:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f2f1ed;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #1c5cab;
  --accent-wash: #e6effa;
  --hinweis: #fff6e0;
  --hinweis-rand: #eda100;

  --s-netto: #2a78d6;
  --s-kindergeld: #1baf7a;
  --s-grundsicherung: #eb6834;
  --s-wohngeld: #6250d6;
  --s-kiz: #eda100;
  --s-but: #e87ba4;
  --s-pflege: #008300;
  --s-kita: #e34948;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242422;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #6da7ec;
    --accent-wash: #1c2a3b;
    --hinweis: #2b2414;
    --hinweis-rand: #c98500;

    --s-netto: #3987e5;
    --s-kindergeld: #199e70;
    --s-grundsicherung: #d95926;
    --s-wohngeld: #9085e9;
    --s-kiz: #c98500;
    --s-but: #d55181;
    --s-pflege: #008300;
    --s-kita: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242422;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #6da7ec;
  --accent-wash: #1c2a3b;
  --hinweis: #2b2414;
  --hinweis-rand: #c98500;

  --s-netto: #3987e5;
  --s-kindergeld: #199e70;
  --s-grundsicherung: #d95926;
  --s-wohngeld: #9085e9;
  --s-kiz: #c98500;
  --s-but: #d55181;
  --s-pflege: #008300;
  --s-kita: #e66767;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

header.kopf { padding: 24px 0 8px; }
.untertitel { color: var(--text-2); margin: 0; max-width: 70ch; }

.modell-hinweis {
  margin: 16px 0;
  padding: 10px 14px;
  border-left: 4px solid var(--hinweis-rand);
  background: var(--hinweis);
  border-radius: 6px;
  font-size: 0.95rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

.karte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.karte + .karte { margin-top: 16px; }

/* ---------- Eingaben ---------- */
.feld { margin-bottom: 14px; }
.feld > label, .feld > .label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 4px; }
.feld .hilfe { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
input[type="number"], select {
  width: 100%;
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--axis);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
input[type="number"] { font-variant-numeric: tabular-nums; }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.segmente { display: flex; flex-wrap: wrap; gap: 6px; }
.segmente label {
  flex: 1 1 auto;
  text-align: center;
  padding: 6px 8px;
  border: 1px solid var(--axis);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  white-space: nowrap;
}
.segmente input { position: absolute; opacity: 0; pointer-events: none; }
.segmente input:checked + span { font-weight: 600; }
.segmente label:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.segmente label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.kinder-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--axis);
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}
.stepper output { min-width: 1.5em; text-align: center; font-weight: 600; }

.kind {
  border-top: 1px solid var(--grid);
  padding-top: 10px;
  margin-top: 10px;
}
.kind-zeile { display: flex; align-items: center; gap: 10px; }
.kind-zeile .name { font-weight: 600; min-width: 4.5em; }
.kind-zeile select { width: auto; flex: 1; }
.kind .extra { margin: 8px 0 0 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }
.kind .extra .zwei { margin-bottom: 6px; }
.kind .extra label { font-size: 0.85rem; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.9rem; margin: 6px 0; }
.check input { margin-top: 4px; }

details.mehr { margin-top: 6px; }
details.mehr summary { cursor: pointer; font-weight: 600; font-size: 0.92rem; color: var(--text-2); }
details.mehr .inhalt { margin-top: 10px; }

.speichern { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.info-knopf {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--axis); background: var(--surface); color: var(--text-2);
  font: italic 600 13px/1 Georgia, serif; cursor: pointer; padding: 0;
}
.info-box {
  margin-top: 8px; padding: 10px 12px; font-size: 0.86rem;
  background: var(--surface-2); border-radius: 8px; color: var(--text-2);
}
.knopf {
  font: inherit; font-size: 0.92rem;
  padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent-wash); color: var(--text);
  cursor: pointer;
}
.status { font-size: 0.85rem; color: var(--text-2); }

/* ---------- Ergebnis ---------- */
.legende { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 8px; font-size: 0.85rem; color: var(--text-2); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legende i.linie { height: 3px; border-radius: 2px; }
.legende i.gestrichelt { height: 0; border-top: 2px dashed var(--muted); border-radius: 0; background: none !important; }

.diagramm { position: relative; width: 100%; }
.diagramm svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.diagramm text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.diagramm .achse { stroke: var(--axis); stroke-width: 1; }
.diagramm .gitter { stroke: var(--grid); stroke-width: 1; }
.diagramm .marke { stroke: var(--axis); stroke-width: 1; }
.diagramm .fadenkreuz { stroke: var(--text-2); stroke-width: 1; }
.diagramm .gewaehlt { stroke: var(--accent); stroke-width: 1.5; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 8px 10px; font-size: 0.82rem; min-width: 190px;
}
.tooltip .t-kopf { font-weight: 600; margin-bottom: 4px; }
.tooltip table, .aufschluesselung table { border-collapse: collapse; width: 100%; }
.tooltip td { padding: 1px 0; }
.tooltip td:last-child, .aufschluesselung td:last-child { text-align: right; font-variant-numeric: tabular-nums; padding-left: 12px; }
.tooltip i, .aufschluesselung i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.tooltip tr.summe td, .aufschluesselung tr.summe td { border-top: 1px solid var(--grid); font-weight: 600; padding-top: 3px; }

.auswahl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; margin-top: 12px; }
.auswahl input[type="range"] { width: 100%; accent-color: var(--accent); }
.auswahl output { font-weight: 600; font-variant-numeric: tabular-nums; }

.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 12px; }
.kennzahl { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.kennzahl .k-label { font-size: 0.82rem; color: var(--text-2); }
.kennzahl .k-wert { font-size: 1.5rem; font-weight: 600; }
.kennzahl .k-zusatz { font-size: 0.8rem; color: var(--muted); }

.aufschluesselung { margin-top: 14px; font-size: 0.92rem; }
.aufschluesselung td { padding: 3px 0; border-bottom: 1px solid var(--grid); }
.aufschluesselung tr.minus td:last-child { color: var(--text-2); }

.antraege { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; }
.antraege h3 { margin: 0 0 6px; }
.antraege ul { margin: 0; padding-left: 1.1rem; }
.antraege li { margin: 6px 0; }
.antraege .betrag { color: var(--text-2); white-space: nowrap; }
.antraege .wo { font-size: 0.92rem; color: var(--text-2); }
.antraege .hilfe { margin: 8px 0 0; }
.hinweise { margin: 12px 0 0; padding-left: 1.1rem; font-size: 0.92rem; color: var(--text-2); }
.hinweise li { margin: 4px 0; }

.tabelle-scroll { overflow-x: auto; }
table.daten { border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; width: 100%; }
table.daten th, table.daten td { padding: 4px 8px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.daten th { color: var(--text-2); font-weight: 600; position: sticky; top: 0; background: var(--surface); }

.annahmen ul { padding-left: 1.1rem; margin: 6px 0 12px; }
.annahmen li { margin: 4px 0; font-size: 0.93rem; }

footer.fuss { padding: 24px 0 40px; color: var(--muted); font-size: 0.88rem; }
footer.fuss a { color: var(--text-2); }

.textseite { max-width: 760px; }
.textseite h2 { margin-top: 1.6rem; }
.adresse-bild { display: block; max-width: 100%; height: auto; margin: 8px 0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .adresse-bild { filter: invert(1) hue-rotate(180deg); }
}
:root[data-theme="dark"] .adresse-bild { filter: invert(1) hue-rotate(180deg); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.betreuung { display: flex; flex-wrap: wrap; gap: 0 14px; margin-top: 4px; }
.betreuung .check { margin: 4px 0; }
.kind .privat { display: grid; grid-template-columns: auto 90px; gap: 2px 8px; align-items: center; margin: 4px 0 6px; font-size: 0.88rem; }
.kind .privat input { padding: 4px 6px; }
.kind .privat .hilfe { grid-column: 1 / -1; color: var(--muted); font-size: 0.8rem; }

.vorschau-hinweis {
  margin-bottom: 16px; padding: 12px 14px; border-radius: 10px;
  background: var(--accent-wash); border: 1px solid var(--accent);
}
#ergebnis.vorschau .karte { opacity: 0.4; filter: grayscale(1); transition: opacity 0.3s, filter 0.3s; }
#ergebnis .karte { transition: opacity 0.3s, filter 0.3s; }
