:root {
  --oef-bg: #050b10;
  --oef-surface: #091219;
  --oef-panel: #0d1820;
  --oef-panel-strong: #11212b;
  --oef-line: #203640;
  --oef-line-strong: #31505d;
  --oef-accent: #00bfd6;
  --oef-accent-soft: #8bd8e2;
  --oef-warn: #f4b740;
  --oef-danger: #ed5c5c;
  --oef-purple: #b07cff;
  --oef-text: #e8f0f3;
  --oef-muted: #8aa0aa;
  --oef-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --oef-sans: Archivo, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  background: var(--oef-bg);
  color: var(--oef-text);
  font-family: var(--oef-sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--oef-accent-soft); }
a:hover { color: var(--oef-text); }
:focus-visible { outline: 2px solid var(--oef-accent); outline-offset: 3px; }

.skip-link {
  position: fixed;
  z-index: 10000;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  background: var(--oef-text);
  color: var(--oef-bg);
  padding: 9px 12px;
  font-weight: 800;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

.oef-topbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--oef-line);
  background: #03080c;
  color: var(--oef-muted);
  font: 600 11px/1.35 var(--oef-mono);
  letter-spacing: .035em;
  text-transform: uppercase;
}
.topbar-brand, .topbar-links { display: flex; align-items: center; gap: 10px; }
.topbar-links { justify-content: flex-end; }
.topbar-links a { text-decoration: none; }
.status-dot { width: 7px; height: 7px; background: var(--oef-warn); border-radius: 50%; }
.topbar-separator { color: var(--oef-line-strong); }

.dashboard {
  min-height: calc(100vh - 42px);
  display: grid;
  grid-template-columns: minmax(270px, 310px) minmax(520px, 1fr) minmax(290px, 340px);
  grid-template-areas: "context map insights";
  background: var(--oef-line);
  gap: 1px;
}
.panel { min-width: 0; background: var(--oef-surface); }
.panel-context { grid-area: context; padding: 24px; }
.panel-map { grid-area: map; position: relative; min-height: 620px; overflow: hidden; background: #020609; }
.panel-insights { grid-area: insights; padding: 22px; }

@media (min-width: 1181px) {
  .dashboard {
    height: calc(100vh - 42px);
    min-height: 660px;
  }
  .panel { min-height: 0; overflow-y: auto; }
  .panel-map { overflow: hidden; }
  #oef-map { min-height: 0; }
}

.product-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.product-lockup img { width: 42px; height: 42px; }
.eyebrow {
  margin: 0 0 5px;
  color: var(--oef-accent-soft);
  font: 700 10px/1.2 var(--oef-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: clamp(24px, 3vw, 34px); line-height: 1; letter-spacing: -.035em; }
.lede { margin: 0 0 18px; color: #b9c7cd; font-size: 14px; line-height: 1.55; }

.state-card, .method-card, .notice {
  border: 1px solid var(--oef-line);
  background: var(--oef-panel);
  padding: 13px;
}
.state-card { margin-bottom: 15px; }
.state-chip {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--oef-line-strong);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--oef-muted);
  font: 700 10px/1.2 var(--oef-mono);
  letter-spacing: .045em;
  text-transform: uppercase;
}
.state-chip[data-state="ok"] { color: var(--oef-accent-soft); border-color: #28616a; background: #0c2027; }
.state-chip[data-state="warning"] { color: var(--oef-warn); border-color: #665329; background: #241d0e; }
.state-chip[data-state="error"] { color: #ffaaaa; border-color: #6d3434; background: #261111; }
.state-chip[data-state="loading"] { color: #cad5d9; }
.state-meta, .microcopy { margin: 8px 0 0; color: var(--oef-muted); font: 10px/1.45 var(--oef-mono); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0 0 15px; background: var(--oef-line); border: 1px solid var(--oef-line); }
.stat { min-width: 0; background: var(--oef-surface); padding: 13px; }
.stat dt { margin: 0 0 7px; color: var(--oef-muted); font: 700 9px/1.3 var(--oef-mono); letter-spacing: .06em; text-transform: uppercase; }
.stat dd { margin: 0; font: 700 clamp(18px, 2vw, 25px)/1 var(--oef-mono); }
.stat-wide { grid-column: 1 / -1; }
.stat-wide dd { font-size: 14px; color: var(--oef-accent-soft); }
.stat small { display: block; margin-top: 5px; color: var(--oef-muted); font: 9px/1.3 var(--oef-mono); }

.control-group { margin-top: 19px; }
.control-title, .section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 11px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--oef-line);
  color: var(--oef-text);
  font: 700 11px/1.3 var(--oef-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.select-label { display: grid; gap: 7px; margin-bottom: 13px; color: var(--oef-muted); font: 600 11px/1.3 var(--oef-mono); }
.select-label select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--oef-line-strong);
  border-radius: 2px;
  background: var(--oef-bg);
  color: var(--oef-text);
  padding: 8px 10px;
  font-family: var(--oef-mono);
}
.select-label select:disabled { opacity: .55; cursor: wait; }
.toggles { display: grid; gap: 2px; }
.toggle-row { min-height: 38px; display: flex; align-items: center; gap: 10px; padding: 7px 8px; background: var(--oef-panel); color: #c9d5d9; font: 11px/1.35 var(--oef-mono); cursor: pointer; }
.toggle-row:hover { background: var(--oef-panel-strong); }
.toggle-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--oef-accent); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 14px; }
.button {
  min-height: 42px;
  border: 1px solid var(--oef-line-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--oef-text);
  padding: 8px 10px;
  font: 700 10px/1.35 var(--oef-mono);
  letter-spacing: .035em;
  text-transform: uppercase;
  cursor: pointer;
}
.button:hover { border-color: var(--oef-accent); color: var(--oef-accent-soft); background: #0b1b22; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-primary { grid-column: 1 / -1; border-color: #28616a; color: var(--oef-accent-soft); background: #0b1b22; }
.button[aria-pressed="true"] { border-color: var(--oef-warn); color: var(--oef-warn); }

.method-card { margin-top: 17px; }
.method-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.method-card h2 { margin: 0; font-size: 12px; }
.method-card p { margin: 0; color: #adbec5; font-size: 11px; line-height: 1.5; }
.method-card a { display: inline-block; margin-top: 9px; font: 10px var(--oef-mono); }

#oef-map { width: 100%; height: 100%; min-height: 620px; background: #020609; }
.map-hud { position: absolute; z-index: 700; top: 16px; left: 16px; right: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; pointer-events: none; }
.map-title, .map-legend { border: 1px solid var(--oef-line-strong); background: var(--oef-bg); }
.map-title { max-width: 450px; padding: 11px 13px; }
.map-title h2 { margin: 0 0 4px; font-size: 14px; letter-spacing: -.01em; }
.map-title p { margin: 0; color: var(--oef-accent-soft); font: 10px/1.4 var(--oef-mono); }
.map-legend { position: absolute; z-index: 700; left: 16px; bottom: 24px; width: min(235px, calc(100% - 90px)); padding: 10px 12px; pointer-events: none; }
.legend-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: var(--oef-muted); font: 700 9px var(--oef-mono); text-transform: uppercase; }
.legend-bar { height: 7px; background: linear-gradient(90deg, #145467, var(--oef-accent), var(--oef-warn), var(--oef-danger)); }
.legend-scale { display: flex; justify-content: space-between; margin-top: 5px; color: var(--oef-muted); font: 9px var(--oef-mono); }
.map-disclaimer { position: absolute; z-index: 700; top: 84px; left: 16px; max-width: 340px; margin: 0; color: #c8d4d8; background: var(--oef-bg); border-left: 2px solid var(--oef-warn); padding: 7px 9px; font: 9px/1.45 var(--oef-mono); pointer-events: none; }

.leaflet-container { font-family: var(--oef-sans) !important; }
.leaflet-control-zoom a { background: var(--oef-panel) !important; color: var(--oef-text) !important; border-color: var(--oef-line-strong) !important; }
.leaflet-control-zoom a:hover { background: var(--oef-panel-strong) !important; color: var(--oef-accent-soft) !important; }
.leaflet-control-attribution { background: rgba(5, 11, 16, .9) !important; color: var(--oef-muted) !important; font-size: 9px !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--oef-panel-strong); color: var(--oef-text); border-radius: 2px; }
.leaflet-popup-content-wrapper { border: 1px solid var(--oef-line-strong); }
.map-popup { min-width: 185px; display: grid; gap: 5px; }
.map-popup__title { color: var(--oef-accent-soft); font-size: 13px; }
.map-popup__line { color: #bdcbd0; font: 10px/1.4 var(--oef-mono); }
.oef-grid-canvas { position: absolute; pointer-events: none; }

.insight-section { margin-bottom: 26px; }
.section-kicker { color: var(--oef-muted); font: 9px var(--oef-mono); letter-spacing: .03em; text-transform: none; }
.section-note { margin: -3px 0 10px; color: var(--oef-muted); font-size: 10px; line-height: 1.45; }
.zone-list { display: grid; gap: 9px; }
.zone-row { display: grid; grid-template-columns: 84px 1fr 28px; align-items: center; gap: 8px; min-height: 24px; }
.zone-name { color: #cbd7db; font-size: 11px; }
.zone-track { height: 6px; background: #132630; overflow: hidden; }
.zone-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--oef-accent), var(--oef-warn)); }
.zone-score { color: var(--oef-accent-soft); text-align: right; font: 10px var(--oef-mono); }
.list { display: grid; gap: 1px; max-height: 330px; overflow: auto; background: var(--oef-line); border: 1px solid var(--oef-line); }
.city-row, .event-row { width: 100%; min-height: 43px; border: 0; background: var(--oef-surface); color: var(--oef-text); padding: 8px 10px; cursor: pointer; text-align: left; }
.city-row:hover, .event-row:hover { background: var(--oef-panel-strong); }
.city-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.city-name { font-size: 11px; font-weight: 650; }
.city-chance { color: var(--oef-warn); font: 700 11px var(--oef-mono); white-space: nowrap; }
.event-row { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 9px; }
.event-mag { color: var(--oef-warn); font: 800 12px var(--oef-mono); }
.event-detail { min-width: 0; display: grid; gap: 3px; }
.event-place { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.event-time { color: var(--oef-muted); font: 9px var(--oef-mono); }
.source-meta { margin: 8px 0 0; color: var(--oef-muted); font: 9px/1.4 var(--oef-mono); }

.notice { margin-top: 12px; border-left: 3px solid var(--oef-danger); color: #ffc0c0; font-size: 11px; line-height: 1.5; }
.notice[hidden] { display: none; }
.official-links { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--oef-line); font: 10px var(--oef-mono); }

.chart-dialog { width: min(900px, calc(100% - 28px)); max-height: calc(100vh - 28px); border: 1px solid var(--oef-line-strong); border-radius: 3px; background: var(--oef-surface); color: var(--oef-text); padding: 0; }
.chart-dialog::backdrop { background: rgba(0, 0, 0, .82); }
.dialog-inner { padding: 22px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.dialog-head h2 { margin: 0 0 5px; font-size: 20px; }
.dialog-head p { margin: 0; color: var(--oef-muted); font-size: 11px; line-height: 1.5; }
.icon-button { min-width: 42px; min-height: 42px; border: 1px solid var(--oef-line-strong); background: transparent; color: var(--oef-text); cursor: pointer; }
.icon-button:hover { border-color: var(--oef-accent); color: var(--oef-accent-soft); }
.chart { width: 100%; overflow-x: auto; background: var(--oef-bg); border: 1px solid var(--oef-line); }
.chart svg { display: block; width: 100%; min-width: 620px; height: auto; }
.chart-grid { stroke: #1a3039; stroke-width: 1; }
.chart-axis { stroke: #5b747e; stroke-width: 1; }
.chart-line { fill: none; stroke: var(--oef-accent); stroke-width: 3; }
.chart-point { fill: var(--oef-warn); stroke: var(--oef-bg); stroke-width: 2; }
.chart-label { fill: var(--oef-muted); font: 10px var(--oef-mono); }
.chart-axis-title { fill: #b8c6cb; font: 11px var(--oef-mono); }

@media (max-width: 1180px) {
  .dashboard {
    min-height: 0;
    grid-template-columns: minmax(270px, 320px) minmax(0, 1fr);
    grid-template-areas: "context map" "insights insights";
  }
  .panel-map, #oef-map { height: 720px; min-height: 0; }
  .panel-insights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
  .insight-section { margin: 0; }
  .official-links, .notice { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .oef-topbar { align-items: flex-start; flex-direction: column; gap: 7px; padding: 10px 13px; }
  .topbar-links { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .topbar-disclaimer { text-transform: none; }
  .dashboard { grid-template-columns: 1fr; grid-template-areas: "context" "map" "insights"; }
  .panel-context, .panel-insights { padding: 18px; }
  .panel-map, #oef-map { min-height: 62vh; height: 62vh; }
  .panel-insights { display: block; }
  .insight-section { margin-bottom: 24px; }
  .map-hud { top: 10px; left: 10px; right: 10px; }
  .map-title { padding: 8px 10px; }
  .map-title h2 { font-size: 12px; }
  .map-disclaimer { top: 70px; left: 10px; right: 10px; max-width: none; }
  .map-legend { left: 10px; bottom: 22px; }
  .dialog-inner { padding: 15px; }
  .dialog-head { gap: 10px; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
  .stat-wide { grid-column: auto; }
  .actions { grid-template-columns: 1fr; }
  .button-primary { grid-column: auto; }
  .product-lockup { align-items: flex-start; }
  .map-disclaimer { display: none; }
  .map-legend { width: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  body { background: #fff; color: #000; }
  .oef-topbar, .control-group, .official-links, .map-disclaimer, .map-legend, .leaflet-control-container, .chart-dialog { display: none !important; }
  .dashboard { display: block; background: #fff; }
  .panel { background: #fff; color: #000; padding: 14px; }
  .panel-map, #oef-map { height: 430px; min-height: 430px; border: 1px solid #333; }
  .state-card, .method-card, .stat, .notice { background: #fff; color: #000; border-color: #bbb; }
  .lede, .method-card p, .state-meta, .microcopy, .section-note, .source-meta { color: #444; }
  .panel-insights { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .city-row, .event-row { background: #fff; color: #000; border-bottom: 1px solid #ddd; }
  a { color: #000; }
}
