/* Rythmo Triage Command. True-black flat (design skill draw, seed 383059086):
   one cool near-black ground for a monitor, panels one lightness step up, no
   borders or shadows on panels, colour only on the triage categories and the
   SIMULATION marker. Grid: 12 columns, 16px gap, 28px gutter. At 1440 the
   canvas is 1384 wide: totals 4 cols + scene 8 cols; list 7 + side 5. */
:root {
  --ground: #0c0d0f; --surface: #15171a; --raised: #22252a; --rule: #23262b; --control: #3a3e45;
  --text: #ffffff; --muted: #b4b4b4; --faint: #949494;
  --brand: #5fc4cf; /* Rythmo teal, lifted for dark: the mark only */
  --p1: #d62828; --p2: #ffc400; --p3: #1e9648; --dead: #141414; --nb: #b8bdc2; --waiting: #4a4f57;
  --sim: #ffc400; --sim-ink: #12253f; --warn: #f2b33d;
  --radius: 6px; --gap: 16px; --gutter: 28px; --pad: 20px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--ground); color: var(--text); font: 15px/1.45 var(--font); }
h1 { font-size: 24px; line-height: 1.2; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; color: var(--muted); }
button { font: inherit; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.sim { background: var(--sim); color: var(--sim-ink); font-weight: 700; font-size: 14px; text-align: center; padding: 5px 16px; }
.top { height: 56px; display: flex; align-items: center; gap: 24px; padding: 0 var(--gutter); border-bottom: 1px solid var(--rule); }
.mark { display: flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; }
.logo { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--brand); }
.back { background: none; border: 0; color: var(--muted); padding: 0; }
.back:hover, .back:focus-visible { color: var(--text); }
.who { margin-left: auto; display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 14px; }
.who .link { border-left: 1px solid var(--rule); padding-left: 16px; }
.link { background: none; border: 0; color: var(--muted); padding: 0; }
.link:hover, .link:focus-visible { color: var(--text); }

main { padding: 24px var(--gutter) 48px; }
.title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.meta { margin: 4px 0 0; color: var(--muted); }
.fresh { color: var(--faint); font-size: 13px; white-space: nowrap; }
.panel { background: var(--surface); border-radius: var(--radius); padding: var(--pad); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.empty { color: var(--muted); margin: 8px 0 0; }

/* Sign in */
.signin { max-width: 360px; margin: 12vh auto 0; }
.signin p { margin: 6px 0 20px; }
input { width: 100%; font: inherit; font-size: 22px; letter-spacing: 0.04em; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--control); background: var(--surface); color: var(--text); }
input:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.primary { width: 100%; margin-top: 12px; height: 44px; border: 0; border-radius: 999px; background: var(--text); color: #000; font-weight: 600; }
.primary:hover { background: #e6e6e6; }
.error { color: #ff7a7a; min-height: 1.4em; margin: 10px 0 0; }

/* Board */
.board { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); }
.totals { grid-column: span 4; }
.scene { grid-column: span 8; }
.patients { grid-column: span 7; }
.side { grid-column: span 5; display: grid; gap: var(--gap); align-content: start; }
.total { font-size: 96px; line-height: 1; font-weight: 600; letter-spacing: -0.03em; margin: 4px 0 20px; }
.strip { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--raised); margin-bottom: 8px; }
.strip span { display: block; height: 100%; }
.cats { list-style: none; margin: 0; padding: 0; }
.cats li { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 12px; height: 52px; border-bottom: 1px solid var(--rule); }
.cats li:last-child { border-bottom: 0; }
.cats .n { font-size: 32px; font-weight: 600; }
.cats .zero { color: var(--faint); }
.sw { width: 14px; height: 14px; border-radius: 3px; }
.sw-P1 { background: var(--p1); } .sw-P2 { background: var(--p2); } .sw-P3 { background: var(--p3); }
.sw-DEAD { background: var(--dead); box-shadow: inset 0 0 0 1px var(--faint); } /* taste-skill-ignore: a black swatch needs an outline to show on a dark panel */ .sw-NOT_BREATHING { background: var(--nb); }
.sw-none { background: var(--waiting); }

/* Tables: rules and alignment */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--faint); padding: 0 10px 8px 0; }
.table td { padding: 10px 10px 10px 0; border-top: 1px solid var(--rule); white-space: nowrap; }
.table .num { text-align: right; }
.table tr.go { cursor: pointer; }
.table tr.go:hover td, .table tr.go:focus-visible td { background: var(--raised); }
.table tr.closed td { color: var(--faint); }
.scroll { max-height: 420px; overflow-y: auto; }
.cat { display: inline-flex; align-items: center; gap: 8px; }
.note { color: var(--faint); font-size: 13px; margin-left: 8px; }

.phones { list-style: none; margin: 0; padding: 0; }
.phones li { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--rule); }
.phones li:first-child { border-top: 0; }
.quiet { color: var(--warn); }
.log { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.log li { display: grid; grid-template-columns: 6.5em 14px 1fr; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--rule); font-size: 14px; }
.log li:first-child { border-top: 0; }
.log time { color: var(--faint); }

/* Map */
.map-box { position: relative; margin-top: 4px; }
.map { position: relative; height: 470px; overflow: hidden; border-radius: 4px; background: var(--raised); touch-action: none; cursor: grab; user-select: none; }
.map:active { cursor: grabbing; }
.map-tiles img { position: absolute; left: 0; top: 0; width: 256px; height: 256px; max-width: none; }
.map-markers { position: absolute; inset: 0; pointer-events: none; }
.map-dot { position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); } /* taste-skill-ignore: markers float over a busy map and must stand off it */
.map-dot span { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 600; color: #000; background: rgba(255,255,255,.92); padding: 0 5px; border-radius: 3px; }
.map-controls { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.map-controls button { height: 32px; min-width: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(21,23,26,.92); color: var(--text); font-weight: 600; }
.map-controls button[aria-pressed="true"] { background: var(--text); color: #000; }
.map-attrib { position: absolute; right: 0; bottom: 0; font-size: 11px; background: rgba(255,255,255,.85); color: #222; padding: 1px 6px; border-top-left-radius: 4px; }
.map-scale { position: absolute; left: 10px; bottom: 10px; border: 2px solid #000; border-top: 0; height: 8px; font-size: 11px; font-weight: 700; color: #000; text-shadow: 0 0 3px #fff; line-height: 0; } /* taste-skill-ignore: keeps the scale legible over map tiles */
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
#d-plot svg { width: 100%; height: auto; display: block; background: var(--raised); border-radius: 4px; }

.offline { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--warn); color: #000; padding: 8px 14px; border-radius: 999px; font-weight: 600; margin: 0; }

@media (max-width: 1100px) {
  .totals, .scene, .patients, .side { grid-column: 1 / -1; }
  .map { height: 380px; }
}
@media (max-width: 600px) {
  :root { --gutter: 16px; --pad: 16px; }
  .top { gap: 12px; } .mark .muted, #org { display: none; }
  .total { font-size: 72px; }
  .map { height: 320px; }
  .hide-phone { display: none; }
}
.table .zero, .cats .zero { color: var(--faint); }
.live { margin-bottom: var(--gap); }
.live-figs { display: flex; align-items: flex-end; gap: 56px; flex-wrap: wrap; }
.live .total { margin: 0; }
.live-cats { list-style: none; margin: 0 0 6px; padding: 0; display: flex; gap: 40px; flex-wrap: wrap; }
.live-cats li { display: grid; grid-template-columns: 14px auto; column-gap: 10px; align-items: center; }
.live-cats .n { grid-column: 2; font-size: 40px; font-weight: 600; line-height: 1.1; }
.live-cats .l { color: var(--muted); font-size: 14px; }
.ext { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; margin-left: 12px; }
.ext::after { content: " \2197"; }
.ext:hover, .ext:focus-visible { color: var(--text); }
td .ext { margin-left: 0; }
