/*
 * FV-Manager -- Gestaltung der gesamten Oberflaeche.
 *
 * Eine Datei, kein Framework, kein CDN, kein Build-Schritt, kein JavaScript. Das ist keine
 * Sparsamkeit, sondern die Sicherheitsrichtlinie: geladen wird ausschliesslich, was im Repository
 * liegt.
 *
 * AUFBAU
 *   1. Kennwerte (Farben, Typografie, Abstaende, Radien, Schatten)
 *   2. Grundlagen (Reset, Typografie, Verweise, Tastaturfokus)
 *   3. Geruest (Seitenleiste, Kopfzeile, Inhaltsbereich)
 *   4. Navigation
 *   5. Seitenkopf und Aktionsleisten
 *   6. Karten, Kennzahlen, Aufgaben
 *   7. Tabellen
 *   8. Formulare
 *   9. Schaltflaechen
 *  10. Abzeichen und Zustaende
 *  11. Meldungen
 *  12. Leere Zustaende, Blaetterung, Nebenbestandteile
 *  13. Belege (Rechnung, Zuwendungsbestaetigung)
 *  14. Anmeldung und Fehlerseiten
 *  15. Enge Geraete
 *  16. Druck und Bewegungsempfindlichkeit
 *
 * GRUNDGEDANKE DER GESTALTUNG
 * Eine Vereinsverwaltung fuehrt Geld und personenbezogene Daten. Sie darf deshalb weder verspielt
 * noch billig wirken. Die Oberflaeche arbeitet mit viel Weissraum, wenigen Farben und ruhiger
 * Typografie; Farbe wird ausschliesslich zur Aussage eingesetzt, nie zur Zierde. Die dunkelgruene
 * Seitenleiste traegt den Wiedererkennungswert, der Arbeitsbereich bleibt hell und sachlich.
 *
 * ZUSTAENDE STEHEN NIE ALLEIN IN FARBE. Jedes Abzeichen traegt seinen Text; die Farbe verstaerkt
 * ihn. Wer Farben nicht unterscheiden kann, verliert dadurch keine Information.
 */

/* == 1. Kennwerte ====================================================================== */

:root {
    /* Markenfarbe: ein tiefes, ruhiges Gruen. Dunkel genug, um auf Weiss den Kontrastwert
       4.5:1 zu erreichen, und damit sowohl fuer Flaechen als auch fuer Text tauglich. */
    --fv-primary-900: #062a1b;
    --fv-primary-800: #0b3b27;
    --fv-primary-700: #0f5234;
    --fv-primary: #115c3a;
    --fv-primary-600: #146b44;
    --fv-primary-500: #1c8556;
    --fv-primary-100: #d6e8de;
    --fv-primary-50: #eef5f1;

    /* Neutrale Toene mit einem Hauch Gruen -- damit Flaechen und Marke zusammengehoeren,
       ohne dass es auffaellt. */
    --fv-ink: #101b16;
    --fv-text: #1d2a24;
    --fv-muted: #5b6b63;
    --fv-subtle: #7b8a83;
    --fv-border: #dfe6e2;
    --fv-border-strong: #c6d1cb;
    --fv-bg: #f5f7f6;
    --fv-surface: #ffffff;
    --fv-surface-sunken: #fafbfa;

    /* Aussagefarben. Erfolg ist bewusst heller als die Marke, sonst waere eine
       Erfolgsmeldung von einer Markenflaeche nicht zu unterscheiden. */
    --fv-success: #17714a;
    --fv-success-bg: #e7f3ec;
    --fv-success-border: #b9d9c8;
    --fv-warning: #8a5300;
    --fv-warning-bg: #fdf4e3;
    --fv-warning-border: #ecd6a8;
    --fv-error: #9b1c23;
    --fv-error-bg: #fdecec;
    --fv-error-border: #f0c2c2;
    --fv-info: #1c4f8a;
    --fv-info-bg: #eaf1fa;
    --fv-info-border: #c2d6ee;

    /* Abstandsstaffel. Alles Weitere ist ein Vielfaches davon. */
    --fv-1: 0.25rem;
    --fv-2: 0.5rem;
    --fv-3: 0.75rem;
    --fv-4: 1rem;
    --fv-5: 1.25rem;
    --fv-6: 1.5rem;
    --fv-8: 2rem;
    --fv-10: 2.5rem;
    --fv-12: 3rem;
    --fv-gap: var(--fv-4);
    --fv-gap-lg: var(--fv-6);

    --fv-radius-sm: 6px;
    --fv-radius: 10px;
    --fv-radius-lg: 14px;
    --fv-radius-pill: 999px;

    /* Schatten bleiben knapp unter der Wahrnehmungsschwelle. Sie sollen Ebenen trennen,
       nicht auffallen. */
    --fv-shadow-xs: 0 1px 2px rgba(16, 27, 22, .05);
    --fv-shadow-sm: 0 1px 2px rgba(16, 27, 22, .05), 0 2px 8px rgba(16, 27, 22, .04);
    --fv-shadow-md: 0 2px 4px rgba(16, 27, 22, .05), 0 8px 24px rgba(16, 27, 22, .07);
    --fv-focus: 0 0 0 3px rgba(28, 133, 86, .32);
    --fv-focus-dark: 0 0 0 3px rgba(255, 255, 255, .45);

    --fv-sidebar: 264px;
    --fv-content: 1240px;

    --fv-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --fv-font-num: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, monospace;
}

/* == 2. Grundlagen ===================================================================== */

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

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

body {
    margin: 0;
    background: var(--fv-bg);
    color: var(--fv-text);
    font-family: var(--fv-font);
    font-size: 1rem;
    line-height: 1.6;
    /* Die Seite selbst laeuft nie waagerecht ueber. Wo eine Tabelle breiter ist als der
       Bildschirm, scrollt ausschliesslich ihr eigener Rahmen (.table-wrap). */
    overflow-x: hidden;
}

/*
 * DIE TYPOGRAFISCHE LEITER
 *
 * Hierarchie entsteht hier nicht aus "groesser und fetter", sondern aus vier Reglern: Groesse,
 * Gewicht, Farbe und Laufweite. Deshalb kann eine Kennzahl gross und trotzdem ruhig sein, und ein
 * Abschnittstitel klein und trotzdem deutlich.
 *
 *   Rubrik (.page-eyebrow)      11px · 700 · gesperrt · gedaempft
 *   Seitentitel (h1)            26px · 600 · leicht negativ
 *   Seitenbeschreibung          15px · 400 · gedaempft
 *   Abschnittstitel (h2)        17px · 600
 *   Kartentitel (.card-head h2) 15px · 600
 *   Kennzahl-Beschriftung       13px · 600 · gedaempft
 *   Kennzahl-Wert               26px · 550 · Ziffernbreiten fest · negativ gesperrt
 *   Begleittext                 14px · 400 · gedaempft
 *   Tabelle primaer             15px · 550 · Tinte
 *   Tabelle sekundaer           13px · 400 · gedaempft
 *
 * **Zahlen sind keine Ueberschriften.** Ein Betrag bekommt feste Ziffernbreiten, damit Spalten
 * fluchten, und ein geringeres Gewicht als eine gleich grosse Ueberschrift -- sonst schreit die
 * Zahl, statt gelesen zu werden.
 */
h1, h2, h3, h4 {
    margin: 0;
    color: var(--fv-ink);
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 1.625rem; letter-spacing: -0.02em; }
h2 { font-size: 1.0625rem; letter-spacing: -0.01em; }
h3 { font-size: 0.9375rem; }

p { margin: 0 0 var(--fv-3); }
p:last-child { margin-bottom: 0; }

/*
 * Uebergaenge sind kurz genug, um nicht aufzufallen, und lang genug, damit ein Zustandswechsel
 * nicht springt. Sie liegen ausschliesslich auf Farbe, Rand und Schatten -- nie auf Groesse oder
 * Position, weil Bewegung im Layout beim Lesen stoert. prefers-reduced-motion schaltet sie ab.
 */
a, .btn, .tile, .task, .stat, .app-sidebar nav a, .app-sidebar nav form button,
tbody tr, .pagination a, .field input, .field select, .field textarea {
    transition: background-color .12s ease, border-color .12s ease, color .12s ease,
        box-shadow .12s ease;
}

a {
    color: var(--fv-primary-600);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

a:hover { color: var(--fv-primary-800); }

strong { font-weight: 650; }

/* Tastaturfokus ist ueberall sichtbar und nie abgeschaltet. */
:focus-visible {
    outline: 2px solid var(--fv-primary-500);
    outline-offset: 2px;
    border-radius: var(--fv-radius-sm);
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: var(--fv-2);
    z-index: 100;
    padding: var(--fv-2) var(--fv-4);
    background: var(--fv-surface);
    color: var(--fv-primary-800);
    border-radius: var(--fv-radius-sm);
    box-shadow: var(--fv-shadow-md);
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    left: var(--fv-2);
}

/* == 3. Geruest ======================================================================== */

.app-shell {
    display: grid;
    grid-template-columns: var(--fv-sidebar) minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--fv-5);
    padding: var(--fv-5) var(--fv-4) var(--fv-6);
    background: var(--fv-primary-900);
    color: rgba(255, 255, 255, .82);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--fv-3);
    padding: var(--fv-2) var(--fv-3);
    color: #fff;
    text-decoration: none;
    border-radius: var(--fv-radius);
}

.brand:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.brand:focus-visible { outline-color: #fff; }

.brand-mark { display: flex; flex: 0 0 auto; color: #fff; }
.brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.brand-name {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.brand-club {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, .58);
    /* Vereinsnamen koennen lang sein; sie duerfen die Leiste nicht sprengen. */
    overflow-wrap: anywhere;
}

.app-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-main > main,
.app-main > .flash-area {
    width: 100%;
    max-width: var(--fv-content);
    margin: 0 auto;
    padding: 0 var(--fv-8);
}

.app-main > main {
    padding-top: var(--fv-6);
    padding-bottom: var(--fv-12);
    display: flex;
    flex-direction: column;
    gap: var(--fv-5);
}

.app-main > .flash-area { padding-top: var(--fv-5); }

/* Der Benutzerbereich am Fuss der Leiste. */
.sidebar-user {
    margin-top: auto;
    padding-top: var(--fv-4);
    border-top: 1px solid rgba(255, 255, 255, .12);
    display: flex;
    flex-direction: column;
    gap: var(--fv-2);
}

.sidebar-user-name {
    padding: 0 var(--fv-3);
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, .62);
}

/* == 4. Navigation ===================================================================== */

.app-sidebar nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-group + .nav-group { margin-top: var(--fv-5); }

.nav-group-title {
    padding: 0 var(--fv-3) var(--fv-1);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .34);
}

.app-sidebar nav a {
    display: flex;
    align-items: center;
    gap: var(--fv-3);
    padding: 0.4375rem var(--fv-3);
    border-radius: var(--fv-radius-sm);
    color: rgba(255, 255, 255, .78);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

/*
 * Das Symbol ist leiser als der Text -- es hilft beim Wiederfinden und tritt beim Lesen zurueck.
 * Erst der aktive Eintrag holt es auf volle Deckkraft.
 */
.app-sidebar nav .icon { flex: 0 0 auto; opacity: .58; }

.app-sidebar nav a:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.app-sidebar nav a:hover .icon { opacity: .85; }

.app-sidebar nav a:focus-visible {
    outline-color: #fff;
    outline-offset: -2px;
}

/* Der aktive Eintrag traegt keine Klasse, sondern aria-current -- die Auszeichnung sagt
   damit dasselbe wie die Gestaltung, und beides kann nicht auseinanderlaufen. */
/*
 * Der aktive Eintrag hebt sich durch eine ruhige Flaeche und eine helle Kante ab, nicht durch eine
 * leuchtende Farbe. Er soll auffindbar sein, nicht blenden.
 */
.app-sidebar nav a[aria-current="page"] {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--fv-primary-500);
}

.app-sidebar nav a[aria-current="page"] .icon { opacity: 1; }

.app-sidebar nav form { margin: 0; }

/* Abmelden ist kein Menuepunkt, sondern der Ausgang -- entsprechend leise. */
.app-sidebar nav form button {
    display: flex;
    align-items: center;
    gap: var(--fv-3);
    width: 100%;
    padding: 0.4375rem var(--fv-3);
    background: none;
    border: 0;
    border-radius: var(--fv-radius-sm);
    color: rgba(255, 255, 255, .58);
    font: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
}

.app-sidebar nav form button .icon { opacity: .5; }

.app-sidebar nav form button:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.app-sidebar nav form button:focus-visible { outline-color: #fff; }

/*
 * Auf schmalen Geraeten wird aus der Leiste eine umbrechende Zeile aus Verweisen.
 *
 * **Warum kein Aufklapper.** Ein Umschalter braeuchte entweder JavaScript -- das die
 * Sicherheitsrichtlinie ausschliesst -- oder ein <details>. Letzteres blenden neuere Engines ueber
 * ::details-content aus, was sich mit CSS nicht verlaesslich wieder einblenden laesst. Eine
 * Navigation, die auf manchen Geraeten unerreichbar ist, waere schlechter als eine, die etwas
 * Platz kostet. Die Verweise brechen deshalb um und bleiben immer sichtbar.
 */

/* == 5. Seitenkopf und Aktionsleisten ================================================== */

.page-subtitle {
    margin: var(--fv-1) 0 0;
    color: var(--fv-muted);
    font-size: 0.9375rem;
}


    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--fv-2);
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--fv-2);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--fv-1);
    margin-bottom: var(--fv-2);
    color: var(--fv-muted);
    font-size: 0.875rem;
    text-decoration: none;
}

.back-link:hover { color: var(--fv-primary-700); text-decoration: underline; }

.section-title {
    margin: var(--fv-2) 0 0;
    color: var(--fv-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Eine Leiste mit Vorgaengen zu einem Datensatz. Entscheidende Vorgaenge stehen abgesetzt. */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--fv-2);
}

.action-bar form { margin: 0; }

.action-bar--decisive {
    margin-top: var(--fv-4);
    padding-top: var(--fv-4);
    border-top: 1px dashed var(--fv-border-strong);
}

/* == 6. Karten, Kennzahlen, Aufgaben =================================================== */

.card {
    background: var(--fv-surface);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-lg);
    box-shadow: var(--fv-shadow-sm);
    overflow: hidden;
}

.card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--fv-3);
    padding: var(--fv-4) var(--fv-5);
    border-bottom: 1px solid var(--fv-border);
    background: var(--fv-surface-sunken);
}

.card-head h2 { font-size: 1rem; }

.card-body { padding: var(--fv-5); }
.card-body > :last-child { margin-bottom: 0; }
.card-body form { margin: 0; }

/* Kennzahlen. Die Zahl ist gross, die Erlaeuterung klein -- und die Zahl steht in einer
   Ziffernschrift mit gleichen Breiten, damit Betraege untereinander fluchten. */
.figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--fv-5);
    margin: 0;
}

.figures > div { min-width: 0; }

.figures dt {
    color: var(--fv-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.figures dd {
    margin: var(--fv-1) 0 0;
    color: var(--fv-ink);
    font-size: 1.5rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.figures dd.figure-lead { font-size: 1.875rem; }

.figure-note {
    display: block;
    margin-top: 2px;
    color: var(--fv-muted);
    font-size: 0.8125rem;
    font-weight: 400;
    letter-spacing: 0;
}

/* Kacheln des Schnellzugriffs. */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: var(--fv-4);
}

.tile {
    display: flex;
    flex-direction: column;
    gap: var(--fv-1);
    padding: var(--fv-5);
    background: var(--fv-surface);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-lg);
    box-shadow: var(--fv-shadow-xs);
    color: var(--fv-text);
    text-decoration: none;
}

.tile:hover {
    border-color: var(--fv-primary-100);
    box-shadow: var(--fv-shadow-md);
    color: var(--fv-text);
}

.tile-title { font-weight: 650; color: var(--fv-ink); }
.tile-text { color: var(--fv-muted); font-size: 0.875rem; }

/*
 * Aufgabenkarten der Startseite.
 *
 * Jede beantwortet drei Fragen: Was ist offen, warum zaehlt das, was kann ich jetzt tun. Der
 * farbige Streifen links traegt die Dringlichkeit -- zusaetzlich zum Text, nie an seiner Stelle.
 */
.task-list {
    display: flex;
    flex-direction: column;
    gap: var(--fv-3);
}

.task {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--fv-4);
    padding: var(--fv-3) var(--fv-4);
    background: var(--fv-surface);
    border: 1px solid var(--fv-border);
    border-left: 3px solid var(--fv-border-strong);
    border-radius: 0 var(--fv-radius) var(--fv-radius) 0;
}

.task:hover { border-color: var(--fv-border-strong); box-shadow: var(--fv-shadow-xs); }

.task--attention { border-left-color: var(--fv-warning); }
.task--open { border-left-color: var(--fv-info); }
.task--done { border-left-color: var(--fv-success); }

.task-body { min-width: 0; flex: 1 1 22rem; }
.task-title { margin: 0; font-size: 0.9375rem; font-weight: 600; color: var(--fv-ink); }
.task-text { margin: 2px 0 0; color: var(--fv-muted); font-size: 0.875rem; line-height: 1.5; }
.task-action { flex: 0 0 auto; }

/*
 * Beschriftung und Wert nebeneinander statt untereinander.
 *
 * Eine Detailseite mit zwoelf Angaben war vorher zwoelf Zeilenpaare hoch -- man scrollte an
 * Beschriftungen entlang, um einen Wert zu finden. Als zweispaltiges Raster steht die Beschriftung
 * links, der Wert rechts, und das Auge folgt einer Kante. Die erste Spalte ist genau so breit wie
 * die laengste Beschriftung; die Werte fluchten dadurch von selbst.
 */
.data-list {
    display: grid;
    grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
    gap: var(--fv-2) var(--fv-5);
    margin: 0;
    align-items: baseline;
}

.data-list dt {
    color: var(--fv-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.data-list dd {
    margin: 0;
    color: var(--fv-text);
    overflow-wrap: anywhere;
}

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

.period-list li {
    padding: var(--fv-3) 0;
    border-bottom: 1px solid var(--fv-border);
}

.period-list li:last-child { border-bottom: 0; padding-bottom: 0; }

/* == 7. Tabellen ======================================================================= */

/*
 * Der eigene Rollbereich ist Absicht: Eine breite Tabelle scrollt fuer sich, die Seite bleibt
 * ruhig. Auf schmalen Geraeten ist das der einzige Ort mit waagerechtem Rollen.
 */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

thead th {
    padding: var(--fv-3) var(--fv-5);
    background: var(--fv-surface-sunken);
    border-bottom: 1px solid var(--fv-border);
    color: var(--fv-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
}

tbody td {
    padding: var(--fv-3) var(--fv-5);
    border-bottom: 1px solid var(--fv-border);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--fv-surface-sunken); }

.col-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

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

.table-note {
    padding: var(--fv-3) var(--fv-5);
    border-top: 1px solid var(--fv-border);
    color: var(--fv-muted);
    font-size: 0.875rem;
}

/* == 8. Formulare ====================================================================== */

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--fv-4);
}

.field {
    display: flex;
    flex-direction: column;
    gap: var(--fv-1);
    margin-bottom: var(--fv-4);
    min-width: 0;
}

.field-row > .field { margin-bottom: 0; }

.field label {
    color: var(--fv-ink);
    font-size: 0.875rem;
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--fv-surface);
    border: 1px solid var(--fv-border-strong);
    border-radius: var(--fv-radius-sm);
    color: var(--fv-text);
    font: inherit;
    font-size: 0.9375rem;
}

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--fv-subtle); }

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--fv-primary-500);
    box-shadow: var(--fv-focus);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
    background: var(--fv-surface-sunken);
    color: var(--fv-muted);
    cursor: not-allowed;
}

.field textarea { min-height: 7rem; resize: vertical; }

.field select {
    /* Kein eigenes Pfeilbild: Das Betriebssystem zeichnet den Aufklapper vertrauter, als
       wir es koennten. */
    appearance: auto;
}

/* Fehler stehen unmittelbar am Feld und tragen role="alert". */
.field [role="alert"] {
    color: var(--fv-error);
    font-size: 0.875rem;
    font-weight: 500;
}

.field:has([role="alert"]) input,
.field:has([role="alert"]) select,
.field:has([role="alert"]) textarea {
    border-color: var(--fv-error);
}

.field-hint,
.field .figure-note {
    color: var(--fv-muted);
    font-size: 0.875rem;
    font-weight: 400;
}

.field-hint { margin: var(--fv-1) 0 var(--fv-4); }

.field--check {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--fv-2);
    flex-wrap: wrap;
}

.field--check label {
    display: flex;
    align-items: center;
    gap: var(--fv-2);
    font-weight: 500;
    cursor: pointer;
}

.field--check input[type="checkbox"] {
    width: 1.0625rem;
    height: 1.0625rem;
    margin: 0;
    accent-color: var(--fv-primary-600);
    flex: 0 0 auto;
}

.field--check .figure-note,
.field--check .field-hint { flex: 1 1 100%; margin: 0; }

.required-mark { color: var(--fv-error); }

/*
 * Formularabschnitte.
 *
 * Ein langes Formular ohne Gliederung ist eine Liste von Feldern; mit Gliederung ist es eine Folge
 * von Fragen. Die Trennlinie steht ueber dem Abschnitt und nicht darunter -- so gehoert sie sichtbar
 * zur folgenden Ueberschrift.
 */
fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

fieldset + fieldset {
    margin-top: var(--fv-6);
    padding-top: var(--fv-6);
    border-top: 1px solid var(--fv-border);
}

legend {
    padding: 0 0 var(--fv-4);
    color: var(--fv-ink);
    font-size: 1rem;
    font-weight: 650;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--fv-3);
    margin-top: var(--fv-5);
    padding-top: var(--fv-4);
    border-top: 1px solid var(--fv-border);
}

/* Ein Formular ohne eigene Anordnung -- die Felder darin tragen ihre Abstaende selbst. */
.form > :last-child { margin-bottom: 0; }

/*
 * Eingabefelder werden nicht breiter als lesbar. Ein Namensfeld ueber die volle Breite eines
 * 1440-Pixel-Bildschirms sieht nicht grosszuegig aus, sondern unfertig.
 */
.form-wide { max-width: 46rem; }

.items-table th,
.items-table td { padding: var(--fv-2) var(--fv-3); }
.items-table .field { margin: 0; }
.items-table .field label { position: absolute; left: -9999px; }
.items-row-new td { background: var(--fv-primary-50); }

/* == 9. Schaltflaechen ================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--fv-2);
    padding: 0.5rem 0.9375rem;
    border: 1px solid transparent;
    border-radius: var(--fv-radius-sm);
    background: var(--fv-surface);
    color: var(--fv-text);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; }

.btn--primary {
    background: var(--fv-primary);
    border-color: var(--fv-primary);
    color: #fff;
}

.btn--primary:hover {
    background: var(--fv-primary-800);
    border-color: var(--fv-primary-800);
    color: #fff;
}

/* Zweitrangig: sichtbar, aber ohne Flaeche. */
.btn--quiet {
    background: var(--fv-surface);
    border-color: var(--fv-border-strong);
    color: var(--fv-text);
}

.btn--quiet:hover {
    background: var(--fv-surface-sunken);
    border-color: var(--fv-subtle);
    color: var(--fv-ink);
}

/* Ohne Rahmen -- fuer Vorgaenge in Tabellenzeilen. */
.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--fv-primary-700);
    padding-left: var(--fv-2);
    padding-right: var(--fv-2);
}

.btn--ghost:hover { background: var(--fv-primary-50); color: var(--fv-primary-800); }

/* Entscheidend und nicht umkehrbar. */
.btn--decisive {
    background: var(--fv-warning-bg);
    border-color: var(--fv-warning-border);
    color: var(--fv-warning);
}

.btn--decisive:hover { background: #f9ead0; color: #6f4300; }

.btn--danger {
    background: var(--fv-error-bg);
    border-color: var(--fv-error-border);
    color: var(--fv-error);
}

.btn--danger:hover { background: #fbdada; color: #7d161c; }

.btn--small { padding: 0.3125rem 0.625rem; font-size: 0.875rem; }

.btn[disabled],
.btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* == 10. Abzeichen und Zustaende ======================================================= */

/*
 * Ein Abzeichen traegt immer seinen Text. Die Farbe ist Verstaerkung, nie die Aussage --
 * sonst waere der Zustand fuer einen Teil der Anwender unsichtbar.
 *
 * Unbekannte Zustaende erscheinen in der neutralen Grundform. Das Partial kennt keinen
 * einzigen Statuswert; kommt einer hinzu, faellt hier nichts um.
 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--fv-1);
    padding: 0.125rem 0.5rem;
    border: 1px solid var(--fv-border-strong);
    border-radius: var(--fv-radius-pill);
    background: var(--fv-surface-sunken);
    color: var(--fv-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

/* Gueltig, laufend, erledigt. */
.badge--active,
.badge--issued,
.badge--paid,
.badge--approved,
.badge--verified,
.badge--exported {
    background: var(--fv-success-bg);
    border-color: var(--fv-success-border);
    color: var(--fv-success);
}

/* In Arbeit, vorlaeufig. */
.badge--draft,
.badge--review,
.badge--created,
.badge--partially_paid,
.badge--declared {
    background: var(--fv-info-bg);
    border-color: var(--fv-info-border);
    color: var(--fv-info);
}

/* Erfordert Aufmerksamkeit. */
.badge--open,
.badge--overpaid,
.badge--suspended,
.badge--expired,
.badge--not_configured {
    background: var(--fv-warning-bg);
    border-color: var(--fv-warning-border);
    color: var(--fv-warning);
}

/*
 * Beendet, zurueckgenommen, nicht vorhanden -- neutral, nicht rot.
 *
 * Rot ist in dieser Anwendung ausschliesslich fuer Fehler und zerstoerende Vorgaenge reserviert.
 * Eine beendete Mitgliedschaft ist kein Fehler, eine stornierte Rechnung ist kein Fehler, und
 * "nichts zu tun" schon gar nicht. Wer Rot fuer Endzustaende verwendet, hat kein Rot mehr fuer die
 * Faelle, in denen es zaehlt.
 */
.badge--cancelled,
.badge--resigned,
.badge--inactive,
.badge--deceased {
    background: var(--fv-surface-sunken);
    border-color: var(--fv-border-strong);
    color: var(--fv-muted);
}

/* == 11. Meldungen ===================================================================== */

.flash-area {
    display: flex;
    flex-direction: column;
    gap: var(--fv-2);
}

.notice {
    margin: 0;
    padding: var(--fv-3) var(--fv-4);
    border: 1px solid var(--fv-border);
    border-left: 4px solid var(--fv-subtle);
    border-radius: var(--fv-radius);
    background: var(--fv-surface);
    color: var(--fv-text);
    font-size: 0.9375rem;
}

.notice--success {
    background: var(--fv-success-bg);
    border-color: var(--fv-success-border);
    border-left-color: var(--fv-success);
    color: #0f4a30;
}

.notice--info {
    background: var(--fv-info-bg);
    border-color: var(--fv-info-border);
    border-left-color: var(--fv-info);
    color: #163f6e;
}

.notice--warning {
    background: var(--fv-warning-bg);
    border-color: var(--fv-warning-border);
    border-left-color: var(--fv-warning);
    color: #6f4300;
}

.notice--error {
    background: var(--fv-error-bg);
    border-color: var(--fv-error-border);
    border-left-color: var(--fv-error);
    color: #7d161c;
}

/* Ein ruhiger Hinweiskasten im Inhalt -- etwa die Erklaerung, warum etwas nicht geht. */
.alert {
    padding: var(--fv-4) var(--fv-5);
    border: 1px solid var(--fv-border);
    border-left: 4px solid var(--fv-subtle);
    border-radius: var(--fv-radius);
    background: var(--fv-surface-sunken);
}

.alert--info {
    background: var(--fv-info-bg);
    border-color: var(--fv-info-border);
    border-left-color: var(--fv-info);
}

.alert--warning {
    background: var(--fv-warning-bg);
    border-color: var(--fv-warning-border);
    border-left-color: var(--fv-warning);
}

.alert--error {
    background: var(--fv-error-bg);
    border-color: var(--fv-error-border);
    border-left-color: var(--fv-error);
}

.alert h3 { margin-bottom: var(--fv-1); font-size: 0.9375rem; }

/* == 12. Leere Zustaende, Blaetterung, Nebenbestandteile =============================== */

.empty-state,
.empty {
    padding: var(--fv-10) var(--fv-5);
    text-align: center;
}

.empty-state-message {
    margin: 0;
    color: var(--fv-ink);
    font-size: 1rem;
    font-weight: 650;
}

.empty-state-hint {
    max-width: 34rem;
    margin: var(--fv-2) auto 0;
    color: var(--fv-muted);
    font-size: 0.9375rem;
}

.empty-state p:last-child { margin-top: var(--fv-5); }

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--fv-2);
    padding: var(--fv-3) var(--fv-5);
    border-top: 1px solid var(--fv-border);
    font-size: 0.9375rem;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 var(--fv-2);
    justify-content: center;
    border-radius: var(--fv-radius-sm);
    text-decoration: none;
}

.pagination a { border: 1px solid var(--fv-border-strong); color: var(--fv-text); }
.pagination a:hover { background: var(--fv-primary-50); border-color: var(--fv-primary-100); }
.pagination span { color: var(--fv-muted); }

.audit-change { font-size: 0.875rem; }
.audit-field { color: var(--fv-muted); font-weight: 600; }

/* == 13. Belege ======================================================================== */

.document {
    max-width: 52rem;
    padding: var(--fv-8);
    background: var(--fv-surface);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-lg);
}

.document-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--fv-5);
    margin-bottom: var(--fv-8);
}

.document-issuer { font-size: 0.875rem; color: var(--fv-muted); }
.document-issuer strong { display: block; color: var(--fv-ink); font-size: 1rem; }

.document-meta { margin: 0; }
.document-meta div { display: flex; justify-content: space-between; gap: var(--fv-5); }
.document-meta dt { color: var(--fv-muted); }
.document-meta dd { margin: 0; font-variant-numeric: tabular-nums; }

.document table { margin-bottom: var(--fv-5); }
.document tbody tr:hover { background: none; }

.document-total {
    display: flex;
    justify-content: flex-end;
    gap: var(--fv-5);
    padding-top: var(--fv-4);
    border-top: 2px solid var(--fv-ink);
    font-weight: 700;
}

.document-total span:last-child { font-variant-numeric: tabular-nums; }
.document-note { margin-top: var(--fv-6); color: var(--fv-muted); font-size: 0.875rem; }

/* == 14. Anmeldung und Fehlerseiten ==================================================== */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--fv-6);
    background:
        radial-gradient(1200px 600px at 50% -10%, #0d4a2f 0%, transparent 60%),
        var(--fv-primary-900);
}

.auth-card {
    width: 100%;
    max-width: 25rem;
    padding: var(--fv-8);
    background: var(--fv-surface);
    border-radius: var(--fv-radius-lg);
    box-shadow: 0 20px 50px rgba(6, 42, 27, .35);
}

.auth-card h1 { margin-bottom: var(--fv-5); font-size: 1.375rem; }
.auth-card .btn { width: 100%; }

.auth-brand { margin-bottom: var(--fv-6); text-align: center; }
.auth-brand .brand-name { display: block; color: var(--fv-ink); font-size: 1.25rem; }
.auth-brand .brand-club { color: var(--fv-muted); }

.error-page {
    max-width: 34rem;
    margin: var(--fv-12) auto;
    padding: var(--fv-8);
    background: var(--fv-surface);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-lg);
    text-align: center;
}

.error-code {
    color: var(--fv-muted);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.error-message { margin: var(--fv-3) 0 var(--fv-6); font-size: 1.125rem; }

/* == 14b. Zusammengesetzte Bausteine (TP7.1) ========================================== */

/*
 * Diese Bausteine sind der eigentliche Unterschied zwischen einem eingefaerbten Formular und einer
 * Anwendung. Sie tragen keine neuen Daten -- sie ordnen die vorhandenen so, dass die wichtigste
 * Aussage zuerst gelesen wird.
 */

/* --- Seitenkopf ------------------------------------------------------------------- */

/*
 * Drei Ebenen, immer in derselben Reihenfolge: woher komme ich (Rubrik), was ist das hier
 * (Titel), was weiss ich sofort darueber (Kontext) -- und rechts die eine Aktion, die auf dieser
 * Seite zaehlt. Wer eine Seite oeffnet, hat damit nach zwei Sekunden alles Noetige.
 */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--fv-5);
    padding-bottom: var(--fv-5);
    border-bottom: 1px solid var(--fv-border);
}

.page-header-main { min-width: 0; flex: 1 1 24rem; }

.page-eyebrow {
    margin: 0 0 var(--fv-1);
    color: var(--fv-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.page-header h1 {
    font-size: 1.75rem;
    overflow-wrap: anywhere;
}

.page-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--fv-2) var(--fv-3);
    margin: var(--fv-2) 0 0;
    color: var(--fv-muted);
    font-size: 0.9375rem;
}

/* Der Mittelpunkt trennt Angaben, ohne eine Linie zu ziehen. */
.page-meta > * + *::before {
    content: "·";
    margin-right: var(--fv-3);
    color: var(--fv-border-strong);
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--fv-2);
    flex: 0 0 auto;
}

/* --- Identitaetskopf einer Detailseite ---------------------------------------------- */

/*
 * Fuer Datensaetze, die einen Namen haben: Mitglied, Partner, Benutzer. Das Monogramm ist keine
 * Zierde -- es macht die Seite auf einen Blick unterscheidbar, wenn man mehrere hintereinander
 * oeffnet.
 */
.identity {
    display: flex;
    align-items: center;
    gap: var(--fv-4);
    min-width: 0;
}

.identity-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 3rem;
    height: 3rem;
    border-radius: var(--fv-radius-pill);
    background: var(--fv-primary-100);
    color: var(--fv-primary-800);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.identity-body { min-width: 0; }

.identity-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--fv-3);
}

/* --- Kennzahlenkarten --------------------------------------------------------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--fv-4);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: var(--fv-1);
    padding: var(--fv-5);
    background: var(--fv-surface);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-lg);
    box-shadow: var(--fv-shadow-xs);
    min-width: 0;
}

.stat-label {
    margin: 0;
    color: var(--fv-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.stat-value {
    margin: 0;
    color: var(--fv-ink);
    font-size: 1.625rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.stat-value--text { font-size: 1.125rem; font-weight: 600; letter-spacing: 0; }

/*
 * Eine Kennzahlenflaeche mit einer fuehrenden Zahl und mehreren Nebenwerten.
 *
 * Vier gleich grosse Karten nebeneinander sagen "diese vier Zahlen sind gleich wichtig". Das
 * stimmt fast nie. Hier traegt eine Zahl die Aussage, die uebrigen ordnen sie ein -- und sie
 * brauchen dafuer keinen eigenen Rahmen.
 */
.stat-band {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: var(--fv-6);
    align-items: center;
    padding: var(--fv-5) var(--fv-6);
    background: var(--fv-surface);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-lg);
    box-shadow: var(--fv-shadow-xs);
}

.stat-band-lead .stat-value { font-size: 2.25rem; }

.stat-band-rest {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--fv-5);
    padding-left: var(--fv-6);
    border-left: 1px solid var(--fv-border);
}

.stat-band-rest .stat-value { font-size: 1.25rem; }



.stat-note { margin: 0; color: var(--fv-muted); font-size: 0.875rem; }

.stat-link {
    margin: var(--fv-2) 0 0;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Eine Kennzahl, die eine Handlung verlangt. */
.stat--attention { border-left: 4px solid var(--fv-warning); }
.stat--good { border-left: 4px solid var(--fv-success); }

/* --- Abschnittsueberschrift im Inhalt ----------------------------------------------- */

/*
 * Ersetzt die Reihe gleichrangiger Karten: Wo frueher zehn Karten untereinander standen, gibt es
 * jetzt benannte Abschnitte mit einer Ueberschrift und einer eigenen Aktion.
 */
.section {
    display: flex;
    flex-direction: column;
    gap: var(--fv-4);
}

.section + .section { margin-top: var(--fv-4); }

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--fv-3);
}

.section-head h2 { font-size: 1.0625rem; }

.section-lead {
    margin: var(--fv-1) 0 0;
    color: var(--fv-muted);
    font-size: 0.9375rem;
    max-width: 60ch;
}

/* --- Werkzeugleiste ueber Listen ---------------------------------------------------- */

/*
 * Suche und Filter gehoeren sichtbar zusammen und ueber die Tabelle -- nicht in eine eigene Karte
 * darueber, die wie ein zweiter Inhalt aussieht.
 */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--fv-3);
    padding: var(--fv-4) var(--fv-5);
    background: var(--fv-surface-sunken);
    border-bottom: 1px solid var(--fv-border);
}

.toolbar .field { margin: 0; flex: 0 1 13rem; }
.toolbar .field--search { flex: 1 1 20rem; }
.toolbar-actions { display: flex; gap: var(--fv-2); margin-left: auto; }

/* --- Kleine Aufgabe, kleine Flaeche -------------------------------------------------- */

/*
 * Eine Auswahl mit einer Schaltflaeche braucht keine Karte ueber die volle Breite. Diese Leiste
 * steht ohne Rahmen auf der Flaeche und nimmt nur so viel Platz, wie ihre Felder brauchen.
 */
.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--fv-3);
}

.inline-form .field { margin: 0; flex: 0 0 auto; min-width: 9rem; }
.inline-form .field select,
.inline-form .field input { width: auto; min-width: 9rem; }

/* --- Aktionsgruppe in Tabellenzeilen ------------------------------------------------ */

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--fv-1);
}

/* --- Prozessschritte ---------------------------------------------------------------- */

/*
 * Der gefuehrte Ablauf. Er behauptet keinen Assistenten, den es nicht gibt -- er zeigt, wo man im
 * Vorgang steht und was danach kommt. Der aktuelle Schritt traegt aria-current, damit die Aussage
 * nicht allein in der Farbe steckt.
 */
.steps {
    display: flex;
    flex-wrap: wrap;
    gap: var(--fv-2);
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: schritt;
}

.steps li {
    display: flex;
    align-items: center;
    gap: var(--fv-2);
    flex: 1 1 12rem;
    padding: var(--fv-3) var(--fv-4);
    background: var(--fv-surface);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius);
    color: var(--fv-muted);
    font-size: 0.9375rem;
}

.steps li::before {
    counter-increment: schritt;
    content: counter(schritt);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--fv-radius-pill);
    background: var(--fv-surface-sunken);
    border: 1px solid var(--fv-border-strong);
    font-size: 0.8125rem;
    font-weight: 700;
}

.steps li[aria-current="step"] {
    background: var(--fv-primary-50);
    border-color: var(--fv-primary-100);
    color: var(--fv-primary-800);
    font-weight: 600;
}

.steps li[aria-current="step"]::before {
    background: var(--fv-primary);
    border-color: var(--fv-primary);
    color: #fff;
}

/* --- Voraussetzungsliste ------------------------------------------------------------ */

/*
 * Fuer Vorgaenge, die mehrere Bedingungen haben -- der SEPA-Einzug vor allem. Statt einer
 * Fehlermeldung nach dem Versuch steht vorher da, was fehlt.
 *
 * Das Zeichen vor der Zeile ist aria-hidden; die Aussage traegt der Text.
 */
.checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--fv-2);
}

.checklist li {
    display: flex;
    align-items: flex-start;
    gap: var(--fv-3);
    font-size: 0.9375rem;
}

.checklist .mark {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 1.375rem;
    height: 1.375rem;
    margin-top: 1px;
    border-radius: var(--fv-radius-pill);
    font-size: 0.8125rem;
    font-weight: 700;
}

.checklist .ok .mark { background: var(--fv-success-bg); color: var(--fv-success); }
.checklist .todo .mark { background: var(--fv-warning-bg); color: var(--fv-warning); }
.checklist .todo { color: var(--fv-text); }
.checklist .ok { color: var(--fv-muted); }
.checklist strong { color: var(--fv-ink); }

/* --- Beschreibungspaare in zwei Spalten --------------------------------------------- */

.pairs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--fv-4) var(--fv-6);
    margin: 0;
}

.pairs > div { min-width: 0; }

.pairs dt {
    color: var(--fv-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.pairs dd {
    margin: 2px 0 0;
    color: var(--fv-text);
    overflow-wrap: anywhere;
}

/* --- Primaerer Name in einer Tabellenzelle ------------------------------------------ */

/*
 * Der Name traegt die Zeile; alles andere ist Beiwerk. Zwei Zeilen in einer Zelle sind hier
 * besser als zwei Spalten -- sie halten die Tabelle schmal genug fuer einen Laptop.
 */
.cell-primary {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.cell-primary strong { color: var(--fv-ink); font-weight: 550; }
.cell-primary a { color: var(--fv-ink); font-weight: 550; text-decoration: none; }
.cell-primary a:hover { color: var(--fv-primary-700); text-decoration: underline; }
.cell-secondary {
    color: var(--fv-muted);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

/* == 15. Enge Geraete ================================================================== */

/* Tablet und kleiner Desktop: schmalere Leiste, weniger Aussenrand. */
@media (max-width: 1100px) {
    :root { --fv-sidebar: 224px; }
    .app-main > main,
    .app-main > .flash-area { padding-left: var(--fv-5); padding-right: var(--fv-5); }
}

/*
 * Mobil: Die Leiste wird zur Kopfzeile, die Navigation klappt ueber ein <details> auf.
 * Das ist der einzige Weg zu einer verlaesslich erreichbaren Navigation ohne JavaScript --
 * und er ist mit der Tastatur bedienbar, weil <summary> von Haus aus fokussierbar ist.
 */
@media (max-width: 860px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }

    .app-sidebar {
        position: static;
        height: auto;
        gap: var(--fv-3);
        padding: var(--fv-3) var(--fv-4);
    }

    .brand { padding: 0; }

    /* Die Abschnitte laufen ineinander: Auf 390px waeren sechs Ueberschriften mehr Ballast
       als Ordnung. Die Reihenfolge bleibt und traegt die Gliederung allein. */
    .nav-group-title { display: none; }
    .nav-group + .nav-group { margin-top: 0; }

    .app-sidebar nav ul {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--fv-1);
    }

    .app-sidebar nav a,
    .app-sidebar nav form button {
        width: auto;
        padding: var(--fv-1) var(--fv-3);
        border: 1px solid rgba(255, 255, 255, .18);
        border-radius: var(--fv-radius-pill);
        font-size: 0.875rem;
    }

    .app-sidebar nav a[aria-current="page"] { box-shadow: none; }

    .nav-panel {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--fv-1);
    }

    .sidebar-user {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
        flex-direction: row;
        align-items: center;
        gap: var(--fv-2);
    }

    .sidebar-user-name { padding: 0; }

    .app-main > main { padding-top: var(--fv-4); gap: var(--fv-4); }
    .app-main > main,
    .app-main > .flash-area { padding-left: var(--fv-4); padding-right: var(--fv-4); }

    .page-header { flex-direction: column; align-items: stretch; gap: var(--fv-4); }
    .page-header-actions .btn { flex: 1 1 auto; }
    .page-header h1 { font-size: 1.375rem; }
    .identity-avatar { width: 2.5rem; height: 2.5rem; font-size: 0.875rem; }

    .card-head,
    .card-body,
    thead th,
    tbody td,
    .pagination,
    .filter-bar { padding-left: var(--fv-4); padding-right: var(--fv-4); }

    .form-actions .btn { flex: 1 1 10rem; }

    /* Die Kennzahlenflaeche stapelt: nebeneinander waeren beide Haelften zu schmal. */
    .stat-band { grid-template-columns: minmax(0, 1fr); gap: var(--fv-5); padding: var(--fv-4); }
    .stat-band-rest {
        padding-left: 0;
        border-left: 0;
        padding-top: var(--fv-4);
        border-top: 1px solid var(--fv-border);
        gap: var(--fv-4);
    }
    .stat-band-lead .stat-value { font-size: 1.875rem; }

    .steps li { flex: 1 1 100%; }
    .inline-form { width: 100%; }
    .inline-form .field,
    .inline-form .field select { flex: 1 1 100%; width: 100%; }
    .toolbar-actions { margin-left: 0; width: 100%; }
    .toolbar-actions .btn { flex: 1 1 auto; }
    .data-list { grid-template-columns: minmax(0, 1fr); gap: var(--fv-1); }
    .data-list dd { margin-bottom: var(--fv-3); }
    .data-list dd:last-of-type { margin-bottom: 0; }
    h1 { font-size: 1.375rem; }
    .figures { gap: var(--fv-4); }
    .figures dd { font-size: 1.25rem; }
    .figures dd.figure-lead { font-size: 1.5rem; }
    .document { padding: var(--fv-5); }
}

@media (max-width: 420px) {
    .app-main > main,
    .app-main > .flash-area { padding-left: var(--fv-3); padding-right: var(--fv-3); }
    .card-head, .card-body, thead th, tbody td, .pagination, .filter-bar {
        padding-left: var(--fv-3);
        padding-right: var(--fv-3);
    }
    .task { padding: var(--fv-4); }
    .task-action .btn { width: 100%; }
}

/* == 16. Druck und Bewegungsempfindlichkeit ============================================ */

@media print {
    .app-sidebar,
    .skip-link,
    .page-header-actions,
    .action-bar,
    .form-actions,
    .pagination { display: none; }

    .app-shell { display: block; }
    .app-main > main { max-width: none; padding: 0; }
    .card { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
    body { background: #fff; }
}

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