/* Haushalt Dortmund – Stylesheet
   Zuerst Smartphone, dann breiter (ab 48rem).
   Design angelehnt an dortmund.de (E37): Schrift Poppins, Schwarz/Grau, Petrol als Akzent.
   Bewusst KEIN Logo, Wappen oder „DO“-Zeichen der Stadt: inoffizielle Seite (E27).
   Schrift selbst gehostet (website/schriften/, SIL Open Font License), keine fremden Server (E28).
   Diagrammfarben geprüft mit dem Palette-Validator (Farbsehschwäche, Kontrast):
   hell #00809e, #eb6834, #6250d6 · dunkel #1a9cb2, #d95926, #9085e9 · mehr/weniger hell #00809e/#e34948, dunkel #1a9cb2/#e66767.
   Textkontraste (WCAG): Text 15,5 : 1, Text-2 ≥ 6,1 : 1, Links ≥ 4,7 : 1, Weiß auf Petrol 5,1 : 1. */

@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("../schriften/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("../schriften/poppins-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 800; font-display: swap; src: url("../schriften/poppins-latin-800-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --flaeche: #ffffff;
  --flaeche-2: #f5f5f5;
  --linie: #d6d6d6;
  --text: #242424;
  --text-2: #5c5c5c;
  --link: #00798c;
  --akzent: #00798c;
  --nummer: #00798c;
  --reihe-1: #00809e;
  --reihe-2: #eb6834;
  --reihe-3: #6250d6;
  --mehr: #00809e;
  --weniger: #e34948;
  --hinweis-flaeche: #f5f5f5;
  --hinweis-rand: #00798c;
  --fokus: #00798c;
  --schrift: "Poppins", Verdana, system-ui, sans-serif;
  --balken: 1.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --flaeche: #1f1f1f;
    --flaeche-2: #2e2e2e;
    --linie: #444444;
    --text: #fefefe;
    --text-2: #b8b8b8;
    --link: #7fedff;
    --akzent: #1a9cb2;
    --nummer: #00798c;
    --reihe-1: #1a9cb2;
    --reihe-2: #d95926;
    --reihe-3: #9085e9;
    --mehr: #1a9cb2;
    --weniger: #e66767;
    --hinweis-flaeche: #2e2e2e;
    --hinweis-rand: #1a9cb2;
    --fokus: #7fedff;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--schrift);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--flaeche);
}

a { color: var(--link); }
a:focus-visible, summary:focus-visible, button:focus-visible, .tabelle-rahmen:focus-visible {
  outline: 3px solid var(--fokus);
  outline-offset: 2px;
  border-radius: 2px;
}

.springen {
  position: absolute; left: -999px; top: 0;
  background: var(--flaeche); padding: .5rem 1rem; z-index: 10;
}
.springen:focus { left: .5rem; }

.inhalt { max-width: 48rem; margin: 0 auto; padding: 0 1rem; }

/* Kopf */
.kopf { border-bottom: 1px solid var(--linie); padding: 1rem 0 .5rem; }
.kopf h1 { font-size: 1.625rem; font-weight: 800; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
.kopf h1 a { color: inherit; text-decoration: none; }
.hinweis {
  background: var(--hinweis-flaeche);
  border-left: 4px solid var(--hinweis-rand);
  padding: .5rem .75rem;
  font-size: .9375rem;
  margin: .5rem 0;
}
/* Abstand beim Scrollen: Das feststehende Menü darf angesprungene oder fokussierte Elemente nicht verdecken (WCAG 2.4.11). */
html { scroll-padding-top: 4rem; }
.menue { position: sticky; top: 0; z-index: 5; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.menue ol {
  list-style: none; display: flex; gap: .25rem; margin: 0 auto; padding: .5rem 1rem;
  max-width: 48rem; overflow-x: auto;
}
.menue a {
  display: block; white-space: nowrap; padding: .25rem .625rem; border-radius: 999px;
  background: var(--flaeche-2); color: var(--text); text-decoration: none; font-size: .9375rem;
}

/* Abschnitte */
section { padding: 2rem 0 1rem; border-bottom: 1px solid var(--linie); scroll-margin-top: 3.5rem; }
h2 { font-size: 1.375rem; font-weight: 800; line-height: 1.3; margin: 0 0 .75rem; }
h3 { font-size: 1.125rem; font-weight: 600; margin: 1.5rem 0 .5rem; }
.nummer {
  display: inline-block; min-width: 1.75rem; height: 1.75rem; line-height: 1.75rem; margin-right: .5rem;
  text-align: center; border-radius: 50%; background: var(--nummer); color: #fff; font-size: 1rem; font-weight: 600; /* Kontrast 5,1 : 1 */
}
.kernaussage { font-size: 1.1875rem; }
.quelle { font-size: .875rem; color: var(--text-2); }
.fussnote { font-size: .875rem; color: var(--text-2); }

/* Kennzahlen */
.kennzahlen { display: grid; gap: .75rem; margin: 1rem 0; }
.kennzahl { background: var(--flaeche-2); border-radius: .5rem; padding: .75rem 1rem; }
.kennzahl .bezeichnung { display: block; color: var(--text-2); font-size: .9375rem; }
.kennzahl .wert { display: block; font-size: 1.75rem; font-weight: 800; line-height: 1.2; }

/* Liegende Balken (Abschnitt 1 und 2) */
.balkenliste { list-style: none; margin: 1rem 0; padding: 0; }
.balkenliste > li { border-bottom: 1px solid var(--linie); }
.balkenliste summary { list-style: none; cursor: pointer; padding: .5rem 0; }
.balkenliste summary::-webkit-details-marker { display: none; }
.zeile { display: grid; grid-template-columns: 1fr auto; column-gap: .5rem; align-items: baseline; }
.zeile .name { font-size: .9375rem; }
.zeile .name::before { content: "▸ "; color: var(--text-2); }
details[open] > summary .name::before { content: "▾ "; }
.zeile .betrag { font-variant-numeric: tabular-nums; font-size: .9375rem; white-space: nowrap; }
.spur { grid-column: 1 / -1; height: var(--balken); margin-top: .25rem; position: relative; }
.balken {
  position: absolute; top: 0; bottom: 0; left: 0;
  background: var(--reihe-1);
  border-radius: 0 4px 4px 0;
  min-width: 2px;
}
.details { padding: .25rem 0 1rem 1rem; font-size: .9375rem; }
.details dl { display: grid; grid-template-columns: auto 1fr; gap: .125rem 1rem; margin: .5rem 0; }
.details dt { color: var(--text-2); }
.details dd { margin: 0; font-variant-numeric: tabular-nums; }
.mini { list-style: none; padding: 0; margin: .5rem 0; }
.mini li { display: grid; grid-template-columns: 1fr auto; gap: .5rem; font-size: .875rem; }
.mini .spur { height: .5rem; margin: .125rem 0 .375rem; }

/* Abweichungsbalken (Abschnitt 2) */
.abweichung .spur { background: linear-gradient(var(--text-2), var(--text-2)) 50% 0 / 1px 100% no-repeat; }
.abweichung .balken.mehr { left: 50%; background: var(--mehr); border-radius: 0 4px 4px 0; }
.abweichung .balken.weniger { right: 50%; left: auto; background: var(--weniger); border-radius: 4px 0 0 4px; }
.abweichung .name::before, .ohne-details .name::before { content: none; }
.ohne-details > li { padding: .375rem 0; }
.ohne-details .zeile .betrag { text-align: right; }
.ohne-details .betrag .anteil, .ohne-details .betrag .wert { display: block; }
.ohne-details .betrag .wert { font-size: .8125rem; color: var(--text-2); }
.abweichung li { padding: .375rem 0; }
.legende { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .875rem; color: var(--text-2); margin: .5rem 0; padding: 0; list-style: none; }
.legende li { display: flex; align-items: center; gap: .375rem; }
.muster { display: inline-block; width: .875rem; height: .875rem; border-radius: 2px; }

/* Säulen (Abschnitt 3, Jahresergebnis) */
.saeulen { display: grid; grid-template-columns: repeat(6, 1fr); gap: .375rem; margin: 1rem 0 .5rem; align-items: start; }
.saeule { display: flex; flex-direction: column; align-items: center; font-size: .8125rem; }
.saeule .jahr { font-weight: 600; font-size: .9375rem; }
.saeule .art { color: var(--text-2); }
.saeule .flaeche { width: 100%; height: 10rem; position: relative; border-top: 1px solid var(--text-2); margin-top: .25rem; }
.saeule .wertbalken {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: min(100%, 24px); background: var(--reihe-1); border-radius: 0 0 4px 4px;
}
.saeule .wertbalken.planung {
  background: repeating-linear-gradient(45deg, var(--reihe-1) 0 3px, transparent 3px 7px);
  box-shadow: inset 0 0 0 2px var(--reihe-1);
}
.saeule .wertbalken.entwurf { background: var(--reihe-2); }
.saeule .wert { font-variant-numeric: tabular-nums; margin-top: .25rem; text-align: center; }

/* Gestapelte Balken (Abschnitt 3, Schulden) */
.stapel { list-style: none; padding: 0; margin: 1rem 0; }
.stapel li { margin-bottom: .75rem; }
.stapel .kopfzeile { display: flex; justify-content: space-between; gap: .5rem; font-size: .9375rem; }
.stapel .kopfzeile strong { white-space: nowrap; }
.stapel .spur { display: flex; gap: 2px; height: var(--balken); }
.stapel .teil { height: 100%; }
.stapel .teil:last-child { border-radius: 0 4px 4px 0; }
.teil.r1, .muster.r1 { background: var(--reihe-1); }
.teil.r2, .muster.r2 { background: var(--reihe-2); }
.teil.r3, .muster.r3 { background: var(--reihe-3); }
.muster.ist { background: var(--reihe-1); }
.muster.entwurf { background: var(--reihe-2); }
.muster.planung { background: repeating-linear-gradient(45deg, var(--reihe-1) 0 3px, transparent 3px 7px); box-shadow: inset 0 0 0 2px var(--reihe-1); }

/* Zeitleiste (Abschnitt 4) */
.zeitleiste { list-style: none; padding: 0; margin: 1rem 0; border-left: 2px solid var(--linie); }
.zeitleiste > li { position: relative; padding: 0 0 1rem 1.25rem; }
.zeitleiste > li::before {
  content: ""; position: absolute; left: -7px; top: .45rem; width: 12px; height: 12px;
  border-radius: 50%; background: var(--flaeche); box-shadow: inset 0 0 0 2px var(--akzent);
}
.zeitleiste > li.erledigt::before { background: var(--akzent); }
.zeitleiste .datum { font-weight: 600; display: block; }
.zeitleiste .status { font-size: .8125rem; color: var(--text-2); }
.termine { font-size: .875rem; }
.termine ul { padding-left: 1.25rem; margin: .25rem 0; }

/* Tabellen */
details.tabelle { margin: .5rem 0 1rem; font-size: .875rem; }
details.tabelle > summary { cursor: pointer; color: var(--link); }
.tabelle-rahmen { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin-top: .5rem; }
th, td { text-align: left; padding: .25rem .5rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
caption { text-align: left; font-weight: 600; padding-bottom: .25rem; }

/* Tooltip */
.tooltip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 18rem;
  background: var(--text); color: var(--flaeche); padding: .375rem .5rem; border-radius: 4px;
  font-size: .8125rem; line-height: 1.4;
}
.tooltip[hidden] { display: none; }

/* Memorandum 2030: Vergleich je Jahr (Abschnitt 2) */
.jahresvergleich { list-style: none; padding: 0; margin: 1rem 0; }
.jahresvergleich > li { padding: .5rem 0; border-bottom: 1px solid var(--linie); }
.jahresvergleich .jahr { font-weight: 600; display: block; }
.vergleich { display: block; margin: .25rem 0; }
.vergleich .kopfzeile { display: flex; justify-content: space-between; gap: .5rem; font-size: .875rem; }
.vergleich .kopfzeile strong { font-weight: 400; text-align: right; font-variant-numeric: tabular-nums; }
.vergleich .spur { display: block; position: relative; height: var(--balken); margin-top: .125rem; }
.balken.r1 { background: var(--reihe-1); }
.balken.r2 { background: var(--reihe-2); }
.grenzlinie, .muster.grenze { background: var(--text); }
.grenzlinie { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-left: -1px; }
.muster.grenze { width: 3px; }
blockquote { margin: 1rem 0; padding: .25rem 0 .25rem 1rem; border-left: 4px solid var(--linie); }
blockquote p { margin: 0 0 .25rem; }
blockquote footer { font-size: .875rem; color: var(--text-2); }
details.erklaerung { margin: 1rem 0; padding: .5rem .75rem; background: var(--flaeche-2); border-radius: .5rem; }
details.erklaerung > summary { cursor: pointer; font-weight: 600; }
details.erklaerung h4 { font-size: 1rem; margin: 1rem 0 .25rem; }

/* Memorandum 2030: Liste aller Maßnahmen (Abschnitt 3) */
.knopf {
  font: inherit; font-weight: 600; cursor: pointer; padding: .5rem 1rem; border-radius: .375rem;
  border: 2px solid var(--akzent); background: var(--akzent); color: #fff; /* Kontrast Weiß auf Petrol 5,1 : 1 */
}
.knopf.leise { background: transparent; color: var(--link); border-color: var(--linie); font-weight: 400; }
.knopf:disabled { opacity: .7; cursor: progress; }
@media (prefers-color-scheme: dark) { .knopf { background: var(--flaeche-2); color: var(--text); } }
.filterleiste { display: grid; gap: .5rem; margin: 1rem 0 .5rem; }
.filter { margin: 0; display: grid; gap: .125rem; font-size: .9375rem; min-width: 0; }
.filterleiste > .knopf { justify-self: start; }
.filter label { color: var(--text-2); }
.filter input, .filter select {
  font: inherit; font-size: 1rem; padding: .375rem .5rem; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--text-2); border-radius: .25rem; width: 100%; min-width: 0;
}
input:focus-visible, select:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }
.treffer { font-weight: 600; }
.massnahmenliste { list-style: none; padding: 0; margin: .5rem 0 1rem; }
.massnahmenliste > li { border-bottom: 1px solid var(--linie); }
.massnahmenliste summary { cursor: pointer; padding: .5rem 0; display: grid; gap: .125rem; list-style: none; }
.massnahmenliste summary::-webkit-details-marker { display: none; }
.massnahmenliste .titel { font-weight: 600; }
.massnahmenliste .titel::before { content: "▸ "; color: var(--text-2); font-weight: 400; }
.massnahmenliste details[open] > summary .titel::before { content: "▾ "; }
.massnahmenliste .meta { font-size: .8125rem; color: var(--text-2); }
.massnahmenliste .betrag { font-size: .9375rem; font-variant-numeric: tabular-nums; }
.massnahmenliste .beschreibung { white-space: pre-line; }
.mini.jahre li { max-width: 24rem; }

/* Glossar */
.glossar dt { font-weight: 600; margin-top: 1rem; scroll-margin-top: 1rem; }
.glossar dd { margin: .25rem 0 0; }

/* Fuß */
.fuss { padding: 1.5rem 0 3rem; font-size: .875rem; color: var(--text-2); }
.fuss ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.fuss .version { font-size: .8125rem; }

.laden { color: var(--text-2); font-style: italic; }
.fehler { border-left: 4px solid var(--weniger); padding: .5rem .75rem; background: var(--flaeche-2); }

@media (min-width: 48rem) {
  .kopf h1 { font-size: 2.25rem; }
  .filterleiste { grid-template-columns: 1fr 1fr; align-items: end; }
  .filter.suche { grid-column: 1 / -1; }
  .massnahmenliste summary { grid-template-columns: 1fr auto; column-gap: 1rem; }
  .massnahmenliste .meta { grid-column: 1; }
  .massnahmenliste .betrag { grid-column: 2; grid-row: 1; text-align: right; }
  .kennzahlen { grid-template-columns: repeat(3, 1fr); }
  .zeile { grid-template-columns: 16rem 1fr 7rem; }
  .zeile .betrag { text-align: right; grid-column: 3; grid-row: 1; }
  .abweichung .zeile { grid-template-columns: 13rem 1fr 11rem; }
  .ohne-details .zeile { grid-template-columns: 16rem 1fr 10rem; }
  .spur { grid-column: 2; grid-row: 1; margin-top: 0; }
  .saeule .flaeche { height: 14rem; }
}

@media (forced-colors: active) {
  .balken, .wertbalken, .teil, .muster, .grenzlinie { forced-color-adjust: none; border: 1px solid CanvasText; }
}
