:root {
  --bg: #0e1114; --surface: #161a1f; --surface2: #1d232a; --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.16);
  --text: #e9edf1; --text2: #a3adb8; --text3: #6f7a86;
  --brand: #9dc23b; --brand-ink: #0e1114; --brand-dim: rgba(157,194,59,.14);
  --good: #0aac23; --warning: #fbb315; --serious: #f18a59; --critical: #dc3c3d; --none: #5d6670;
  --good-bg: rgba(10,172,35,.16); --warning-bg: rgba(251,179,21,.16); --serious-bg: rgba(241,138,89,.16); --critical-bg: rgba(220,60,61,.18);
  --txt-crit: #ff7b7b; --txt-warn: #ffc94d;
  --plan: #8a96a3; --night: rgba(120,140,200,.07);
  --h0: #222930; --h1: #2c4a1e; --h2: #3f6d22; --h3: #5f9a27; --h4: #9dc23b;
  --radius: 12px; --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef1f4; --surface: #ffffff; --surface2: #f5f7f9; --line: rgba(11,11,11,.08); --line2: rgba(11,11,11,.16);
  --text: #15191d; --text2: #55606b; --text3: #8a949e;
  --brand: #6f9a12; --brand-ink: #fff; --brand-dim: rgba(111,154,18,.12);
  --good-bg: rgba(10,172,35,.12); --warning-bg: rgba(251,179,21,.2); --serious-bg: rgba(241,138,89,.18); --critical-bg: rgba(220,60,61,.12);
  --txt-crit: #b3261e; --txt-warn: #8a5a00;
  --plan: #7b8692; --night: rgba(60,80,140,.06);
  --h0: #eceff2; --h1: #d6ebc0; --h2: #a9d37c; --h3: #6fae37; --h4: #3f7d12;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(0,0,0,.05);
  color-scheme: light;
}
* , *::before, *::after { box-sizing: border-box; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--text2); }
.small { font-size: 12px; }
.txt-crit { color: var(--txt-crit); }
.txt-warn { color: var(--txt-warn); }
.strong { font-weight: 600; }
.txt-ok { color: var(--good); } .txt-serious { color: var(--serious); } .txt-nometa { color: var(--text2); }
body:not(.admin) .admin-only { display: none !important; }
.ic { width: 1em; height: 1em; vertical-align: -.12em; flex: none; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.s-ok { background: var(--good); } .dot.s-warn { background: var(--warning); } .dot.s-crit { background: var(--critical); } .dot.s-nometa { background: var(--none); }
button.link { all: unset; cursor: pointer; color: var(--brand); font-weight: 700; text-decoration: underline; margin-left: 6px; }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--brand) 0 50%, #3b4148 50% 100%); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 9px; border: 2.5px solid var(--bg); border-radius: 50%; }
.brand b { display: block; font-weight: 800; letter-spacing: .08em; color: var(--brand); font-size: 15px; }
.brand small { display: block; color: var(--text2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }

/* Buttons */
.btn { border: 1px solid var(--line2); background: var(--surface2); padding: 10px 16px; border-radius: 10px; font-weight: 600; }
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.icon-btn { border: 1px solid var(--line); background: var(--surface2); border-radius: 8px; padding: 0 11px; height: 34px; min-width: 34px; font-size: 14px; font-weight: 600; color: var(--text2); }
.icon-btn:hover { color: var(--text); border-color: var(--line2); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% -10%, var(--brand-dim), transparent 60%), var(--bg); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); display: grid; gap: 18px; }
.login-card h1 { font-size: 24px; margin: 8px 0 4px; }
.fields label { font-size: 13px; }
.fields input { padding: 11px 12px; font-size: 15px; }
.btn-lg { padding: 13px 16px; font-size: 15px; }
.login-note { font-size: 12px; color: var(--text3); text-align: center; }
.login-card p { margin: 0; }
.fields { display: grid; gap: 10px; }
.fields label, label.inline { display: grid; gap: 4px; font-size: 12px; color: var(--text2); font-weight: 600; }
label.inline { display: flex; align-items: center; gap: 8px; }
input, select { background: var(--surface2); border: 1px solid var(--line2); border-radius: 8px; padding: 9px 11px; font-size: 14px; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--brand); }
.seg { display: flex; border: 0; padding: 3px; margin: 0; background: var(--surface2); border-radius: 10px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 8px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--text2); cursor: pointer; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); }
.adv summary { cursor: pointer; color: var(--text2); font-size: 13px; margin-bottom: 8px; }
.notice { background: var(--warning-bg); border: 1px solid rgba(251,179,21,.35); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.notice code, .error code { font-family: var(--mono); font-size: 12px; }
.error { color: var(--txt-crit); background: var(--critical-bg); padding: 8px 12px; border-radius: 8px; }
.login-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.login-actions .btn { flex: 1 1 180px; }

/* Top bar */
.demo-banner { background: repeating-linear-gradient(135deg, var(--warning) 0 14px, #e0a000 14px 28px); color: #0b0b0b; text-align: center; font-weight: 700; font-size: 12px; padding: 4px; letter-spacing: .05em; }
.topbar { display: flex; align-items: center; gap: 20px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.tb-title { flex: 1 1 320px; }
.tb-title h1 { font-size: 20px; }
.tb-title p { margin: 4px 0 0; color: var(--text2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.tb-time { display: grid; justify-items: end; gap: 2px; }
.btn-out { color: var(--text); }
.turno { display: inline-flex; gap: 6px; align-items: center; padding: 3px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.turno[data-turno="diurno"] { background: var(--warning-bg); color: var(--text); }
.turno[data-turno="nocturno"] { background: rgba(120,140,220,.18); color: var(--text); }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.clock { font-family: var(--mono); font-size: 30px; font-weight: 500; letter-spacing: .02em; line-height: 1; }
.sync { display: flex; align-items: center; gap: 6px; color: var(--text3); font-size: 11px; }
.ring { width: 11px !important; height: 11px !important; }
.ring { --p: 0; width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(var(--brand) calc(var(--p) * 360deg), var(--line2) 0); flex: none; }
.sync[data-state="loading"] .ring { background: conic-gradient(var(--brand) 90deg, var(--line2) 0); animation: spin 1s linear infinite; }
.sync[data-state="error"] .ring { background: var(--critical); }
.sync[data-state="error"] { color: var(--txt-crit); }
@keyframes spin { to { transform: rotate(360deg); } }
.tb-actions { display: flex; gap: 6px; }

/* Shift bar */
.shiftbar { padding: 30px 24px 4px; }
.sb-track { position: relative; height: 10px; border-radius: 999px; display: flex; overflow: visible; background: var(--surface2); }
.sb-day, .sb-night { flex: 1; height: 100%; }
.sb-day { border-radius: 999px 0 0 999px; background: var(--warning-bg); }
.sb-night { border-radius: 0 999px 999px 0; background: rgba(120,140,220,.16); }
.sb-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, transparent, var(--brand-dim)); border-right: 0; }
.sb-now { position: absolute; top: -5px; bottom: -5px; width: 3px; border-radius: 2px; background: var(--brand); transform: translateX(-1px); }
.sb-now span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 700; color: var(--brand); }
.sb-ax { display: flex; justify-content: space-between; font-size: 11px; color: var(--text3); margin-top: 6px; }

main { padding: 16px 24px 40px; display: grid; gap: 16px; max-width: 1800px; margin: 0 auto; }
.warnings { display: grid; gap: 6px; }
.warnings:empty { display: none; }
.warn-item { display: flex; gap: 10px; align-items: center; background: var(--warning-bg); border: 1px solid rgba(251,179,21,.3); padding: 7px 12px; border-radius: 10px; font-size: 13px; }

/* Status pills (icono + texto, nunca sólo color) */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.mini { padding: 0 5px; font-size: 10px; min-width: 16px; justify-content: center; }
.pill.s-ok { background: var(--good-bg); color: var(--text); box-shadow: inset 3px 0 0 var(--good); }
.pill.s-warn { background: var(--warning-bg); color: var(--text); box-shadow: inset 3px 0 0 var(--warning); }
.pill.s-crit { background: var(--critical-bg); color: var(--text); box-shadow: inset 3px 0 0 var(--critical); }
.pill.s-serious { background: var(--serious-bg); color: var(--text); box-shadow: inset 3px 0 0 var(--serious); }
.pill.s-nometa, .pill.s-nobudget { background: var(--surface2); color: var(--text2); box-shadow: inset 3px 0 0 var(--none); }
.bar { height: 6px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.bar i.s-ok { background: var(--good); } .bar i.s-warn { background: var(--warning); } .bar i.s-crit { background: var(--critical); } .bar i.s-nometa, .bar i.s-nobudget { background: var(--none); }

/* KPIs */
.kpis { display: grid; grid-template-columns: minmax(300px, 1.25fr) repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; text-align: left; box-shadow: var(--shadow); min-width: 0; }
button.kpi { cursor: pointer; }
.kpi-act:hover { border-color: var(--line2); background: var(--surface2); }
.kpi-label { color: var(--text2); font-size: 13px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.kpi-val { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-sub { color: var(--text3); font-size: 12px; }
.kpi .bar { margin-top: auto; }
.kpi-hero { grid-row: span 2; align-items: stretch; justify-content: center; gap: 4px; }
.kpi-gauge { position: relative; width: 210px; margin: 0 auto; }
.gauge { width: 100%; display: block; }
.g-track { fill: none; stroke: var(--surface2); stroke-width: 11; stroke-linecap: round; }
.g-val { fill: none; stroke-width: 11; stroke-linecap: round; }
.g-val.s-ok { stroke: var(--good); } .g-val.s-warn { stroke: var(--warning); } .g-val.s-crit { stroke: var(--critical); } .g-val.s-nometa { stroke: var(--none); }
.g-tick { stroke: var(--surface); stroke-width: 2; }
.kpi-gauge-val { position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; }
.kpi-gauge-val strong { display: block; font-size: 38px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.txt-warn.kpi-val, .kpi-gauge-val .txt-warn { color: var(--txt-warn); }
.kpi-gauge-val .txt-ok { color: var(--text); }
.kpi-hero-l { text-align: center; color: var(--text2); font-size: 13px; font-weight: 600; margin-bottom: 10px; }

/* Cards */
.grid2 { display: grid; grid-template-columns: minmax(340px, 1fr) minmax(400px, 1.5fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-h.wrap { flex-wrap: wrap; }
.card-h h2 { font-size: 15px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.sw-a { background: var(--brand); }
.sw-e { background: repeating-linear-gradient(90deg, var(--plan) 0 4px, transparent 4px 7px); }
.sw-night { height: 10px; background: rgba(120,140,220,.25); }

.card-prio { display: flex; flex-direction: column; }
.priority { display: grid; align-content: start; gap: 6px; height: 300px; overflow: auto; padding-right: 4px; }
.prio { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; text-align: left; background: var(--surface2); border: 1px solid var(--line); border-left: 4px solid var(--none); border-radius: 10px; padding: 8px 12px; }
.prio:hover { border-color: var(--line2); }
.s-border-crit { border-left-color: var(--critical) !important; } .s-border-warn { border-left-color: var(--warning) !important; } .s-border-ok { border-left-color: var(--good) !important; }
.prio-rank { font-weight: 800; color: var(--text3); font-size: 15px; text-align: center; }
.prio-main { display: grid; gap: 3px; min-width: 0; }
.prio-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.prio-title small { font-weight: 500; color: var(--text3); font-size: 12px; margin-left: 4px; }
.prio-sub { color: var(--text2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prio-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; color: var(--text2); border: 1px solid var(--line2); border-radius: 999px; padding: 1px 8px; display: inline-flex; gap: 4px; align-items: center; }
.tag-warn { color: var(--txt-warn); border-color: rgba(251,179,21,.4); }
.tag-crit { color: var(--txt-crit); border-color: rgba(220,60,61,.4); }
.prio-num { font-variant-numeric: tabular-nums; color: var(--text3); }
.prio-num b { font-size: 18px; color: var(--text); }
.empty { padding: 24px; text-align: center; color: var(--text2); }

/* Chart */
.chart-box { position: relative; }
#chart svg { display: block; overflow: visible; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-base { stroke: var(--line2); }
.c-ax { fill: var(--text3); font-size: 11px; font-family: var(--sans); }
.c-plan { fill: none; stroke: var(--plan); stroke-width: 2; stroke-dasharray: 5 4; }
.c-actual { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; }
.c-area { fill: var(--brand-dim); }
.c-night { fill: var(--night); }
.c-now { stroke: var(--text3); stroke-dasharray: 2 3; }
.c-dot { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.c-lab { fill: var(--text); font-size: 12px; font-weight: 700; font-family: var(--sans); }
.c-lab2 { fill: var(--text2); font-weight: 600; }
.c-cross { stroke: var(--text3); }
.c-hdot-a { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.c-hdot-e { fill: var(--plan); stroke: var(--surface); stroke-width: 2; }
.tip { position: absolute; pointer-events: none; background: var(--surface2); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font-size: 12px; display: grid; gap: 3px; min-width: 150px; box-shadow: var(--shadow); }
.tip span { display: flex; align-items: center; gap: 6px; color: var(--text2); }
.tip span b { margin-left: auto; color: var(--text); }

/* Toolbar */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="search"] { width: 280px; padding: 7px 10px; }
.toolbar select { padding: 7px 10px; max-width: 260px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips button, .seg-btn button { border: 1px solid var(--line); background: var(--surface2); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--text2); display: inline-flex; gap: 5px; align-items: center; }
.chips button[aria-pressed="true"], .seg-btn button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chips .n { opacity: .7; font-variant-numeric: tabular-nums; }
.seg-btn { display: flex; }
.seg-btn button:first-child { border-radius: 999px 0 0 999px; } .seg-btn button:last-child { border-radius: 0 999px 999px 0; }

/* Table */
.table-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 10px; }
.tbl, .heat { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .heat th { position: sticky; top: 0; background: var(--surface2); z-index: 1; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text2); border-bottom: 1px solid var(--line2); }
.tbl th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; padding: 9px 10px; white-space: nowrap; }
.tbl th.num button { justify-content: flex-end; width: 100%; box-sizing: border-box; }
.sort-i { font-size: 9px; color: var(--brand); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td .sub { display: block; color: var(--text3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.tbl td.num .ic { margin-right: 4px; }
.tbl .dim { color: var(--text3); }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover, .heat tbody tr:hover { background: var(--surface2); }
.tbl tbody tr.sel { background: var(--brand-dim); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.tbl small { color: var(--text3); }
.cbar { display: grid; grid-template-columns: minmax(70px, 110px) 52px; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; justify-content: start; }
.cbar span { text-align: right; }

/* Heatmap */
.heat th { padding: 8px 2px; text-align: center; }
.heat th.h-name { text-align: left; padding-left: 10px; }
.heat th.night { color: #9aa8e0; }
.heat th.now { color: var(--brand); }
.heat td { padding: 0; border-bottom: 1px solid var(--line); }
.heat td.h-name { padding: 5px 10px; max-width: 280px; min-width: 200px; cursor: pointer; }
.heat td.h-name small { display: block; color: var(--text3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.heat td.num { padding: 0 8px; }
td.hc { width: 32px; min-width: 28px; height: 34px; text-align: center; font-size: 11px; font-weight: 700; border-left: 2px solid var(--surface); }
.hc.l0 { background: var(--h0); color: var(--text3); } .hc.l1 { background: var(--h1); } .hc.l2 { background: var(--h2); } .hc.l3 { background: var(--h3); color: #fff; } .hc.l4 { background: var(--h4); color: #0b0b0b; }
.hc.fut { background: transparent; }
.hc.miss { box-shadow: inset 0 0 0 2px var(--critical); }
td.hc.now { outline: 2px solid var(--brand); outline-offset: -2px; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--text2); margin-bottom: 10px; }
.heat-legend i.hc { display: inline-block; width: 16px; height: 12px; border-radius: 3px; margin-left: 8px; }
.heat-legend .sep { width: 12px; }

/* Drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--surface); border-left: 1px solid var(--line2); box-shadow: -20px 0 40px rgba(0,0,0,.35); padding: 24px; overflow: auto; z-index: 20; transform: translateX(100%); transition: transform .2s ease; }
.drawer.open { transform: none; }
.drawer-x { position: absolute; top: 16px; right: 16px; }
.drawer h2 { font-size: 20px; margin: 2px 40px 4px 0; }
.drawer h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text2); margin: 20px 0 8px; }
.drawer p { margin: 0 0 8px; }
.eyebrow { font-size: 12px; color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-right: 40px !important; }
.btn-call { display: inline-block; text-decoration: none; margin: 6px 0; background: var(--brand); color: var(--brand-ink); border: 0; }
.d-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.d-kpis div { background: var(--surface2); border-radius: 10px; padding: 10px; display: grid; gap: 4px; }
.d-kpis span { font-size: 11px; color: var(--text2); }
.d-kpis b { font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.d-kpis small { color: var(--text3); font-weight: 500; }
.strip { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.strip i { height: 26px; border-radius: 3px; }
.strip i.fut { background: var(--surface2); opacity: .5; }
.strip-ax { display: flex; justify-content: space-between; font-size: 10px; color: var(--text3); margin-top: 4px; }
.rlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.rlist li { display: flex; gap: 10px; align-items: center; padding: 7px 10px; background: var(--surface2); border-radius: 8px; font-size: 13px; flex-wrap: wrap; }
.rlist li b { font-family: var(--mono); }
.rlist li span:not(.pill) { flex: 1; color: var(--text2); min-width: 120px; }

/* Dialog */
.dlg { width: min(980px, calc(100vw - 32px)); max-height: 88vh; background: var(--surface); color: var(--text); border: 1px solid var(--line2); border-radius: 16px; padding: 20px; }
.dlg::backdrop { background: rgba(0,0,0,.55); }
.fsec { margin-top: 16px; }
.fsec h3 { font-size: 15px; margin-bottom: 10px; }
.fsec h3 small { color: var(--text3); font-weight: 500; font-size: 12px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.fgrid label { display: grid; gap: 3px; font-size: 12px; color: var(--text2); font-weight: 600; }
.fgrid select { padding: 6px 8px; font-size: 13px; }
.fs-sample { color: var(--text3); font-weight: 400; font-family: var(--mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsec pre { background: var(--surface2); padding: 12px; border-radius: 8px; font-size: 11px; max-height: 260px; overflow: auto; }
.fsec details { margin-top: 10px; }
.dlg-f { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.dlg-f .grow { flex: 1; }
.diag { width: 100%; margin-top: 12px; font-family: var(--mono); font-size: 11px; background: var(--surface2); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 10px; }
.warn-item code { font-family: var(--mono); background: var(--surface2); padding: 1px 4px; border-radius: 4px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 30; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast[data-kind="error"] { background: var(--critical); color: #fff; }
.foot { font-size: 12px; text-align: center; }

/* Alcance + turnos + horas */
.scope { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.scope label { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 13px; color: var(--text2); }
.scope select { max-width: 320px; padding: 6px 10px; }
.scale { display: flex; gap: 16px; margin-left: auto; font-size: 12px; color: var(--text2); flex-wrap: wrap; }
.scale span { display: inline-flex; align-items: center; gap: 6px; }
.txt-good { color: var(--brand); font-weight: 600; }
.kpi-turnos { display: grid; gap: 6px; }
.trow { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 10px; align-items: baseline; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.trow.is-cur { background: var(--surface2); }
.trow .bar { grid-column: 1 / -1; grid-row: 2; }
.trow-n { font-weight: 700; display: flex; gap: 8px; align-items: baseline; }
.trow-n em { font-style: normal; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); }
.trow-pct { text-align: right; font-variant-numeric: tabular-nums; }
.trow-p { font-size: 12px; color: var(--text3); min-width: 74px; text-align: right; }
.bar-lg { height: 12px; }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 4px; height: 160px; align-items: end; }
.hcol { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; text-align: center; min-width: 0; }
.hcol i { display: block; border-radius: 4px 4px 0 0; min-height: 0; }
.hcol.day i { background: #408320; } .hcol.night i { background: #b2b2b2; }
:root:not([data-theme="light"]) .hcol.night i { background: #8d949b; }
.hcol .hv { font-size: 11px; color: var(--text2); line-height: 16px; font-variant-numeric: tabular-nums; }
.hcol .hh { font-size: 10px; color: var(--text3); padding-top: 4px; border-top: 1px solid var(--line2); }
.hcol.now .hh { color: var(--brand); font-weight: 800; }
.hcol.fut .hh { opacity: .5; }
.sw-day { height: 10px; width: 10px; background: #408320; } .sw-nightbar { height: 10px; width: 10px; background: #b2b2b2; }

/* Impresión (informe para el cliente) */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface2: #f1f5f7; --text: #16202d; --text2: #55606b; --text3: #8a949e; --line: #e2e8ed; --line2: #d0d8dd; --shadow: none; }
  .tb-actions, .sync, .toolbar, .chips, .drawer, .demo-banner, #chartTip, #warnings .link { display: none !important; }
  .table-wrap { max-height: none; overflow: visible; }
  .card, .kpi { break-inside: avoid; }
  body { font-size: 11px; }
}

/* Modo TV (pantalla de central) */
body.tv { font-size: 16px; }
body.tv .kpi-val { font-size: 42px; }
body.tv .clock { font-size: 38px; }
body.tv .tb-actions .icon-btn:not(#tvBtn):not(#refreshBtn) { display: none; }

@media (max-width: 1250px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi-hero { grid-column: 1 / -1; grid-row: auto; display: grid; grid-template-columns: 210px 1fr; column-gap: 24px; align-items: center; }
  .kpi-hero-l { grid-column: 1; grid-row: 2; margin: 0; }
  .kpi-turnos { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar, .shiftbar, main { padding-left: 16px; padding-right: 16px; }
  .toolbar input[type="search"] { width: 100%; }
}
@media (max-width: 700px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi-hero { display: flex; } .kpi-turnos { grid-column: auto; } .kpi-val { font-size: 28px; } .hours { height: 130px; gap: 2px; } .hcol .hv { font-size: 9px; } .hcol .hh { font-size: 8px; } .scale { margin-left: 0; } .tb-time { justify-items: start; } }
@media (prefers-reduced-motion: reduce) { .ring, .drawer { animation: none !important; transition: none !important; } }
