:root {
  --bg: #07080b;
  --bg-elev: #10131a;
  --bg-card: #141821;
  --line: rgba(232, 228, 214, 0.08);
  --line-strong: rgba(232, 228, 214, 0.16);
  --ink: #ece8dc;
  --muted: #9a9484;
  --dim: #6d685c;
  --accent: #e8c37a;
  --accent-2: #c9a35a;
  --danger: #d45a4a;
  --danger-soft: rgba(212, 90, 74, 0.14);
  --ok: #7dba8a;
  --ok-soft: rgba(125, 186, 138, 0.12);
  --info: #7aa3c9;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(212, 90, 74, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(232, 195, 122, 0.07), transparent 50%),
    linear-gradient(180deg, #0b0d12 0%, #07080b 40%);
  z-index: -1;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(16px);
  background: rgba(7, 8, 11, 0.72);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: conic-gradient(from 200deg, #d45a4a, #e8c37a, #7aa3c9, #d45a4a);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 6px; border-radius: 4px; background: #07080b;
}
.brand strong { font-weight: 600; letter-spacing: 0.04em; font-size: 14px; }
.brand span { color: var(--muted); font-size: 12px; margin-left: 6px; font-family: var(--mono); }
.nav-links { display: flex; gap: 18px; font-size: 13px; color: var(--muted); }
.nav-links a { color: var(--muted); text-decoration: none; }
.nav-links a:hover { color: var(--ink); }
.live-actions { display: flex; align-items: center; gap: 10px; }
.refresh {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink);
  background: transparent; border: 1px solid var(--line-strong);
  padding: 6px 10px; border-radius: 999px; cursor: pointer;
}
.refresh:hover { border-color: var(--accent); color: var(--accent); }
.live-pill {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--line-strong); padding: 6px 10px; border-radius: 999px;
}
.live-pill.ok { color: #b6d8bc; border-color: rgba(125,186,138,.35); }
.live-pill.warn { color: var(--accent); }
.live-pill.pending { color: var(--info); }
.live-banner {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: rgba(20,24,33,.7);
  color: var(--muted); font-size: 13px; margin: 8px 0 28px;
}
.live-banner strong { color: var(--ink); font-weight: 560; }
.dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--danger);
  box-shadow: 0 0 0 0 rgba(212, 90, 74, 0.7);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(212, 90, 74, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(212, 90, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(212, 90, 74, 0); }
}

/* HERO */
.hero { padding: 56px 0 28px; }
.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent-2); margin-bottom: 14px;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(36px, 6vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  max-width: 16ch;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.lede {
  max-width: 62ch; margin-top: 18px; color: var(--muted); font-size: 17px;
}
.meta-row {
  display: flex; flex-wrap: wrap; gap: 18px; margin-top: 22px;
  color: var(--dim); font-size: 13px; font-family: var(--mono);
}

/* STATS */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 36px 0 8px;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  min-height: 118px;
}
.stat .label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--dim);
}
.stat .num {
  font-family: var(--serif);
  font-size: clamp(28px, 3.4vw, 42px);
  letter-spacing: -0.03em;
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}
.stat .sub { margin-top: 4px; color: var(--muted); font-size: 12px; }
.stat.danger .num { color: #f0b0a6; }
.stat.ok .num { color: #b6d8bc; }
.stat.gold .num { color: var(--accent); }

.note {
  color: var(--dim); font-size: 12px; margin: 14px 0 40px; max-width: 90ch;
}

/* GRID SECTIONS */
section { padding: 18px 0 42px; }
.sec-head {
  display: flex; justify-content: space-between; align-items: end; gap: 20px;
  margin-bottom: 18px;
}
.sec-head h2 {
  font-family: var(--serif); font-weight: 500; font-size: 28px; letter-spacing: -0.02em;
}
.sec-head p { color: var(--muted); font-size: 14px; max-width: 48ch; }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.split { display: grid; grid-template-columns: 1.35fr 0.85fr; gap: 12px; }
#map { height: 520px; background: #0c1016; }
.map-legend {
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 12px; color: var(--muted);
}
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

.prov-list { display: flex; flex-direction: column; }
.prov {
  display: grid; grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.prov:last-child { border-bottom: 0; }
.prov:hover { background: rgba(255,255,255,0.02); }
.prov.active { background: rgba(232, 195, 122, 0.06); }
.prov .name { font-weight: 560; }
.prov .meta { color: var(--dim); font-size: 12px; font-family: var(--mono); }
.prov .vals { text-align: right; }
.prov .vals b { font-variant-numeric: tabular-nums; }
.bar {
  grid-column: 1 / -1;
  height: 3px; background: rgba(255,255,255,0.06); border-radius: 99px; overflow: hidden;
}
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

table.data {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
table.data th {
  text-align: left; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim);
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-weight: 500;
}
table.data td {
  padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top;
}
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 13px; }
.badge {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 999px; border: 1px solid var(--line-strong);
}
.badge.active { color: #f0b0a6; border-color: rgba(212,90,74,.35); background: var(--danger-soft); }
.badge.ended { color: var(--ok); border-color: rgba(125,186,138,.3); background: var(--ok-soft); }
.badge.imported { color: var(--info); }

.charts { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 12px; }
.chart-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 16px 0; flex-wrap: wrap;
}
.chart-head h3 {
  font-size: 13px; font-family: var(--mono); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--dim); margin: 0;
}
.chips { display: flex; gap: 8px; }
.chip {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  background: transparent; border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 5px 10px; cursor: pointer;
}
.chip.on { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.chart-box { padding: 18px 16px 10px; height: 360px; }
.dock {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(120%);
  display: flex; align-items: center; gap: 16px;
  background: rgba(16,19,26,.92); border: 1px solid var(--line-strong);
  backdrop-filter: blur(16px); border-radius: 999px;
  padding: 10px 12px 10px 18px; z-index: 50;
  box-shadow: var(--shadow); transition: transform .25s ease;
  font-family: var(--mono); font-size: 12px; color: var(--ink); white-space: nowrap;
}
.dock.show { transform: translateX(-50%) translateY(0); }
.chart-box h3, .compare h3 {
  font-size: 13px; font-family: var(--mono); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--dim); margin: 0 16px 8px;
}

.compare { padding: 8px 0 4px; }
.hist {
  display: grid; grid-template-columns: 88px 1fr 90px;
  gap: 8px; align-items: center;
  padding: 10px 16px;
}
.hist .year { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.hist .barwrap { height: 8px; background: rgba(255,255,255,0.06); border-radius: 99px; overflow: hidden; }
.hist .barwrap i { display: block; height: 100%; background: #8a7a5a; }
.hist.active .barwrap i { background: var(--danger); }
.hist .count { font-family: var(--mono); font-size: 12px; text-align: right; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card { padding: 22px; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); }
.card h3 { font-family: var(--serif); font-size: 20px; font-weight: 500; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 14px; }
.card ul { margin: 10px 0 0 18px; color: var(--muted); font-size: 14px; }

.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: var(--line-strong);
}
.t-item { position: relative; padding: 0 0 22px 22px; }
.t-item::before {
  content: ""; position: absolute; left: -16px; top: 7px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(232,195,122,0.12);
}
.t-item .when { font-family: var(--mono); font-size: 11px; color: var(--accent-2); letter-spacing: 0.08em; text-transform: uppercase; }
.t-item h3 { font-size: 16px; margin: 4px 0 4px; }
.t-item p { color: var(--muted); font-size: 14px; }

.sources { color: var(--muted); font-size: 13px; }
.sources li { margin: 6px 0; }

footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 48px;
  color: var(--dim); font-size: 12px;
}
.foot { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

.leaflet-container { background: #0c1016; font-family: var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #161b24; color: var(--ink); }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-control-zoom a { background: #161b24 !important; color: var(--ink) !important; border-color: var(--line) !important; }

@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .split, .charts, .cards { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  #map { height: 380px; }
}
@media (max-width: 560px) {
  .wrap { width: min(1180px, calc(100% - 24px)); }
  .stats { grid-template-columns: 1fr 1fr; }
}
