[hidden] { display: none !important; }
/* Layout: barra superior con 3 pestañas. Reasignar = lista de duties (izq) + recomendación (der); en teléfono se apilan. */
:root {
  --bg: #f6f4f8; --surface: #ffffff; --surface-2: #f1edf5; --ink: #1e1a24; --muted: #6d6676; --line: #e2dce8;
  --accent: #6c369c; --accent-ink: #ffffff; --accent-soft: #eee5f7;
  --ok: #1d7a4c; --ok-soft: #e1f3e9; --warn: #9a5a00; --warn-soft: #fdf1d8; --err: #b3261e; --err-soft: #fbe5e3;
  --info: #1f5fa8; --info-soft: #e3eefb; --done: #4b5563; --done-soft: #eceef1;
  --plate-bg: #fdfdfb; --plate-ink: #15131a; --plate-band: #1f3a8a;
  --bar: #6b3a99; --grid: #ebe6f0;
  --shadow: 0 1px 2px rgba(30,26,36,.06), 0 4px 16px rgba(30,26,36,.06);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --header-h: 56px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #141118; --surface: #1d1922; --surface-2: #26212d; --ink: #efeaf4; --muted: #a59eae; --line: #342e3c;
  --accent: #b48be0; --accent-ink: #1a1220; --accent-soft: #2f2440;
  --ok: #6fd3a0; --ok-soft: #173327; --warn: #f0b85a; --warn-soft: #3a2d14; --err: #f28b82; --err-soft: #3d1d1b;
  --info: #8ab8f0; --info-soft: #1b2a3d; --done: #b7bec9; --done-soft: #2a2e35;
  --plate-bg: #e9e7e2; --plate-ink: #15131a; --plate-band: #3557b8; --bar: #b48be0; --grid: #2e2836;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #141118; --surface: #1d1922; --surface-2: #26212d; --ink: #efeaf4; --muted: #a59eae; --line: #342e3c;
  --accent: #b48be0; --accent-ink: #1a1220; --accent-soft: #2f2440;
  --ok: #6fd3a0; --ok-soft: #173327; --warn: #f0b85a; --warn-soft: #3a2d14; --err: #f28b82; --err-soft: #3d1d1b;
  --info: #8ab8f0; --info-soft: #1b2a3d; --done: #b7bec9; --done-soft: #2a2e35;
  --plate-bg: #e9e7e2; --plate-ink: #15131a; --plate-band: #3557b8; --bar: #b48be0; --grid: #2e2836;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.4; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }

.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 6; background: var(--surface); border-bottom: 1px solid var(--line);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.topbar-in { max-width: 1320px; margin: 0 auto; min-height: var(--header-h); display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 14px; font-weight: 800; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: transparent; padding: 8px 12px; white-space: nowrap; position: relative; border-radius: 10px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 640px) { .tabs { margin-left: 0; width: 100%; overflow-x: auto; padding-bottom: 8px; } .tab { flex: 1; white-space: nowrap; } }

.theme-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; flex: none; }
.theme-btn svg { width: 18px; height: 18px; stroke: var(--ink); fill: none; stroke-width: 1.8; stroke-linecap: round; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; } :root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (max-width: 640px) { .theme-btn { position: absolute; top: 9px; right: max(16px, env(safe-area-inset-right, 0px)); } .topbar-in { position: relative; } }
.banner { background: var(--info-soft); color: var(--info); font-size: 13px; padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.banner-in { max-width: 1320px; margin: 0 auto; }
.shell { max-width: 1320px; margin: 0 auto; padding-block: 16px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.view[hidden] { display: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.sub { color: var(--muted); font-size: 13px; margin: 0; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi b { display: block; font-size: 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .note { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.controls input, .controls select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
.controls input[type="search"] { flex: 1 1 200px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.plate { font-family: var(--mono); font-weight: 600; font-size: 12.5px; letter-spacing: .06em; color: var(--plate-ink); background: var(--plate-bg); border: 1.5px solid var(--plate-ink); border-top: 4px solid var(--plate-band); border-radius: 5px; padding: 0 6px 1px; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.b-ok { background: var(--ok-soft); color: var(--ok); } .b-warn { background: var(--warn-soft); color: var(--warn); }
.b-err { background: var(--err-soft); color: var(--err); } .b-info { background: var(--info-soft); color: var(--info); } .b-acc { background: var(--accent-soft); color: var(--accent); }
.cat { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-weight: 800; font-size: 13px; }
.cat-A { background: var(--ok-soft); color: var(--ok); } .cat-B { background: var(--info-soft); color: var(--info); }
.cat-C { background: var(--warn-soft); color: var(--warn); } .cat-D { background: var(--err-soft); color: var(--err); }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; cursor: pointer; user-select: none; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; } tbody tr:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
.scorebar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.scorebar i { display: block; height: 6px; border-radius: 999px; background: var(--surface-2); flex: 1; overflow: hidden; }
.scorebar i em { display: block; height: 100%; background: var(--bar); border-radius: 999px; }
.more { padding: 10px; text-align: center; }

/* Reasignar */
.ra { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .ra { grid-template-columns: 1fr; } }
.dlist { display: grid; gap: 6px; max-height: calc(100vh - 260px); overflow-y: auto; padding-right: 2px; }
@media (max-width: 960px) { .dlist { max-height: 46vh; } }
.ditem { text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; cursor: pointer; display: grid; gap: 3px; }
.ditem:hover { border-color: var(--accent); }
.ditem[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-soft); }
.ditem .t { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; font-size: 13.5px; }
.ditem .s { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fallen { border-left: 4px solid var(--err); }
.fallen .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-size: 13.5px; }
.cands { display: grid; gap: 10px; margin-top: 14px; }
.cand { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.cand.top { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.rank { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; }
.cand .head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-weight: 600; }
.cand .why { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cand .pts { text-align: right; } .cand .pts b { font-size: 22px; font-variant-numeric: tabular-nums; display: block; } .cand .pts span { font-size: 11.5px; color: var(--muted); }
.reasons { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.reasons li { display: flex; gap: 7px; align-items: baseline; }
.reasons li::before { flex: none; width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 800; transform: translateY(2px); }
.r-ok::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
.r-neu::before { content: "–"; background: var(--surface-2); color: var(--muted); }
.r-mid::before { content: "!"; background: var(--warn-soft); color: var(--warn); }
.r-bad::before { content: "✕"; background: var(--err-soft); color: var(--err); }
.r-neu { color: var(--muted); }
.semaf { display: grid; gap: 6px; }
.semaf .s { display: grid; grid-template-columns: 140px 78px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.semaf .s:last-child { border-bottom: 0; }
@media (max-width: 480px) { .semaf .s { grid-template-columns: 1fr auto; } .semaf .s .f { grid-column: 1 / -1; } }
.breakdown { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.breakdown div { font-size: 11px; color: var(--muted); } .breakdown b { display: block; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .cand { grid-template-columns: 36px minmax(0, 1fr); } .cand .pts { grid-column: 2; text-align: left; } .breakdown { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.steps { display: grid; gap: 4px; margin: 14px 0 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); }
.steps li::before { content: counter(s); width: 20px; height: 20px; flex: none; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.steps li.on { color: var(--ink); font-weight: 600; } .steps li.on::before { background: var(--accent); color: var(--accent-ink); }
.steps li { color: var(--ink); line-height: 1.45; } .steps li small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; margin-top: 2px; }
.steps li small .plate { font-size: 11px; } .steps a { color: var(--accent); }
.proc-h { margin: 14px 0 0; font-size: 13px; font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; border: 1.5px dashed var(--line); border-radius: 12px; }
details.alt { margin-top: 12px; } details.alt summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 8px 0; }

/* Charts */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .lbl { fill: var(--ink); font-size: 11.5px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 14px; height: 0; border-top: 2px dashed currentColor; vertical-align: middle; margin-right: 4px; }
.tip { position: fixed; z-index: 30; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 7px 10px; border-radius: 8px; max-width: 260px; box-shadow: var(--shadow); }

/* Drawer */
dialog { border: 1px solid var(--line); padding: 0; border-radius: 16px; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(20,17,24,.45); }
.dlg { padding: 20px; display: grid; gap: 12px; }
.subs { display: grid; gap: 8px; }
.subs .s { display: grid; grid-template-columns: 150px minmax(0, 1fr) 36px; gap: 10px; align-items: center; font-size: 13px; }
.subs .s i { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; display: block; }
.subs .s i em { display: block; height: 100%; background: var(--bar); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.facts div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--muted); }
.facts b { display: block; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .subs .s { grid-template-columns: 110px minmax(0, 1fr) 32px; } .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.glos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 900px) { .glos { grid-template-columns: 1fr; } }
.glos dl { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 8px 14px; margin: 10px 0 0; font-size: 13.5px; }
.glos dt { font-weight: 700; } .glos dd { margin: 0; color: var(--ink); }
@media (max-width: 480px) { .glos dl { grid-template-columns: 1fr; gap: 2px; } .glos dd { margin-bottom: 8px; } }
.glos .rule { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; margin-left: 4px; }
.ic { display: inline-flex; vertical-align: -3px; } .ic::before { margin: 0; }
.ic.r-ok::before, .ic.r-neu::before, .ic.r-mid::before, .ic.r-bad::before { flex: none; width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 800; }
.tag-co { background: var(--info-soft); color: var(--info); }
.cat.sm { width: 18px; height: 18px; font-size: 11px; border-radius: 5px; vertical-align: -3px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ===== App real: login, formularios, botones, avisos ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.ok { border-color: var(--ok); color: var(--ok); } .btn.bad { border-color: var(--err); color: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: grid; gap: 5px; font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 400; }
.form { display: grid; gap: 12px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .card { width: min(400px, 100%); padding: 28px; display: grid; gap: 16px; }
.login .brand-mark { width: 40px; height: 40px; font-size: 18px; border-radius: 12px; }
.msg { font-size: 13px; padding: 9px 12px; border-radius: 10px; }
.msg.err { background: var(--err-soft); color: var(--err); } .msg.ok { background: var(--ok-soft); color: var(--ok); } .msg.info { background: var(--info-soft); color: var(--info); }
.user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.user b { color: var(--ink); font-weight: 600; }
.count { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; border-radius: 999px; background: var(--err); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.toast { position: fixed; top: 16px; right: 16px; z-index: 50; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--ok); box-shadow: var(--shadow); border-radius: 10px; padding: 10px 14px; font-size: 14px; max-width: 360px; }
.toast.err { border-left-color: var(--err); }
.acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.acts .sub { margin-right: 4px; }
.log { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.log li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.log li:last-child { border-bottom: 0; } .log time { color: var(--muted); font-variant-numeric: tabular-nums; }
.state-tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; } .progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.drop { border: 1.5px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; }
.drop:hover, .drop.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.files { display: grid; gap: 8px; margin-top: 12px; }
.file { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; font-size: 13px; }
.file .t { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.wgrid label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; } .wgrid input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.stack { display: grid; gap: 14px; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.covered { border-left: 4px solid var(--ok); }
