/* ============================================================
   bAV-Rechner · Design-System  (Stand 2026-09-18)

   Läuft eingebettet per iFrame auf Fremdseiten UND eigenständig.
   Keine Framework-Abhängigkeit, keine externen Schriften (DSGVO).

   Branding pro Institut: nur --brand überschreiben (site_*.css).
   Alle Tönungen werden daraus per color-mix() abgeleitet.
   ============================================================ */

/* ------------------------------------------------------------
   1. Tokens
   ------------------------------------------------------------ */

:root {
    color-scheme: light;

    /* Marke (Standard: Provinzial-Rot) */
    --brand: #E00000;
    --brand-contrast: #ffffff;
    --brand-text: var(--brand);             /* Marke als Text/Link (WCAG 4,5:1 auf Fläche) */
    --brand-strong: color-mix(in oklab, var(--brand) 82%, black);
    --brand-soft: color-mix(in oklab, var(--brand) 9%, var(--surface));
    --brand-soft-2: color-mix(in oklab, var(--brand) 18%, var(--surface));
    --brand-focus: color-mix(in oklab, var(--brand) 32%, transparent);

    /* Neutral – kühles Schiefergrau, leicht zur Marke geneigt */
    --canvas: #f3f4f7;
    --surface: #ffffff;
    --surface-2: #f7f8fa;
    --surface-3: #eef0f4;
    --ink: #1a1e26;
    --ink-2: #4f5866;
    --ink-3: #656e7c;                       /* 5,1:1 auf Weiß */
    --line: #dfe3ea;                        /* dekorative Trennlinien */
    --line-2: #c9cfd9;
    --control-border: #858e9d;              /* Rahmen von Bedienelementen, 3,3:1 (WCAG 1.4.11) */

    /* Status */
    --ok: #16794a;
    --ok-soft: #e4f4ec;
    --danger: #c42b25;
    --danger-soft: #fbe9e8;
    --warn: #9a6200;
    --warn-soft: #fff4d6;

    /* Maße */
    --r-lg: 16px;
    --r: 10px;
    --r-sm: 7px;
    --control-h: 2.75rem;
    --shadow-1: 0 1px 2px rgba(20, 26, 40, .06);
    --shadow-2: 0 2px 6px rgba(20, 26, 40, .06), 0 12px 32px -8px rgba(20, 26, 40, .12);

    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --brand-text: color-mix(in oklab, var(--brand) 65%, white);
    --brand-strong: color-mix(in oklab, var(--brand) 78%, white);
    --brand-soft: color-mix(in oklab, var(--brand) 16%, var(--surface));
    --brand-soft-2: color-mix(in oklab, var(--brand) 28%, var(--surface));
    --canvas: #0f1218;
    --surface: #171b23;
    --surface-2: #1d222c;
    --surface-3: #252b36;
    --ink: #eef1f6;
    --ink-2: #b4bcc9;
    --ink-3: #8f98a6;
    --line: #2b323e;
    --line-2: #3a4351;
    --control-border: #6b7584;
    --ok: #4fc487;
    --ok-soft: #12321f;
    --danger: #ff6b63;
    --danger-soft: #3a1815;
    --warn: #f2b84b;
    --warn-soft: #3a2b0b;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .35), 0 12px 32px -8px rgba(0, 0, 0, .55);
}

/* ------------------------------------------------------------
   2. Basis & Betriebsmodus (eingebettet / eigenständig)
   ------------------------------------------------------------ */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--surface);
    color: var(--ink);
    font: 400 15px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
}

/* Eigenständig: ruhige Bühne, App als Karte */
html[data-mode="standalone"] body {
    background: var(--canvas);
    min-height: 100dvh;
}

html[data-mode="standalone"] .bav {
    max-width: 760px;
    margin: 0 auto;
    padding: clamp(16px, 4vw, 40px) 16px 56px;
}

/* Eingebettet: Hostseite bestimmt den Hintergrund, kein Rand */
html[data-mode="embedded"] body {
    background: transparent;
}

html[data-mode="embedded"] .bav {
    padding: 4px 0 8px;
}

.bav {
    container: bav / inline-size;
    display: grid;
    gap: 16px;
}

[hidden] {
    display: none !important;
}

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

a {
    color: var(--brand-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: .15em;
}

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

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0s !important;
        animation-duration: 0s !important;
    }
}

/* ------------------------------------------------------------
   3. Kopf
   ------------------------------------------------------------ */

.bav-header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.bav-logo {
    flex: 0 0 auto;
    max-height: 44px;
    max-width: 160px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.bav-title {
    min-width: 0;
}

.bav-title h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.25;
}

.bav-title p {
    margin: 2px 0 0;
    font-size: .875rem;
    color: var(--ink-2);
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------------
   4. Schritt-Anzeige
   ------------------------------------------------------------ */

.stepper {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 10px 10px 10px 8px;
    border: 0;
    border-top: 3px solid var(--line);
    border-radius: 0 0 var(--r-sm) var(--r-sm);
    background: transparent;
    color: var(--ink-3);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .2s var(--ease), background-color .2s var(--ease);
}

.step:hover:not(:disabled) {
    background: var(--surface-2);
}

.step:disabled {
    cursor: default;
}

.step-num {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 2px solid var(--control-border);
    border-radius: 50%;
    font-size: .8rem;
    font-weight: 700;
    line-height: 1;
    color: var(--ink-3);
    background: var(--surface);
}

.step-num > span {
    display: block;
    line-height: 1;
}

.step-text {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.step-title {
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink-2);
}

.step-summary {
    font-size: .75rem;
    line-height: 1.35;
    color: var(--ink-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.step-summary:empty {
    display: none;
}

.step[aria-current="step"] {
    border-top-color: var(--brand);
}

.step[aria-current="step"] .step-title {
    color: var(--ink);
}

.step[aria-current="step"] .step-num {
    border-color: var(--brand);
    background: var(--brand);
    color: var(--brand-contrast);
}

.step.is-done {
    border-top-color: var(--brand);
}

.step.is-done .step-num {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-text);
}

.step.is-done .step-num::before {
    content: "";
    display: block;
    width: 6px;
    height: 10px;
    margin-top: -3px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.step.is-done .step-num span {
    display: none;
}

/* Schmale iFrames: nur Nummern + aktiver Titel */
@container bav (max-width: 480px) {
    .stepper {
        gap: 4px;
    }

    .step {
        grid-template-columns: auto;
        justify-items: center;
        padding: 8px 4px;
    }

    .step-text {
        display: none;
    }

    .step[aria-current="step"] .step-text {
        display: grid;
        text-align: center;
    }

    .step[aria-current="step"] .step-summary {
        display: none;
    }
}

/* ------------------------------------------------------------
   5. Hilfe-Zeile (Muster-Gehaltsabrechnung, Video)
   ------------------------------------------------------------ */

.help {
    display: grid;
    gap: 8px;
}

.help-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 6px 12px 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: .85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s var(--ease), background-color .15s var(--ease);
}

.chip:hover {
    border-color: var(--line-2);
    background: var(--surface-2);
    color: var(--ink);
}

.chip svg {
    width: 16px;
    height: 16px;
    color: var(--brand-text);
    flex: 0 0 auto;
}

.chip[aria-expanded="true"] {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.video-box {
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
    background: #000;
}

.video-box video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-width: 100%;
}

/* ------------------------------------------------------------
   6. Panels (ein Schritt = eine Karte)
   ------------------------------------------------------------ */

.panel {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-1);
    animation: panel-in .28s var(--ease);
}

html[data-mode="standalone"] .panel {
    box-shadow: var(--shadow-2);
}

@keyframes panel-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 16px;
    padding: 18px 20px 0;
}

.panel-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.005em;
    text-wrap: balance;
}

.panel-head p {
    margin: 0;
    font-size: .85rem;
    color: var(--ink-2);
}

.panel-body {
    display: grid;
    gap: 18px;
    padding: 18px 20px 20px;
}

.panel-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.panel-foot .note {
    margin: 0;
    font-size: .8rem;
    color: var(--ink-3);
}

.panel-foot .btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

@container bav (max-width: 480px) {
    .panel-head {
        padding: 16px 16px 0;
    }

    .panel-body {
        padding: 16px;
        gap: 16px;
    }

    .panel-foot {
        padding: 12px 16px;
    }

    .panel-foot .btn-row {
        width: 100%;
    }

    .panel-foot .btn-row .btn {
        flex: 1 1 auto;
    }
}

/* Feldgruppen mit dezenter Zwischenüberschrift */
.group {
    display: grid;
    gap: 14px;
}

.group + .group {
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.group-title {
    margin: 0;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
}

/* Feldraster: jedes Feld belegt vier Zeilen (Label / Element / Hinweis / Fehler)
   des übergeordneten Rasters (Subgrid). So stehen Eingabeelemente nebeneinander
   auf gleicher Höhe, auch wenn ein Label zwei Zeilen braucht. */
.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px 20px;
}

.grid-2 > .field {
    display: grid;
    grid-row: span 4;
    grid-template-rows: subgrid;
    gap: 6px 0;
}

.grid-2 > .field > .field-label {
    grid-row: 1;
    align-self: end;
}

.grid-2 > .field > :not(.field-label):not(.field-hint):not(.field-error) {
    grid-row: 2;
}

.grid-2 > .field > .field-hint {
    grid-row: 3;
    margin-bottom: 6px;
}

.grid-2 > .field > .field-error {
    grid-row: 4;
    margin-bottom: 12px;
}

@container bav (min-width: 560px) {
    .grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-2 > .span-2 {
        grid-column: 1 / -1;
    }
}

/* ------------------------------------------------------------
   7. Formularelemente
   ------------------------------------------------------------ */

.field {
    display: grid;
    gap: 6px;
    align-content: start;
    min-width: 0;
}

.field-label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
    text-wrap: balance;
}

.req {
    margin-left: .1em;
    color: var(--danger);
    font-weight: 700;
}

.field-hint {
    margin: 0;
    font-size: .78rem;
    line-height: 1.4;
    color: var(--ink-3);
}

.field-hint.is-ok {
    color: var(--ok);
    font-weight: 500;
}

.field-error {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    margin: 0;
    font-size: .8rem;
    line-height: 1.4;
    font-weight: 500;
    color: var(--danger);
}

.field-error::before {
    content: "";
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    margin-top: 3px;
    border-radius: 50%;
    background: var(--danger);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%23000'/%3E%3Cpath d='M8 4v5' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='11.6' r='1' fill='%23fff'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%23000'/%3E%3Cpath d='M8 4v5' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='11.6' r='1' fill='%23fff'/%3E%3C/svg%3E") center / contain no-repeat;
}

.input,
.select {
    width: 100%;
    min-height: var(--control-h);
    padding: 0 12px;
    border: 1px solid var(--control-border);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    line-height: 1.3;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}

.input::placeholder {
    color: var(--ink-3);
}

.input:hover,
.select:hover {
    border-color: var(--ink-2);
}

.input:focus,
.select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-focus);
}

.input:disabled,
.select:disabled {
    background: var(--surface-3);
    color: var(--ink-3);
    cursor: not-allowed;
}

.input[aria-invalid="true"],
.select[aria-invalid="true"] {
    border-color: var(--danger);
}

.input[aria-invalid="true"]:focus,
.select[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 28%, transparent);
}

input[type="date"].input {
    appearance: none;
    -webkit-appearance: none;
}

input[type="date"].input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: .7;
}

.select {
    padding-right: 38px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%237c8594' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

/* Eingabe mit Einheit (€) */
.affix {
    position: relative;
}

.affix .input {
    padding-right: 42px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.affix .affix-unit {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    font-size: .95rem;
    color: var(--ink-3);
    pointer-events: none;
}

/* Segment-Steuerung (Radios) */
.segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.seg {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.seg input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.seg span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--control-h);
    padding: 6px 12px;
    border: 1px solid var(--control-border);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--ink-2);
    font-size: .95rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.25;
    transition: border-color .15s var(--ease), background-color .15s var(--ease), color .15s var(--ease);
}

.seg:hover input:not(:checked):not(:disabled) + span {
    border-color: var(--ink-2);
    background: var(--surface-2);
}

.seg input:checked + span {
    border-color: var(--brand);
    background: var(--brand);
    color: var(--brand-contrast);
}

.seg input:focus-visible + span {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand);
}

.seg input:disabled + span {
    opacity: .5;
    cursor: not-allowed;
}

.segmented.is-compact .seg {
    flex: 0 1 auto;
}

.segmented.is-compact .seg span {
    min-width: 3rem;
}

/* Auswahlkarten (Beitragsvorschläge, Optionen mit Beschreibung) */
.choices {
    display: grid;
    gap: 8px;
}

@container bav (min-width: 560px) {
    .choices.is-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .choices.is-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* display: grid, damit die Karte die volle Zeilenhöhe füllt und Nachbarn
   mit ein- und zweizeiligen Titeln gleich hoch sind */
.choice {
    position: relative;
    display: grid;
}

.choice input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.choice-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px 14px;
    border: 1px solid var(--control-border);
    border-radius: var(--r);
    background: var(--surface);
    transition: border-color .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease);
}

.choice-card::before {
    content: "";
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border: 2px solid var(--control-border);
    border-radius: 50%;
    background: var(--surface);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}

.choice:hover input:not(:checked) + .choice-card {
    border-color: var(--ink-2);
    background: var(--surface-2);
}

.choice input:checked + .choice-card {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.choice input:checked + .choice-card::before {
    border-color: var(--brand);
    box-shadow: inset 0 0 0 5px var(--brand);
}

.choice input:focus-visible + .choice-card {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand);
}

.choice-title {
    font-weight: 600;
    line-height: 1.3;
}

.choice-title strong {
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.choice-desc {
    display: block;
    margin-top: 2px;
    font-size: .8rem;
    line-height: 1.4;
    color: var(--ink-2);
}

/* Schalter (Checkbox) */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: var(--control-h);
    cursor: pointer;
    user-select: none;
}

.switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.switch-track {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: var(--control-border);
    transition: background-color .2s var(--ease);
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: transform .2s var(--ease);
}

.switch input:checked + .switch-track {
    background: var(--brand);
}

.switch input:checked + .switch-track::after {
    transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand);
}

.switch input:disabled ~ * {
    opacity: .5;
    cursor: not-allowed;
}

.switch-label {
    font-size: .95rem;
    line-height: 1.35;
}

/* Verweis-Nummer auf die Muster-Gehaltsabrechnung */
.ref {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    margin-left: .2em;
    vertical-align: text-bottom;
    border-radius: 50%;
    background: var(--brand);
    color: var(--brand-contrast);
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
}

/* Combobox (Krankenkasse) */
.combo {
    position: relative;
}

.combo .input {
    padding-right: 40px;
}

.combo-clear {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-3);
    transform: translateY(-50%);
    cursor: pointer;
}

.combo-clear:hover {
    background: var(--surface-3);
    color: var(--ink);
}

.combo-clear svg {
    width: 16px;
    height: 16px;
}

.combo-list {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 264px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow-2);
}

.combo-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border-radius: var(--r-sm);
    font-size: .925rem;
    cursor: pointer;
}

.combo-list li .combo-meta {
    flex: 0 0 auto;
    font-size: .78rem;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

.combo-list li[aria-selected="true"],
.combo-list li:hover {
    background: var(--brand-soft);
}

.combo-list li[aria-disabled="true"] {
    color: var(--ink-3);
    cursor: default;
    background: transparent;
}

.combo-list li mark {
    background: transparent;
    color: inherit;
    font-weight: 700;
}

/* ------------------------------------------------------------
   8. Schaltflächen
   ------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--control-h);
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--r);
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
}

.btn:active {
    transform: translateY(1px);
}

.btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-contrast);
}

.btn-primary:hover {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
    color: var(--brand-contrast);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--control-border);
    color: var(--ink);
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--ink-3);
    color: var(--ink);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-2);
    padding-inline: 12px;
}

.btn-ghost:hover {
    background: var(--surface-3);
    color: var(--ink);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: .6;
    cursor: wait;
    transform: none;
}

.btn .spinner {
    display: none;
}

.btn.is-busy .spinner {
    display: inline-block;
}

.btn.is-busy .btn-icon {
    display: none;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid color-mix(in oklab, currentColor 35%, transparent);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ------------------------------------------------------------
   9. Meldungen
   ------------------------------------------------------------ */

.alert {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: var(--r);
    font-size: .9rem;
    line-height: 1.45;
}

.alert svg {
    width: 20px;
    height: 20px;
    margin-top: 1px;
}

.alert p {
    margin: 0;
}

.alert .alert-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.alert-danger {
    background: var(--danger-soft);
    border-color: color-mix(in oklab, var(--danger) 30%, transparent);
    color: var(--ink);
}

.alert-danger svg {
    color: var(--danger);
}

.alert-info {
    background: var(--brand-soft);
    border-color: color-mix(in oklab, var(--brand) 25%, transparent);
    color: var(--ink);
}

.alert-info svg {
    color: var(--brand-text);
}

.form-summary {
    scroll-margin-top: 12px;
}

.form-summary ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

.form-summary a {
    color: inherit;
}

/* ------------------------------------------------------------
   10. Ergebnis
   ------------------------------------------------------------ */

.result-skeleton {
    display: grid;
    gap: 14px;
    padding: 20px;
}

.sk {
    height: 14px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
}

.sk.is-hero {
    height: 120px;
    border-radius: var(--r);
}

@keyframes shimmer {
    to {
        background-position: -200% 0;
    }
}

.hero {
    position: relative;
    display: grid;
    gap: 4px;
    padding: 22px 22px 20px;
    border-radius: var(--r);
    background:
        radial-gradient(120% 140% at 100% 0%, var(--brand-soft-2), transparent 60%),
        var(--brand-soft);
    overflow: hidden;
}

.hero-kicker {
    margin: 0;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ink-2);
}

.hero-value {
    margin: 2px 0 0;
    font-size: clamp(2.2rem, 8cqi, 3.25rem);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.05;
    color: var(--brand-text);
}

.hero-value small {
    font-size: .45em;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--ink-2);
    margin-left: .2em;
}

.hero-label {
    margin: 0;
    font-size: .95rem;
    color: var(--ink-2);
}

.hero-alt {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid color-mix(in oklab, var(--brand) 18%, transparent);
    font-size: .875rem;
    color: var(--ink-2);
}

.hero-alt strong {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

/* Finanzierungs-Balken */
.finance {
    display: grid;
    gap: 12px;
    margin: 0;
}

.finance figcaption {
    font-size: .95rem;
    font-weight: 600;
    text-wrap: balance;
}

.finance figcaption b {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.finance-bar {
    display: block;
    width: 100%;
    height: 28px;
    max-width: 100%;
    overflow: visible;
}

.finance-bar rect {
    transition: opacity .15s var(--ease);
}

.finance-bar text {
    font: 600 12px var(--font);
    fill: var(--brand-contrast);
    pointer-events: none;
}

.finance.has-hover .finance-bar rect:not(.is-hot) {
    opacity: .35;
}

.legend {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

@container bav (min-width: 560px) {
    .legend {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.legend li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 4px 6px;
    margin: 0 -6px;
    border-radius: var(--r-sm);
    font-size: .875rem;
    cursor: default;
}

.legend li:hover,
.legend li.is-hot {
    background: var(--surface-2);
}

.legend li.is-hot .legend-name {
    color: var(--ink);
}

.finance.has-hover .legend li:not(.is-hot) .swatch {
    opacity: .35;
}

.legend .swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend .legend-name {
    color: var(--ink-2);
    overflow-wrap: anywhere;
}

.legend .legend-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.legend li.is-you .legend-name {
    color: var(--ink);
    font-weight: 600;
}

/* Kennzahlen */
.facts {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
}

@container bav (min-width: 560px) {
    .facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .facts > div:nth-child(odd) {
        border-right: 1px solid var(--line);
    }

    .facts > div:nth-child(n + 3) {
        border-top: 1px solid var(--line);
    }
}

@container bav (max-width: 559px) {
    .facts > div + div {
        border-top: 1px solid var(--line);
    }
}

.facts > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
}

.facts dt {
    margin: 0;
    font-size: .85rem;
    color: var(--ink-2);
}

.facts dd {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.facts .is-delta dd {
    color: var(--ok);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@container bav (max-width: 480px) {
    .actions .btn {
        flex: 1 1 100%;
    }
}

.disclosure {
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface-2);
}

.disclosure summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.disclosure summary::-webkit-details-marker {
    display: none;
}

.disclosure summary::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 4px;
    border: solid var(--ink-3);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    transition: transform .2s var(--ease);
}

.disclosure[open] summary::after {
    transform: rotate(-135deg);
}

.disclosure .disclosure-body {
    padding: 0 14px 14px;
    font-size: .85rem;
    line-height: 1.55;
    color: var(--ink-2);
}

.disclosure .disclosure-body p {
    margin: 0;
}

.disclosure .disclosure-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-top: 10px;
    border-radius: var(--r-sm);
    background: #fff;
}

/* ------------------------------------------------------------
   11. Fuß
   ------------------------------------------------------------ */

.bav-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    font-size: .75rem;
    color: var(--ink-3);
}

.bav-footer p {
    margin: 0;
}

/* ------------------------------------------------------------
   12. Hohe Kontraste / Windows-Kontrastmodus (forced-colors)
   Zustände dürfen nicht nur über Hintergrundfarbe erkennbar sein.
   ------------------------------------------------------------ */

@media (forced-colors: active) {
    .seg input:checked + span,
    .choice input:checked + .choice-card {
        outline: 3px solid Highlight;
        outline-offset: -3px;
    }

    .choice input:checked + .choice-card::before {
        background: Highlight;
    }

    .switch-track {
        border: 1px solid ButtonText;
    }

    .switch-track::after {
        background: ButtonText;
    }

    .switch input:checked + .switch-track::after {
        background: Highlight;
    }

    .step[aria-current="step"] {
        outline: 2px solid Highlight;
    }

    .swatch,
    .finance-bar {
        forced-color-adjust: none;
    }

    .hero,
    .field-error::before {
        forced-color-adjust: none;
    }
}

/* ------------------------------------------------------------
   13. Druck
   ------------------------------------------------------------ */

@media print {
    body {
        background: #fff !important;
        color: #000;
    }

    .stepper,
    .help,
    .actions,
    .panel-foot,
    .btn {
        display: none !important;
    }

    .panel {
        border: 0;
        box-shadow: none;
    }

    .hero {
        background: none;
        border: 1px solid #999;
    }
}
