:root {
    --bg:#050807;
    --card:#101613;
    --card2:#151d19;
    --border:rgba(255,255,255,.08);
    --green:#36e66b;
    --green-soft:rgba(54,230,107,.11);
    --text:#fff;
    --soft:#929b97;
}

* { box-sizing:border-box; }

html,
body {
    margin:0;
    min-height:100%;
    background:
        radial-gradient(circle at 50% -8%,rgba(54,230,107,.11),transparent 31%),
        var(--bg);
    color:var(--text);
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
}

body {
    min-height:100dvh;
}

button,
input {
    font:inherit;
}

.access-shell {
    width:min(100%,480px);
    min-height:100dvh;
    margin:0 auto;
    display:flex;
    flex-direction:column;
    justify-content:center;
    padding:
        calc(20px + env(safe-area-inset-top))
        15px
        calc(20px + env(safe-area-inset-bottom));
}

.brand-panel {
    text-align:center;
    margin-bottom:14px;
}

.brand-mark {
    width:64px;
    height:64px;
    display:grid;
    place-items:center;
    margin:0 auto 9px;
    border:1px solid rgba(54,230,107,.28);
    border-radius:19px;
    background:var(--green-soft);
    color:var(--green);
    font-size:30px;
    font-weight:950;
    box-shadow:0 0 28px rgba(54,230,107,.08);
}

.brand-panel > span {
    color:var(--green);
    font-size:12px;
    font-weight:900;
    letter-spacing:1px;
}

.brand-panel h1 {
    margin:3px 0 5px;
    font-size:31px;
    letter-spacing:2px;
}

.brand-panel p {
    max-width:370px;
    margin:0 auto;
    color:var(--soft);
    font-size:12px;
    line-height:1.45;
}

.login-card {
    padding:17px;
    border:1px solid rgba(54,230,107,.12);
    border-radius:20px;
    background:linear-gradient(145deg,var(--card2),var(--card));
    box-shadow:0 18px 55px rgba(0,0,0,.32);
}

.card-heading {
    margin-bottom:12px;
}

.card-heading > span {
    color:var(--green);
    font-size:12px;
    font-weight:900;
    letter-spacing:.8px;
}

.card-heading h2 {
    margin:3px 0;
    font-size:20px;
}

.card-heading p {
    margin:0;
    color:var(--soft);
    font-size:12px;
}

.field {
    display:block;
    margin-bottom:10px;
}

.field > span {
    display:block;
    margin-bottom:5px;
    color:var(--soft);
    font-size:12px;
}

.field input {
    width:100%;
    height:47px;
    padding:0 11px;
    border:1px solid var(--border);
    outline:0;
    border-radius:11px;
    background:#0a0f0c;
    color:white;
    font-size:12px;
}

.field input:focus {
    border-color:rgba(54,230,107,.35);
    box-shadow:0 0 0 3px rgba(54,230,107,.05);
}

.password-field {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    border:1px solid var(--border);
    border-radius:11px;
    background:#0a0f0c;
    overflow:hidden;
}

.password-field input {
    border:0;
    border-radius:0;
}

.password-field button {
    min-width:54px;
    border:0;
    border-left:1px solid var(--border);
    background:rgba(54,230,107,.04);
    color:var(--green);
    font-size:12px;
    font-weight:850;
}

.login-button,
.register-button {
    width:100%;
    min-height:48px;
    border-radius:11px;
    cursor:pointer;
}

.login-button {
    border:0;
    background:linear-gradient(145deg,#49ef7d,#22bd54);
    color:#041007;
    font-weight:900;
}

.register-button {
    border:1px solid rgba(54,230,107,.18);
    background:var(--green-soft);
    color:var(--green);
    font-size:12px;
    font-weight:850;
}

.divider {
    display:grid;
    grid-template-columns:1fr auto 1fr;
    gap:8px;
    align-items:center;
    margin:12px 0;
    color:#5f6864;
    font-size:12px;
}

.divider::before,
.divider::after {
    content:"";
    height:1px;
    background:rgba(255,255,255,.06);
}

.legacy-access {
    display:none;
    grid-template-columns:minmax(0,1fr) auto;
    gap:8px;
    align-items:center;
    padding:9px;
    margin-top:10px;
    border:1px solid rgba(255,152,82,.13);
    border-radius:10px;
    background:rgba(255,152,82,.04);
}

.legacy-access.visible {
    display:grid;
}

.legacy-access span,
.legacy-access strong,
.legacy-access small {
    display:block;
}

.legacy-access span {
    color:#ffb17b;
    font-size:12px;
    font-weight:900;
}

.legacy-access strong {
    margin:2px 0;
    font-size:12px;
}

.legacy-access small {
    color:var(--soft);
    font-size:12px;
}

.legacy-access button {
    min-height:34px;
    padding:0 10px;
    border:0;
    border-radius:9px;
    background:#ff9b58;
    color:#1a0b02;
    font-size:12px;
    font-weight:900;
}

.security-note {
    margin:11px 0 0;
    color:#727b77;
    font-size:12px;
    line-height:1.4;
    text-align:center;
}

.toast {
    position:fixed;
    z-index:500;
    left:50%;
    bottom:calc(16px + env(safe-area-inset-bottom));
    max-width:calc(100% - 30px);
    padding:9px 13px;
    opacity:0;
    visibility:hidden;
    transform:translate(-50%,10px);
    border:1px solid rgba(54,230,107,.2);
    border-radius:999px;
    background:#111814;
    color:white;
    font-size:12px;
    transition:.2s ease;
}

.toast.show {
    opacity:1;
    visibility:visible;
    transform:translate(-50%,0);
}


/* =========================================================
   PASO 30 — ACCESO LEGIBLE Y COMPACTO
========================================================= */
.access-shell {
    justify-content:center;
    padding:
        calc(10px + env(safe-area-inset-top))
        13px
        calc(12px + env(safe-area-inset-bottom));
}

.brand-panel {
    margin-bottom:9px;
}

.brand-mark {
    width:54px;
    height:54px;
    margin-bottom:6px;
    border-radius:16px;
    font-size:26px;
}

.brand-panel > span {
    font-size:12px;
}

.brand-panel h1 {
    margin:2px 0 3px;
    font-size:28px;
}

.brand-panel p {
    max-width:400px;
    font-size:12px;
    line-height:1.35;
}

.login-card {
    padding:14px;
    border-radius:17px;
}

.card-heading {
    margin-bottom:9px;
}

.card-heading > span {
    font-size:12px;
}

.card-heading h2 {
    margin:2px 0;
    font-size:20px;
}

.card-heading p {
    font-size:12px;
}

.field {
    margin-bottom:8px;
}

.field > span {
    margin-bottom:4px;
    font-size:12px;
}

.field input {
    height:44px;
    font-size:14px;
}

.password-field button {
    min-width:62px;
    font-size:12px;
}

.login-button,
.register-button {
    min-height:44px;
    font-size:13px;
}

.divider {
    margin:9px 0;
    font-size:12px;
}

.legacy-access {
    margin-top:8px;
    padding:8px 9px;
}

.legacy-access span {
    font-size:12px;
}

.legacy-access strong {
    font-size:12px;
}

.legacy-access small {
    font-size:12px;
}

.legacy-access button {
    min-height:36px;
    font-size:12px;
}

.security-note {
    margin-top:8px;
    font-size:12px;
    line-height:1.35;
}

@media (max-height:720px) {
    .access-shell {
        justify-content:flex-start;
    }

    .brand-panel {
        margin-bottom:6px;
    }

    .brand-mark {
        width:47px;
        height:47px;
        font-size:23px;
    }

    .brand-panel h1 {
        font-size:24px;
    }

    .brand-panel p {
        font-size:12px;
    }

    .login-card {
        padding:12px;
    }

    .field {
        margin-bottom:6px;
    }

    .field input {
        height:42px;
    }

    .login-button,
    .register-button {
        min-height:42px;
    }
}


/* PASO 32 — acceso sin logo gráfico */
.brand-panel {
    margin-bottom:10px !important;
}

.brand-panel h1 {
    margin-top:0 !important;
}


/* =========================================================
   AUDITORÍA FINAL — RECUPERACIÓN PORTÁTIL DE CUENTA
========================================================= */
.restore-account-button {
    width:100%;
    min-height:42px;
    margin-top:7px;
    border:1px solid rgba(255,255,255,.08);
    border-radius:11px;
    background:#0b100d;
    color:#d5ddd9;
    font-size:12px;
    font-weight:800;
    cursor:pointer;
}

.restore-account-modal {
    position:fixed;
    z-index:800;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:14px;
    opacity:0;
    visibility:hidden;
    background:rgba(0,0,0,.78);
    backdrop-filter:blur(8px);
    transition:.18s ease;
}

.restore-account-modal.open {
    opacity:1;
    visibility:visible;
}

.restore-account-card {
    width:min(100%,460px);
    max-height:calc(100dvh - 28px);
    overflow:auto;
    padding:14px;
    border:1px solid rgba(54,230,107,.16);
    border-radius:17px;
    background:linear-gradient(145deg,#151d19,#0b100d);
}

.restore-account-header {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    margin-bottom:8px;
}

.restore-account-header span,
.restore-account-header strong {
    display:block;
}

.restore-account-header span {
    color:var(--green);
    font-size:12px;
    font-weight:900;
    letter-spacing:.7px;
}

.restore-account-header strong {
    margin-top:2px;
    font-size:15px;
}

#closeRestoreAccountButton {
    width:36px;
    height:36px;
    border:1px solid var(--border);
    border-radius:10px;
    background:#0a0f0c;
    color:white;
    font-size:20px;
}

.restore-account-help {
    margin:0 0 9px;
    color:var(--soft);
    font-size:12px;
    line-height:1.45;
}

.restore-file-zone {
    min-height:76px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    gap:3px;
    padding:10px;
    border:1px dashed rgba(54,230,107,.25);
    border-radius:11px;
    background:rgba(54,230,107,.025);
    text-align:center;
    cursor:pointer;
}

.restore-file-zone input { display:none; }
.restore-file-zone strong { font-size:12px; }
.restore-file-zone small { color:var(--soft); font-size:12px; }

.restore-account-preview {
    display:none;
    padding:9px;
    margin-top:8px;
    border:1px solid rgba(54,230,107,.10);
    border-radius:10px;
    background:rgba(54,230,107,.025);
}

.restore-account-preview.visible { display:block; }
.restore-account-preview span,
.restore-account-preview strong,
.restore-account-preview small { display:block; }
.restore-account-preview span { color:var(--green); font-size:12px; font-weight:900; }
.restore-account-preview strong { margin:2px 0; font-size:12px; }
.restore-account-preview small { color:var(--soft); font-size:12px; }

.restore-password-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:7px;
    margin-top:8px;
}

.restore-password-grid .field { margin:0; }

.restore-confirm-button {
    width:100%;
    min-height:45px;
    margin-top:9px;
    border:0;
    border-radius:10px;
    background:linear-gradient(145deg,#49ef7d,#22bd54);
    color:#041007;
    font-size:12px;
    font-weight:900;
    cursor:pointer;
}

.restore-confirm-button:disabled {
    opacity:.45;
    cursor:not-allowed;
}

@media (max-width:400px) {
    .restore-password-grid { grid-template-columns:1fr; }
}


/* PASO 39 — entrada estable en móvil */
.access-shell { min-height:100svh !important; }
@supports (height:100dvh) { .access-shell { min-height:100dvh !important; } }
.login-card input { font-size:16px !important; }
.restore-account-card input { font-size:16px !important; }


/* PASO 59 — recuperación y confirmación */
.forgot-password-button{width:100%;min-height:42px;margin-top:3px;border:0;background:transparent;color:var(--green);font-size:12px;font-weight:800;cursor:pointer}.confirmation-notice{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;margin-top:8px;padding:9px;border:1px solid rgba(54,230,107,.13);border-radius:10px;background:rgba(54,230,107,.035)}.confirmation-notice[hidden]{display:none!important}.confirmation-notice strong,.confirmation-notice small{display:block}.confirmation-notice strong{font-size:12px;color:#fff}.confirmation-notice small{margin-top:2px;color:var(--soft);font-size:12px;line-height:1.35}.confirmation-notice button{min-height:40px;padding:0 10px;border:1px solid rgba(54,230,107,.16);border-radius:9px;background:var(--green-soft);color:var(--green);font-size:12px;font-weight:850;cursor:pointer}.confirmation-notice button:disabled{opacity:.5}@media(max-width:360px){.confirmation-notice{grid-template-columns:1fr}.confirmation-notice button{width:100%}}

/* PASO 12.1C — reto MFA de acceso */
.mfa-login-modal{position:fixed;inset:0;z-index:1200;display:none;align-items:center;justify-content:center;padding:calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));background:rgba(0,0,0,.76);backdrop-filter:blur(10px)}.mfa-login-modal.open{display:flex}.mfa-login-card{width:min(100%,390px);padding:20px 18px 17px;border:1px solid rgba(54,230,107,.18);border-radius:18px;background:#0b1710;box-shadow:0 20px 70px rgba(0,0,0,.48);text-align:center}.mfa-login-icon{width:46px;height:46px;margin:0 auto 9px;display:grid;place-items:center;border-radius:14px;background:rgba(54,230,107,.10);border:1px solid rgba(54,230,107,.18);color:#36e66b;font-size:24px;font-weight:900}.mfa-login-card>span{display:block;color:#36e66b;font-size:12px;font-weight:900;letter-spacing:.75px}.mfa-login-card h2{margin:5px 0 6px;color:#fff;font-size:21px}.mfa-login-card p{margin:0 auto 13px;max-width:310px;color:#9ba9a1;font-size:12px;line-height:1.5}.mfa-login-card input{box-sizing:border-box;width:100%;height:52px;margin-bottom:10px;border:1px solid rgba(54,230,107,.18);border-radius:12px;background:rgba(0,0,0,.24);color:#fff;text-align:center;font-size:22px;font-weight:900;letter-spacing:7px;outline:none}.mfa-login-card input:focus{border-color:rgba(54,230,107,.55);box-shadow:0 0 0 3px rgba(54,230,107,.07)}.mfa-login-card .forgot-password-button{margin-top:7px}

/* PASO 12.1C FIX — error MFA visible junto al campo */
.mfa-login-message{box-sizing:border-box;width:100%;margin:-2px 0 10px;padding:8px 10px;border:1px solid rgba(54,230,107,.16);border-radius:10px;background:rgba(54,230,107,.055);color:#d4f4dd;font-size:12px;line-height:1.4;text-align:left}.mfa-login-message.error{border-color:rgba(255,104,104,.24);background:rgba(255,104,104,.07);color:#ffc7c7}
