/* VisionSentinel Command - "Cinema" layout, with the team's mobile-card skin (13 Nov, see the end of the file).
   Deep slate surfaces, sage accent, monospace micro-labels; the camera image is the largest thing
   on the page and the case file sits next to it. Fonts are the ones Windows already has (Segoe UI,
   Consolas): no downloads, works offline. */
:root {
  color-scheme: dark;
  --bg: #0d1214;
  --header: #0f1618;
  --panel: #151d20;
  --panel-alt: #1b2528;
  --stage: #172023;
  --line: #232c2f;
  --line-strong: #2c3739;
  --text: #e9f0f3;
  --muted: #8d9eac;
  --accent: #ff8c34;
  --green: #ff8d36;
  --amber: #f6c16b;
  --red: #fb8d79;
  --alarm: #ff6b57;
  --veh: #c9fa89;
  --two: #7bdce3;
  --ped: #d6b8ff;
  --radius: 16px;
  --radius-sm: 12px;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: Consolas, "Cascadia Mono", "SF Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 20px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 38px; line-height: 1.15; letter-spacing: -1.3px; font-weight: 450; }
h2 { font-size: 17px; line-height: 1.4; letter-spacing: -.3px; font-weight: 600; }
svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.eyebrow { font-size: 10px; letter-spacing: 1.7px; font-weight: 600; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 5px; padding: 5px 8px; font-size: 9px; font-weight: 650; letter-spacing: .6px; white-space: nowrap; }
.pill > i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.green { background: #2d2520; color: var(--green); }
.pill.amber { background: #3a3023; color: var(--amber); }
.pill.red { background: #3b2422; color: var(--red); }
.pill.muted { background: var(--panel-alt); color: var(--muted); }
.tiny-tag { display: inline-block; color: var(--muted); font-size: 8px; border: 1px solid var(--line); border-radius: 3px; padding: 2px 5px; vertical-align: middle; letter-spacing: .6px; font-weight: 500; margin-left: 5px; }

/* ---------------------------------------------------------------- header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 21px 36px; border-bottom: 1px solid var(--line); background: var(--header); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 400; letter-spacing: .7px; white-space: nowrap; }
.brand b { font-weight: 750; }
.brand small { display: block; color: var(--muted); font-size: 8px; letter-spacing: 2px; margin-top: 3px; font-weight: 600; }
.emblem { width: 35px; height: 35px; color: #ff892f; stroke-linecap: butt; stroke-linejoin: miter; filter: drop-shadow(0 0 7px #ff852822); }
.nav { display: flex; gap: 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 11px; color: var(--muted); }
.nav a:hover { color: var(--text); }
.nav a.selected { color: var(--accent); box-shadow: inset 0 -1px var(--accent); }
.nav svg { width: 15px; height: 15px; }
.nav b { font-size: 9px; font-weight: 650; background: #3b2422; color: var(--red); border-radius: 8px; padding: 1px 6px; }
.top-tools { display: flex; align-items: center; gap: 18px; }
.link { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--muted); }
.link.on .dot { background: var(--green); }
.link.off .dot { background: var(--red); }
.date { font: 10px var(--mono); color: var(--muted); letter-spacing: .6px; }
.round { border: 1px solid var(--line); background: var(--panel-alt); width: 33px; height: 33px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.round svg { width: 16px; height: 16px; }
.round .sound-on { display: none; }
.round[aria-pressed="true"] { color: var(--accent); border-color: #544a44; }
.round[aria-pressed="true"] .sound-on { display: inline; }
.round[aria-pressed="true"] .sound-off { display: none; }

/* ---------------------------------------------------------------- intro + banner */
main { max-width: 1800px; margin: auto; padding: 25px 36px 0; }
.intro { display: flex; justify-content: space-between; align-items: center; gap: 25px; margin: 8px 0 26px; }
.intro .eyebrow { margin-bottom: 10px; }
.intro-sub { color: var(--muted); font-size: 12px; margin-top: 10px; }
.location { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); padding: 9px 12px; border-radius: 7px; white-space: nowrap; font-size: 11px; }
.location svg { width: 15px; color: var(--accent); }

.alert-banner { display: flex; align-items: center; gap: 13px; background: #27221e; border: 1px solid #524a44; border-left: 3px solid var(--green); padding: 12px 17px; border-radius: 8px; margin-bottom: 18px; }
.alert-symbol { display: grid; place-items: center; color: var(--green); border: 1px solid currentColor; border-radius: 50%; width: 25px; height: 25px; flex: none; font-weight: 700; font-size: 12px; }
.alert-banner strong { font-size: 13px; font-weight: 600; }
.alert-banner p { font-size: 11px; color: var(--muted); margin-top: 3px; max-width: 900px; }
.alert-banner a { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 11px; white-space: nowrap; color: var(--green); }
.alert-banner a svg { width: 15px; }
.alert-banner a[hidden] { display: none; }
body[data-tone="amber"] .alert-banner { background: #2c281e; border-color: #615332; border-left-color: var(--amber); }
body[data-tone="amber"] .alert-symbol, body[data-tone="amber"] .alert-banner a { color: var(--amber); }
body[data-tone="red"] .alert-banner { background: #2b2221; border-color: #6b4239; border-left-color: var(--alarm); }
body[data-tone="red"] .alert-symbol, body[data-tone="red"] .alert-banner a { color: var(--red); }
body[data-tone="muted"] .alert-banner { background: var(--panel-alt); border-color: var(--line); border-left-color: var(--muted); }
body[data-tone="muted"] .alert-symbol, body[data-tone="muted"] .alert-banner a { color: var(--muted); }

/* ---------------------------------------------------------------- grid + panels */
.grid { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(325px, 1fr); gap: 18px; align-items: start; }
.camera-panel { grid-column: 1; grid-row: 1; }
.case-panel { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; }
.timeline-panel { grid-column: 1; grid-row: 2; }
.traffic-panel { grid-column: 1; grid-row: 3; }
.journal-panel { grid-column: 2; grid-row: 3 / span 2; align-self: stretch; }
.node-panel { grid-column: 1; grid-row: 4; }
.panel { min-width: 0; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 19px 20px; }
.panel-heading .eyebrow { font-size: 8px; letter-spacing: 1.5px; display: block; margin-bottom: 4px; }
.panel-heading > .muted { font-size: 10px; text-align: right; }

/* ---------------------------------------------------------------- camera */
.stage-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--stage); font: 8px var(--mono); letter-spacing: 1px; color: var(--muted); }
.stage-head > span:first-child { display: flex; align-items: center; gap: 7px; color: var(--accent); }
.camera-panel .panel-heading { padding: 16px 20px; }
.viewport { aspect-ratio: 16 / 8.7; position: relative; overflow: hidden; background: #0d1518; }
.viewport canvas, .viewport img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.viewport img { object-fit: contain; }
.viewport [hidden] { display: none; }
.image-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(#060c1566, transparent 22%, transparent 66%, #060c15c4); }
.feed-top, .feed-bottom { position: absolute; left: 25px; right: 25px; display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none; }
.feed-top { top: 23px; }
.feed-bottom { bottom: 22px; align-items: end; }
.feed-bottom > div { display: grid; gap: 7px; min-width: 0; }
.feed-brand { display: flex; align-items: center; gap: 9px; font: 600 11px var(--mono); letter-spacing: 2px; color: #fff; text-shadow: 0 1px 4px #000a; }
.feed-brand svg { width: 26px; height: 26px; stroke-linecap: butt; stroke-linejoin: miter; }
.feed-mode { font: 8px var(--mono); letter-spacing: .7px; padding: 5px 7px; background: #09131aaa; border: 1px solid #ffffff30; border-radius: 3px; color: #fff; white-space: nowrap; }
.feed-mode > i { display: inline-block; width: 5px; height: 5px; background: #f6d7c0; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.feed-mode.live > i { background: var(--alarm); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.feed-status { font: 600 10px var(--mono); letter-spacing: 1px; background: #1d1814dd; border-left: 2px solid var(--green); padding: 5px 8px; width: max-content; max-width: 100%; color: #f8e2d1; }
.viewport[data-tone="amber"] .feed-status { background: #281f12dd; border-left-color: var(--amber); color: #ffe2b0; }
.viewport[data-tone="red"] .feed-status { background: #2b1814dd; border-left-color: #ff9b70; color: #ffd1bb; }
.viewport[data-tone="muted"] .feed-status { background: #141b20dd; border-left-color: var(--muted); color: #d5dde3; }
.feed-detail { font-size: 12px; color: #fff; text-shadow: 0 1px 4px #000c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame-stamp { font: 8px/1.7 var(--mono); text-align: right; letter-spacing: .5px; color: #fff; text-shadow: 0 1px 3px #000c; white-space: nowrap; }
.video-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.viewport.live .video-empty { display: none; }
.viewport.alarm { box-shadow: inset 0 0 0 2px var(--alarm); }

.video-toolbar { padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; font-size: 10px; flex-wrap: wrap; }
.toolbar-status { display: flex; align-items: center; gap: 7px; }
.legend { display: flex; gap: 12px; color: var(--muted); font-size: 9px; flex-wrap: wrap; }
.legend > span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.key { width: 7px; height: 7px; display: inline-block; border: 1px solid var(--veh); }
.key.two { border-color: var(--two); }
.key.person { border-color: var(--ped); }
.key.lost { border: 1px dashed var(--muted); }
.key.occ { border: 1px dashed var(--amber); background: repeating-linear-gradient(-45deg, #ffbf5966 0 2px, transparent 2px 4px); }
.layers { border: 0; margin: 0; padding: 0; display: flex; gap: 5px; flex-wrap: wrap; }
.layers[disabled] { display: none; }
.layers label { display: flex; align-items: center; gap: 6px; padding: 4px 9px 4px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 10px; cursor: pointer; user-select: none; }
.layers label:has(input:checked) { color: var(--text); border-color: #544a44; background: #231e1a; }
.layers input { appearance: none; width: 12px; height: 12px; border: 1px solid var(--muted); border-radius: 3px; margin: 0; display: grid; place-items: center; cursor: pointer; }
.layers input:checked { background: var(--accent); border-color: var(--accent); }
.layers input:checked::after { content: ""; width: 6px; height: 3px; border: solid #201c1a; border-width: 0 0 1.6px 1.6px; transform: rotate(-45deg) translate(1px, -1px); }

/* ---------------------------------------------------------------- case file */
.case-panel .panel-heading { padding: 24px; align-items: flex-start; }
.case-panel h2 { font-size: 20px; line-height: 1.4; max-width: 230px; }
.case-body { padding: 0 24px 24px; }
.incident-type { display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); padding: 12px 0 24px; }
.event-icon { background: #3b2927; color: var(--red); border-radius: 9px; padding: 10px; display: flex; }
.event-icon.calm { background: #2d2520; color: var(--green); }
.event-icon.warn { background: #3a3023; color: var(--amber); }
.incident-type strong { font-size: 15px; }
.incident-type p { font-size: 10px; color: var(--muted); margin-top: 4px; }
.event-meta { display: grid; grid-template-columns: 1fr; gap: 17px; margin: 23px 0; }
.event-meta > span { color: var(--muted); font-size: 10px; }
.event-meta strong { display: block; color: var(--text); font-size: 13px; font-weight: 500; margin-top: 4px; }
.score-bar { display: block; height: 3px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.score-bar > i { display: block; height: 100%; background: var(--amber); }
.state-confirmed .score-bar > i { background: var(--alarm); }
.ai-note { padding: 18px; border: 1px solid #443d39; background: #292420; border-radius: 7px; }
.ai-head { display: flex; align-items: center; gap: 7px; font-size: 8px; letter-spacing: .8px; color: var(--accent); }
.ai-head > span { margin-left: auto; color: var(--muted); font-size: 7px; letter-spacing: .6px; }
.ai-note svg { width: 13px; height: 13px; }
.ai-note p { font-size: 12px; line-height: 1.9; margin: 10px 0; }
.ai-note small { font-size: 9px; color: var(--muted); display: block; }
.ai-note .chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 10px; }
.ai-note .chips span { font-size: 9px; border: 1px solid #4d4641; border-radius: 3px; padding: 2px 6px; color: #f6d5bc; }
.ai-note.pending .ai-head { color: var(--amber); }
.ai-note.bad .ai-head { color: var(--red); }
.ai-note.review .ai-head { color: var(--amber); }
.ai-note .ops { display: grid; gap: 8px; margin-top: 10px; }
.ai-note .op { border-left: 2px solid #4d4641; padding: 2px 0 2px 10px; }
.ai-note .op.gemini { border-left-color: #8ab4f8; }
.ai-note .op b { font-size: 10px; letter-spacing: .5px; }
.ai-note .op > span { float: right; font-size: 8px; letter-spacing: .6px; color: var(--muted); }
.ai-note .op p { margin: 4px 0 2px; }
.dots::after { content: ""; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.evidence-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 25px 0; }
.evidence-strip button { padding: 0; text-align: left; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--panel-alt); }
.evidence-strip button:hover { border-color: var(--accent); }
.evidence-strip img { display: block; width: 100%; aspect-ratio: 1.2; object-fit: cover; }
.evidence-strip span { display: flex; justify-content: space-between; font-size: 8px; padding: 6px; }
.evidence-strip b { color: var(--muted); font-weight: 400; }
.evidence-wait { margin: 25px 0; font-size: 10px; color: var(--muted); border: 1px dashed var(--line); border-radius: 5px; padding: 14px; text-align: center; }
.report-actions { display: flex; flex-direction: column; gap: 9px; }
.report-actions .row { display: flex; gap: 9px; }
.report-actions .row > * { flex: 1; }
.primary, .secondary { display: flex; align-items: center; justify-content: center; gap: 9px; border-radius: 6px; padding: 13px 12px; font-size: 11px; }
.primary { background: var(--accent); color: #201c1a; font-weight: 650; border: 1px solid transparent; }
.primary:hover { filter: brightness(1.06); }
.secondary { border: 1px solid var(--line); color: var(--text); }
.secondary:hover { border-color: var(--muted); }
.secondary.danger { color: var(--red); }
.primary svg, .secondary svg { width: 14px; height: 14px; }
[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.why { margin: 18px 0 0; font-size: 11px; }
.why summary { cursor: pointer; color: var(--muted); font-size: 10px; list-style: none; display: flex; align-items: center; gap: 6px; }
.why summary::-webkit-details-marker { display: none; }
.why summary::before { content: "›"; font-size: 13px; transition: transform .15s; }
.why[open] summary::before { transform: rotate(90deg); }
.why ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.why li { display: grid; grid-template-columns: 38px 1fr; gap: 6px; line-height: 1.5; color: #cdd8dd; font-size: 10.5px; }
.why time { font: 9px var(--mono); color: var(--muted); padding-top: 2px; }
.history { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; }
.history .eyebrow { font-size: 8px; display: block; margin-bottom: 8px; }
.history button { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.history button:last-child { border-bottom: 0; }
.history button.current { color: var(--accent); }
.history small { color: var(--muted); font-size: 9px; margin-left: auto; white-space: nowrap; }

/* ---------------------------------------------------------------- timeline */
.timeline-panel .panel-heading { padding-bottom: 10px; }
.chart-key { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; font-size: 9px; color: var(--muted); }
.chart-key > span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.chart-key i { display: inline-block; }
.k-line { width: 12px; height: 2px; background: var(--accent); }
.k-vis { width: 12px; height: 0; border-top: 1px dashed var(--muted); }
.k-imp { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.k-aft { width: 6px; height: 6px; border-radius: 50%; background: var(--text); }
#lane { display: block; width: calc(100% - 44px); height: 104px; margin: 0 22px; }
.timeline-labels { display: flex; justify-content: space-between; font: 8px var(--mono); color: var(--muted); padding: 10px 22px 18px; }

/* ---------------------------------------------------------------- traffic */
.traffic-total { display: flex; align-items: center; gap: 12px; padding: 0 20px 18px; }
.traffic-total > strong { font-size: 40px; line-height: 1; letter-spacing: -2px; font-weight: 400; font-variant-numeric: tabular-nums; }
.traffic-total > div { font-size: 11px; }
.traffic-total small { display: block; font-size: 9px; color: var(--muted); margin-top: 4px; }
.traffic-total svg { margin-left: auto; color: var(--accent); }
.composition-bar { height: 7px; display: flex; gap: 3px; margin: 0 20px 18px; background: var(--panel-alt); border-radius: 2px; }
.composition-bar > i { width: 0; background: var(--accent); border-radius: 2px; transition: width .6s ease; }
.composition-bar > i:nth-child(2) { background: #6b9f96; }
.composition-bar > i:nth-child(3) { background: #cfb36c; }
.composition-bar > i:nth-child(4) { background: #68808b; }
.composition-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; padding: 0 20px 20px; }
.composition-legend > span { font-size: 10px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.composition-legend i { width: 5px; height: 5px; background: var(--accent); border-radius: 1px; flex: none; }
.composition-legend span:nth-child(2) i { background: #6b9f96; }
.composition-legend span:nth-child(3) i { background: #cfb36c; }
.composition-legend span:nth-child(4) i { background: #68808b; }
.composition-legend b { color: var(--text); font-weight: 400; margin-left: auto; font-variant-numeric: tabular-nums; }
.traffic-foot { display: flex; justify-content: space-between; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 8px; color: var(--muted); }

/* ---------------------------------------------------------------- history (Tiger Data) */
.history-panel { margin-top: 18px; }
.history-body { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(250px, 1fr); gap: 22px; padding: 0 20px 18px; }
.history-chart svg { width: 100%; height: 150px; display: block; background: var(--panel-alt); border-radius: 4px; }
.history-axis { display: flex; justify-content: space-between; font: 8px var(--mono); color: var(--muted); margin-top: 6px; }
.h-stat strong { font-size: 40px; line-height: 1; font-weight: 400; letter-spacing: -2px; display: block; }
.h-stat span { font-size: 11px; display: block; margin-top: 6px; }
.h-stat small { font-size: 9px; color: var(--muted); display: block; margin-top: 4px; }
.h-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 6px; }
.h-list li { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.h-list b { color: var(--text); font-weight: 400; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .history-body { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- volunteers in the case file */
.case-community { margin-top: 12px; padding: 12px 14px; border: 1px solid #443d39; border-radius: 7px; font-size: 11px; }
.case-community b { font-size: 10px; letter-spacing: .6px; color: var(--accent); }
.case-community .counts { display: flex; gap: 14px; margin-top: 6px; color: var(--muted); }
.case-community .counts strong { color: var(--text); font-size: 15px; font-weight: 500; margin-right: 3px; }

/* ---------------------------------------------------------------- journal */
.activity { list-style: none; margin: 0; padding: 0 20px 14px; max-height: 560px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.activity li { display: flex; align-items: start; gap: 11px; border-top: 1px solid var(--line); padding: 12px 0; }
.activity time { color: var(--muted); font: 9px var(--mono); width: 44px; padding-top: 3px; flex: none; }
.activity .dot { margin-top: 6px; }
.activity li > span:last-child { font-size: 11px; min-width: 0; }
.activity small { display: block; color: var(--muted); font-size: 9px; margin-top: 3px; line-height: 1.5; }
.activity .empty { color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); padding: 14px 0; }

/* ---------------------------------------------------------------- system */
.node-body { padding: 0 20px 20px; }
.node-row { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.node-row[hidden] { display: none; }  /* rows for what this run does not use (history, second opinion, volunteers) */
.node-row > span { color: var(--muted); white-space: nowrap; }
.node-row > strong { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.node-stages { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; font-size: 9px; color: var(--muted); }
.node-stages > span { display: flex; align-items: center; gap: 6px; }
.node-stages i { width: 5px; height: 5px; background: var(--line); border-radius: 50%; }
.node-stages > span.on { color: var(--text); }
.node-stages > span.on i { background: var(--accent); box-shadow: 0 0 0 3px #ff8c3422; }
.node-stages b { font-weight: 400; opacity: .5; }

/* ---------------------------------------------------------------- metrics, footer */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.metrics article { padding: 14px 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.metrics article > div { color: var(--muted); font-size: 11px; }
.metrics strong { display: block; font-size: 24px; font-weight: 500; letter-spacing: -1px; margin: 9px 0 5px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metrics strong > span { font-size: 15px; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.metrics .text-unit { font-size: 11px; letter-spacing: 1px; margin-left: 6px; }
.metrics strong.warn { color: var(--amber); }
.metrics strong.bad { color: var(--red); }
.metrics small { font-size: 10px; color: var(--muted); }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 9px; color: var(--muted); padding: 24px 0; }
.footer > span:first-child { display: flex; align-items: center; gap: 7px; }
.footer svg { width: 13px; height: 13px; }
.footer b { font-weight: inherit; }
.footer > span:last-child { font: 8px var(--mono); letter-spacing: .6px; text-align: right; }

/* ---------------------------------------------------------------- zone editor */
.zones-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.zones-view canvas { cursor: crosshair; }
.zones-side h2 { font-size: 18px; }
.tools { display: grid; gap: 7px; }
.tools label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; cursor: pointer; }
.tools label:has(input:checked) { border-color: #544a44; background: #231e1a; }
.tools input { accent-color: var(--accent); margin-top: 3px; }
.tools b { display: block; font-size: 12px; font-weight: 600; }
.tools small { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.zone-keys { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 16px 0 6px; font-size: 9.5px; color: var(--muted); }
kbd { font: 9px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; color: var(--text); }
.zone-list-title { font-size: 12px; margin: 18px 0 6px; display: flex; align-items: center; gap: 4px; }
.zone-list { list-style: none; margin: 0 0 18px; padding: 0; }
.zone-list li { display: flex; align-items: center; border-top: 1px solid var(--line); }
.zone-list li.sel { background: #231e1a; }
.zone-list li.empty { color: var(--muted); font-size: 11px; padding: 10px 0; }
.zone-list button[data-sel] { flex: 1; display: flex; align-items: center; gap: 8px; text-align: left; padding: 9px 6px; font-size: 11px; }
.zone-list button i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.zone-list small { margin-left: auto; color: var(--muted); font-size: 9px; }
.zone-list .del { color: var(--muted); font-size: 16px; padding: 4px 10px; }
.zone-list .del:hover { color: var(--red); }
.secondary.small { padding: 5px 10px; font-size: 10px; }
.key.zk-road { border: 1px dashed var(--accent); }
.key.zk-give { background: #f6c16b66; border-color: #f6c16b; }
.key.zk-park { background: #7bdce366; border-color: #7bdce3; }
.key.zk-bus { background: #d6b8ff66; border-color: #d6b8ff; }
.key.zk-other { background: #9aa7ae66; border-color: #9aa7ae; }
.key.zk-island { background: #93a5ff66; border-color: #93a5ff; }
.key.zone { border: 1px dashed var(--accent); }
.edit-zones { font-size: 10px; color: var(--accent); border: 1px solid #544a44; border-radius: 5px; padding: 4px 9px; white-space: nowrap; }
.edit-zones:hover { background: #231e1a; }
@media (max-width: 960px) { .zones-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- dialog */
dialog { color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; max-width: 980px; width: calc(100% - 32px); padding: 22px 25px 25px; box-shadow: 0 30px 100px #0008; }
dialog::backdrop { background: #020913b3; backdrop-filter: blur(5px); }
.dialog-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.close-button { border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; width: 30px; height: 30px; }
.close-button svg { width: 15px; }
dialog h2 { font-size: 22px; margin-bottom: 14px; }
dialog video, dialog img { width: 100%; border-radius: 7px; display: block; background: #000; max-height: 72vh; object-fit: contain; }
dialog [hidden] { display: none; }

/* ---------------------------------------------------------------- responsive */
@media (min-width: 1600px) {
  .viewport { aspect-ratio: 16 / 8; } /* until the first frame sets the real one */
  .ai-note p { font-size: 14px; }
  .case-panel h2 { font-size: 23px; max-width: none; }
}
@media (max-width: 1200px) {
  .top { gap: 15px; padding: 18px 24px; }
  .nav { gap: 5px; }
  .nav a { padding: 9px; font-size: 10px; }
  .top-tools { gap: 10px; }
  main { padding: 24px 24px 0; }
  .grid { grid-template-columns: minmax(0, 1.8fr) 310px; }
  .case-body { padding: 0 17px 20px; }
  .case-panel .panel-heading { padding: 18px; }
  .ai-note { padding: 12px; }
  .ai-note p { font-size: 11px; }
  .feed-brand { font-size: 9px; }
  .event-meta { margin: 17px 0; gap: 12px; }
  .evidence-strip { margin: 20px 0; }
}
@media (max-width: 960px) {
  .top { flex-wrap: wrap; }
  .nav { order: 3; justify-content: center; width: 100%; border-top: 1px solid var(--line); padding-top: 9px; }
  .top-tools { margin-left: auto; }
  h1 { font-size: 32px; }
  .grid { grid-template-columns: 1.5fr 1fr; }
  .camera-panel { grid-column: 1 / -1; grid-row: 1; }
  .case-panel { grid-column: 2; grid-row: 2 / span 2; }
  .timeline-panel { grid-column: 1; grid-row: 2; }
  .traffic-panel { grid-column: 1; grid-row: 3; }
  .journal-panel { grid-column: 1; grid-row: 4; }
  .node-panel { grid-column: 2; grid-row: 4; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .top { padding: 14px 16px; gap: 12px; }
  .brand { font-size: 12px; }
  .emblem { width: 31px; height: 31px; }
  .top-tools .date, .top-tools .link > span { display: none; }
  .top-tools .pill { font-size: 7px; }
  .nav { justify-content: space-between; gap: 0; }
  .nav a { font-size: 10px; padding: 9px 6px; gap: 6px; }
  .nav a svg { width: 13px; height: 13px; }
  main { padding: 18px 16px 0; }
  h1 { font-size: 26px; letter-spacing: -.8px; }
  .intro { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
  .location { white-space: normal; }
  .alert-banner { flex-wrap: wrap; }
  .alert-banner a { margin-left: 38px; }
  .grid { display: flex; flex-direction: column; gap: 14px; }
  .camera-panel { order: 0; }
  .case-panel { order: 1; }
  .timeline-panel { order: 2; }
  .traffic-panel { order: 3; }
  .journal-panel { order: 4; }
  .node-panel { order: 5; }
  .viewport { aspect-ratio: 16 / 10; }
  .feed-top, .feed-bottom { left: 12px; right: 12px; }
  .feed-top { top: 12px; }
  .feed-bottom { bottom: 12px; }
  .feed-brand { font-size: 7px; letter-spacing: .5px; }
  .feed-brand svg { width: 18px; height: 18px; }
  .feed-detail { font-size: 9px; }
  .feed-status { font-size: 8px; }
  .frame-stamp { font-size: 7px; }
  .stage-head { padding: 9px 14px; font-size: 7px; }
  .video-toolbar { padding: 12px 14px; }
  .legend { display: none; }
  .case-panel .panel-heading { padding: 18px; }
  .case-body { padding: 0 18px 20px; }
  .event-meta { grid-template-columns: 1fr 1fr; }
  .evidence-strip img { aspect-ratio: 16 / 10; }
  .chart-key { display: none; }
  .activity { max-height: 380px; }
  .metrics { gap: 10px; }
  .metrics article { padding: 12px; }
  .footer { flex-direction: column; align-items: flex-start; gap: 8px; }
  .footer > span:last-child { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .feed-mode.live > i, .dots::after { animation: none; }
}
.heading-tools { display: flex; align-items: center; gap: 12px; }

/* ================================================================ skin: the team's mobile-card template (13 Nov)
   Only looks: rounder cards, tinted status cards, pill badges, big rounded buttons. No layout or behaviour change. */
.top { background: var(--bg); }
.nav { gap: 6px; }
.nav a { border-radius: 10px; padding: 9px 14px; }
.nav a:hover { background: var(--panel); }
.nav a.selected { background: #231f1c; color: var(--accent); box-shadow: none; }
.pill { border-radius: 6px; padding: 4px 9px; font-size: 9.5px; letter-spacing: .5px; }
.pill.green { background: #2a2420; }
.pill.amber { background: #372c11; }
.pill.red { background: #3a1f1b; }
.tiny-tag { border-radius: 6px; padding: 2px 6px; }
.round { border-radius: 10px; background: var(--panel); border-color: var(--line-strong); width: 36px; height: 36px; }
.location { border-radius: 12px; background: var(--panel); padding: 10px 14px; }

/* the banner = a tinted status card */
.alert-banner { border-radius: 14px; border-left-width: 1px; padding: 16px 20px; background: #1e1a17; border-color: #3a322c; }
.alert-banner strong { font-size: 15px; }
.alert-banner p { font-size: 12px; }
.alert-symbol { border: 0; border-radius: 10px; width: 34px; height: 34px; background: #342b25; font-size: 14px; }
body[data-tone="amber"] .alert-banner { background: #211a10; border-color: #4a3a1c; }
body[data-tone="amber"] .alert-symbol { background: #3a2e14; }
body[data-tone="red"] .alert-banner { background: #251916; border-color: #5c2f27; }
body[data-tone="red"] .alert-symbol { background: #3d211c; }
body[data-tone="muted"] .alert-banner { background: var(--panel); border-color: var(--line); }
body[data-tone="muted"] .alert-symbol { background: var(--panel-alt); }

/* cards */
.panel { border-color: var(--line); }
.stage-head { background: var(--panel); }
.viewport { background: #0b1012; }
.feed-mode { border-radius: 6px; }
.feed-status { border-left: 0; border-radius: 6px; padding: 6px 10px; }
.layers label { border-radius: 8px; padding: 5px 10px 5px 8px; }
.layers label:has(input:checked) { background: #231f1c; border-color: #493e36; }
.edit-zones { border-radius: 8px; padding: 5px 10px; }
.metrics article { background: var(--panel); border-color: var(--line); }

/* case file */
.event-icon { border-radius: 12px; }
.ai-note { border-radius: 12px; background: var(--panel-alt); border-color: var(--line-strong); }
.ai-note.pending, .ai-note.review { background: #211a10; border-color: #4a3a1c; }
.ai-note.bad { background: #251916; border-color: #5c2f27; }
.ai-note .chips span { border-radius: 6px; background: #1f2b2e; border-color: var(--line-strong); }
.case-community { border-radius: 12px; background: #1e1a17; border-color: #3a322c; }
.evidence-strip button { border-radius: 10px; border-color: var(--line-strong); background: var(--panel-alt); }
.evidence-strip button[data-label="Impact"] { border-color: #c9a86a; }
.evidence-strip button[data-label="Impact"] span { color: var(--amber); }
.evidence-wait { border-radius: 12px; }
.primary, .secondary { border-radius: 12px; padding: 14px 14px; font-size: 12px; font-weight: 600; }
.primary { background: #ff8d35; color: #201b17; }
.secondary { background: var(--panel); border-color: var(--line-strong); }
.secondary.danger { background: #251a18; border-color: #6e3329; color: #f1998c; }
.history button { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 6px; background: var(--panel-alt); }
.history button:last-child { border-bottom: 1px solid var(--line); }
.history button:hover { border-color: var(--line-strong); }

/* history, system, zone editor, dialog */
.history-chart svg { border-radius: 10px; }
.tools label { border-radius: 12px; }
.tools label:has(input:checked) { background: #231f1c; border-color: #493e36; }
.zone-list li.sel { background: #231f1c; }
dialog { border-radius: 18px; }
dialog video, dialog img { border-radius: 12px; }
.close-button { border-radius: 10px; }
.start-btn { margin-left: auto; padding: 11px 18px; white-space: nowrap; }
.start-btn + a { margin-left: 18px; }
.start-btn[hidden] { display: none; }
.start-btn svg { fill: currentColor; stroke: none; }
.start-btn[hidden] + a { margin-left: auto; }
/* safety level of the volunteers' alert (community/safety.py) */
.case-community p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.case-community.trained { background: #211a10; border-color: #4a3a1c; }
.case-community.trained b { color: #f0c46e; }
.case-community.hold { background: #251916; border-color: #5c2f27; }
.case-community.hold b, .case-community p.stop { color: #ff9b87; }
