*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --font: var(--app-font);
}

html, body {
    height: 100%;
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background:
        radial-gradient(ellipse at 20% 50%, color-mix(in srgb, var(--primary) 18%, transparent) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 15%, color-mix(in srgb, var(--primary) 10%, transparent) 0%, transparent 45%),
        radial-gradient(ellipse at 70% 90%, color-mix(in srgb, var(--primary) 8%, transparent) 0%, transparent 40%),
        #eef0f8;
}
body.dark-theme {
    background:
        radial-gradient(ellipse at 20% 50%, color-mix(in srgb, var(--primary) 14%, transparent) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 15%, color-mix(in srgb, var(--primary) 8%, transparent) 0%, transparent 45%),
        radial-gradient(ellipse at 70% 90%, color-mix(in srgb, var(--primary) 6%, transparent) 0%, transparent 40%),
        hsl(228,24%,10%);
}

/* ═══════════════════════════════════════════════
   CARD WRAPPER
═══════════════════════════════════════════════ */
.login-card {
    display: flex;
    width: 100%;
    max-width: 980px;
    min-height: 580px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow:
        0 2px  4px  rgba(0,0,0,.04),
        0 8px  24px rgba(0,0,0,.10),
        0 32px 80px rgba(0,0,0,.15);
    animation: cardIn .5s cubic-bezier(.22,1,.36,1) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px) scale(.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ═══════════════════════════════════════════════
   BRAND PANEL (LEFT)
═══════════════════════════════════════════════ */
.login-brand {
    flex: 1.1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 3rem;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--primary) 30%, #0d1b2e) 0%,
        color-mix(in srgb, var(--primary) 45%, #162c45) 55%,
        color-mix(in srgb, var(--primary) 55%, #1a3554) 100%);
    color: #fff;
    text-align: center;
}

.login-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 75% 20%, rgba(255,255,255,.14) 0%, transparent 45%),
        radial-gradient(circle at 20% 85%, rgba(255,255,255,.08) 0%, transparent 40%);
    pointer-events: none;
}

.b-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.13);
    pointer-events: none;
}
.b-ring-1 { width: 380px; height: 380px; top: -130px; right: -120px; }
.b-ring-2 { width: 260px; height: 260px; bottom: -90px;  left:  -80px; }
.b-ring-3 { width: 180px; height: 180px; top:   40%;  right: -50px; opacity: .6; }

.b-deco {
    position: absolute;
    color: rgba(255,255,255,.10);
    pointer-events: none;
    line-height: 1;
}
.b-deco-1 { font-size: 6rem;  top:  6%; right:  6%; transform: rotate(-20deg); }
.b-deco-2 { font-size: 2.8rem; bottom: 22%; left:  6%; transform: rotate(10deg); }
.b-deco-3 { font-size: 2rem;  top:  45%; right: 12%; }
.b-deco-4 { font-size: 4rem;  bottom:  5%; right: 8%; transform: rotate(25deg); }
.b-deco-5 { font-size: 2.2rem; top: 18%; left: 8%; transform: rotate(-12deg); }

.brand-body {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-ring-outer {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.75rem;
    animation: pulse-ring 3s ease-out infinite;
    box-shadow:
        0 0 0 0   rgba(255,255,255,.25),
        0 8px 32px rgba(0,0,0,.25);
}
.logo-ring-inner {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: flex;
    align-items: center;
    justify-content: center;
}
.logo-ring-inner img {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 50%;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,.25));
}
.logo-ring-inner i {
    font-size: 2rem;
    color: #fff;
    font-weight: 400;
}

@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0  0   rgba(255,255,255,.25), 0 8px 32px rgba(0,0,0,.25); }
    50%  { box-shadow: 0 0 0 14px rgba(255,255,255,.0),  0 8px 32px rgba(0,0,0,.25); }
    100% { box-shadow: 0 0 0  0   rgba(255,255,255,.0),  0 8px 32px rgba(0,0,0,.25); }
}

.brand-name {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.2;
    text-shadow: 0 2px 12px rgba(0,0,0,.2);
    margin-bottom: .75rem;
}

.brand-divider {
    width: 40px;
    height: 3px;
    background: rgba(255,255,255,.45);
    border-radius: 2px;
    margin: 0 auto .75rem;
}

.brand-slogan {
    font-size: .875rem;
    opacity: .78;
    max-width: 240px;
    line-height: 1.7;
}

.brand-badges {
    display: flex;
    gap: .5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}
.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 20px;
    padding: .3rem .75rem;
    font-size: .72rem;
    font-weight: 400;
}
.brand-badge i { font-size: .85rem; font-weight: 400; }

/* ═══════════════════════════════════════════════
   FORM PANEL (RIGHT)
═══════════════════════════════════════════════ */
.login-panel {
    flex: none;
    width: 420px;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3.5rem 3rem;
    position: relative;
}
body.dark-theme .login-panel { background: hsl(228,24%,12%); }

.login-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(0,0,0,.035) 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
    z-index: 0;
}
body.dark-theme .login-panel::after {
    background-image: radial-gradient(circle, rgba(255,255,255,.04) 1px, transparent 1px);
}

/* ── Botón de cambio de tema — ícono fantasma, igual que .header__action-btn ── */
.login-theme-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 2;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    transition: background .15s, color .15s;
}
.login-theme-btn i { font-weight: 400; }
.login-theme-btn:hover { background: #f3f4f6; color: var(--primary); }
body.dark-theme .login-theme-btn { color: hsl(228,12%,62%); }
body.dark-theme .login-theme-btn:hover { background: rgba(255,255,255,.08); color: var(--primary); }

.form-inner {
    position: relative;
    z-index: 1;
}

.form-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--primary);
    margin-bottom: .6rem;
}
.form-eyebrow::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: -.02em;
    margin-bottom: 2rem;
}
body.dark-theme .form-title { color: hsl(228,18%,92%); }

.form-subtitle {
    font-size: .855rem;
    color: #9ca3af;
    margin-bottom: 2rem;
}
body.dark-theme .form-subtitle { color: hsl(228,12%,58%); }

.field { margin-bottom: 1.4rem; }

.field label {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    color: hsl(228, 18%, 42%);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: .4rem;
}
body.dark-theme .field label { color: hsl(228,12%,62%); }

.field-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.field-icon {
    position: absolute;
    left: .9rem;
    font-size: 1.1rem;
    font-weight: 400;
    color: #c4c9d4;
    pointer-events: none;
    transition: color .2s;
    z-index: 1;
}
body.dark-theme .field-icon { color: hsl(228,12%,50%); }

.field-wrap input {
    width: 100%;
    padding: .78rem 2.8rem;
    font-size: .9rem;
    font-family: var(--font);
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
    color: #111827;
    background: #f9fafb;
    background-clip: padding-box;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
body.dark-theme .field-wrap input {
    border-color: hsl(228,24%,28%);
    color: hsl(228,18%,92%);
    background: hsl(228,24%,14%);
}

.field-wrap input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px var(--primary-soft);
}
body.dark-theme .field-wrap input:focus { background: hsl(228,24%,16%); }

.field-wrap input:focus ~ .field-icon,
.field-wrap:focus-within .field-icon { color: var(--primary); }

.field-wrap input::placeholder { color: #c9cdd6; }
body.dark-theme .field-wrap input::placeholder { color: hsl(228,12%,45%); }

/* Autofill del navegador ignora "background" normal — fuerza su propio fondo
   claro (amarillo/celeste) salvo que se sobreescriba con box-shadow inset. */
.field-wrap input:-webkit-autofill,
.field-wrap input:-webkit-autofill:hover,
.field-wrap input:-webkit-autofill:focus {
    -webkit-text-fill-color: #111827;
    -webkit-box-shadow: 0 0 1px 1000px #f9fafb inset;
    background-clip: padding-box;
    transition: background-color 9999s ease-in-out 0s;
}
body.dark-theme .field-wrap input:-webkit-autofill,
body.dark-theme .field-wrap input:-webkit-autofill:hover,
body.dark-theme .field-wrap input:-webkit-autofill:focus {
    -webkit-text-fill-color: hsl(228,18%,92%);
    -webkit-box-shadow: 0 0 1px 1000px hsl(228,24%,14%) inset;
}

.field-wrap select {
    width: 100%;
    padding: .78rem 2.8rem;
    font-size: .9rem;
    font-family: var(--font);
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
    color: #111827;
    background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 1rem center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color .2s, background-color .2s, box-shadow .2s;
}
body.dark-theme .field-wrap select {
    border-color: hsl(228,24%,28%);
    color: hsl(228,18%,92%);
    background-color: hsl(228,24%,14%);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

.field-wrap select:focus {
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px var(--primary-soft);
}
body.dark-theme .field-wrap select:focus { background-color: hsl(228,24%,16%); }

.field-hint {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    font-size: .74rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: .38rem;
    padding-left: .25rem;
    opacity: .85;
}
.field-hint i { font-size: .78rem; }

.btn-toggle-pass {
    position: absolute;
    right: .8rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #c4c9d4;
    font-size: 1.1rem;
    padding: .2rem;
    display: flex;
    align-items: center;
    transition: color .15s;
    z-index: 1;
}
.btn-toggle-pass:hover { color: #6b7280; }
body.dark-theme .btn-toggle-pass { color: hsl(228,12%,50%); }
body.dark-theme .btn-toggle-pass:hover { color: hsl(228,18%,80%); }

.login-error {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 1rem;
}
.login-error.hidden { display: none; }
body.dark-theme .login-error { color: #f87171; }

.login-btn {
    width: 100%;
    padding: .85rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: .95rem;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    letter-spacing: .02em;
    margin-top: .5rem;
    transition: opacity .2s, transform .1s, box-shadow .2s;
    box-shadow: 0 4px 16px var(--primary-glow);
}
.login-btn:hover  { opacity: .9; box-shadow: 0 8px 24px var(--primary-glow); }
.login-btn:active { transform: scale(.98); }
.login-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.login-copy {
    margin-top: 2rem;
    font-size: .72rem;
    color: #c4c9d4;
    text-align: center;
}
body.dark-theme .login-copy { color: hsl(228,12%,45%); }

/* ═══════════════════════════════════════════════
   RECORDARME + OLVIDÉ CONTRASEÑA
═══════════════════════════════════════════════ */
.login-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: .3rem 0 1.5rem;
}

.check-label {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .82rem;
    color: #6b7280;
    user-select: none;
}
body.dark-theme .check-label { color: hsl(228,12%,62%); }

.check-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.check-box {
    width: 17px;
    height: 17px;
    border: 1.5px solid #d1d5db;
    border-radius: 4px;
    background: #f9fafb;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s, background .15s;
    position: relative;
}
body.dark-theme .check-box { border-color: hsl(228,24%,30%); background: hsl(228,24%,14%); }

.check-box::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
    opacity: 0;
    transition: opacity .15s;
}

.check-label input:checked ~ .check-box {
    background: var(--primary);
    border-color: var(--primary);
}

.check-label input:checked ~ .check-box::after {
    opacity: 1;
}

.check-label:hover .check-box {
    border-color: var(--primary);
}

.forgot-link {
    font-size: .82rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    transition: opacity .15s;
}
.forgot-link:hover { opacity: .75; text-decoration: underline; }

/* ═══════════════════════════════════════════════
   ERROR INLINE CAMPO FORGOT
═══════════════════════════════════════════════ */
.forgot-field-err {
    display: block;
    font-size: .78rem;
    color: #dc2626;
    margin-top: .3rem;
    min-height: 1em;
}
body.dark-theme .forgot-field-err { color: #f87171; }

/* ═══════════════════════════════════════════════
   MODAL OLVIDÉ CONTRASEÑA
═══════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}

.modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #fff;
    border-radius: 18px;
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow:
        0 4px 16px rgba(0,0,0,.10),
        0 24px 64px rgba(0,0,0,.18);
    transform: translateY(12px) scale(.97);
    transition: transform .25s cubic-bezier(.22,1,.36,1);
}
body.dark-theme .modal-card { background: hsl(228,24%,18%); }

.modal-overlay.is-open .modal-card {
    transform: translateY(0) scale(1);
}

.modal-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.modal-hdr__left {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: var(--primary);
    font-size: 1.25rem;
}

.modal-hdr__left h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}
body.dark-theme .modal-hdr__left h3 { color: hsl(228,18%,92%); }

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 1.25rem;
    padding: .25rem;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: background .15s, color .15s;
    line-height: 1;
}
.modal-close:hover { background: #f3f4f6; color: #374151; }
.modal-close i { font-weight: 400; }
body.dark-theme .modal-close { color: hsl(228,12%,58%); }
body.dark-theme .modal-close:hover { background: hsl(228,24%,24%); color: hsl(228,18%,92%); }

.modal-desc {
    font-size: .855rem;
    color: #6b7280;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}
body.dark-theme .modal-desc { color: hsl(228,12%,58%); }

.modal-hint {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    font-size: .78rem;
    color: #9ca3af;
    line-height: 1.5;
    margin: -.25rem 0 1rem;
}
body.dark-theme .modal-hint { color: hsl(228,12%,55%); }
.modal-hint i { flex-shrink: 0; margin-top: .1rem; }

/* ═══════════════════════════════════════════════
   ESTADO INVÁLIDO EN RESET_PASSWORD
═══════════════════════════════════════════════ */
.reset-invalid {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    border-radius: 10px;
    padding: 1rem;
    color: #b91c1c;
    font-size: .85rem;
    line-height: 1.5;
}
.reset-invalid i {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: .1rem;
    font-weight: 400;
}
.reset-invalid p { margin: .25rem 0 0; color: #991b1b; font-weight: 400; }
body.dark-theme .reset-invalid {
    background: hsl(0,45%,16%);
    border-color: hsl(0,45%,28%);
    border-left-color: #ef4444;
    color: hsl(0,85%,80%);
}
body.dark-theme .reset-invalid p { color: hsl(0,70%,75%); }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 820px) {
    body { padding: 0; align-items: stretch; background: #fff; }
    body.dark-theme { background: hsl(228,24%,10%); }

    .login-card {
        flex-direction: column;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
        /* En escritorio "overflow: hidden" recorta las esquinas redondeadas,
           pero acá (radius 0) solo servía para tapar el formulario cuando no
           entraba completo en 100vh — con esto la página puede scrollear
           para ver el resto en vez de cortarlo. */
        overflow: visible;
        animation: none;
    }

    .login-brand {
        flex: none;
        padding: 2.5rem 2rem;
    }
    .logo-ring-outer   { width: 80px; height: 80px; margin-bottom: 1.25rem; }
    .logo-ring-inner   { width: 58px; height: 58px; }
    .logo-ring-inner img { width: 40px; height: 40px; }
    .logo-ring-inner i { font-size: 1.5rem; }
    .brand-name        { font-size: 1.4rem; }
    .brand-slogan      { font-size: .82rem; }
    .b-deco-1          { font-size: 4rem; }
    .b-deco-4          { display: none; }

    .login-panel {
        width: 100%;
        padding: 2.5rem 1.75rem 2rem;
        flex: 1;
    }

    .brand-badges { display: none; }
}
