/* Haushalt Oldenburg
   Layout: linksbündige Spalte bis 76rem. Oben ein tiefblaues Band mit der Rechnung des
   Haushalts (Erträge − Aufwendungen = Ergebnis, die Summe doppelt unterstrichen wie in der
   Buchhaltung) neben dem Jahresergebnis im Zeitverlauf. Darunter ruhige Abbildungen ohne
   Kästen, nur durch Haarlinien gegliedert. Schrift: Fira Sans, für große Zahlen Condensed. */

@font-face { font-family: "Fira Sans"; src: url("schrift/fira-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("schrift/fira-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("schrift/fira-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Fira Sans Condensed"; src: url("schrift/fira-sans-condensed-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Fira Sans Condensed"; src: url("schrift/fira-sans-condensed-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: light;
  --grund: #f3f5f8;
  --flaeche: #ffffff;
  --tinte: #14243a;
  --tinte-2: #46566a;
  --leise: #5c6c80;
  --linie: #d3dbe3;
  --gitter: #e3e8ee;
  --achse: #a9b5c2;
  --hover: rgba(20, 36, 58, 0.05);
  --gewaehlt: rgba(20, 36, 58, 0.09);
  --gut: #0b6b2b;
  --schlecht: #b3261e;
  --band: #123a63;
  /* Datenreihen: geprüfte Kategorienpalette, feste Reihenfolge */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #008300;
  --s7: #6250d6;
  --s8: #e34948;
  --ertrag: var(--s1);
  --aufwand: var(--s2);
  --invest: var(--s7);
  --ergebnis: var(--tinte-2);
  --font: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-zahl: "Fira Sans Condensed", "Fira Sans", "Arial Narrow", sans-serif;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --grund: #0d151e;
    --flaeche: #141f2b;
    --tinte: #e6edf4;
    --tinte-2: #b0bdcb;
    --leise: #8f9eaf;
    --linie: #283746;
    --gitter: #1f2b38;
    --achse: #45566a;
    --hover: rgba(230, 237, 244, 0.05);
    --gewaehlt: rgba(230, 237, 244, 0.1);
    --gut: #4cc36b;
    --schlecht: #f2766d;
    --band: #0f2d4d;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --s6: #008300;
    --s7: #9085e9;
    --s8: #e66767;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--tinte);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--tinte);
  outline-offset: 2px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.sprung {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 50;
  background: var(--flaeche);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
}
.sprung:focus { top: 0.5rem; }

.spalte {
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

/* Kopf mit Reitern */
.kopf {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--grund);
  border-bottom: 1px solid var(--linie);
}
.kopf-innen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 2.5rem;
}
.marke {
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: none;
  padding-block: 0.75rem;
}
.kopf-hinweis {
  order: 3;
  margin-left: auto;
  padding-block: 0.75rem;
  font-size: 0.8125rem;
  color: var(--leise);
}
.reiter {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  margin-inline: -0.75rem;
}
.reiter a {
  padding: 0.95rem 0.75rem 0.8rem;
  color: var(--tinte-2);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.reiter a:hover { color: var(--tinte); }
.reiter a[aria-current="page"] {
  color: var(--tinte);
  font-weight: 500;
  border-bottom-color: var(--tinte);
}
.reiter a:focus-visible { outline-offset: -2px; }
@media (max-width: 40rem) {
  .kopf { position: static; }
  .kopf-innen { display: block; }
  .marke { display: block; padding-bottom: 0; }
  .kopf-hinweis { padding-block: 0.15rem 0; }
}

main:focus { outline: none; }
.seite { scroll-margin-top: 5rem; }

/* Band mit der Rechnung: eigene Farben, unabhängig vom Farbschema der Seite */
.band {
  background: var(--band);
  color: #eef3f8;
  --tinte: #f1f5f9;
  --tinte-2: #c6d3e0;
  --leise: #a7bacd;
  --linie: rgba(255, 255, 255, 0.2);
  --gitter: rgba(255, 255, 255, 0.11);
  --achse: rgba(255, 255, 255, 0.4);
  --flaeche: #0b2645;
  --ergebnis: #e3ebf3;
  --minus: #ffa69a;
  --gut: #8fe0a8;
  --schlecht: #ffa69a;
}
.band-innen {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 2.5rem 4rem;
  padding-block: 2.75rem 3rem;
  align-items: start;
}
@media (max-width: 60rem) {
  .band-innen { grid-template-columns: minmax(0, 1fr); }
}
.band h1 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.25rem); font-weight: 600; line-height: 1.15; }
.band .lead { color: var(--tinte-2); margin-top: 0.75rem; }
.band-notiz { font-size: 0.875rem; color: var(--leise); }
.band .abb { border-top: 0; padding-top: 0; }

.rechnung {
  border-collapse: collapse;
  margin-block: 1.75rem 1rem;
  font-variant-numeric: tabular-nums lining-nums;
}
.rechnung td { padding: 0; vertical-align: baseline; }
.rechnung .op {
  font-family: var(--font-zahl);
  font-size: clamp(1.75rem, 1rem + 2.4vw, 2.75rem);
  color: var(--leise);
  text-align: left;
  padding-right: 0.4rem;
  width: 1.1em;
}
.rechnung .wert {
  font-family: var(--font-zahl);
  font-weight: 500;
  font-size: clamp(2.25rem, 1.1rem + 3.6vw, 3.75rem);
  line-height: 1.12;
  text-align: right;
  padding-right: 1rem;
  white-space: nowrap;
}
.rechnung .text { padding-bottom: 0.4rem; line-height: 1.3; hyphens: auto; overflow-wrap: anywhere; }
@media (max-width: 30rem) {
  .rechnung .wert { padding-right: 0.6rem; }
  .rechnung .op { padding-right: 0.2rem; }
}
.rechnung .text span { display: block; }
.rechnung .text .notiz { font-size: 0.875rem; color: var(--tinte-2); margin-top: 0.15rem; }
.rechnung tr.summe td { padding-top: 0.45rem; }
.rechnung tr.summe :is(.op, .wert) { border-top: 5px double var(--tinte); }
.rechnung tr.summe .wert { font-weight: 600; }
.rechnung tr.summe .text span:first-child { font-weight: 500; }
.rechnung .negativ { color: var(--minus); }

/* Inhalt */
.inhalt { padding-block: 2.5rem 4rem; }
.seite h1 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.25rem); font-weight: 600; line-height: 1.15; }
.lead { font-size: 1.0625rem; color: var(--tinte-2); max-width: 68ch; line-height: 1.55; margin-top: 0.75rem; }
.inhalt > .lead { margin-bottom: 2rem; }
.abschnitt {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 3.5rem 0 1.25rem;
}
.abschnitt:first-child { margin-top: 0.5rem; }

.raster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  gap: 2.75rem 3.5rem;
}
.breit { grid-column: 1 / -1; }

.abb {
  display: grid;
  gap: 0.6rem;
  align-content: start;
  min-width: 0;
  border-top: 1px solid var(--linie);
  padding-top: 1rem;
}
.abb figcaption { display: grid; gap: 0.2rem; }
.abb-titel { font-size: 1.125rem; font-weight: 500; line-height: 1.3; }
.abb-notiz { font-size: 0.875rem; color: var(--leise); line-height: 1.45; max-width: 70ch; }
.abb-aussage { font-size: 0.9375rem; color: var(--tinte-2); line-height: 1.5; max-width: 60ch; }
.aussage { font-size: 1.0625rem; line-height: 1.55; max-width: 52ch; }
.aussage b, .abb-aussage b, .abb-notiz b { font-weight: 600; color: var(--tinte); white-space: nowrap; }
.abb-text { align-content: start; }
.abb-text .aussage + .aussage { margin-top: 0.75rem; }
.negativ-text { color: var(--schlecht); }

/* Diagramme */
.chart { position: relative; container-type: inline-size; min-width: 0; }
.diagramm { display: block; overflow: visible; }
.tick { font-family: var(--font); font-size: 12px; fill: var(--leise); font-variant-numeric: tabular-nums; }
.gitter { stroke: var(--gitter); stroke-width: 1; shape-rendering: crispEdges; }
.null { stroke: var(--achse); stroke-width: 1; shape-rendering: crispEdges; }
.grenze { stroke: var(--achse); stroke-width: 1; stroke-dasharray: 3 3; }
.linie { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.linie.plan { stroke-dasharray: 5 4; stroke-linecap: butt; }
.punkt { stroke: var(--flaeche); stroke-width: 2; }
.ring { fill: var(--grund); stroke-width: 2; }
.band .ring { fill: var(--band); }
.regel { stroke: var(--achse); stroke-width: 1; }
.fokus { pointer-events: none; }
.fuehrung { stroke: var(--achse); stroke-width: 1; }
.endlabel { font-family: var(--font); font-size: 13px; fill: var(--tinte); }
.balken-ist { fill: var(--farbe); }
.balken-plan { fill: var(--farbe); fill-opacity: 0.35; }
.stapel-plan { fill: var(--farbe); fill-opacity: 0.55; }
.balken-prognose { fill: none; stroke: var(--farbe); stroke-width: 1.5; }
.saeule { outline: none; }
.saeule:hover :is(.balken-ist, .balken-plan, .stapel-plan), .saeule:focus-visible :is(.balken-ist, .balken-plan, .stapel-plan) { filter: brightness(1.12); }
.saeule:focus-visible path { stroke: var(--tinte); stroke-width: 1; }
.spark { display: block; overflow: visible; }
.spark-linie { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }

.balken { display: grid; gap: 0.55rem; }
.balken-zeile {
  display: grid;
  grid-template-columns: minmax(7rem, 36%) minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  border-radius: var(--radius);
}
.balken-zeile:hover .balken-bar { filter: brightness(1.1); }
.balken-zeile:focus-visible { outline-offset: 2px; }
.balken-label { font-size: 0.875rem; line-height: 1.3; overflow-wrap: anywhere; }
.balken-spur { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.balken-bar { flex: 0 0 calc((100% - 9.5rem) * var(--anteil)); height: 14px; border-radius: 0 4px 4px 0; }
.balken-wert { font-size: 0.875rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.balken-zusatz { color: var(--leise); }
@container (max-width: 26rem) {
  .balken-zeile { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
}

.legende { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; font-size: 0.8125rem; color: var(--tinte-2); }
.leg { display: inline-flex; align-items: center; gap: 0.4rem; }
.leg-key, .tt-key { flex: none; display: inline-block; }
.leg-key.flaeche, .tt-key.flaeche { width: 10px; height: 10px; border-radius: 2px; background: var(--farbe); }
.leg-key.plan-flaeche, .tt-key.plan-flaeche { width: 10px; height: 10px; border-radius: 2px; background: var(--farbe); opacity: 0.35; }
.leg-key.umriss, .tt-key.umriss { width: 10px; height: 10px; border-radius: 2px; border: 1.5px solid var(--farbe); }
.leg-key.linie, .tt-key.linie { width: 16px; height: 0; border-top: 2px solid var(--farbe); }
.leg-key.plan, .tt-key.plan { width: 16px; height: 0; border-top: 2px dashed var(--farbe); }
.leg-key.ring, .tt-key.ring, .tt-key.prognose { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--farbe); }
.tt-key { width: 12px; }

.tt {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  background: var(--flaeche);
  color: var(--tinte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(10, 20, 35, 0.16);
  padding: 0.45rem 0.65rem;
  font-size: 0.8125rem;
  display: grid;
  gap: 0.15rem;
  max-width: 20rem;
}
.tt-kopf { color: var(--tinte-2); }
.tt-zeile { display: grid; grid-template-columns: 14px auto 1fr; gap: 0.45rem; align-items: center; white-space: nowrap; }
.tt-zeile b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tt-zeile span:last-child { color: var(--tinte-2); }

/* Tabellen */
.werkzeuge { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 2.5rem 0 0.75rem; }
.suche {
  flex: 1 1 16rem;
  min-width: 0;
  font: inherit;
  color: var(--tinte);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}
.filter { display: inline-flex; border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; background: var(--flaeche); }
.filter button {
  font: inherit;
  font-size: 0.875rem;
  color: var(--tinte-2);
  background: none;
  border: 0;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
}
.filter button + button { border-left: 1px solid var(--linie); }
.filter button[aria-pressed="true"] { color: var(--grund); background: var(--tinte); font-weight: 500; }
.filter button:focus-visible { outline-offset: -3px; }

.tabelle-box {
  overflow: auto;
  max-height: 34rem;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--flaeche);
  margin-bottom: 2.5rem;
}
.tabelle-box.hoch { max-height: 40rem; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.tabelle th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--flaeche);
  text-align: left;
  font-weight: 500;
  color: var(--tinte-2);
  border-bottom: 1px solid var(--linie);
  padding: 0;
  white-space: nowrap;
}
.tabelle th:not(:has(button)) { padding: 0.55rem 0.75rem; }
.tabelle th button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  display: block;
  width: 100%;
  text-align: inherit;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}
.tabelle th button:hover { color: var(--tinte); }
.tabelle th button:focus-visible { outline-offset: -3px; }
.tabelle th[aria-sort="descending"] button::after { content: " ↓"; }
.tabelle th[aria-sort="ascending"] button::after { content: " ↑"; }
.tabelle td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--gitter); vertical-align: middle; }
.tabelle tbody tr:last-child td { border-bottom: 0; }
.tabelle tbody tr { cursor: pointer; }
.tabelle tbody tr:hover td { background: var(--hover); }
.tabelle tbody tr.gewaehlt td { background: var(--gewaehlt); }
.tabelle tbody tr:focus-visible { outline: 2px solid var(--tinte); outline-offset: -2px; }
.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle th.zahl { text-align: right; }
.schluessel { color: var(--leise); font-variant-numeric: tabular-nums; white-space: nowrap; }
.spark-zelle { width: 112px; }
.gut { color: var(--gut); }
.schlecht { color: var(--schlecht); }
@media (max-width: 45rem) {
  .tabelle .nebensache { display: none; }
}


@media (prefers-reduced-motion: no-preference) {
  .reiter a { transition: color 120ms ease, border-color 120ms ease; }
}

@media print {
  .kopf, .werkzeuge, .sprung { display: none; }
  .seite[hidden] { display: block; }
  .band { background: none; color: #000; }
}
