:root {
  --bg: #020618;
  --panel: #070c1e;
  --panel-2: #0b1329;
  --line: #1e293b;
  --line-soft: #131d31;
  --text: #cbd5e1;
  --heading: #f8fafc;
  --muted: #94a3b8;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Status fills — one hue per status, tuned for contrast on slate-950 */
  --live: #34d399;
  --live-uc: #4ade80;
  --uc: #fb923c;
  --planned: #60a5fa;
  --suspended: #f87171;
  --grid: #a78bfa;
  --contrast: #e2e8f0;
  /* EU-operator rings */
  --eu-yes: #facc15;
  --eu-mixed: #cbd5e1;
  --eu-no: #f87171;
  --accent: #22d3ee;
  --kicker: #7dd3fc;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.5 var(--sans);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  grid-template-rows: auto 1fr;
  height: 100%;
  background: var(--bg);
}

header {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
header h1 {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--heading);
}
header .as-of {
  color: var(--muted);
  font-size: 0.72rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

aside {
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 0.9rem 1rem 1.4rem;
}

.thesis {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 0.85rem;
}
.caveat {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.stat {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 0.5rem;
  padding: 0.5rem 0.6rem;
}
.stat b {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}
.stat span {
  color: var(--muted);
  font-size: 0.72rem;
}

fieldset {
  border: 1px solid var(--line-soft);
  border-radius: 0.5rem;
  margin: 0 0 0.7rem;
  padding: 0.45rem 0.55rem 0.55rem;
  font-size: 0.78rem;
}
legend {
  color: var(--kicker);
  padding: 0 0.3rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
label { display: flex; align-items: center; gap: 0.4rem; margin: 0.18rem 0; cursor: pointer; color: var(--text); }
label:hover { color: var(--heading); }
input[type="checkbox"] { accent-color: var(--accent); }
.swatch {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
  border: 1px solid #0006;
}
.swatch.ring { background: transparent; border-width: 2px; border-radius: 50%; }

.views { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.8rem; }
.views button, .clear {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
}
.views button:hover, .clear:hover { border-color: var(--accent); color: var(--heading); }
.views button.is-active {
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.12);
  color: var(--heading);
}

.slider-hint {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}
.mw-range-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--kicker);
  margin-bottom: 0.15rem;
  font-variant-numeric: tabular-nums;
}
.mw-slider {
  position: relative;
  height: 28px;
  margin: 0.15rem 0 0.2rem;
}
.mw-slider-rail,
.mw-slider-fill {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 4px;
  border-radius: 2px;
  pointer-events: none;
}
.mw-slider-rail { background: var(--line); }
.mw-slider-fill { background: var(--accent); right: auto; }
.mw-slider input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  background: none;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}
.mw-slider input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto;
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--heading);
  border: 2px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 1px #0008;
}
.mw-slider input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--heading);
  border: 2px solid var(--accent);
  cursor: pointer;
}
.gpu-live {
  margin: 0.4rem 0 0;
  color: var(--kicker);
  font-size: 0.72rem;
  line-height: 1.35;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.gpu-table-wrap { overflow-x: auto; }
.gpu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}
.gpu-table th, .gpu-table td {
  padding: 0.22rem 0.18rem;
  text-align: right;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  color: var(--text);
}
.gpu-table th:first-child, .gpu-table td:first-child { text-align: left; }
.gpu-table thead th {
  color: var(--kicker);
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.gpu-table tbody tr.is-active td {
  color: var(--accent);
  background: rgba(34, 211, 238, 0.1);
}

.search {
  width: 100%;
  margin-bottom: 0.55rem;
  background: var(--bg);
  color: var(--heading);
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  padding: 0.4rem 0.5rem;
  font: 0.8rem var(--sans);
}
.search::placeholder { color: var(--muted); }
.search:focus { outline: none; border-color: var(--accent); }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  padding: 0.45rem 0;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text);
}
.list li:hover { color: var(--accent); }
.list .name { display: block; font-weight: 600; font-size: 0.82rem; color: var(--heading); }
.list .meta { color: var(--muted); font-variant-numeric: tabular-nums; }

#map { min-height: 0; background: var(--bg); }

.popup {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--text);
  max-width: 280px;
}
.popup h3 { margin: 0 0 0.3rem; font-size: 0.95rem; color: var(--heading); }
.popup dl { margin: 0; display: grid; grid-template-columns: 7.2rem 1fr; gap: 0.15rem 0.4rem; }
.popup dt { color: var(--muted); }
.popup dd { margin: 0; font-variant-numeric: tabular-nums; }
.popup .notes { margin-top: 0.45rem; color: var(--muted); }

.maplibregl-popup-content {
  padding: 0.7rem 0.8rem;
  background: var(--panel-2) !important;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
}
.maplibregl-popup-tip { border-top-color: var(--panel-2) !important; border-bottom-color: var(--panel-2) !important; }
.maplibregl-popup-close-button { color: var(--muted); }
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-group { background: var(--panel-2) !important; box-shadow: 0 4px 12px rgb(0 0 0 / 0.4) !important; }
.maplibregl-ctrl-group button { background: transparent !important; }
.maplibregl-ctrl-group button span { filter: invert(0.8); }

.legend-inline { display: flex; gap: 0.7rem; flex-wrap: wrap; margin: 0.3rem 0 0.7rem; font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-inline i { font-style: normal; }

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

@media (max-width: 820px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; grid-template-rows: auto minmax(42vh, 52vh) auto; height: auto; min-height: 100%; }
  header { grid-column: 1; flex-wrap: wrap; }
  #map { grid-row: 2; min-height: 42vh; }
  aside { grid-row: 3; border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
}
