/* ============================================================
   PassOne Security — ArguedasOne palette
   verde #2FA84F · azul #2C7BE5 · cabecera #2C6FA6
   barra oscura #2C3E50 · fondo #F4F6F8 · fila sel. #E3F3E8 · bordes #DCE1E6
   ============================================================ */

:root {
    --ao-green: #2FA84F;
    --ao-green-dark: #268a41;
    --ao-blue: #2C7BE5;
    --ao-header: #2C6FA6;
    --ao-dark: #2C3E50;
    --ao-bg: #F4F6F8;
    --ao-row: #E3F3E8;
    --ao-border: #DCE1E6;

    --surface: #ffffff;
    --surface-2: #ffffff;
    --text: #223040;
    --text-muted: #5c6b7a;
    --on-dark: #eef4fb;
    --shadow: 0 1px 3px rgba(44, 62, 80, .12), 0 6px 18px rgba(44, 62, 80, .08);
    --radius: 14px;
    --radius-sm: 9px;
    --focus: #2C7BE5;

    --danger: #d64545;
    --warning: #c9802b;
    --ok: var(--ao-green);

    --sidebar-w: 248px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --ao-bg: #141c24;
    --ao-row: #1f3b2c;
    --ao-border: #35475a;
    --surface: #1e2a36;
    --surface-2: #22303e;
    --text: #e6edf4;
    --text-muted: #9fb0c0;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --focus: #6ea8ff;
    color-scheme: dark;
}

* { box-sizing: border-box; }

/* Global type scale — compact. Every rem-based size below scales from this. */
html { font-size: 14px; }
html, body { height: 100%; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    background: var(--ao-bg);
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ao-blue); }

/* ---------- Startup / loading ---------- */
.startup {
    position: fixed; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; background: var(--ao-bg); color: var(--ao-header);
}
.startup__logo img { border-radius: 20px; box-shadow: var(--shadow); }
.startup__name { font-size: 1.4rem; font-weight: 700; color: var(--ao-header); }
.startup__sub { font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.startup__spinner {
    margin-top: 10px; width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid var(--ao-border); border-top-color: var(--ao-green);
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- App shell ---------- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--ao-dark);
    color: var(--on-dark);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar__brand {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar__brand img { width: 40px; height: 40px; border-radius: 10px; }
.sidebar__title { font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.sidebar__title small { display: block; font-weight: 400; font-size: .72rem; color: #a9bace; letter-spacing: .08em; }

.nav { padding: 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    color: #cdd9e5; text-decoration: none; font-weight: 500; font-size: .9rem;
}
.nav a .ico { width: 20px; height: 20px; flex: none; opacity: .95; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: var(--ao-blue); color: #fff; }
.nav a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sidebar__foot {
    margin-top: auto; padding: 14px; font-size: .72rem; color: #8ea0b3;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.topbar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--ao-border);
    position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }

.privacy-chip {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--ao-row); color: var(--ao-green-dark);
    border: 1px solid #bfe3ca; border-radius: 999px;
    padding: 5px 12px; font-size: .8rem; font-weight: 600;
}
:root[data-theme="dark"] .privacy-chip { color: #8fe0a6; border-color: #2f6b45; }
.privacy-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ao-green); }

.content { padding: 22px clamp(14px, 4vw, 40px) 60px; max-width: 1060px; margin: 0 auto; width: 100%; }

/* mobile top nav */
.mobile-nav { display: none; }

/* ---------- Banner ---------- */
.privacy-banner {
    display: flex; gap: 12px; align-items: flex-start;
    background: linear-gradient(180deg, var(--ao-row), var(--surface));
    border: 1px solid #bfe3ca; border-left: 4px solid var(--ao-green);
    border-radius: var(--radius); padding: 13px 16px; margin: 0 0 20px;
    color: var(--text);
}
:root[data-theme="dark"] .privacy-banner { border-color: #2f6b45; background: #1a2b22; }
.privacy-banner .ico { color: var(--ao-green); flex: none; margin-top: 2px; }

/* ---------- Headings ---------- */
.page-head { margin-bottom: 18px; }
.page-head h1 { margin: 0 0 4px; font-size: clamp(1.25rem, 2.2vw, 1.55rem); color: var(--ao-header); }
:root[data-theme="dark"] .page-head h1 { color: #7bb6ec; }
.page-head p { margin: 0; color: var(--text-muted); }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--ao-border);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h2 { margin: 0 0 14px; font-size: 1.02rem; color: var(--ao-header); }
:root[data-theme="dark"] .card h2 { color: #7bb6ec; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Result box ---------- */
.result {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--surface-2); border: 2px solid var(--ao-border);
    border-radius: var(--radius-sm); padding: 14px 16px;
}
.result__value {
    flex: 1; min-width: 160px;
    font-family: Consolas, "SF Mono", Menlo, monospace;
    font-size: clamp(1rem, 2.1vw, 1.25rem); font-weight: 600;
    word-break: break-all; letter-spacing: .5px; color: var(--text);
}
.result__value.placeholder { color: var(--text-muted); font-weight: 400; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: 10px;
    padding: 9px 15px; font-size: 0.95rem; font-weight: 600; cursor: pointer;
    background: var(--surface); color: var(--text); transition: background .15s, transform .05s;
    min-height: 40px;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn--primary { background: var(--ao-blue); color: #fff; }
.btn--primary:hover { background: #2266c9; }
.btn--green { background: var(--ao-green); color: #fff; }
.btn--green:hover { background: var(--ao-green-dark); }
.btn--ghost { background: transparent; border-color: var(--ao-border); color: var(--text); }
.btn--ghost:hover { background: var(--ao-row); }
.btn--icon { padding: 9px 11px; min-width: 40px; }
.btn--block { width: 100%; }
.btn--lg { padding: 12px 20px; font-size: 1rem; min-height: 46px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Form controls ---------- */
label { font-weight: 600; font-size: .92rem; display: block; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.help { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }

input[type="text"], input[type="number"], input[type="password"], select, textarea {
    width: 100%; padding: 11px 12px; font-size: 1rem;
    border: 1px solid var(--ao-border); border-radius: 10px;
    background: var(--surface-2); color: var(--text); font-family: inherit;
}
textarea { resize: vertical; min-height: 56px; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--ao-blue);
}

input[type="range"] { width: 100%; accent-color: var(--ao-blue); height: 30px; }

.len-row { display: flex; align-items: center; gap: 14px; }
.len-value {
    font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem;
    min-width: 50px; text-align: center; color: var(--ao-header);
    background: var(--ao-row); border-radius: 10px; padding: 5px 4px;
}
:root[data-theme="dark"] .len-value { color: #8fe0a6; }

/* Switch */
.switch { display: flex; align-items: center; gap: 12px; padding: 9px 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
    width: 46px; height: 26px; border-radius: 999px; background: var(--ao-border);
    position: relative; flex: none; transition: background .15s;
}
.switch .track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
    border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.switch input:checked + .track { background: var(--ao-green); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch .switch__label { font-weight: 500; }

.checkgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; }
@media (max-width: 560px) { .checkgrid { grid-template-columns: 1fr; } }

/* ---------- Strength meter ---------- */
.meter { margin-top: 6px; }
.meter__bar { height: 12px; border-radius: 999px; background: var(--ao-border); overflow: hidden; }
.meter__fill { height: 100%; border-radius: 999px; transition: width .25s, background .25s; }
.meter__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.meter__label { font-weight: 700; }
.s-0 { background: var(--danger); } .t-0 { color: var(--danger); }
.s-1 { background: #e0792e; } .t-1 { color: #c9802b; }
.s-2 { background: #d6b63c; } .t-2 { color: #a98a12; }
.s-3 { background: #4b9f60; } .t-3 { color: var(--ao-green-dark); }
.s-4 { background: var(--ao-green); } .t-4 { color: var(--ao-green-dark); }
:root[data-theme="dark"] .t-3, :root[data-theme="dark"] .t-4 { color: #8fe0a6; }

.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.stat {
    flex: 1 1 130px; background: var(--surface-2); border: 1px solid var(--ao-border);
    border-radius: 10px; padding: 10px 12px;
}
.stat .k { font-size: .76rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.scenario-list { list-style: none; padding: 0; margin: 8px 0 0; }
.scenario-list li {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 9px 0; border-bottom: 1px dashed var(--ao-border);
}
.scenario-list li:last-child { border-bottom: 0; }
.scenario-list .time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.warnings { list-style: none; padding: 0; margin: 8px 0 0; }
.warnings li { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; }
.warnings li .ico { flex: none; margin-top: 2px; }
.warnings li.ok { color: var(--ao-green-dark); }
:root[data-theme="dark"] .warnings li.ok { color: #8fe0a6; }
.warnings li.warn { color: var(--warning); }

.note {
    background: var(--surface-2); border: 1px dashed var(--ao-border);
    border-radius: 10px; padding: 11px 13px; font-size: .86rem; color: var(--text-muted);
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--ao-border); border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--ao-border); }
table.data th { background: var(--ao-row); color: var(--text); position: sticky; top: 0; }
:root[data-theme="dark"] table.data th { background: #22382b; }
table.data tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
table.data td.pw { font-family: Consolas, monospace; word-break: break-all; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
    background: var(--ao-dark); color: #fff; padding: 11px 18px; border-radius: 999px;
    font-weight: 600; font-size: .9rem; box-shadow: var(--shadow); display: flex; gap: 8px; align-items: center;
    animation: toast-in .2s ease;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ao-green-dark); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Profiles ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.profile-card { display: flex; flex-direction: column; gap: 8px; }
.profile-card .pc-head { display: flex; align-items: center; gap: 10px; }
.profile-card .pc-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--ao-row); color: var(--ao-header); display: flex; align-items: center; justify-content: center; flex: none; }
:root[data-theme="dark"] .profile-card .pc-ico { background: #22382b; color: #8fe0a6; }
.profile-card .pc-name { font-weight: 700; }
.profile-card p { margin: 0; color: var(--text-muted); font-size: .88rem; flex: 1; }
.tag { display: inline-block; background: var(--surface-2); border: 1px solid var(--ao-border); border-radius: 999px; padding: 2px 9px; font-size: .74rem; color: var(--text-muted); margin-right: 4px; }

/* ---------- Select inline (language) ---------- */
.inline-select { display: inline-flex; align-items: center; gap: 8px; }
.inline-select select { width: auto; padding: 8px 10px; min-width: 120px; }

/* ---------- Accessibility ---------- */
.skip-link {
    position: absolute; left: 10px; top: -60px; background: var(--ao-blue); color: #fff;
    padding: 10px 16px; border-radius: 8px; z-index: 200; transition: top .15s;
}
.skip-link:focus { top: 10px; }
.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;
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ---------- Error UI ---------- */
#blazor-error-ui {
    background: #ffecec; color: #7a1f1f; bottom: 0; display: none; left: 0; position: fixed;
    width: 100%; padding: 12px 20px; box-shadow: 0 -1px 4px rgba(0, 0, 0, .2); z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 16px; top: 10px; }

/* ---------- Responsive: collapse sidebar ---------- */
@media (max-width: 820px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .mobile-nav {
        display: flex; gap: 4px; overflow-x: auto; background: var(--ao-dark);
        padding: 8px 10px; position: sticky; top: 0; z-index: 30;
    }
    .mobile-nav a {
        color: #cdd9e5; text-decoration: none; padding: 8px 12px; border-radius: 8px;
        font-size: .86rem; white-space: nowrap; font-weight: 600;
    }
    .mobile-nav a.active { background: var(--ao-blue); color: #fff; }
    .topbar { top: 0; }
}

/* ---------- Print ---------- */
@media print {
    .sidebar, .mobile-nav, .topbar, .privacy-banner, .btn, .btn-row, #blazor-error-ui { display: none !important; }
    .app { display: block; }
    .content { max-width: none; padding: 0; }
    body { background: #fff; }
}
