* {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --red: #ff1738;
    --red-light: #ff405b;
    --navy: #071326;
    --muted: #9caec8;
    --line: #304766;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px 22px;
    font-family: Arial, Helvetica, sans-serif;
    color: #f7f8ff;
    background:
        linear-gradient(110deg, rgba(3, 9, 20, .52), rgba(4, 11, 24, .37)),
        url("/images/login-background.jpg") center center / cover no-repeat fixed;
}

.login-container {
    width: min(100%, 990px);
    margin: auto;
}

.login-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    width: 100%;
    padding: clamp(34px, 5vw, 68px) clamp(24px, 7vw, 78px) 48px;
    border: 2px solid #ff405b;
    border-radius: 36px;
    background:
        linear-gradient(145deg, rgba(5, 17, 36, .94), rgba(4, 12, 27, .91) 60%, rgba(10, 15, 32, .88));
    box-shadow:
        0 0 10px rgba(255, 23, 56, .62),
        0 0 34px rgba(255, 23, 56, .25),
        0 25px 85px rgba(0, 0, 0, .4),
        inset 0 0 42px rgba(22, 44, 78, .13);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.login-card::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(ellipse at 50% 0%, rgba(34, 57, 92, .22), transparent 60%);
    pointer-events: none;
}

.brand {
    text-align: center;
    margin: 0 auto 48px;
}

.brand-logo {
    width: clamp(125px, 19vw, 190px);
    height: clamp(105px, 15vw, 155px);
    margin: 0 auto 12px;
    filter: drop-shadow(0 8px 13px rgba(255, 23, 56, .22));
}

.brand-logo svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.brand-name {
    font-size: clamp(34px, 5vw, 62px);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -1.8px;
    white-space: nowrap;
    text-shadow: 0 2px 18px rgba(0, 0, 0, .2);
}

.brand-name span {
    color: #ff263f;
}

.brand-caption {
    margin-top: 9px;
    font-size: clamp(13px, 2.4vw, 27px);
    font-weight: 700;
    letter-spacing: clamp(3px, .65vw, 8px);
    white-space: nowrap;
}

.brand-tagline {
    margin-top: 25px;
    color: #a1b0ca;
    font-size: clamp(16px, 2.7vw, 29px);
    letter-spacing: .1px;
}

.brand-tagline i,
.login-footer i {
    color: #ff1738;
    font-style: normal;
    padding: 0 7px;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.field {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    height: clamp(70px, 9vw, 96px);
    border: 2px solid var(--line);
    border-radius: 23px;
    background: rgba(10, 26, 47, .8);
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, .1);
    transition: border-color .2s, box-shadow .2s;
}

.field:focus-within {
    border-color: #ff405b;
    box-shadow: 0 0 0 3px rgba(255, 23, 56, .1), 0 0 18px rgba(255, 23, 56, .08);
}

.field-icon {
    flex: 0 0 auto;
    width: clamp(25px, 3.7vw, 39px);
    height: clamp(25px, 3.7vw, 39px);
    margin-left: clamp(20px, 3vw, 34px);
    color: #f8f9ff;
}

.lock-icon {
    width: clamp(24px, 3.5vw, 36px);
}

.field input {
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 0 22px clamp(0px, .5vw, 6px) clamp(22px, 3vw, 34px);
    border: 0;
    outline: none;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: clamp(18px, 3vw, 34px);
}

.field input::placeholder {
    color: #a0aec5;
    opacity: 1;
}

.password-field input {
    padding-right: 94px;
}

.eye-button {
    position: absolute;
    right: 54px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 42px;
    height: 46px;
    padding: 8px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #f8f9ff;
    cursor: pointer;
}

.eye-button svg {
    width: 100%;
    height: 100%;
}

.eye-button:hover,
.eye-button:focus-visible {
    color: #ff405b;
    outline: none;
}

.remember-row {
    position: relative;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 17px;
    min-height: 34px;
    color: #f0f2f8;
    font-size: clamp(16px, 2.3vw, 25px);
    cursor: pointer;
    user-select: none;
}

.remember-row input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.custom-check {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid #62718a;
    border-radius: 8px;
    background: rgba(10, 26, 47, .9);
    color: white;
}

.custom-check svg {
    display: none;
    width: 24px;
    height: 24px;
}

.remember-row input:checked + .custom-check {
    border-color: #ff1738;
    background: #ff1738;
    box-shadow: 0 0 15px rgba(255, 23, 56, .4);
}

.remember-row input:checked + .custom-check svg {
    display: block;
}

.remember-row input:focus-visible + .custom-check {
    outline: 2px solid white;
    outline-offset: 3px;
}

.login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    width: 100%;
    min-height: clamp(70px, 8.7vw, 96px);
    margin-top: 2px;
    padding: 15px 24px;
    border: 2px solid #ff405b;
    border-radius: 30px;
    background: linear-gradient(100deg, #ff1738, #f7082b);
    color: #fff;
    font-family: inherit;
    font-size: clamp(20px, 3vw, 35px);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(255, 23, 56, .27), inset 0 1px rgba(255, 255, 255, .15);
    transition: transform .15s, box-shadow .2s, filter .2s;
}

.login-button svg {
    width: clamp(27px, 3.7vw, 42px);
    height: clamp(27px, 3.7vw, 42px);
    flex: 0 0 auto;
}

.login-button:hover {
    filter: brightness(1.12);
    box-shadow: 0 0 35px rgba(255, 23, 56, .43);
}

.login-button:active {
    transform: translateY(1px);
}

.login-button:disabled {
    opacity: .7;
    cursor: wait;
}

.login-error {
    min-height: 0;
    margin-top: -12px;
    color: #ff8294;
    font-size: 14px;
    text-align: center;
    overflow-wrap: anywhere;
}

.login-error:not(:empty) {
    min-height: 20px;
}

.login-footer {
    margin-top: 44px;
    padding-top: 32px;
    border-top: 2px solid rgba(48, 71, 102, .72);
    color: #aab8cf;
    text-align: center;
    font-size: clamp(14px, 1.8vw, 22px);
    line-height: 1.65;
}

.login-footer p {
    margin: 4px 0 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Conserva el estilo del botón de salida del dashboard si comparte esta hoja. */
.logout-btn {
    border: 1px solid #7f1d1d;
    background: #3b1115;
    color: #fca5a5;
}

.logout-btn:hover {
    border-color: #ef4444;
    background: #7f1d1d;
    color: #fff;
}

@media (min-width: 1200px) and (min-height: 900px) {
    .login-container {
        width: min(100%, 1000px);
    }
}

@media (max-width: 600px) {
    body {
        padding: 18px 12px;
        background-attachment: scroll;
    }

    .login-card {
        padding: 32px 20px 27px;
        border-radius: 23px;
    }

    .brand {
        margin-bottom: 30px;
    }

    .brand-logo {
        width: 112px;
        height: 95px;
    }

    .brand-name {
        font-size: clamp(29px, 7vw, 38px);
        letter-spacing: -1.3px;
    }

    .brand-caption {
        font-size: clamp(10px, 2.8vw, 14px);
        letter-spacing: 2.4px;
    }

    .brand-tagline {
        margin-top: 17px;
        font-size: 16px;
    }

    #login-form {
        gap: 17px;
    }

    .field {
        height: 64px;
        border-radius: 15px;
    }

    .field-icon {
        width: 25px;
        height: 25px;
        margin-left: 16px;
    }

    .field input {
        padding-left: 16px;
        font-size: 17px;
    }

    .password-field input {
        padding-right: 88px;
    }

    .eye-button {
        right: 45px;
        width: 34px;
        height: 38px;
    }

    .remember-row {
        gap: 12px;
        font-size: 16px;
    }

    .custom-check {
        width: 29px;
        height: 29px;
        flex-basis: 29px;
    }

    .login-button {
        min-height: 62px;
        border-radius: 20px;
        font-size: 19px;
        gap: 14px;
    }

    .login-footer {
        margin-top: 29px;
        padding-top: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
    }
}


/* AJUSTE DE TAMAÑO: LOGIN COMPACTO */
@media (min-width: 601px) {
    body {
        padding: 12px 20px;
    }

    .login-container {
        width: min(100%, 760px);
    }

    .login-card {
        padding: 24px 54px 20px;
        border-radius: 24px;
    }

    .brand {
        margin-bottom: 24px;
    }

    .brand-logo {
        width: 100px;
        height: 78px;
        margin-bottom: 5px;
    }

    .brand-name {
        font-size: 38px;
        letter-spacing: -1px;
    }

    .brand-caption {
        margin-top: 5px;
        font-size: 15px;
        letter-spacing: 4px;
    }

    .brand-tagline {
        margin-top: 12px;
        font-size: 18px;
    }

    #login-form {
        gap: 15px;
    }

    .field {
        height: 58px;
        border-radius: 14px;
    }

    .field-icon {
        width: 25px;
        height: 25px;
        margin-left: 22px;
    }

    .field input {
        padding-left: 20px;
        font-size: 20px;
    }

    .password-field input {
        padding-right: 90px;
    }

    .eye-button {
        right: 48px;
        width: 36px;
        height: 40px;
    }

    .remember-row {
        gap: 12px;
        min-height: 28px;
        font-size: 16px;
    }

    .custom-check {
        width: 26px;
        height: 26px;
        flex-basis: 26px;
    }

    .custom-check svg {
        width: 20px;
        height: 20px;
    }

    .login-button {
        min-height: 60px;
        border-radius: 17px;
        font-size: 21px;
        gap: 14px;
    }

    .login-button svg {
        width: 27px;
        height: 27px;
    }

    .login-error {
        font-size: 12px;
    }

    .login-footer {
        margin-top: 22px;
        padding-top: 15px;
        font-size: 14px;
        line-height: 1.5;
    }
}

@media (min-width: 601px) and (max-height: 850px) {
    .login-card {
        padding-top: 17px;
        padding-bottom: 15px;
    }

    .brand {
        margin-bottom: 17px;
    }

    .brand-logo {
        width: 80px;
        height: 62px;
    }

    .brand-tagline {
        margin-top: 8px;
    }

    #login-form {
        gap: 11px;
    }

    .field {
        height: 52px;
    }

    .login-button {
        min-height: 52px;
    }

    .login-footer {
        margin-top: 15px;
        padding-top: 10px;
    }
}


/* AJUSTE FINAL: PANEL MÁS ESTRECHO */
@media (min-width: 601px) {
    .login-container {
        width: 100%;
        max-width: 600px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .login-card {
        width: 100%;
        padding-left: 34px;
        padding-right: 34px;
    }
}

@media (max-width: 600px) {
    .login-container {
        max-width: 430px;
    }
}


/* CORRECCIÓN: LOGIN MÁS COMPACTO */
.login-container {
    width: 100% !important;
    max-width: revert !important;
    margin: 0 auto !important;
}

.login-card {
    width: 100% !important;
    padding-left: 28px !important;
    padding-right: 28px !important;
}

@media (max-width: 520px) {
    .login-container {
        max-width: 100% !important;
        padding: 14px !important;
    }

    .login-card {
        padding-left: 22px !important;
        padding-right: 22px !important;
    }
}


/* Ajustar el ojo al borde derecho del campo */
.password-wrapper .eye-button {
    right: 12px !important;
    left: auto !important;
    z-index: 5;
}


/* CORRECCIÓN DEFINITIVA: OJO PEGADO A LA DERECHA */
.password-field {
    position: relative !important;
}

.password-field .eye-button {
    position: absolute !important;
    right: 8px !important;
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 7px !important;
    z-index: 10 !important;
}

.password-field input {
    padding-right: 58px !important;
}


/* Ajuste fino: un poco más ancho y alto */
@media (min-width: 601px) {
    .login-container {
        max-width: 520px !important;
    }

    .login-card {
        padding-left: 36px !important;
        padding-right: 36px !important;
        padding-top: 26px !important;
        padding-bottom: 24px !important;
    }

    .brand {
        margin-bottom: 20px !important;
    }

    #login-form {
        gap: 13px !important;
    }

    .field {
        height: 56px !important;
    }

    .login-button {
        min-height: 56px !important;
    }

    .login-footer {
        margin-top: 19px !important;
        padding-top: 13px !important;
    }
}


/* HOST CONTROL: contenido interior más compacto */
@media (min-width: 601px) {
    .brand {
        margin-bottom: 24px !important;
    }

    .brand-logo {
        width: 115px !important;
        height: 90px !important;
        margin-bottom: 7px !important;
    }

    .brand-name {
        font-size: 38px !important;
        letter-spacing: -1px !important;
    }

    .brand-caption {
        margin-top: 5px !important;
        font-size: 15px !important;
        letter-spacing: 4px !important;
    }

    .brand-tagline {
        margin-top: 12px !important;
        font-size: 18px !important;
    }

    #login-form {
        gap: 15px !important;
    }

    .field {
        height: 48px !important;
        border-radius: 14px !important;
    }

    .field-icon {
        width: 22px !important;
        height: 22px !important;
    }

    .field input {
        font-size: 17px !important;
    }

    .remember-row {
        font-size: 14px !important;
        min-height: 24px !important;
    }

    .custom-check {
        width: 22px !important;
        height: 22px !important;
        flex-basis: 22px !important;
    }

    .login-button {
        min-height: 48px !important;
        border-radius: 15px !important;
        font-size: 17px !important;
        gap: 10px !important;
        padding: 10px 18px !important;
    }

    .login-button svg {
        width: 22px !important;
        height: 22px !important;
    }

    .login-footer {
        margin-top: 20px !important;
        padding-top: 13px !important;
        font-size: 12px !important;
        line-height: 1.5 !important;
    }
}


/* AJUSTE DE TAMANO: SOLO ELEMENTOS INTERIORES */
@media screen and (min-width: 601px) {
    .login-card .brand-logo {
        width: 85px !important;
        height: 68px !important;
        margin-bottom: 4px !important;
    }

    .login-card .brand-name {
        font-size: 30px !important;
        letter-spacing: -0.5px !important;
    }

    .login-card .brand-caption {
        margin-top: 4px !important;
        font-size: 12px !important;
        letter-spacing: 2px !important;
    }

    .login-card .brand-tagline {
        margin-top: 8px !important;
        font-size: 14px !important;
    }

    .login-card .brand {
        margin-bottom: 18px !important;
    }

    .login-card #login-form {
        gap: 10px !important;
    }

    .login-card #login-form .field {
        height: 44px !important;
        min-height: 44px !important;
        border-radius: 12px !important;
    }

    .login-card #login-form .field-icon {
        width: 20px !important;
        height: 20px !important;
    }

    .login-card #login-form .field input {
        font-size: 15px !important;
    }

    .login-card .remember-row {
        font-size: 13px !important;
        min-height: 20px !important;
    }

    .login-card .custom-check {
        width: 18px !important;
        height: 18px !important;
        flex-basis: 18px !important;
    }

    .login-card #login-form .login-button {
        min-height: 44px !important;
        height: 44px !important;
        padding: 8px 14px !important;
        font-size: 15px !important;
        border-radius: 12px !important;
        gap: 8px !important;
    }

    .login-card .login-button svg {
        width: 19px !important;
        height: 19px !important;
    }

    .login-card .login-footer {
        margin-top: 14px !important;
        padding-top: 10px !important;
        font-size: 11px !important;
    }
}


/* AJUSTE FINAL: TARJETA MAS ANGOSTA Y ALTA */
@media screen and (min-width: 601px) {
    .login-container {
        max-width: revert !important;
    }

    .login-card {
        min-height: unset !important;
        padding-top: revert !important;
        padding-bottom: revert !important;
    }
}


/* AJUSTE FINAL: TARJETA MAS ANGOSTA Y ALTA */
@media screen and (min-width: 601px) {
    .login-container {
        max-width: 440px !important;
    }

    .login-card {
        min-height: 620px !important;
        padding-top: 38px !important;
        padding-bottom: 32px !important;
    }
}

/* Reducir un poco la altura del panel */
@media screen and (min-width: 601px) {
    .login-card {
        padding-top: 24px !important;
        padding-bottom: 20px !important;
    }
}

/* Ajuste efectivo de altura del panel */
@media screen and (min-width: 601px) {
    .login-container .login-card {
        min-height: 0 !important;
        height: auto !important;
        padding-top: 18px !important;
        padding-bottom: 14px !important;
    }
}

/* Recuperar un poco de altura */
@media screen and (min-width: 601px) {
    .login-container .login-card {
        padding-top: 30px !important;
        padding-bottom: 26px !important;
    }
}

/* Recuperar un poco de altura */
@media screen and (min-width: 601px) {
    .login-container .login-card {
        padding-top: 30px !important;
        padding-bottom: 30px !important;
    }
}

/* Recuperar un poco de altura */
@media screen and (min-width: 601px) {
    .login-container .login-card {
        padding-top: 30px !important;
        padding-bottom: 45px !important;
    }
}


/* Login: efecto translúcido sutil, sin cambiar dimensiones */
.login-container .login-card {
    background: rgba(15, 23, 42, 0.82) !important;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
}

/* Restaurar el aro rojo del login */
.login-container .login-card {
    border: 1px solid rgba(255, 55, 75, 0.85) !important;
    box-shadow:
        0 0 0 1px rgba(255, 55, 75, 0.20),
        0 0 18px rgba(255, 35, 60, 0.18),
        0 8px 32px rgba(0, 0, 0, 0.22) !important;
}

/* Intensificar solo el brillo rojo del contorno */
.login-container .login-card {
    border: 1px solid rgba(255, 35, 60, 0.95) !important;
    box-shadow:
        0 0 0 1px rgba(255, 35, 60, 0.35),
        0 0 12px rgba(255, 35, 60, 0.35),
        0 0 24px rgba(255, 35, 60, 0.22),
        0 8px 32px rgba(0, 0, 0, 0.22) !important;
}

/* Mas transparencia solo en el fondo del cuadro */
.login-container .login-card {
    background: rgba(15, 23, 42, 0.48) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
