@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/jbmono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/jbmono-500.woff2") format("woff2");
}

:root {
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Light Topo theme (default) */
  --bg: #e2e8f0;
  --hud-bg: rgba(255, 255, 255, 0.90);
  --hud-elevated: rgba(248, 250, 252, 0.98);
  --hud-well: rgba(241, 245, 249, 0.92);
  --hud-border: rgba(15, 23, 42, 0.11);
  --hud-border-hi: rgba(2, 132, 199, 0.45);
  --hud-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.10);

  --ink-1: #0f172a;
  --ink-2: #475569;
  --ink-3: #64748b;

  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-tint: rgba(2, 132, 199, 0.11);
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #e11d48;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --hud-bg: rgba(15, 23, 42, 0.84);
  --hud-elevated: rgba(30, 41, 59, 0.94);
  --hud-well: rgba(2, 6, 23, 0.56);
  --hud-border: rgba(148, 163, 184, 0.16);
  --hud-border-hi: rgba(56, 189, 248, 0.45);
  --hud-shadow: 0 2px 6px rgba(0, 0, 0, 0.32), 0 12px 28px rgba(0, 0, 0, 0.42);

  --ink-1: #f8fafc;
  --ink-2: #cbd5e1;
  --ink-3: #94a3b8;

  --accent: #0ea5e9;
  --accent-hover: #38bdf8;
  --accent-tint: rgba(14, 165, 233, 0.18);
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #f43f5e;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink-1);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  letter-spacing: normal;
  color: inherit;
}

.field-val, .time-readout, .telemetry, .mini-v, .legend-ticks {
  font-variant-numeric: tabular-nums;
}

.hidden { display: none !important; }

#map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

/* MapLibre native controls */
.maplibregl-ctrl-top-right { top: 348px !important; right: 12px !important; }
.maplibregl-ctrl-bottom-left { bottom: 62px !important; left: 12px !important; }
.maplibregl-ctrl-bottom-right { display: none !important; }
.maplibregl-ctrl-group {
  background: var(--hud-bg) !important;
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--hud-border) !important;
  border-radius: 10px !important;
  box-shadow: var(--hud-shadow) !important;
  overflow: hidden;
}
.maplibregl-ctrl-group button {
  background: transparent !important;
  border-color: var(--hud-border) !important;
}
.maplibregl-ctrl-group button:hover { background: var(--hud-well) !important; }
[data-theme="dark"] .maplibregl-ctrl-icon { filter: invert(0.92) brightness(1.1); }
.maplibregl-ctrl-scale {
  background: var(--hud-bg) !important;
  backdrop-filter: blur(14px);
  border: 1px solid var(--hud-border) !important;
  border-top: none !important;
  border-radius: 0 0 6px 6px;
  color: var(--ink-2) !important;
  font-family: var(--mono) !important;
  font-size: 11px !important;
  padding: 2px 7px !important;
}

/* Frosted HUD surface */
.hud {
  position: fixed;
  z-index: 10;
  background: var(--hud-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--hud-border);
  border-radius: 11px;
  box-shadow: var(--hud-shadow);
}

/* Top Bar */
.topbar {
  top: 12px;
  left: 12px;
  right: 12px;
  height: 44px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
}
.brand-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink-1);
}
.search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 440px;
}
.search-select, .search-input {
  height: 30px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 7px;
  color: var(--ink-1);
  font-size: 12px;
  font-weight: 400;
  padding: 0 9px;
  outline: none;
}
.search-select { width: 254px; flex-shrink: 0; }
.search-input { flex: 1; min-width: 140px; }
.search-input::placeholder { color: var(--ink-3); }
.search-input:focus, .search-select:focus { border-color: var(--hud-border-hi); }

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.seg-group {
  display: inline-flex;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-2);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: 120ms ease;
}
.seg-btn:hover { color: var(--ink-1); }
.seg-btn.active {
  background: var(--hud-elevated);
  color: var(--ink-1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--hud-border);
  background: var(--hud-elevated);
  color: var(--ink-1);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: 120ms ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--hud-border-hi); }
.btn.active {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent);
}
.btn:disabled {
  opacity: 0.42;
  pointer-events: none;
}
.btn-xs {
  padding: 3px 7px;
  font-size: 11px;
}
.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.btn.primary {
  height: 34px;
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 12.5px;
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.compare {
  height: 32px;
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.42);
  color: var(--warn);
  font-weight: 500;
}

/* Left Scenario Drawer */
.drawer {
  top: 66px;
  left: 12px;
  width: 256px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sec-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.upload-link {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}
.upload-link:hover { text-decoration: underline; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}
.tool-btn {
  padding: 6px 6px;
  font-size: 12px;
  text-align: center;
}
.tool-btn[data-tool="inspect"] { grid-column: span 2; }

.divider {
  height: 1px;
  background: var(--hud-border);
  margin: 2px 0;
}

.intervention-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(13, 148, 136, 0.10);
  border: 1px solid rgba(13, 148, 136, 0.28);
  font-size: 12px;
  color: var(--ink-1);
}
.iv-actions { display: flex; gap: 4px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.field-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-2);
}
.field-val {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-1);
}
input[type="range"] {
  width: 100%;
  height: 4px;
  accent-color: var(--accent);
  margin: 2px 0;
  cursor: pointer;
}

.adv-details {
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  background: var(--hud-well);
  padding: 6px 8px;
}
.adv-summary {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.adv-summary::after { content: "▾"; font-size: 11px; color: var(--ink-3); }
.adv-details[open] .adv-summary::after { content: "▴"; }
.adv-body {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ctl-select {
  width: 100%;
  height: 28px;
  background: var(--hud-elevated);
  border: 1px solid var(--hud-border);
  border-radius: 6px;
  color: var(--ink-1);
  font-size: 11.5px;
  padding: 0 6px;
}
.ctl-select-xs {
  width: auto;
  height: 24px;
  font-size: 11px;
  padding: 0 4px;
}
.cta-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.nwp-card {
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nwp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nwp-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
}
.nwp-badge.high { background: rgba(22, 163, 74, 0.14); color: var(--ok); }
.nwp-badge.moderate { background: rgba(217, 119, 6, 0.14); color: var(--warn); }
.nwp-badge.low { background: rgba(225, 29, 72, 0.14); color: var(--danger); }
.nwp-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.nwp-row {
  display: flex;
  justify-content: space-between;
  color: var(--ink-2);
}
.nwp-row strong { font-weight: 500; color: var(--ink-1); }

/* Top-Right Layer Card */
.layer-panel {
  top: 66px;
  right: 12px;
  width: 214px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.layer-toggles { display: flex; gap: 4px; }
.layer-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.legend-bar {
  height: 8px;
  border-radius: 999px;
  border: 1px solid var(--hud-border);
}
.legend-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
}
.legend-note {
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-3);
}

/* Floating Inspector */
.inspector {
  right: 12px;
  bottom: 66px;
  width: 336px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.inspector-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.inspector-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
}
.chart-svg {
  width: 100%;
  height: 124px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 8px;
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.mini-stat {
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 7px;
  padding: 6px 8px;
}
.mini-k {
  font-size: 11px;
  color: var(--ink-3);
}
.mini-v {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
  margin-top: 1px;
}
.mini-v.good { color: #0d9488; }
.mini-v.bad { color: var(--danger); }

/* Bottom-Left Status & Cursor Pill */
.status-pill {
  left: 12px;
  bottom: 14px;
  height: 36px;
  max-width: calc(50vw - 275px);
  padding: 0 9px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
}
.honesty-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--ink-1);
  white-space: nowrap;
}
.honesty-inline .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ok);
}
.honesty-inline.fail .dot { background: var(--danger); }
.pill-sep { color: var(--ink-3); }
.telemetry {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom-Center Compact Playback Capsule */
.timeline {
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  width: 530px;
  height: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.time-readout {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-1);
  min-width: 215px;
  text-align: center;
  white-space: nowrap;
}
.scrubber { flex: 1; }
.scrubber:focus { outline: none; }

/* Adaptive Multi-Day / Interval Forecast Bar */
.forecast-bar {
  right: 12px;
  bottom: 14px;
  width: 620px;
  padding: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
}
.fb-callout-rail {
  position: relative;
  height: 0;
}
.fb-callout {
  position: absolute;
  bottom: 10px;
  left: 0%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #ffffff;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
  pointer-events: none;
}
.fb-callout::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--accent);
}
.fb-track {
  height: 6px;
  background: rgba(15, 23, 42, 0.12);
  border-radius: 10px 10px 0 0;
  overflow: hidden;
}
[data-theme="dark"] .fb-track { background: rgba(255, 255, 255, 0.14); }
.fb-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
}
.fb-segments {
  display: flex;
  width: 100%;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}
.fb-seg {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-2);
  border-right: 1px solid var(--hud-border);
  white-space: nowrap;
}
.fb-seg:last-child { border-right: none; }
.fb-seg.active {
  background: rgba(2, 132, 199, 0.14);
  color: var(--accent);
  font-weight: 600;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-card {
  width: min(640px, 92vw);
  max-height: 78vh;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}
.src-card {
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.src-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-tint);
  color: var(--accent);
}
.src-badge.pub { background: rgba(22, 163, 74, 0.14); color: var(--ok); }

.btn.recording {
  background: rgba(225, 29, 72, 0.16);
  border-color: var(--danger);
  color: var(--danger);
}
.director-caption {
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-1);
  pointer-events: none;
  max-width: 520px;
  text-align: center;
}
.left-stack {
  position: fixed;
  top: 66px;
  left: 12px;
  width: 288px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 20;
  pointer-events: none;
}
[data-presentation="true"] .left-stack {
  top: 14px;
}
[data-profile="public"] #drawer,
[data-profile="public"] #btn-export-asc,
[data-profile="public"] #btn-export-csv,
[data-profile="public"] [data-layer="diff"] {
  display: none !important;
}
[data-profile="researcher"]:not([data-presentation="true"]) .public-outlook {
  display: none !important;
}
body.has-forecast-bar .status-pill {
  max-width: calc(100vw - 656px);
}
body.has-forecast-bar .inspector {
  bottom: 94px;
}
.coord-well {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
}
.nwp-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sim-progress {
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-1);
  z-index: 35;
}
.sim-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--hud-border);
  border-top-color: var(--accent);
  animation: arus-spin 0.75s linear infinite;
}
@keyframes arus-spin {
  to { transform: rotate(360deg); }
}
.toast-bar {
  bottom: 66px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-1);
  z-index: 45;
  max-width: min(460px, calc(100vw - 24px));
}
.site-verdict {
  right: 12px;
  bottom: 66px;
  width: 320px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 25;
}
.sv-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sv-summary {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-2);
}
.sv-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--hud-border);
}
.sv-ffe {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-2);
}
.sv-ffe .ctl-select {
  width: auto;
  padding: 3px 6px;
  font-size: 11px;
}
.fb-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
}
.fb-main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fb-track {
  cursor: pointer;
}
.fb-seg {
  cursor: pointer;
}
[data-presentation="true"] #fb-play {
  display: none !important;
}
.po-spot.clickable {
  cursor: pointer;
  border-radius: 5px;
  padding: 2px 4px;
  margin: 0 -4px;
  pointer-events: auto;
}
.po-spot.clickable:hover {
  background: var(--hud-well);
}
.public-outlook {
  pointer-events: auto;
}
body.picking-site #map {
  cursor: crosshair !important;
}
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Responsive layouts for tablets & phones */
@media (max-width: 1120px) {
  .topbar {
    height: auto;
    min-height: 44px;
    flex-wrap: wrap;
    padding: 6px 10px;
    gap: 6px;
  }
  .search-select { width: 190px; }
  .search-input { width: 130px; min-width: 110px; }
  .status-pill { max-width: calc(50vw - 220px); }
  .timeline { width: min(460px, calc(100vw - 24px)); }
  .forecast-bar { width: min(540px, calc(100vw - 24px)); }
}
@media (max-width: 768px) {
  .topbar {
    top: 8px;
    left: 8px;
    right: 8px;
  }
  .top-left {
    width: 100%;
  }
  .search-wrap {
    flex: 1;
    min-width: 0;
  }
  .search-select { width: 46%; min-width: 110px; }
  .search-input { flex: 1; width: auto; min-width: 90px; }
  .top-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .left-stack {
    top: auto;
    bottom: 66px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 36vh;
    overflow-y: auto;
    pointer-events: auto;
  }
  .layer-panel {
    display: none;
  }
  .maplibregl-ctrl-top-right {
    top: 108px !important;
    right: 8px !important;
  }
  .status-pill {
    display: none;
  }
  .timeline,
  .forecast-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    transform: none;
  }
  .time-readout {
    min-width: 96px;
    font-size: 11px;
  }
  .inspector,
  .site-verdict {
    left: 8px;
    right: 8px;
    bottom: 62px;
    width: auto;
  }
  .drawer {
    top: 106px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 45vh;
  }
  .btn,
  .seg-btn {
    min-height: 36px;
  }
}
.modal-wide {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-tabs {
  display: flex;
  gap: 4px;
  background: var(--hud-well);
  padding: 4px;
  border-radius: 9px;
  border: 1px solid var(--hud-border);
}
.modal-tabs .seg-btn {
  flex: 1;
  text-align: center;
}
.modal-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 640px) {
  .modal-grid-2 { grid-template-columns: 1fr; }
}
.modal-sec {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-1);
  cursor: pointer;
}
.toggle-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}
.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--hud-border);
}
.modal-foot-right {
  display: flex;
  gap: 8px;
}
.context-box {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-2);
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mjo-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(2, 132, 199, 0.14);
  color: var(--accent);
}
.stale-warn {
  color: var(--warn);
  font-weight: 600;
}
.engine-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-2);
}
.left-stack > .hud {
  position: static;
  width: 100%;
  box-sizing: border-box;
}
.public-outlook {
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}
.po-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.po-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-1);
}
.po-risk {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.po-risk.low { background: rgba(22, 163, 74, 0.16); color: var(--ok); }
.po-risk.moderate { background: rgba(217, 119, 6, 0.18); color: var(--warn); }
.po-risk.high { background: rgba(225, 29, 72, 0.18); color: var(--danger); }
.po-summary {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-2);
}
.po-hotspots {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 4px;
  border-top: 1px solid var(--hud-border);
}
.po-spot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 11.5px;
}
.po-spot-name { color: var(--ink-1); font-weight: 500; }
.po-spot-val { color: var(--ink-2); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.po-spot-val.warn { color: var(--warn); font-weight: 500; }
.po-spot-val.danger { color: var(--danger); font-weight: 500; }
.po-foot {
  font-size: 10.5px;
  color: var(--ink-3);
  padding-top: 4px;
  border-top: 1px solid var(--hud-border);
}
.legend-river {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--hud-border);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
}
.river-swatch {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: #059669;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}

/* Live Per-Frame Area Flood Gauge (aligned in .left-stack below Public Outlook card) */
.live-metrics {
  padding: 10px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: auto;
}
[data-profile="researcher"] .left-stack {
  top: auto;
  bottom: 102px;
}
.lm-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.lm-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-1);
}
.lm-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lm-trend {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.lm-trend.rising { color: var(--danger); }
.lm-trend.receding { color: var(--ok); }
.lm-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.lm-badge.low { background: rgba(22, 163, 74, 0.16); color: var(--ok); }
.lm-badge.moderate { background: rgba(234, 179, 8, 0.20); color: #a16207; }
.lm-badge.high { background: rgba(234, 88, 12, 0.18); color: #c2410c; }
.lm-badge.danger { background: rgba(225, 29, 72, 0.18); color: var(--danger); }
[data-theme="dark"] .lm-badge.moderate { color: #facc15; }
[data-theme="dark"] .lm-badge.high { color: #fb923c; }
.lm-bar-wrap {
  position: relative;
  height: 10px;
  display: flex;
  align-items: center;
}
.lm-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #16a34a 0%, #eab308 35%, #f97316 68%, #e11d48 100%);
}
.lm-marker {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid #0f172a;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
}
.lm-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ink-3);
  margin-top: -3px;
}
.lm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.lm-cell {
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 7px;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.lm-k { font-size: 10px; color: var(--ink-3); }
.lm-v { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--ink-1); }
/* Clean broadcast / recording presentation mode (hides editor chrome, keeps key viewer info) */
[data-presentation="true"] .topbar,
[data-presentation="true"] .drawer,
[data-presentation="true"] .maplibregl-ctrl-top-right,
[data-presentation="true"] .layer-panel .sec-head,
[data-presentation="true"] .layer-panel .layer-tabs,
[data-presentation="true"] #btn-play,
[data-presentation="true"] #btn-speed,
[data-presentation="true"] #btn-inspector-close {
  display: none !important;
}
[data-presentation="true"] .status-pill {
  left: 12px;
  bottom: 14px;
  max-width: 560px;
}
[data-presentation="true"] .timeline {
  left: auto;
  right: 12px;
  transform: none;
  width: 440px;
}
[data-presentation="true"] .director-caption {
  top: 14px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 18px;
  max-width: 720px;
}
[data-presentation="true"] .layer-panel {
  top: 14px;
  width: 196px;
}
[data-presentation="true"] .timeline {
  width: 470px;
}
.spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -1px;
  margin-right: 5px;
}
@keyframes spin { to { transform: rotate(360deg); } }
