/* QA pass (20 Oct 2026): top bar, alarm card, bridge cards, stats, history/shift log, sign tiles,
   drawers, help tour, control-room mode and the phone layout. Loaded after the inline styles and
   control-panel.css, so it can restyle them without touching their rules. */

[hidden]{ display:none !important; }
.sr-only{ position:absolute !important; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
/* overflow-x:hidden on html AND body turns body into a scroll box, which breaks every sticky
   element; clip hides the sideways overflow without that side effect */
html, body{ overflow-x:clip; }
html{ scroll-padding-top:calc(var(--tb-h, 64px) + 12px); }

/* ---------- L2: heavier, larger, higher-contrast text ---------- */
html[data-view="aurora"]{ --text-dim:rgba(233,236,255,0.74); }
html[data-view="aurora"][data-sky="day"]{ --text-dim:rgba(244,248,255,0.86); }
.hero-line{ font-weight:300; }
html[data-view="aurora"] .section-title{ font-weight:300; }
.hero-lede p{ font-size:16px; font-weight:400; }
.section-sub{ font-size:13px; letter-spacing:.2px; line-height:1.5; }
.legend, .filters, .export-bar, .tl-controls, .lg-preview, .legend-card .lg-note{ font-size:12px; }
.filters select, .filters label, .export-bar label, .export-bar input[type=date], .export-bar select, .export-bar button, .tl-controls button{ font-size:13px; }
table.hist{ font-size:13px; }
table.hist th{ font-size:11px; }
.tl-axis{ font-size:11px; }
.msg-state .since{ font-size:12px; }
.orb-core .small{ font-size:11px; }
footer, .scene-credit{ font-size:12px; }
.dim{ color:var(--text-dim); }

/* ---------- L7: visible focus everywhere ---------- */
:focus-visible{ outline:2px solid #fff; outline-offset:2px; }
html[data-view="aurora"] button:focus-visible{ box-shadow:0 0 0 4px rgba(45,226,196,.35); }

/* ===================== G1/L5: the top bar ===================== */
.topbar{
  position:sticky; top:0; z-index:55;
  background:rgba(7,11,31,.78);
  backdrop-filter:blur(16px) saturate(150%); -webkit-backdrop-filter:blur(16px) saturate(150%);
  border-bottom:1px solid rgba(255,255,255,.08);
  box-shadow:0 10px 30px rgba(0,0,0,.25);
}
.tb-inner{ display:flex; align-items:center; gap:14px; padding:9px 20px; min-height:58px; }
.tb-brand{ display:flex; align-items:center; gap:9px; color:var(--text); text-decoration:none; font-weight:600; font-size:15px; letter-spacing:.2px; flex:none; }
.tb-brand svg{ width:28px; height:28px; color:var(--teal, #2de2c4); }
.tb-state{
  --k:#8a93b8;
  display:flex; align-items:center; gap:9px; flex:none;
  padding:7px 14px 7px 11px; border-radius:999px;
  background:color-mix(in srgb, var(--k) 14%, rgba(255,255,255,.04));
  border:1px solid color-mix(in srgb, var(--k) 55%, transparent);
  font-size:14px; font-weight:600; color:var(--text);
  transition:background .6s ease, border-color .6s ease;
}
.tb-state[data-key="BOTH"]{ --k:#2de2c4; }
.tb-state[data-key="POOLE"]{ --k:#7b5cff; }
.tb-state[data-key="TWIN"]{ --k:#ff6fa8; }
.tb-state[data-key="MIXED"]{ --k:#ffd166; }
.tb-state[data-key="ALARM"]{ --k:#ff3b50; background:rgba(255,59,80,.22); }
.tb-dot{ width:10px; height:10px; border-radius:50%; background:var(--k); box-shadow:0 0 10px var(--k); flex:none; }
.tb-state[data-key="POOLE"] .tb-dot, .tb-state[data-key="TWIN"] .tb-dot, .tb-state[data-key="ALARM"] .tb-dot{ animation:tbBeat 1.6s ease-in-out infinite; }
@keyframes tbBeat{ 50%{ transform:scale(.6); opacity:.6; } }
.tb-state-for{ font-weight:400; color:var(--text-dim); font-variant-numeric:tabular-nums; }
.tb-state-for:empty{ display:none; }
.tb-nav{ display:flex; justify-content:safe center; flex:1 1 auto; gap:2px; min-width:0; overflow-x:auto; scrollbar-width:none; }
.tb-nav::-webkit-scrollbar{ display:none; }
.tb-nav a{ padding:7px 11px; border-radius:999px; font-size:13px; color:var(--text-dim); text-decoration:none; white-space:nowrap; transition:color .2s, background .2s; }
.tb-nav a:hover{ color:var(--text); background:rgba(255,255,255,.06); }
.tb-nav a.on{ color:var(--text); background:rgba(255,255,255,.1); box-shadow:inset 0 0 0 1px rgba(255,255,255,.12); }
.tb-right{ display:flex; align-items:center; gap:8px; flex:none; }
.tb-health{ display:flex; flex-direction:column; align-items:flex-end; gap:1px; margin-left:auto; }
.tb-health #heartbeat{ font-size:12px; letter-spacing:.2px; padding:4px 10px; }
.tb-next{ font-size:11px; color:var(--text-dim); padding-right:10px; font-variant-numeric:tabular-nums; }
.tb-next:empty{ display:none; }
html[data-view="aurora"] .tb-icon, html[data-view="aurora"] .tb-lock, html[data-view="aurora"] .tb-alarm{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  height:36px; padding:0 12px; font-size:13px; letter-spacing:.2px; text-transform:none;
  background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.14); color:var(--text);
}
html[data-view="aurora"] .tb-icon{ width:36px; padding:0; }
.tb-icon svg, .tb-lock svg{ width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.tb-icon svg .fill{ fill:currentColor; }
.tb-icon .bell-off{ display:block; }
.tb-icon[aria-pressed="true"] .bell-off{ display:none; }
html[data-view="aurora"] .tb-icon[aria-pressed="true"]{ color:#ffd166; border-color:rgba(255,209,102,.55); background:rgba(255,209,102,.12); }
.tb-lock[data-locked="1"]{ color:#ffd166 !important; border-color:rgba(255,209,102,.5) !important; }
.tb-lock[data-locked="0"]{ color:#33ff9c !important; border-color:rgba(51,255,156,.45) !important; background:rgba(51,255,156,.08) !important; }
.tb-lock[data-locked="0"] .shackle{ transform:translate(4px,-1px) rotate(18deg); transform-origin:16px 11px; }
.tb-lock[data-locked="0"] #tbLockText{ font-weight:700; letter-spacing:1.5px; }
html[data-view="aurora"] .tb-alarm{ background:#c8102e; border-color:#ff8a98; color:#fff; font-weight:700; animation:tbAlarm 2s ease-in-out infinite; }
@keyframes tbAlarm{ 50%{ box-shadow:0 0 0 6px rgba(255,59,80,.25); } }
#connectBtn{ padding:8px 14px; font-size:12px; }

/* G6: monitor down -> say so, and grey the live values */
.stale-banner{
  padding:9px 20px; font-size:14px; font-weight:600; color:#fff;
  background:linear-gradient(90deg, rgba(110,116,140,.95), rgba(80,86,110,.95));
  border-top:1px solid rgba(255,255,255,.12);
}
.stale-banner::before{ content:"⏸"; margin-right:10px; }
html[data-stale] :is(.hero-line, .orb-wrap, #bridgeCards, #summaryBar, #msgRows .msg-state, .legend-card .lg-item){
  filter:grayscale(1); opacity:.55; transition:filter .6s, opacity .6s;
}

/* ===================== F4: the alarm card ===================== */
#alarmCard{
  position:fixed; z-index:70; left:50%; top:calc(var(--tb-h, 64px) + 18px); transform:translateX(-50%);
  width:min(520px, calc(100vw - 24px));
  padding:20px 22px 18px; border-radius:18px;
  background:linear-gradient(180deg, #5c0614, #3d0410);
  border:1px solid #ff6676; color:#fff;
  box-shadow:0 24px 70px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06) inset, 0 0 60px rgba(255,40,60,.45);
  animation:cardIn .35s cubic-bezier(.2,.8,.2,1);
}
html.alarm:not(.alarm-acked) #alarmCard{ display:block; }
@keyframes cardIn{ from{ opacity:0; transform:translate(-50%, -12px) scale(.97); } }
.ac-head{ display:flex; align-items:center; gap:14px; }
.ac-icon{
  flex:none; width:44px; height:44px; border-radius:50%; display:grid; place-items:center;
  background:#ff3b50; color:#fff; font-weight:800; font-size:24px;
  box-shadow:0 0 0 0 rgba(255,59,80,.7); animation:acRing 1.8s ease-out infinite;
}
@keyframes acRing{ to{ box-shadow:0 0 0 16px rgba(255,59,80,0); } }
.ac-kicker{ font-size:12px; font-weight:700; letter-spacing:1.6px; text-transform:uppercase; color:#ffb3bc; }
#alarmCard h2{ margin:2px 0 0; font-size:22px; line-height:1.2; font-weight:700; }
.ac-facts{ display:grid; grid-template-columns:repeat(3, 1fr); gap:10px; margin:16px 0 0; }
.ac-facts div{ background:rgba(0,0,0,.25); border-radius:12px; padding:9px 12px; }
.ac-facts dt{ font-size:11px; letter-spacing:1px; text-transform:uppercase; color:#ffb3bc; }
.ac-facts dd{ margin:3px 0 0; font-size:18px; font-weight:700; font-variant-numeric:tabular-nums; }
.ac-note{ margin:14px 0 0; font-size:14px; line-height:1.45; color:#ffe1e5; }
.ac-actions{ display:flex; gap:10px; margin-top:16px; justify-content:flex-end; }
html[data-view="aurora"] #alarmCard button{ font-size:14px; letter-spacing:.3px; text-transform:none; padding:10px 18px; }
html[data-view="aurora"] #alarmCard .ac-ack{ background:#fff; color:#5c0614; border-color:#fff; font-weight:800; }
html[data-view="aurora"] #alarmCard .ac-ack:hover{ background:#ffe3e7; box-shadow:0 0 18px rgba(255,255,255,.4); }
html[data-view="aurora"] #alarmCard .ac-ghost{ background:transparent; color:#fff; border-color:rgba(255,255,255,.5); }
/* acknowledged: keep a thin, still red edge instead of the pulsing glow */
html.alarm.alarm-acked #alarmFlash{ animation:none; opacity:.55; background:none; box-shadow:inset 0 0 0 3px rgba(255,40,60,.9); }
@media (max-width:560px){ .ac-facts{ grid-template-columns:1fr 1fr; } .ac-facts div:last-child{ grid-column:span 2; } }

/* ===================== G2: bridge cards ===================== */
.bridge-cards{ display:grid; grid-template-columns:1fr 1fr; gap:14px; margin:26px 0 6px; position:relative; z-index:2; }
.bcard{
  --k:#2de2c4;
  position:relative; padding:16px 18px 15px 22px; border-radius:18px; overflow:hidden;
  background:var(--panel); border:1px solid var(--panel-border); box-shadow:var(--glass-shadow);
  backdrop-filter:var(--glass-blur); -webkit-backdrop-filter:var(--glass-blur);
}
.bcard::before{ content:""; position:absolute; left:0; top:0; bottom:0; width:5px; background:var(--k); box-shadow:0 0 18px var(--k); }
.bcard[data-state="none"]{ --k:#8a93b8; }
.bcard[data-state="lift"]{ --k:#7b5cff; }
.bcard[data-bridge="TWIN"][data-state="lift"]{ --k:#ff6fa8; }
.bcard[data-state="over"]{ --k:#ff3b50; border-color:rgba(255,59,80,.6); }
.bcard[data-state="lift"], .bcard[data-state="over"]{ background:linear-gradient(100deg, color-mix(in srgb, var(--k) 18%, transparent), transparent 70%), var(--panel); }
.bc-name{ font-size:12px; font-weight:700; letter-spacing:1.6px; text-transform:uppercase; color:var(--text-dim); }
.bc-state{ margin-top:4px; font-size:22px; font-weight:600; color:var(--text); font-variant-numeric:tabular-nums; }
.bcard[data-state="lift"] .bc-state, .bcard[data-state="over"] .bc-state{ color:color-mix(in srgb, var(--k) 55%, #fff); }
.bc-meta{ margin-top:3px; font-size:13px; color:var(--text-dim); }

/* ===================== G3: dial labels only during a lift ===================== */
#dialTicks{ opacity:0; transition:opacity .6s ease; }
.orb-wrap.lifting #dialTicks{ opacity:1; }

/* ===================== F7/S1/S2/S3: sign tiles ===================== */
#summaryBar .sign-pill{ cursor:pointer; transition:transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
#summaryBar .sign-pill:hover{ transform:translateY(-2px); border-color:rgba(255,255,255,.24); }
#summaryBar .sign-pill-name{ font-size:13px; }
#summaryBar .sign-pill-badge{ font-size:10px; }
#summaryBar .face-panel{ height:clamp(92px, 9vw, 132px); }
#summaryBar .face-panel img{ width:100%; height:100%; object-fit:contain; }
#summaryBar .face-unknown{ min-height:0; height:clamp(92px, 9vw, 132px); font-size:14px; }
#summaryBar .pill-foot{ margin-top:auto; letter-spacing:.1px; font-size:12px; color:var(--text-dim); line-height:1.35; font-variant-numeric:tabular-nums; }
#summaryBar .pill-foot.bad{ color:var(--magenta); font-weight:600; }
#summaryBar .pill-odd{ align-self:flex-start; font-size:11px; font-weight:700; padding:3px 9px; border-radius:999px; color:#2a1d00; background:#ffd166; }
#summaryBar .sign-pill.odd{ border-color:rgba(255,209,102,.7); box-shadow:var(--glass-shadow), 0 0 0 1px rgba(255,209,102,.35) inset; }
@media (min-width:1200px) and (max-width:1500px){ #summaryBar .pf-sep, #summaryBar .pf-check{ display:none; } }
.msg-name{ cursor:pointer; text-decoration:underline dotted rgba(255,255,255,.3); text-underline-offset:3px; }

/* ===================== L6: placeholders while loading ===================== */
@keyframes sk{ from{ background-position:-400px 0; } to{ background-position:400px 0; } }
.sk-tile, .sk-row, tr.sk .sk-line{
  background:linear-gradient(90deg, rgba(255,255,255,.04) 0, rgba(255,255,255,.10) 50%, rgba(255,255,255,.04) 100%) 0 0 / 800px 100%;
  animation:sk 1.4s linear infinite;
}
#summaryBar .sign-pill.sk-tile{ min-height:190px; cursor:default; }
.skeleton-rows .sk-row{ height:58px; border-radius:16px; margin-bottom:8px; }
tr.sk .sk-line{ height:12px; border-radius:6px; width:70%; }

/* ===================== section blocks, segmented controls ===================== */
.sec-block{ scroll-margin-top:calc(var(--tb-h, 64px) + 12px); }
#hero, #summaryBar, #bridgeCards{ scroll-margin-top:calc(var(--tb-h, 64px) + 12px); }
.sec-head{ display:flex; align-items:flex-end; justify-content:space-between; flex-wrap:wrap; gap:10px 18px; }
.sec-h3{ font-size:clamp(22px, 3vw, 30px) !important; margin:44px 0 10px !important; }
.seg{ display:inline-flex; flex-wrap:wrap; gap:3px; padding:3px; border-radius:999px; background:rgba(255,255,255,.05); border:1px solid var(--panel-border); }
html[data-view="aurora"] .seg button{
  border:0; background:transparent; backdrop-filter:none; -webkit-backdrop-filter:none; box-shadow:none;
  padding:7px 14px; font-size:13px; letter-spacing:.2px; text-transform:none; color:var(--text-dim);
}
html[data-view="aurora"] .seg button:hover{ color:var(--text); background:rgba(255,255,255,.06); box-shadow:none; }
html[data-view="aurora"] .seg button[aria-pressed="true"]{ color:#070b1f; background:var(--teal); font-weight:700; }
html[data-view="aurora"] .seg-sm button{ padding:5px 11px; font-size:12px; }

/* ===================== H5/H6: stats ===================== */
.stat-tiles{ display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; margin-top:8px; }
.stat-tile, .stat-card{
  background:var(--panel); border:1px solid var(--panel-border); border-radius:18px; box-shadow:var(--glass-shadow);
  backdrop-filter:var(--glass-blur); -webkit-backdrop-filter:var(--glass-blur);
}
.stat-tile{ --k:rgba(255,255,255,.3); position:relative; padding:14px 16px 14px 20px; overflow:hidden; }
.stat-tile::before{ content:""; position:absolute; left:0; top:14px; bottom:14px; width:3px; border-radius:0 3px 3px 0; background:var(--k); }
.stat-tile.k-POOLE{ --k:#7b5cff; } .stat-tile.k-TWIN{ --k:#ff6fa8; } .stat-tile.k-ALARM{ --k:#ff3b50; } .stat-tile.k-COMMS{ --k:#ff9a4d; }
.st-label{ font-size:12px; font-weight:600; letter-spacing:.4px; color:var(--text-dim); }
.st-value{ font-size:34px; font-weight:300; line-height:1.1; margin-top:2px; font-variant-numeric:tabular-nums; color:var(--text); }
.st-sub{ font-size:12px; color:var(--text-dim); margin-top:2px; }
.stats-grid{ display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1.6fr); gap:12px; margin-top:12px; }
.stat-card{ padding:16px 18px; }
.stat-card h4{ margin:0 0 12px; font-size:14px; font-weight:600; color:var(--text); }
.stat-card h4 .dim{ font-weight:400; font-size:12px; }
.up-row{ display:grid; grid-template-columns:minmax(90px, 150px) 1fr 52px; align-items:center; gap:10px; padding:5px 0; font-size:13px; }
.up-name{ color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.up-track{ height:8px; border-radius:4px; background:rgba(255,255,255,.07); overflow:hidden; }
.up-track i{ display:block; height:100%; border-radius:4px; background:var(--teal); }
.up-track i.low{ background:#ff9a4d; }
.up-pct{ text-align:right; font-variant-numeric:tabular-nums; color:var(--text-dim); }
.heat-card{ position:relative; }
.heat-card #heatPick{ position:absolute; top:12px; right:14px; }
.heat{ display:grid; grid-template-columns:34px repeat(24, minmax(0, 1fr)); gap:2px; margin-top:6px; }
.heat .hx{ font-size:10px; color:var(--text-dim); text-align:left; height:14px; }
.heat .hy{ font-size:11px; color:var(--text-dim); align-self:center; }
.heat i{ display:block; aspect-ratio:1.25; min-height:12px; border-radius:3px; background:rgba(255,255,255,.05); }
.heat i.on{ background:var(--hc); opacity:var(--a); }
.heat i:hover{ outline:1px solid #fff; outline-offset:0; opacity:1; }
.heat-key{ display:flex; align-items:center; gap:4px; justify-content:flex-end; margin-top:10px; font-size:11px; color:var(--text-dim); }
.heat-key i{ width:14px; height:10px; border-radius:2px; background:var(--hc, #7b5cff); opacity:var(--a); }
.heat-card:has(#heatPick [data-heat="TWIN"][aria-pressed="true"]) .heat-key i{ background:#ff6fa8; }
.heat-card:has(#heatPick [data-heat="POOLE"][aria-pressed="true"]) .heat-key i{ background:#7b5cff; }
@media (max-width:1000px){ .stat-tiles{ grid-template-columns:1fr 1fr; } .stats-grid{ grid-template-columns:1fr; } }

/* ===================== H7/H8/L7: timeline ===================== */
#msgRows{ position:relative; }
#msgRows .timeline{ cursor:crosshair; }
#msgRows.dragging .timeline, #msgRows.dragging .timeline div{ cursor:grabbing; }
.tl-hint{ font-size:12px; color:var(--text-dim); margin:-4px 0 10px; }
.tl-hover{ position:absolute; top:0; bottom:0; width:1px !important; background:rgba(255,255,255,.75); pointer-events:none; z-index:3; }
.tl-hover::after{
  content:attr(data-t); position:absolute; top:-22px; left:50%; transform:translateX(-50%);
  padding:2px 7px; border-radius:6px; font-size:11px; white-space:nowrap; color:#070b1f; background:#fff; font-weight:600;
}
/* T16 R3: all five signs at the hovered moment */
.tl-card{ position:absolute; top:6px; width:232px; padding:6px 8px; display:grid; gap:2px; border-radius:6px; pointer-events:none; z-index:4;
  background:var(--panel); border:1px solid var(--panel-border); color:var(--text); font-size:12.5px; line-height:1.35; box-shadow:0 6px 18px rgba(0,0,0,.35); }
.tlc-row{ display:flex; align-items:center; gap:6px; min-width:0; }
.tlc-row > span:not(.tlc-l):not(.tlc-c){ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tlc-row .sw{ flex:none; margin:0; }
.tlc-l{ flex:none; width:14px; font-weight:700; }
.tlc-row.odd{ font-weight:700; }
.tlc-c{ flex:none; margin-left:auto; color:var(--amber, #ffd166); font-size:11px; }
.tl-sel{ position:absolute; top:0; bottom:0; background:rgba(45,226,196,.16); border-left:1px solid var(--teal); border-right:1px solid var(--teal); pointer-events:none; z-index:3; }
.tl-sel::after{
  content:attr(data-t); position:absolute; top:-22px; left:50%; transform:translateX(-50%);
  padding:2px 7px; border-radius:6px; font-size:11px; white-space:nowrap; color:#070b1f; background:var(--teal); font-weight:700;
}
#msgRows.selecting{ user-select:none; }
.timeline .seg-l{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:9px; font-weight:800; color:rgba(255,255,255,.92); letter-spacing:0; pointer-events:none; }
html[data-view="aurora"] .timeline{ height:16px; }
.st-COMMS, html[data-view="aurora"] .st-COMMS{ background:repeating-linear-gradient(135deg, #000 0 3px, #4b5170 3px 5px); box-shadow:inset 0 0 0 1px rgba(255,255,255,.45); }
.st-ALERT{ background:#ff3b50; }
.tl-axis{ position:relative; }
#msgRows.zoomed + .tl-axis::after{ content:"Zoomed in · double-click the bars to zoom out"; position:absolute; right:0; top:18px; color:var(--teal); font-weight:600; }

/* ===================== F5/H1/H2/H3/H10: tables ===================== */
html[data-view="aurora"] .table-wrap, .table-wrap{ max-height:none; overflow:clip; }
table.hist th{ top:var(--tb-h, 64px); z-index:2; }
html[data-view="aurora"] table.hist th{ background:rgba(12,17,45,.94); }
table.hist td{ white-space:normal; }
table.hist td:first-child, table.hist td[data-label="From"], table.hist td[data-label="To"], table.hist td[data-label="Time"]{ white-space:nowrap; }
table.hist tbody tr:hover td{ background:rgba(255,255,255,.035); }
table.hist .empty-row{ color:var(--text-dim); padding:18px 14px; }
.op-init{ display:inline-block; padding:2px 8px; border-radius:6px; font-weight:700; letter-spacing:1.5px; font-size:12px; background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.14); }
.op-cc{ color:var(--text-dim); font-size:12px; }
.op-none{ color:var(--text-dim); }
html[data-view="aurora"] .grp-toggle{
  display:inline-flex; align-items:center; gap:8px; padding:0; border:0; background:none; box-shadow:none;
  backdrop-filter:none; -webkit-backdrop-filter:none; font:inherit; font-weight:600; letter-spacing:0; text-transform:none; color:var(--text);
}
html[data-view="aurora"] .grp-toggle:hover{ background:none; box-shadow:none; color:var(--teal); }
.grp-toggle .caret{ width:0; height:0; border-left:5px solid currentColor; border-top:4px solid transparent; border-bottom:4px solid transparent; transition:transform .2s; }
.grp-toggle[aria-expanded="true"] .caret{ transform:rotate(90deg); }
table.hist tr.sub td{ background:rgba(255,255,255,.025); font-size:12px; }
table.hist tr.sub td:first-child{ padding-left:34px; color:var(--text-dim); }
table.hist tr.grp.open td{ border-bottom:0; }
html[data-view="aurora"] table.hist tr.k-alert td, html[data-view="aurora"] table.hist tr.bad td:nth-child(3){ color:#ff8a98; }
.filters{ margin-top:6px; }
html[data-view="aurora"] .filters input[type=search], html[data-view="aurora"] .filters input[type=date]{
  font:inherit; font-size:13px; color:var(--text); background:rgba(255,255,255,.06); border:1px solid var(--panel-border); border-radius:999px; padding:7px 14px;
}
.filters input[type=search]{ min-width:min(280px, 100%); }
.filters .goto{ display:inline-flex; align-items:center; gap:6px; }
.filters .chk{ display:inline-flex; align-items:center; gap:6px; }
#histCount{ margin-left:auto; color:var(--text-dim); }
.filter-chip{
  display:inline-flex; align-items:center; gap:10px; margin:0 0 10px; padding:6px 6px 6px 14px; border-radius:999px;
  background:rgba(45,226,196,.12); border:1px solid rgba(45,226,196,.45); font-size:13px; color:var(--text);
}
html[data-view="aurora"] .filter-chip button{ padding:4px 10px; font-size:12px; text-transform:none; letter-spacing:0; }
html[data-view="aurora"] .more-btn{ display:block; margin:12px auto 0; padding:9px 22px; font-size:13px; text-transform:none; letter-spacing:.2px; }
.export-bar{ margin:18px 0 0; padding:12px 14px; border-radius:18px; background:rgba(255,255,255,.03); border:1px solid var(--panel-border); }
.eb-title{ font-weight:700; color:var(--text); }
html[data-view="aurora"] .export-bar .seg button{ border:0; background:transparent; padding:5px 11px; }
html[data-view="aurora"] .export-bar .seg button[aria-pressed="true"]{ background:var(--teal); color:#070b1f; }
html[data-view="aurora"] #exGo{ background:var(--teal); color:#070b1f; border-color:transparent; font-weight:700; }
#shiftFilter{ margin:0 0 12px; }
.report-box{ display:flex; gap:8px; align-items:center; margin-bottom:12px; }
html[data-view="aurora"] .report-box select{ font:inherit; font-size:13px; color:var(--text); background:rgba(255,255,255,.06); border:1px solid var(--panel-border); border-radius:999px; padding:8px 12px; }
html[data-view="aurora"] .report-box select option{ background:#0d1230; }
html[data-view="aurora"] #srGo{ background:linear-gradient(90deg, #2de2c4, #7b5cff); color:#070b1f; border:0; font-weight:800; padding:10px 18px; font-size:13px; text-transform:none; letter-spacing:.3px; }
.offline-now{
  display:flex; flex-wrap:wrap; gap:8px 18px; align-items:center; margin:0 0 12px; padding:12px 16px; border-radius:16px;
  background:rgba(255,154,77,.1); border:1px solid rgba(255,154,77,.5); font-size:14px;
}
.offline-now b{ color:#ffb27a; }
.off-sign{ display:inline-flex; align-items:center; gap:8px; }

/* phones: each table row becomes a small card */
@media (max-width:720px){
  table.hist thead{ display:none; }
  table.hist, table.hist tbody{ display:block; }
  table.hist tr{ display:block; padding:10px 14px; border-top:1px solid rgba(255,255,255,.07); }
  table.hist tr:first-child{ border-top:0; }
  table.hist td, html[data-view="aurora"] table.hist td{ display:flex; align-items:center; gap:4px; padding:2px 0; border:0; font-size:13px; white-space:normal; }
  table.hist td::before{ content:attr(data-label); flex:0 0 78px; font-size:11px; letter-spacing:.5px; text-transform:uppercase; color:var(--text-dim); }
  table.hist td .sw{ margin-right:4px; }
  table.hist tr.grp td:first-child{ font-size:14px; }
  table.hist .empty-row{ display:block; }
  table.hist .empty-row::before{ content:none; }
  table.hist tr.sub{ margin-left:16px; background:rgba(255,255,255,.03); border-left:2px solid rgba(255,255,255,.12); }
  table.hist tr.sub td, table.hist tr.sub td:first-child{ padding-left:0; background:none; }
  table.hist tr.sk{ display:block; }
  table.hist tr.sk td{ display:block; }
  table.hist tr.sk td::before{ content:none; }
}

/* ===================== C1/F8/C2/C4/C5: bridge controls ===================== */
.cp-guard{ margin-bottom:12px; }
.cp-guard[data-state="checking"], .cp-guard[data-state="open"]{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  padding:8px 8px 8px 14px; border-radius:999px; font-size:13px; color:var(--text);
  background:rgba(255,255,255,.04); border:1px solid var(--panel-border);
}
.cp-guard[data-state="open"]{ background:rgba(51,255,156,.07); border-color:rgba(51,255,156,.35); }
.cpg-dot{ width:9px; height:9px; border-radius:50%; background:#8a93b8; flex:none; }
.cp-guard[data-state="open"] .cpg-dot{ background:#33ff9c; box-shadow:0 0 10px #33ff9c; }
.cpg-line{ flex:1 1 auto; min-width:0; }
.cpg-sep{ color:var(--text-dim); margin:0 2px; }
.cpg-op{ letter-spacing:1.5px; color:#33ff9c; }
.cpg-dim{ color:var(--text-dim); }
html[data-view="aurora"] .cpg-lock{ padding:6px 14px; font-size:12px; letter-spacing:.3px; text-transform:none; }
.cp-guard[data-state="locked"]{
  display:grid; grid-template-columns:auto 1fr; gap:4px 14px; align-items:center;
  padding:16px 18px; border-radius:18px;
  background:linear-gradient(120deg, rgba(255,209,102,.12), rgba(255,255,255,.03) 60%);
  border:1px solid rgba(255,209,102,.45); box-shadow:var(--glass-shadow);
}
.cpg-icon{ width:42px; height:42px; border-radius:12px; display:grid; place-items:center; background:rgba(255,209,102,.16); color:#ffd166; grid-row:span 1; }
.cpg-icon svg{ width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; }
.cpg-text{ display:flex; flex-direction:column; gap:2px; font-size:13px; color:var(--text-dim); }
.cpg-text b{ font-size:16px; color:var(--text); }
html[data-view="aurora"] .cpg-unlock{
  grid-column:1 / -1; margin-top:10px; min-height:48px; font-size:15px; font-weight:800; letter-spacing:.3px; text-transform:none;
  background:#ffd166; color:#2a1d00; border-color:transparent;
}
html[data-view="aurora"] .cpg-unlock:hover{ background:#ffe099; box-shadow:0 0 22px rgba(255,209,102,.45); }
/* locked: the bridge buttons below are clearly unavailable but still readable */
#cp-buttons button[data-locked="1"]{ opacity:.5; }
/* C5: a dot in the legend colour, so the button matches the map key. The green (current) and
   amber (pressed, running) states are unchanged. */
.cp-key{ position:absolute; left:18px; top:50%; width:12px; height:12px; margin-top:-6px; border-radius:50%; z-index:1; background:var(--k); box-shadow:0 0 0 3px color-mix(in srgb, var(--k) 25%, transparent), 0 0 10px var(--k); }
#cp-buttons button{ padding-left:44px; padding-right:44px; }
#cp-buttons button[data-state="POOLE"]{ --k:#7b5cff; }
#cp-buttons button[data-state="TWIN"]{ --k:#ff6fa8; }
#cp-buttons button[data-state="RESET"]{ --k:#2de2c4; }
.cp-status{ font-size:13px; }
/* C4: per-sign progress after a press */
.cp-track{
  margin-top:12px; padding:12px 14px; border-radius:16px;
  background:rgba(255,255,255,.04); border:1px solid var(--panel-border);
}
.cp-track[data-state="done"]{ background:rgba(51,255,156,.07); border-color:rgba(51,255,156,.4); }
.cp-track[data-state="late"]{ background:rgba(255,209,102,.08); border-color:rgba(255,209,102,.5); }
.cpt-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:13px; font-weight:600; color:var(--text); }
html[data-view="aurora"] .cpt-close{ width:26px; height:26px; padding:0; font-size:11px; flex:none; }
.cpt-bar{ height:4px; margin:10px 0; border-radius:2px; background:rgba(255,255,255,.08); overflow:hidden; }
.cpt-bar i{ display:block; height:100%; background:linear-gradient(90deg, #2de2c4, #33ff9c); transition:width .8s cubic-bezier(.2,.8,.2,1); }
.cp-track ul{ list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(5, minmax(0, 1fr)); gap:6px; }
.cp-track li{ display:flex; flex-direction:column; align-items:center; gap:4px; padding:8px 4px; border-radius:12px; background:rgba(255,255,255,.04); font-size:11px; color:var(--text-dim); text-align:center; }
.cpt-mark{ width:22px; height:22px; border-radius:50%; border:2px solid rgba(255,255,255,.25); position:relative; }
.cp-track li.wait .cpt-mark{ border-top-color:#2de2c4; animation:cptSpin 1s linear infinite; }
@keyframes cptSpin{ to{ transform:rotate(360deg); } }
.cp-track li.ok{ background:rgba(51,255,156,.1); color:var(--text); }
.cp-track li.ok .cpt-mark{ border-color:#33ff9c; background:#33ff9c; animation:cptPop .35s cubic-bezier(.2,1.6,.4,1); }
.cp-track li.ok .cpt-mark::after{ content:""; position:absolute; left:6px; top:2px; width:5px; height:10px; border:solid #062014; border-width:0 2.5px 2.5px 0; transform:rotate(45deg); }
@keyframes cptPop{ from{ transform:scale(.4); } }
.cp-track li.late .cpt-mark{ border-color:#ffd166; }
.cpt-letter{ font-size:15px; font-weight:800; color:var(--text); }
.cpt-name{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
/* P1: phones - controls behind one button */
.cp-phone-toggle{ display:none !important; }
@media (max-width:720px){
  html[data-view="aurora"] .cp-phone-toggle{
    display:flex !important; width:100%; align-items:center; justify-content:space-between; min-height:52px;
    font-size:15px; font-weight:700; text-transform:none; letter-spacing:.3px; border-radius:16px;
  }
  .cpt-caret{ width:9px; height:9px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg); transition:transform .2s; margin-right:4px; }
  .cp-hero.open .cpt-caret{ transform:rotate(-135deg); }
  .cp-hero:not(.open) > :not(.cp-phone-toggle){ display:none !important; }
  .cp-hero.open .cp-phone-toggle{ margin-bottom:12px; }
  .cp-track ul{ grid-template-columns:repeat(5, minmax(0, 1fr)); }
  .cpt-name{ display:none; }
}

/* ===================== drawers (S3 sign detail, L1 settings) ===================== */
.drawer-scrim{ position:fixed; inset:0; z-index:79; background:rgba(3,5,15,.5); backdrop-filter:blur(2px); -webkit-backdrop-filter:blur(2px); }
.drawer{
  position:fixed; z-index:80; top:0; right:0; bottom:0; width:min(430px, 100vw); overflow-y:auto;
  padding:20px 22px 30px; color:var(--text);
  background:linear-gradient(180deg, #0e1438, #090d26); border-left:1px solid rgba(255,255,255,.12);
  box-shadow:-30px 0 60px rgba(0,0,0,.45); animation:drIn .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes drIn{ from{ transform:translateX(40px); opacity:0; } }
.dr-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:12px; margin-bottom:16px; }
.dr-kicker{ font-size:12px; font-weight:700; letter-spacing:1.6px; text-transform:uppercase; color:var(--text-dim); }
.drawer h2{ margin:2px 0 0; font-size:24px; font-weight:400; }
.drawer h3{ margin:22px 0 8px; font-size:13px; font-weight:700; letter-spacing:1px; text-transform:uppercase; color:var(--text-dim); }
html[data-view="aurora"] .dr-close{ width:36px; height:36px; padding:0; font-size:14px; flex:none; }
.dr-now{ padding:12px 14px; border-radius:14px; background:rgba(255,255,255,.05); border:1px solid var(--panel-border); font-size:14px; line-height:1.5; }
.dr-now.bad{ border-color:rgba(255,154,77,.55); background:rgba(255,154,77,.1); }
.dr-now .sw{ margin-right:7px; }
.dr-stats{ display:grid; grid-template-columns:repeat(3, 1fr); gap:8px; margin-top:10px; }
.dr-stats div{ padding:10px 12px; border-radius:12px; background:rgba(255,255,255,.04); }
.dr-stats span{ display:block; font-size:11px; color:var(--text-dim); }
.dr-stats b{ font-size:20px; font-weight:400; font-variant-numeric:tabular-nums; }
.dr-list{ list-style:none; margin:0; padding:0; }
.dr-list li{ display:grid; grid-template-columns:auto 1fr; gap:0 10px; align-items:center; padding:8px 0; border-top:1px solid rgba(255,255,255,.06); font-size:13px; }
.dr-list li .sw{ grid-row:span 2; }
.dl-when{ grid-column:2; font-size:12px; color:var(--text-dim); font-variant-numeric:tabular-nums; }
html[data-view="aurora"] .dr-go{ margin-top:22px; width:100%; min-height:44px; font-size:14px; text-transform:none; letter-spacing:.2px; }
.set-group{ padding:4px 0 10px; border-bottom:1px solid rgba(255,255,255,.06); }
.set-note{ margin:10px 0 0; font-size:13px; line-height:1.5; color:var(--text-dim); }
.set-note[data-warn]::after{ content:" " attr(data-warn); color:#ffd166; }
html[data-view="aurora"] .set-link{ margin-top:10px; padding:6px 12px; font-size:12px; letter-spacing:.2px; text-transform:none; }
#settingsDrawer .lg-preview{ margin:8px 0; font-size:13px; color:var(--text-dim); line-height:1.9; }
#settingsDrawer .lg-preview .linkish{ font-size:13px; }

/* ===================== L8: tour ===================== */
.tour-hole{
  position:fixed; z-index:90; border-radius:16px; pointer-events:none;
  box-shadow:0 0 0 9999px rgba(3,5,15,.74), 0 0 0 2px rgba(45,226,196,.9), 0 0 30px rgba(45,226,196,.4);
  transition:left .3s ease, top .3s ease, width .3s ease, height .3s ease;
}
.tour-card{
  position:fixed; z-index:91; padding:16px 18px 14px; border-radius:18px; color:var(--text);
  background:linear-gradient(180deg, #121a46, #0b1030); border:1px solid rgba(45,226,196,.45); box-shadow:0 20px 50px rgba(0,0,0,.55);
  transition:left .3s ease, top .3s ease;
}
.tour-card h3{ margin:4px 0 6px; font-size:18px; font-weight:600; }
.tour-card p{ margin:0; font-size:14px; line-height:1.5; color:var(--text-dim); }
.tr-count{ font-size:11px; font-weight:700; letter-spacing:1.4px; text-transform:uppercase; color:var(--teal); }
.tr-actions{ display:flex; align-items:center; gap:8px; margin-top:14px; }
.tr-actions span{ flex:1; }
html[data-view="aurora"] .tour-card button{ padding:7px 14px; font-size:13px; text-transform:none; letter-spacing:.2px; }
html[data-view="aurora"] .tour-card .primary{ background:var(--teal); color:#070b1f; border-color:transparent; font-weight:700; }
html[data-view="aurora"] .tour-card .tr-skip{ background:none; border-color:transparent; color:var(--text-dim); }

/* ===================== L3: control-room mode ===================== */
html.calm .bscene *{ animation-play-state:paused !important; }
html.calm .bscene .warn, html.calm .bscene .blink{ animation-play-state:running !important; }
html.calm #funFx, html.calm #meteorFx{ display:none !important; }
html.calm .bscene .boat, html.calm .bscene .drone-path, html.calm .bscene .gull-path{ visibility:hidden; }
html.calm #auroraCanvas{ opacity:.3; }
html.calm :is(.orb-radar, .ring-a, .ring-b, .orb-ripple, .orb::before, .orb){ animation:none !important; }
html.calm .orb-ripple{ display:none; }

/* ===================== P3: bottom tab bar ===================== */
.tab-bar{ display:none; }
@media (max-width:720px){
  .tab-bar{
    display:grid; grid-template-columns:repeat(4, 1fr); position:fixed; z-index:56; left:0; right:0; bottom:0;
    padding:6px 8px calc(6px + env(safe-area-inset-bottom)); background:rgba(7,11,31,.9);
    backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px); border-top:1px solid rgba(255,255,255,.1);
  }
  .tab-bar a{ display:flex; flex-direction:column; align-items:center; gap:2px; padding:5px 0; border-radius:12px; font-size:11px; color:var(--text-dim); text-decoration:none; }
  .tab-bar a.on{ color:var(--text); background:rgba(255,255,255,.08); }
  .tab-bar svg{ width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
  body{ padding-bottom:calc(70px + env(safe-area-inset-bottom)); }
}

/* ===================== phone layout (P1) ===================== */
@media (max-width:1100px){ .tb-nav{ display:none; } }
@media (max-width:720px){
  .tb-inner{ flex-wrap:wrap; gap:6px 6px; padding:7px 10px 6px; min-height:0; }
  .tb-brand, #tbHelp{ display:none; }
  .tb-state{ font-size:13px; padding:6px 12px 6px 9px; order:1; flex:1 1 0; min-width:0; }
  .tb-state-text{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; }
  .tb-state-for{ white-space:nowrap; }
  .tb-right{ order:2; gap:5px; }
  html[data-view="aurora"] .tb-icon, html[data-view="aurora"] .tb-lock{ width:34px; height:34px; padding:0; }
  html[data-view="aurora"] .tb-alarm{ height:34px; padding:0 10px; font-size:12px; }
  .tb-health{ order:3; flex-direction:row; align-items:center; width:100%; justify-content:flex-start; gap:8px; margin-left:0; }
  .tb-health #heartbeat{ font-size:11px; padding:3px 9px; }
  .tb-health #heartbeat .ecg{ display:none; }
  .tb-next{ padding:0; }
  #tbLockText{ display:none; }
  main{ display:flex; flex-direction:column; padding:10px 14px 20px; }
  #hero .legend-card{ display:none; }   /* the top bar chip says the same thing; signs come sooner */
  #hero{ order:1; } #bridgeCards{ order:2; } #summaryBar{ order:3; } #sceneBand{ order:4; } #grid{ order:5; } #signMessages{ order:6; }
  .bridge-cards{ grid-template-columns:1fr; gap:10px; margin-top:14px; }
  .bc-state{ font-size:19px; }
  .hero-line{ font-size:clamp(34px, 11vw, 48px); }
  .orb-wrap{ width:min(190px, 52vw); }
  .stat-tiles{ grid-template-columns:1fr 1fr; }
  .st-value{ font-size:28px; }
  .heat{ grid-template-columns:30px repeat(24, minmax(0, 1fr)); gap:1px; }
  .heat .hx{ font-size:8px; }
  .heat-card #heatPick{ position:static; margin-bottom:8px; }
  .filters input[type=search]{ flex:1 1 100%; }
  #histCount{ margin-left:0; }
  .sec-head{ align-items:flex-start; }
  .tl-hint{ display:none; }
  .ac-actions{ flex-direction:column-reverse; }
  html[data-view="aurora"] #alarmCard button{ width:100%; }
}
