:root {
  --ink: #12202b;
  --muted: #5b6b75;
  --line: #d4dde3;
  --paper: #f6f3ec;
  --panel: #fffdf8;
  --accent: #0f6e62;
  --eb: #c2410c;
  --wb: #1d4e89;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--paper);
  font: 15px/1.45 "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

a { color: var(--accent); }

.top {
  padding: 0.7rem 1rem 0.55rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
}

.brand a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
}

.brand strong {
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.lede {
  margin: 0.35rem 0 0;
  max-width: 46rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin: 0.9rem 0 1rem;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.kpi b {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.range {
  margin: 0 0 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem 1.05rem;
}

.range-names {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
}

.range-bar {
  position: relative;
  height: 28px;
  touch-action: none;
}

.range-bar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 4px;
  background: #e4eaee;
  border-radius: 99px;
}

.range-fill {
  position: absolute;
  top: 12px;
  height: 4px;
  background: var(--ink);
  border-radius: 99px;
}

.range-thumb {
  position: absolute;
  top: 3px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  padding: 0;
  border: 2px solid var(--ink);
  background: #fff;
  border-radius: 50%;
  cursor: grab;
  z-index: 1;
  touch-action: none;
}

.range-thumb:active { cursor: grabbing; }

.range-thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toggles {
  display: flex;
  gap: 0.4rem;
  margin: 0 0 0.8rem;
}

.toggles button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.toggles button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.chart {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.7rem 0.3rem;
}

.chart svg { width: 100%; height: auto; display: block; overflow: visible; }

.legend {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin: 0.55rem 0 1.1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.legend i {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: -1px;
}

.histnote {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.88rem;
}

#histChart { margin-bottom: 1.2rem; }

.corridor-map {
  height: 520px;
  margin: 0 0 1.2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #e8eef1;
}

.leaflet-container { font-family: inherit; }

.cam-marker {
  background: none;
  border: none;
}

.cam-icon {
  width: 10px;
  height: 10px;
  margin: 3px;
  background: #fff;
  border: 2px solid #12202b;
  box-shadow: 0 1px 2px rgba(18, 32, 43, 0.35);
  transform: rotate(45deg);
}

.cam-icon.off { opacity: 0.28; }

.leaflet-popup-content {
  font-size: 0.88rem;
  line-height: 1.4;
}

.leaflet-popup-content a { font-weight: 650; }

.tablewrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  padding: 0.5rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th { color: var(--muted); font-weight: 650; }

.mph { font-variant-numeric: tabular-nums; font-weight: 650; }

tr.off { opacity: 0.35; }

.source {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi b { font-size: 1.3rem; }
}
