/* ==========================================================================
   SITUATION ROOM · STYLES
   Calm, low-glare dark theme for long viewing sessions on a wall display
   (1920×1080), scaling down to laptops. No glows, no looping animation —
   motion is reserved for data actually changing.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0e131b;
  --surface: #151c27;
  --surface-2: #1b2431;
  --surface-3: #222c3b;
  --border: #243041;
  --border-2: #2f3c50;

  /* Ink */
  --text-1: #e6ebf2;
  --text-2: #a3aebd;
  --text-3: #6e7a8b;

  /* UI accents (never data) */
  --accent: #7fa7d9;
  --gold: #c8a45a;
  --gold-2: #d8bb7a;

  /* Party series (validated categorical order on dark surface) */
  --apc: #3987e5;
  --pdp: #d95926;
  --lp: #199e70;
  --adc: #9085e9;
  --oth: #5d6679;

  /* Status (reserved; always paired with icon + label) */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;

  --r: 12px;
  --gap: 12px;
  --f-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* Experiment: Akwa Ibom state orange as the UI accent (toggle with C / dock button).
   Kept to chrome only — never data — and tuned amber so it doesn't read as PDP (#d95926)
   or the "serious" status (#ec835a). */
:root[data-accent="state"] {
  --gold: #f08a1c;
  --gold-2: #f6a23c;
}
/* Thin state-colour band along the top edge of the screen */
:root[data-accent="state"] body::before { content: ''; position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 90; background: linear-gradient(90deg, var(--gold) 0%, var(--gold-2) 60%, transparent 100%); pointer-events: none; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text-1); font-family: var(--f-ui); font-size: 13px; overflow: hidden; -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum' 1, 'cv11' 1; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
kbd { font-family: var(--f-mono); font-size: 10px; padding: 1px 5px; border: 1px solid var(--border-2); border-radius: 4px; color: var(--text-3); }
.muted { color: var(--text-3); }

.app { width: 100%; min-width: 0; height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 64px 96px 1fr 36px; gap: var(--gap); padding: var(--gap) 16px; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ph-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 10px; flex-shrink: 0; }
.ph-head h2 { font-size: 14px; font-weight: 600; color: var(--text-1); white-space: nowrap; display: flex; align-items: baseline; gap: 8px; }
/* Title with its subtitle on a second line, for headers that also carry a tag */
.ph-head h2.stack { flex-direction: column; align-items: flex-start; gap: 2px; white-space: normal; min-width: 0; }
.ph-head h2 em { font-style: normal; font-weight: 400; font-size: 12px; color: var(--text-3); }
.tag { font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tag.ghost { background: transparent; color: var(--text-3); }
.tag.red { background: rgba(208, 59, 59, .15); color: #f19a9a; }
.tag.gold { background: color-mix(in srgb, var(--gold) 15%, transparent); color: var(--gold-2); }

.btn { height: 32px; padding: 0 12px; border: 1px solid var(--border-2); border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface); transition: background .2s, color .2s, border-color .2s; }
.btn:hover { color: var(--text-1); background: var(--surface-2); }
.btn.icon { width: 32px; padding: 0; }
.btn.on { color: var(--bg); background: var(--gold-2); border-color: var(--gold-2); }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden; background: var(--surface); padding: 2px; gap: 2px; }
.seg button { padding: 0 10px; height: 26px; font-size: 12px; font-weight: 500; color: var(--text-3); border-radius: 6px; transition: background .2s, color .2s; }
.seg button:hover { color: var(--text-1); }
.seg button.on { color: var(--text-1); background: var(--surface-3); }

/* ---------- Top bar ---------- */
.topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.crest { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; object-fit: cover; object-position: center 15%; border: 2px solid var(--gold); background: var(--surface-3); }
.brand-title { font-size: 19px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.brand-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 20px; background: rgba(12, 163, 12, .12); color: #7fd37f; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.live-pill.paused { background: rgba(250, 178, 25, .12); color: var(--warning); }
.live-pill.paused i { background: var(--warning); }

.phasebar { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); max-width: 620px; justify-self: center; width: 100%; }
.ph { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-3); }
.ph-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border-2); background: var(--bg); z-index: 1; transition: background .6s, border-color .6s; }
.ph-t { font-size: 12px; font-weight: 500; white-space: nowrap; }
.ph-s { font-size: 11px; }
.ph.done { color: var(--text-2); }
.ph.done .ph-dot { background: var(--text-3); border-color: var(--text-3); }
.ph.active { color: var(--text-1); }
.ph.active .ph-dot { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 18%, transparent); }
.ph.active .ph-t { font-weight: 600; }
.ph-progress { position: absolute; left: 10%; right: 10%; top: 4px; height: 2px; background: var(--border); }
.ph-progress i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 1.2s ease; }

.topright { display: flex; align-items: center; gap: 18px; }
.threat { display: flex; flex-direction: column; gap: 2px; }
.th-lbl { font-size: 11px; color: var(--text-3); }
.th-val { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; color: #7fd37f; transition: color .6s; }
.th-val i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.threat[data-l="3"] .th-val { color: var(--warning); }
.threat[data-l="4"] .th-val { color: var(--serious); }
.threat[data-l="5"] .th-val { color: #f07a7a; }
.clock { text-align: right; padding-left: 18px; border-left: 1px solid var(--border); }
.clock-time { font-size: 24px; font-weight: 600; letter-spacing: -.01em; line-height: 1.05; }
.clock-date { font-size: 11px; color: var(--text-3); margin-top: 3px; }
/* IReV preview dock: fixed edge tab with a collapsible, scrollable control panel. */
.tdock { --dock-bg: var(--gold-2); position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; pointer-events: none; }
.tdock > * { pointer-events: auto; }
.tdock__btn { position: relative; width: 46px; height: 52px; display: grid; place-items: center; border-radius: 14px 0 0 14px; background: var(--dock-bg); color: #2b1f00; box-shadow: 0 8px 32px #0006; transition: width .2s; }
.tdock__btn:hover, .tdock.is-open .tdock__btn { width: 52px; }
.tdock__dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--critical); box-shadow: 0 0 0 2px var(--dock-bg); }
.tdock__panel { width: min(360px, calc(100vw - 72px)); max-height: min(86vh, 740px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 20px; box-shadow: 0 16px 60px #0008; padding: 18px; display: flex; flex-direction: column; gap: 16px; animation: dockIn .22s ease; }
.tdock__panel[hidden] { display: none; }
@keyframes dockIn { from { opacity: 0; transform: translateX(14px); } }
.tdock__head { display: flex; justify-content: space-between; gap: 12px; }
.tdock__head h2 { font-size: 16px; font-weight: 600; }
.tdock__head p { font-size: 12px; line-height: 1.5; color: var(--text-2); margin-top: 4px; }
.tdock__close { width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; font-size: 22px; color: var(--text-2); }
.tdock__close:hover { background: var(--surface-3); color: var(--text-1); }
.tdock__now { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; border-radius: 14px; background: #2b230f; color: #f6e3ae; }
.tdock__now b { font: 500 15px var(--f-mono); }
.tdock__now > span:last-child { font-size: 12px; }
.tdock__label { font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text-2); }
.tdock__now .tdock__label { color: inherit; opacity: .75; }
.tdock__section { display: flex; flex-direction: column; gap: 8px; }
.tdock__phases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tdock__phases button, .tdock__play button, .tdock__restart { padding: 8px 6px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-2); font-size: 12px; font-weight: 500; color: var(--text-2); }
.tdock__phases button:hover, .tdock__play button:hover, .tdock__restart:hover { background: var(--surface-3); color: var(--text-1); }
.tdock__phases button[aria-pressed="true"], .tdock__play button[aria-pressed="true"] { background: var(--gold-2); border-color: var(--gold-2); color: var(--bg); }
.tdock__play, .tdock__speeds { display: flex; gap: 6px; }
.tdock__play > button { width: 36px; flex-shrink: 0; }
.tdock__speeds { flex: 1; }
.tdock__speeds button { flex: 1; min-width: 0; }
.tdock__section input[type="range"] { width: 100%; accent-color: var(--gold-2); cursor: pointer; }
.tdock__scale { display: flex; justify-content: space-between; gap: 6px; font-size: 10px; color: var(--text-3); }
.tdock__restart { margin-top: 5px; }
.tdock__tools { display: flex; flex-wrap: wrap; gap: 6px; }
.tdock__tools .btn { flex: 1; padding: 0 8px; white-space: nowrap; }
.tdock__note { font-size: 11px; color: var(--text-3); }
.tdock button:focus-visible, .tdock input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 600px) {
  .tdock { top: auto; bottom: max(24px, env(safe-area-inset-bottom)); transform: none; align-items: flex-end; }
  .tdock__panel { max-height: calc(100dvh - 60px); padding: 14px; }
  .tdock__tools .btn { flex-basis: 100%; }
}

/* ---------- KPI strip ---------- */
.kpis { display: grid; grid-template-columns: repeat(8, 1fr); gap: var(--gap); }
.kpi { padding: 13px 16px 12px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; justify-content: space-between; min-width: 0; transition: border-color .6s, background .6s; }
.kpi-l { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-v { font-size: 25px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.kpi-v small { font-size: 13px; color: var(--text-3); font-weight: 400; margin-left: 3px; letter-spacing: 0; }
.kpi-s { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-s .up { color: #7fd37f; } .kpi-s .down { color: var(--serious); }
.kpi-meter { position: relative; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.kpi-meter i, .kpi-meter em { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 2px; transition: width 1.2s ease; }
.kpi-meter i { background: var(--accent); }
.kpi-meter em { background: rgba(255, 255, 255, .45); height: 1px; top: auto; }
.spark { width: 100%; height: 22px; display: block; }
.kpi.lead { border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.kpi.alert.hot { border-color: rgba(208, 59, 59, .45); background: linear-gradient(180deg, rgba(208, 59, 59, .08), var(--surface)); }
.kpi.alert.hot .kpi-v { color: #f19a9a; }

/* ---------- Main grid ---------- */
.main { display: grid; grid-template-columns: minmax(330px, 23%) minmax(0, 1fr) minmax(350px, 24.5%); gap: var(--gap); min-height: 0; }
.col { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; min-width: 0; }

/* ---------- Race ---------- */
.race { flex-shrink: 0; }
.principal { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; padding: 2px 16px 12px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--surface-3); border: 2px solid var(--gold); }
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 15%; display: block; }
.pr-txt { min-width: 0; }
.pr-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-meta { font-size: 11.5px; color: var(--text-3); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.pr-role { font-size: 11.5px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; color: #fff; }
.chip.apc { background: var(--apc); }
.pr-share { text-align: right; white-space: nowrap; }
.pr-pct { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.pr-votes { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.bars { padding: 0 16px 10px; display: flex; flex-direction: column; gap: 5px; }
.bar-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.bar-row .pid { font-weight: 600; font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.bar-row .pid i { width: 8px; height: 8px; border-radius: 2px; }
.bar-track { height: 10px; border-radius: 5px; background: var(--surface-3); position: relative; overflow: hidden; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 5px; transition: width 1.4s cubic-bezier(.2, .8, .2, 1); }
.bar-row.principal-row .bar-track { height: 14px; border-radius: 7px; }
.bar-row .bv { font-size: 12px; text-align: right; color: var(--text-1); font-weight: 500; min-width: 64px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-row .bv span { color: var(--text-3); font-size: 11px; display: block; font-weight: 400; }
.fifty { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: rgba(255, 255, 255, .25); }

.race-foot { display: grid; grid-template-columns: 160px 1fr; gap: 14px; padding: 10px 16px 14px; border-top: 1px solid var(--border); align-items: center; }
.gauge-wrap { position: relative; }
.gauge { width: 100%; display: block; }
.g-track { fill: none; stroke: var(--surface-3); stroke-width: 12; stroke-linecap: round; }
.g-val { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke .6s; }
.g-tick { display: none; }
.g-needle { display: none; }
.g-hub { display: none; }
.gauge-v { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; pointer-events: none; }
.gauge-v b { font-size: 20px; font-weight: 600; display: block; letter-spacing: -.02em; }
.gauge-v span { font-size: 11px; color: var(--text-3); }
.race-stats { display: grid; gap: 8px; }
.race-stats div { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.race-stats div:last-child { border-bottom: 0; padding-bottom: 0; }
.race-stats b { color: var(--text-1); font-weight: 500; }

/* ---------- LGA board ---------- */
.board { flex: 1; }
.board-all { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 5px 8px; border: 1px solid var(--border-2); border-radius: 6px; color: var(--text-2); font-size: 11.5px; text-decoration: none; }
.board-all:hover, .board-all:focus-visible { color: var(--text-1); background: var(--surface-3); }
.board-head, .board-row { display: grid; grid-template-columns: 1.35fr .8fr .95fr 1fr .9fr; gap: 8px; align-items: center; padding: 0 16px; }
.board-head { height: 28px; font-size: 11px; color: var(--text-3); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.board-body { overflow: auto; flex: 1; }
.board-row { height: 33px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .2s; position: relative; }
.board-row:last-child { border-bottom: 0; }
.board-row:hover, .board-row.focus { background: var(--surface-2); }
.board-row.focus::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--gold); }
.board-row .ln { font-weight: 500; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-row .ln small { display: block; font-weight: 400; font-size: 11px; color: var(--text-3); }
.board-row .ln .home-star { color: var(--gold); }
.home-star { cursor: help; }
.board-row .cv { font-size: 12px; }
.mini { height: 3px; border-radius: 2px; background: var(--surface-3); margin-top: 4px; overflow: hidden; }
.mini i { display: block; height: 100%; background: var(--accent); transition: width 1.2s ease; }
.share { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 1px; background: var(--surface-3); margin-top: 4px; }
.share i { display: block; height: 100%; transition: width 1.2s ease; }
.st { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 20px; background: var(--surface-3); color: var(--text-3); white-space: nowrap; display: inline-block; }
.st.voting { color: var(--accent); background: rgba(127, 167, 217, .12); }
.st.counting { color: var(--warning); background: rgba(250, 178, 25, .1); }
.st.collating { color: var(--serious); background: rgba(236, 131, 90, .1); }
.st.collated { color: #7fd37f; background: rgba(12, 163, 12, .12); }

/* ---------- Map ---------- */
.mappanel { flex: 1; }
.map-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#map { position: absolute; inset: 8px 24px 40px; width: calc(100% - 48px); height: calc(100% - 48px); }
.hex { stroke: var(--surface); stroke-width: 1.4; cursor: pointer; transition: fill 1.2s ease, fill-opacity 1.2s ease, opacity .5s; }
.hex:hover { stroke: #fff; stroke-width: 1.4; }
.hex.dim { opacity: .2; }
.lga-border { fill: none; stroke: rgba(230, 235, 242, .55); stroke-width: 1; stroke-linecap: round; pointer-events: none; }
.lga-label { pointer-events: none; }
.ll-name { font-family: var(--f-ui); font-weight: 600; font-size: 6.4px; fill: #fff; paint-order: stroke; stroke: rgba(14, 19, 27, .8); stroke-width: 2.2px; }
.ll-stat { font-family: var(--f-ui); font-size: 5.2px; fill: var(--text-2); paint-order: stroke; stroke: rgba(14, 19, 27, .8); stroke-width: 2px; }
.crit-dot { fill: #fff; stroke: var(--critical); stroke-width: 1.4; pointer-events: none; }
.map-hud { position: absolute; font-size: 11.5px; color: var(--text-2); pointer-events: none; }
.map-hud.tr { right: 16px; top: 6px; max-width: 46%; }
.map-hud.bl { left: 16px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 12px; max-width: 72%; }
.map-hud.br { right: 16px; bottom: 12px; color: var(--text-3); }
.lg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg i.empty { background: #232d3c !important; }
.lg i.hatch { background: repeating-linear-gradient(45deg, #232d3c 0 2px, #344257 2px 4px); }
.lg i.line { width: 14px; height: 3px; border-radius: 2px; }
.lg i.dash { width: 14px; height: 0; border-top: 2px dashed var(--text-3); border-radius: 0; }
.lg b { color: var(--text-1); font-weight: 600; font-variant-numeric: tabular-nums; }
.lg.note { color: var(--text-3); }
.lg.ramp b { width: 110px; height: 8px; border-radius: 4px; display: inline-block; }
.spot { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 12px 14px; min-width: 210px; animation: fadeIn .5s ease; }
.spot .k { font-size: 11px; color: var(--text-3); }
.spot .n { font-weight: 600; font-size: 17px; color: var(--text-1); margin: 2px 0 8px; }
.spot .g { display: grid; grid-template-columns: auto auto; gap: 4px 18px; font-size: 12px; }
.spot .g span { color: var(--text-3); }
.spot .g b { color: var(--text-1); font-weight: 500; text-align: right; }
@keyframes fadeIn { from { opacity: 0; } }
.legend-inline { display: flex; gap: 14px; }

/* ---------- Charts ---------- */
.charts-row { display: grid; grid-template-columns: 1.25fr 1fr; gap: var(--gap); height: 220px; flex-shrink: 0; }
.chart-host { flex: 1; min-height: 0; position: relative; padding: 0 10px 4px 4px; }
.chart { display: block; overflow: visible; }
.chart .grid { stroke: rgba(255, 255, 255, .05); }
.chart .tick { font-family: var(--f-ui); font-size: 10.5px; fill: var(--text-3); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.dash { stroke-dasharray: 4 4; stroke-width: 1.5; }
.chart .cross { stroke: rgba(255, 255, 255, .25); stroke-dasharray: 2 3; pointer-events: none; }
.chart .head { stroke: var(--surface); stroke-width: 2; }

/* ---------- Incident desk ---------- */
.desk { flex: 1; }
.desk h2 { display: flex; align-items: center; gap: 8px; }
.desk-all { font-size: 11.5px; color: var(--text-3); text-decoration: none; white-space: nowrap; }
.desk-all:hover { color: var(--text-1); }

/* ---------- Incidents ---------- */
.flash-list { overflow: auto; flex: 1; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.empty-state { color: var(--text-3); font-size: 12.5px; text-align: center; padding: 30px 10px; }
.fp { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); animation: fadeIn .6s ease; }
.fp.critical { --sev: var(--critical); border-color: rgba(208, 59, 59, .35); }
.fp.serious { --sev: var(--serious); }
.fp.warning { --sev: var(--warning); }
.fp-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; color: var(--sev); background: color-mix(in srgb, var(--sev) 16%, transparent); }
.fp-t { font-weight: 600; font-size: 12.5px; line-height: 1.3; }
.fp-m { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.fp-m b { color: var(--text-2); font-weight: 500; }
.fp-s { margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fp-state { font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); text-transform: capitalize; }
.fp-state.open { color: #f19a9a; background: rgba(208, 59, 59, .12); }
.fp-state.acknowledged { color: var(--warning); background: rgba(250, 178, 25, .1); }
.fp-state.responding { color: var(--accent); background: rgba(127, 167, 217, .12); text-transform: none; }
.fp-act { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.fp-act .ago { font-size: 11px; color: var(--text-3); }
.fp-act button { font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border-2); color: var(--text-2); transition: background .2s, color .2s; }
.fp-act button:hover { color: var(--text-1); background: var(--surface-3); }
.fp-act button.go { color: var(--text-1); background: var(--surface-3); }
.fp-act button.go:hover { background: var(--gold-2); color: var(--bg); border-color: var(--gold-2); }

/* ---------- Ops ---------- */
.ops { flex-shrink: 0; }
.ops-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; padding: 2px 16px 16px; }
.op-l { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); }
.op-l b { color: var(--text-1); font-weight: 500; }
.op-m { height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.op-m i { display: block; height: 100%; border-radius: 2px; background: var(--accent); transition: width 1.2s ease, background .6s; }
.op-m i.warn { background: var(--warning); }
.op-m i.bad { background: var(--critical); }

/* ---------- Status bar ---------- */
.statusbar { min-width: 0; max-width: 100%; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 12px; color: var(--text-2); }
.sb-reports { overflow: hidden; display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.report-ticker { position: relative; overflow: hidden; min-width: 0; flex: 1; }
.report-track { display: flex; width: max-content; animation: reportScroll var(--report-duration, 60s) linear infinite; }
.report-track:not(:has(.report-group)) { animation: none; }
.report-group { display: flex; flex-shrink: 0; align-items: center; }
.report-item { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding-right: 8px; color: var(--text-2); text-decoration: none; }
.report-item::after { content: '·'; color: var(--text-3); margin-left: 0; }
.report-item:hover { color: var(--text-1); }
.report-time { color: var(--text-3); font-size: 11px; }
.report-item b { font-weight: 500; }
.report-ticker:hover .report-track, .report-ticker:focus-within .report-track { animation-play-state: paused; }
.report-ticker:focus-within { overflow-x: auto; }
.report-ticker:focus-within .report-track { animation: none; }
@keyframes reportScroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .report-ticker { overflow-x: auto; }
  .report-track { animation: none !important; }
  .report-group[aria-hidden], .report-item[aria-hidden] { display: none; }
}
.sb-k { font-size: 11px; font-weight: 600; color: var(--gold-2); flex-shrink: 0; }
.sb-meta { flex-shrink: 0; display: flex; gap: 20px; color: var(--text-3); white-space: nowrap; align-items: center; }
.sb-meta i.ok { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--good); margin-right: 6px; }
.sb-meta b { color: var(--text-2); font-weight: 500; }
.sb-meta .keys { display: flex; gap: 5px; align-items: center; }

/* ---------- Clickable data points (dashboard) ---------- */
[data-href] { cursor: pointer; }
.kpi[data-href]:hover, .op[data-href]:hover { border-color: var(--border-2); background: var(--surface-2); }
.principal[data-href], .race-foot[data-href], .bar-row[data-href] { border-radius: 8px; transition: background .2s; }
.principal[data-href]:hover, .race-foot[data-href]:hover { background: var(--surface-2); }
.bar-row[data-href]:hover .pid { color: var(--text-1); }
.fi[data-href]:hover, .fp[data-href]:hover { background: var(--surface-3); }
.fi[data-href] { transition: background .2s; }
.op { padding: 4px 6px; margin: -4px -6px; border-radius: 8px; border: 1px solid transparent; transition: background .2s; }
.phasebar[data-href]:hover .ph-t, .threat[data-href]:hover .th-lbl { color: var(--text-1); }
.chart-host[data-href]:hover { background: rgba(255, 255, 255, .015); }
.ph-head h2 a { color: inherit; text-decoration: none; }
.ph-head h2 a:hover { color: var(--gold-2); }

/* ---------- Detail pages ---------- */
.page-root { position: fixed; inset: 0; overflow: auto; background: var(--bg); z-index: 40; }
.page-root[hidden], .app[hidden] { display: none; }
.pg { max-width: 1480px; margin: 0 auto; padding: 0 28px 48px; }
.pg-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; padding: 14px 0; background: var(--bg); border-bottom: 1px solid var(--border); }
.pg-home { display: flex; align-items: center; gap: 10px; color: var(--text-1); text-decoration: none; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.pg-home .crest { width: 30px; height: 30px; border-width: 1.5px; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--text-1); }
.crumbs i { font-style: normal; color: var(--border-2); }
.crumbs .cur { color: var(--text-1); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.pg-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pg-right a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.pg-clock { font-size: 18px; font-weight: 600; padding: 0 6px; }
.pg-hero { padding: 28px 0 20px; }
.pg-kicker { font-size: 13px; color: var(--text-3); }
.pg-hero h1 { font-size: 32px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; display: flex; align-items: center; gap: 10px; }
.pg-hero h1 .dot { width: 14px; height: 14px; border-radius: 4px; }
.pg-sub { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 22px; }
.pg-body { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .card { min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.sc { padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.sc.clickable { transition: background .2s, border-color .2s; }
.sc.clickable:hover { background: var(--surface-2); border-color: var(--border-2); }
.sc-l { font-size: 12px; color: var(--text-3); }
.sc-v { font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-s { font-size: 12px; color: var(--text-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 18px 10px; }
.card-h h3 { font-size: 15px; font-weight: 600; }
.card-n { font-size: 12px; color: var(--text-3); display: flex; gap: 12px; }
.card-b { padding: 0 18px 16px; }
.chart-box { height: 260px; position: relative; }
.toolbar { display: flex; gap: 8px; padding: 0 18px 12px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 220px; height: 34px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 8px; padding: 0 12px; color: var(--text-1); font: 13px var(--f-ui); outline: none; }
.toolbar input:focus { border-color: var(--accent); }
.toolbar select { height: 34px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 8px; padding: 0 10px; color: var(--text-1); font: 12.5px var(--f-ui); }
.toolbar select:disabled { color: var(--text-3); cursor: not-allowed; }
/* People: avatar (illustrated face over an initials fallback) */
.pav { width: var(--s); height: var(--s); flex-shrink: 0; position: relative; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; background: hsl(var(--h) 35% 30%); color: hsl(var(--h) 60% 85%); font-size: calc(var(--s) * .38); font-weight: 600; vertical-align: middle; }
.pav img { position: absolute; inset: 0; width: 100%; height: 100%; }
.who { display: inline-flex; align-items: center; gap: 9px; }
.who small { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }
.person { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.person .pav { border: 2px solid var(--border-2); }
.person-n { font-size: 16px; font-weight: 600; }
.person-r { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.ag-st { font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 20px; background: var(--surface-3); white-space: nowrap; }
.ag-st.reported { color: #7fd37f; background: rgba(12, 163, 12, .12); }
.ag-st.in { color: var(--accent); background: rgba(127, 167, 217, .12); }
.ag-st.out { color: #f19a9a; background: rgba(208, 59, 59, .12); }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3); padding: 9px 10px; border-bottom: 1px solid var(--border-2); white-space: nowrap; cursor: pointer; user-select: none; }
.tbl th:hover { color: var(--text-1); }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.tbl td b { color: var(--text-1); font-weight: 600; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr[data-href]:hover td { background: var(--surface-2); color: var(--text-1); }
.tbl tfoot td { border-top: 1px solid var(--border-2); border-bottom: 0; color: var(--text-2); }
.tbl.compact td { padding: 7px 4px; }
.tbl .sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.tbl .ok { color: #7fd37f; }
.empty-cell { text-align: center !important; color: var(--text-3) !important; padding: 24px !important; }
.tbl-foot { font-size: 12px; color: var(--text-3); padding: 10px 10px 0; }
.mono { font-family: var(--f-mono); font-size: 12px; color: var(--text-3); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: 0; }

.sharebar { display: flex; height: 26px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--surface-3); margin-bottom: 12px; }
.sharebar i { display: flex; align-items: center; padding-left: 8px; font-style: normal; font-size: 11.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; transition: width 1s ease; }

.barlist { display: flex; flex-direction: column; gap: 4px; }
.bl-row { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 70px; gap: 12px; align-items: center; padding: 5px 6px; border-radius: 6px; font-size: 13px; }
.bl-row[data-href]:hover { background: var(--surface-2); }
.bl-l { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-t { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bl-t i { display: block; height: 100%; border-radius: 4px; transition: width 1s ease; }
.bl-v { text-align: right; color: var(--text-1); font-weight: 500; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 24px; font-size: 13px; }
.kv span { color: var(--text-3); }
.kv b { color: var(--text-1); font-weight: 500; text-align: right; }
.lnk { color: var(--accent); text-decoration: none; }
.lnk:hover { text-decoration: underline; }
.prose { font-size: 13.5px; line-height: 1.6; color: var(--text-2); max-width: 820px; }
.prose b { color: var(--text-1); }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-bottom: 14px; }
.meter.big { height: 12px; border-radius: 6px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 1s ease; }

.inc-list { display: flex; flex-direction: column; gap: 8px; }
.inc-list .fp { animation: none; }
.actions { display: flex; gap: 8px; }
.actions:empty { display: none; }
.btn.pri { background: var(--gold-2); color: var(--bg); border-color: var(--gold-2); }
.btn.pri:hover { background: var(--gold); color: var(--bg); }
.sev { font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 20px; white-space: nowrap; }
.sev-critical { color: #f19a9a; background: rgba(208, 59, 59, .14); }
.sev-serious { color: var(--serious); background: rgba(236, 131, 90, .12); }
.sev-warning { color: var(--warning); background: rgba(250, 178, 25, .1); }

.chiplinks { display: flex; flex-wrap: wrap; gap: 6px; }
.cl { font-size: 12px; padding: 5px 11px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); text-decoration: none; transition: background .2s; }
.cl:hover { background: var(--surface-3); color: var(--text-1); }
.cl.on { border-color: var(--gold); color: var(--text-1); }

/* Timelines (PU activity, incident lifecycle, day log) */
.tl { list-style: none; position: relative; display: flex; flex-direction: column; gap: 2px; }
.tl li { display: grid; grid-template-columns: 52px 1fr; gap: 14px; padding: 8px 8px 8px 0; font-size: 13px; color: var(--text-2); position: relative; border-radius: 6px; }
.tl li::before { content: ''; position: absolute; left: 62px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.tl li > span:last-child { padding-left: 22px; }
.tl li[data-href]:hover { background: var(--surface-2); }
.tl-t { color: var(--text-3); font-size: 12.5px; text-align: right; }
.tl .tl-good::before { background: var(--good); }
.tl .tl-warning::before { background: var(--warning); }
.tl .tl-serious::before { background: var(--serious); }
.tl .tl-critical::before { background: var(--critical); }
.tl .tl-phase::before { background: var(--gold); }
.tl .tl-results::before { background: var(--apc); }
.tl .tl-pending { opacity: .5; }
.tl .tl-pending::before { background: transparent; border: 1.5px solid var(--text-3); }
.tl .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tl.big li { font-size: 14px; padding: 10px 8px 10px 0; }

/* Status chips shared by dashboard and pages */
.pst { font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 20px; background: var(--surface-3); white-space: nowrap; }
.pst.closed { color: var(--text-3); }
.pst.voting { color: var(--accent); background: rgba(127, 167, 217, .12); }
.pst.counting { color: var(--warning); background: rgba(250, 178, 25, .1); }
.pst.declared { color: var(--text-1); }
.pst.uploaded { color: #7fd37f; background: rgba(12, 163, 12, .12); }
.pst.cancelled, .pst.suspended, .pst.bvas { color: #f19a9a; background: rgba(208, 59, 59, .12); }

@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .pg { padding: 0 16px 40px; }
  .crumbs { display: none; }
}

/* ---------- Declaration overlay ---------- */
.declaration { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(10, 14, 20, .94); opacity: 0; pointer-events: none; transition: opacity .8s ease; }
.declaration.on { opacity: 1; pointer-events: auto; }
.dc { text-align: center; max-width: 780px; padding: 40px; }
.dc-k { font-size: 12px; color: var(--text-3); }
.dc-crest { width: 96px; height: 96px; margin: 20px auto 12px; display: block; border-radius: 50%; object-fit: cover; object-position: center 15%; border: 3px solid var(--gold); }
.dc-n { font-size: 44px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--text-1); }
.dc-s { font-size: 15px; color: var(--text-2); margin-top: 10px; }
.dc-g { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 30px 0; }
.dc-g div { border-radius: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--border); }
.dc-g span { font-size: 12px; color: var(--text-3); }
.dc-g b { display: block; font-size: 22px; font-weight: 600; margin-top: 4px; }

/* ---------- Tooltip ---------- */
.tooltip { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; min-width: 190px; max-width: 280px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); font-size: 12px; opacity: 0; transition: opacity .12s; }
.tooltip.on { opacity: 1; }
.tt-h { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.tt-r { display: flex; justify-content: space-between; gap: 14px; color: var(--text-3); padding: 1px 0; align-items: center; }
.tt-r b { color: var(--text-1); font-weight: 500; }
.tt-r i, .tt-l i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.tt-r i + * { flex: 1; }
.tt-l { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); color: var(--text-1); display: flex; align-items: center; }
.tt-f { margin-top: 6px; font-size: 11px; color: var(--text-3); }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Responsive: laptops ---------- */
@media (max-width: 1600px) {
  .app { grid-template-rows: 60px 90px 1fr 34px; padding: 10px 12px; --gap: 10px; }
  .brand-sub, .sb-meta .keys { display: none; }
  .kpi-v { font-size: 21px; }
  .clock-time { font-size: 21px; }
  .charts-row { height: 190px; }
}
@media (max-width: 1366px) {
  html, body { font-size: 12px; overflow: auto; }
  .main { grid-template-columns: 300px minmax(0, 1fr) 320px; min-height: 900px; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .app { grid-template-rows: 60px auto 1fr 34px; height: auto; min-height: 100vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
