/*
  Corporate Design des Bundes – Webseiten-Styleguide (Stand Juni 2023), Theme „Taubenblau".
  Farbwerte und Schrift aus dem Styleguide (Grundlagen S. 6–9). Kontraste sind auf WCAG 2.2 AA
  (mind. 4,5:1) ausgelegt.

  Kein Dark Mode: Die Anwendung wird in die klimaaktiv-Website eingebettet, die keinen kennt.
  Alle Tokens stehen deshalb genau einmal auf :root – keine prefers-color-scheme-Blöcke,
  kein data-theme-Attribut.
*/

:root {
    color-scheme: light;

    /* Designfarben (Theme Taubenblau) */
    --brand-01: #286f9c;   /* Designfarbe hell */
    --brand-02: #104166;   /* Designfarbe dunkel */
    --f-01: #e9f0f5;       /* 10 % Designfarbe hell */

    /* Akzent: klimaaktiv-Gelb, abgelesen aus dem offiziellen Logo. Sparsam einsetzen.
       Kontrast: als Fläche unter --text-01 15,0:1 und --brand-02 7,6:1 — gut.
       Auf Weiß nur 1,4:1: nie als Textfarbe und nie als alleiniger Zustands- oder
       Grenzanzeiger auf hellem Grund; dort trägt eine dunkle Kante (--brand-02) oder
       --warn-line (3,75:1) die Information. */
    --accent: #fcd800;

    /* Neutrale Farben */
    --text-01: #000000;    /* Standard-Text */
    --text-02: #4d4d4d;    /* 70 % Text */
    /* Gedaempfter Text (Fussnoten, Codes, Achsen). Dunkler als der Styleguide-Wert
       #757575: Der haelt 4,5:1 nur auf Weiss, nicht auf den grauen Baendern
       (--surface-2 / --table-03), auf denen er tatsaechlich steht (WCAG 1.4.3). */
    --text-03: #696969;
    --bg: #ffffff;         /* Standard-Hintergrund */
    --field-01: #ccd9de;   /* Trennlinien, Rahmen */
    --field-line: #949494; /* Formularlinien, WCAG-konform */
    --table-02: #e5ecee;
    --table-03: #f0f4f5;

    /* Flächen (aus dem Mockup übernommen) */
    --ground: #eef1f3;     /* Seitenhintergrund hinter der App-Fläche */
    --surface: #ffffff;    /* Karten, App-Fläche */
    --surface-2: #f0f4f5;  /* Leisten, Tabellenhinterlegung */

    /* Aliase auf die Linien-Tokens – neue Namen, gleiche Werte. */
    --line: var(--field-01);
    --line-strong: var(--field-line);

    /* Berechnete Felder: im Beratungstool „automatisch hinterlegt". */
    --warn-bg: #fff7d6;
    /* Rahmen hervorgehobener Felder: Er macht das Feld erkennbar und braucht deshalb 3:1
       (WCAG 1.4.11) — 3,75:1 auf Weiß, 3,38:1 auf --surface-2. Das hellere #d3b51a hielt 2:1. */
    --warn-line: #9c8200;

    /* Getoente Flaechen zu den Supportfarben (Landes-Badge, Knock-out-Hinweis). */
    --success-bg: #e9f1ea;

    /* Förderstufen nach HWB: Helligkeitsstufen von hell (Stufe 1) bis dunkel (höchste Stufe), aus der
       Designfarbe; schwarze Schrift hält auf allen mindestens 7:1. */
    --stufe-1: #dce8f0;
    --stufe-2: #bcd3e3;
    --stufe-3: #9dbdd3;
    --stufe-4: #7ea7c6;
    --danger-bg: #f9ece9;

    /* Supportfarben */
    --danger: #c92c0c;
    --danger-hover: #b1260b;
    --success: #37783e;
    --success-hover: #29592d;
    --warning: #ffd400;

    --radius: 4px;
    --radius-lg: 10px;
    --shadow: 0 1px 2px rgba(16, 65, 102, .06), 0 6px 20px rgba(16, 65, 102, .07);
    /* Fokusring deckend: Als einziger Fokusindikator (Pillen, Kacheln, Schalter) braucht er 3:1
       gegen seine Umgebung (WCAG 1.4.11) — 5,5:1 auf Weiß, 3,8:1 an den grauen Rahmen. Die
       halbtransparente Fassung kam auf knapp 2:1. Geprüft von NichtTextKontrast (E2E). */
    --ring: 0 0 0 3px var(--brand-01);
    --maxw: 72rem;
    --font: "Source Sans 3", "Source Sans Pro", system-ui, "Segoe UI", Arial, sans-serif;
}

/*
  Schrift selbst gehostet (DSGVO – kein Google-Fonts-CDN). Die WOFF2-Dateien liegen im
  Repository (schriften/, SIL Open Font License 1.1 – siehe LICENSE.md daneben), damit jeder
  Build sie hat: der Container-Build zieht keine Schriften aus dem Netz nach.
  `tools/schriften-holen.ps1` dient zum Aktualisieren. Fehlen die Dateien doch einmal, greift
  die System-Fallback-Kette aus --font und die Anwendung bleibt benutzbar.
*/
@font-face {
    font-family: "Source Sans 3";
    src: url("schriften/source-sans-3-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Source Sans 3";
    src: url("schriften/source-sans-3-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Source Sans 3";
    src: url("schriften/source-sans-3-700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* { box-sizing: border-box; }

html { font-size: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-01);
    background: var(--ground);
}

h1, h2, h3 { color: var(--brand-02); line-height: 1.2; font-weight: 700; }
h1 { font-size: 1.9rem; margin: 0 0 1rem; }
h2 { font-size: 1.4rem; }

a { color: var(--brand-01); }
a:hover { color: var(--brand-02); }

/* Sichtbarer Fokus für Tastaturbedienung (WCAG 2.4.7). */
:focus-visible {
    outline: 3px solid var(--brand-01);
    outline-offset: 2px;
}

/* ---------- Skip-Link (Styleguide S. 18) ---------- */
.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    z-index: 100;
    padding: .6rem 1rem;
    background: var(--text-01);
    color: #fff;
    text-decoration: none;
}
.skip-link:focus {
    left: 0;
    color: #fff;
}

/* ---------- Grundlayout ----------
   Kein height/min-height in Viewport-Einheiten: Die Anwendung läuft später in einem iframe,
   dessen Viewport nicht das ist, was die Nutzer:innen sehen. Die Höhe ergibt sich aus dem Inhalt.
*/
.app-shell {
    display: flex;
    flex-direction: column;
    max-width: var(--maxw);
    margin: 1.25rem auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
@media (max-width: 74rem) {
    .app-shell { margin: 0; border: none; border-radius: 0; box-shadow: none; }
}

/* Kopfzeile: Marke · Titel · Konto. Hell, damit das Logo auf seinem Weiß sitzt. */
.app-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.app-header__inner {
    margin: 0 auto;
    padding: .85rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.app-header__brand { display: flex; align-items: center; text-decoration: none; }
.app-header__logo { display: block; height: 1.9rem; width: auto; }
.app-header__titel {
    border-left: 1px solid var(--line);
    padding-left: 1rem;
    font-size: .82rem;
    color: var(--text-02);
    line-height: 1.25;
}
.app-header__titel strong { display: block; font-size: .95rem; color: var(--text-01); font-weight: 600; }
.app-header__spacer { flex: 1 1 auto; }
.app-header__account { display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: var(--text-02); }

.app-account__name { display: flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--text-01); }
.app-account__avatar {
    display: grid; place-items: center;
    width: 1.9rem; height: 1.9rem; border-radius: 50%;
    background: var(--brand-01); color: #fff;
    font-size: .75rem; font-weight: 700; letter-spacing: .02em;
}
.app-account__link { color: var(--brand-01); }
a.app-account__name { text-decoration: none; }
a.app-account__name:hover span:last-child { text-decoration: underline; }
.app-account__logout { display: inline; margin: 0; }

.app-body { flex: 1; display: flex; width: 100%; }

.app-nav { flex: 0 0 15rem; padding: 1.5rem 1rem; border-right: 1px solid var(--field-01); }
.app-nav__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.app-nav__link {
    display: block; padding: .5rem .75rem; border-radius: var(--radius);
    color: var(--text-01); text-decoration: none;
}
.app-nav__link:hover { background: var(--f-01); }
.app-nav__link.active { background: var(--brand-01); color: #fff; font-weight: 600; }

/* min-width: 0: Als Flex-Kind wäre die Hauptfläche sonst mindestens so breit wie ihr breitester
   Inhalt (z. B. Schrittleiste, 5 × 9.5rem) und ragte knapp über 48rem rechts aus der Shell, die
   dort den „Weiter"-Knopf abschnitt. So scrollt der breite Container selbst (overflow-x). */
.app-main { flex: 1; min-width: 0; padding: 1.5rem; }
.app-main:focus { outline: none; }
.app-main__content { max-width: 48rem; }

/* Verwaltung (#11): Datentabellen brauchen die Fensterbreite. Erkennungsmerkmal ist die
   Unternavigation (.admin-nav), die jede Seite unter /admin trägt. Die Shell verliert dort
   Kartenrahmen und 72rem-Grenze. overflow: visible statt hidden: hidden bildete einen
   Scroll-Container, an dem der Tabellenkopf (position: sticky) haftete statt am Seitenscroll; und
   ragt eine Tabelle doch einmal über (größere Textabstände, WCAG 1.4.12), scrollt die Seite,
   statt Inhalt abzuschneiden. Absätze und Formularfelder behalten ihre Lesebreite. */
.app-shell:has(.admin-nav) {
    max-width: none; margin: 0;
    border: none; border-radius: 0; box-shadow: none;
    overflow: visible;
}
.app-main__content:has(.admin-nav) { max-width: none; }
.app-main__content:has(.admin-nav) p { max-width: 75ch; }
.app-main__content:has(.admin-nav) .form-field { max-width: 48rem; }

.lead { font-size: 1.15rem; color: var(--text-02); }
.hinweis {
    margin-top: 1.5rem; padding: .9rem 1rem;
    background: var(--f-01); border-left: 4px solid var(--brand-01); border-radius: var(--radius);
    color: var(--text-02);
}

/* Rechtliche Seiten (Barrierefreiheitserklärung): Kontaktangaben als Begriffsliste. */
.rechtstext h2 { margin-top: 1.75rem; }
.rechtstext h3 { font-size: 1.1rem; margin-top: 1.25rem; }
.rechtstext__kontakt { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
.rechtstext__kontakt dt { font-weight: 600; }
.rechtstext__kontakt dd { margin: 0; }

/* Nutzungsstatistik (/admin/statistik): kurze Zahlentabellen in natürlicher Breite statt über die
   ganze Seite; Spaltenköpfe ohne Umbruch (die Zahlenspalten sind sonst 1px schmal gesetzt).
   Doppelte Klasse: .tabelle (width: 100%) und .tabelle--verwaltung (Köpfe white-space: normal)
   stehen weiter unten. */
.tabelle.tabelle--statistik { width: auto; min-width: min(100%, 30rem); }
.tabelle.tabelle--statistik thead th,
.tabelle.tabelle--statistik thead th.zahl { white-space: nowrap; }

/* Administrationshandbuch (/admin/handbuch): aus Markdown gerendert, daher nur Elementselektoren. */
.handbuch { max-width: 75rem; }
.handbuch h2 { margin-top: 2.25rem; padding-top: 1rem; border-top: 1px solid var(--field-01); }
.handbuch h3 { font-size: 1.1rem; margin-top: 1.5rem; }
.handbuch h2, .handbuch h3 { scroll-margin-top: 1rem; }
.handbuch hr { display: none; }
.handbuch li + li { margin-top: .2rem; }
.handbuch .tabelle-huelle { margin: .75rem 0 1rem; }
.handbuch .tabelle td, .handbuch .tabelle th { vertical-align: top; }
.handbuch code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; }
.handbuch :not(pre) > code { padding: .05rem .25rem; background: var(--surface-2); border-radius: 3px; }
.handbuch pre { overflow-x: auto; padding: .75rem 1rem; background: var(--surface-2); border-radius: var(--radius); }
.handbuch blockquote { margin: 1rem 0; padding: .75rem 1rem; background: var(--f-01); border-left: 4px solid var(--brand-01); }
.handbuch blockquote > :first-child { margin-top: 0; }
.handbuch blockquote > :last-child { margin-bottom: 0; }
.handbuch img { display: block; max-width: 100%; height: auto; margin: 1rem 0; }

.kv { list-style: none; margin: 1rem 0; padding: 0; }
.kv li { display: flex; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid var(--field-01); }
.kv li span:first-child { flex: 0 0 8rem; color: var(--text-02); }

.app-footer {
    background: var(--surface-2);
    border-top: 1px solid var(--line);
    padding: 1.25rem 1.4rem;
    color: var(--text-02);
}
.app-footer__links { display: flex; gap: 1.25rem; flex-wrap: wrap; margin: 0 0 .5rem; }
.app-footer__note { margin: 0; font-size: .9rem; }

/* ---------- Formulare (Styleguide S. 34–40): Felder 100 % Breite ---------- */
.form-page { max-width: 32rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-field { flex: 1 1 12rem; }
.form-field { margin-bottom: 1rem; }
.form-field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.form-optional { font-weight: 400; color: var(--text-03); }

.form-control {
    width: 100%;
    padding: .55rem .7rem;
    font: inherit;
    color: var(--text-01);
    background: #fff;
    border: 1px solid var(--field-line);
    border-radius: var(--radius);
}
.form-control:focus-visible { border-color: var(--brand-01); }

.form-field--checkbox { display: flex; align-items: center; gap: .5rem; }
.form-field--checkbox label { margin: 0; font-weight: 400; }

.form-error, .validation-message { color: var(--danger); font-size: .9rem; display: block; margin-top: .25rem; }
/* Fehlerbehaelter (FieldError, Zahl- und Auswahlfeld) stehen immer im Markup, damit
   aria-describedby nie ins Leere zeigt; leer nehmen sie keinen Platz ein. */
.form-error:empty { display: none; }
.form-error__zeile { display: block; }
.form-validation-summary { color: var(--danger); }
.form-alt { margin-top: 1.25rem; }
.form-hint { color: var(--text-02); font-size: .9rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: .6rem 1.4rem;
    font: inherit; font-weight: 600;
    border: 1px solid transparent; border-radius: var(--radius);
    cursor: pointer; text-decoration: none;
    background: transparent; color: var(--brand-01);
}
.btn--primary { background: var(--brand-01); color: #fff; }
.btn--primary:hover { background: var(--brand-02); color: #fff; }
.btn--outline { border-color: var(--brand-01); color: var(--brand-01); }
.btn--outline:hover { background: var(--f-01); color: var(--brand-02); }
/* Flache Variante für Nebenaktionen in Tabellenzeilen und Leisten. */
.btn--flach:hover { background: var(--f-01); color: var(--brand-02); }
.btn--gefahr { background: var(--danger); color: #fff; }
.btn--gefahr:hover { background: var(--danger-hover); color: #fff; }
.btn--gefahr-flach { color: var(--danger); }
.btn--gefahr-flach:hover { background: var(--danger-bg); color: var(--danger-hover); }
.btn--klein { padding: .3rem .7rem; font-size: .85rem; }
.btn--link { background: none; border: none; color: inherit; text-decoration: underline; padding: 0; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Aktionen nebeneinander, statt sie einzeln mit Abständen zu versehen. */
.btn-reihe { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

/* ---------- Meldungen ----------
   Vier Zustände; die ARIA-Rolle setzt die aufrufende Stelle (role="alert" unterbricht,
   role="status" berichtet nur). Rahmen und Text tragen die Aussage mit — Farbe allein genügt
   nicht (WCAG 1.4.1).
*/
.alert {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
}
.alert__inhalt { flex: 1 1 auto; min-width: 0; }
.alert__inhalt > :first-child { margin-top: 0; }
.alert__inhalt > :last-child { margin-bottom: 0; }
.alert--kompakt { padding: .45rem .7rem; font-size: .92rem; }
.alert__schliessen {
    flex: 0 0 auto;
    padding: 0 .2rem; margin: -.1rem 0 0;
    font: inherit; font-size: 1.2rem; line-height: 1.2; color: inherit;
    background: none; border: 0; cursor: pointer;
}
.alert--danger { background: var(--danger-bg); border: 1px solid var(--danger); color: var(--danger-hover); }
.alert--success { background: var(--success-bg); border: 1px solid var(--success); color: var(--success-hover); }
.alert--info { background: var(--f-01); border: 1px solid var(--brand-01); color: var(--text-01); }
.alert--warning { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--text-01); }
.text-danger { color: var(--danger); }

/* Nur für Screenreader – z.B. Überschrift einer Aktionsspalte. */
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    clip-path: inset(50%);
    overflow: hidden; white-space: nowrap;
}

/* ---------- Ladeanzeige ----------
   Unbestimmter Fortschritt als reine CSS-Animation.
*/
.spinner {
    display: inline-block;
    width: 2.5rem; height: 2.5rem;
    border: 3px solid var(--field-01); border-top-color: var(--brand-01);
    border-radius: 50%;
    animation: spinner-dreht 900ms linear infinite;
}
@keyframes spinner-dreht { to { transform: rotate(360deg); } }
/* Nicht abschalten: Ein stehender Kreis sagt nichts mehr aus. Nur deutlich langsamer. */
@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2.5s; }
}

/* ---------- Tabellen ----------
   Kompakte Liste mit Kopfhinterlegung und Zeilenmarkierung beim Überfahren. Die Hülle scrollt
   waagrecht, damit schmale Bildschirme die Seite nicht mitziehen.
*/
/* position: relative macht die Hülle zum Bezugsrahmen der absolut positionierten
   Screenreader-Texte (.visually-hidden) in der Tabelle. Sonst hängen sie am Dokument, stehen
   rechts neben der breiten Tabelle und lassen den Seitenkörper waagrecht scrollen
   (Projektliste bei 400 px: 193 px Überstand). */
.tabelle-huelle { position: relative; overflow-x: auto; }
.tabelle {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--table-02);
}
.tabelle th, .tabelle td {
    padding: .4rem .6rem;
    text-align: left; vertical-align: middle;
    border-bottom: 1px solid var(--table-02);
}
.tabelle thead th {
    font-weight: 600; color: var(--text-02);
    background: var(--table-03);
}
.tabelle tbody tr:hover { background: var(--table-03); }
.tabelle tbody tr:last-child td { border-bottom: 0; }

/* Abschnitt einer Seite, mit Abstand zum naechsten. */
.abschnitt { margin-bottom: 1.5rem; }

.fehlerliste { margin: 0; padding-left: 1.2rem; }

/* ---------- Projektliste ----------
   Je Projekt eine Karte: Kopf (Bezeichnung, Kennzeichen), Angaben, Knopfreihe. Alles bricht um,
   damit die Liste auch im iframe der klimaaktiv-Website und bei 320 px ohne Querscrollen bleibt.
*/
.projekt-neu {
    margin-top: 1rem; padding: 1rem 1.25rem;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.projekt-karten { list-style: none; margin: 0; padding: 0; }
.projekt-karte {
    min-width: 0; margin: 0 0 .75rem; padding: .75rem 1rem;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.projekt-karte__kopf { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; }
.projekt-karte__kopf .badge { margin: 0; }
.projekt-karte__titel { min-width: 0; margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
/* Block statt Zeile im Fließtext: Die Klickfläche bekommt ihre 24 px Höhe (WCAG 2.5.8). */
.projekt-karte__titel a { display: inline-block; padding: .15rem 0; }
.projekt-karte__angaben { margin: .25rem 0 0; color: var(--text-02); font-size: .9rem; overflow-wrap: anywhere; }
.projekt-karte__aktionen { margin-top: .6rem; gap: .35rem; }
.projekt-karte__umbenennen { margin-top: .6rem; }
.projekt-karte__umbenennen .form-field { margin-bottom: .5rem; }
.projekt-karte__umbenennen .btn-reihe { margin-top: .5rem; }
.projekt-karte__freigabe { margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.projekt-karte__freigabe h4 { margin: 0 0 .4rem; font-size: 1rem; color: var(--brand-02); }
.projekt-karte__freigabe p { margin: 0 0 .75rem; }
.projekt-karte__freigabe .btn-reihe { margin-top: .5rem; }

/* Feldgruppen im Formular: <fieldset>/<legend> gibt Screenreadern die Gruppenzugehörigkeit. */
/* min-width: 0 — ein <fieldset> ist sonst mindestens so breit wie sein Inhalt (min-content):
   Der Regel-Diff ließ den Förder-Editor bei 400 px um 2.600 px überstehen, der Maßnahmen-Editor
   stand bei 320 px 26 px über. */
.feldgruppe {
    min-width: 0;
    border: 1px solid var(--field-01);
    border-radius: var(--radius);
    padding: 1rem 1.25rem 1.25rem;
    margin: 0 0 1.5rem;
}
.feldgruppe > legend {
    padding: 0 .4rem;
    font-weight: 700;
    color: var(--brand-02);
}
.feldgruppe > * + * { margin-top: 1rem; }

/* ---------- Schritt 2: Maßnahmenwahl ----------
   Gliederung Bereich → Gruppe → Maßnahme. Ein Bereich ist ein aufklappbares <details>; die
   Kopfzeile trägt die Bereichsnummer und sagt, was darin gewählt ist, ohne dass man aufklappen muss.
*/
.massnahmen-hinweis {
    display: flex; gap: .6rem; align-items: flex-start;
    margin: 0 0 1rem;
    padding: .7rem .9rem;
    border: 1px dashed var(--brand-01); border-radius: var(--radius);
    background: var(--f-01);
    font-size: .85rem; color: var(--text-02);
}
.massnahmen-hinweis__marke { color: var(--brand-01); font-weight: 700; }

.bereich {
    margin-bottom: .6rem;
    border: 1px solid var(--field-01); border-radius: var(--radius);
    background: var(--bg);
    overflow: hidden;
}
.bereich__kopf {
    display: flex; align-items: center; gap: .7rem;
    padding: .8rem 1rem;
    font-weight: 600; font-size: .95rem;
    cursor: pointer;
    list-style: none;
}
.bereich__kopf::-webkit-details-marker { display: none; }
.bereich__kopf:hover { background: var(--table-03); }
/* Ring nach innen: .bereich schneidet mit overflow: hidden alles ab, was über ihn hinausragt —
   am zugeklappten Bereich bliebe vom äußeren Ring nichts übrig. */
.bereich__kopf:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--brand-01); }
.bereich__num {
    flex: 0 0 1.5rem; width: 1.5rem; height: 1.5rem;
    display: grid; place-items: center;
    border-radius: var(--radius);
    background: var(--f-01); color: var(--brand-02);
    font-size: .78rem; font-weight: 700;
}
.bereich__fueller { flex: 1; }
.bereich__wahl { font-size: .8rem; font-weight: 600; color: var(--text-03); text-align: right; }
.bereich__wahl--gesetzt { color: var(--success); }
.bereich__pfeil { color: var(--text-03); transition: transform .15s; }
.bereich[open] .bereich__pfeil { transform: rotate(90deg); }
.bereich__inhalt { padding: .25rem 1rem 1rem; border-top: 1px solid var(--field-01); }
.bereich__sub, .bereich__leer {
    margin: .7rem 0 0; font-size: .82rem; color: var(--text-03);
}

/* Untergruppe: fieldset/legend, damit die Gruppenzugehörigkeit vorgelesen wird. */
.untergruppe { border: none; margin: .9rem 0 0; padding: 0; }
.untergruppe__titel {
    padding: 0; margin-bottom: .45rem;
    font-size: .85rem; font-weight: 600; color: var(--text-02);
}
.untergruppe__regel { font-weight: 400; color: var(--text-03); }

/*
  Auswahl-Pillen. Die <input> sind echte Radios bzw. Checkboxen — visuell ersetzt, aber im Baum
  vorhanden und fokussierbar (nicht display:none, das nähme ihnen Tastatur und Screenreader).
  Der gewählte Zustand hängt nicht an der Farbe allein: das Häkchen und die stärkere Schrift
  tragen ihn mit.
*/
.pillen { display: flex; flex-wrap: wrap; gap: .5rem; }
.pille { position: relative; display: inline-flex; }
.pille input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pille label {
    display: inline-block;
    padding: .35rem .85rem;
    border: 1.5px solid var(--field-01); border-radius: 999px;
    background: var(--bg); color: var(--text-02);
    font-size: .85rem; cursor: pointer;
}
.pille label:hover { border-color: var(--brand-01); }
.pille input:checked + label {
    border-color: var(--brand-01); border-width: 2px;
    padding: calc(.35rem - 1px) calc(.85rem - 1px);
    background: var(--f-01); color: var(--brand-02); font-weight: 600;
}
/* Der Haken ist Optik: Dass die Option gewählt ist, sagt das Radio ohnehin an. Die leere
   Alternative nach dem Schrägstrich hält ihn aus der Vorlesestimme heraus. */
.pille input:checked + label::before { content: "✓ " / ""; }
.pille input:focus-visible + label { box-shadow: var(--ring); }
.pille__code { margin-left: .35rem; font-size: .72rem; font-weight: 400; color: var(--text-03); }
.pille input:checked + label .pille__code { color: var(--brand-01); }

/* „keine (Erhaltung)" ist die Grundstellung, kein Erfolg — deshalb neutral statt in Markenfarbe. */
.pille--neutral input:checked + label {
    border-color: var(--field-line);
    background: var(--table-03); color: var(--text-02);
}
.pille--neutral input:checked + label .pille__code { color: var(--text-03); }

/* Maßnahmenregeln: Hinweis unter der Option — Begründung einer greifenden Regel oder die
   Erläuterung der Maßnahme. Gesperrt = nicht wählbar und nicht gewählt; Konflikt = gewählt, aber
   nicht (mehr) zulässig. Beides trägt Text, nicht nur Farbe/Strichart. */
.pillen { align-items: flex-start; }
.pille--mit-hinweis { flex-direction: column; align-items: flex-start; }
.pille__hinweis { max-width: 24rem; margin: .2rem .85rem 0; font-size: .72rem; color: var(--text-03); }
.pille input:disabled { cursor: not-allowed; }
.pille input:disabled + label {
    border-style: dashed; background: var(--table-03); color: var(--text-03); cursor: not-allowed;
}
.pille input:disabled + label:hover { border-color: var(--field-01); }
.pille--konflikt input:checked + label { border-color: var(--danger); }
.pille--konflikt .pille__hinweis { color: var(--danger); }

.massnahmen-aktionen { margin-top: 1.25rem; }

/* Optionale Leistungen: Aufklapper je gewählter Maßnahme unter ihrer Gruppe. Knopf mit
   aria-expanded; der Pfeil dreht wie am Bereich. Native Checkboxen in Zeilen — die langen
   Leistungstexte brechen als Zeile um, als Pille nicht. */
.optionen { margin: .45rem 0 0; }
.optionen__schalter {
    display: inline-flex; align-items: center; gap: .45rem;
    min-height: 2rem; padding: .25rem .5rem; margin-left: -.5rem;
    border: none; border-radius: var(--radius); background: none;
    color: var(--brand-02); font: inherit; font-size: .82rem; font-weight: 600; text-align: left;
    cursor: pointer;
}
.optionen__schalter:hover { background: var(--f-01); }
.optionen__schalter:focus-visible { outline: none; box-shadow: var(--ring); }
.optionen__pfeil { transition: transform .15s; }
.optionen__schalter[aria-expanded="true"] .optionen__pfeil { transform: rotate(90deg); }
.optionen__stand { font-weight: 400; color: var(--text-03); }
.optionen__inhalt { margin: .2rem 0 0 .2rem; padding: .25rem 0 .25rem .85rem; border-left: 3px solid var(--f-01); }
.optionen__gruppe { border: none; margin: 0; padding: 0; min-width: 0; }
.optionen__hinweis { margin: .25rem 0; font-size: .8rem; color: var(--text-03); }
.optionen__liste { margin: 0; padding: 0; list-style: none; }
.option { display: flex; align-items: flex-start; gap: .55rem; padding: .3rem 0; font-size: .85rem; color: var(--text-02); }
.option input { flex: 0 0 auto; width: 1.15rem; height: 1.15rem; margin: .1rem 0 0; accent-color: var(--brand-01); cursor: pointer; }
.option input:focus-visible { outline: 3px solid var(--brand-01); outline-offset: 2px; }
.option label { cursor: pointer; }
.option__nummer { margin-left: .35rem; font-size: .72rem; color: var(--text-03); }
.option__preis { margin-left: .4rem; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Pflichtgruppen optionaler Leistungen (Issue #16): immer offen unter der gewählten Maßnahme, mit
   derselben Randlinie wie der aufgeklappte Inhalt — „genau eine" als Radios, „mindestens eine" als
   Checkboxen. Die Legende sagt Gruppe, Maßnahme und Regel; ein Verstoß steht als Text darunter. */
.pflichtgruppe { margin: .45rem 0 0 .2rem; padding: .25rem 0 .25rem .85rem; border: none; border-left: 3px solid var(--f-01); min-width: 0; }
.pflichtgruppe__legende { padding: 0; font-size: .82rem; font-weight: 600; color: var(--brand-02); }
.pflichtgruppe__regel { font-weight: 400; color: var(--text-03); }
.pflichtgruppe--fehlt { border-left-color: var(--danger); }
.pflichtgruppe__fehler { margin: .2rem 0 0; font-size: .8rem; color: var(--danger); }

/* ---------- Blazor-Fehleranzeige ---------- */
#blazor-error-ui {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: .8rem 1.25rem;
    background: var(--warning); color: var(--text-01);
    box-shadow: 0 -1px 4px rgba(0,0,0,.2);
}
#blazor-error-ui .reload { color: var(--brand-02); }
#blazor-error-ui .dismiss {
    float: right; min-width: 1.75rem; min-height: 1.75rem;
    font: inherit; font-size: 1.2rem; line-height: 1;
    color: var(--text-01); background: none; border: none; cursor: pointer;
}

/* ---------- Dialog „Verbindung unterbrochen" (ReconnectModal) ----------
   Blazor setzt nur die Zustandsklassen components-reconnect-show/-failed/-rejected/-hide;
   ReconnectModal.razor.js öffnet den Dialog modal. Welcher Text und welche Knöpfe zu sehen
   sind, steht allein hier — ohne Inline-Stile (CSP style-src ohne 'unsafe-inline'). */
.reconnect {
    width: min(32rem, calc(100vw - 2rem));
    padding: 1.5rem;
    border: 1px solid var(--line-strong);
    border-top: 4px solid var(--brand-02);
    border-radius: var(--radius-lg);
    background: var(--surface); color: var(--text-01);
    box-shadow: var(--shadow);
}
.reconnect::backdrop { background: rgba(16, 65, 102, .45); }
/* Der Dialog selbst erhält den Fokus nur, solange keine Aktion sichtbar ist (Ansage durch role=alertdialog). */
.reconnect:focus { outline: none; }
.reconnect__titel { margin: 0 0 .5rem; font-size: 1.25rem; color: var(--brand-02); }
.reconnect__text { display: none; margin: 0; }
.reconnect__versuch { white-space: nowrap; }
.reconnect__erneut, .reconnect__neu-laden { display: none; }
.components-reconnect-show .reconnect__text--verbinden,
.components-reconnect-failed .reconnect__text--gescheitert,
.components-reconnect-rejected .reconnect__text--abgelaufen { display: block; }
.components-reconnect-failed .reconnect__erneut,
.components-reconnect-failed .reconnect__neu-laden,
.components-reconnect-rejected .reconnect__neu-laden { display: inline-block; }
.components-reconnect-show .reconnect__aktionen { display: none; }

/* ---------- Projekt-Assistent (Schritt 0–4) ----------
   Der Assistent trägt seine Navigation selbst: Schrittleiste oben, Kontext-Rail rechts,
   Vor/Zurück in der Fußleiste. Die Seitenleiste der App tritt dafür zurück, und der Inhalt
   darf die Breitenbegrenzung der übrigen Seiten überschreiten.
*/
.app-body:has(.assistent) .app-nav { display: none; }
.app-main:has(.assistent) { padding: 0; }
.app-main__content:has(.assistent) { max-width: none; }

.assistent { display: flex; flex-direction: column; }

/* Schrittleiste */
.assistent__stepper {
    display: flex;
    gap: .25rem;
    padding: .75rem 1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}
.schritt {
    flex: 1 1 0;
    min-width: 9.5rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .6rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-02);
    position: relative;
}
.schritt:hover { background: rgba(40, 111, 156, .08); }
.schritt__num {
    flex: 0 0 1.6rem;
    width: 1.6rem; height: 1.6rem;
    display: grid; place-items: center;
    border-radius: 50%;
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    font-size: .8rem; font-weight: 700;
}
.schritt__lbl { font-size: .78rem; line-height: 1.25; }
.schritt__lbl b { display: block; font-size: .85rem; font-weight: 600; color: var(--text-01); }
.schritt--aktiv { color: var(--text-01); }
.schritt--aktiv .schritt__num { background: var(--brand-01); border-color: var(--brand-01); color: #fff; }
.schritt--aktiv::after {
    content: "";
    position: absolute; left: .6rem; right: .6rem; bottom: -.8rem;
    height: 3px; border-radius: 3px; background: var(--accent);
}
.schritt--erledigt .schritt__num { background: var(--success); border-color: var(--success); color: #fff; }

/* Inhalt + Kontext-Rail */
.assistent__layout { display: grid; grid-template-columns: minmax(0, 1fr) 18.5rem; }
.assistent__inhalt { padding: 1.6rem 1.9rem 1.9rem; min-width: 0; }
/* Die Rail selbst hat keine Fläche und keine Trennlinie: Sie gliedert sich in Inseln
   (.rail-box), wie die rechte Spalte auf klimaaktiv.at. Höhe aus dem Inhalt — eine Insel darf
   wachsen (Datenstand-Vorschau). */
.assistent__rail {
    display: flex; flex-direction: column; gap: 1.5rem;
    padding: 1.6rem 1.4rem 1.9rem 0;
    min-width: 0;
}
/* 53rem = 848 px: Die Rail klappt schon auf Tablet-Breite unter den Inhalt. Bei 820 px blieben
   dem Formular neben der 18,5rem breiten Rail keine 34rem — zu wenig für das Dreierraster.
   Darunter stehen die Inseln untereinander, eingerückt wie der Inhalt. */
@media (max-width: 53rem) {
    .assistent__layout { grid-template-columns: 1fr; }
    .assistent__rail { padding: 0 1.9rem 1.9rem; }
}

/* Insel der Rail (RailBox). Maße nach klimaaktiv.at: Fläche #f0f4f5, Radius 10 px,
   Innenabstand 17 px, Abstand 24 px, Überschrift 17 px in normaler Schreibung und Strichstärke.
   Kontraste auf --surface-2: --brand-02 9,6:1, --text-02 7,6:1, --text-03 5,0:1. */
.rail-box {
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    padding: 1.0625rem;
    font-size: .875rem;
    color: var(--text-02);
    overflow-wrap: break-word;
}
.rail-box__titel { font-size: 1.0625rem; font-weight: 400; margin: 0 0 .5rem; }
.rail-box p { margin: 0 0 .6rem; }
.rail-box > :last-child { margin-bottom: 0; }
/* Ohne neueren Datenstand bleibt der Hinweis leer; sein Abstand soll die Insel nicht strecken. */
.rail-box .datenstand-hinweis:empty { display: none; }

/* Kopfbereich einer Schrittseite */
.schritt-eyebrow {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--brand-01); font-weight: 700; margin: 0;
}
.schritt-titel { font-size: 1.5rem; margin: .3rem 0 .25rem; }
.schritt-lede { color: var(--text-02); max-width: 62ch; margin: 0 0 1.4rem; }

/* Fußnavigation – im Fluss, nicht am Viewport fixiert (iframe-Betrieb). */
.assistent__navbar {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    padding: 1rem 1.9rem;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
}
.assistent__navbar .sp { flex: 1 1 auto; }
.assistent__fortschritt { font-size: .82rem; color: var(--text-03); }

/* ---------- Hilfe: ?-Knöpfe, Begriffe im Text, Glossar-Insel (Issue #7) ----------
   Ein Klick-Popover (HilfePopover) für beides: ?-Knopf am Feld und Begriff im Fließtext. Die Blase
   liegt absolut unter ihrem Anker im Fluss der Seite — kein position: fixed, keine Viewport-Höhe
   (iframe-Betrieb). Breite aus dem umgebenden Feld bzw. Absatz, damit sie auf 320 px nicht übersteht.
*/
/* Beschriftung + ?-Knopf in einer Zeile. Der Knopf ist 24 px groß (WCAG 2.5.8), ragt aber mit
   negativem Rand über die Zeile hinaus — Felder mit und ohne Hilfe stehen auf gleicher Höhe. */
.hilfe-kopf {
    position: relative;
    display: flex; align-items: center; gap: .35rem;
    margin-bottom: .3rem;
}
.hilfe-kopf > .feld__label { margin-bottom: 0; }
/* Die Hülle ohne eigene Zeilenbox: Sonst trüge sie die Zeilenhöhe der Seite und höbe die Zeile doch an. */
.hilfe--feld { display: flex; align-items: center; }
.hilfe__knopf {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.5rem; height: 1.5rem; margin: -.25rem 0;
    padding: 0;
    font: inherit; font-size: .8rem; font-weight: 700; line-height: 1;
    color: var(--brand-01); background: var(--surface);
    border: 1px solid var(--brand-01); border-radius: 50%;
    cursor: pointer;
}
.hilfe__knopf:hover { background: var(--f-01); color: var(--brand-02); }
.hilfe__knopf[aria-expanded="true"] { background: var(--brand-01); color: #fff; }

/* Begriff im Satz: bleibt Text (display: inline — Ausnahme „Inline" von 2.5.8), punktiert
   unterstrichen. Die Unterstreichung trägt die Markierung, nicht die Farbe (WCAG 1.4.1). */
.begriff__knopf {
    display: inline;
    padding: 0; margin: 0;
    font: inherit; color: inherit; text-align: inherit;
    background: none; border: 0; border-radius: 2px;
    text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: .2em;
    cursor: pointer;
}
.begriff__knopf:hover,
.begriff__knopf[aria-expanded="true"] {
    color: var(--brand-02); background: var(--f-01);
    text-decoration-style: solid;
}

/* Die Live-Region steht immer im Markup (Ansage beim Öffnen) und nimmt geschlossen keinen Platz ein. */
.hilfe__blase {
    position: absolute; z-index: 20;
    display: block;
    margin-top: .35rem;
    padding: .6rem .75rem;
    font-size: .82rem; font-weight: 400; font-style: normal; line-height: 1.45;
    color: var(--text-01); text-align: left; white-space: normal;
    background: var(--surface);
    border: 1px solid var(--brand-01); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.hilfe__titel { display: block; margin-bottom: .15rem; font-weight: 700; color: var(--brand-02); }
/* „Wo steht das?" nach dem Hilfetext (Issue #13): Abstand nach oben statt neuer Blase. */
.hilfe__titel--fundstelle { margin-top: .45rem; }
/* Am Feld: unter der Beschriftungszeile, mindestens 16rem breit (schmale Spalten im Dreierraster). */
.hilfe--feld .hilfe__blase { top: 100%; left: 0; width: max(100%, 16rem); }
/* Im Fließtext: unter der Zeile des Begriffs, so breit wie der Absatz (höchstens 28rem). */
:where(p, li, dd, div):has(> .hilfe--begriff) { position: relative; }
.hilfe--begriff .hilfe__blase { left: 0; width: min(100%, 28rem); }

/* Glossar-Insel: Begriffe des Schritts nach Abschnitt (h3 unter der h2 der Insel). */
.glossar__abschnitt { margin: .9rem 0 .3rem; font-size: .8rem; font-weight: 700; color: var(--brand-02); }
.rail-box__titel + .glossar__abschnitt { margin-top: 0; }
.glossar__liste { margin: 0; }
.glossar__begriff { font-weight: 600; color: var(--text-01); }
.glossar__definition { margin: .1rem 0 .6rem; }
.glossar__liste > :last-child { margin-bottom: 0; }

@media print {
    .hilfe__knopf, .hilfe__ansage { display: none; }
}

/* ---------- Schritt 0: Vorentscheidungen ---------- */
.vorentscheidung { border: none; margin: 0 0 1.6rem; padding: 0; }
.vorentscheidung__label {
    display: flex; align-items: center; gap: .5rem;
    padding: 0;
    font-size: .95rem; font-weight: 700;
}
.pflicht { color: var(--danger); }
.vorentscheidung__sub { margin: .25rem 0 .75rem; font-size: .85rem; color: var(--text-02); }
.vorentscheidung__select {
    font: inherit; font-size: .95rem;
    width: 100%; max-width: 21rem;
    padding: .55rem .75rem;
    border: 1px solid var(--field-line); border-radius: var(--radius);
    background: var(--bg); color: var(--text-01);
}
.vorentscheidung__select:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--brand-01); }

/*
  Auswahlkacheln. Echte Radiogroup: Die <input> sind visuell versteckt, aber im Baum vorhanden und
  fokussierbar — Tastatur, Screenreader und Formularübermittlung funktionieren ohne Skripting.
  Nicht per display:none/visibility ausblenden, das nähme ihnen genau das.
*/
.kacheln {
    display: grid; gap: .75rem;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}
.kachel {
    position: relative;
    display: flex; flex-direction: column; gap: .25rem;
    padding: .9rem;
    border: 1.5px solid var(--field-01); border-radius: var(--radius);
    background: var(--bg); cursor: pointer;
}
.kachel:hover { border-color: var(--brand-01); }
.kachel input { position: absolute; opacity: 0; pointer-events: none; }
.kachel__symbol { font-size: 1.25rem; line-height: 1; }
.kachel__titel { font-weight: 600; font-size: .95rem; }
.kachel__text { font-size: .82rem; color: var(--text-02); }
.kachel__haken {
    position: absolute; top: .6rem; right: .6rem;
    width: 1.15rem; height: 1.15rem; border-radius: 50%;
    background: var(--brand-01); color: #fff;
    display: none; place-items: center; font-size: .7rem;
}
.kachel:has(input:checked) {
    border-color: var(--brand-01);
    background: var(--f-01);
    box-shadow: inset 0 0 0 1px var(--brand-01);
}
.kachel:has(input:checked) .kachel__titel { color: var(--brand-02); }
.kachel:has(input:checked) .kachel__haken { display: grid; }
.kachel:has(input:focus-visible) { box-shadow: var(--ring); }
/* Derzeit nicht wählbar: sichtbar, aber ausgegraut — die Schrift behält ausreichend Kontrast. */
.kachel:has(input:disabled) {
    cursor: not-allowed;
    border-style: dashed;
    background: var(--surface-2);
}
.kachel:has(input:disabled):hover { border-color: var(--field-01); }
.kachel:has(input:disabled) .kachel__titel,
.kachel:has(input:disabled) .kachel__text { color: var(--text-03); }
.kachel:has(input:disabled) .kachel__symbol { filter: grayscale(1); opacity: .6; }

/* Was die Vorentscheidungen in den Folgeschritten bewirken. */
.filterwirkung {
    border: 1px dashed var(--brand-01);
    border-radius: var(--radius);
    background: var(--f-01);
    padding: .8rem 1rem;
    margin: 0 0 1.5rem;
    font-size: .88rem; color: var(--text-02);
}
.filterwirkung__titel { margin: 0 0 .35rem; font-weight: 700; color: var(--brand-02); }
.filterwirkung ul { margin: 0; padding-left: 1.2rem; }

.gegenstandslos__titel { margin: 0 0 .4rem; }

/* ---------- Schritt 1: Gebäudedaten ----------
   Das Formular ist in vier Absätze gegliedert; die Unterzeile sagt, was ein Absatz abfragt.
   Den Badge nutzt auch Schritt 3 (Bundesland an der Landesförderung).
*/
.absatz { border: none; margin: 0 0 1.75rem; padding: 0; }
.absatz > legend {
    display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
    width: 100%; padding: 0;
    font-size: 1rem; font-weight: 700; color: var(--brand-02);
}
.absatz__badge {
    padding: .1rem .5rem;
    font-size: .69rem; font-weight: 700; letter-spacing: .03em;
    color: var(--brand-01); background: var(--f-01);
    border-radius: 999px;
}
.absatz__sub { margin: .25rem 0 .9rem; font-size: .82rem; color: var(--text-03); }
.absatz__sub em { font-style: italic; }

/* Zwei- bzw. dreispaltiges Raster; unter 620px einspaltig. */
.raster2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1.15rem; }
.raster3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .9rem 1.15rem; }
.raster__breit { grid-column: 1 / -1; }
@media (max-width: 38.75rem) {
    .raster2, .raster3 { grid-template-columns: 1fr; }
}

/* Feld + Fußnote als eine Rasterzelle. */
.feld { display: flex; flex-direction: column; min-width: 0; }
.fnote { margin-top: .25rem; font-size: .78rem; line-height: 1.35; color: var(--text-03); }
/* Fundstelle und Hinweis untereinander (Issue #13): Die zweite Fußnote rückt nur knapp ab. */
.fnote--fundstelle + .fnote { margin-top: .1rem; }
/* Formelzeichen in der Beschriftung (HWB mit tiefgestelltem Index): Die Zeilenhöhe bleibt ruhig. */
.symbol sub { font-size: .75em; line-height: 0; }

/*
  Natives Auswahlfeld im Raster. Die Beschriftung steht darueber statt im Feld zu schweben: Sie
  bleibt damit auch bei langen Titeln und schmalen Spalten vollstaendig lesbar, und das Menue
  zeichnet der Browser — auf dem Telefon als Systemauswahl.
*/
.feld__label {
    margin-bottom: .3rem;
    font-size: .8rem; font-weight: 600; color: var(--text-02);
}
/* Pflichtstern. Die zweite Angabe gibt ihm einen leeren Alternativtext — der Screenreader liest
   aria-required statt „Stern"; ältere Browser nehmen die erste. */
.feld__label--pflicht::after {
    content: " *";
    content: " *" / "";
    color: var(--danger);
}
.feld__select {
    font: inherit; font-size: .95rem;
    width: 100%; min-width: 0;
    padding: .5rem .65rem;
    color: var(--text-01); background: var(--bg);
    border: 1px solid var(--field-line); border-radius: var(--radius);
}
.feld__select:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--brand-01); }

/* Freitextfeld im selben Raster (Adresse) — Anmutung wie das Auswahlfeld. */
.feld__eingabe {
    font: inherit; font-size: .95rem;
    width: 100%; min-width: 0;
    padding: .5rem .65rem;
    color: var(--text-01); background: var(--bg);
    border: 1px solid var(--field-line); border-radius: var(--radius);
}
.feld__eingabe:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--brand-01); }

/*
  Zahlenfeld: Rahmen und Fokusring liegen an der Hülle, damit die angesetzte Einheit innerhalb
  des Rahmens sitzt und nicht daneben. Vorgelesen wird sie über aria-describedby, nicht über
  dieses Markup.
*/
.zahlfeld {
    display: flex; align-items: stretch;
    min-width: 0;
    background: var(--bg);
    border: 1px solid var(--field-line); border-radius: var(--radius);
}
.zahlfeld:focus-within { box-shadow: var(--ring); border-color: var(--brand-01); }
.zahlfeld__eingabe {
    font: inherit; font-size: .95rem;
    flex: 1 1 auto; min-width: 0; width: 100%;
    padding: .5rem .65rem;
    color: var(--text-01); background: transparent;
    border: 0; border-radius: inherit;
}
/* Der Ring sitzt an der Hülle; ein zweiter am Feld selbst wäre ein Ring im Ring. */
.zahlfeld__eingabe:focus-visible { outline: none; }
.zahlfeld__eingabe[readonly] { cursor: default; }
.zahlfeld__einheit {
    display: flex; align-items: center;
    padding: 0 .65rem;
    font-size: .8rem; line-height: 1.2; color: var(--text-02);
    background: var(--surface-2);
    border-left: 1px solid var(--field-01);
    border-radius: 0 var(--radius) var(--radius) 0;
    white-space: nowrap;
}

/*
  Berechnete bzw. herangezogene Werte sind hinterlegt — so hält es auch das Beratungstool.
  Die Hinterlegung allein trägt keine Information: Die Fußnote benennt den Wert im Klartext.
  Die zweite Rahmenlinie kommt als Innenschatten, damit die Zelle nicht um ein Pixel springt,
  sobald die Hervorhebung wechselt.
*/
.feld--hervorgehoben .zahlfeld {
    background: var(--warn-bg);
    border-color: var(--warn-line); box-shadow: inset 0 0 0 1px var(--warn-line);
}
.feld--hervorgehoben .zahlfeld:focus-within { box-shadow: var(--ring), inset 0 0 0 1px var(--warn-line); }
.feld--hervorgehoben .zahlfeld__einheit { background: transparent; border-left-color: var(--warn-line); }
.feld--hervorgehoben .fnote { color: #7a6a12; font-weight: 600; }

/*
  Auswahl als Radiogruppe bzw. Mehrfachauswahl im Raster (Issue #21): fieldset/legend ohne
  Browser-Rahmen, sonst wie ein Feld. Die Optionen sind die Pillen der Maßnahmenwahl.
*/
.wahlfeld { border: 0; margin: 0; padding: 0; min-width: 0; }
.wahlfeld > legend { padding: 0; }
.pille__symbol { display: inline-flex; vertical-align: middle; margin-right: .35rem; }
.bauweise-symbol { display: block; }
.bauweise-symbol__gebaeude { fill: currentColor; }
.bauweise-symbol__nachbar { fill: currentColor; opacity: .35; }

/* Wohnnutzfläche: ein Feld, darunter der Knopf zurück zum berechneten Wert. */
.wnf { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; min-width: 0; }
.wnf > .feld { align-self: stretch; }
.wnf__zuruecksetzen { margin-left: -.5rem; }

/* „Ergänzende Informationen": aufklappbar unter der Normalansicht, Kopf wie ein Maßnahmenbereich. */
.ergaenzend {
    margin: 0 0 1.75rem;
    border: 1px solid var(--field-01); border-radius: var(--radius);
    background: var(--bg);
}
.ergaenzend__kopf {
    padding: .75rem 1rem;
    font-size: 1rem; font-weight: 700; color: var(--brand-02);
    cursor: pointer;
}
.ergaenzend__kopf:hover { background: var(--table-03); }
.ergaenzend__kopf:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--brand-01); }
.ergaenzend__inhalt { padding: 0 1rem 1rem; }

/* ---------- Schritt 2: Szenario-Tabs ----------
   Die Tabs sitzen auf der Trennlinie: Der aktive Tab bricht sie auf (eigene Unterkante in
   Flaechenfarbe) und traegt innen die gelbe Akzentkante des Mockups.
*/
.szenario-tabs {
    display: flex; align-items: center; flex-wrap: wrap; gap: .4rem;
    border-bottom: 2px solid var(--line);
    margin-bottom: .2rem;
}

/* In Schritt 2 steht neben der Tableiste, was Szenarien verwaltet. Die Trennlinie traegt dann
   die Zeile, nicht die Leiste — sonst liefe sie unter „+ Szenario" durch. */
.szenario-leiste {
    display: flex; align-items: center; flex-wrap: wrap; gap: .4rem;
    border-bottom: 2px solid var(--line);
    margin-bottom: .2rem;
}
.szenario-leiste .szenario-tabs { border-bottom: none; margin-bottom: 0; }
.szenario-umbenennen { display: inline-flex; align-items: center; gap: .25rem; }

.szenario-tab {
    display: flex; align-items: center; gap: .5rem;
    margin-bottom: -2px;
    font-family: inherit; font-size: .88rem; font-weight: 600;
    padding: .55rem .95rem;
    color: var(--text-02); background: var(--surface-2);
    border: 1px solid var(--line); border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
}
.szenario-tab:hover { color: var(--brand-02); }
/* Aktiver Tab: Das CI-Gelb hält auf Weiß nur 1,4:1, die Fläche Weiß gegen --surface-2 nur
   1,1:1 — als Zustandsanzeiger zu schwach (WCAG 1.4.11). Die dunkle Kante über dem
   gelben Streifen trägt den Zustand: --brand-02 hält 10,7:1 zu Weiß und 7,6:1 zum Gelb. */
.szenario-tab--aktiv {
    color: var(--brand-02); background: var(--surface);
    border-bottom: 2px solid var(--surface);
    box-shadow: 0 -3px 0 var(--accent) inset, 0 -5px 0 var(--brand-02) inset;
}
.szenario-tab__badge {
    padding: .05rem .4rem;
    font-size: .62rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
    color: var(--brand-01); background: var(--f-01);
    border-radius: 999px;
}

/* Stift bzw. Haken zum Umbenennen — neben dem Tab, nicht darin: kein Button im Button. */
.szenario-tab__stift {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.75rem; min-height: 1.75rem;
    padding: .2rem .4rem;
    font-family: inherit; font-size: .85rem; line-height: 1;
    color: var(--brand-01); background: none; border: none; cursor: pointer;
}
.szenario-tab__stift:hover { color: var(--brand-02); }

.szenario-tab__eingabe {
    font-family: inherit; font-size: .88rem; font-weight: 600;
    padding: .5rem .7rem; width: 12rem;
    color: var(--text-01); background: var(--surface);
    border: 1px solid var(--brand-01);
    border-radius: var(--radius) var(--radius) 0 0;
}

.szenario-neu {
    padding: .5rem .75rem;
    font-family: inherit; font-size: .85rem; font-weight: 600;
    color: var(--brand-01); background: transparent;
    border: 1px dashed var(--line-strong); border-radius: var(--radius);
    cursor: pointer;
}
.szenario-neu:hover { border-color: var(--brand-01); background: var(--f-01); }
.szenario-neu:disabled { color: var(--text-03); border-color: var(--field-01); cursor: not-allowed; }

.szenario-panel { padding-top: 1.1rem; }
.szenario-aktionen { display: flex; justify-content: flex-end; gap: .5rem; margin-bottom: .9rem; }

/* ---------- Schritt 2: KPI-Leiste ----------
   Drei Kacheln ueber der Maßnahmenliste. Die Investitionskachel traegt die gelbe Akzentkante —
   sie ist die Zahl, auf die im Gespraech gezeigt wird.
*/
.kpi-leiste { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0 0 1.25rem; }
/* Die Kachel ist eine Begriffsliste (<dl>): Ihre Vorgabe-Abstaende muessen weg. */
.kpi {
    flex: 1 1 10rem;
    margin: 0;
    padding: .7rem .9rem;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
}
.kpi dd { margin-left: 0; }
.kpi--akzent { border-left: 4px solid var(--accent); }
.kpi__label {
    font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--text-02);
}
.kpi__wert {
    margin: .1rem 0 0;
    font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums;
    color: var(--text-01);
}
.kpi__wert small { font-size: .75rem; font-weight: 600; color: var(--text-02); }

/* Die Kennzeichnung sitzt an der Kachel, nicht im Kleingedruckten. */
.kpi__beispielwert,
.kpi__kennzeichen {
    margin: .25rem 0 0;
    font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--text-02);
}

/* Preis an der Option und Summe in der Bereichs-Kopfzeile. */
.pille__preis {
    margin-left: .4rem;
    font-size: .74rem; font-weight: 600; font-variant-numeric: tabular-nums;
    color: var(--text-02);
}
.pille input:checked + label .pille__preis { color: var(--brand-02); }
.bereich__summe {
    margin-right: .75rem;
    font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums;
    color: var(--text-02);
}

/* ---------- Schritt 3: Foerderdaten ----------
   Eine Zeile je Foerderung: Gebiets-Badge, Bezeichnung mit Untertitel, Schalter. Keine der
   Bezeichnungen steht im Markup — die Liste kommt aus den Stammdaten des Datenstands.
*/
.fund-list { display: flex; flex-direction: column; gap: .5rem; margin: .25rem 0 .75rem; }

.fund {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .7rem .9rem;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
}

/* Abgewaehlt: zurueckgenommen, aber lesbar — die Zeile bleibt eine Information. */
.fund--aus { background: var(--table-03); border-style: dashed; }
.fund--aus .fund__name { color: var(--text-02); text-decoration: line-through; }

.badge {
    flex: 0 0 auto; margin-top: .1rem;
    padding: .1rem .5rem;
    font-size: .68rem; font-weight: 700; letter-spacing: .02em;
    border-radius: 999px; white-space: nowrap;
}
.badge--bund { color: var(--brand-02); background: var(--f-01); }
.badge--land { color: var(--success); background: var(--success-bg); }
/* Neutraler Zustand, z.B. „öffentlich geteilt" in der Projektliste. */
.badge--info { margin-left: .4rem; color: var(--brand-02); background: var(--f-01); }

/* Datenstand: Badge am Projekt, Unterschiede zweier Stände, Pflichtprüfungen. */
.badge--datenstand { color: var(--brand-02); background: var(--accent); }
.badge--entfernt { color: var(--danger); background: var(--danger-bg); }
.datenstand-aenderungen { list-style: none; margin: .5rem 0 1rem; padding: 0; }
.datenstand-aenderung {
    display: flex; gap: .5rem; align-items: flex-start;
    padding: .35rem 0; border-bottom: 1px solid var(--line);
}
.datenstand-aenderung__text { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.datenstand-aenderung__typ { font-size: .75rem; color: var(--text-03); }
.datenstand-aenderung__felder { margin: .15rem 0 0; padding-left: 1rem; font-size: .85rem; color: var(--text-02); }
.datenstand-hinweis { margin-top: .5rem; }
.datenstand-hinweis__vorschau { margin-top: .5rem; }

/* Datenstand wechseln (Issue #12): Auswahl, Vorschau, Bestätigen — schmal genug für die Rail. */
.datenstand-wechsel { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.datenstand-wechsel > * + * { margin-top: .5rem; }
.datenstand-wechsel__auswahl { min-width: 0; margin: 0; padding: 0; border: none; }
.datenstand-wechsel__auswahl > legend { padding: 0; margin-bottom: .25rem; font-size: .9rem; font-weight: 700; color: var(--brand-02); }
.datenstand-wechsel__option { display: flex; align-items: flex-start; gap: .5rem; padding: .3rem 0; }
.datenstand-wechsel__option input { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; margin: .15rem 0 0; accent-color: var(--brand-01); cursor: pointer; }
.datenstand-wechsel__option input:focus-visible { outline: 3px solid var(--brand-01); outline-offset: 2px; }
.datenstand-wechsel__option input:disabled { cursor: default; }
.datenstand-wechsel__option label { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; font-size: .9rem; cursor: pointer; }
.datenstand-wechsel__meta { font-size: .78rem; color: var(--text-02); }
.datenstand-wechsel__titel { margin-bottom: 0; font-size: .9rem; font-weight: 600; }
.datenstand-wechsel__liste { margin: .3rem 0 0; padding-left: 1.1rem; overflow-wrap: anywhere; }
.pruefungen { margin: .5rem 0 1rem; padding-left: 1.2rem; }
.pruefung--ok b { color: var(--success); }
.pruefung--fehler b { color: var(--danger); }

.fund__text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.fund__name { font-size: .95rem; font-weight: 600; color: var(--text-01); }
.fund__sub { font-size: .78rem; color: var(--text-02); }

.fund__details { margin-top: .3rem; font-size: .8rem; color: var(--text-02); }
.fund__details > summary { color: var(--brand-01); cursor: pointer; font-weight: 600; }
.fund__details p { margin: .35rem 0 0; max-width: 60ch; }

/* Warum eine Förderung nicht rechnet (Förderschiene, Abwahl) — rechts in der Zeile, umbrechend. */
.fund__status { flex: 0 1 18rem; margin-left: auto; font-size: .78rem; color: var(--text-02); overflow-wrap: anywhere; }

/* Förderschienen (Issue #17): native Radios mit Kurztext je Alternative. */
.schiene__optionen { display: flex; flex-direction: column; gap: .4rem; margin: .25rem 0 .5rem; }
.schiene__option {
    display: flex; align-items: flex-start; gap: .6rem;
    padding: .6rem .8rem;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
}
.schiene__option:has(input:checked) { border-color: var(--brand-01); background: var(--f-01); }
.schiene__option input { flex: 0 0 auto; width: 1.15rem; height: 1.15rem; margin: .15rem 0 0; accent-color: var(--brand-01); cursor: pointer; }
.schiene__option input:focus-visible { outline: 3px solid var(--brand-01); outline-offset: 2px; }
.schiene__inhalt { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.schiene__option label { cursor: pointer; }
.schiene__name { font-size: .95rem; font-weight: 600; color: var(--text-01); overflow-wrap: anywhere; }
.schiene__text { font-size: .8rem; color: var(--text-02); max-width: 70ch; }
.schiene__vorgabe { margin-left: .4rem; font-size: .72rem; font-weight: 600; color: var(--brand-02); }
.schiene__gilt {
    display: flex; flex-direction: column; gap: .15rem;
    margin: .5rem 0 0; padding: .7rem .9rem;
    background: var(--f-01);
    border-left: 3px solid var(--brand-01); border-radius: 0 var(--radius) var(--radius) 0;
}

/* Erweiterte Einstellungen (Issue #17): zugeklappt am Ende von Schritt 3. */
.erweitert { margin: 1.25rem 0 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.erweitert__kopf { padding: .7rem .9rem; font-weight: 600; color: var(--brand-02); cursor: pointer; }
.erweitert__kopf:focus-visible { outline: none; box-shadow: var(--ring); }
.erweitert__stand { font-weight: 400; color: var(--text-02); }
.erweitert__inhalt { padding: 0 .9rem .9rem; }
.erweitert__abschnitt + .erweitert__abschnitt { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.erweitert__titel { margin: .25rem 0 .25rem; font-size: .95rem; color: var(--text-01); }
.abwahl__name { font-size: .95rem; font-weight: 600; color: var(--text-01); overflow-wrap: anywhere; }
.fund--aus .abwahl__name { color: var(--text-02); text-decoration: line-through; }

/* Schalter: echte Checkbox mit role="switch" — Zustand und Tastaturbedienung bleiben nativ. */
.fund__schalter { display: flex; align-items: center; gap: .45rem; margin-left: auto; padding-top: .1rem; }
.fund__schalter label {
    display: inline-flex; align-items: center; min-height: 1.6rem;
    font-size: .76rem; color: var(--text-02); cursor: pointer;
}

/* Schalter und Beschriftung sind beide mindestens 24 px hoch — WCAG 2.2, Kriterium 2.5.8
   „Target Size (Minimum)". */
.switch {
    appearance: none; -webkit-appearance: none;
    position: relative; flex: 0 0 auto; margin: 0;
    width: 2.75rem; height: 1.6rem;
    background: var(--line-strong); border: none; border-radius: 999px;
    cursor: pointer; transition: background .15s;
}
.switch::after {
    content: ""; position: absolute; top: .15rem; left: .15rem;
    width: 1.3rem; height: 1.3rem;
    background: #fff; border-radius: 50%;
    transition: left .15s;
}
.switch:checked { background: var(--brand-01); }
.switch:checked::after { left: 1.3rem; }
/* Weißer Spalt vor dem Ring: Beim ausgeschalteten Schalter grenzte der Ring sonst an die graue
   Schiene und hielt dort keine 3:1 (WCAG 1.4.11, Benutzerverwaltung). */
.switch:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--brand-01); }

@media (prefers-reduced-motion: reduce) {
    .switch, .switch::after { transition: none; }
}

.fund-leer, .fund-hinweis {
    margin: .5rem 0 0;
    font-size: .85rem; color: var(--text-02);
    max-width: 62ch;
}
.fund-leer {
    padding: .8rem .9rem;
    background: var(--f-01);
    border-left: 3px solid var(--brand-01); border-radius: 0 var(--radius) var(--radius) 0;
}

/* Knock-out: verfehltes Pflichtkriterium. Rot umrandet, aber als Hinweis ausgezeichnet — die
   Foerderung entfaellt in der Berechnung, die Eingabe ist deswegen nicht fehlerhaft. */
.ko {
    margin: 1rem 0 0;
    padding: .8rem .95rem;
    font-size: .85rem; color: var(--text-01);
    background: var(--danger-bg);
    border-left: 3px solid var(--danger); border-radius: 0 var(--radius) var(--radius) 0;
}
.ko strong { display: block; margin-bottom: .2rem; color: var(--danger-hover); }
.ko__rechnung { display: block; margin-top: .3rem; color: var(--text-02); }

/* ---------- Schritt 4: Ergebnisseite ----------
   Aufbau nach dem Blatt „04_Ergebnisse" des Beratungstools: dunkles Kopfband, vier Kennzahlen,
   Kostenblock, Förderblock, Bilanz. Die Blöcke sind auf Druckbarkeit ausgelegt (Lastenheft S. 14:
   ein bis zwei A4-Seiten) — siehe den Druckabschnitt am Ende der Datei.
*/
.ergebnis-vorschau { border-style: dashed; }

.ergebnis { margin-bottom: 1.5rem; }

.ergebnis-kopf {
    padding: 1.1rem 1.3rem;
    background: var(--brand-02); color: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
}
.ergebnis-kopf h2 { margin: 0; font-size: 1.15rem; color: #fff; }
.ergebnis-kopf__meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem;
    margin: .4rem 0 0;
    font-size: .82rem; color: #c8d6e2;
}
.ergebnis-kopf__schienen span { min-width: 0; overflow-wrap: anywhere; }
.ergebnis-kopf__badge {
    padding: .1rem .55rem;
    font-size: .7rem; font-weight: 700; letter-spacing: .02em;
    color: var(--brand-02); background: var(--accent);
    border-radius: 999px; white-space: nowrap;
}

.ergebnis-block {
    padding: 1.1rem 1.3rem 1.4rem;
    background: var(--surface);
    border: 1px solid var(--line); border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* In der Ergebnisleiste stehen vier Kacheln statt drei — ohne die Grundbreite bräche die letzte um. */
.kpi-leiste--ergebnis .kpi { flex-basis: 8rem; }

.ergebnis-abschnitt { margin-top: 1.6rem; }
.ergebnis-abschnitt > h2, .ergebnis-abschnitt > h3 {
    margin: 0 0 .6rem;
    font-size: 1.05rem;
}
.ergebnis-vergleich { margin-top: 2rem; }

/* Zahlenspalten: rechtsbündig und mit gleich breiten Ziffern, damit Beträge untereinander stehen.
   Der Selektor nennt th/td mit: .tabelle th/.tabelle td setzt text-align und wäre sonst stärker. */
.zahl { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle th.zahl, .tabelle td.zahl { text-align: right; }
.zahl small { font-size: .72rem; font-weight: 400; color: var(--text-03); }

.tabelle caption {
    padding: .4rem .6rem;
    text-align: left; font-weight: 700; font-size: .85rem; color: var(--brand-02);
    background: var(--table-03);
    border-bottom: 1px solid var(--table-02);
}
.tabelle tfoot th, .tabelle tfoot td {
    padding: .45rem .6rem;
    font-weight: 700;
    border-top: 2px solid var(--line-strong);
}
.tabelle tbody tr.zeile--leer th, .tabelle tbody tr.zeile--leer td { color: var(--text-03); }
.tabelle tbody tr.zeile--aus th { color: var(--text-02); }
.tabelle tbody tr.zeile--aus td.zahl { color: var(--text-03); }
.tabelle th .fund__sub { display: block; font-weight: 400; }

/* Förder-Tabellen (Issue #5): Hinweis, Ausschlussgrund und Deckelung stehen in einer eigenen Zeile
   unter der Förderung, über alle Spalten — die erste Spalte bleibt schmal, „Betrag" ohne Querscrollen
   sichtbar. Ein Pfeil-Knopf klappt sie auf; Zeilen ohne Text halten denselben Einzug.
   Bis zu vier Blockspalten: Wird es eng, brechen und trennen die Köpfe („Heizungstausch",
   „Photovoltaik"), die Beträge nicht — so passen vier Blöcke in rund 750 px. */
.foerdergliederung thead th { hyphens: auto; }
.foerdergliederung thead th.zahl { white-space: normal; }
.foerderzeile { display: flex; align-items: flex-start; gap: .3rem; }
.foerderzeile__schalter, .foerderzeile__platz { flex: 0 0 auto; width: 1.5rem; height: 1.5rem; }
.foerderzeile__schalter {
    display: inline-flex; align-items: center; justify-content: center;
    margin: -.05rem 0; padding: 0;
    border: none; border-radius: var(--radius); background: none;
    color: var(--brand-02); font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.foerderzeile__schalter:hover { background: var(--f-01); }
.foerderzeile__schalter:focus-visible { outline: none; box-shadow: var(--ring); }
.foerderzeile__pfeil { display: inline-block; transition: transform .15s; }
.foerderzeile__schalter[aria-expanded="true"] .foerderzeile__pfeil { transform: rotate(90deg); }
.foerderzeile__name { min-width: 0; }
.foerderzeile__vermerk {
    display: inline-block; margin-left: .3rem; padding: 0 .4rem;
    font-size: .72rem; font-weight: 600; color: var(--text-02);
    background: var(--table-02); border-radius: 999px; white-space: nowrap;
}
/* Teil der Förderart (§ 6 bei Sockel-/Totalsanierung, Issue #18): eigene Zeile unter dem Namen. */
.foerderzeile__rahmen { display: block; font-size: .8rem; font-weight: 400; color: var(--text-02); }
.foerdergliederung tr.foerderdetail > td {
    padding-top: 0; padding-left: 1.5rem;
    font-size: .82rem; color: var(--text-02);
}
/* Mit Knopf: Der Text beginnt bündig unter der Bezeichnung (Zellenrand + Knopf + Abstand). */
.foerdergliederung--aufklappbar tr.foerderdetail > td { padding-left: 2.4rem; }
.foerderdetail__text { margin: 0; max-width: 75ch; }
/* Förderung und ihre Detailzeile lesen sich als eine Einheit: keine Linie dazwischen, gemeinsamer Hover. */
.foerdergliederung tbody tr:has(+ tr.foerderdetail:not([hidden])) > * { border-bottom-color: transparent; }
.foerdergliederung tbody tr:has(+ tr.foerderdetail[hidden]:last-child) > * { border-bottom: 0; }
.foerdergliederung tbody tr:hover + tr.foerderdetail,
.foerdergliederung tbody tr:has(+ tr.foerderdetail:hover) { background: var(--table-03); }

/* Rechtsstand je Förderung (Rechtsangaben): Angabenzeile als <dl>, in Schritt 3 unter dem Namen, in den
   Förder-Tabellen als eigene Zeile unter der Förderung, immer offen. Der Vermerk „abgelaufen“ ist Text;
   Fläche und Kante wiederholen ihn nur (wie „inaktiv“). */
.rechtsangaben { margin: .3rem 0 0; font-size: .78rem; color: var(--text-01); }
.rechtsangaben dl { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem 1.1rem; margin: 0; }
.rechtsangaben dl > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .3rem; min-width: 0; }
.rechtsangaben dt { color: var(--text-02); }
.rechtsangaben dd { margin: 0; overflow-wrap: anywhere; }
/* Zielgröße 24 px (WCAG 2.5.8): Die Links stehen allein im Wert, nicht im Fließtext. */
.rechtsangaben a { display: inline-block; min-height: 1.5rem; line-height: 1.5rem; font-weight: 600; }
.rechtsangaben a.extern::after { content: "\2197"; content: "\2197" / ""; margin-left: .15rem; font-size: .85em; }
.vermerk-zeitraum {
    display: inline-block; margin-left: .2rem; padding: 0 .4rem;
    font-size: .72rem; font-weight: 600; line-height: 1.45; color: var(--text-01);
    background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); border-radius: 999px; white-space: nowrap;
}
.foerdergliederung tr.rechtszeile > td { padding-top: 0; padding-left: 1.5rem; }
.foerdergliederung--aufklappbar tr.rechtszeile > td { padding-left: 2.4rem; }
.foerdergliederung tr.rechtszeile .rechtsangaben { margin-top: 0; }
/* Förderung, Detailzeile und Angabenzeile lesen sich als eine Einheit. */
.foerdergliederung tbody tr:has(+ tr.rechtszeile) > *,
.foerdergliederung tbody tr:has(+ tr.foerderdetail[hidden] + tr.rechtszeile) > * { border-bottom-color: transparent; }
.rechtsstand-hinweis { margin: 0 0 .6rem; max-width: 75ch; }
.detail-foerderung .rechtsangaben { margin: -.2rem 0 .6rem; font-size: .85rem; }

@media (prefers-reduced-motion: reduce) {
    .foerderzeile__pfeil { transition: none; }
}

.bilanz tfoot tr.bilanz__quote th, .bilanz tfoot tr.bilanz__quote td {
    font-weight: 600; color: var(--text-02);
    border-top: 0;
}

/* Inaktive Förderungen (Issue #19): Vermerk mit Symbol, Begründung in Schritt 3, Summe ohne sie in der Bilanz. */
.foerderzeile__vermerk--inaktiv { color: var(--text-01); background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); }
.inaktiv-vermerk { font-size: .8rem; color: var(--text-01); }
.inaktiv-vermerk__symbol { margin-right: .2rem; }
.inaktiv-liste { margin: .4rem 0 .6rem; padding-left: 1.2rem; font-size: .85rem; }
.bilanz tfoot tr.bilanz__ohne-inaktive th, .bilanz tfoot tr.bilanz__ohne-inaktive td {
    font-weight: 600; color: var(--text-02);
}

.ergebnis-schaetzung {
    margin: 0 0 1.25rem;
    padding: .7rem .95rem;
    font-size: .85rem; color: var(--text-01);
    background: var(--f-01);
    border-left: 3px solid var(--brand-01); border-radius: 0 var(--radius) var(--radius) 0;
    max-width: 70ch;
}
.ergebnis-schaetzung__kern { margin: 0; }
.ergebnis-schaetzung__details { margin-top: .35rem; }
.ergebnis-schaetzung__details > summary { color: var(--brand-01); cursor: pointer; font-weight: 600; }
.ergebnis-schaetzung__details p { margin: .35rem 0 0; }

/* ---------- Diagramme (Inline-SVG, Architecture.md §11.2) ----------
   Die Kernaussage steht sichtbar über der Zeichenfläche und ist zugleich deren Textalternative
   (aria-labelledby). Darunter liegt dieselbe Zahlenreihe als aufklappbare Tabelle.
*/
.chart { margin: 1.1rem 0 0; }
.chart__titel {
    font-size: .88rem; font-weight: 700; color: var(--brand-02);
    margin-bottom: .15rem;
}
.chart__aussage {
    margin: 0 0 .6rem;
    font-size: .85rem; color: var(--text-02);
    max-width: 70ch;
}

/* Die Zeichenfläche scrollt waagrecht, nie der Seitenkörper (iframe-Betrieb). */
.chart__flaeche { overflow-x: auto; }
.chart__svg {
    display: block;
    width: 100%; height: auto;
    min-width: 34rem;
    font-family: inherit;
}

/* SVG-Text färbt fill, nicht color. */
.chart__label { font-size: 12px; fill: var(--text-02); }
.chart__wert { font-size: 12px; font-weight: 600; fill: var(--text-01); }
.chart__wert--klein { font-size: 11px; }
.chart__achse { font-size: 11px; fill: var(--text-03); }
.chart__legende { font-size: 12px; fill: var(--text-02); }

.chart__daten { margin-top: .5rem; font-size: .85rem; }
.chart__daten > summary { color: var(--brand-01); cursor: pointer; font-weight: 600; }
.chart__daten > .tabelle-huelle { margin-top: .5rem; }

/* ---------- Schritt 4: Drilldown, Vergleich, Detailansicht ---------- */
.ergebnis-abschnitt .tabelle-huelle + .tabelle-huelle { margin-top: .9rem; }
.ergebnis-detail-link { margin: 0 0 .25rem; font-size: .9rem; }
.ergebnis-drucken, .detail-zurueck {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem;
    margin: 1rem 0;
}
/* Drucken und PDF-Download nebeneinander. */
.ergebnis-export { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .6rem; }

/* Drilldown im Kostenblock: welche Maßnahmen den Betrag eines Bereichs auslösen. */
.drilldown > summary { cursor: pointer; color: var(--brand-02); }
.drilldown__liste { margin: .35rem 0 .1rem; padding: 0; list-style: none; font-weight: 400; font-size: .85rem; }
.drilldown__liste li {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: .15rem 0 .15rem .9rem; color: var(--text-02);
    border-top: 1px dotted var(--line);
}

.vergleich tfoot tr.vergleich__neben th, .vergleich tfoot tr.vergleich__neben td,
.detail-positionen tfoot tr.vergleich__neben th, .detail-positionen tfoot tr.vergleich__neben td {
    font-weight: 600; color: var(--text-02); border-top: 0;
}

.detail-inhalt ol { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin: .4rem 0 0; padding-left: 1.2rem; font-size: .9rem; }
.detail-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: .9rem 1.2rem; align-items: start; }
.detail-raster .tabelle-huelle + .tabelle-huelle { margin-top: .9rem; }
.detail-angaben th { font-weight: 400; }
.detail-angaben__text { text-align: right; }
.detail-bereich {
    display: flex; justify-content: space-between; gap: 1rem;
    margin: 1.3rem 0 .5rem; padding-bottom: .2rem;
    font-size: .95rem; color: var(--brand-02);
    border-bottom: 2px solid var(--brand-01);
}
.detail-positionen { font-size: .85rem; }
.detail-positionen th[scope=row] { font-weight: 400; }
.detail-summe { margin-top: 1.2rem; }
.detail-foerderung { margin-top: 1.4rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.detail-foerderung > h4 { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .5rem; font-size: .98rem; }
.detail-fakten { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; margin: 0 0 .6rem; font-size: .9rem; }
.detail-fakten dt { color: var(--text-02); }
.detail-fakten dd { margin: 0; font-weight: 600; }
.detail-hinweise { margin: 0 0 .6rem; padding-left: 1.2rem; font-size: .85rem; color: var(--text-02); }

/* ---------- Förderschwellen (Issue #14) ----------
   Je Schwelle Lage in Worten, Werte und ein Balken mit der Grenze als Marke. Der Text trägt die Aussage;
   Randfarbe, Symbol und Balken wiederholen sie (WCAG 1.4.1).
*/
.schwellen { margin: .45rem 0 .5rem; font-size: .85rem; color: var(--text-01); }
.schwellen__titel { margin: 0 0 .25rem; font-weight: 700; color: var(--brand-02); }
.schwellen__liste { display: grid; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.schwelle {
    display: grid; gap: .12rem; max-width: 46rem;
    padding: .3rem .55rem;
    background: var(--table-03);
    border-left: 3px solid var(--line-strong); border-radius: 0 var(--radius) var(--radius) 0;
}
.schwelle--erfuellt { border-left-color: var(--success); }
.schwelle--knapp { background: var(--warn-bg); border-left-color: var(--warn-line); }
.schwelle__kopf { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .1rem .8rem; }
.schwelle__name { font-weight: 600; }
.schwelle__lage { font-weight: 700; white-space: nowrap; }
.schwelle__werte, .schwelle__gruppe { color: var(--text-02); }
.schwelle__balken { display: block; width: 100%; max-width: 20rem; height: 12px; }
.schwelle__spur { fill: var(--surface); stroke: var(--line-strong); stroke-width: .5; }
.schwelle__ist { fill: var(--brand-01); }
.schwelle--knapp .schwelle__ist { fill: var(--warn-line); }
.schwelle__grenze { stroke: var(--text-01); stroke-width: 2; vector-effect: non-scaling-stroke; }
.schwellen__hinweis {
    max-width: 46rem; margin: .4rem 0 0; padding: .3rem .55rem;
    background: var(--warn-bg); border-left: 3px solid var(--warn-line);
}
.foerderzeile__vermerk--knapp { color: var(--text-01); background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); }

/* Diagramm „Förderstufen nach HWB“ (FoerderstufenBand): je Förderung ein Band, Zonen je Stufe. Helligkeit und
   Schraffur tragen die Stufe, nicht der Farbton — je dunkler, desto höher; „keine Stufe“ schraffiert. Schwarze
   Schrift hält auf allen Tönen mindestens 7:1. Waagrecht in Prozent, Schrift in Pixeln: Die Seite scrollt nie
   quer. Die Container-Abfragen blenden Zonennamen ein, sobald sie hineinpassen (.sb-ab-…), und die Nummer
   statt des Namens aus (.sb-bis-…); die Stufen stehen in FoerderstufenBand.Breitenstufen. */
.stufenband__legende {
    display: flex; flex-wrap: wrap; gap: .25rem 1.1rem;
    margin: 0 0 .5rem; padding: 0; list-style: none;
    font-size: .8rem; color: var(--text-02);
}
.stufenband__legende li { display: inline-flex; align-items: center; gap: .35rem; }
.stufenband__kennzeichen {
    display: inline-block; min-width: 1.1rem; padding: 0 .2rem;
    font-size: .75rem; font-weight: 700; line-height: 1.1rem; text-align: center;
    color: #fff; background: var(--brand-02); border-radius: 2px;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.stufenband__muster {
    display: inline-block; width: .9rem; height: .7rem;
    border: 1px solid var(--line-strong);
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.stufenband__muster--keine { background: repeating-linear-gradient(45deg, #fff 0 2px, #c4cdd2 2px 3.5px); }
.stufenband__muster--1 { background: var(--stufe-1); }
.stufenband__muster--4 { background: var(--stufe-4); margin-left: -.35rem; }
.stufenband__flaeche { container: stufenband / inline-size; }
.stufenband__zeile + .stufenband__zeile { margin-top: .35rem; }
.stufenband__name { margin: 0 0 .1rem; font-size: .85rem; font-weight: 700; color: var(--brand-02); }
.stufenband__svg, .stufenband__achse { display: block; width: 100%; overflow: visible; font-family: inherit; }
.stufenband__zone--1 { fill: var(--stufe-1); }
.stufenband__zone--2 { fill: var(--stufe-2); }
.stufenband__zone--3 { fill: var(--stufe-3); }
.stufenband__zone--4 { fill: var(--stufe-4); }
.stufenband__grund { fill: #fff; }
.stufenband__schraffur { stroke: #c4cdd2; stroke-width: 2; }
.stufenband__rahmen { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.stufenband__grenze { stroke: var(--brand-02); stroke-width: 2; }
.stufenband__text { font-size: 11px; fill: var(--text-01); }
.stufenband__text--leer { fill: var(--text-02); paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.stufenband__nummer { font-size: 11px; font-weight: 700; fill: var(--text-01); }
.stufenband__wert { font-size: 11px; fill: var(--text-02); }
.stufenband__fuehrung { stroke: var(--text-02); stroke-width: 1; }
.stufenband__lot { stroke: var(--text-01); stroke-width: 1.2; stroke-dasharray: 2 3; }
.stufenband__dreieck { fill: var(--text-01); }
.stufenband__kennungsbox { fill: var(--brand-02); }
.stufenband__kennung { font-size: 11px; font-weight: 700; fill: #fff; }
.stufenband__markenwert { font-size: 12px; font-weight: 700; fill: var(--text-01); }
.stufenband__achsenlinie { stroke: var(--line-strong); stroke-width: 1; }
.stufenband__bestand { margin: .1rem 0 0; font-size: .8rem; color: var(--text-02); }
.stufenband__svg--breit, .stufenband__svg--druck, .stufenband__einheit-druck { display: none; }
@container stufenband (min-width: 600px) {
    .stufenband__svg--breit { display: block; }
    .stufenband__svg--schmal { display: none; }
}
.sb-ab-400, .sb-ab-520, .sb-ab-640, .sb-ab-760, .sb-ab-880 { display: none; }
@container stufenband (min-width: 400px) { .sb-ab-400 { display: inline; } .sb-bis-400 { display: none; } }
@container stufenband (min-width: 520px) { .sb-ab-520 { display: inline; } .sb-bis-520 { display: none; } }
@container stufenband (min-width: 640px) { .sb-ab-640 { display: inline; } .sb-bis-640 { display: none; } }
@container stufenband (min-width: 760px) { .sb-ab-760 { display: inline; } .sb-bis-760 { display: none; } }
@container stufenband (min-width: 880px) { .sb-ab-880 { display: inline; } .sb-bis-880 { display: none; } }
.schwellen__band { max-width: 46rem; margin: 0 0 .4rem; }

/* Matrix zu den Förderstufen: Zelle in Worten, die Stufenleiter davor wiederholt sie nur. */
.vergleich-stufen > .tabelle-huelle { margin-top: .9rem; }
.stufenmatrix th[scope=row] { width: 34%; min-width: 8rem; }
.stufenmatrix td, .stufenmatrix th { vertical-align: top; }
.stufenmatrix thead th { white-space: normal; }
.stufenmatrix__name { display: block; font-weight: 700; }
.stufenmatrix__stufen { margin: .15rem 0 0; padding-left: 1.2rem; font-size: .8rem; font-weight: 400; color: var(--text-02); }
.stufenmatrix__hwb { display: block; font-size: .8rem; font-weight: 400; color: var(--text-02); }
.stufenmatrix__erreicht { display: block; font-weight: 700; }
.stufenmatrix__naechste { display: block; font-size: .85rem; color: var(--text-02); }
.stufenmatrix__zelle--knapp { background: var(--warn-bg); box-shadow: inset 3px 0 0 var(--warn-line); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.stufenmatrix__zelle--knapp .stufenmatrix__naechste { color: var(--text-01); }
.stufenmatrix__zelle--leer { color: var(--text-02); }
.stufenleiter { display: flex; gap: 2px; margin: .15rem 0 .2rem; }
.stufenleiter__stufe {
    width: 14px; height: 8px;
    border: 1px solid var(--brand-02); background: var(--surface);
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.stufenleiter__stufe--an { background: var(--brand-02); }

/* Schritt 3: Hinweis neben dem HWB-Zielwert. */
.hwb-schwellen { align-self: stretch; margin: .1rem 0 0; }
.hwb-schwellen ul { margin: .2rem 0 .2rem; padding-left: 1.1rem; }

/* ---------- Rechenweg: Schrittkette und Dialog (Issue #8) ----------
   Einstieg „Rechenweg ansehen" in der Detailzeile der Förder-Tabelle; der Dialog ist ein natives
   <dialog> im Top-Layer (kein eigenes position: fixed). Höhe begrenzt in % und rem, nie in vh —
   im iframe scrollt der Inhalt im Dialog. Die Schrittkette (RechenwegChain) steht auch in der
   Detailansicht und im PDF; dort sind alle Formeln offen.
*/
.rechenweg-ausloeser {
    display: inline-flex; align-items: center; gap: .4rem;
    margin: .3rem 0 .1rem; padding: .25rem .65rem;
    font: inherit; font-size: .85rem; font-weight: 600; color: var(--brand-01);
    background: var(--surface); border: 1px solid var(--brand-01); border-radius: var(--radius);
    cursor: pointer;
}
.rechenweg-ausloeser:hover { background: var(--f-01); color: var(--brand-02); }
.rechenweg-ausloeser:focus-visible { outline: none; box-shadow: var(--ring); }
.foerderdetail__text + .rechenweg-ausloeser { margin-top: .45rem; }
.drilldown-icon { flex: 0 0 auto; }

.rechenweg-dialog {
    width: min(52rem, calc(100% - 2rem));
    max-height: min(46rem, calc(100% - 2rem));
    padding: 0;
    color: var(--text-01); background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.rechenweg-dialog[open] { display: flex; flex-direction: column; }
.rechenweg-dialog::backdrop { background: rgba(16, 65, 102, .45); }
.rechenweg-dialog__kopf {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    padding: .85rem 1.2rem;
    background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.rechenweg-dialog__titel { margin: 0; font-size: 1.1rem; }
/* Der Fokus landet beim Öffnen auf der Überschrift (tabindex=-1) — nur Ansage, kein Bedienelement. */
.rechenweg-dialog__titel:focus { outline: none; }
.rechenweg-dialog__vorsatz {
    display: block; margin-bottom: .15rem;
    font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-02);
}
.rechenweg-dialog__schliessen { flex: 0 0 auto; }
.rechenweg-dialog__inhalt { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 1rem 1.2rem 1.3rem; }
.rechenweg-dialog__fakten { margin-bottom: .2rem; }

.rechenweg-baustein__titel { margin: 1.1rem 0 .5rem; font-size: .95rem; color: var(--brand-02); }
.rechenweg-baustein > .rechenweg-baustein__titel:first-child { margin-top: .5rem; }

.rechenweg-eingaben { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: .4rem 1.4rem; }
.rechenweg-eingaben__titel { margin: 0 0 .2rem; font-size: .78rem; font-weight: 700; color: var(--text-02); }
.rechenweg-eingaben__liste { margin: 0; font-size: .85rem; }
.rechenweg-eingaben__eintrag {
    display: flex; justify-content: space-between; align-items: baseline; gap: .8rem;
    padding: .2rem 0; border-bottom: 1px dotted var(--line);
}
.rechenweg-eingaben__eintrag dt { min-width: 0; color: var(--text-02); }
.rechenweg-eingaben__eintrag dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rechenweg-eingaben__eintrag dd.rechenweg-eingaben__tabelle { white-space: normal; }
.rechenweg-name { font-size: .75rem; color: var(--text-03); overflow-wrap: anywhere; }

.rechenweg-kette { display: flex; flex-direction: column; gap: .5rem; margin: 0; padding: 0; list-style: none; counter-reset: rechenschritt; }
.rechenschritt {
    position: relative;
    padding: .55rem .8rem .55rem 2.6rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    counter-increment: rechenschritt;
}
/* Nummer und Verbindungslinie: die Kette. */
.rechenschritt::before {
    content: counter(rechenschritt);
    position: absolute; left: .55rem; top: .55rem;
    display: grid; place-items: center; width: 1.5rem; height: 1.5rem;
    font-size: .75rem; font-weight: 700; color: var(--brand-02);
    background: var(--f-01); border-radius: 50%;
}
.rechenschritt:not(:last-child)::after {
    content: "";
    position: absolute; left: 1.25rem; top: 2.15rem; bottom: -.6rem;
    border-left: 2px solid var(--f-01);
}
.rechenschritt__kopf { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem .8rem; }
.rechenschritt__text { flex: 1 1 15rem; min-width: 0; margin: 0; font-size: .92rem; }
.rechenschritt__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem; margin: .15rem 0 0; font-size: .78rem; }
.rechenweg-quelle {
    padding: 0 .4rem;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .72rem; color: var(--text-02);
    border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.rechenschritt--entscheidend { background: var(--warn-bg); border: 2px solid var(--warn-line); }
.rechenschritt--entscheidend::before { color: var(--text-01); background: var(--accent); }
.rechenschritt__entscheidend { margin: .35rem 0 0; font-size: .85rem; }

.rechenweg-chip {
    display: inline-block; padding: .05rem .55rem;
    font-size: .85rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
    border-radius: 999px;
}
.rechenweg-chip--euro { color: var(--brand-02); background: var(--f-01); }
.rechenweg-chip--ja { color: var(--success-hover); background: var(--success-bg); }
.rechenweg-chip--nein { color: var(--danger-hover); background: var(--danger-bg); }
.rechenweg-chip--stufe { color: var(--text-01); background: var(--accent); }
.rechenweg-chip--zahl { color: var(--text-01); background: var(--table-02); }

/* Mindestens 24 × 24 px (WCAG 2.5.8). */
.rechenschritt__schalter {
    display: inline-flex; align-items: center; gap: .3rem;
    min-height: 1.5rem; min-width: 1.5rem;
    margin-top: .25rem; padding: .15rem .4rem;
    font: inherit; font-size: .8rem; font-weight: 600; color: var(--brand-01);
    background: none; border: none; border-radius: var(--radius); cursor: pointer;
}
.rechenschritt__schalter:hover { background: var(--f-01); color: var(--brand-02); }
.rechenschritt__schalter:focus-visible { outline: none; box-shadow: var(--ring); }
.rechenschritt__pfeil { display: inline-block; transition: transform .15s; }
.rechenschritt__schalter[aria-expanded="true"] .rechenschritt__pfeil { transform: rotate(90deg); }
.rechenschritt__formel { margin-top: .3rem; padding: .4rem .6rem; background: var(--surface-2); border-radius: var(--radius); }
.rechenschritt__formel[hidden] { display: none; }
.rechenschritt__formelzeile { display: flex; align-items: baseline; gap: .6rem; margin: 0; }
.rechenschritt__formelzeile + .rechenschritt__formelzeile { margin-top: .25rem; }
.rechenschritt__formellabel { flex: 0 0 5.2rem; font-size: .72rem; font-weight: 600; color: var(--text-02); }
.rechenweg-formel { min-width: 0; font-size: .78rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.rechenweg-formel__wert { font-weight: 700; color: var(--brand-02); }

.rechenweg-ergebnis { font-size: .85rem; }
.rechenweg-ergebnis th[scope=row] { font-weight: 400; }
.rechenweg-ergebnis__vergleich { margin: 0 0 .6rem; font-size: .88rem; }
.rechenweg-ergebnis__hinweis { margin: .4rem 0 0; font-size: .8rem; }
.rechenweg-ergebnis__kuerzung {
    margin: .6rem 0 0; padding: .45rem .7rem;
    font-size: .85rem;
    background: var(--warn-bg); border: 2px solid var(--warn-line); border-radius: var(--radius);
}
.rechenweg-hinweise { margin-top: .6rem; }

@media (max-width: 30rem) {
    .rechenweg-dialog__kopf { padding: .7rem .9rem; }
    .rechenweg-dialog__inhalt { padding: .8rem .9rem 1rem; }
    .rechenschritt { padding-left: 2.3rem; }
    .rechenschritt::before { left: .4rem; }
    .rechenschritt:not(:last-child)::after { left: 1.1rem; }
    .rechenschritt__formelzeile { flex-direction: column; gap: 0; }
    .rechenschritt__formellabel { flex-basis: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .rechenschritt__pfeil { transition: none; }
}

@media print {
    /* Am Papier gibt es nichts zu öffnen: Formeln offen, keine Knöpfe, kein Dialog. */
    .rechenweg-ausloeser, .rechenschritt__schalter, .rechenweg-dialog { display: none !important; }
    .rechenschritt__formel[hidden] { display: block; }
    .foerdergliederung tr.foerderdetail--nur-rechenweg { display: none !important; }
    .ergebnis-detail .foerdergliederung tbody tr:has(+ tr.foerderdetail--nur-rechenweg) > * { border-bottom-color: var(--table-02); }
    .rechenschritt { break-inside: avoid; }
}

/* ---------- Responsive (Desktop/Tablet/Smartphone) ---------- */
@media (max-width: 48rem) {
    .app-body { flex-direction: column; }
    .app-nav { flex-basis: auto; border-right: none; border-bottom: 1px solid var(--field-01); }
    .app-nav__list { flex-direction: row; flex-wrap: wrap; }
    .btn--primary { width: 100%; text-align: center; }
    .app-header__inner { padding: .7rem 1rem; }
    .assistent__inhalt { padding: 1.25rem 1rem 1.5rem; }
    .assistent__navbar { padding: .9rem 1rem; }
    .assistent__navbar .btn { width: auto; }
    .assistent__rail { padding: 0 1rem 1.25rem; }
    .kpi { flex-basis: 100%; }
    .szenario-tab, .szenario-tab__eingabe { font-size: .82rem; }
    .fund { flex-wrap: wrap; }
    .fund__schalter { margin-left: 0; width: 100%; }
    .fund__status { margin-left: 0; flex-basis: 100%; }
    .ergebnis-kopf, .ergebnis-block { padding-left: 1rem; padding-right: 1rem; }
    .kpi-leiste--ergebnis .kpi { flex-basis: 100%; }
}

/* ---------- Druck: die Zusammenfassung auf 1–2 A4-Seiten (Lastenheft S. 14) ----------
   Alles, was der Bedienung dient, entfällt: Schrittleiste, Kontext-Rail, Fußnavigation,
   Szenario-Tabs, Schaltflächen. Übrig bleibt der Bericht. Der PDF-Export
   (druckoptimiertes HTML über einen Headless-Browser) nutzt dasselbe Druck-Stylesheet.
*/
@media print {
    body { background: #fff; }

    .app-header, .app-nav, .assistent__stepper, .assistent__rail, .assistent__navbar,
    .szenario-tabs, .skip-link, .btn, .alert__schliessen {
        display: none !important;
    }

    .assistent__layout { grid-template-columns: 1fr; }
    .assistent__inhalt { padding: 0; }
    .szenario-panel { padding-top: 0; }

    /* Aufgeklappt drucken: Was hinter einem Aufklapper liegt, fehlt am Papier sonst ganz. */
    details > summary { display: none; }
    details > *:not(summary) { display: block !important; }

    .chart__flaeche { overflow: visible; }
    .chart__svg { min-width: 0; }

    /* Blöcke nicht über den Seitenrand hinweg zerreißen. */
    .ergebnis, .chart, .ergebnis-abschnitt, .tabelle { break-inside: avoid; }
    .ergebnis-vergleich { break-before: page; }

    .ergebnis-kopf { background: var(--brand-02) !important; color: #fff !important; }
    .ergebnis-kopf, .ergebnis-block { border-color: var(--line-strong); }

    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; }

    /* Zusammenfassung auf 1–2 A4 — die Zahlen der Diagramme stehen schon in den
       Tabellen, Drilldown und Verweise dienen nur der Bedienung. Die Detailansicht druckt alles. */
    @page { size: A4; margin: 12mm; }
    html { font-size: 10px; }
    .ergebnis:not(.ergebnis-detail), .ergebnis:not(.ergebnis-detail) .ergebnis-abschnitt { break-inside: auto; }
    .ergebnis:not(.ergebnis-detail) tr.zeile--leer,
    .ergebnis:not(.ergebnis-detail) tr.zeile--null,
    .ergebnis-vergleich tr.zeile--leer,
    .ergebnis:not(.ergebnis-detail) .foerdergliederung tr.foerderdetail { display: none; }
    /* Förder-Tabellen (Issue #5): Am Papier gibt es nichts aufzuklappen — die Detailansicht druckt
       jede Detailzeile, auch eine am Schirm zugeklappte. */
    .foerderzeile__schalter, .foerderzeile__platz { display: none; }
    .foerdergliederung--aufklappbar tr.foerderdetail > td { padding-left: 1.5rem; }
    /* Am Papier ist Platz genug: Blockköpfe ungetrennt in einer Zeile. */
    .foerdergliederung thead th { hyphens: manual; }
    .foerdergliederung thead th.zahl { white-space: nowrap; }
    .ergebnis-detail .foerdergliederung tr.foerderdetail[hidden] { display: table-row; }
    .ergebnis-detail .foerdergliederung tbody tr:has(+ tr.foerderdetail) > * { border-bottom-color: transparent; }
    .ergebnis:not(.ergebnis-detail) .foerdergliederung tbody tr:has(+ tr.foerderdetail) > * { border-bottom-color: var(--table-02); }
    /* Angabenzeile (Rechtsstand): am Papier ohne Detailzeile direkt unter der Förderung; Linktext ist schon die
       Kurzadresse, die volle Adresse bleibt im PDF anklickbar. */
    .ergebnis:not(.ergebnis-detail) .foerdergliederung tbody tr:has(+ tr.foerderdetail + tr.rechtszeile) > * { border-bottom-color: transparent; }
    .foerdergliederung tr.rechtszeile > td, .foerdergliederung--aufklappbar tr.rechtszeile > td { padding: 0 .4rem .12rem 1.5rem; }
    .rechtsangaben a[href]::after, .rechtsangaben a.extern::after { content: none; }
    /* Eine Zeile je Förderung, ein Satz darüber: Die Zusammenfassung bleibt bei zwei Seiten (Lastenheft S. 14). */
    .rechtsangaben { font-size: .72rem; line-height: 1.15; }
    .rechtsangaben a { display: inline; min-height: 0; line-height: inherit; }
    .rechtsangaben dl { column-gap: .9rem; }
    .vermerk-zeitraum { line-height: 1.1; }
    .rechtsstand-hinweis { max-width: none; margin-bottom: .15rem; font-size: .8rem; }
    .ergebnis:not(.ergebnis-detail) .chart__aussage { max-width: none; }
    .ergebnis-detail-link, .ergebnis-drucken, .detail-zurueck, .detail-inhalt,
    .assistent__inhalt > .schritt-eyebrow, .assistent__inhalt > .schritt-lede {
        display: none !important;
    }
    .ergebnis:not(.ergebnis-detail) .chart__daten,
    .ergebnis-vergleich .chart__daten,
    .drilldown__liste { display: none !important; }
    .drilldown > summary { display: inline !important; color: inherit; }
    .ergebnis-abschnitt { margin-top: .7rem; }
    .ergebnis-kopf { padding: .5rem .8rem; }
    .ergebnis-block { padding: .5rem .8rem .7rem; }
    .kpi-leiste { margin-bottom: .5rem; }
    .tabelle th, .tabelle td { padding: .12rem .4rem; }
    .chart { margin-top: .4rem; }
    .chart__svg { max-height: 62mm; width: auto; max-width: 100%; }
    .ergebnis-vergleich .chart { display: inline-block; width: 49%; vertical-align: top; }
    /* Förderstufen nach HWB: das flache Druckband (FoerderstufenBand) links, die Matrix rechts daneben — so bleibt
       die Zusammenfassung bei zwei Seiten. Aussage und Legende entfallen, die Matrix sagt beides in Worten; ihre
       Stufenliste und Stufenleiter wiederholen nur Band und Zelle. Die Detailansicht druckt dasselbe Druckband. */
    .stufenband__flaeche .stufenband__svg--schmal, .stufenband__flaeche .stufenband__svg--breit { display: none; }
    .stufenband__flaeche .stufenband__svg--druck { display: block; }
    .vergleich-stufen {
        display: grid; grid-template-columns: 9fr 11fr; gap: 0 1.2rem; align-items: start;
        break-inside: avoid;
    }
    .ergebnis-vergleich .stufenband { display: block; width: auto; }
    .stufenband .chart__aussage, .stufenband__legende, .stufenband__bestand, .stufenband__einheit { display: none; }
    .stufenband__einheit-druck { display: inline; }
    .stufenband__achse { height: 20px; }
    .vergleich-stufen .stufenmatrix { font-size: .8rem; }
    .vergleich-stufen .stufenmatrix caption { padding-top: .2rem; padding-bottom: .2rem; }
    .stufenband__zeile { display: grid; grid-template-columns: 8.5rem 1fr; gap: .4rem; align-items: end; }
    .stufenband__zeile + .stufenband__zeile { margin-top: .2rem; }
    .stufenband__name { margin: 0; font-size: .8rem; line-height: 1.15; }
    .stufenband__achse { margin-left: 8.9rem; width: calc(100% - 8.9rem); }
    .vergleich-stufen > .tabelle-huelle { margin-top: .4rem; }
    .stufenmatrix__stufen, .stufenleiter { display: none; }
    .stufenmatrix th[scope=row] { min-width: 0; }
    /* Volle Breite und kleiner: Am Ende der Zusammenfassung darf der Hinweis keine dritte Seite anfangen. */
    .ergebnis-schaetzung { margin: 0 0 .6rem; padding: .4rem .6rem; max-width: none; font-size: .78rem; line-height: 1.3; }
    .ergebnis-schaetzung__details > summary { display: none; }
    .ergebnis-vergleich ~ .ergebnis-schaetzung { margin: .6rem 0 0; }
    /* Eingeklappt bleibt eingeklappt: Erläuterung und Rundungsregeln trägt das PDF, der Browserdruck nur den Kernsatz. */
    .ergebnis-schaetzung__details:not([open]) { display: none; }
    .ergebnis-detail .ergebnis-abschnitt, .detail-foerderung { break-inside: auto; }
    .ergebnis-detail .tabelle { break-inside: auto; }
    .ergebnis.ergebnis-detail { break-inside: auto; }
}

/* ---------- Verwaltung ----------
   Eigene Bausteine statt Komponentenbibliothek (Architecture §11.1): Stand-Hinweis, Unternavigation,
   sortierbare Tabellen (.sortierknopf + aria-sort), Zelleneingaben für den Massen-Edit, Diff.
*/
.admin-nav { margin: 0 0 1rem; }
.admin-nav__liste { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin: 0; padding: 0; list-style: none; }
.admin-nav__link { color: var(--brand-01); font-weight: 600; text-decoration: none; }
.admin-nav__link:hover, .admin-nav__link.active { text-decoration: underline; }
.admin-nav__link.active { color: var(--brand-02); }

.admin-stand {
    margin: 0 0 1.25rem; padding: .75rem 1rem;
    border-left: 4px solid var(--brand-01); border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--f-01);
}
.admin-stand--entwurf { border-left-color: var(--warn-line); background: var(--warn-bg); }
.admin-stand__titel { margin: 0 0 .25rem; font-size: 1rem; }
.admin-stand p { margin: 0; }
.admin-stand .btn-reihe { margin-top: .6rem; }

.admin-uebersicht dt { margin-top: .6rem; font-weight: 700; }
.admin-uebersicht dd { margin: .15rem 0 0; color: var(--text-02); }

.admin-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 1rem; }
.admin-filter .form-field { min-width: min(100%, 18rem); }
.admin-filter .form-field--datum { min-width: min(100%, 11rem); }
.admin-details { margin: .5rem 0; }
.admin-details > summary { cursor: pointer; font-weight: 600; color: var(--brand-02); }
.admin-aktionen { margin: 1.25rem 0 2rem; }

.sortierknopf {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: 0; border: 0; background: none;
    font: inherit; font-weight: 600; color: inherit; cursor: pointer;
}
.sortierknopf:focus-visible { outline: none; box-shadow: var(--ring); }
.sortierknopf__pfeil { color: var(--text-03); }

.tabelle--eingabe td { vertical-align: top; }
.tabelle--eingabe .form-control { padding: .3rem .45rem; }
.zelle-eingabe {
    width: 100%; min-width: 5.5rem; padding: .3rem .45rem;
    font: inherit; text-align: right;
    border: 1px solid var(--field-line); border-radius: var(--radius); background: #fff;
}
.zelle-eingabe:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--brand-01); }
.zelle-eingabe--fehler { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.zelle-eingabe[readonly], .zelle-eingabe:disabled { background: var(--surface-2); }
.tabelle tbody tr.zeile--geaendert { background: var(--warn-bg); }

/* Listentabellen der Verwaltung (#11): kompakt, ohne Querscrollen ab 80rem.
   - .auslassung: Textspalte einzeilig, gekürzt mit „…" — nur, wo der volle Text auch im Editor
     der Zeile steht. max-width: 0 nimmt der Spalte ihre Inhaltsbreite; sie teilt sich den Rest
     der Tabelle nach ihrem Anteil (width in %), nie schmaler als min-width. Der Text bleibt
     vollständig im DOM (Screenreader) und steht im title (Maus). Links kürzen sich selbst
     (display: block), damit ihr Fokusring im Zellabstand ganz sichtbar bleibt; sie bleiben
     24px hoch (WCAG 2.5.8), auch bei der kleineren Schrift der Tabelle.
   - .umbruch: lange Wörter (E-Mail-Adressen) brechen statt die Spalte zu verbreitern.
   - .zahl, .kennung: Zahlen und Codes schrumpfen auf ihre Breite (width: 1px), ohne Umbruch.
   - 48–80rem: Die Hülle scrollt quer, die erste Spalte haftet links.
   - Ab 80rem passt die Tabelle in die Breite: Die Hülle gibt den Querscroll auf, der Kopf haftet
     beim senkrechten Seitenscroll oben. In einem Scroll-Container (overflow-x: auto) haftete er
     nur an der Hülle, die senkrecht nicht scrollt. scroll-padding-top hält fokussierte Zeilen
     unter dem haftenden Kopf frei (WCAG 2.4.11).
   Unter 48rem bleibt alles wie bei .tabelle: volle Zeilen, Querscroll in der Hülle. */
@media (min-width: 48rem) {
    .tabelle--verwaltung { font-size: .9rem; }
    .tabelle--verwaltung th, .tabelle--verwaltung td { padding: .35rem .4rem; }
    .tabelle--verwaltung tbody tr { background: var(--surface); }
    .tabelle--verwaltung .zelle-eingabe { min-width: 4.75rem; }
    .tabelle--verwaltung .form-control { min-width: 7rem; }
    .tabelle--verwaltung .zahl, .tabelle--verwaltung .kennung { width: 1px; white-space: nowrap; }
    .tabelle--verwaltung thead th, .tabelle--verwaltung thead th.zahl { white-space: normal; }
    .tabelle--verwaltung .auslassung {
        width: 15%; max-width: 0; min-width: 5rem;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .tabelle--verwaltung .auslassung--breit { width: 40%; min-width: 10rem; }
    .tabelle--verwaltung .auslassung--schmal { width: 8%; }
    .tabelle--verwaltung .auslassung > :is(a, span) { display: block; overflow: hidden; text-overflow: ellipsis; }
    .tabelle--verwaltung .umbruch { overflow-wrap: anywhere; }
    .tabelle--verwaltung .sortierknopf { min-height: 1.5rem; }
    .tabelle--verwaltung tbody a { display: inline-block; min-width: 1.5rem; line-height: 1.5rem; }
}
@media (min-width: 48rem) and (max-width: 79.99rem) {
    .tabelle--verwaltung tbody > tr > :first-child {
        position: sticky; left: 0; z-index: 1;
        background-color: inherit;
        box-shadow: inset -1px 0 0 var(--table-02);
    }
    .tabelle--verwaltung thead th:first-child {
        position: sticky; left: 0; z-index: 2;
        box-shadow: inset -1px 0 0 var(--table-02);
    }
}
@media (min-width: 80rem) {
    html:has(.tabelle--verwaltung) { scroll-padding-top: 4.5rem; }
    .tabelle-huelle:has(> .tabelle--verwaltung) { overflow: visible; }
    .tabelle--verwaltung thead th {
        position: sticky; top: 0; z-index: 1;
        box-shadow: inset 0 -1px 0 var(--table-02);
    }
}

.code-eingabe { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88rem; }
.schritt-liste { margin: 0; padding-left: 1.4rem; }
.schritt-zeile { margin-bottom: .9rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.regel-pruefung { margin: 0 0 .75rem; }

/* Hilfe zur Ausdruckssprache im Förder-Editor: am Feld beim Tippen (im Fluss unter dem Feld, verdeckt also
   nichts, WCAG 2.4.11) und als Übersicht zum Aufklappen. Code bricht um, statt Tabellenzellen zu verbreitern. */
.ausdruck-hilfe {
    margin-top: .35rem; padding: .5rem .7rem;
    font-size: .82rem; line-height: 1.45;
    background: var(--f-01); border-left: 4px solid var(--brand-01); border-radius: var(--radius);
}
.ausdruck-hilfe p { margin: 0 0 .3rem; }
.ausdruck-hilfe__signatur { font-weight: 700; color: var(--brand-02); }
.ausdruck-hilfe code, .ausdruck-uebersicht code { overflow-wrap: anywhere; }
.ausdruck-hilfe__fallstricke { margin: .2rem 0 0; padding-left: 1.2rem; }
.ausdruck-hilfe__beispiele { margin: .2rem 0 .4rem; padding-left: 1.2rem; }
.ausdruck-hilfe__herkunft { color: var(--text-02); }
.ausdruck-hilfe__titel { margin: 0; font-weight: 600; }
.ausdruck-uebersicht__titel { margin: 1rem 0 .4rem; font-size: 1rem; }
.ausdruck-funktionen dt { margin-top: .8rem; font-weight: 700; color: var(--brand-02); }
.ausdruck-funktionen dd { margin: .2rem 0 0 1rem; }
.ausdruck-funktionen dd p { margin: 0 0 .2rem; }
.regel-karte { margin: 0 0 1rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
.regel-karte h3 { margin-top: 0; font-size: 1rem; }
.bedingung { margin: .5rem 0; padding: .5rem .75rem; border: 1px dashed var(--field-line); border-radius: var(--radius); }

.diff {
    max-height: 28rem; overflow: auto; margin: .5rem 0; padding: .5rem;
    font-size: .82rem; line-height: 1.45; background: var(--surface-2); border-radius: var(--radius);
}
.diff__zeile { display: block; white-space: pre; }
.diff__zeile--neu { background: var(--success-bg); }
.diff__zeile--entfernt { background: var(--danger-bg); }

/* ---------- Regelwerk (#9) ----------
   Regelwerk-Ansicht einer Förderung in der Verwaltung: Steckbrief, Parameter, Abhängigkeitsgraph
   (Inline-SVG, Knoten als Knöpfe in foreignObject) mit Karte daneben, Bezüge als Tabelle. Lage
   und Größe stehen als SVG-Attribute im Markup, nie als Inline-Style (CSP). Die Zeichenfläche
   scrollt waagrecht in ihrer Hülle, nie der Seitenkörper; Text im Graphen mindestens 12 px.
   Hervorhebung über Strichstärke und -art, nicht nur über Farbe (WCAG 1.4.1); Ränder und Kanten
   ≥ 3:1 (1.4.11).
*/
.regelwerk-wege { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; }
.regelwerk-link {
    display: inline-flex; align-items: center; gap: .35rem;
    min-height: 1.5rem; font-weight: 600;
}

.regelwerk-steckbrief {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    gap: .6rem 1.5rem; margin: 0;
}
.regelwerk-steckbrief dt { font-size: .8rem; font-weight: 700; color: var(--text-02); }
.regelwerk-steckbrief dd { margin: .1rem 0 0; overflow-wrap: anywhere; }
.regelwerk-steckbrief__breit { grid-column: 1 / -1; }
.regelwerk-massnahmen { margin: 0; padding-left: 1.2rem; columns: 2 18rem; column-gap: 2rem; }

.regelwerk-fakten { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem 1rem; margin: 0 0 1rem; }
.regelwerk-fakten dt { font-weight: 700; }
.regelwerk-fakten dd { margin: 0; }

.regelwerk-steuerung { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 2rem; margin-bottom: .5rem; }
.regelwerk-steuerung__beispiel { min-width: min(100%, 24rem); margin-bottom: 0; }
.regelwerk-legende { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin: 0 0 .4rem; padding: 0; list-style: none; font-size: .85rem; }
.regelwerk-legende li { display: inline-flex; align-items: center; gap: .4rem; }
.regelwerk-legende__muster {
    display: inline-block; width: 1.6rem; height: 1rem;
    background: var(--surface); border: 2px solid var(--text-02); border-radius: 3px;
}
.regelwerk-legende__muster--aktiv { border: 4px solid var(--brand-02); }
.regelwerk-legende__muster--bezug { border: 3px solid var(--brand-02); }
.regelwerk-legende__muster--gedimmt { border: 2px dashed var(--text-03); background: var(--surface-2); }
.regelwerk-beispielstatus { min-height: 1.5rem; }
.regelwerk-beispielstatus p { margin: .2rem 0 .5rem; }

.regelwerk-graph { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.regelwerk-graph__flaeche {
    overflow-x: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.regelwerk-graph__svg { display: block; max-width: none; font-family: inherit; }
.regelwerk-graph__spaltenkopf { font-size: 13px; font-weight: 700; fill: var(--text-02); }

/* Kanten: grau 5,7:1, hervorgehoben dunkel und dick, ohne Bezug dünn gestrichelt. */
.regelwerk-kante { fill: none; stroke: var(--text-03); stroke-width: 1.5; }
.regelwerk-kante--hervor { stroke: var(--brand-02); stroke-width: 3; }
.regelwerk-kante--gedimmt { stroke-width: 1; stroke-dasharray: 4 4; }
.regelwerk-graph__pfeil { fill: var(--text-03); }
.regelwerk-graph__pfeil--hervor { fill: var(--brand-02); }

/* Der Fokusring liegt im Rand des foreignObject (6 px). */
.regelwerk-knoten-huelle { overflow: visible; }
.regelwerk-knoten {
    display: flex; flex-direction: column; justify-content: center; gap: .1rem;
    width: calc(100% - 12px); height: calc(100% - 12px); margin: 6px;
    padding: .15rem .6rem;
    font: inherit; font-size: 14px; line-height: 1.25; text-align: left; color: var(--text-01);
    background: var(--surface); border: 2px solid var(--text-02); border-radius: var(--radius);
    cursor: pointer;
}
.regelwerk-knoten:hover { background: var(--f-01); }
.regelwerk-knoten--kontext, .regelwerk-knoten--angabe { border-radius: 999px; padding-inline: .9rem; }
.regelwerk-knoten--angabe { background: var(--table-03); }
.regelwerk-knoten--parameter { border-radius: 0; background: var(--surface-2); }
.regelwerk-knoten--ergebnis, .regelwerk-knoten--voraussetzung {
    background: var(--f-01); border-color: var(--brand-02); border-left-width: 6px;
}
.regelwerk-knoten__titel { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.regelwerk-knoten__zeile { display: flex; gap: .4rem; min-width: 0; font-size: 12px; color: var(--text-02); white-space: nowrap; }
.regelwerk-knoten__art { font-weight: 700; }
.regelwerk-knoten__wert { font-variant-numeric: tabular-nums; }
.regelwerk-knoten--aktiv { border: 4px solid var(--brand-02); }
.regelwerk-knoten--vorgaenger, .regelwerk-knoten--nachfolger { border-width: 3px; border-color: var(--brand-02); }
.regelwerk-knoten--gedimmt { border-style: dashed; border-color: var(--text-03); background: var(--surface-2); color: var(--text-02); }
.regelwerk-knoten[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 4px var(--brand-02); }

.regelwerk-graph__karte {
    padding: .75rem 1rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.regelwerk-karte__titel { margin: 0 0 .5rem; font-size: 1rem; overflow-wrap: anywhere; }
.regelwerk-karte__art { display: block; font-size: .78rem; color: var(--text-02); }
.regelwerk-karte__leer { margin: 0; }
.regelwerk-karte__schritt { padding-left: .8rem; }
.regelwerk-karte__schritt::before, .regelwerk-karte__schritt::after { display: none; }
.regelwerk-karte__status { margin: .4rem 0 0; }
.regelwerk-karte__fakten, .regelwerk-karte__bezuege { margin: .5rem 0 0; font-size: .9rem; }
.regelwerk-karte__fakten dt, .regelwerk-karte__bezuege dt { font-weight: 700; }
.regelwerk-karte__fakten dd, .regelwerk-karte__bezuege dd { margin: 0 0 .35rem; overflow-wrap: anywhere; }
.regelwerk-karte__tabelle { font-size: .85rem; }

.regelwerk-liste { font-size: .9rem; }
.regelwerk-liste th[scope=row] { font-weight: 400; }
.regelwerk-liste__art { display: block; font-size: .78rem; font-weight: 700; color: var(--text-02); }
.regelwerk-hinweise .fund__sub { display: block; }

/* Ab 64rem steht die Karte neben dem Graphen und bleibt beim Scrollen sichtbar. */
@media (min-width: 64rem) {
    .regelwerk-graph { grid-template-columns: minmax(0, 1fr) 22rem; }
    .regelwerk-graph__karte { position: sticky; top: 1rem; }
}

@media print {
    .admin-nav, .admin-stand, .regelwerk-wege, .regelwerk-steuerung__beispiel, .regelwerk-graph__karte { display: none !important; }
    .regelwerk-graph { display: block; }
    .regelwerk-graph__flaeche { overflow: visible; border: 0; }
    .regelwerk-graph__svg { width: 100%; height: auto; }
    .regelwerk-abschnitt { break-before: page; }
    .regelwerk-liste tr { break-inside: avoid; }
}

/* ---------- Testmodus, Auswirkungsvorschau, Zwischengrößen (Issue #15) ---------- */
.tabelle--kompakt { font-size: .875rem; }
.tabelle--kompakt th[scope=row] { font-weight: 400; overflow-wrap: anywhere; }

.testmodus-wahl fieldset, .testmodus-datenstand { min-width: 0; margin: 0; padding: 0; border: none; }
.testmodus-datenstand > legend { padding: 0; margin-bottom: .25rem; font-weight: 700; }
.testmodus-datenstand__option, .auswirkung__wahl { display: flex; align-items: center; gap: .5rem; min-height: 1.75rem; }
.testmodus-datenstand__option input, .auswirkung__wahl input { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--brand-01); }
.testmodus-datenstand__option input:focus-visible, .auswirkung__wahl input:focus-visible { outline: 3px solid var(--brand-01); outline-offset: 2px; }
.testmodus-stand { margin: 1rem 0; }
.testmodus-stand a { margin-left: .5rem; }
.testmodus { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 2rem; }
.testmodus__tabelle caption { caption-side: top; text-align: left; font-weight: 700; color: var(--brand-02); padding: .5rem 0 .25rem; }
.testmodus__tabelle th[scope=row] { font-weight: 400; }
.testmodus__tabelle th[scope=row] label { display: block; }
.testmodus__name { display: block; font-size: .78rem; color: var(--text-02); overflow-wrap: anywhere; }
.testmodus__marke { display: inline-block; margin-top: .15rem; font-size: .78rem; font-weight: 700; color: var(--text-01); }
.testmodus__eingabe { min-width: 7rem; }
.testmodus__original, .testmodus__vorher { color: var(--text-02); overflow-wrap: anywhere; }
.testmodus__formel { overflow-wrap: anywhere; }
.testmodus-import { margin: .75rem 0; }
.testmodus-foerderung { margin: 0 0 1rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.testmodus-foerderung--geaendert { border-left: 4px solid var(--warn-line); }
.testmodus-foerderung h3 { margin: 0 0 .35rem; font-size: 1rem; }
.testmodus-foerderung__status { margin: 0 0 .35rem; }
.testmodus-foerderung__betraege { margin: .35rem 0; }
.testmodus-foerderung__betraege dt { font-weight: 700; }
.testmodus-foerderung__betraege dd { margin: 0 0 .25rem; }
.testmodus-foerderung__zeilen, .testmodus-foerderung__hinweise { margin: .35rem 0; padding-left: 1.2rem; }
.testmodus-foerderung__rechenweg > summary { cursor: pointer; font-weight: 600; color: var(--brand-02); }
.testmodus-status--ok { font-weight: 700; color: var(--success); }
.testmodus-status--aus { font-weight: 700; }
.testmodus-status--fehler { font-weight: 700; color: var(--danger); }
.testmodus-uebernehmen { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.testmodus-uebernehmen .form-field { min-width: min(100%, 18rem); flex: 1 1 18rem; }
.testmodus-probelauf { margin-top: 1rem; }

.admin-ergebnis-links { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: 1rem 0 0; font-size: .9rem; }

/* minmax(0, …): Sonst bestimmt die breiteste Tabelle die Spalte, und die Seite scrollt quer (Telefonbreite). */
.admin-vorschau { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 2rem; }
.auswirkung { margin: 1.5rem 0; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--f-01); }
.auswirkung__titel { margin: 0 0 .25rem; font-size: 1.1rem; }
.auswirkung__projekte { min-width: 0; margin: .5rem 0; padding: 0; border: none; }
.auswirkung__projekte > legend { padding: 0; margin-bottom: .25rem; font-weight: 700; }
.auswirkung__wahl label { overflow-wrap: anywhere; }
.auswirkung__block h3 { margin: .75rem 0 .25rem; font-size: 1rem; overflow-wrap: anywhere; }
.auswirkung__tabelle { background: var(--surface); }
.auswirkung__geaendert { font-weight: 700; }
.auswirkung__beispiele { margin: .25rem 0; padding-left: 1.2rem; font-size: .9rem; }
.auswirkung__beispiele li { margin-bottom: .35rem; }
.auswirkung__beispiele span { display: block; }
.auswirkung__beispielname { overflow-wrap: anywhere; }
.auswirkung .pruefung--ok { color: var(--success); }
.auswirkung .pruefung--fehler { color: var(--danger); }

.zwischengroessen-inhalt ul { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.zwischengroessen-massnahme { margin: .5rem 0; }
.zwischengroessen-massnahme > summary { cursor: pointer; font-weight: 600; color: var(--brand-02); overflow-wrap: anywhere; }

/* Ab 80rem stehen Kontext und Förderungen nebeneinander. Die Vorschau steht erst ab 100rem neben dem
   Formular (haftend) — bei 1280 px brauchen die Listentabellen die volle Breite (#11); darunter folgt sie. */
@media (min-width: 80rem) {
    .testmodus { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@media (min-width: 100rem) {
    .admin-vorschau { grid-template-columns: minmax(0, 1fr) 24rem; align-items: start; }
    .admin-vorschau > .auswirkung { position: sticky; top: 1rem; margin-top: 0; max-height: calc(100vh - 2rem); overflow-y: auto; }
}

@media print {
    .auswirkung, .testmodus-import, .admin-ergebnis-links { display: none !important; }
}
