/* M001: two visible radio groups, address/link to their right. */
.ak-invitation { display:grid; grid-template-columns:max-content max-content minmax(12rem,1fr) 6rem max-content; align-items:start; gap:.75rem; margin-bottom:1rem; }
.ak-invitation fieldset { border:0; padding:0; margin:0; min-width:0; }
.ak-invitation legend { padding:0; margin-bottom:.35rem; }
.ak-invitation .ak-days { margin:0; width:6rem; }
.ak-invitation .ak-days input { width:100%; box-sizing:border-box; min-height:44px; }
.ak-segments { display:grid; gap:.15rem; }
.ak-segment { display:flex; align-items:center; gap:.5rem; min-height:32px; margin:0; cursor:pointer; font-size:.85rem; }
.ak-invitation .ak-segment input { position:static; opacity:1; width:1rem; height:1rem; margin:0; flex:none; accent-color:var(--btn-primary,#2563eb); }
.ak-segment input:focus-visible { outline:2px solid var(--color-focus-ring,#007bff); outline-offset:2px; }
.ak-segment:has(input:disabled) { opacity:.45; cursor:not-allowed; }
.ak-details { min-width:0; }
.ak-existing,.ak-new,.ak-copy-hint { display:none; overflow-wrap:anywhere; }
.ak-invitation:has(.ak-delivery input[value="benutzer"]:checked) .ak-existing,
.ak-invitation:has(.ak-delivery input[value="andere"]:checked) .ak-new,
.ak-invitation:has(.ak-delivery input[value="link"]:checked) .ak-copy-hint { display:block; }
.ak-details input { width:100%; min-width:0; box-sizing:border-box; }
.ak-details small { font-size:.8rem; color:var(--text-secondary,#6b7280); }
.ak-link-row { display:flex; gap:.4rem; }
.ak-link-row input { flex:1; }
.ak-invitation .ak-create { margin:1.65rem 0 0 auto; min-height:44px; white-space:nowrap; }
@media (max-width:900px) {
    .ak-invitation { grid-template-columns:1fr 1fr; }
    .ak-invitation .ak-details { grid-column:1 / -1; }
    .ak-invitation .ak-create { margin-top:0; }
}
/* Handbuch media controls and immutable image blocks. */
[data-handbuch-editor] .handbuch-medien-panel {
    border: 1px solid #6c757d;
    border-radius: 0.35rem;
    padding: 0.8rem;
    margin: 0.6rem 0;
    background: var(--bg-secondary, #f5f7fa);
}
[data-handbuch-editor] .handbuch-medien-panel[hidden],
[data-handbuch-editor] .handbuch-medien-panel [hidden],
[data-handbuch-editor] .handbuch-medium [hidden] { display: none; }
[data-handbuch-editor] .handbuch-medien-panel label {
    display: block;
    margin: 0.6rem 0;
}
[data-handbuch-editor] .handbuch-medien-panel input:not([type="checkbox"]),
[data-handbuch-editor] .handbuch-medien-panel textarea,
[data-handbuch-editor] .handbuch-medien-panel select {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.4rem;
}
[data-handbuch-editor] .handbuch-medien-panel button { margin: 0.2rem; }
[data-handbuch-editor] .handbuch-medien-panel progress { display: block; width: 100%; }
[data-handbuch-editor] .handbuch-medien-vorschau { max-width: 100%; max-height: 240px; object-fit: contain; }
[data-handbuch-editor] .handbuch-medien-ergebnisse { max-height: 300px; overflow-y: auto; }
[data-handbuch-editor] .handbuch-medien-treffer { display: flex; gap: 0.5rem; align-items: center; padding: 0.4rem; }
[data-handbuch-editor] .handbuch-medien-treffer img { width: 80px; max-height: 70px; object-fit: contain; }
[data-handbuch-editor] .handbuch-medien-treffer button { overflow-wrap: anywhere; text-align: left; }
[data-handbuch-editor] .handbuch-medien-marker { background: #fff3cd; color: #533f03; padding: 0.15rem 0.4rem; border: 1px dashed #856404; }
.handbuch-medium { display: block; max-width: 100%; margin: 1rem 0; }
.handbuch-medium[data-width="25"] { width: 25%; }
.handbuch-medium[data-width="50"] { width: 50%; }
.handbuch-medium[data-width="75"] { width: 75%; }
.handbuch-medium[data-width="100"] { width: 100%; }
.handbuch-medium[data-align="center"] { margin-left: auto; margin-right: auto; }
.handbuch-medium[data-align="right"] { margin-left: auto; }
.handbuch-medium img { display: block; width: 100%; height: auto; }
.handbuch-medium figcaption { margin-top: 0.3rem; font-size: 0.9em; overflow-wrap: anywhere; }
[data-handbuch-editor] .handbuch-medium.ProseMirror-selectednode { outline: 3px solid #007bff; outline-offset: 3px; }
[data-handbuch-editor] .handbuch-medium-fehler { display: block; border: 1px solid #dc3545; padding: 0.5rem; }
/* M090 Schnellzugriff (Suchkachel, Vollseite) — Logik in static/js/schnellzugriff.js */
.kachel-suche { cursor:default; overflow:visible; }
.kachel-suche:hover { transform:none; box-shadow:none; border-color:var(--kachel-border); }
.kachel-suche:hover .kachel-icon { transform:none; }
.kachel-suche:focus-within { border-color:#2a5298; box-shadow:0 6px 16px rgba(42,82,152,0.2); z-index:60; }
.kachel-suche .sz-feld { flex:1; min-width:0; }
.sz-input { width:100%; padding:.45rem .6rem; border:1px solid #cbd5e1; border-radius:6px; font-size:.9rem; box-sizing:border-box; }
.sz-ergebnisse { position:absolute; top:calc(100% + 4px); left:-2px; width:max(calc(100% + 4px), 300px); max-height:16rem; overflow-y:auto; background:#fff; border:1px solid #cbd5e1; border-radius:8px; box-shadow:0 8px 20px rgba(0,0,0,.18); z-index:70; text-align:left; }
.sz-ergebnisse:empty { display:none; }
.sz-gross { position:relative; max-width:640px; }
.sz-gross .sz-input { font-size:1.1rem; padding:.7rem .9rem; }
.sz-gross .sz-ergebnisse { position:static; width:100%; max-height:none; margin-top:.5rem; box-shadow:none; }
.sz-eintrag { display:flex; align-items:center; gap:.6rem; width:100%; padding:.5rem .7rem; border:0; border-bottom:1px solid #eef2f7; background:#fff; cursor:pointer; text-align:left; font:inherit; }
.sz-eintrag:hover, .sz-eintrag.sz-aktiv { background:#e8f0fe; }
.sz-icon { width:1.6rem; flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:1.2rem; line-height:1; }
.sz-icon img { width:1.6rem; height:1.6rem; object-fit:contain; display:block; }
.sz-text { flex:1; min-width:0; display:flex; flex-direction:column; }
.sz-titel { font-weight:600; color:#1e3c72; font-size:.9rem; }
.sz-beschr { color:#6b7280; font-size:.75rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sz-badge { flex-shrink:0; font-size:.68rem; font-weight:600; padding:.1rem .45rem; border-radius:999px; }
.sz-badge-gruppe { background:#fef3c7; color:#92400e; }
.sz-badge-modul { background:#e0e7ff; color:#3730a3; }
.sz-leer { padding:.75rem; color:#6b7280; font-size:.85rem; }
@media (max-width:768px) { .kachel-suche { grid-column:1 / -1; flex-direction:row !important; text-align:left !important; min-height:90px; } }
/* M089 Dashboard-Editor */
.de-layout { display:grid; grid-template-columns:minmax(0,1fr) calc(var(--kachel-breite) + 2rem); gap:1rem; align-items:start; }
.de-side { position:sticky; top:.5rem; max-height:calc(100vh - 7rem); overflow-y:auto; display:flex; flex-direction:column; gap:.4rem; }
.de-side h3 { margin:0; }
.de-side select { width:100%; }
@media (max-width:640px) { .de-layout { grid-template-columns:1fr; } .de-side { position:static; max-height:none; } }
.de-row { margin:.65rem 0; }
.de-row label { display:block; font-weight:600; margin-bottom:.2rem; }
.de-zone { min-height:48px; padding:.35rem; border:2px dashed #94a3b8; border-radius:6px; background:#f8fafc; display:flex; gap:.35rem; flex-wrap:wrap; }
.de-chip.dashboard-kachel { width:var(--kachel-breite); height:var(--kachel-hoehe); padding:1.5rem; cursor:grab; }
.de-staging-controls { display:flex; gap:.5rem; margin:.75rem 0 .35rem; }
.de-staging-controls select { flex:1; }
.de-staging { margin-bottom:1rem; background:#fffbeb; border-color:#f59e0b; flex-direction:column; flex-wrap:nowrap; align-items:flex-start; min-height:120px; }
/*
 * BFT Fahrten Management System — Haupt-Stylesheet
 * =================================================
 * Autor:    Balz Heusler / Oz AI Agent
 * Zuletzt aktualisiert: April 2026
 *
 * INHALTSVERZEICHNIS
 * ------------------
 *  1.  Reset & CSS-Variablen
 *  2.  App-Shell Layout  (shell.html)
 *  3.  Login-Seite       (login_form.html)
 *  4.  Adressfelder      (generic_form.py)
 *  5.  Dashboard-Uebersicht (dashboard_content.html)
 *  6.  Dashboard-Kacheln    (dashboard_module.html)
 *  7.  Statistik-Karten
 *  8.  Datentabellen     (generic_list.py)
 *  9.  Nachrichten / Alerts
 * 10.  Modale Dialoge    (generic_form.py / content.py)
 * 11.  Buttons (Standard)
 * 12.  Buttons (Klein, fuer Tabellen)
 * 13.  Badges & Status-Anzeigen
 * 14.  Links
 * 15.  Formulare (generisch)
 * 16.  Tabs
 * 17.  Info-Grid
 * 18.  Code-Block
 * 19.  Flash-Nachrichten (Toasts)
 * 20.  Debug-Info
 * 21.  Fehlerseite
 * 22.  Responsive
 *
 * FARBKONZEPT
 * -----------
 * Alle Farben und Abstaende als CSS-Variablen in :root.
 * Aenderung an einer zentralen Stelle wirkt ueberall.
 *
 * KACHEL-GROESSEN
 * ---------------
 * Standardwerte in :root (--kachel-*).
 * Rollen-spezifische Werte via <style>:root{--kachel-*:...}</style>
 * in dashboard_module.html (aus DB-Tabelle rollen).
 *
 * INLINE-STYLES
 * -------------
 * Ziel: keine inline styles in Python/HTML.
 * Noch verbleibende inline styles in content.py sind
 * dynamische f-string Werte (z.B. Farben aus DB) die
 * nicht durch CSS-Klassen ersetzt werden koennen.
 */


/* Shared Mermaid popup: legacy and Schema5 engine adapters. */
.hb-mermaid-overlay { position: fixed; inset: 0; z-index: 10050; padding: 2vh 1vw; display: flex; background: var(--color-overlay); }
.hb-mermaid-popup { width: 100%; height: 100%; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 8px; background: var(--form-surface); color: var(--text-color); box-shadow: var(--shadow-lg); font-family: var(--font-family); font-size: var(--font-size-small); line-height: 1.4; }
.hb-mermaid-popup [hidden] { display: none !important; }
.hb-mermaid-popup :is(button,input,select,textarea,summary) { font: inherit; max-width: 100%; min-width: 0; }
.hb-mermaid-popup :is(button,summary) { min-height: 40px; cursor: pointer; }
.hb-mermaid-popup button { padding: .4rem .6rem; border: 1px solid var(--color-border); border-radius: 4px; background: var(--btn-secondary); color: var(--color-text-inverse); }
.hb-mermaid-popup button:hover { background: var(--btn-secondary-hover); }
.hb-mermaid-popup button[aria-pressed="true"] { outline: 2px solid var(--color-focus-ring); outline-offset: -2px; }
.hb-mermaid-popup button:disabled { cursor: default; opacity: .55; }
.hb-mermaid-popup .btn-secondary { background: var(--btn-secondary); color: var(--color-text-inverse); }
.hb-mermaid-popup .btn-secondary:hover { background: var(--btn-secondary-hover); }
.hb-mermaid-popup .btn-primary { background: var(--btn-primary); color: var(--color-text-inverse); }
.hb-mermaid-popup .btn-primary:hover { background: var(--btn-primary-hover); }
.hb-mermaid-popup :focus-visible { outline: 3px solid var(--color-focus-ring); outline-offset: 2px; }
.hb-mermaid-popup label { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; color: var(--label-color); }
.hb-mermaid-popup .form-input { background: var(--input-bg); color: var(--input-text); border: 1px solid var(--input-border); border-radius: 4px; padding: .4rem; }
.hb-mermaid-popup .form-input:disabled { background: var(--input-disabled); }
.hb-mermaid-popup .form-input:focus { border-color: var(--input-border-focus); }
.hb-mermaid-header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem .8rem; background: var(--form-header-bg); border-bottom: 1px solid var(--color-border); flex: none; }
.hb-mermaid-header h2 { flex: 1; margin: 0; font-size: var(--font-size-h1); overflow-wrap: anywhere; }
.hb-mermaid-debug { flex-basis: 100%; color: var(--debug-color); font-family: var(--font-mono); overflow-wrap: anywhere; }
.hb-mermaid-dirty { color: var(--text-secondary); }
.hb-mermaid-commands { flex: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: .4rem .6rem; background: var(--form-header-bg); border-bottom: 1px solid var(--color-border); }
.hb-mermaid-command-group { position: relative; }
.hb-mermaid-command-group > summary { display: flex; align-items: center; padding: .4rem .6rem; border: 1px solid var(--color-border); border-radius: 4px; background: var(--form-surface); color: var(--text-color); }
.hb-mermaid-command-group[open] > summary { border-color: var(--color-focus-ring); }
.hb-mermaid-command-body { position: absolute; z-index: 4; top: 100%; left: 0; display: flex; flex-direction: column; gap: .5rem; width: min(380px, 88vw); max-height: 58svh; overflow: auto; padding: .65rem; border: 1px solid var(--color-border); border-radius: 4px; background: var(--form-surface); color: var(--text-color); box-shadow: var(--shadow-lg); }
.hb-mermaid-command-body > div { display: flex; flex-direction: column; gap: .5rem; }
.hb-mermaid-command-body label { justify-content: space-between; }
.hb-mermaid-command-body .hb-mermaid-node-property { padding-bottom: .6rem; border-bottom: 1px solid var(--color-border); }
.hb-mermaid-node-property label { display: flex; flex-direction: column; align-items: stretch; }
.hb-mermaid-node-property :is(input,select) { width: 100%; }
.hb-mermaid-main { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(320px, 1.8fr) minmax(240px, 1fr); flex: 1 1 0; min-height: 0; min-width: 0; overflow: hidden; }
.hb-mermaid-source { min-width: 0; min-height: 0; padding: .6rem; display: flex !important; flex-direction: column; align-items: stretch !important; }
.hb-mermaid-source textarea { flex: 1; width: 100%; min-height: 0; resize: none; font-family: var(--font-mono) !important; }
.hb-mermaid-canvas { position: relative; min-width: 0; min-height: 0; overflow: auto; border: 1px solid var(--color-border); background: var(--form-surface); }
.hb-mermaid-canvas > div { min-height: 100%; }
.hb-mermaid-aside { min-height: 0; min-width: 0; overflow: auto; border-left: 1px solid var(--color-border); padding: .6rem; background: var(--form-surface); }
.hb-mermaid-media { display: flex; flex-direction: column; gap: .5rem; }
.hb-mermaid-media h3 { font-size: var(--font-size-body); margin: 0; }
.hb-mermaid-media ol { padding-left: 1.2rem; }
.hb-mermaid-media :is(p,ol) { color: var(--text-secondary); font-size: var(--font-size-small); }
.hb-mermaid-media label { justify-content: space-between; }
.hb-mermaid-media input { max-width: 65%; }
.hb-mermaid-properties { margin-top: .7rem; border-top: 1px solid var(--color-border); padding-top: .6rem; }
.hb-mermaid-properties > div { display: flex; flex-direction: column; gap: .5rem; }
.hb-mermaid-properties { display: flex; flex-direction: column; gap: .5rem; }
.hb-mermaid-media > div:first-child { display: flex; flex-direction: column; gap: .5rem; }
.hb-mermaid-results,.hb-mermaid-media .hb-visual-results { display: flex; flex-direction: column; gap: .5rem; }
.hb-mermaid-media button { white-space: normal; overflow-wrap: anywhere; }
.hb-mermaid-tile-preview { display: block; width: 120px; height: 80px; max-width: 100%; object-fit: contain; }
.hb-mermaid-icon-preview { display: block; width: 32px; height: 32px; object-fit: contain; }
.hb-mermaid-results,.hb-mermaid-media .hb-visual-results { max-height: 40vh; overflow-y: auto; }
.hb-mermaid-results>button,.hb-visual-results>div { display: flex; align-items: center; gap: .5rem; min-height: 44px; text-align: left; }
.hb-tile-options { min-width: 0; display: flex; flex-direction: column; gap: .3rem; padding: .4rem; }
.hb-tile-options label { min-height: 32px; justify-content: flex-start; }
.hb-tile-options input[type=checkbox] { flex: none; width: auto; }
.hb-mermaid-asset-preview { max-width: 100%; max-height: 180px; object-fit: contain; }
.hb-mermaid-status { flex: none; max-height: 15svh; overflow: auto; padding: .35rem .8rem; white-space: pre-wrap; color: var(--error-color); }
.hb-mermaid-status:empty { padding: 0; }
.hb-mermaid-footer { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; padding: .5rem .8rem; background: var(--form-header-bg); border-top: 1px solid var(--color-border); }
.hb-mermaid-type-picker { position: relative; width: min(380px, 100%); }
.hb-mermaid-type-picker > .hb-mermaid-type-list { position: absolute; z-index: 6; top: 100%; left: 0; width: min(440px, 90vw); background: var(--form-surface); }
.hb-mermaid-command-group > summary::after { content: ' ▾'; margin-left: .4rem; }
.hb-rich-commands { position: relative; display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem; background: var(--form-header-bg); border: 1px solid var(--color-border); }
.hb-rich-commands > details { position: relative; }
.hb-rich-commands summary { cursor: pointer; list-style: none; padding: .6rem; border: 1px solid var(--color-border); border-radius: 4px; background: var(--form-surface); color: var(--text-color); }
.hb-rich-command-body { position: absolute; z-index: 10; top: 100%; left: 0; display: flex; flex-direction: column; gap: .3rem; width: min(310px, 85vw); max-height: 45svh; overflow: auto; padding: .5rem; border: 1px solid var(--color-border); background: var(--form-surface); box-shadow: var(--shadow-lg); }
.hb-rich-command-body .btn { text-align: left; white-space: normal; }
.hb-rich-commands > details:last-child .hb-rich-command-body { left: auto; right: 0; }
@media (max-width: 640px) {
    .hb-rich-commands > details { position: static; }
    .hb-rich-commands .hb-rich-command-body { left: 0; right: 0; width: 100%; }
}
.hb-mermaid-popup .hb-mermaid-type-picker button { display: grid; grid-template-columns: 80px 1fr; align-items: center; gap: .2rem .5rem; width: 100%; text-align: left; padding: .4rem; border: 1px solid var(--color-border); background: var(--form-surface); color: var(--text-color); }
.hb-mermaid-type-picker img { grid-row: span 2; object-fit: contain; width: 80px; height: 50px; }
.hb-mermaid-type-picker small { color: var(--text-secondary); font-family: var(--font-mono); }
.hb-mermaid-type-list { max-height: 42svh; overflow: auto; margin-top: .3rem; border: 1px solid var(--color-border-strong); box-shadow: var(--shadow-md); }
.hb-mermaid-type-list > input { position: sticky; top: 0; z-index: 1; width: 100%; }
.hb-mermaid-popup .hb-mermaid-type-list [aria-selected="true"] { border-color: var(--color-focus-ring); background: var(--color-surface-subtle); }
.hb-mermaid-panels { display: none; }
.hb-mermaid-popup .hb-diagram-steps { padding-left: 1rem; }
.hb-mermaid-popup .hb-diagram-steps li { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
@media (max-width: 1000px) {
    .hb-mermaid-overlay { padding: 0; }
    .hb-mermaid-popup { border-radius: 0; }
    .hb-mermaid-panels { display: flex; flex: none; gap: .3rem; padding: .35rem; background: var(--form-header-bg); }
    .hb-mermaid-panels button { flex: 1; padding: .4rem; white-space: normal; }
    .hb-mermaid-panels [aria-pressed="true"] { outline: 2px solid var(--color-focus-ring); }
    .hb-mermaid-main { grid-template-columns: minmax(0, 1fr); }
    .hb-mermaid-popup:not([data-active-panel="source"]) .hb-mermaid-source,
    .hb-mermaid-popup:not([data-active-panel="canvas"]) .hb-mermaid-canvas,
    .hb-mermaid-popup:not([data-active-panel="media"]) .hb-mermaid-aside { display: none !important; }
    .hb-mermaid-command-group { position: static; }
    .hb-mermaid-command-body { top: auto; left: 2vw; width: 96vw; max-height: 50svh; }
    .hb-mermaid-header h2 { font-size: var(--font-size-body); }
    .hb-mermaid-popup :is(button,summary) { min-height: 44px; }
}

/* ============================================================
   1. RESET & CSS-VARIABLEN
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* --- Design-System Farben --- */
    --primary-color:   #2563eb;
    --primary-hover:   #1d4ed8;
    --secondary-color: #64748b;
    --success-color:   #10b981;
    --error-color:     #ef4444;
    --warning-color:   #f59e0b;
    --info-color:      #3b82f6;

    /* --- Hintergruende & Oberflaechen --- */
    --bg-color:      #f8fafc;
    --surface-color: #ffffff;

    /* --- Texte & Rahmen --- */
    --text-color:     #1e293b;
    --text-secondary: #64748b;
    --border-color:   #e2e8f0;

    /* --- Schatten --- */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);

    /* --- App-Shell Farben (shell.html) --- */
    --header-bg:          #eef3f8;
    --header-title-color: #1e293b;
    --user-info-bg:       #fff9c4;   /* Gelber Hintergrund fuer das User-Info-Panel */
    --user-info-border:   #ffeb3b;

    /* --- Dashboard-Kacheln ---
       Standardwerte. Rollen-spezifische Ueberschreibungen via
       <style>:root{--kachel-breite: Xpx; ...}</style> in dashboard_module.html.
       Die Werte kommen aus DB-Tabelle 'rollen' (dashboard_kachel_* Felder).
    */
    --kachel-breite:              200px;
    --kachel-hoehe:               150px;
    --kachel-abstand:              16px;  /* Horizontaler Abstand zwischen Kacheln */
    --kachel-abstand-vertikal:     16px;  /* Vertikaler Abstand zwischen Zeilen */
    --kachel-icon-groesse:         40px;
    --kachel-titel-groesse:        16px;
    --kachel-beschreibung-groesse: 12px;
    --kachel-bg:            white;
    --kachel-border:        #dee2e6;
    --kachel-border-radius: 8px;

    /* --- Formular-Ueberlagerung ---
       Abstand vom oberen Rand fuer modale Formulare.
       Fester Wert; shell.html setzt ihn ebenfalls fest (56px). Die frueher
       dafuer vorgesehene Systemeinstellung Form-px-from-top ist entfernt.
    */
    --form-top-offset: 56px;

    /* --- BFT Action-Buttons (überschreibbar via Farbsystem-Admin) --- */
    --btn-primary:          #007bff;
    --btn-secondary:        #6c757d;
    --btn-danger:           #dc3545;
    --btn-success:          #28a745;
    --btn-warning:          #ffc107;
    --btn-dark:             #343a40;
    --btn-accent:           #6f42c1;
    --btn-info:             #0d9488;
    --contact-phone-action-bg:       #28a745;
    --contact-phone-action-fg:       #ffffff;
    --contact-phone-action-hover-bg: #218838;
    --contact-email-action-bg:       #007bff;
    --contact-email-action-fg:       #ffffff;
    --contact-email-action-hover-bg: #0069d9;

    /* --- Datentabellen (überschreibbar via Farbsystem-Admin) --- */
    --list-bg:              #ffffff;
    --list-header-bg:       #f8f9fa;
    --list-row-hover:       #f8f9fa;
    --list-row-active:      #eef4ff;
    --list-subrow-bg:       #f0f4ff;
    --list-subrow-border:   #c7d9f5;

    /* --- Schriften (überschreibbar via Farbsystem-Admin) --- */
    --font-family:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono:       'IBM Plex Mono', Consolas, 'Courier New', monospace; /* IDs, Codes, Debug */
    --font-size-body:  1rem;
    --font-size-small: 0.85rem;
    --font-size-h1:    1.3rem;
    --font-size-label: 0.85rem;

    /* --- Textfarben-Rollen (Kap. 11.3) --- */
    --color-text-muted:      #8a94a3;  /* Hilfetexte, Zeitstempel, Platzhalter */
    --color-text-inverse:    #ffffff;  /* Text auf dunklen Flächen */
    --color-text-link:       #2563eb;  /* Links */
    --debug-color:           #94a3b8;  /* Debug-Hinweise */

    /* --- Oberflächen-Rollen (Kap. 11.4) --- */
    --color-surface:         #ffffff;  /* Karten, Formulare, Modale */
    --color-surface-subtle:  #f8fafc;  /* Formular-Header, Code-Block */
    --color-overlay:         rgba(15,23,42,0.55); /* Modal-Abdunklung */
    --color-focus-ring:      #2563eb;  /* Tastatur-Fokus (WCAG) */

    /* --- Rahmen-Rollen (Kap. 11.5) --- */
    --color-border:          #e2e8f0;  /* Standard-Rahmen (= --border-color) */
    --color-border-strong:   #aeb8c5;  /* Betonte Abgrenzung */
    --color-divider:         #e4e9ef;  /* Trennlinien */

    /* --- Primär-Dunkel für Titel, Tabs, Kacheln --- */
    --color-primary-dark:    #1e3c72;

    /* --- Formulare / Inputs (Kap. 11.7) --- */
    --input-bg:              #ffffff;
    --input-text:            #1e293b;
    --input-placeholder:     #8a94a3;
    --input-border:          #e2e8f0;
    --input-border-hover:    #aeb8c5;
    --input-border-focus:    #2563eb;
    --input-invalid:         #dc3545;
    --input-disabled:        #f1f5f9;
    --form-surface:          #ffffff;
    --form-header-bg:        #f8fafc;
    --label-color:           #334155;

    /* --- Status-Hintergründe (Kap. 11.2) --- */
    --color-success-bg:      #d4edda;
    --color-warning-bg:      #fff3cd;
    --color-error-bg:        #f8d7da;
    --color-info-bg:         #d1ecf1;

    /* --- Button-Hover-Zustände (abgeleitet, überschreibbar via Farbsystem) --- */
    --btn-primary-hover:   #0069d9;
    --btn-secondary-hover: #5a6268;
    --btn-danger-hover:    #c82333;
    --btn-success-hover:   #218838;
    --btn-warning-hover:   #e0a800;
    --btn-dark-hover:      #23272b;
    --btn-accent-hover:    #5a2d91;
    --btn-info-hover:      #0b7a70;

    /* --- Badge-Farben --- */
    --badge-danger-bg:    #dc3545;
    --badge-danger-fg:    #ffffff;
    --badge-warning-bg:   #ffc107;
    --badge-warning-fg:   #212529;
    --badge-success-bg:   #28a745;
    --badge-success-fg:   #ffffff;
    --badge-primary-bg:   #007bff;
    --badge-primary-fg:   #ffffff;
    --badge-secondary-bg: #6c757d;
    --badge-secondary-fg: #ffffff;

    /* --- Komponenten-Schriften (UI-intern, nicht im Typografie-Kontext-System) --- */
    --font-size-footer: 0.8rem;
    --font-size-tab:    0.9rem;
    --font-size-meta:   0.6rem;  /* Winzig-Labels: user-info, kachel-id etc. */

    /* --- Diff-Ansicht (Änderungsprotokoll) --- */
    --diff-row-bg:     #f8f9fa;
    --diff-changed-bg: #fff3cd;
    --diff-json-bg:    #e3f2fd;
    --diff-old-bg:     #ffebee;
    --diff-new-bg:     #e8f5e9;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}


/* ============================================================
   2. APP-SHELL LAYOUT (shell.html)
   Drei-Zonen-Layout: Header -> #main-content -> Footer
   ============================================================ */

/* svh = small viewport height — behebt 100vh-Bug auf Android (Browser-Adressleiste) */
html, body { height: 100svh; overflow: hidden; }
body { display: flex; flex-direction: column; }

html.app-icon-page, html.app-icon-page body {
    height: auto;
    min-height: 100svh;
    overflow-y: auto;
}

/* Header */
.app-header {
    background: var(--header-bg);
    color: var(--text-color);
    /* Padding skaliert mit Viewport */
    padding: clamp(0.4rem, 0.75vw, 0.75rem) clamp(0.75rem, 1.5vw, 1.5rem);
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}
/* 3-Spalten-Layout: Links=Logo/Titel, Mitte=Dashboard, Rechts=Login
   Jeder Bereich bekommt flex:1 damit Mitte wirklich zentriert ist */
.header-left   { display: flex; align-items: center; gap: clamp(0.4rem, 0.75vw, 1rem); flex: 1; min-width: 0; }
.header-center { display: flex; align-items: center; justify-content: center; gap: clamp(0.35rem, 0.6vw, 0.75rem); flex: 1; }
.header-right  { display: flex; align-items: center; justify-content: flex-end; gap: clamp(0.5rem, 0.75vw, 1rem); flex: 1; }
/* Header-Buttons: Schrift + Höhe skalieren mit Viewport */
.header-center .btn {
    display: inline-flex;
    align-items: center;
    height: clamp(28px, 2.8vw, 36px) !important;
    padding-left:  clamp(0.5rem, 0.75vw, 1rem);
    padding-right: clamp(0.5rem, 0.75vw, 1rem);
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    box-sizing: border-box !important;
    white-space: nowrap;
    gap: 6px;
    font-size: clamp(0.78rem, 0.85vw, 0.875rem);
}
/* Innerer Text-Container (Titel + Debug) muss Overflow erlauben */
.header-left > div { min-width: 0; overflow: hidden; }
.logo-link    { display: block; flex-shrink: 0; }
/* Logo skaliert mit Viewport: min 30px, bevorzugt 3.5vw, max 45px */
.app-logo     { height: clamp(30px, 3.5vw, 45px); cursor: pointer; transition: transform 0.2s; }
.app-logo:hover { transform: scale(1.05); }
/* App-Titel: dreistufig responsiv, immer einzeilig
   Umschalter über Media Queries (nicht clamp) — kein Div-Constraint-Problem */
.app-title {
    font-size: var(--typo-app-titel-size, 1.25rem);
    font-weight: var(--typo-app-titel-weight, 600);
    margin: 0;
    color: var(--typo-app-titel-color, var(--header-title-color));
    font-family: var(--typo-app-titel-family, var(--font-family));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
/* Span-Varianten: immer einzeilig */
.title-full, .title-med, .title-short { white-space: nowrap; }
/* Standard: voller Text */
.title-med   { display: none; }
.title-short { display: none; }
/* Auf schmaleren Desktop-Ansichten: mittlere Variante */
@media (max-width: 1399px) {
    .title-full  { display: none; }
    .title-med   { display: inline; }
}
/* Unter 900px: Kurzform */
@media (max-width: 899px) {
    .title-med   { display: none; }
    .title-short { display: inline; }
}
/* Debug-Zeile im Header */
#header-revision-line {
    font-size: clamp(0.58rem, 0.65vw, 0.82rem) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* User-Info Panel (oben rechts, nach Login sichtbar) */
.user-info {
    display: none; /* Wird per .active durch JavaScript eingeblendet */
    position: relative;
}
.user-info.active { display: block; }
.user-info-label  { font-size: var(--font-size-meta, 0.6rem); color: var(--color-text-muted); font-weight: 400; margin-bottom: 0.15rem; }
.user-info-row    { display: flex; align-items: center; gap: 0.75rem; }
.header-session-info {
    align-items: center;
    gap: 0.45rem;
    font-size: clamp(0.65rem, 0.75vw, 0.78rem);
    color: #6b7280;
    white-space: nowrap;
}
.header-session-info #login-time,
.header-session-info #session-countdown {
    display: inline-flex;
    align-items: center;
    min-height: 1.7rem;
    padding: 0.1rem 0.45rem;
    border: 1px solid currentColor;
    border-radius: 5px;
    box-sizing: border-box;
}

/* Haupt-Inhalt-Bereich (via HTMX dynamisch befuellt) */
#main-content {
    flex: 1; padding: 0;
    max-width: 100%; width: 100%; margin: 0;
    overflow-y: auto; min-height: 0;
}

/* Lade-Indikator: Inhalt wird waehrend HTMX-Request leicht ausgeblendet */
.htmx-request #main-content { opacity: 0.6; pointer-events: none; }

/* Footer */
/* Footer: 3-Spalten-Layout, spiegelt Header-Struktur */
.app-footer {
    background: #f8f9fa; padding: 0.4rem 1.5rem; color: #6c757d;
    border-top: 1px solid #dee2e6; flex-shrink: 0;
    display: flex; align-items: center;
}
.app-footer p  { margin: 0; font-size: var(--font-size-footer, 0.8rem); }
.footer-left   { display: flex; align-items: center; flex: 1; }
.footer-center { display: flex; align-items: center; justify-content: center; flex: 1; }
.footer-right  { display: flex; align-items: center; justify-content: flex-end; flex: 1; gap: 0.5rem; }
/* Footer-Buttons: gleiche interne Ausrichtung wie Header-Buttons */
.footer-right .btn {
    display: inline-flex;
    align-items: center;
    height: 32px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    box-sizing: border-box !important;
    white-space: nowrap;
    gap: 6px;
}


/* ============================================================
   3. LOGIN-SEITE (partials/login_form.html)
   ============================================================ */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%); }
.login-container { width: 100%; max-width: 400px; padding: 2rem; }
.login-box       { background: white; padding: 2rem; border-radius: 0.5rem; box-shadow: var(--shadow-lg); }
.login-header    { text-align: center; margin-bottom: 2rem; }
.login-header h1 { color: var(--primary-color); font-size: 1.75rem; margin-bottom: 0.5rem; }
.login-header p  { color: var(--text-secondary); font-size: 0.875rem; }
.login-form      { display: flex; flex-direction: column; gap: 1rem; }
.login-footer    { text-align: center; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border-color); }
.login-footer p  { color: var(--text-secondary); font-size: 0.75rem; }

.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-weight: 500; font-size: 0.875rem; color: var(--text-color); }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
    padding: 0.625rem; border: 1px solid var(--border-color);
    border-radius: 0.375rem; font-size: 0.875rem; transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.checkbox-label         { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.password-input-wrapper { position: relative; display: flex; align-items: center; }
.password-input-wrapper input { padding-right: 2.5rem; width: 100%; }
.password-toggle {
    position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; padding: 0.25rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; opacity: 0.6; transition: opacity 0.2s;
}
.password-toggle:hover { opacity: 1; }
.password-toggle:focus { outline: 2px solid var(--primary-color); outline-offset: 2px; border-radius: 0.25rem; }


/* ============================================================
   4. ADRESSFELDER (generic_form.py -> address_standard Layout)
   Spezielle Grid-Layouts fuer Schweizer Adressen
   ============================================================ */
.address-layout       { display: flex; flex-direction: column; gap: 0.4rem; }
.address-row          { display: grid; gap: 0.4rem; }
.address-row-full     { grid-template-columns: 1fr; }
.address-row-street   { grid-template-columns: 8fr 1fr; }
.address-row-street > div:last-child label { text-align: right; white-space: nowrap; }
.address-row-street > div:last-child input { text-align: right; }
.address-row-location { grid-template-columns: 1.5fr 1.5fr 7fr; }

/* === Google Places Autocomplete (bft-google-places.js) === */
.gp-search-wrapper {
    position: relative;
    margin-bottom: 0.6rem;
}
.gp-search-input {
    width: 100%;
    padding: 0.5rem 0.5rem 0.5rem 1.8rem;
    border: 1px solid #007bff;
    border-radius: 4px;
    font-size: 0.875rem;
    background: #f0f8ff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%23007bff'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5S10.62 6.5 12 6.5s2.5 1.12 2.5 2.5S13.38 11.5 12 11.5z'/%3E%3C/svg%3E") no-repeat 0.4rem center;
}
.gp-search-input:focus { outline: none; border-color: #0056b3; }
.gp-dropdown {
    position: absolute;
    z-index: 2000;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    display: none;
}
.gp-option {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gp-option--hover, .gp-option:hover { background: #e8f0fe; }

/* === PLZ / Land Autocomplete Dropdowns (bft-address.js) === */
.plz-option, .land-option {
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.8rem;
    background: white;
}
.plz-option--hover, .land-option--hover,
.plz-option:hover, .land-option:hover { background: #f0f8ff; }
.plz-logik-badge { color: #28a745; font-size: 0.7rem; margin-left: 0.4rem; }

/* Autocomplete-Container Basisstil */
[id*="-autocomplete"] {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    display: none;
}

/* Laender-Dropdown: Nur ISO-Code in geschlossenem Zustand, voller Text in Optionen */
select[name="land"] { text-align: center; font-weight: 500; }
select[name="land"] option { text-align: left; padding: 0.5rem; font-weight: normal; }
select[name="land"]:focus option,
select[name="land"][size] option { min-width: 250px; }


/* ============================================================
   5. DASHBOARD-UEBERSICHT (partials/dashboard_content.html)
   Kompakte Kacheln fuer den Admin-Bereich (feste Groesse)
   ============================================================ */

/* Grid-Container; Spaltenanzahl wird inline gesetzt (z.B. repeat(5,1fr)) */
.table-buttons-grid { display: grid; gap: 0.75rem; }

/* Kompakte Kachel (Admin-Dashboard) */
.table-button {
    background: white; border: 2px solid #dee2e6;
    border-radius: 6px; padding: 0.75rem 0.5rem;
    text-align: center; cursor: pointer; transition: all 0.3s;
}
.table-button .button-icon { font-size: 2.2rem; margin-bottom: 0.35rem; }
.table-button h4           { color: #1e3c72; margin: 0; font-size: 0.85rem; line-height: 1.2; }
.table-button:hover        { border-color: #2a5298; box-shadow: 0 4px 12px rgba(42,82,152,0.15); transform: translateY(-2px); }
.table-button:active       { transform: translateY(0); }

/* Abschnitt-Container (um Gruppen von Inhalten) */
.admin-section       { background: var(--surface-color); border-radius: 1rem; padding: 2rem; box-shadow: var(--shadow-md); }
.section-title       { font-size: 2rem; font-weight: 700; color: var(--text-color); margin-bottom: 0.5rem; }
.section-description { color: var(--text-secondary); font-size: 1rem; margin-bottom: 2rem; }

/* Benutzerinformations-Karte */
.user-info-container { background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%); border-radius: 1rem; padding: 2rem; box-shadow: var(--shadow-lg); color: white; }
.user-info-header    { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.2); }
.user-avatar         { width: 80px; height: 80px; background: rgba(255,255,255,0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 700; backdrop-filter: blur(10px); border: 3px solid rgba(255,255,255,0.3); }
.avatar-initials     { text-transform: uppercase; }
.user-details        { flex: 1; }
.user-name           { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.25rem 0; }
.user-role           { font-size: 1rem; opacity: 0.9; margin: 0; font-weight: 500; }
.user-info-grid      { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }
.info-item           { display: flex; flex-direction: column; gap: 0.5rem; }
.info-label          { font-size: 0.875rem; opacity: 0.8; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.info-value          { font-size: 1.125rem; font-weight: 600; }
.status-badge        { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 0.375rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.status-active       { background: rgba(16,185,129,0.2); color: white; border: 1px solid rgba(255,255,255,0.3); }
.button-content      { flex: 1; }
.button-content h3   { font-size: 1.25rem; font-weight: 700; color: var(--text-color); margin: 0 0 0.25rem 0; }
.button-content p    { font-size: 0.875rem; color: var(--text-secondary); margin: 0; }


/* ============================================================
   6. DASHBOARD-KACHELN (partials/dashboard_module.html)
   Groessen ueber CSS-Variablen gesteuert.
   Rollen-spezifische Werte ueberschreiben :root-Defaults via
   <style>:root{--kachel-breite:Xpx;...}</style> im Template.
   ============================================================ */

/* Scrollbarer Wrapper fuer das Kachel-Grid */
.dashboard-scroll    { height: 100%; overflow-y: auto; padding: 1.5rem; }
.dashboard-container { display: flex; flex-direction: column; padding: 0; margin: 0; }

/* Zeile mit Kacheln (Abstand aus CSS-Variable) */
.dashboard-row { display: flex; gap: var(--kachel-abstand); flex-wrap: wrap; margin-bottom: var(--kachel-abstand-vertikal); }

/* Kachel (aktiv) - alle Groessen aus CSS-Variablen */
.dashboard-kachel {
    background: var(--kachel-bg);
    border: 2px solid var(--kachel-border);
    border-radius: var(--kachel-border-radius);
    padding: 1.5rem; cursor: pointer; transition: all 0.3s;
    width: var(--kachel-breite); height: var(--kachel-hoehe);
    display: flex; justify-content: center; align-items: center;
    flex-shrink: 0; gap: 0.75rem; position: relative;
}
.dashboard-kachel:hover  { border-color: #2a5298; box-shadow: 0 6px 16px rgba(42,82,152,0.2); transform: translateY(-4px); }
.dashboard-kachel:active { transform: translateY(-2px); }

/* Leerer Platzhalter (Modul K00 = Abstandshalter) */
.dashboard-kachel-empty {
    background: transparent; border: 2px dashed var(--color-border);
    border-radius: var(--kachel-border-radius);
    width: var(--kachel-breite); height: var(--kachel-hoehe);
    flex-shrink: 0;
}

/* Icon-Position (Klasse aus rolle.dashboard_icon_position gesetzt) */
.kachel-icon-top    { flex-direction: column; text-align: center; }
.kachel-icon-bottom { flex-direction: column-reverse; text-align: center; }
.kachel-icon-left   { flex-direction: row; text-align: left; }
.kachel-icon-right  { flex-direction: row-reverse; text-align: left; }

/* Kachel-Inhalte (Groessen aus CSS-Variablen) */
.kachel-icon        { font-size: var(--kachel-icon-groesse); line-height: 1; transition: transform 0.3s; }
.kachel-icon img    { width: var(--kachel-icon-groesse); height: var(--kachel-icon-groesse); object-fit: contain; display: block; }
.kachel-title       { color: var(--color-primary-dark); margin: 0 0 0.25rem 0; font-size: var(--kachel-titel-groesse); font-weight: 600; line-height: 1.3; }
.kachel-description { color: var(--text-secondary);    font-size: var(--kachel-beschreibung-groesse); margin: 0; line-height: 1.2; }
.kachel-text        { display: flex; flex-direction: column; justify-content: center; }
.kachel-empty-text  { text-align: center; padding: 3rem; background: var(--color-surface-subtle); border-radius: 8px; border: 2px dashed var(--color-border); }
.kachel-modul-id    { position: absolute; top: 0.25rem; left: 0.5rem; font-size: clamp(0.55rem, var(--typo-debug-info-size, 0.65rem), 0.85rem); color: var(--typo-debug-info-color, var(--color-text-muted)); font-family: var(--typo-debug-info-family, var(--font-mono)); font-weight: var(--typo-debug-info-weight, 400); opacity: 0.85; }

/* Hover-Animation auf Icon */
.dashboard-kachel:hover .kachel-icon { transform: scale(1.1); }


/* ============================================================
   7. STATISTIK-KARTEN (partials/dashboard_fahrer.html etc.)
   ============================================================ */
.stats-grid   { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.stat-card    { background: var(--surface-color); padding: 1.5rem; border-radius: 0.75rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); display: flex; align-items: center; gap: 1rem; transition: all 0.3s ease; }
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.stat-icon    { font-size: 2.5rem; opacity: 0.8; }
.stat-content { flex: 1; }
.stat-card h3 { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 0.5rem; font-weight: 500; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary-color); }


/* ============================================================
   8. DATENTABELLEN (generic_list.py)
   Verwendung: <table class="data-table">
   .td-actions = Aktions-Spalte (Bearbeiten/Loeschen)
   ============================================================ */
.data-table          { width: 100%; border-collapse: collapse; background: var(--list-bg); box-shadow: 0 2px 4px rgba(0,0,0,0.1); font-size: clamp(0.75rem, var(--typo-liste-zelle-size, 0.9rem), 1rem); color: var(--typo-liste-zelle-color, var(--text-color)); font-family: var(--typo-liste-zelle-family, var(--font-family)); }
.data-table thead    { position: sticky; top: 0; background: var(--list-header-bg); z-index: 10; }
.data-table th       { padding: 0.75rem; text-align: left; border-bottom: 2px solid var(--color-border); font-size: clamp(0.75rem, var(--typo-liste-kopf-size, 0.9rem), 1.1rem); font-weight: var(--typo-liste-kopf-weight, 600); color: var(--typo-liste-kopf-color, inherit); font-family: var(--typo-liste-kopf-family, inherit); }
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table td       { padding: 0.6rem; border-bottom: 1px solid var(--color-border); font-variant-numeric: tabular-nums; }
.data-table tr:hover { background: var(--list-row-hover); }
@media (max-width: 480px) {
    .action-subrow .td-actions-inner .btn-bft:is(
        [hx-get^="/content/rechnungsentwurfs-verwaltung"],
        [hx-get^="/content/spesenabrechnungs-verwaltung"],
        [hx-get^="/content/mitgliederrechnungen-uebermittlung"],
        [hx-get^="/content/list/M055/"],
        [hx-post^="/content/rechnungsentwurfs-verwaltung"],
        [hx-post^="/content/spesenabrechnungs-verwaltung"],
        [hx-post^="/content/mitgliederrechnungen-uebermittlung"]
    ) {
        min-width: 0;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.1;
    }
}
/* ==============================================================
   BFT ACTION BUTTONS (.btn-bft)
   Desktop (>1280px): 44px Höhe, Icon 20px
   Tablet 481–1280px: 44px, 6 Buttons pro Zeile vor Umbruch
   Mobil (≤480px):    36px Höhe, Icon 16px (via Media-Query)
   Icon links, Beschriftung rechts.
   ============================================================== */
.btn-bft {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
    text-decoration: none;
    width: auto;           /* Desktop: auto-Breite */
}
/* Icon: immer 20×20px, weiss auf farbigem Hintergrund */
.btn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    object-fit: contain;
    filter: brightness(0) invert(1);
    vertical-align: middle;
}
.btn-bft-warning .btn-icon { filter: none; } /* Dunkel auf Gelb */
/* Farben */
.btn-bft-primary   { background: var(--btn-primary);   color: white; }
.btn-bft-secondary { background: var(--btn-secondary); color: white; }
.btn-bft-danger    { background: var(--btn-danger);    color: white; }
.btn-bft-success   { background: var(--btn-success);   color: white; }
.btn-bft-warning   { background: var(--btn-warning);   color: #212529; }
.btn-bft-dark      { background: var(--btn-dark);      color: white; }
.btn-bft-accent    { background: var(--btn-accent);    color: white; }
.btn-bft-info      { background: var(--btn-info);      color: white; }
/* Hover */
.btn-bft-primary:hover   { background: var(--btn-primary-hover,   #0069d9); }
.btn-bft-secondary:hover { background: var(--btn-secondary-hover, #5a6268); }
.btn-bft-danger:hover    { background: var(--btn-danger-hover,    #c82333); }
.btn-bft-success:hover   { background: var(--btn-success-hover,   #218838); }
.btn-bft-warning:hover   { background: var(--btn-warning-hover,   #e0a800); }
.btn-bft-dark:hover      { background: var(--btn-dark-hover,      #23272b); }
.btn-bft-accent:hover    { background: var(--btn-accent-hover,    #5a2d91); }
.btn-bft-info:hover      { background: var(--btn-info-hover,      #0b7a70); }

/* Aktions-Spalte global ausblenden — Buttons erscheinen bei Zeilen-Klick als Sub-Row */
.data-table thead th:last-child            { display: none; }
.data-table tbody td.td-actions            { display: none; }
.data-table tbody tr:not(.action-subrow)   { cursor: pointer; }
.data-table tbody tr.is-open               { background: var(--list-row-active) !important; }

/* Sub-Row: Aktionsbuttons als expandierte Zeile (Desktop: flex, Mobile: grid) */
.action-subrow td {
    padding: 0.5rem 0.75rem;
    background: var(--list-subrow-bg);
    border-bottom: 2px solid var(--list-subrow-border);
}
.action-subrow .td-actions-inner {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Aeltere Tabellen-Wrapper */
.sync-link-scroll { overflow-x: auto; max-width: 100%; }
.sync-link-table { min-width: 600px; }
.sync-link-table thead th:last-child { display: table-cell; }
/* Read-only M094 matrix: no action column or row expansion. */
#sync-rules { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; }
#sync-help summary { cursor: pointer; min-height: 44px; padding: .6rem 0; color: var(--text-color); }
#sync-help > div { max-height: 40vh; overflow: auto; padding: .5rem; border: 1px solid var(--color-border); background: var(--surface-color); }
#sync-help ul { padding-left: 1.2rem; }
#sync-help p { margin-top: .5rem; }
#sync-rules .bft-module-header > p { font-size: .8rem; color: var(--text-secondary); }
#sync-matrix-scroll { flex: 1; min-height: 0; overflow: auto; padding: 0 .5rem; }
#sync-rules table { table-layout: fixed; }
#sync-rules thead th:last-child { display: table-cell; }
#sync-rules th, #sync-rules td { padding: .35rem .25rem; text-align: center; overflow-wrap: anywhere; }
#sync-rules th:first-child { width: 36%; text-align: left; }
#sync-rules tbody th { font-weight: 400; border-bottom: 1px solid var(--color-border); }
#sync-rules tbody tr { cursor: default; }
#sync-rules tbody tr:nth-child(even) { background: var(--list-header-bg); }
#sync-rules .badge { font-size: .75rem; padding: .15rem .35rem; }
@media (max-width: 480px) {
    #sync-rules .bft-module-header { padding: .35rem .5rem; }
    #sync-rules .bft-module-header h2 { font-size: 1rem; }
    #sync-rules th, #sync-rules td { font-size: .75rem; }
}
.table-container { background: var(--surface-color); border-radius: 0.5rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); overflow: hidden; }
.table-header    { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.table-header h3 { font-size: 1.125rem; color: var(--text-color); }


/* ============================================================
   9. NACHRICHTEN / ALERTS
   Verwendung in Python:  html += '<div class="msg-error">Fehler</div>'
   Verwendung in Jinja2:  <div class="msg-error">{{ message }}</div>
   ============================================================ */
.msg-error    { padding: 1rem; background: var(--color-error-bg);   color: var(--btn-danger);  border: 1px solid var(--btn-danger);  border-radius: 4px; }
.msg-warning  { padding: 1rem; background: var(--color-warning-bg); color: var(--btn-warning); border: 1px solid var(--btn-warning); border-radius: 4px; }
.msg-success  { padding: 1rem; background: var(--color-success-bg); color: var(--btn-success); border: 1px solid var(--btn-success); border-radius: 4px; }
.msg-info     { padding: 1rem; background: var(--color-info-bg);    color: var(--btn-info);    border: 1px solid var(--btn-info);    border-radius: 4px; }
.msg-error-sm { padding: 0.5rem 0.75rem; background: var(--color-error-bg); color: var(--btn-danger); border: 1px solid var(--btn-danger); border-radius: 4px; font-size: 0.9rem; }


/* ============================================================
   10. MODALE DIALOGE (generic_form.py / content.py)
   .modal-overlay      = voller Bildschirm mit dunklem Hintergrund (z=1000)
   .modal-overlay-top  = Modal mit Abstand fuer sticky Header  (z=2000)
   .modal-container    = weisser Dialog-Container (max 900px)
   .modal-container-wide = breiter Dialog (max 1100px)
   .modal-close-btn    = Abbrechen-Button oben rechts
   .modal-form-name    = kleiner Titel oben links (Formular-Name)
   ============================================================ */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-overlay-top {
    position: fixed; top: var(--form-top-offset, 0); left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000;
}
.modal-container      { background: white; padding: 2rem; border-radius: 8px; max-width: 900px; width: 90%; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-container-wide { background: white; padding: 1.5rem; border-radius: 8px; max-width: 1100px; width: 95%; overflow-y: auto; position: relative; }
.modal-close-btn      { position: absolute; top: 0.5rem; right: 0.5rem; padding: 0.25rem 0.75rem; background: var(--btn-secondary); color: var(--color-text-inverse); border: none; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
.modal-form-name      { position: absolute; top: 0.5rem; left: 1rem; font-size: 0.75rem; color: var(--color-text-muted); font-family: var(--font-mono); }
/* Formular-Klassen für generic_form.rs */
.form-modal-container { background: var(--form-surface); }
.form-modal-title     { color: var(--typo-modul-titel-color, var(--color-primary-dark)); margin: 0; font-size: clamp(0.875rem, var(--typo-modul-titel-size, 1rem), 1.6rem); font-weight: var(--typo-modul-titel-weight, 600); font-family: var(--typo-modul-titel-family, var(--font-family)); }
.form-modal-divider   { border-bottom: 1px solid var(--color-border); padding-bottom: 0.25rem; }
.form-tab-active      { padding: 0.5rem 0.75rem; background: none; border: none; border-bottom: 2px solid var(--color-primary-dark); cursor: pointer; font-weight: 500; color: var(--color-primary-dark); font-size: 0.9rem; }
.form-tab-inactive    { padding: 0.5rem 0.75rem; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; font-weight: 500; color: var(--text-secondary); font-size: 0.9rem; }
.form-footer          { background: var(--form-surface); border-top: 2px solid var(--color-border); padding-top: 0.75rem; margin-top: 0.75rem; }
.form-badge           { display: inline-flex; align-items: center; gap: 0.1rem; background: var(--color-primary-dark); color: var(--color-text-inverse); border-radius: 12px; padding: 0.15rem 0.4rem; font-size: 0.8rem; }
.form-required-mark   { color: var(--input-invalid); }
.form-section-bg      { background: var(--color-surface-subtle); border: 1px solid var(--input-border); border-radius: 4px; padding: 4px; }
.form-mono-value      { font-size: 0.75rem; color: var(--color-text-muted); font-family: var(--font-mono); min-width: 3.5em; }
.form-overlay         { background: var(--color-overlay); }


/* ============================================================
   11. BUTTONS (Standard, normale Groesse)
   Verwendung: class="btn btn-primary"
   ============================================================ */
.btn           { padding: 0.5rem 1rem; border: none; border-radius: 0.375rem; cursor: pointer; font-size: 0.875rem; font-weight: 500; transition: all 0.2s; text-decoration: none; display: inline-block; }
.btn-primary   { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--secondary-color); color: white; }
.btn-secondary:hover { background: var(--btn-secondary-hover, #5a6268); }
.btn-success   { background: var(--success-color); color: white; }
.btn-danger    { background: var(--error-color); color: white; }
.btn-block     { width: 100%; }
.btn-logout    { padding: 0.5rem 1rem; background: var(--error-color); color: white; border: none; border-radius: 0.375rem; font-size: 0.875rem; cursor: pointer; transition: background 0.2s; }
.btn-logout:hover { background: var(--btn-danger-hover, #c82333); }


/* ============================================================
   12. BUTTONS (Klein, fuer Tabellen-Zeilen)
   Kombinieren: class="btn-sm btn-primary-sm"
   btn-sm    = Standard-Padding (mit margin-right)
   btn-sm-md = etwas breiter (ohne margin-right)
   ============================================================ */
.btn-sm    { padding: 0.25rem 0.5rem; border: none; border-radius: 4px; cursor: pointer; font-size: 0.8rem; display: inline-block; }
.btn-sm-md { padding: 0.25rem 0.75rem; border: none; border-radius: 4px; cursor: pointer; font-size: 0.85rem; display: inline-block; }
.btn-primary-sm   { background: var(--btn-primary);   color: var(--color-text-inverse); }
.btn-secondary-sm { background: var(--btn-secondary); color: var(--color-text-inverse); }
.btn-danger-sm    { background: var(--btn-danger);    color: var(--color-text-inverse); }
.btn-success-sm   { background: var(--btn-success);   color: var(--color-text-inverse); }
.btn-warning-sm   { background: var(--btn-warning);   color: #212529; }
.btn-info-sm      { background: var(--btn-teal);      color: var(--color-text-inverse); }
.btn-primary-sm:hover   { filter: brightness(0.9); }
.btn-secondary-sm:hover { filter: brightness(0.9); }
.btn-danger-sm:hover    { filter: brightness(0.9); }
.btn-success-sm:hover   { filter: brightness(0.9); }


/* ============================================================
   13. BADGES & STATUS-ANZEIGEN (generic_list.py)
   Verwendung: <span class="badge badge-success">Aktiv</span>
   .badge-toggle = anklickbar (Aktiv/Inaktiv umschalten via HTMX)
   ============================================================ */
.badge           { padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.75rem; color: white; display: inline-block; }

/* Dynamischer Zähler-Badge auf Aktions-Buttons (z.B. Vormerkungen(2)) */
.btn-badge {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    min-width:       18px;
    height:          18px;
    border-radius:   9px;
    font-size:       0.65rem;
    font-weight:     700;
    padding:         0 4px;
    margin-left:     4px;
    vertical-align:  middle;
    line-height:     1;
}
.btn-badge.badge-danger   { background: var(--badge-danger-bg,    #dc3545); color: var(--badge-danger-fg,    white); }
.btn-badge.badge-warning  { background: var(--badge-warning-bg,   #ffc107); color: var(--badge-warning-fg,   #212529); }
.btn-badge.badge-success  { background: var(--badge-success-bg,   #28a745); color: var(--badge-success-fg,   white); }
.btn-badge.badge-primary  { background: var(--badge-primary-bg,   #007bff); color: var(--badge-primary-fg,   white); }
.btn-badge.badge-secondary{ background: var(--badge-secondary-bg, #6c757d); color: var(--badge-secondary-fg, white); }
.badge-success   { background: var(--badge-success-bg,   #28a745); color: var(--badge-success-fg,   white); }
.badge-danger    { background: var(--badge-danger-bg,    #dc3545); color: var(--badge-danger-fg,    white); }
.badge-warning   { background: var(--badge-warning-bg,   #ffc107); color: var(--badge-warning-fg,   #212529); }
.badge-secondary { background: var(--badge-secondary-bg, #6c757d); color: var(--badge-secondary-fg, white); }
.badge-toggle    { cursor: pointer; }
/* Aktions-Badges fuer Aenderungsprotokoll (CREATE / UPDATE / DELETE) */
.badge-create    { background: var(--badge-success-bg,   #28a745); color: var(--badge-success-fg,   white); }
.badge-update    { background: var(--badge-primary-bg,   #007bff); color: var(--badge-primary-fg,   white); }
.badge-delete    { background: var(--badge-danger-bg,    #dc3545); color: var(--badge-danger-fg,    white); }
.badge-insert    { background: var(--badge-success-bg,   #28a745); color: var(--badge-success-fg,   white); }

/* === Diff-Ansicht (Aenderungsprotokoll Feldvergleich) ===
   .diff-row           = Basis-Zeile (unveraendert)
   .diff-row-changed   = Zeile mit Aenderung (gelb)
   .diff-row-json      = JSON-Feld mit Aenderung (blau)
   .diff-value         = Wert-Box (alt/neu)
   .diff-value-old     = Alter Wert (hellrot)
   .diff-value-new     = Neuer Wert (hellgruen)
*/
.diff-row          { background: var(--diff-row-bg, #f8f9fa); border: 2px solid var(--color-border); border-radius: 4px; padding: 0.75rem; }
.diff-row-changed  { background: var(--diff-changed-bg, #fff3cd); border: 2px solid var(--badge-warning-bg, #ffc107); border-radius: 4px; padding: 0.75rem; }
.diff-row-json     { background: var(--diff-json-bg, #e3f2fd); border: 2px solid var(--info-color, #2196f3); border-radius: 4px; padding: 0.75rem; }
.diff-field-name   { font-weight: 600; color: var(--text-color); margin-bottom: 0.5rem; font-size: 0.95rem; }
.diff-grid         { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.diff-label        { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.diff-value        { padding: 0.5rem; border-radius: 3px; border: 1px solid var(--color-border); word-break: break-word; background: var(--form-surface); }
.diff-value-old    { background: var(--diff-old-bg, #ffebee); }
.diff-value-new    { background: var(--diff-new-bg, #e8f5e9); }


/* ============================================================
   14. LINKS
   Verwendung: <a class="link-primary">Text</a>
   ============================================================ */
.link-primary       { color: var(--color-text-link); text-decoration: none; font-weight: 500; cursor: pointer; }
.link-primary:hover { color: var(--color-primary-dark); text-decoration: underline; }


/* ============================================================
   15. FORMULARE (generisch, generic_form.py)
   .form-input  = Standard-Input / Select / Textarea
   .form-label  = Label ueber dem Feld
   .form-field  = Wrapper-Div um Label + Input
   ============================================================ */
.form-input        { width: 100%; padding: 0.5rem; border: 1px solid var(--input-border); border-radius: 4px; font-size: clamp(0.75rem, var(--typo-form-input-size, 0.875rem), 1rem); background: var(--input-bg); color: var(--typo-form-input-color, var(--input-text)); font-family: var(--typo-form-input-family, var(--font-family)); font-weight: var(--typo-form-input-weight, 400); }
.form-input:hover  { border-color: var(--input-border-hover); }
.form-input:focus  { outline: none; border-color: var(--input-border-focus); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.form-input:disabled { background: var(--input-disabled); color: var(--color-text-muted); cursor: not-allowed; }
.form-input[readonly] { background: var(--color-surface-subtle); }
.form-label        { display: block; margin-bottom: 0.25rem; font-weight: var(--typo-form-label-weight, 500); color: var(--typo-form-label-color, var(--label-color)); font-size: clamp(0.75rem, var(--typo-form-label-size, 0.875rem), 1rem); font-family: var(--typo-form-label-family, var(--font-family)); }
.form-field        { margin-bottom: 0.4rem; }


/* ============================================================
   15a. TELEFON-FELDER (type=phone in generic_form.rs)
   .phone-field-row     = Flex-Wrapper: Vorwahl-Dropdown + Nummernfeld
   .phone-prefix-select = Vorwahl-Dropdown ("+41 CH", nur freigegebene Laender)
   .phone-number-input  = Eingabefeld fuer die nationale Nummer
   .phone-preview       = Live-Vorschau/Validierungshinweis darunter (bft-phone.js)
   .field-invalid       = Roter Rahmen bei clientseitig erkannter ungueltiger Eingabe
   ============================================================ */
.phone-field-row     { display: grid; grid-template-columns: 3.1cm minmax(16rem,22rem) 2.2rem minmax(12rem,1fr); gap: 0.5rem; align-items: center; max-width: 52rem; }
.phone-field-row .phone-prefix-select.form-input { width: 3.1cm !important; min-width: 0; }
.phone-field-row .phone-number-input  { width: 100%; min-width: 0; }
.phone-call-link      { display:flex;align-items:center;justify-content:center;width:2.2rem;height:2.2rem;border-radius:4px;background:var(--contact-phone-action-bg);color:var(--contact-phone-action-fg);text-decoration:none;font-size:1.05rem;flex-shrink:0; }
.phone-call-link:hover { background:var(--contact-phone-action-hover-bg); }
.phone-format-hint { grid-column:4; font-size:0.8rem;color:var(--color-text-muted);font-family:var(--font-mono);line-height:1.25; }
.email-field-row       { display:grid;grid-template-columns:minmax(0,1fr) 2.2rem;gap:0.5rem;align-items:center; }
.email-field-row .form-input { width:100%;min-width:0; }
.email-action-link     { display:flex;align-items:center;justify-content:center;width:2.2rem;height:2.2rem;border-radius:4px;background:var(--contact-email-action-bg);color:var(--contact-email-action-fg);text-decoration:none; }
.email-action-link:hover { background:var(--contact-email-action-hover-bg); }
.list-contact-value { vertical-align:middle; }
.list-contact-action { display:inline-flex;align-items:center;justify-content:center;width:1.75rem;height:1.75rem;margin-right:0.4rem;border-radius:4px;vertical-align:middle;text-decoration:none; }
.list-contact-action img { width:1rem;height:1rem;object-fit:contain; }
.list-phone-action { background:var(--contact-phone-action-bg); }
.list-phone-action:hover { background:var(--contact-phone-action-hover-bg); }
.list-email-action { background:var(--contact-email-action-bg); }
.list-email-action:hover { background:var(--contact-email-action-hover-bg); }
.phone-preview       { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 0.2rem; font-family: var(--font-mono); min-height: 1em; }
.field-invalid       { border-color: var(--input-invalid) !important; }


/* ============================================================
   15b. COLOR SELECT WIDGET (type=color_select in generic_form)
   Dropdown mit Farbswatch aus aktuellen CSS-Theme-Variablen
   ============================================================ */
.cs-wrapper      { position: relative; user-select: none; }
.cs-wrapper[data-disabled="true"] { opacity: 0.6; pointer-events: none; }
.cs-trigger      { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.6rem; cursor: pointer; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); font-size: 0.875rem; transition: border-color 0.15s; }
.cs-trigger:hover { border-color: var(--input-border-hover); }
.cs-swatch       { width: 18px; height: 18px; border-radius: 3px; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.15); }
.cs-cur-label    { flex: 1; font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-color); }
.cs-arrow        { color: var(--color-text-muted); font-size: 0.7rem; }
.cs-dropdown     { position: absolute; top: calc(100% + 2px); left: 0; right: 0; background: var(--form-surface); border: 1px solid var(--input-border); border-radius: 6px; box-shadow: var(--shadow-md); z-index: 600; max-height: 260px; overflow-y: auto; }
.cs-option       { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; cursor: pointer; transition: background 0.1s; }
.cs-option:hover { background: var(--color-surface-subtle); }
.cs-option.cs-selected { background: var(--list-row-active); }
.cs-opt-label    { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-color); }

/* ============================================================
   16. TABS
   Verwendung: <div class="tab-bar"><button class="tab-btn">Tab</button></div>
   Aktiver Tab: .tab-btn.active oder data-Attribut per JavaScript
   ============================================================ */
.tab-bar { border-bottom: 2px solid var(--color-border); margin-bottom: 1rem; display: flex; gap: 0.25rem; flex-wrap: wrap; }
.tab-btn { padding: 0.5rem 0.75rem; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; font-weight: 500; color: var(--text-secondary); transition: all 0.2s; font-size: var(--font-size-tab, 0.9rem); margin-bottom: -2px; }
.tab-btn.active,
.tab-btn[aria-selected="true"] { color: var(--color-primary-dark); border-bottom-color: var(--color-primary-dark); }


/* ============================================================
   17. INFO-GRID (Detail-Ansicht)
   Zweispaltige Label/Wert-Tabelle
   Verwendung: <div class="info-grid"><strong>Log-ID:</strong><span>123</span>...
   ============================================================ */
.info-grid { display: grid; grid-template-columns: 150px 1fr; gap: 0.5rem; font-size: 0.9rem; color: var(--color-text-muted); margin-bottom: 1.5rem; background: var(--color-surface-subtle); padding: 1rem; border-radius: 4px; }


/* ============================================================
   18. CODE-BLOCK
   Verwendung: <pre class="code-block">...</pre>
   ============================================================ */
.code-block { background: var(--color-surface-subtle); padding: 1rem; border-radius: 4px; overflow-x: auto; font-size: 0.85rem; font-family: var(--font-mono); white-space: pre-wrap; word-wrap: break-word; }


/* ============================================================
   19. FLASH-NACHRICHTEN (Toasts, utils.py showNotification)
   Erscheinen animiert oben rechts
   ============================================================ */
.flash-messages    { position: fixed; top: 80px; right: 20px; z-index: 1000; max-width: 400px; }
.flash             { padding: 1rem; margin-bottom: 0.5rem; border-radius: 0.375rem; box-shadow: var(--shadow-lg); display: flex; justify-content: space-between; align-items: center; animation: slideIn 0.3s ease-out; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.flash-success     { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success-color); }
.flash-error       { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--error-color); }
.flash-warning     { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning-color); }
.flash-info        { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--info-color); }
.flash-close       { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: inherit; opacity: 0.5; }
.flash-close:hover { opacity: 1; }


/* ============================================================
   20. DEBUG-INFO
   Sichtbarkeit server-seitig gesteuert (utils/debug.py).
   Python rendert diese Elemente NUR wenn
   system_einstellungen.debug-info = 'Ja'.
   -> Kein JavaScript-Toggle noetig!
   .debug-hint       = inline (z.B. Feldname in Label)
   .debug-hint-block = block  (z.B. Route oben links in Liste/Formular)
   ============================================================ */
.debug-hint       { color: var(--typo-debug-info-color, var(--debug-color)); font-family: var(--typo-debug-info-family, var(--font-mono)); font-size: clamp(0.65rem, var(--typo-debug-info-size, 0.75rem), 0.9rem); font-weight: var(--typo-debug-info-weight, 400); opacity: 0.9; margin-left: 0.5rem; display: inline; }
.debug-hint-block { color: var(--typo-debug-info-color, var(--debug-color)); font-family: var(--typo-debug-info-family, var(--font-mono)); font-size: clamp(0.65rem, var(--typo-debug-info-size, 0.75rem), 0.9rem); font-weight: var(--typo-debug-info-weight, 400); opacity: 0.9; margin-bottom: 0.25rem; display: block; }


/* ============================================================
   21. FEHLERSEITE (templates/error.html)
   ============================================================ */
.error-page          { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 200px); }
.error-container     { text-align: center; }
.error-container h1  { font-size: 6rem; color: var(--primary-color); margin-bottom: 1rem; }
.error-container h2  { font-size: 1.5rem; color: var(--text-color); margin-bottom: 1rem; }
.error-container p   { color: var(--text-secondary); margin-bottom: 2rem; }
.footer              { text-align: center; padding: 2rem; background: var(--surface-color); border-top: 1px solid var(--border-color); color: var(--text-secondary); font-size: 0.875rem; }


/* ============================================================
   23. FAHRTEN-FORMULAR GRID-LAYOUTS
   Desktop-Werte als CSS-Klassen – responsive Overrides in § 22.
   HTML-Struktur ist identisch auf Desktop und Smartphone:
   Nur CSS unterscheidet die Darstellung.
   ============================================================ */

/* Basisdaten: Datum | Wochentag | Uhrzeit | Status */
.bft-grid-basisdaten {
    display: grid;
    grid-template-columns: 1fr auto 1fr 1.2fr;
    gap: 0.5rem;
    align-items: end;
    margin-bottom: 1rem;
}

/* Wegpunkt-Hauptgrid: Links (Typ/Zeit/Personen) | Mitte (Adresse) | Rechts (Route) */
.bft-grid-wegpunkt {
    display: grid;
    grid-template-columns: 280px 1fr 180px;
    gap: 1rem;
}

/* Wegpunkt-Innengrid: Datum | Wochentag | Uhrzeit */
.bft-grid-wp-datetime {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.4rem;
    align-items: end;
}

/* Wegpunkt-Mittelspalte: Adresse + Ein/Aussteigen */
.bft-wp-middle-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Wegpunkt-Spalte rechts: Google Route-Info */
.bft-wegpunkt-col3 {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Adress-Innengrid: Land | PLZ | Ort */
.bft-grid-address-lpo {
    display: grid;
    grid-template-columns: 70px 90px 1fr;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

/* Metriken: Gefahrene KM | Auslagen */
.bft-grid-metriken {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}


/* ============================================================
   22. RESPONSIVE
   Desktop: > 480px — kein einziger Desktop-Style wird veraendert
   Mobile:  ≤ 480px — Galaxy Z Flip 7 Hauptscreen Portrait ~360-390px
   Cover:   ≤ 300px — Flip 7 Cover-Screen ~260px
   ============================================================ */

/* --- Mobile-only Elemente: auf Desktop IMMER versteckt ---
   !important verhindert Override durch spaetere CSS-Regeln
   oder Inline-Styles. Nur @media (max-width:480px) hebt das auf.
   ----------------------------------------------------------- */
.mobile-header-bar  { display: none !important; }
.mobile-menu-panel  { display: none !important; }
.bottom-nav         { display: none !important; }

/* --- Bottom Navigation Basis-Styles --- */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 56px; z-index: 600;
    background: var(--header-bg);
    border-top: 2px solid rgba(220,20,60,0.2);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.12);
    align-items: stretch;
}
.bottom-nav-btn {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px;
    background: none; border: none; cursor: pointer;
    font-size: 0.6rem; font-weight: 600; color: #555;
    border-right: 1px solid rgba(0,0,0,0.08);
    min-height: 48px; padding: 0.25rem;
    transition: background 0.15s;
}
.bottom-nav-btn:last-child  { border-right: none; }
.bottom-nav-btn:active       { background: rgba(0,0,0,0.08); }
.bottom-nav-btn-icon         { font-size: 1.25rem; line-height: 1; }

/* --- Mobile Menu Drawer --- */
.mobile-menu-panel {
    position: fixed;
    top: 48px; left: 0; right: 0; /* direkt unter mobile-header-bar */
    background: var(--user-info-bg);
    border-bottom: 2px solid var(--user-info-border);
    padding: 1rem;
    z-index: 9999;
    transform: translateY(-120%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1),
                visibility 0s linear 0.25s;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    /* Wenn geschlossen: unsichtbar + nicht klickbar */
    visibility: hidden;
    pointer-events: none;
}
.mobile-menu-panel.open {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1),
                visibility 0s linear 0s;
}
.mobile-menu-close {
    position: absolute; top: 0.5rem; right: 0.75rem;
    background: none; border: none;
    font-size: 1.4rem; cursor: pointer; color: #666;
    padding: 0.25rem;
}

/* ============================================================
   BREAKPOINT < 480px — Galaxy Z Flip 7 Hauptscreen
   ============================================================ */
@media (max-width: 480px) {

    /* --- Viewport Fix --- */
    html, body { height: 100svh; }

    /* --- Desktop-Header und Footer verstecken --- */
    .app-header { display: none !important; }
    .app-footer { display: none !important; }

    /* --- Mobile UI einblenden (ueberschreibt das desktop display:none !important) --- */
    .mobile-header-bar { display: flex !important; }
    .mobile-menu-panel { display: block !important; } /* transition aktiv */
    .bottom-nav        { display: flex !important; }

    /* --- Hauptinhalt: scrollbar + Platz fuer Bottom-Nav --- */
    #main-content {
        overflow-y: auto;
        overflow-x: hidden;
        padding-bottom: 60px;
        -webkit-overflow-scrolling: touch;
    }

    /* --- M050 Fahrtenmanagement / Tagesdisposition ---
       Desktop nutzt height:100% + internen flex:1-Scroll. Auf schmalen
       Screens fuellen Toolbar + Filter die Viewport-Hoehe, sodass der
       flex:1-Listenbereich auf 0px kollabiert und nicht scrollbar ist.
       -> Feste Hoehe entsperren; die Seite (#main-content) uebernimmt
          das Scrollen und die komplette Fahrten-Liste wird erreichbar. */
    .bft-m050-view   { height: auto !important; min-height: 0; }
    .bft-m050-scroll { flex: none !important; overflow-y: visible !important; overflow-x: auto !important; }

    /* --- Dashboard: 2-Spalten-Grid statt Flex-Rows --- */
    .dashboard-scroll { padding: 0.6rem; }
    .dashboard-container { gap: 0.5rem; }
    .dashboard-row {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        flex: unset !important;
        margin-bottom: 0 !important;
    }
    .dashboard-kachel {
        width: 100% !important;
        height: auto !important;
        min-height: 90px !important;
        padding: 0.6rem !important;
        flex-direction: column !important;
        text-align: center !important;
    }
    .dashboard-kachel-empty { width: 100% !important; height: 90px !important; }
    .kachel-icon        { font-size: 1.6rem !important; }
    .kachel-title       { font-size: 0.72rem !important; }
    .kachel-description { font-size: 0.62rem !important; }
    .kachel-modul-id    { font-size: 0.55rem !important; }

    /* --- Login-Seite --- */
    .login-page      { padding: 0; align-items: flex-start; }
    .login-container { padding: 1rem; max-width: 100%; }
    .login-box       { padding: 1.25rem; border-radius: 8px; }
    .login-header h1 { font-size: 1.3rem; }

    /* --- Datentabellen: Kompaktere Schrift + Abstände --- */
    .data-table             { font-size: 0.75rem; }
    .data-table th,
    .data-table td          { padding: 0.35rem 0.4rem; }

    /* Sub-Row Mobile: 3-Spalten-Grid statt Desktop-Flex */
    .action-subrow td {
        padding: 0.5rem 0.4rem;
        background: #eef4ff;
        border-bottom: 2px solid #c7d9f5;
    }
    .action-subrow .td-actions-inner {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px;
        width: calc(100vw - 1.6rem);
        max-width: calc(100vw - 1.6rem);
    }
    /* btn-bft in Sub-Row Mobile: kompaktere Grösse */
    .action-subrow .td-actions-inner .btn-bft {
        width: 100% !important;
        justify-content: center !important;
        height: 34px !important;
        font-size: 0.72rem !important;
        padding: 0 8px !important;
        gap: 5px !important;
    }
    /* Auch ausserhalb Sub-Row verkleinern (z.B. M059, M061 Tabellenzeilen) */
    .btn-bft {
        height: 36px;
        font-size: 0.78rem;
        padding: 0 10px;
        gap: 6px;
    }
    .btn-icon {
        width: 16px;
        height: 16px;
    }
    /* Legacy btn-action (für Module die noch nicht umgestellt) */
    .btn-action {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 0 0.75rem !important;
        font-size: 0.85rem !important;
        min-height: 44px;
        min-width: 0;
        width: 100%;
        border-radius: 7px !important;
        margin: 0 !important;
        box-sizing: border-box;
    }
    .btn-action-label { font-size: 0.85rem; font-weight: 500; }

    /* --- Modale Formulare: Vollbild (Stufe 2) --- */
    .modal-overlay,
    .modal-overlay-top {
        align-items: flex-start !important;
        padding: 0 !important;
    }
    .modal-container,
    .modal-container-wide {
        width:  100vw !important;
        max-width: 100vw !important;
        height: calc(100svh - 48px) !important;
        max-height: none !important;
        border-radius: 0 !important;
        padding: 0.75rem !important;
        margin: 0 !important;
        overflow-y: auto !important;
    }

    /* --- Flash-Nachrichten nach unten (über Bottom-Nav) --- */
    .flash-messages {
        top: auto; bottom: 64px;
        left: 8px; right: 8px;
        max-width: none;
    }

    /* --- Tabs: horizontal scrollbar --- */
    .tab-bar { overflow-x: auto; flex-wrap: nowrap; }
    .tab-btn { white-space: nowrap; font-size: 0.78rem; padding: 0.35rem 0.55rem; }

    /* --- Buttons in Tabellen: Touch-freundlich --- */
    .btn-sm, .btn-sm-md { padding: 0.35rem 0.6rem; font-size: 0.75rem; }

    /* --- Fahrten-Formular: Responsive Grids (§ 23) --- */
    /* Modal: Vollbild, kein Rand */
    .bft-form-modal-inner {
        padding: 0.75rem !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        max-height: calc(100svh - 48px) !important;
    }
    /* Basisdaten: 2-spaltig (Datum | Uhrzeit), Wochentag versteckt */
    .bft-grid-basisdaten    { grid-template-columns: 1fr 1fr; }
    #weekday-display,
    [id^="wp-weekday-"]     { display: none; }
    .bft-status-field       { grid-column: 1 / -1; }  /* Status volle Breite */
    /* Wegpunkt: alle Spalten untereinander */
    .bft-grid-wegpunkt      { grid-template-columns: 1fr; }
    /* Alle Panels gleich breit: max-width:75% der Mittelspalten-Kinder aufheben */
    .bft-wp-middle-col > * { max-width: 100% !important; width: 100% !important; }
    /* Land kürzer, PLZ kürzer → mehr Platz für Ort */
    .bft-grid-address-lpo   { grid-template-columns: 45px 70px 1fr; }
    .bft-grid-wp-datetime   { grid-template-columns: 1fr 1fr; }
    /* Metriken: einspaltig */
    .bft-grid-metriken      { grid-template-columns: 1fr; }
}

/* Shared module controls: one live DOM instance, progressive enhancement. */
:root {
    --header-control-bg: #dbeafe;
    --header-control-text: #1e3a8a;
    --header-control-border: #93b4dc;
    --header-control-active-bg: #1e3c72;
    --header-control-active-text: #ffffff;
    --header-control-panel-bg: #f1f5fb;
    --header-control-panel-text: #1e293b;
    --header-control-close-bg: #475569;
    --header-control-close-text: #ffffff;
}

.bft-module-header { padding: .5rem 1rem; flex: none; min-width: 0; }
.bft-module-header .debug-hint-block { white-space: normal; overflow-wrap: anywhere; }
.bft-compact-view, .bft-compact-scroll, .bft-compact-scroll > div { min-width: 0; }
.bft-header-context { margin: .4rem 0; color: #475569; overflow-wrap: anywhere; }
.bft-header-primary { margin: .5rem 0; }
.bft-planner-layout, .bft-planner-layout > div, .bft-planner-basis > div { min-width: 0; }
.bft-planner-layout input, .bft-planner-layout select, .bft-planner-layout textarea { min-width: 0; max-width: 100%; }
.bft-planner-layout .msg-info { overflow-wrap: anywhere; }
@media (max-width: 768px) {
    .bft-planner-layout { grid-template-columns: minmax(0, 1fr) !important; }
    .bft-planner-basis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .bft-planner-basis > div:last-child { grid-column: 1 / -1; }
}
.bft-m050-view .bft-header-primary { align-items: flex-start; }
.bft-m050-view .bft-header-primary > .btn-bft,
.bft-m050-view .bft-header-primary > details > summary {
    height: 36px; box-sizing: border-box;
}
.bft-header-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; }
.bft-header-group { min-width: 0; max-width: 100%; }
.bft-header-panel { min-width: 0; }
.bft-header-panel[hidden] { display: none !important; }
.bft-header-items { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; min-width: 0; }
.bft-header-toggle, .bft-header-close { display: none; }
.bft-header-help { flex-basis: 100%; min-width: 0; overflow-wrap: anywhere; }
.bft-header-help > div { margin: .25rem 0 !important; padding: 0 !important; }
.bft-header-controls :focus-visible { outline: 3px solid var(--color-focus-ring, #2563eb); outline-offset: 2px; }
@media (max-width: 768px) {
    .bft-compact-view { height: auto !important; min-height: 0; }
    .bft-compact-scroll { flex: none !important; overflow-y: visible !important; overflow-x: auto !important; }
    .bft-module-header h2 { font-size: 1.15rem !important; }
    .bft-module-header > button { min-height: 44px; white-space: normal; max-width: 100%; }
    .bft-module-header h2 span { min-width: 0; overflow-wrap: anywhere; }
    .bft-header-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; align-items: stretch; }
    .bft-header-group { display: contents; }
    .bft-header-panel { grid-column: 1 / -1; order: 10; padding: .65rem; border: 1px solid var(--header-control-border); border-radius: 8px; background: var(--header-control-panel-bg); color: var(--header-control-panel-text); }
    .bft-header-controls.is-ready .bft-header-toggle {
        display: flex; justify-content: space-between; align-items: center; gap: .3rem;
        min-height: 44px; min-width: 0; padding: .5rem .4rem; border: 1px solid var(--header-control-border);
        border-radius: 6px; background: var(--header-control-bg); color: var(--header-control-text); font: inherit; font-size: .85rem; font-weight: 600; line-height: 1.25;
        text-align: left; cursor: pointer; overflow-wrap: anywhere;
    }
    .bft-header-controls.is-ready .bft-header-toggle:is(:hover, [aria-expanded="true"]) { background: var(--header-control-active-bg); color: var(--header-control-active-text); }
    .bft-header-controls.is-ready .bft-header-close { display: block; min-height: 44px; margin-top: .5rem; padding: .5rem 1rem; border: 0; border-radius: 6px; background: var(--header-control-close-bg); color: var(--header-control-close-text); font: inherit; cursor: pointer; }
    .bft-header-panel .bft-header-items { align-items: stretch; }
    .bft-header-panel button, .bft-header-primary button {
        min-height: 44px !important; height: auto !important; white-space: normal !important;
        max-width: 100%; overflow-wrap: anywhere; line-height: 1.3; padding: .5rem .65rem !important;
    }
    .bft-header-panel form { width: 100%; min-width: 0; padding: 0 !important; }
    .bft-header-panel form > input:not([type="hidden"]), .bft-header-panel form > select {
        width: 100% !important; max-width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box;
    }
    .bft-header-panel select { min-width: 0; max-width: 100%; min-height: 44px; }
    .bft-header-primary button { width: 100%; justify-content: center; }
    .bft-m050-view .bft-header-primary > .btn-bft,
    .bft-m050-view .bft-header-primary > details > summary {
        height: 44px !important; width: auto; white-space: nowrap !important;
    }
    .bft-header-panel .bft-header-help { width: 100%; }
}

@media (min-width: 480px) and (max-width: 768px) {
    .bft-header-controls { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 319px) {
    .bft-header-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
   BREAKPOINT 481px–1280px — Tablet / kleiner Desktop
   Buttons wrappen erst nach 6 Stück (statt 3)
   ============================================================ */
@media (min-width: 481px) and (max-width: 1280px) {
    .td-actions-inner {
        grid-template-columns: repeat(6, auto);
    }
    .action-subrow .td-actions-inner {
        grid-template-columns: repeat(6, auto);
        max-width: none;
    }
    .action-subrow .td-actions-inner .btn-bft {
        width: auto;
    }
}

/* ============================================================
   BREAKPOINT < 300px — Galaxy Z Flip 7 Cover-Screen (~260px)
   ============================================================ */
@media (max-width: 300px) {
    /* 1-Spalte auf dem winzigen Cover-Screen */
    .dashboard-row {
        grid-template-columns: 1fr !important;
    }
    .dashboard-kachel { min-height: 72px !important; }
    .kachel-icon      { font-size: 1.3rem !important; }
}

/* ============================================================
   Hilfesystem — Info-Icon + Popup (help-popup.js)
   ============================================================ */
.help-icon {
    display: inline-block;
    color: #1e3c72;
    cursor: help;
    font-size: 0.95em;
    line-height: 1;
    vertical-align: baseline;
    opacity: 0.7;
    user-select: none;
}
.help-icon:hover,
.help-icon:focus { opacity: 1; outline: none; }

.help-popup {
    position: fixed;
    z-index: 3000;
    max-width: 320px;
    background: #e0f7fa;            /* eigene Tooltip-Farbe: helles Cyan */
    border: 1px solid #4dd0e1;
    border-left: 4px solid #0097a7;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
    padding: 0.7rem 0.85rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #0b3a4a;
}
.help-popup-title {
    font-weight: 700;
    color: #00697a;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}
.help-popup-body { white-space: pre-line; }
.help-popup-actions { margin-top: 0.6rem; text-align: right; }
.help-popup-more {
    background: #0097a7;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.help-popup-more:hover { background: #00838f; }

@media (max-width: 600px) {
    .help-popup { max-width: 88vw; }
}

/* Tooltips global deaktiviert (System-Einstellung tooltips=Nein) */
.bft-tooltips-off .help-icon { display: none; }

/* M092 local editor and sibling ordering */
.handbuch-editor-bereich{min-width:0;margin:1.25rem 0;padding:1rem;border:1px solid #cbd5e1;border-radius:8px;background:#fff}
.handbuch-editor-bereich>legend{padding:0 .5rem;font-size:1.1rem;font-weight:700;color:#1e3c72}
.handbuch-editor-bereich>form+form{margin-top:1.25rem;padding-top:1rem;border-top:1px solid #e5e9f0}
.handbuch-editor-aktionen{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;margin:.75rem 0}
.handbuch-pruefung-zeile{display:grid;grid-template-columns:minmax(0,1fr) 12rem;gap:1rem;align-items:start}
@media(max-width:600px){.handbuch-pruefung-zeile{grid-template-columns:minmax(0,1fr)}}
.handbuch-editor-bestaetigung{display:flex;align-items:flex-start;gap:.5rem;flex:1 1 20rem;min-width:0}
.handbuch-editor-bestaetigung>input{flex:none;margin-top:.3rem}
.handbuch-editor-version{padding:1rem;background:#f5f8fc;border-radius:8px;margin-top:1rem}
#edit-modal .modal-container:has([data-handbuch-freigabe])>ul{list-style:none;padding:0;margin:1rem 0;display:grid;gap:.75rem}
#edit-modal .modal-container:has([data-handbuch-freigabe])>ul>li{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:.75rem;border:1px solid #cbd5e1;border-radius:6px;background:#f5f8fc}
@media(max-width:700px){#edit-modal .modal-container:has([data-handbuch-freigabe])>ul>li{grid-template-columns:1fr}}
.handbuch-pdf-status{position:fixed;right:1rem;bottom:4.5rem;z-index:3500;max-width:min(90vw,520px);padding:1rem;display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;border:2px solid #1e3c72;border-radius:8px;background:#fff;color:#1e3c72;box-shadow:0 4px 18px #0003}
.handbuch-pdf-fehler{border-color:#dc3545;color:#842029}
.handbuch-pdf-spinner{width:24px;height:24px;border:3px solid #ccd5e2;border-top-color:#1e3c72;border-radius:50%;animation:handbuch-pdf-spin 1s linear infinite}
.handbuch-pdf-status [hidden]{display:none!important}
a[aria-busy=true]{cursor:wait;opacity:.7}
@keyframes handbuch-pdf-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.handbuch-pdf-spinner{animation:none}}
#handbuch-sortierung{padding:.5rem 1rem}
.handbuch-sort-liste,.handbuch-sort-liste ul{list-style:none;padding:0;margin:.75rem 0}
.handbuch-sort-liste ul{margin-left:1.5rem}
.handbuch-sort-liste ul:empty{display:none}
.handbuch-sort-liste [hidden]{display:none!important}
.handbuch-sort-liste [data-chapter-toggle]{min-height:44px;cursor:pointer}
.handbuch-sort-liste li{margin:.6rem 0}
.handbuch-sort-zeile{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;padding:1rem;border:2px solid #cbd5e1;border-radius:8px;background:#fff;box-shadow:0 2px 5px #0001;cursor:grab;user-select:none}
.handbuch-sort-zeile:focus-visible{outline:3px solid #007bff;outline-offset:2px}
.handbuch-sort-zeile [data-griff]{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;touch-action:none;font-size:1.8rem;color:#1e3c72}
.handbuch-sort-zeile [data-sort-nummer]{padding:.4rem .65rem;background:#1e3c72;color:#fff;border-radius:6px}
.handbuch-sort-zeile [data-sort-titel]{flex:1;min-width:8rem;font-weight:600}
.handbuch-sort-zeile>.badge,.handbuch-sort-zeile>[data-chapter-toggle]{display:inline-flex;align-items:center;justify-content:center;gap:.35rem;box-sizing:border-box;flex:0 0 8rem;width:8rem;height:44px;margin:0;padding:.4rem .5rem;border:1px solid transparent;border-radius:4px;font-family:inherit;font-size:.85rem;font-weight:500;line-height:1.2;white-space:nowrap}
.handbuch-sort-zeile small{color:#596579}
.handbuch-sort-aktiv{background:#eef6ff;border-color:#007bff;cursor:grabbing}
.handbuch-sort-vor>.handbuch-sort-zeile{border-top:4px solid #007bff}
.handbuch-sort-nach>.handbuch-sort-zeile{border-bottom:4px solid #007bff}
.handbuch-sort-zeile[aria-disabled=true]{cursor:wait;opacity:.7}
body:has(#handbuch-sortierung .handbuch-sort-aktiv) .help-popup{display:none!important;pointer-events:none}
.handbuch-sort-werkzeuge{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin:.75rem 0}
.handbuch-kapitel-info{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap;padding:.75rem 1rem;background:#fff;border:2px solid #cbd5e1;border-top:0;border-radius:0 0 8px 8px}
.handbuch-sort-liste .handbuch-sort-zeile{border-radius:8px 8px 0 0}
.handbuch-kapitel-meta{display:flex;gap:.5rem 1rem;flex-wrap:wrap;min-width:0;color:#596579}
.handbuch-kapitel-meta small{flex-basis:100%;overflow-wrap:anywhere}
.handbuch-kapitel-aktionen{display:flex;gap:.5rem;flex-wrap:wrap}
@media (min-width:1100px){
    .handbuch-sort-liste li[data-kapitel]{display:grid;grid-template-columns:minmax(0,1fr);align-items:stretch;border:2px solid #cbd5e1;border-radius:8px;background:#fff}
    .handbuch-sort-liste li[data-kapitel]>.handbuch-sort-zeile{border:0;border-radius:8px;box-shadow:none;min-width:0}
    .handbuch-sort-liste li[data-kapitel]>.handbuch-kapitel-info{display:grid;grid-template-columns:minmax(0,1fr) auto;border:0;border-radius:8px;min-width:0}
    .handbuch-sort-liste li[data-kapitel]>ul{grid-column:1/-1}
    .handbuch-sort-liste li.handbuch-sort-vor{box-shadow:0 -3px 0 #007bff}
    .handbuch-sort-liste li.handbuch-sort-nach{box-shadow:0 3px 0 #007bff}
}

[data-rich-toolbar]{display:flex;gap:.25rem;flex-wrap:wrap;position:sticky;top:0;background:var(--list-bg,#fff);z-index:1;padding:.5rem}[data-rich-toolbar] button{min-height:36px}[data-rich-surface] .tiptap{min-height:300px;padding:1rem;border:1px solid #aaa;outline:0}[data-rich-surface] table{border-collapse:collapse;width:100%}[data-rich-surface] td,[data-rich-surface] th{border:1px solid #888;padding:.4rem}[data-rich-surface] .selectedCell{background:#cce5ff}.handbuch-note{border-left:4px solid #007bff;background:#eef6ff;padding:.7rem}.handbuch-note[data-note=warning],.handbuch-note[data-note=draft]{border-color:#d69200;background:#fff5d6}kbd,.ui{border:1px solid #aaa;border-radius:3px;padding:0 .2em}
/* M093: responsive controlled video and explicit GIF playback. */
.handbuch-medium video { display: block; width: 100%; max-width: 100%; height: auto; }
.handbuch-medium [hidden] { display: none; }
.handbuch-medium > button { margin-top: 0.4rem; }
.handbuch-image { max-width: 100%; margin: 1em 0; }
.handbuch-image img, .handbuch-image video { display: block; width: 100%; max-width: 100%; height: auto; }
.handbuch-image figcaption { overflow-wrap: anywhere; }
.handbuch-image-w25 { width: 25%; }
.handbuch-image-w50 { width: 50%; }
.handbuch-image-w75 { width: 75%; }
.handbuch-image-w100 { width: 100%; }
.handbuch-image-center { margin-left: auto; margin-right: auto; }
.handbuch-image-right { margin-left: auto; }
.handbuch-image-left { margin-right: auto; }
.modal-container video, article video { display: block; max-width: 100%; height: auto; }
.modal-container:has([data-medien-close]) img { max-width: 100%; height: auto; }
