/*
 * DIWA 2.0 – Bausteine. Werte ausschließlich aus tokens.css; keine Modulfarben.
 * Bisherige Klassen gelten weiter (Module sehen ohne Änderung neu aus), neue Varianten sind ergänzt.
 * Übersicht mit Beispielen: /admin/designsystem
 *
 *   Schaltflächen · Kleinteile (Tastenkappe, Etikett, Status, Ampel, Live, Segmente, Filter) · Karten ·
 *   Kennzahlen · Kacheln · Formulare (mitlaufende Speichern-Leiste, Abschnitte, Symbole, Farben) ·
 *   Tabellen · Meldungen · Leerzustand · Angaben · Reiter · Schritte · Schalter · Dialog, Menü,
 *   Kurzmeldung · Zu erledigen · Zeilen · Seitenwechsel · Nummernschild · Kleinteile
 */

/* ==== Schaltflächen ========================================================= */
/* Flach, ohne Verlauf und Glanz, Beschriftung in normaler Schreibweise (nie Versalien).
   .btn hell (Standard für Nebenaktionen) · .btn--primary Schiefer (Standardaktion, z. B. Speichern) ·
   .btn--accent Hauptaktion (die eine je Bildschirm; Aktionsblau --action-primary-* – nie Rot, unabhängig
   von der Hausfarbe) · .btn--danger Gefahr (zerstörend; im Dialog rot gefüllt --action-danger-* – Rot nur
   hier und bei Fehlern) · .btn--secondary ruhig grau · .btn--quiet ohne Rahmen · .btn--link wie ein Link. */

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--target-min);
    padding: 7px 16px;
    border: 1px solid var(--c-control-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-text-strong);
    font-family: inherit;
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color var(--duration), border-color var(--duration), color var(--duration);
}

.btn:hover {
    border-color: var(--c-border);
    background: var(--c-page);
    color: var(--c-heading);
    text-decoration: none;
}

.btn:active {
    background: var(--c-panel);
}

.btn .icon {
    width: 16px;
    height: 16px;
    flex: none;
}

.btn--primary,
.btn--accent,
.btn--danger {
    border-color: transparent;
    color: #fff;
}

.btn--primary {
    background: var(--c-slate);
}

.btn--primary:hover {
    border-color: transparent;
    background: var(--c-slate-hover);
    color: #fff;
}

.btn--primary:active {
    background: var(--c-slate-active);
}

.btn--accent {
    background: var(--action-primary-bg);
    color: var(--action-primary-text);
}

.btn--accent:hover,
.btn--accent:active {
    border-color: transparent;
    background: var(--action-primary-bg-hover);
    color: var(--action-primary-text);
}

/* Gefahr: auf normalen Seiten als umrandete Schaltfläche (ein Rot je Bildschirm), im Rückfrage-Dialog
   rot gefüllt – dort ist sie die eine Hauptaktion. Feste Gefahrenfarbe, unabhängig vom Mandanten. */
.btn--danger {
    border-color: var(--c-danger-border);
    background: var(--c-surface);
    color: var(--c-danger-text);
}

.btn--danger:hover {
    border-color: var(--c-danger);
    background: var(--c-danger-bg);
    color: var(--c-danger-text);
}

.dialog .btn--danger,
.btn--danger.btn--solid {
    border-color: transparent;
    background: var(--action-danger-bg);
    color: var(--action-danger-text);
}

.dialog .btn--danger:hover,
.btn--danger.btn--solid:hover {
    border-color: transparent;
    background: var(--action-danger-bg-hover);
    color: var(--action-danger-text);
}

.btn--secondary {
    border-color: transparent;
    background: var(--c-panel);
    color: var(--c-text-strong);
}

.btn--secondary:hover {
    border-color: transparent;
    background: #e3e8ee;
    color: var(--c-heading);
}

.btn--quiet {
    border-color: transparent;
    background: transparent;
    color: var(--c-blue);
}

.btn--quiet:hover {
    border-color: transparent;
    background: var(--c-blue-light);
    color: var(--c-blue-dark);
}

.btn--link {
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--c-blue);
    font-weight: var(--fw-regular);
}

.btn--link:hover {
    border: 0;
    background: none;
    color: var(--c-blue-hover);
    text-decoration: underline;
}

.btn:disabled,
.btn[aria-disabled="true"],
.btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn--sm {
    min-height: var(--target-sm);
    padding: 4px 12px;
    font-size: var(--fs-tiny);
}

.btn--sm .icon {
    width: 15px;
    height: 15px;
}

.btn--lg {
    min-height: 48px;
    padding: 10px 24px;
    font-size: var(--fs-base);
}

.btn--xl {
    min-height: 64px;
    padding: 12px 24px;
    font-size: var(--fs-md);
}

.btn--xl .icon {
    width: 20px;
    height: 20px;
}

.btn--icon {
    width: var(--target-min);
    padding: 0;
}

.btn--sm.btn--icon {
    width: var(--target-sm);
}

.btn--block,
.btn--full {
    display: flex;
    width: 100%;
}

.btn-row,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

.btn-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
}

.btn-grid .btn {
    justify-content: flex-start;
}

.form-actions {
    margin-top: var(--space-5);
}

.form-actions--split {
    justify-content: space-between;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* Aktionssymbole (Kundenliste): gerahmte Quadrate mit Statusfarbe des Symbols */
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--c-control-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-text-strong);
    cursor: pointer;
}

.icon-button .icon {
    width: 18px;
    height: 18px;
}

.icon-button:hover {
    border-color: var(--c-border);
    background: var(--c-page);
    text-decoration: none;
}

.icon-button--call .icon { color: var(--c-info); }
.icon-button--start .icon { color: var(--c-danger); }
.icon-button--done .icon { color: var(--c-warning); }
.icon-button--cancel .icon { color: var(--c-danger); }

.icon-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.icon-actions form {
    display: inline;
    margin: 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--c-panel);
    color: var(--c-text-strong);
    font-size: var(--fs-small);
    line-height: 1.4;
}

a.chip:hover {
    background: var(--c-blue-light);
    color: var(--c-blue-dark);
    text-decoration: none;
}

/* ==== Kleinteile ============================================================ */

/* Tastenkappe: Kürzel an Schaltflächen und in Hilfen */
.kbd,
kbd.kbd {
    display: inline-block;
    min-width: 1.8em;
    padding: 0 6px;
    border: 1px solid var(--c-line-strong);
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    color: var(--c-text-strong);
    font: var(--fw-medium) 12px/1.6 var(--font);
    text-align: center;
    text-transform: none;
    letter-spacing: 0;
}

.btn .kbd {
    margin-left: auto;
}

.btn--accent .kbd,
.btn--primary .kbd {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* Etiketten: normale Schreibweise, nie mitten im Wort getrennt („Akti/v“): Etiketten sind kurz, Tabellen-
   spalten passen sich an. Nur auf schmalen Bildschirmen bricht ein Etikett zwischen Wörtern um. */
.badge,
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 1px 9px;
    border-radius: var(--radius-pill);
    background: #e9ecf1;
    color: #3d4552;
    font-size: var(--fs-tiny);
    font-weight: var(--fw-medium);
    line-height: 1.6;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    vertical-align: middle;
}

@media (max-width: 40rem) {
    .badge,
    .tag {
        white-space: normal;
    }
}

.badge .icon,
.tag .icon {
    width: 14px;
    height: 14px;
}

.badge--success, .tag--ok { background: #e1f3e2; color: var(--c-success-text); }
.badge--info, .tag--info { background: #e1edf8; color: var(--c-info-text); }
.badge--warning, .tag--warn { background: #fdefcc; color: var(--c-warning-text); }
.badge--danger, .tag--danger { background: #fbe1e2; color: var(--c-danger-text); }
/* Termin-Etikett und Hervorhebung: --highlight (früher Rot – Rot steht nur noch für Fehler und Löschen) */
.badge--online,
.badge--signal,
.tag--online { background: var(--highlight); color: var(--on-highlight); }
.badge--outline,
.tag--line { background: transparent; box-shadow: inset 0 0 0 1px var(--c-line-strong); color: var(--c-text-strong); }
.badge--plain { background: var(--c-panel); color: var(--c-text-strong); }

/* Punkt vor dem Etikett (z. B. „Aktiv“): Zustand zusätzlich als Form */
.badge--dot::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

/* Wartezeit mit Ampel: Minuten + drei Balken (1 = im Ziel, 2 = knapp, 3 = über Ziel) + Wort */
.wait {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--c-text-strong);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.wait__bars {
    display: inline-grid;
    grid-template-columns: repeat(3, 4px);
    align-items: end;
    gap: 2px;
    height: 14px;
}

.wait__bars::before,
.wait__bars::after,
.wait__bars > span {
    content: "";
    display: block;
    border-radius: 1px;
    background: var(--c-line-strong);
}

.wait__bars::before { height: 6px; }
.wait__bars > span { height: 10px; }
.wait__bars::after { height: 14px; }

.wait--ok .wait__bars::before { background: var(--ampel-ok); }
.wait--warn .wait__bars::before,
.wait--warn .wait__bars > span { background: var(--ampel-warn); }
.wait--over .wait__bars::before,
.wait--over .wait__bars > span,
.wait--over .wait__bars::after { background: var(--ampel-over); }

.wait__word {
    color: var(--c-muted);
    font-size: var(--fs-tiny);
    font-weight: var(--fw-medium);
}

.wait--ok .wait__word { color: var(--ampel-ok-text); }
.wait--warn .wait__word { color: var(--ampel-warn-text); }
.wait--over .wait__word,
.wait--over strong { color: var(--ampel-over-text); }

/* Live-Zustand einer Ansicht (Punkt + Text) */
.live {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--c-success-text);
    font-size: var(--fs-tiny);
    font-weight: var(--fw-medium);
}

.live::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--c-success);
    box-shadow: 0 0 0 3px var(--c-success-bg);
}

.live--off {
    color: var(--c-warning-text);
}

.live--off::before {
    background: var(--c-warning);
    box-shadow: 0 0 0 3px var(--c-warning-bg);
}

/* Segmente: Umschalter zwischen gleichrangigen Ansichten */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--c-line-strong);
    border-radius: 8px;
    background: var(--c-page);
}

.segmented button,
.segmented a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--c-text-strong);
    font: inherit;
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    text-decoration: none;
    cursor: pointer;
}

.segmented button:hover,
.segmented a:hover {
    background: var(--c-surface);
    text-decoration: none;
}

.segmented [aria-pressed="true"],
.segmented [aria-current="page"],
.segmented [aria-selected="true"] {
    background: var(--c-surface);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1), inset 0 0 0 1px var(--c-line-strong);
    color: var(--c-blue-dark);
}

.segmented button:focus-visible,
.segmented a:focus-visible {
    outline-offset: 0;
}

/* Filter-Chips über Listen (Mehrfachauswahl, Zahl der Treffer am Chip) */
.fchip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 4px 12px;
    border: 1px solid var(--c-control-border);
    border-radius: var(--radius-pill);
    background: var(--c-surface);
    color: var(--c-text-strong);
    font: inherit;
    font-size: var(--fs-small);
    text-decoration: none;
    cursor: pointer;
}

.fchip:hover {
    border-color: var(--c-border);
    text-decoration: none;
}

.fchip .icon {
    width: 15px;
    height: 15px;
}

.fchip[aria-pressed="true"],
.fchip[aria-current="true"],
.fchip[aria-current="page"] {
    border-color: var(--c-blue);
    background: var(--c-blue-light);
    color: var(--c-blue-dark);
    font-weight: var(--fw-medium);
}

.fchip__count {
    color: var(--c-muted);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
}

/* ==== Karten ================================================================ */
/* Weiße Fläche, feine Linie, 10 px Radius. Kopf ohne grauen Balken – Titel, Nebeninfo und Aktion. */

.panel,
.card {
    margin-bottom: var(--gap);
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

.panel:last-child,
.card:last-child {
    margin-bottom: 0;
}

.panel--accent,
.card--accent {
    border-top: 3px solid var(--highlight);
}

.panel--accent-blue {
    border-top: 3px solid var(--c-blue);
}

/* Besonderer Betriebszustand (z. B. Ausgabe gestoppt) – Farbe nur zusätzlich zum Text */
.panel--warning {
    border-top: 3px solid var(--c-warning);
}

.panel--flat {
    box-shadow: none;
}

.panel__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--c-line);
}

.panel__header h2,
.panel__header h3,
.panel__title {
    margin: 0;
    color: var(--c-heading);
    font-size: 17px;
    font-weight: var(--fw-medium);
    line-height: var(--lh-tight);
}

.panel__header h2 .icon,
.panel__header h3 .icon {
    width: 18px;
    height: 18px;
    margin-right: 4px;
    color: var(--c-blue);
    vertical-align: -0.15em;
}

.panel__header p {
    width: 100%;
    margin: 2px 0 0;
    color: var(--c-muted);
    font-size: var(--fs-small);
}

.panel__header > div > p {
    width: auto;
}

/* Kopf ohne Trennlinie, wenn direkt eine Tabelle oder Liste folgt */
.panel__header--plain {
    border-bottom: 0;
    padding-bottom: var(--space-2);
}

.panel__meta {
    color: var(--c-muted);
    font-size: var(--fs-small);
}

.panel__body {
    padding: var(--space-5);
}

.panel__body > :last-child {
    margin-bottom: 0;
}

.panel__body--flush {
    padding: 0;
}

.panel__footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--c-line);
    border-radius: 0 0 var(--radius-card) var(--radius-card);
    background: var(--c-subtle);
}

/* Ruhige Box (früher grau gerahmt): Kundendaten, Hinweise im Formular */
.form-panel {
    margin-bottom: var(--space-5);
    padding: var(--space-5);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-subtle);
}

.form-panel > :last-child {
    margin-bottom: 0;
}

/* ==== Kennzahlen ============================================================= */
/* Eine Zeile verbundener Zellen mit feiner Linie (statt Einzelkacheln mit Farbkante). Werte groß und
   tabellarisch; der Ton erscheint als kleine Markierung am Text – Kennzahlen werden nicht rot gefärbt
   (Rot bleibt der einen Hauptaktion vorbehalten). */

.kpis,
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 168px), 1fr));
    overflow: hidden;
    margin: 0 0 var(--gap);
    padding: 0;
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-surface);
    box-shadow: var(--shadow-card);
    list-style: none;
}

/* Trennlinien je Zelle (rechts und unten); die äußeren schneidet der Rahmen ab */
.kpis > li,
.stat-row > .stat {
    display: flex;
    min-width: 0;
    margin: 0 -1px -1px 0;
    border-right: 1px solid var(--c-line);
    border-bottom: 1px solid var(--c-line);
}

.kpis > li > * {
    flex: 1;
}

.kpi,
.metric,
.stat {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    padding: var(--space-4) var(--space-5);
    background: var(--c-surface);
    color: var(--c-text);
}

.kpi__value,
.metric__value,
.stat__value {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px var(--space-2);
    color: var(--c-heading);
    font-size: var(--fs-display);
    font-weight: var(--fw-bold);
    line-height: 1.15;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.kpi__unit {
    color: var(--c-text);
    font-size: var(--fs-md);
    font-weight: var(--fw-medium);
    letter-spacing: 0;
}

.kpi__label,
.metric__label,
.stat__label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: var(--space-1) 0 0;
    color: var(--c-text-strong);
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    letter-spacing: 0;
    text-transform: none;
}

.kpi__hint,
.stat__hint {
    display: block;
    margin-top: 2px;
    color: var(--c-muted);
    font-size: var(--fs-tiny);
}

.kpi__value .wait {
    flex-wrap: wrap;
    gap: 2px var(--space-2);
    font-size: inherit;
    white-space: normal;
}

@media (max-width: 640px) {
    .kpi,
    .metric,
    .stat {
        padding: var(--space-3) var(--space-4);
    }

    .kpi__value,
    .metric__value,
    .stat__value {
        font-size: 24px;
    }
}

.kpi__value .wait__word {
    font-size: var(--fs-small);
}

/* Einheiten kleiner („2 h 50 min“ bleibt eine Zeile), Zeitangabe bricht nicht um */
.kpi__value .wait strong {
    white-space: nowrap;
}

.kpi__value .wait__unit {
    font-size: 0.62em;
    font-weight: var(--fw-medium);
}

/* Ton: Markierung vor der Beschriftung (Form + Farbe), Wert bleibt schwarz.
   accent = Hervorhebung (--highlight; kpi--red ist der frühere Name und zeigt sie ebenfalls – kein Rot mehr),
   danger = Fehler und Störungen (rot, nur dafür). */
.kpi--accent .kpi__label::before,
.kpi--red .kpi__label::before,
.kpi--danger .kpi__label::before,
.kpi--blue .kpi__label::before,
.kpi--green .kpi__label::before,
.kpi--orange .kpi__label::before,
.kpi--grey .kpi__label::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.kpi--accent .kpi__label::before,
.kpi--red .kpi__label::before { background: var(--highlight); }
.kpi--danger .kpi__label::before { background: var(--c-danger); }
.kpi--blue .kpi__label::before { background: var(--c-blue); }
.kpi--green .kpi__label::before { background: var(--c-success); }
.kpi--orange .kpi__label::before { background: var(--c-warning); }
.kpi--grey .kpi__label::before { background: var(--c-border); }

/* Ausnahmezustand (z. B. Geräte gestört, Wartezeit über Ziel): ruhige Fläche + Text */
.kpi--alert {
    background: var(--c-danger-bg);
}

.kpi--alert .kpi__hint {
    color: var(--c-danger-text);
}

.kpi--warn {
    background: var(--c-warning-bg);
}

.kpi--warn .kpi__hint {
    color: var(--c-warning-text);
}

a.kpi {
    color: var(--c-text);
    text-decoration: none;
}

a.kpi::after {
    content: "";
    position: absolute;
    right: var(--space-4);
    top: var(--space-4);
    width: 8px;
    height: 8px;
    border-top: 2px solid var(--c-border);
    border-right: 2px solid var(--c-border);
    transform: rotate(45deg);
}

a.kpi:hover {
    background: var(--c-row-hover);
    text-decoration: none;
}

a.kpi:hover::after {
    border-color: var(--c-blue);
}

a.kpi:focus-visible {
    outline-offset: -4px;
}

/* ==== Bereichs-Kacheln ======================================================= */

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-3);
    list-style: none;
    margin: 0 0 var(--space-6);
    padding: 0;
}

.tile {
    margin: 0;
}

.tile a,
.tile__inner {
    display: flex;
    gap: var(--space-3);
    height: 100%;
    padding: var(--space-4);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-surface);
    box-shadow: var(--shadow-card);
    color: var(--c-text);
    transition: border-color var(--duration), background-color var(--duration);
}

.tile a:hover {
    border-color: var(--c-blue);
    background: var(--c-blue-tint);
    text-decoration: none;
}

.tile__icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--c-blue-light);
    color: var(--c-blue);
}

.tile__icon .icon {
    width: 20px;
    height: 20px;
}

.tile__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tile__title {
    color: var(--c-heading);
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
}

.tile a:hover .tile__title {
    color: var(--c-blue-dark);
}

.tile__text {
    color: var(--c-text);
    font-size: var(--fs-small);
}

/* ==== Formulare ============================================================== */

.form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
}

.form-section {
    display: grid;
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
    gap: var(--space-5) var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--c-line);
    scroll-margin-top: 72px;
}

.form-section:last-of-type {
    border-bottom: 0;
    padding-bottom: 0;
}

.form-section__intro h2,
.form-section__intro h3 {
    margin: 0;
    color: var(--c-heading);
    font-size: var(--fs-base);
    font-weight: var(--fw-bold);
}

.form-section__intro p {
    margin-top: var(--space-1);
    color: var(--c-muted);
    font-size: var(--fs-small);
}

.form-section__fields {
    display: grid;
    gap: var(--space-5);
    max-width: var(--form-max);
    min-width: 0;
}

@media (max-width: 900px) {
    .form-section {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-4);
    }
}

/* ---- Feldzeile: Felder und Tasten nebeneinander -------------------------------------------------
   Verbindlich für jede Zeile mit mehreren Feldern – in Formularen (.form-row), Filter- und
   Werkzeugleisten (.toolbar) und Suchen. Jede Zeile hat fünf Ebenen über Subgrid:
     Abstand · Beschriftung · Eingabe/Auswahl/Taste · Hinweis · Fehler.
   Damit stehen alle Beschriftungen einer Zeile auf einer Oberkante und alle Eingaben, Auswahlfelder
   und Tasten auf einer Ober- und Unterkante – auch wenn nur ein Feld einen Hinweis oder Fehler hat oder
   eine Beschriftung umbricht. Bedienelemente einer Zeile sind gleich hoch (--control-h; .form-row--lg
   48 px). Tasten stehen am Ende der Zeile, einzeln oder als Gruppe (.form-row__actions, .btn-row) und
   sitzen auf der Ebene der Eingaben; Kontrollkästchen ebenso. Schmal stehen die Felder untereinander.
   Bricht die Zeile um, trennt die Abstandsebene die Zeilen; vor der ersten Zeile hebt der negative
   Außenabstand sie auf. Abnahme: e2e/tests/feldzeilen.spec.ts (docs/design/designsystem.md 5.5). */
.form-row,
.toolbar {
    --row-space: var(--space-4);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--field-min, 12rem)), 1fr));
    align-items: start;
    column-gap: var(--space-4);
    row-gap: 0;
}

.form-row {
    margin-top: calc(-1 * var(--row-space));
}

.form-row--lg {
    --control-h: var(--control-h-lg);
}

:is(.form-row, .toolbar) > .field:not(fieldset) {
    grid-row: span 5;
    grid-template-rows: subgrid;
    gap: 0;
}

:is(.form-row, .toolbar) > .field:not(fieldset)::before {
    content: "";
    grid-row: 1;
    height: var(--row-space);
}

:is(.form-row, .toolbar) > .field:not(fieldset) > :is(label, legend, .field__label) {
    grid-row: 2;
    align-self: start;
    margin-bottom: 6px;
}

:is(.form-row, .toolbar) > .field:not(fieldset) > :not(label, legend, .field__label, .field__help, .hint, .field__error) {
    grid-row: 3;
}

:is(.form-row, .toolbar) > .field:not(fieldset) > :is(.field__help, .hint) {
    grid-row: 4;
    margin-top: 6px;
}

:is(.form-row, .toolbar) > .field:not(fieldset) > .field__error {
    grid-row: 5;
    margin-top: 6px;
}

/* Feldgruppen (fieldset) beginnen auf der Ebene der Beschriftungen */
:is(.form-row, .toolbar) > fieldset {
    grid-row: span 5;
    margin-top: var(--row-space);
}

/* Tasten, Tastengruppen, Kontrollkästchen und Text: auf der Ebene der Eingaben, unten bündig */
:is(.form-row, .toolbar) > :not(.field, fieldset) {
    grid-row: span 3;
    align-self: end;
    /* Abstandsebene auch für Tasten, die allein in einer (umbrochenen) Zeile stehen */
    margin: var(--row-space) 0 0;
}

:is(.form-row, .toolbar) > :is(.form-row__actions, .toolbar__actions, .btn-row, .form-actions) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

:is(.form-row, .toolbar) > :is(.btn, .check) {
    justify-self: start;
}

:is(.form-row, .toolbar) > .check {
    min-height: var(--control-h);
    align-items: center;
}

/* Bedienelemente einer Zeile: gleiche Höhe wie die Eingaben, auch kleine und große Tasten */
:is(.form-row, .toolbar) .btn:not(.btn--link) {
    min-height: var(--control-h);
    padding-block: 0;
}

.field {
    display: grid;
    align-content: start;   /* in Rastern gestreckt: Feldhöhe bleibt gleich, Felder einer Zeile fluchten */
    gap: 6px;
    min-width: 0;
}

.field__label,
.field > label,
fieldset > legend {
    color: var(--c-text-strong);
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    line-height: 1.4;
}

.field__required {
    margin-left: 2px;
    color: var(--c-blue);
}

.field__help,
.hint {
    margin: 0;
    color: var(--c-muted);
    font-size: var(--fs-small);
    line-height: 1.45;
}

.field__error {
    display: grid;
    gap: 2px;
    color: var(--c-danger-text);
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
}

.field__error span {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.field__error span::before {
    content: "!";
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    border-radius: 50%;
    background: var(--c-danger);
    color: #fff;
    font-size: 11px;
    font-weight: var(--fw-bold);
}

/* Eingabefelder: Rahmen ≥ 3 : 1 (WCAG 1.4.11), Fokus als deutlicher blauer Rahmen */
.input,
.field input:not([type="checkbox"], [type="radio"], [type="color"], [type="file"], [type="range"]),
.field select,
.field textarea,
.toolbar input:not([type="checkbox"], [type="radio"]),
.toolbar select,
.inline-input {
    width: 100%;
    min-height: var(--control-h);
    padding: 8px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-heading);
    font: inherit;
    font-size: var(--fs-base);
    line-height: 1.4;
    transition: border-color var(--duration), box-shadow var(--duration);
}

.field select,
.toolbar select,
select.input,
select.inline-input {
    padding-right: 36px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23424a57' stroke-width='1.8' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.field select[multiple] {
    padding-right: 12px;
    background-image: none;
}

/* Einzeilige Eingaben und Auswahlfelder: genau so hoch wie Tasten (--control-h), damit Ober- und
   Unterkanten in einer Zeile übereinstimmen */
input.input,
select.input,
.field input:not([type="checkbox"], [type="radio"], [type="color"], [type="file"], [type="range"]),
.field select:not([multiple]),
.toolbar input:not([type="checkbox"], [type="radio"]),
.toolbar select:not([multiple]),
input.inline-input,
select.inline-input {
    height: var(--control-h);
    padding-block: 0;
}

.field textarea {
    min-height: 112px;
    line-height: 1.5;
    resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.inline-input:hover {
    border-color: var(--c-border-strong);
}

.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.toolbar input:focus,
.toolbar select:focus,
.inline-input:focus {
    border-color: var(--c-focus);
    outline: none;
    box-shadow: 0 0 0 1px var(--c-focus), 0 0 0 4px var(--brand-accent-soft);
}

.field input::placeholder,
.field textarea::placeholder,
.inline-input::placeholder {
    color: var(--c-muted);
}

.field input[readonly],
.field input[disabled],
.field select[disabled],
.field textarea[disabled] {
    border-color: var(--c-line-strong);
    background: var(--c-subtle);
    color: var(--c-muted);
    cursor: not-allowed;
}

.field [aria-invalid="true"],
.field .is-invalid {
    border-color: var(--c-danger);
    box-shadow: 0 0 0 1px var(--c-danger);
}

.field input[type="color"] {
    width: 4rem;
    height: var(--target-min);
    padding: 3px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--c-blue);
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: var(--space-2) var(--space-3) var(--space-3);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
}

legend {
    padding: 0 6px;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 6px 0;
    color: var(--c-text-strong);
    font-size: var(--fs-base);
}

.check input {
    flex: none;
    margin-top: 3px;
}

.check__text {
    min-width: 0;
}

.check__text strong {
    display: block;
    color: var(--c-text-strong);
    font-weight: var(--fw-medium);
}

.check__text span {
    display: block;
    color: var(--c-muted);
    font-size: var(--fs-small);
}

/* Links in Beschriftungen von Kontrollkästchen (z. B. Datenschutzhinweis) immer als Link erkennbar */
.check__text a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.choice-list {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    border: 0;
}

.errors-summary {
    margin-bottom: var(--space-5);
}

.errors-summary ul {
    margin: var(--space-1) 0 0;
}

/* Gruppe mehrsprachiger Texte bzw. Mehrfachauswahl: feine Linie statt grauer Box */
fieldset.field--group {
    padding: var(--space-3) var(--space-4) var(--space-4);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-surface);
}

fieldset.field--group > legend {
    padding: 0 6px;
    color: var(--c-text-strong);
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
}

fieldset.field--group > div {
    display: grid;
    gap: var(--space-3);
}

/* Auswahlkacheln (Uhrzeiten, Anliegen) */
.choice-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-3);
    list-style: none;
    margin: 0 0 var(--space-5);
    padding: 0;
}

.choice-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--c-control-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-text-strong);
    font: inherit;
    font-size: var(--fs-base);
    text-align: left;
    cursor: pointer;
}

.choice-tile:hover {
    border-color: var(--c-blue);
    color: var(--c-blue-dark);
    text-decoration: none;
}

.choice-tile[aria-pressed="true"],
.choice-tile.is-selected {
    border-color: var(--c-blue);
    box-shadow: inset 0 0 0 1px var(--c-blue);
    background: var(--c-blue-tint);
}

/* Mitlaufende Speichern-Leiste: Aktionen am Ende langer Formulare bleiben beim Scrollen sichtbar
   (in Karten-Formularen automatisch, sonst mit .form-actions--sticky). */
.form-actions--sticky,
form.panel > .panel__footer:last-child,
form > .panel > .panel__footer:last-child,
form.panel > .btn-row:last-child,
form.panel > .form-actions:last-child {
    position: sticky;
    bottom: 0;
    z-index: 15;
}

.form-actions--sticky {
    margin-top: var(--space-5);
    padding: var(--space-3) var(--space-5);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-surface);
    box-shadow: 0 -4px 16px rgba(16, 24, 40, 0.06);
}

form.panel > .panel__footer:last-child,
form > .panel > .panel__footer:last-child {
    box-shadow: 0 -1px 0 var(--c-line), 0 -6px 16px rgba(16, 24, 40, 0.05);
}

form.panel > .btn-row:last-child,
form.panel > .form-actions:last-child {
    margin: var(--space-5) calc(-1 * var(--space-5)) calc(-1 * var(--space-5));
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--c-line);
    border-radius: 0 0 var(--radius-card) var(--radius-card);
    background: var(--c-subtle);
    box-shadow: 0 -6px 16px rgba(16, 24, 40, 0.05);
}

/* Abschnittsnavigation langer Formulare (erzeugt vom Stimulus-Controller „form-sections“) */
.form-nav {
    position: sticky;
    top: 0;
    z-index: 16;
    /* Breite folgt dem Formular, nicht der Zahl der Abschnitte (sonst scrollt die Seite quer) */
    contain: inline-size;
    display: flex;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin: 0 0 var(--space-5);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: color-mix(in srgb, var(--c-surface) 94%, transparent);
    box-shadow: var(--shadow-card);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.form-nav__label {
    flex: none;
    color: var(--c-muted);
    font-size: var(--fs-tiny);
    font-weight: var(--fw-medium);
}

.form-nav__list {
    display: flex;
    gap: 2px;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    list-style: none;
    scrollbar-width: none;
}

.form-nav__link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 4px 10px;
    border-radius: var(--radius);
    color: var(--c-text-strong);
    font-size: var(--fs-small);
    white-space: nowrap;
    text-decoration: none;
}

.form-nav__link:hover {
    background: var(--c-row-hover);
    color: var(--c-blue-dark);
    text-decoration: none;
}

.form-nav__link[aria-current="true"] {
    background: var(--c-blue-light);
    color: var(--c-blue-dark);
    font-weight: var(--fw-medium);
}

.form-nav__link:focus-visible {
    outline-offset: -3px;
}

.form-nav__link.has-error::after {
    content: "!";
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--c-danger);
    color: #fff;
    font-size: 11px;
    font-weight: var(--fw-bold);
}

/* Symbolwahl als Raster mit Suche (Stimulus „icon-picker“) */
.icon-picker {
    display: grid;
    gap: var(--space-3);
}

.icon-picker__search {
    position: relative;
    max-width: 22rem;
}

.icon-picker__search .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 16px;
    height: 16px;
    color: var(--c-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.icon-picker__search input.input {
    padding-left: 36px;
}

.icon-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: var(--space-2);
    max-height: 22rem;
    margin: 0;
    padding: 2px;
    overflow-y: auto;
    border: 0;
}

.icon-option {
    position: relative;
    margin: 0;
}

.icon-option input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.icon-option__face {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 6px;
    height: 100%;
    min-height: 84px;
    padding: var(--space-3) var(--space-1) var(--space-2);
    border: 1px solid var(--c-line-strong);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-text);
    font-size: var(--fs-xs);
    line-height: 1.3;
    text-align: center;
    overflow-wrap: anywhere;
}

.icon-option__face .icon {
    width: 24px;
    height: 24px;
    color: var(--c-text-strong);
}

.icon-option input:hover + .icon-option__face {
    border-color: var(--c-border);
    background: var(--c-page);
}

.icon-option input:checked + .icon-option__face {
    border-color: var(--c-blue);
    background: var(--c-blue-light);
    box-shadow: inset 0 0 0 1px var(--c-blue);
    color: var(--c-blue-dark);
    font-weight: var(--fw-medium);
}

.icon-option input:checked + .icon-option__face .icon {
    color: var(--c-blue);
}

.icon-option input:focus-visible + .icon-option__face {
    outline: var(--focus-width) solid var(--c-focus);
    outline-offset: var(--focus-offset);
}

.icon-picker__empty {
    margin: 0;
    color: var(--c-muted);
    font-size: var(--fs-small);
}

/* Farbwahl: Farbfeld + Hex-Eingabe + Vorschlagsfarben */
.color-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

.color-picker__well {
    position: relative;
    flex: none;
    width: var(--target-min);
    height: var(--target-min);
    overflow: hidden;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
}

.color-picker__well input[type="color"] {
    position: absolute;
    inset: -6px;
    width: calc(100% + 12px);
    height: calc(100% + 12px);
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.color-picker__well:focus-within {
    outline: var(--focus-width) solid var(--c-focus);
    outline-offset: var(--focus-offset);
}

.color-picker > input.input,
.color-picker > input[type="text"] {
    width: 9rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.color-picker__presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.color-swatch-button {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(16, 24, 40, 0.25);
    border-radius: 50%;
    cursor: pointer;
}

.color-swatch-button[aria-pressed="true"] {
    box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 4px var(--c-heading);
}

/* Filterleiste über Listen: eine Feldzeile im Rahmen (Aufbau siehe „Feldzeile“). Die Abstandsebene der
   ersten Zeile bildet den Innenabstand oben. */
.toolbar {
    --field-min: 13rem;
    margin-bottom: var(--space-4);
    padding: 0 var(--space-4) var(--space-4);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-surface);
}

/* Filterzeile ohne Beschriftungen: Suche, Chips, Ansicht (Listen der Einrichtung) – alle Bedienelemente
   gleich hoch und mittig auf einer Linie */
.filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin-bottom: var(--space-4);
}

.filterbar .btn:not(.btn--link),
.filterbar .fchip,
.filterbar select {
    min-height: var(--control-h);
    padding-block: 0;
}

.filterbar select {
    height: var(--control-h);
}

.filterbar__end {
    display: flex;
    gap: var(--space-2);
    margin-left: auto;
}

.filterbar__sep {
    width: 1px;
    height: 28px;
    background: var(--c-line);
}

.search-field {
    position: relative;
    flex: 1 1 240px;
    max-width: 360px;
}

.search-field .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 16px;
    height: 16px;
    color: var(--c-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.search-field input {
    width: 100%;
    height: var(--control-h);
    padding: 0 12px 0 36px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-heading);
    font: inherit;
    font-size: var(--fs-small);
}

.search-field input:focus {
    border-color: var(--c-focus);
    outline: none;
    box-shadow: 0 0 0 1px var(--c-focus), 0 0 0 4px var(--brand-accent-soft);
}

/* Massenaktionen: erscheint, sobald etwas ausgewählt ist */
.bulkbar {
    position: sticky;
    bottom: var(--space-4);
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin-top: var(--space-4);
    padding: 10px 12px 10px 18px;
    border-radius: var(--radius-card);
    background: var(--c-slate);
    color: #fff;
    box-shadow: 0 10px 30px rgba(10, 20, 50, 0.3);
}

.bulkbar strong {
    margin-right: var(--space-2);
}

.bulkbar .btn {
    min-height: 36px;
    border-color: rgba(255, 255, 255, 0.5);
    background: transparent;
    color: #fff;
}

.bulkbar .btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.bulkbar :focus-visible {
    outline-color: #fff;
}

.bulkbar__end {
    margin-left: auto;
}

/* ==== Tabellen ================================================================ */
/* Ruhig: feine Zeilenlinien, Kopf in normaler Schreibweise, Zahlen tabellarisch und rechtsbündig.
   Der Kopf läuft mit, solange die Tabelle in die Breite passt (Stimulus „tables“ hebt den
   Scrollbereich dann auf, Klasse is-fit); sonst scrollt die Tabelle in ihrem Rahmen quer. */

.table-wrap {
    /* position: relative hält absolut positionierte Inhalte (z. B. visually-hidden) im Scrollbereich –
       sonst scrollt bei schmalen Bildschirmen die ganze Seite quer */
    position: relative;
    overflow-x: auto;
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-surface);
}

/* Passt die Tabelle (Stimulus „tables“), entfällt der Scrollbereich: Kopf läuft mit, Menüs in Zeilen
   ragen über den Rand hinaus. Die Ecken der Kopf- und letzten Zeile folgen dem Radius des Rahmens. */
.table-wrap.is-fit {
    overflow: visible;
}

.table-wrap.is-fit > .table > thead > tr:first-child > :first-child {
    border-top-left-radius: calc(var(--radius-card) - 1px);
}

.table-wrap.is-fit > .table > thead > tr:first-child > :last-child {
    border-top-right-radius: calc(var(--radius-card) - 1px);
}

.table-wrap.is-fit > .table > tbody:last-child > tr:last-child > :first-child {
    border-bottom-left-radius: calc(var(--radius-card) - 1px);
}

.table-wrap.is-fit > .table > tbody:last-child > tr:last-child > :last-child {
    border-bottom-right-radius: calc(var(--radius-card) - 1px);
}

.panel .panel__header + .table-wrap.is-fit > .table > thead > tr:first-child > :is(:first-child, :last-child) {
    border-radius: 0;
}

/* Gestapelte Tabelle auf schmalen Bildschirmen (Stimulus „tables“): Zeile als Block, Spaltenname vor
   jedem Wert – kein Querscrollen bei 390 px. Die Rollen der Tabelle setzt der Controller ausdrücklich. */
@media (max-width: 640px) {
    .table-wrap.is-stacked > .table,
    .table-wrap.is-stacked > .table > tbody,
    .table-wrap.is-stacked > .table > tbody > tr {
        display: block;
    }

    .table-wrap.is-stacked > .table > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .table-wrap.is-stacked > .table > tbody > tr {
        padding: var(--space-3) var(--space-4);
        border-bottom: 1px solid var(--c-line);
    }

    .table-wrap.is-stacked > .table > tbody > tr:last-child {
        border-bottom: 0;
    }

    .table-wrap.is-stacked > .table > tbody > tr > :is(td, th) {
        display: grid;
        grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
        align-items: start;
        justify-items: start;
        gap: var(--space-3);
        overflow-wrap: anywhere;
        padding: 4px 0;
        border: 0;
        text-align: left;
        white-space: normal;
        border-radius: 0 !important;
        box-shadow: none;
    }

    .table-wrap.is-stacked > .table > tbody > tr > :is(td, th)::before {
        content: attr(data-label);
        color: var(--c-muted);
        font-size: var(--fs-tiny);
        font-weight: var(--fw-regular);
        line-height: 1.6;
    }

    /* Erste Spalte (Name, Nummer) als Titel der Zeile, Aktionen ohne Beschriftung darunter */
    .table-wrap.is-stacked > .table > tbody > tr > :first-child {
        display: block;
        padding-bottom: var(--space-2);
        font-size: var(--fs-base);
    }

    .table-wrap.is-stacked > .table > tbody > tr > :is(td, th):first-child::before,
    .table-wrap.is-stacked > .table > tbody > tr > :is(td, th)[data-label=""]::before {
        display: none;
    }

    .table-wrap.is-stacked > .table > tbody > tr > [data-label=""] {
        display: block;
    }

    .table-wrap.is-stacked > .table > tbody > tr > .table__actions {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
        padding-top: var(--space-2);
    }

    .table-wrap.is-stacked > .table > tbody > tr > .table__actions::before {
        display: none;
    }

    .table-wrap.is-stacked > .table > tbody > tr > .num {
        text-align: left;
    }

    .table-wrap.is-stacked > .table > tbody > tr.is-over {
        box-shadow: inset 4px 0 var(--c-danger);
    }

    .table-wrap.is-stacked > .table > tbody > tr.is-over > :first-child {
        box-shadow: none;
    }
}

.table-wrap[tabindex]:focus-visible {
    outline-offset: 2px;
}

.panel .table-wrap,
.card .table-wrap {
    border: 0;
    border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.panel .panel__header + .table-wrap,
.panel .table-wrap:not(:last-child) {
    border-radius: 0;
}

.table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--c-surface);
    color: var(--c-text-strong);
    font-size: 15px;
    line-height: 1.45;
    font-variant-numeric: tabular-nums;
}

.table th,
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--c-line);
    text-align: left;
    vertical-align: middle;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-top: 10px;
    padding-bottom: 10px;
    background: var(--c-subtle);
    border-bottom: 1px solid var(--c-line-strong);
    color: var(--c-text);
    font-size: var(--fs-tiny);
    font-weight: var(--fw-medium);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color var(--duration);
}

.table tbody tr:hover {
    background: var(--c-row-hover);
}

.table tbody tr:last-child > * {
    border-bottom: 0;
}

.table tbody th {
    font-weight: var(--fw-medium);
}

.table td strong {
    color: var(--c-heading);
    font-weight: var(--fw-medium);
}

/* Links in Tabellen blau und kräftig (DIWA: Blau für Links); Schaltflächen behalten ihr Aussehen */
.table :is(td, tbody th) a:not(.btn, .menu__item) {
    color: var(--c-blue);
    font-weight: var(--fw-medium);
}

.table :is(td, tbody th) a:not(.btn, .menu__item):hover {
    color: var(--c-blue-hover);
}

.table :is(td, tbody th) > .subtle,
.table :is(td, tbody th) > small {
    display: block;
    margin-top: 1px;
    font-weight: var(--fw-regular);
}

.table tbody th strong {
    color: var(--c-heading);
    font-weight: var(--fw-medium);
}

.table--zebra tbody tr:nth-child(even) {
    background: var(--c-subtle);
}

.table--compact th,
.table--compact td {
    padding: 8px 12px;
}

.table .num,
.table td.num,
.table th.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.table__actions {
    text-align: right;
    white-space: nowrap;
}

.table__actions > * + * {
    margin-left: var(--space-1);
}

/* Zeile direkt in der Tabelle bearbeiten (inline-edit): Felder in den Zellen, Tasten rechts */
.table tr.table__edit-row > td {
    background: var(--c-blue-tint);
    vertical-align: middle;
}

.table__edit-row .input {
    min-width: 6rem;
}

.table__edit-row .check {
    min-height: var(--control-h);
    align-items: center;
    padding: 0;
}

.table__edit-row .table__actions .btn-row {
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.table tr.is-muted td {
    color: var(--c-muted);
}

.table tr.is-called td {
    background: var(--c-info-bg);
}

.table tr.is-active td {
    background: var(--c-danger-bg);
}

.table tr.is-selected td {
    background: var(--c-blue-tint);
}

/* Zeile mit Handlungsbedarf: Markierung links (Form) */
.table tr.is-over > :first-child {
    box-shadow: inset 4px 0 var(--c-danger);
}

.table-empty {
    padding: var(--space-6) var(--space-4) !important;
    color: var(--c-muted);
    text-align: center !important;
}

/* Kleine Lagetabelle (Startseiten): Zahl groß */
.table .big {
    color: var(--c-heading);
    font-size: 20px;
    font-weight: var(--fw-bold);
}

/* ==== Status (Symbole der Kundensteuerung, immer mit Text) =================== */

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--c-text-strong);
    font-size: var(--fs-small);
    white-space: nowrap;
}

.status::before {
    content: "";
    flex: none;
    width: 11px;
    height: 11px;
}

.status--waiting::before { border-radius: 50%; background: var(--c-success); }
.status--called::before { width: 10px; height: 10px; background: var(--c-info); transform: rotate(45deg); }
.status--in-service::before { background: var(--c-danger); }
.status--parked::before { border-radius: 50%; border: 2px solid var(--c-warning); background: transparent; }
.status--completed::before { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--c-warning); }
.status--cancelled::before,
.status--no-show::before { content: "✕"; width: auto; height: auto; color: var(--c-danger); font-weight: var(--fw-bold); line-height: 1; }
.status--closed::before { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--c-border); }

.legend {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-3);
    padding: 6px var(--space-3);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    background: var(--c-surface);
    font-size: var(--fs-small);
}

.legend__title {
    color: var(--c-text-strong);
    font-weight: var(--fw-medium);
}

/* ==== Meldungen ============================================================== */

.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--c-info-border);
    border-radius: var(--radius-card);
    background: var(--c-info-bg);
    color: var(--c-text-strong);
}

.alert:last-child {
    margin-bottom: 0;
}

.alert > .icon {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    color: var(--c-info);
}

.alert__body {
    min-width: 0;
}

.alert__body > p:last-child {
    margin-bottom: 0;
}

.alert__title {
    display: block;
    margin-bottom: 2px;
    font-weight: var(--fw-bold);
}

.alert--success { border-color: var(--c-success-border); background: var(--c-success-bg); }
.alert--success > .icon { color: var(--c-success); }
.alert--warning { border-color: var(--c-warning-border); background: var(--c-warning-bg); color: var(--c-warning-text); }
.alert--warning > .icon { color: var(--c-warning); }
.alert--danger { border-color: var(--c-danger-border); background: var(--c-danger-bg); color: var(--c-danger-text); }
.alert--danger > .icon { color: var(--c-danger); }

.flash-stack {
    display: grid;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.flash-stack .alert {
    margin: 0;
}

/* hellgrüne Ergebnisbox („Der Termin wurde erstellt“) */
.confirm-box {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--c-success-border);
    border-radius: var(--radius-card);
    background: var(--c-success-bg);
    color: var(--c-text-strong);
}

/* ==== Leerer Zustand ========================================================== */
/* Ein Satz, was fehlt, eine Haupttaste – kein Illustrations-Schmuck. */

.empty {
    display: grid;
    justify-items: center;
    gap: var(--space-2);
    padding: var(--space-7) var(--space-5);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-surface);
    color: var(--c-text);
    text-align: center;
}

.panel .empty {
    border: 0;
    border-radius: 0;
    background: none;
}

.empty > .icon {
    width: 48px;
    height: 48px;
    padding: 12px;
    border-radius: 50%;
    background: var(--c-blue-light);
    color: var(--c-blue);
}

.empty h2,
.empty h3 {
    margin: var(--space-2) 0 0;
    color: var(--c-heading);
    font-size: var(--fs-md);
    font-weight: var(--fw-medium);
}

.empty p {
    max-width: 56ch;
    margin: 0 auto var(--space-2);
}

/* ==== Beschriftete Werte ====================================================== */

.facts {
    display: grid;
    grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr);
    gap: var(--space-2) var(--space-5);
    margin: 0;
}

.facts dt {
    color: var(--c-muted);
    font-size: var(--fs-small);
}

.facts dd {
    margin: 0;
    color: var(--c-text-strong);
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .facts {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
    }

    .facts dd {
        margin-bottom: var(--space-2);
    }
}

/* ==== Reiter ================================================================== */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--space-1);
    margin: 0 0 var(--space-5);
    padding: 0;
    border-bottom: 1px solid var(--c-line-strong);
    list-style: none;
}

.tabs a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: -1px;
    padding: 10px 14px;
    border-bottom: 3px solid transparent;
    color: var(--c-text);
    font-weight: var(--fw-medium);
    white-space: nowrap;
}

.tabs a:hover {
    color: var(--c-blue-dark);
    text-decoration: none;
    border-bottom-color: var(--c-line-strong);
}

.tabs a[aria-current="page"],
.tabs a[aria-selected="true"] {
    border-bottom-color: var(--c-blue);
    color: var(--c-blue-dark);
}

.tabs a:focus-visible {
    outline-offset: -3px;
}

/* ==== Schrittfolge (Assistenten) =============================================== */

.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: step;
}

.steps__item {
    position: relative;
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: var(--space-3);
    padding-bottom: var(--space-4);
    counter-increment: step;
}

.steps__item::before {
    content: counter(step);
    z-index: 1;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--c-line-strong);
    border-radius: 50%;
    background: var(--c-surface);
    color: var(--c-text);
    font-size: var(--fs-small);
    font-weight: var(--fw-bold);
    font-variant-numeric: tabular-nums;
}

.steps__item:not(:last-child)::after {
    content: "";
    position: absolute;
    left: calc(1rem - 1px);
    top: 2rem;
    bottom: 0;
    width: 2px;
    background: var(--c-line);
}

.steps__item[data-state="done"]::before {
    content: "✓";
    border-color: var(--c-success);
    background: var(--c-success);
    color: #fff;
}

.steps__item[data-state="current"]::before {
    border-color: var(--c-blue);
    background: var(--c-blue);
    color: #fff;
}

.steps__item a {
    font-weight: var(--fw-medium);
}

.steps__item p {
    margin: 0;
    color: var(--c-muted);
    font-size: var(--fs-small);
}

/* Schrittleiste links (Einrichtungsassistent): Liste mit Zustand, aktueller Schritt hervorgehoben */
.step-nav {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: stepnav;
}

.step-nav__item {
    counter-increment: stepnav;
}

.step-nav__link {
    position: relative;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
    min-height: 44px;
    padding: 6px var(--space-3);
    border-radius: var(--radius);
    color: var(--c-text-strong);
    font-size: var(--fs-small);
    line-height: 1.35;
    text-decoration: none;
}

.step-nav__link::before {
    content: counter(stepnav);
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 2px solid var(--c-line-strong);
    border-radius: 50%;
    background: var(--c-surface);
    color: var(--c-text);
    font-size: var(--fs-tiny);
    font-weight: var(--fw-bold);
}

.step-nav__link:hover {
    background: var(--c-row-hover);
    color: var(--c-blue-dark);
    text-decoration: none;
}

.step-nav__link small {
    display: block;
    color: var(--c-muted);
    font-size: var(--fs-xs);
}

.step-nav__item[data-state="done"] .step-nav__link::before {
    content: "✓";
    border-color: var(--c-success);
    background: var(--c-success);
    color: #fff;
}

.step-nav__item[data-state="current"] .step-nav__link::before {
    border-color: var(--c-blue);
    color: var(--c-blue-dark);
}

.step-nav__item[data-state="error"] .step-nav__link::before {
    content: "!";
    border-color: var(--c-danger);
    background: var(--c-danger);
    color: #fff;
}

.step-nav__link[aria-current="step"] {
    background: var(--c-blue-light);
    color: var(--c-blue-dark);
    font-weight: var(--fw-medium);
}

.step-nav__link:focus-visible {
    outline-offset: -3px;
}

/* Fortschritt waagrecht (Online-Buchung) */
.wizard-steps {
    display: flex;
    flex-wrap: wrap;
    margin: 0 0 var(--space-6);
    padding: 0;
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-surface);
    list-style: none;
    counter-reset: wizard;
    overflow: hidden;
}

.wizard-steps li {
    flex: 1 1 0;
    min-width: 9rem;
    padding: var(--space-3) var(--space-4);
    border-right: 1px solid var(--c-line);
    border-bottom: 3px solid transparent;
    color: var(--c-text);
    font-size: var(--fs-small);
    counter-increment: wizard;
}

.wizard-steps li:last-child {
    border-right: 0;
}

.wizard-steps li::before {
    content: counter(wizard) ". ";
    font-weight: var(--fw-bold);
}

.wizard-steps li[aria-current="step"] {
    border-bottom-color: var(--c-blue);
    background: var(--c-blue-tint);
    color: var(--c-heading);
    font-weight: var(--fw-medium);
}

/* ==== Umschalter =============================================================== */

.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--target-min);
    cursor: pointer;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 2.75rem;
    height: 1.5rem;
    margin: 0;
    cursor: pointer;
}

.switch__track {
    position: relative;
    flex: none;
    width: 2.75rem;
    height: 1.5rem;
    border-radius: var(--radius-pill);
    background: var(--c-border);
    transition: background-color var(--duration);
}

.switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(1.5rem - 6px);
    height: calc(1.5rem - 6px);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: transform var(--duration);
}

.switch input:checked + .switch__track {
    background: var(--c-blue);
}

.switch input:checked + .switch__track::after {
    transform: translateX(1.25rem);
}

.switch input:focus-visible + .switch__track {
    outline: var(--focus-width) solid var(--c-focus);
    outline-offset: var(--focus-offset);
}

/* ==== Dialog, Menü, Kurzmeldung ================================================== */

.dialog {
    width: min(520px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--c-line);
    border-radius: 14px;
    background: var(--c-surface);
    box-shadow: var(--shadow-pop);
    color: var(--c-text);
}

.dialog::backdrop {
    background: var(--overlay);
}

.dialog__header {
    padding: var(--space-5) var(--space-5) 0;
}

.dialog__header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: var(--fw-medium);
}

.dialog__body {
    padding: var(--space-3) var(--space-5) var(--space-5);
}

.dialog__footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5) var(--space-4);
    border-top: 1px solid var(--c-line);
    border-radius: 0 0 14px 14px;
    background: var(--c-subtle);
}

.dialog--danger {
    border-top: 0;
}

.dialog--danger .dialog__header h2::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: var(--space-2);
    border-radius: 2px;
    background: var(--c-danger);
    vertical-align: 0.1em;
}

/* Zeilenmenü „⋯“ (seltene und Gefahr-Aktionen), Stimulus „disclosure“ */
.menu {
    position: relative;
    display: inline-block;
}

.menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    min-width: 220px;
    padding: var(--space-1);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-surface);
    box-shadow: var(--shadow-pop);
    text-align: left;
    white-space: normal;
}

.menu__panel form {
    display: block;
    margin: 0;
}

.menu__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-height: 36px;
    padding: 6px var(--space-3);
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--c-text-strong);
    font: inherit;
    font-size: var(--fs-small);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.menu__item .icon {
    width: 16px;
    height: 16px;
    color: var(--c-muted);
}

.menu__item:hover {
    background: var(--c-row-hover);
    color: var(--c-blue-dark);
    text-decoration: none;
}

.menu__item--danger,
.menu__item--danger .icon {
    color: var(--c-danger-text);
}

.menu__item--danger:hover {
    background: var(--c-danger-bg);
    color: var(--c-danger-text);
}

.menu__item:focus-visible {
    outline-offset: -3px;
}

.menu__sep {
    height: 1px;
    margin: var(--space-1) 0;
    background: var(--c-line);
}

/* Aufklappfeld an einer Zelle (Zuordnung ändern) */
.popover {
    position: absolute;
    z-index: 30;
    width: 300px;
    max-width: calc(100vw - 32px);
    padding: var(--space-3);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-surface);
    box-shadow: var(--shadow-pop);
    text-align: left;
    white-space: normal;
}

.popover h3 {
    margin: 0 0 var(--space-2);
    font-size: var(--fs-small);
    font-weight: var(--fw-bold);
}

.toast-region {
    position: fixed;
    right: var(--space-5);
    bottom: calc(var(--footer-h) + var(--space-4));
    z-index: 200;
    display: grid;
    gap: var(--space-2);
}

.toast {
    min-width: 260px;
    max-width: 420px;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--c-line);
    border-left: 4px solid var(--c-success);
    border-radius: var(--radius);
    background: var(--c-surface);
    box-shadow: var(--shadow-pop);
    color: var(--c-text-strong);
    font-size: var(--fs-small);
}

.toast--info { border-left-color: var(--c-blue); }
.toast--warning { border-left-color: var(--c-warning); }

/* Seitensuche (Einstieg „Suchen oder Befehl“, solange keine Befehlspalette eingebunden ist) */
.page-finder {
    width: min(640px, calc(100vw - 32px));
    margin-top: 12vh;
}

.page-finder .dialog__body {
    padding-top: var(--space-4);
}

.page-finder__field {
    position: relative;
}

.page-finder__field .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 18px;
    height: 18px;
    color: var(--c-blue);
    transform: translateY(-50%);
    pointer-events: none;
}

.page-finder__field input.input {
    min-height: 48px;
    padding-left: 42px;
    font-size: var(--fs-md);
}

.page-finder__list {
    max-height: min(52vh, 460px);
    margin: var(--space-3) 0 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.page-finder__group {
    padding: var(--space-3) var(--space-2) var(--space-1);
    color: var(--c-muted);
    font-size: var(--fs-tiny);
    font-weight: var(--fw-medium);
}

.page-finder__link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 40px;
    padding: 6px var(--space-2);
    border-radius: var(--radius);
    color: var(--c-text-strong);
    text-decoration: none;
}

.page-finder__link .icon {
    width: 18px;
    height: 18px;
    color: var(--c-blue);
}

.page-finder__link small {
    margin-left: auto;
    color: var(--c-muted);
    font-size: var(--fs-tiny);
}

.page-finder__link:hover,
.page-finder__link.is-selected {
    background: var(--c-blue-light);
    color: var(--c-blue-dark);
    text-decoration: none;
}

.page-finder__link:focus-visible {
    outline-offset: -3px;
}

.page-finder__hint {
    margin: var(--space-3) 0 0;
    color: var(--c-muted);
    font-size: var(--fs-tiny);
}

/* ==== Hinweise für alle Mitarbeitenden (Startseiten) ============================== */

.start-notices {
    display: grid;
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.start-notices > .panel {
    margin: 0;
}

/* Auf der eigenen Startseite (Arbeitsplatz, Empfang): „Ausblenden“ rechts im Kopf des ersten Hinweises */
.start-notices--home {
    position: relative;
}

.start-notices--home > .panel:first-child .panel__header {
    padding-right: 9.5rem;
}

.start-notices__dismiss {
    position: absolute;
    top: calc(var(--space-4) - 1px);
    right: var(--space-4);
}

@media (max-width: 640px) {
    .start-notices--home > .panel:first-child .panel__header {
        padding-right: var(--space-5);
    }

    .start-notices__dismiss {
        position: static;
        justify-self: end;
        margin-top: calc(var(--gap) * -0.5);
    }
}

/* ==== Zu erledigen (Startseiten) ================================================= */

.todo-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.todo {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px var(--space-3);
    padding: var(--space-3) 0;
    border-top: 1px solid var(--c-line);
}

.todo:first-child {
    border-top: 0;
    padding-top: 0;
}

.todo:last-child {
    padding-bottom: 0;
}

.todo > .icon {
    width: 22px;
    height: 22px;
    align-self: start;
    margin-top: 1px;
}

.todo__text {
    min-width: 0;
    color: var(--c-text-strong);
}

.todo__text strong {
    font-weight: var(--fw-medium);
}

.todo small,
.todo__hint {
    display: block;
    color: var(--c-text);
    font-size: var(--fs-small);
}

.todo--error > .icon { color: var(--c-danger); }
.todo--warn > .icon,
.todo--warning > .icon { color: var(--c-warning); }
.todo--info > .icon { color: var(--c-blue); }
.todo--ok > .icon { color: var(--c-success); }

@media (max-width: 640px) {
    .todo {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .todo > .btn,
    .todo > a.btn {
        grid-column: 2;
        justify-self: start;
        margin-top: var(--space-2);
    }
}

.todo-empty {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    color: var(--c-success-text);
    font-weight: var(--fw-medium);
}

.todo-empty .icon {
    width: 20px;
    height: 20px;
    color: var(--c-success);
}

/* Häufige Aufgaben: Schaltflächen im Raster */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
}

.quick-actions .btn {
    justify-content: flex-start;
    min-height: 52px;
    padding-left: var(--space-4);
    white-space: normal;
    text-align: left;
}

.quick-actions .btn .icon {
    color: var(--c-blue);
}

@media (max-width: 640px) {
    .quick-actions {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Balken mit Wert (Auswertungen, Auslastung) */
.bars {
    display: grid;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.bars li {
    display: grid;
    grid-template-columns: minmax(5.5rem, 8rem) minmax(0, 1fr) 4rem;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--fs-small);
}

.bars li > :last-child {
    color: var(--c-text-strong);
    font-weight: var(--fw-medium);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.meter {
    display: block;
    height: 8px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: var(--c-panel);
}

.meter > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--c-blue);
}

/* Hinweisliste über einer Tabelle (Prüfhinweise) */
.notice-list {
    display: grid;
    gap: var(--space-2);
    margin: 0 0 var(--space-4);
    padding: 0;
    list-style: none;
}

.notice-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 10px var(--space-3);
    border: 1px solid var(--c-warning-border);
    border-radius: var(--radius);
    background: var(--c-warning-bg);
    color: var(--c-warning-text);
    font-size: var(--fs-small);
}

.notice-list li .icon {
    margin-top: 2px;
    color: var(--c-warning);
}

.notice-list li a {
    color: var(--c-blue-dark);
    font-weight: var(--fw-medium);
    text-decoration: underline;
}

.page-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--gap);
    align-items: start;
}

@media (max-width: 1179.98px) {
    .page-split {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ==== Zeilenlisten ================================================================ */

.rows {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rows__item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--c-line);
}

.rows__item:last-child {
    border-bottom: 0;
}

.rows__main {
    flex: 1;
    min-width: 0;
}

.rows__main strong {
    display: block;
    color: var(--c-heading);
    font-weight: var(--fw-medium);
}

.rows__meta {
    color: var(--c-muted);
    font-size: var(--fs-small);
}

/* ==== Seitenwechsel ================================================================ */

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-4);
    font-size: var(--fs-small);
}

.pagination__pages {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination__pages a,
.pagination__pages span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--c-control-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-text-strong);
}

.pagination__pages a:hover {
    border-color: var(--c-border);
    background: var(--c-page);
    text-decoration: none;
}

.pagination__pages [aria-current="page"] {
    border-color: var(--c-blue);
    background: var(--c-blue);
    color: #fff;
}

/* ==== Wartenummer (Nummer als Kachel, wie Display/Bon) ============================ */

.plate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.4ch;
    padding: 0.12em 0.45em;
    border: 1px solid var(--c-line-strong);
    border-radius: var(--radius);
    background: #eef1f6;
    color: #10161f;
    font-weight: var(--fw-bold);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.plate--brand {
    border-color: transparent;
    background: var(--c-blue);
    color: var(--brand-on-accent);
}

.plate--signal {
    border-color: transparent;
    background: var(--highlight);
    color: var(--on-highlight);
}

.plate--service {
    border-color: transparent;
    background: var(--c-slate);
    color: #fff;
}

.plate--ghost {
    background: transparent;
    border-color: currentColor;
    color: inherit;
}

.plate--sm { font-size: var(--fs-base); }
.plate--md { font-size: 22px; }
.plate--lg { font-size: 34px; border-radius: var(--radius-lg); }
.plate--xl { font-size: clamp(3rem, 7vw, 6rem); border-radius: 14px; }
.plate--hero { font-size: 84px; padding: 0.06em 0.3em; border-radius: 14px; }

/* ==== Aufruftafel (Vorschau im Display-Editor) ===================================== */

.call-board {
    display: grid;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-5);
    border-radius: var(--radius-card);
    background: var(--c-blue);
    color: var(--brand-on-accent);
}

.call-board__row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    color: color-mix(in srgb, var(--brand-on-accent) 88%, transparent);
    font-size: 18px;
}

.call-board__row--current {
    padding-bottom: var(--space-3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--brand-on-accent);
    font-size: 22px;
    font-weight: var(--fw-bold);
}

.call-board__target {
    font-variant-numeric: tabular-nums;
}

/* ==== Kleinteile ==================================================================== */

.swatch {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 1px solid rgba(16, 24, 40, 0.18);
    border-radius: var(--radius-sm);
    vertical-align: middle;
}

/* Fortschritt */
.bar {
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--c-panel);
    overflow: hidden;
}

.bar__fill {
    height: 100%;
    border-radius: inherit;
    background: var(--c-success);
}

.bar__fill--warning {
    background: var(--c-warning);
}

.bar__fill--danger {
    background: var(--c-danger);
}

.bar__fill--brand {
    background: var(--c-blue);
}

.refresh-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--c-muted);
    font-size: var(--fs-small);
}

.support-details {
    position: relative;
    display: inline-block;
}

.support-details > summary {
    list-style: none;
}

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

.support-form {
    position: absolute;
    right: 0;
    top: calc(100% + var(--space-2));
    z-index: 10;
    width: 22rem;
    max-width: calc(100vw - 32px);
    padding: var(--space-4);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-card);
    background: var(--c-surface);
    box-shadow: var(--shadow-pop);
    text-align: left;
    white-space: normal;
}

@media (max-width: 640px) {
    .btn-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (forced-colors: active) {
    .wait__bars::before,
    .wait__bars::after,
    .wait__bars > span {
        background: CanvasText;
    }

    .side-nav-link[aria-current="page"],
    .area-switch__link[aria-current],
    .step-nav__link[aria-current="step"],
    .form-nav__link[aria-current="true"],
    .icon-option input:checked + .icon-option__face {
        outline: 2px solid Highlight;
    }
}

/* ==== Musterseite /admin/designsystem ============================================== */

.ds-toc ul {
    margin: 0 0 var(--space-6);
    padding: 0;
    list-style: none;
}

.ds-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
    gap: var(--space-3) var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.ds-swatch {
    display: flex;
    gap: var(--space-3);
    min-width: 0;
    font-size: var(--fs-small);
}

.ds-swatch__chip {
    flex: none;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(16, 24, 40, 0.12);
    border-radius: var(--radius);
}

.ds-swatch strong,
.ds-swatch code,
.ds-swatch small {
    display: block;
}

.ds-swatch strong {
    color: var(--c-heading);
    font-weight: var(--fw-medium);
}

.ds-swatch code {
    width: fit-content;
    margin: 2px 0;
    font-size: var(--fs-xs);
}

.ds-swatch small {
    color: var(--c-muted);
    font-size: var(--fs-tiny);
}

.ds-type p {
    margin: 0 0 var(--space-3);
}

.ds-type__h1 { color: var(--c-heading); font-size: var(--fs-h1); font-weight: var(--fw-bold); line-height: var(--lh-heading); letter-spacing: -0.015em; }
.ds-type__h2 { color: var(--c-heading); font-size: var(--fs-h2); font-weight: var(--fw-medium); line-height: var(--lh-heading); }
.ds-type__h3 { color: var(--c-heading); font-size: 17px; font-weight: var(--fw-medium); }

.ds-type__num {
    display: grid;
    gap: 2px;
}

.ds-list {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.ds-dialog-sample {
    width: 100%;
    max-width: 520px;
}

.ds-focus-demo {
    outline: var(--focus-width) solid var(--c-focus);
    outline-offset: var(--focus-offset);
}
