/* Layout: redaktionelle Datenseite. Befund als Überschrift + eine Leitzahl,
   dann drei Abschnitte (Jahresvergleich, Langzeitreihe mit Filterzeile,
   Jahre | 90 Tage) und die Methode als Fußnote.
   Farbe trägt Bedeutung: Rot = laufendes Jahr, Blau = Vorjahr, Grau = Geschichte. */

@font-face {
  font-family: "Public Sans";
  src: url("fonts/public-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fcfcfb;
  --ink: #17191e;
  --ink-2: #4b515c;
  --ink-3: #6f7683;
  --rule: #e4e6ea;
  --rule-2: #c9cdd4;
  --ctx: #c9cdd5;
  --neutral: #5d6573;
  --hi: #c8372d;
  --hi-soft: rgba(200, 55, 45, 0.26);
  --cmp: #1f5fb4;
  --wash: rgba(93, 101, 115, 0.09);
  --font-ui: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181d; --ink: #eceef2; --ink-2: #b4bac5; --ink-3: #8a919e;
    --rule: #272b32; --rule-2: #3b4049; --ctx: #3e434d; --neutral: #a2aab7;
    --hi: #ee5a4c; --hi-soft: rgba(238, 90, 76, 0.32); --cmp: #5a8fe6;
    --wash: rgba(162, 170, 183, 0.10);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16181d; --ink: #eceef2; --ink-2: #b4bac5; --ink-3: #8a919e;
  --rule: #272b32; --rule-2: #3b4049; --ctx: #3e434d; --neutral: #a2aab7;
  --hi: #ee5a4c; --hi-soft: rgba(238, 90, 76, 0.32); --cmp: #5a8fe6;
  --wash: rgba(162, 170, 183, 0.10);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--cmp); outline-offset: 2px; }

.page {
  max-width: 1120px; margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-block: 0 72px;
}

.top {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 10px 22px; padding-block: 14px 13px; border-bottom: 1px solid var(--rule);
}
.wordmark { font: 700 16px/1 var(--font-ui); letter-spacing: -0.01em; margin: 0; }
.top .meta { margin-left: auto; font-size: 13px; color: var(--ink-3); }
.prefs { display: flex; gap: 8px; }
@media (max-width: 720px) {
  .top .meta { order: 3; flex-basis: 100%; margin-left: 0; }
  .prefs { margin-left: auto; }
}

/* --- Lead --- */
.lead {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 40px 64px; align-items: end; padding-block: 52px 8px;
}
.lead h1 {
  font: 600 clamp(29px, 3.7vw, 45px)/1.12 var(--font-serif);
  letter-spacing: -0.012em; text-wrap: balance; margin: 0 0 18px; max-width: 21ch;
}
.lead .dek { font-size: 17px; line-height: 1.6; color: var(--ink-2); margin: 0; max-width: 54ch; }

.figure .num { font: 600 clamp(54px, 7vw, 78px)/0.95 var(--font-ui); letter-spacing: -0.03em; }
.figure .cap { margin-top: 12px; font-size: 14.5px; color: var(--ink-2); }
.figure .delta { margin-top: 4px; font-size: 14.5px; font-weight: 600; }
.ledger { margin: 26px 0 0; border-top: 1px solid var(--rule-2); }
.ledger > div {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: baseline;
  padding-block: 9px; border-bottom: 1px solid var(--rule);
}
.ledger dt { font-size: 14px; color: var(--ink-2); }
.ledger dd { margin: 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.ledger dd small { font-weight: 400; color: var(--ink-3); margin-left: 6px; }

/* --- Abschnitte --- */
.sec { margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--rule-2); }
.sec-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end;
  gap: 12px 32px; margin-bottom: 14px;
}
.sec h2 { font: 600 19px/1.3 var(--font-ui); letter-spacing: -0.005em; margin: 0 0 4px; }
.sec-desc { margin: 0; font-size: 14px; color: var(--ink-2); max-width: 62ch; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.sw { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.sw.dash { border-top-style: dashed; }
.sw.box { width: 11px; height: 11px; border: 0; border-radius: 2px; }
.sw.hi { border-color: var(--hi); } .sw.cmp { border-color: var(--cmp); } .sw.ctx { border-color: var(--ctx); }
.sw.box.neutral { background: var(--neutral); } .sw.box.ctx { background: var(--ctx); }
.sw.box.band { background: var(--hi-soft); } .sw.box.hi-fill { background: var(--hi); } .sw.box.cmp-fill { background: var(--cmp); } .sw.dot { width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--ink); }
.sw.vline { width: 0; height: 12px; border-top: 0; border-left: 1.5px solid var(--hi); }

.chart { width: 100%; }
#cmp { height: 440px; }
#long { height: 380px; }
#daily { height: 230px; }
#acc, #track { height: 300px; }
#cna { height: 420px; }
#kev { height: 300px; }
.split .legend { margin: 12px 0 4px; }
@media (max-width: 600px) { #cmp { height: 360px; } #long { height: 320px; } }

/* Filterzeile: eine Zeile über allem, was sie steuert. */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center;
  padding-block: 11px; margin-bottom: 14px;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.f { display: flex; align-items: center; gap: 9px; }
.f > span { font-size: 13px; color: var(--ink-3); }
.seg { display: inline-flex; border: 1px solid var(--rule-2); border-radius: 6px; overflow: hidden; }
.seg button {
  font: 500 13px/1 var(--font-ui); color: var(--ink-2); background: transparent;
  border: 0; padding: 7px 11px; cursor: pointer; white-space: nowrap;
}
.seg button + button { border-left: 1px solid var(--rule-2); }
.seg button:hover { background: var(--wash); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg button:focus-visible { outline-offset: -2px; }
.seg.sm button { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; padding: 5px 8px; font-size: 12px; }
.seg.sm svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.tbl-wrap { max-height: 380px; overflow: auto; border: 1px solid var(--rule); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 7px 14px; border-bottom: 1px solid var(--rule); text-align: right; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: var(--bg); font-weight: 600; color: var(--ink-2); box-shadow: inset 0 -1px 0 var(--rule-2); }
.note { font-size: 13px; color: var(--ink-3); margin: 10px 0 0; }
.stale { margin: 20px 0 0; padding: 10px 14px; border-left: 3px solid var(--hi); background: var(--wash); font-size: 14px; color: var(--ink); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 64px; }
.split > .sec { min-width: 0; }

/* Jahresliste: Wert am Balkenende, Hochrechnung als hellere Stufe. */
.years { list-style: none; margin: 4px 0 0; padding: 0; }
.years li {
  display: grid; grid-template-columns: 3.1em minmax(0, 1fr); gap: 12px; align-items: center;
  height: 25px; font-size: 13px;
}
.years .y { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.years li.cur .y { color: var(--ink); font-weight: 600; }
.years .track { display: flex; align-items: center; gap: 2px; min-width: 0; }
.years .bar { height: 13px; background: var(--neutral); flex: none; }
.years .bar.end { border-radius: 0 3px 3px 0; }
.years li.prev .bar { background: var(--cmp); }
.years li.cur .bar.act { background: var(--hi); }
.years li.cur .bar.proj { background: var(--hi-soft); }
.years .val { margin-left: 8px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.years li.cur .val { color: var(--ink); font-weight: 600; }
.years .val small { font-weight: 400; color: var(--ink-3); margin-left: 4px; }

.rhythm { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }
.rhythm b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

footer.method {
  margin-top: 72px; padding-top: 18px; border-top: 1px solid var(--rule-2);
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px 64px;
  font-size: 13px; color: var(--ink-2);
}
footer.method h3 { font: 600 13px/1.4 var(--font-ui); color: var(--ink); margin: 0 0 6px; }
footer.method p { margin: 0 0 8px; max-width: 70ch; }
.err { color: var(--hi); font-size: 14px; padding: 24px 0; }

/* Rechtliches: Links unter dem Footer, Datenschutzseite in beiden Sprachen */
.legal { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 22px; font-size: 13px; color: var(--ink-3); }
.legal a[aria-current="page"] { color: var(--ink); }
html[lang="de"] [data-lang-only="en"], html[lang="en"] [data-lang-only="de"] { display: none; }
.wordmark a { color: inherit; text-decoration: none; }
.legal-page { max-width: 70ch; padding-block: 44px 8px; }
.legal-page h1 { font: 600 clamp(28px, 3.4vw, 40px)/1.15 var(--font-serif); letter-spacing: -0.01em; margin: 0 0 14px; }
.legal-page h2 { font: 600 17px/1.35 var(--font-ui); margin: 32px 0 8px; }
.legal-page p { margin: 0 0 12px; color: var(--ink-2); line-height: 1.65; }
.legal-page .lede { font-size: 17px; color: var(--ink); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 0.92em; }

@media (max-width: 860px) {
  .lead { grid-template-columns: 1fr; padding-top: 36px; }
  .split, footer.method { grid-template-columns: 1fr; }
}
