/* DLM Admin — sistema de diseño propio (sin librerías de componentes).
   Tokens en :root; el tema oscuro los redefine. Tipografía del sistema: sin fuentes externas. */

:root {
    --bg: #F4F6F7;
    --surface: #FFFFFF;
    --surface-2: #F8FAFA;
    --border: #E2E8EA;
    --border-strong: #CBD5D8;
    --text: #0D1B1F;
    --muted: #5B6B70;
    --brand: #00758C;
    --brand-strong: #005F72;
    --brand-soft: #E3F4F6;
    --on-brand: #FFFFFF;
    --accent: #1FC7BC;
    --ok: #0F7B4F;        --ok-soft: #E2F5EC;
    --warn: #9A5B00;      --warn-soft: #FFF2D9;
    --danger: #B3261E;    --danger-soft: #FCE8E6;
    --info: #1A5FB4;      --info-soft: #E5EFFB;
    --side-bg: #07191D;
    --side-text: #C9D8DC;
    --side-muted: #7E959B;
    --side-hover: rgba(255, 255, 255, .06);
    --side-active: rgba(31, 199, 188, .14);
    --shadow-sm: 0 1px 2px rgba(13, 27, 31, .06);
    --shadow-lg: 0 18px 48px rgba(13, 27, 31, .18);
    --radius: 12px;
    --radius-sm: 8px;
    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0A1316; --surface: #101C20; --surface-2: #142328; --border: #1F3138; --border-strong: #2C434B;
        --text: #E7EFF1; --muted: #92A6AC; --brand: #35C3D3; --brand-strong: #5AD2DF; --brand-soft: #0F3138; --on-brand: #04191D;
        --ok: #4FD197; --ok-soft: #0E2E21; --warn: #F0B454; --warn-soft: #33260B; --danger: #FF8A80; --danger-soft: #3A1614;
        --info: #7FB3F5; --info-soft: #11263F; --side-bg: #060F12;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0A1316; --surface: #101C20; --surface-2: #142328; --border: #1F3138; --border-strong: #2C434B;
    --text: #E7EFF1; --muted: #92A6AC; --brand: #35C3D3; --brand-strong: #5AD2DF; --brand-soft: #0F3138; --on-brand: #04191D;
    --ok: #4FD197; --ok-soft: #0E2E21; --warn: #F0B454; --warn-soft: #33260B; --danger: #FF8A80; --danger-soft: #3A1614;
    --info: #7FB3F5; --info-soft: #11263F; --side-bg: #060F12;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
    color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font-size: 24px; line-height: 1.25; font-weight: 650; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.pad { padding: 16px 20px 20px; }
.icon { flex: none; vertical-align: -3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
[data-theme="dark"] .only-light, [data-theme="light"] .only-dark { display: none; }
:root:not([data-theme]) .only-dark { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .only-dark { display: inline; }
    :root:not([data-theme]) .only-light { display: none; }
}

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; padding: 18px 12px 12px;
    position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; }
.brand:hover { color: #fff; }
.brand-text { font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.brand-text b { font-weight: 700; color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 16px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--side-text); font-weight: 500; }
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item.active { background: var(--side-active); color: #fff; }
.nav-item.active .icon { color: var(--accent); }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 10px; display: flex; align-items: center; gap: 4px; }
.sidebar-foot .nav-item { flex: 1; min-width: 0; padding: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #04191D; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who b { color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-actions { display: flex; }
.sidebar .icon-btn { color: var(--side-text); }
.sidebar .icon-btn:hover { background: var(--side-hover); color: #fff; }
.main { padding: 28px 36px 56px; max-width: 1320px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.icon-btn.nav-toggle, .scrim { display: none; }
.boot { display: grid; place-items: center; min-height: 60vh; }

.lang { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); }
.lang a { font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 4px 9px; border-radius: 6px; color: var(--muted); }
.lang a:hover { color: var(--text); }
.lang a.on { background: var(--brand); color: var(--on-brand); }
.sidebar .lang { margin: 0 0 10px 8px; background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .08); }
.sidebar .lang a { color: var(--side-muted); }
.sidebar .lang a:hover { color: #fff; }
.sidebar .lang a.on { background: var(--accent); color: #04191D; }
.auth-card .lang { align-self: center; margin-top: 8px; }

/* ---------- cabecera de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.count { font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 1px 9px; letter-spacing: 0; }

/* ---------- tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; }
.card-head.flush { padding: 0 0 8px; }
.link { font-size: 13px; font-weight: 500; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; color: var(--text); transition: transform .15s, box-shadow .15s, border-color .15s; min-height: 88px; }
a.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: 0 8px 22px rgba(13, 27, 31, .08); color: var(--text); }
.kpi-icon { grid-row: span 2; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; }
.kpi-value { font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: 13px; }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-brand { background: var(--brand-soft); color: var(--brand); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 20px; color: var(--muted); text-align: center; }

/* ---------- listas ---------- */
.list > li + li { border-top: 1px solid var(--border); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: var(--text); }
a.list-row:hover { background: var(--surface-2); color: var(--text); }
.list > li:last-child .list-row, .list > li.list-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.list-main b { font-weight: 600; }
.list-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-ok { background: var(--ok); }
.dot-danger { background: var(--danger); }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; line-height: 1; padding: 5px 9px; border-radius: 999px; white-space: nowrap; letter-spacing: 0; }
.chip .icon { vertical-align: 0; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-brand { background: var(--brand-soft); color: var(--brand); }
.chip-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; color: var(--muted); white-space: nowrap; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
[data-theme="dark"] .btn-danger { color: #2B0705; }
.btn-danger:hover { filter: brightness(.93); background: var(--danger); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; height: 42px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- formularios ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-inline { flex-direction: row; align-items: center; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; }
.field small { color: var(--muted); font-size: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-action { padding-top: 25px; justify-content: flex-start; align-items: flex-start; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=search], select, textarea {
    width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; }
textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
input:disabled { opacity: .55; }
.code-input { font-family: var(--mono); font-size: 20px; letter-spacing: .3em; text-align: center; height: 48px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; align-self: end; padding-bottom: 4px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }
.check span { display: flex; flex-direction: column; }
.check small { color: var(--muted); }
.switch { position: relative; display: inline-flex; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch span { width: 40px; height: 22px; border-radius: 999px; background: var(--border-strong); transition: background .15s; position: relative; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; }

/* ---------- barra de herramientas ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search .icon { position: absolute; left: 12px; top: 10px; color: var(--muted); }
.search input { padding-left: 38px; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--brand-soft); color: var(--brand); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td .chip + .chip { margin-left: 4px; }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover { background: var(--surface-2); }
.chev { width: 32px; color: var(--muted); }
.row-actions { text-align: right; white-space: nowrap; }
.details { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.more { display: flex; justify-content: center; }

/* ---------- datos ---------- */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.facts dt { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.facts dd { font-weight: 500; overflow-wrap: anywhere; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.danger-zone h2 { color: var(--danger); }

/* ---------- avisos ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.alert .icon { margin-top: 2px; }
.alert p { margin: 4px 0 10px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert .field > span, .alert input { color: var(--text); }

/* ---------- asistente ---------- */
.stepper { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 13px; }
.stepper li + li::before { content: ""; width: 28px; height: 1px; background: var(--border-strong); margin-right: 4px; }
.step-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--border-strong); font-size: 12px; background: var(--surface); }
.stepper .current { color: var(--text); }
.stepper .current .step-dot { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.stepper .done .step-dot { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.wizard-body { padding: 22px 24px 8px; display: flex; flex-direction: column; gap: 18px; }
.wizard-alert { margin: 8px 24px 0; }
.wizard-foot { display: flex; gap: 8px; padding: 16px 24px 20px; align-items: center; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice { text-align: left; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 2px; padding: 16px; border-radius: var(--radius); border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; transition: border-color .12s, background .12s; }
.choice:hover { border-color: var(--border-strong); }
.choice.on { border-color: var(--brand); background: var(--brand-soft); }
.choice-icon { grid-row: span 2; width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); }
.choice.on .choice-icon { background: var(--brand); color: var(--on-brand); }
.choice small { color: var(--muted); }
.schema-preview { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.module { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.module.on { border-color: var(--brand); background: var(--brand-soft); }
.module input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--brand); }
.module span { display: flex; flex-direction: column; min-width: 0; }
.module small { color: var(--muted); }

/* ---------- flujo de migración ---------- */
.flow { display: flex; flex-direction: column; gap: 16px; }
.flow-step { display: grid; grid-template-columns: auto 1fr; gap: 16px; padding: 20px; }
.flow-num { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; display: grid; place-items: center; }
.flow-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.token { display: flex; gap: 10px; align-items: stretch; }
.token code { flex: 1; min-width: 0; padding: 9px 12px; font-size: 13.5px; overflow-wrap: anywhere; user-select: all; display: flex; align-items: center; }

/* ---------- registro de trabajos ---------- */
.joblog { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.joblog-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.joblog-lines { background: #07191D; color: #C9D8DC; font: 12.5px/1.6 var(--mono); padding: 12px 14px; max-height: 300px; overflow-y: auto; }
.jobline { display: flex; gap: 12px; }
.jobline time { color: #5F7A81; flex: none; }
.jobline span { white-space: pre-wrap; overflow-wrap: anywhere; }
.jobline-warning span { color: #F0B454; }
.jobline-error span { color: #FF8A80; }
.jobline-success span { color: #4FD197; font-weight: 600; }

/* ---------- modal y avisos flotantes ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(4, 14, 17, .55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fade .12s ease-out; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .14s ease-out; }
.modal-sm { max-width: 460px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 8px 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 10px 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--info); box-shadow: var(--shadow-lg); animation: pop .16s ease-out; }
.toast > span { flex: 1; padding-top: 1px; }
.toast-success { border-left-color: var(--ok); } .toast-success > .icon { color: var(--ok); }
.toast-error { border-left-color: var(--danger); } .toast-error > .icon { color: var(--danger); }
.toast-info > .icon { color: var(--info); }
.toast .icon-btn { width: 24px; height: 24px; }
.toast > .icon { margin-top: 2px; }

/* ---------- carga ---------- */
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; display: inline-block; animation: spin .7s linear infinite; }
.spinner-sm { width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; }
.skeleton { position: relative; overflow: hidden; min-height: 88px; }
.skeleton-table { min-height: 320px; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--muted) 12%, transparent) 50%, transparent 70%); animation: shimmer 1.3s infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- acceso ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 440px) 1fr; }
.auth-aside { background: radial-gradient(1200px 600px at -10% -10%, #0E3A42 0%, transparent 60%), #07191D; color: #C9D8DC; padding: 36px 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-aside .brand { padding: 0; }
.auth-pitch h2 { color: #fff; font-size: 26px; line-height: 1.25; letter-spacing: -.02em; font-weight: 650; display: block; margin-bottom: 22px; }
.auth-pitch ul { display: flex; flex-direction: column; gap: 14px; }
.auth-pitch li { display: flex; gap: 12px; align-items: flex-start; }
.auth-pitch .icon { color: var(--accent); margin-top: 2px; }
.auth-legal { color: #7E959B; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { font-size: 26px; }
.auth-note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 13px; }
.steps { counter-reset: step; display: flex; flex-direction: column; gap: 16px; }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 26px 1fr; column-gap: 12px; row-gap: 10px; }
.steps > li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.steps > li > :not(:first-child) { grid-column: 2; }
.qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.qr-img { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 6px; line-height: 0; }
.qr-img svg { width: 168px; height: 168px; }
.qr-manual { display: flex; flex-direction: column; gap: 6px; max-width: 200px; }
.qr-manual code { overflow-wrap: anywhere; padding: 6px 8px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes code { text-align: center; padding: 8px; font-size: 14px; letter-spacing: .06em; user-select: all; }

/* ---------- error del circuito ---------- */
#blazor-error-ui { display: none; position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--danger); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 100; gap: 14px; align-items: center; }
#blazor-error-ui .reload { color: #fff; font-weight: 700; text-decoration: underline; margin-left: 12px; }

/* ---------- adaptable ---------- */
@media (max-width: 1100px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
    .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 40; width: 264px; left: 0; transform: translateX(-100%); transition: transform .2s; }
    .nav-open .sidebar { transform: none; }
    .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(4, 14, 17, .5); z-index: 30; }
    .icon-btn.nav-toggle { display: inline-grid; margin: -8px 0 -12px -8px; }
    .main { padding: 18px 16px 48px; }
    .form-grid, .form-grid.cols-4 { grid-template-columns: 1fr; }
    .span-2, .span-3, .span-4 { grid-column: auto; }
    .field-action { padding-top: 0; }
    .choices, .module-grid, .facts, .field-row { grid-template-columns: 1fr; }
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .danger-zone { flex-direction: column; align-items: flex-start; }
    .flow-step { grid-template-columns: 1fr; }
    .token { flex-direction: column; }
}

/* ---------- Reporte EHF ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-end; padding: 16px 20px; }
.filters .field { flex: 0 0 auto; }
.filters input[type=month] { width: 170px; }
.toolbar .check { align-self: center; align-items: center; padding-bottom: 0; }
.table tfoot td { padding: 12px 16px; border-top: 2px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table-matrix td.num, .table-matrix th.num { white-space: nowrap; }
.table-matrix td b + .chip { margin-left: 8px; }
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.detail-scroll { max-height: 52vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.detail-scroll thead th { position: sticky; top: 0; background: var(--surface); }
.note { display: flex; align-items: center; gap: 6px; margin: 0; }
