:root {
  --bg: #f6f7f9;
  --ink: #1b2430;
  --muted: #5b6675;
  --accent: #0e7c3e;
  --line: #d7dde4;
  --card: #ffffff;
  --warn: #8a5a00;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
.topbar {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.brand { font-weight: 700; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-right: 6px; }
.scenario-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 14px; font-size: 14px;
}
.scenario-label { font-weight: 600; }
.scenario-link {
  min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink); text-decoration: none;
}
.scenario-link.active { border-color: var(--accent); outline: 2px solid var(--accent); font-weight: 700; }
.fixture-note { color: var(--muted); margin-left: auto; }
.live-banner {
  margin: 8px 14px 0; padding: 10px 12px; border-radius: 10px;
  background: #fff8e6; border: 1px solid #d9b45c; color: #1b2430;
  font-size: 14px; font-weight: 600;
}
.conn { font-weight: 600; }
body[data-live="reconnecting"] .conn { color: var(--warn); }
.layout {
  display: grid; grid-template-columns: 3fr 2fr; gap: 12px;
  padding: 12px 14px; align-items: start;
}
.map-pane { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
#map { width: 100%; height: 62vh; min-height: 320px; }
.map-fallback { padding: 12px; font-size: 14px; }
.legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--ink);
}
.sym { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.sym.sensor { background: #2456a6; }
.sym.target { background: #fff; border: 3px solid var(--accent); width: 10px; height: 10px; }
.side-pane { display: grid; gap: 12px; }
.side-pane section { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
h2 { font-size: 15px; margin: 4px 0 8px; }
.muted { color: var(--muted); }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 40vh; overflow: auto; }
.event-item {
  width: 100%; min-height: 48px; text-align: left; cursor: pointer;
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fbfcfd;
  font-size: 15px;
}
.event-item.selected { outline: 3px solid var(--accent); border-color: var(--accent); }
.ev-time { font-weight: 700; }
.ev-kind { text-transform: capitalize; }
.ev-audio { color: var(--muted); }
.kind-silent_miss { border-style: dashed; }
.audio-pending .ev-audio, .audio-unavailable .ev-audio { color: var(--warn); font-weight: 600; }
.empty { padding: 8px 2px; }
.detail dl { display: grid; grid-template-columns: 150px 1fr; gap: 4px 10px; margin: 0 0 8px; font-size: 14px; }
.detail dt { font-weight: 600; }
.detail dd { margin: 0; }
.note { font-size: 14px; }
.marker-ok { font-weight: 600; }
.marker-no { color: var(--warn); font-weight: 600; }
.audio-row { margin: 8px 0; }
.audio-row audio { width: 100%; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.controls button {
  min-height: 44px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #eef1f4; font-size: 15px;
}
.footer {
  display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between;
  padding: 10px 14px; font-size: 12px; color: var(--muted);
}
/* MapLibre HTML markers (no font-stack dependency). */
.mk-label {
  font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.92); border: 1px solid var(--line);
  pointer-events: none; white-space: nowrap;
}
.mk-target { color: var(--accent); border-color: var(--accent); }
.mk-label.selected { outline: 3px solid #ff8c00; border-color: #ff8c00; }
.mk-sensor.selected { color: #b35400; }
.map-wrap { position: relative; }
.map-backdrop-note {
  position: absolute; left: 8px; bottom: 8px; z-index: 5;
  font-size: 12px; font-weight: 600; color: #1b2430;
  background: rgba(255, 255, 255, 0.9); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 8px; pointer-events: none;
}
.audio-ref { font-size: 14px; }
.audio-ref code { font-weight: 700; }
/* Tablet portrait / phone: stacked, map 45-55% of available height, no h-overflow. */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  #map { height: 48vh; min-height: 280px; }
  .detail dl { grid-template-columns: 130px 1fr; }
  body { overflow-x: hidden; }
}
@media (max-width: 420px) {
  #map { height: 46vh; min-height: 240px; }
  .topbar { font-size: 13px; }
  .event-item { font-size: 16px; }
}
/* #87: compact map-first review workspace; diagnostics stay secondary. */
.layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 350px); gap: 10px; padding: 10px; }
.side-pane, .side-pane section { min-width: 0; }
#map { height: calc(100vh - 130px); min-height: 360px; }
.topbar { padding: 8px 12px; gap: 6px 14px; }
.conn { margin-left: auto; }
.demo-tag { font-size: 12px; font-weight: 500; color: var(--muted); }
.event-list { gap: 5px; max-height: 24vh; }
.event-item { padding: 8px; font-size: 14px; gap: 3px 8px; }
.ev-verification { font-size: 12px; color: var(--muted); }
.selected-heading { margin: 0 0 4px; }
.source-line { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.provenance, .diagnostics { margin-top: 10px; font-size: 13px; overflow-wrap: anywhere; }
summary { cursor: pointer; padding: 8px 0; min-height: 36px; }
.detail dl { grid-template-columns: 95px minmax(0, 1fr); font-size: 12px; }
.detail dd { overflow-wrap: anywhere; }
.review-hint { font-size: 13px; color: var(--muted); margin-bottom: 0; }
.controls button:not(:disabled) { cursor: pointer; color: #fff; background: var(--accent); border-color: var(--accent); }
.controls button[data-decision="reject"]:not(:disabled) { background: #963d32; border-color: #963d32; }
.controls button:disabled { opacity: .6; }
.verification { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #eff6ee; }
.live-banner { margin: 6px 10px 0; padding: 6px 9px; font-size: 12px; }
@media (max-width: 900px) {
 .layout { grid-template-columns: 1fr; }
 #map { height: 45vh; min-height: 240px; }
 .side-pane { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
 .event-list { max-height: 26vh; }
}
@media (max-width: 550px) {
 .side-pane { grid-template-columns: 1fr; }
 #map { height: 40vh; min-height: 220px; }
 .event-list { max-height: 19vh; }
 .topbar .scope { font-size: 11px; }
 .conn { font-size: 12px; }
 .controls button { flex: 1; }
}
