/* Schriften selbst gehostet (@fontsource, SIL Open Font License) – keine Verbindung zu Google Fonts */
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(vendor/fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(vendor/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-display: swap; src: url(vendor/fonts/ibm-plex-mono-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Serif"; font-weight: 400; font-display: swap; src: url(vendor/fonts/ibm-plex-serif-latin-400-normal.woff2) format("woff2"); }

:root {
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-a: rgba(20, 20, 19, 0.92);
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --ink-3: #8a8983;
  --line: #2c2c2a;
  --axis: #383835;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --nodata: #6f6e69;
  --accent: #7fd1e3;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --serif: "IBM Plex Serif", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--mono); }
#map { position: fixed; inset: 0; }

.top { position: fixed; top: 16px; left: 20px; z-index: 2; max-width: calc(100vw - 40px); }
.brand { display: flex; align-items: baseline; gap: 14px; }
.brand h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 0; letter-spacing: -0.5px; }
.live { font-size: 14px; letter-spacing: 1px; display: inline-flex; align-items: center; gap: 6px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: pulse 2s infinite; }
.live.stale i { background: var(--critical); animation: none; }
@keyframes pulse { 50% { opacity: 0.35; } }
.sub { font-size: 13px; letter-spacing: 1px; color: var(--ink-2); margin: 6px 0 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  font: 500 14px var(--mono); color: var(--ink-3); background: var(--surface-a);
  border: 1px solid var(--line); padding: 7px 14px; cursor: pointer; border-radius: 2px;
}
.filters button[aria-pressed="true"] { color: var(--ink); border-color: var(--ink-3); }
.filters button:hover { border-color: var(--ink-2); }
.filters .sep { width: 8px; }
.feed { margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.stale {
  margin-top: 8px; max-width: 520px; padding: 8px 12px; font-size: 13px; line-height: 1.4;
  background: var(--surface-a); border: 1px solid var(--warning); color: var(--ink);
}
.stale::before { content: "⚠ "; color: var(--warning); }

.quality { margin-top: 14px; }
.quality table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.quality th, .quality td { padding: 3px 4px; text-align: right; border-bottom: 1px solid var(--line); }
.quality thead th { color: var(--ink-3); font-weight: 400; }
.quality tbody th { text-align: left; color: var(--ink-2); font-weight: 400; }
.quality td { cursor: default; }

.kpis { position: fixed; top: 16px; right: 20px; z-index: 2; display: flex; gap: 32px; text-align: right; }
.kpis b { display: block; font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kpis span { font-size: 13px; color: var(--ink-2); }

.alerts {
  position: fixed; top: 86px; right: 20px; z-index: 2; width: 420px; max-height: 46vh;
  background: var(--surface-a); border: 1px solid var(--line); display: flex; flex-direction: column;
}
.alerts-head { all: unset; cursor: pointer; padding: 12px 18px; font-size: 16px; font-weight: 500; }
.alerts-list { overflow-y: auto; padding: 0 18px 8px; }
.alerts[data-collapsed] .alerts-list { display: none; }
.alert { padding: 12px 0; border-top: 1px solid var(--line); }
.alert h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.alert p { font-size: 12px; color: var(--ink-2); margin: 0 0 6px; line-height: 1.4; }
.alert .trips { font-size: 12px; color: var(--accent); }

.panel {
  position: fixed; left: 20px; bottom: 20px; z-index: 2; width: 440px; max-height: calc(100vh - 230px); overflow-y: auto;
  background: var(--surface-a); border: 1px solid var(--line); padding: 20px 22px 16px;
}
.eyebrow { font-size: 12px; letter-spacing: 1.5px; color: var(--critical); }
.hero { display: flex; align-items: baseline; gap: 12px; margin: 6px 0 4px; }
.hero span { font-family: var(--serif); font-size: 84px; line-height: 1; font-variant-numeric: tabular-nums; }
.hero em { font-size: 18px; color: var(--ink-2); }
.lead { font-size: 14px; line-height: 1.5; margin: 8px 0; }
.pct { font-family: var(--serif); font-size: 24px; color: var(--critical); margin: 6px 0 10px; }
.facts { font-size: 12px; color: var(--ink-2); margin: 0 0 14px; line-height: 1.6; }
.facts div { display: flex; justify-content: space-between; gap: 12px; }
.facts dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }

.chart { position: relative; }
.chart-title { font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
#bars { width: 100%; height: 130px; display: block; }
#bars text { font: 11px var(--mono); fill: var(--ink-2); }
#bars .val { fill: var(--ink); }
#bars .bar { fill: #5b5a55; }
#bars .bar.today { fill: url(#hatch); }
#bars .hit { fill: transparent; cursor: default; }
#bars g:hover .bar { fill: #7c7b75; }
#bars .base { stroke: var(--axis); }
.tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--axis);
  padding: 6px 9px; font-size: 12px; line-height: 1.45; white-space: nowrap; transform: translate(-50%, -100%);
}

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11px; color: var(--ink-2); margin-top: 14px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 5px; vertical-align: -1px; }
.legend i.ring { background: transparent; border: 2px solid var(--ink); }
.src { font-size: 10px; color: var(--ink-3); margin: 10px 0 0; line-height: 1.5; }
.src a { color: var(--ink-2); }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib a { font-family: var(--mono); font-size: 10px; }

.maplibregl-popup-content { background: var(--surface); color: var(--ink); font: 12px var(--mono); border: 1px solid var(--axis); padding: 10px 12px; }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { color: var(--ink-2); }
.pop h4 { margin: 0 0 4px; font-size: 14px; }
.pop .d { font-weight: 600; }
.pop .sub { color: var(--ink-3); }
.pop .route { margin: -2px 0 4px; color: var(--ink); }
.pop .d { margin-top: 6px; }

@media (max-width: 900px) {
  .kpis { position: static; justify-content: flex-start; padding: 0 20px; gap: 20px; text-align: left; }
  .alerts { display: none; }
  .panel { width: auto; right: 16px; left: 16px; max-height: 45vh; }
  .hero span { font-size: 56px; }
}
