/* === RESET & BASE === */
/* Inter selbst gehostet (Variable Font, latin-Subset inkl. Umlaute + €) —
   kein Google-Fonts-Request mehr: schneller, offline-faehig, DSGVO-sauber.
   Die Datei deckt als Variable Font alle Gewichte 400–700 ab. */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/assets/fonts/inter-latin.woff2') format('woff2');
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
input, textarea, select, button { font-family: inherit; font-size: inherit; color: inherit; }
input, textarea, select { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 0.5rem 0.75rem; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); }
/* Suchfelder bleiben beim Fokus dezent — kein Akzent-Ring */
input[type="search"]:focus { border-color: var(--color-border); box-shadow: none; }

/* Strukturelle Tokens — Farben/Schatten definiert ausschliesslich themes.css
   (frueher lag hier ein kompletter Dark-Satz, der nur wegen der Bundle-
   Reihenfolge base→themes unsichtbar blieb) */
:root {
    --radius: 10px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--color-primary); }
h1 { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; font-weight: 600; }
/* === THEME DEFINITIONEN === */
/* 2 Modi: Light (Default) + Dark */
/* Aktives Theme: data-theme Attribut auf <html> ("light" | "dark") */

/* --- LIGHT (Default) --- */
[data-theme="light"], :root {
    --color-primary: #7c3aed;
    --color-primary-dark: #6d28d9;
    --color-primary-light: #ede9fe;
    --color-bg: #fafaf9;
    --color-surface: #ffffff;
    --color-surface-hover: #f5f3ff;
    --color-text: #1c1917;
    --color-text-muted: #78716c;
    --color-text-light: #a8a29e;
    --color-border: #e7e5e4;
    --color-border-light: #f5f5f4;
    --color-success: #059669;
    --color-success-light: #ecfdf5;
    --color-error: #dc2626;
    --color-error-light: #fef2f2;
    --color-warning: #d97706;
    --color-warning-light: #fffbeb;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.06), 0 4px 6px rgba(0,0,0,0.03);
    --login-gradient: linear-gradient(135deg, #faf5ff 0%, #fafaf9 50%, #f5f3ff 100%);
    --color-favorite: #fbbf24;
}

/* --- DARK --- */
[data-theme="dark"] {
    --color-primary: #8b5cf6;
    --color-primary-dark: #7c3aed;
    --color-primary-light: rgba(139, 92, 246, 0.1);
    --color-bg: #09090b;
    --color-surface: #18181b;
    --color-surface-hover: #27272a;
    --color-text: #fafafa;
    --color-text-muted: #a1a1aa;
    --color-text-light: #71717a;
    --color-border: #27272a;
    --color-border-light: #1e1e22;
    --color-success: #34d399;
    --color-success-light: rgba(52, 211, 153, 0.12);
    --color-error: #f87171;
    --color-error-light: rgba(248, 113, 113, 0.12);
    --color-warning: #fbbf24;
    --color-warning-light: rgba(251, 191, 36, 0.12);
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.5), 0 4px 10px rgba(0,0,0,0.3);
    --login-gradient: linear-gradient(135deg, #09090b 0%, #0f0a1f 50%, #09090b 100%);
    --color-favorite: #fbbf24;
}

/* Light-Theme Alert-Borders: kraeftigere Border, weil die *-light-Hintergruende
   im Light-Mode fast weiss sind */
[data-theme="light"] .alert--success { border-color: #a7f3d0; }
[data-theme="light"] .alert--error { border-color: #fecaca; }
[data-theme="light"] .alert--warning { border-color: #fde68a; }

/* Dark/Light-Switch (Einstellungen → Erscheinungsbild) */
.theme-switch { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: calc(var(--radius) - 3px); }
.theme-switch-opt { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: calc(var(--radius) - 3px); font-size: 13px; font-weight: 600; color: var(--color-text-muted); text-decoration: none; transition: all 0.15s; }
.theme-switch-opt:hover { color: var(--color-primary); }
.theme-switch-opt--active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow); }
.theme-switch-opt--active:hover { color: var(--color-text); }
/* === Icon System (SVG inline, Linear-Style) === */
/* Monochrome, 1px stroke, currentColor */

.icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    flex-shrink: 0;
}
.icon--sm { width: 14px; height: 14px; }
.icon--lg { width: 20px; height: 20px; }

/* Icons als background-image SVG (currentColor via filter) */
.icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
/* === Navigation === */
.nav {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    height: 60px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: nowrap;
    max-width: 100vw;
    overflow: visible;
    box-sizing: border-box;
}

.nav-brand a {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--color-primary);
    text-decoration: none;
    margin-right: 2.5rem;
    letter-spacing: -0.02em;
}

.nav-links { display: flex; gap: 0.25rem; align-items: center; flex: 1; min-width: 0; position: relative; }
.nav-link-group { display: flex; gap: 0.25rem; align-items: center; flex-wrap: nowrap; min-width: 0; overflow: hidden; }
.nav-burger { display: none; background: none; border: none; color: var(--color-text-muted); cursor: pointer; padding: 0.4rem; border-radius: var(--radius); align-items: center; justify-content: center; }
.nav-burger:hover { background: var(--color-bg); color: var(--color-text); }
.nav-burger-menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 200px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 0.4rem; z-index: 200; display: flex; flex-direction: column; gap: 0.15rem; }
.nav-burger-menu[hidden] { display: none; }
.nav-burger-item { color: var(--color-text-muted); text-decoration: none; padding: 0.5rem 0.75rem; border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; }
.nav-burger-item:hover { background: var(--color-bg); color: var(--color-text); }
.nav-burger-item--active { background: var(--color-primary-light); color: var(--color-primary); }
.nav.nav--collapsed .nav-link-group { display: none; }
.nav.nav--collapsed .nav-burger { display: inline-flex; }

.nav-link {
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-link:hover { background: var(--color-bg); color: var(--color-text); }
.nav-link--active { background: var(--color-primary-light); color: var(--color-primary); }
.nav-link--right { margin-left: auto; }
.nav-profile { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; text-decoration: none; padding: 0.25rem 0.75rem; border-radius: var(--radius); transition: background 0.15s; }
.nav-profile:hover { background: var(--color-surface-hover); }
.nav-profile--active { background: var(--color-surface-hover); }
.nav-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.nav-avatar-img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.nav-profile-info { display: flex; flex-direction: column; line-height: 1.2; }
.nav-profile-name { color: var(--color-text); font-size: 0.8rem; font-weight: 600; }
.nav-profile-role { color: var(--color-text-muted); font-size: 0.65rem; }
.nav-link--logout { margin-left: auto; color: var(--color-text-muted); }
.nav-link--logout:hover { color: var(--color-error); background: var(--color-error-light); }

/* === Main Content === */
.main {
    padding: 0;
    width: 100%;
}

/* Container-Varianten: tragen das Padding, damit .main padding-frei bleibt.
 * So koennen Module mit eigener Sidebar edge-to-edge im .main sitzen,
 * waehrend normaler Content bequem Abstand hat. */
.container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 2rem; }
.container--narrow { width: 100%; max-width: 640px; margin: 0 auto; padding: 2rem; }
.container--wide { width: 100%; max-width: none; margin: 0; padding: 2rem; }

/* ============================================================
 * Sidebar-Layout (body[data-layout="sidebar"])
 * Haupt-Navi wandert in eine fixe linke Spalte, Modul-Submenues
 * werden zu ausklappbaren Unterelementen.
 *
 * Breiten-Management via CSS-Variable --sidebar-width. Beim Collapse
 * wird nur die Variable geaendert, alles andere (Sidebar, Content,
 * Transitions) folgt automatisch.
 * ============================================================ */

body[data-layout="sidebar"] {
    --sidebar-width: 240px;
    --sidebar-gap: 0.5rem;
}

/* Collapsed-Mode: Sidebar schrumpft zur schmalen Icon-Rail (66px), sie bleibt
 * sichtbar. Nur die Variable aendert sich — .main und .app-sidebar folgen.
 * Wieder-Aufklappen ueber die Brand-Marke (app.js). */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] {
    --sidebar-width: 66px;
    --sidebar-gap: 0px;
}

body[data-layout="sidebar"] .nav { display: none; }

/* Gap wird ueber margin-left erzeugt, NICHT ueber padding-left.
 * Dadurch bleibt .main's Padding einheitlich bei 2rem und alle Views
 * die sich mit 'margin: -2rem' in .main rausziehen funktionieren konsistent. */
body[data-layout="sidebar"] .main {
    margin-left: calc(var(--sidebar-width) + var(--sidebar-gap));
    width: calc(100% - var(--sidebar-width) - var(--sidebar-gap));
    padding: 0;
    min-height: 100vh;
    transition: margin-left 0.2s ease, width 0.2s ease;
}

.app-sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width, 240px); /* folgt der Collapse-Variable: 240px <-> 66px */
    height: 100vh;
    /* --sidebar-* setzt das CI-Theming (partials/ci-style.php); ohne CI gilt das Theme. */
    background: var(--sidebar-bg, var(--color-surface));
    border-right: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    padding: 20px 12px;
    z-index: 100;
    flex-direction: column;
    gap: 4px;
    transition: width 0.2s ease, padding 0.2s ease;
}

body[data-layout="sidebar"] .app-sidebar {
    display: flex;
}

/* Collapsed: schmale Icon-Rail (Prototyp-Spec) — Labels/Name/Claim/Meta aus,
 * Icons zentriert. Die Sidebar bleibt sichtbar, verschwindet NICHT. */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar {
    padding: 20px 10px;
    overflow: visible;
}
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-brand {
    justify-content: center;
    padding: 4px 0 18px;
}
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-brand-name,
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-group-label { display: none; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-link {
    justify-content: center;
    padding: 9px 0;
    gap: 0;
    position: relative;
}
/* Eingeklappt: die Nav darf nicht clippen, sonst wird der Icon-Tooltip abgeschnitten. */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-nav { overflow: visible; }
/* Label wird zum Tooltip: weisse Schrift auf schwarzem, abgerundetem "Button" rechts neben dem Icon. */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-link-label {
    display: block;
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    flex: none;
    padding: 6px 11px;
    background: #1a1a22;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease;
    z-index: 300;
}
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-link:hover .app-sidebar-link-label {
    opacity: 1;
    visibility: visible;
}
/* Eingeklappt: Chevron der Submenue-Parents entfaellt (kein Platz in der Rail). */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-link-chevron { display: none; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-user {
    justify-content: center;
    margin: 6px -10px 0;
    padding: 12px 0 2px;
    gap: 0;
}
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-user-meta { display: none; }

/* Brand nach Prototyp-Spec: Mark + Name/Claim + Collapse-Pfeil, keine Trennlinie. */
.app-sidebar-brand {
    padding: 4px 10px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.app-sidebar-brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent-gradient, var(--color-primary));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 15px;
    flex: 0 0 auto;
    text-decoration: none;
}
.app-sidebar-brand-letter { display: grid; place-items: center; }
/* Hochgeladenes Logo (CI-Feld ci_logo) fuellt die Marke statt des Buchstabens. */
.app-sidebar-brand-logo { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; display: block; }
.app-sidebar-brand-expand { display: none; place-items: center; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-brand-mark:hover .app-sidebar-brand-logo { display: none; }
/* Eingeklappt: Hover ueber die Marke tauscht Logo/Buchstabe gegen das Aufklapp-Icon
 * (Klick klappt auf, siehe app.js). Ausgeklappt ist die Marke der Dashboard-Link. */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-brand-mark { cursor: pointer; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-brand-mark:hover .app-sidebar-brand-letter { display: none; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-brand-mark:hover .app-sidebar-brand-expand { display: grid; }
.app-sidebar-brand-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--sidebar-ink-strong, var(--color-text));
    text-decoration: none;
    letter-spacing: -0.01em;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Claim unter dem App-Namen (CI-Feld ci_claim, z.B. "CRM & Projekte") */
.app-sidebar-brand-claim {
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--sidebar-ink, var(--color-text-muted));
    opacity: 0.75;
    margin-top: -2px;
}

/* ---- Bereichs-Switcher (docs/frontend.md "Bereiche") ----------------------
 * 2 Bereiche: Segmented-Pill ueber dem Dashboard-Link. 3+: Combobox-Button
 * mit Popover. Eingeklappte Rail zeigt nur die Initialen (Regeln unten). */
.app-sidebar-areas {
    margin: 0 0 14px;
    flex-shrink: 0;
    position: relative;
}
.app-sidebar-areas--pill {
    display: flex;
    padding: 3px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: calc(var(--radius) - 3px);
    gap: 2px;
}
/* Textfarben theme-basiert (nicht --sidebar-ink): der Pill-Hintergrund ist
 * --color-bg, nicht die CI-Sidebar-Farbe — sidebar-ink waere darauf unlesbar. */
.app-sidebar-area-seg {
    flex: 1;
    text-align: center;
    padding: 5px 8px;
    border-radius: calc(var(--radius) - 3px);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar-area-seg:hover { color: var(--color-primary); }
.app-sidebar-area-seg--active {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow);
}
.app-sidebar-area-seg--active:hover { color: var(--color-text); }
.app-sidebar-area-seg-initial { display: none; }

/* Combobox (3+ Bereiche): Button mit aktuellem Label + Chevron, Popover-Liste. */
.app-sidebar-area-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: calc(var(--radius) - 3px);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
}
.app-sidebar-area-btn:hover { border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border)); }
.app-sidebar-area-btn-label {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-sidebar-area-btn-initial { display: none; }
.app-sidebar-area-chevron { flex: 0 0 auto; opacity: 0.6; }
.app-sidebar-area-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: calc(var(--radius) - 2px);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    z-index: 300;
}
.app-sidebar-area-item {
    display: block;
    padding: 7px 10px;
    border-radius: calc(var(--radius) - 4px);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
}
.app-sidebar-area-item:hover { background: color-mix(in srgb, var(--color-text-muted) 9%, transparent); }
.app-sidebar-area-item--active { color: var(--color-primary); font-weight: 600; }

/* Eingeklappte Icon-Rail: Pill wird zur Initial-Spalte, Combobox zum Initial-Button. */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-areas--pill {
    flex-direction: column;
    border-radius: calc(var(--radius) - 3px);
    padding: 3px;
}
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-area-seg {
    padding: 6px 0;
    border-radius: calc(var(--radius) - 3px);
}
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-area-seg-label { display: none; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-area-seg-initial { display: inline; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-area-btn {
    justify-content: center;
    padding: 7px 0;
    gap: 0;
}
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-area-btn-label,
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-area-chevron { display: none; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-area-btn-initial { display: inline; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-area-menu {
    left: calc(100% + 8px);
    right: auto;
    top: 0;
    min-width: 180px;
}

.app-sidebar-nav {
    flex: 1;
    min-height: 0;
}

.app-sidebar-module {
    display: block;
}

/* Gruppen-Ueberschrift in der Nav (manifest.nav_group + config app.nav_groups) */
.app-sidebar-group-label {
    padding: 1rem 1.25rem 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-ink, var(--color-text-light));
    opacity: 0.75;
}
.app-sidebar-group-label:first-child { padding-top: 0.35rem; }

.app-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1.25rem;
    color: var(--sidebar-ink, var(--color-text-muted));
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    cursor: pointer;
}
.app-sidebar-link:hover { background: var(--color-bg); color: var(--sidebar-ink-strong, var(--color-text)); }
.app-sidebar-link--active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
}
.app-sidebar-link-icon { display: flex; align-items: center; opacity: 0.85; }
.app-sidebar-link-label { flex: 1; }
/* Nav-Badge (manifest.nav_badge, z.B. faellige Wiedervorlagen): Pille am rechten Rand. */
.app-sidebar-link-badge {
    flex: 0 0 auto;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--color-warning);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}
/* Eingeklappt: Badge schrumpft zum Punkt oben rechts am Icon — Zahl entfaellt,
   das "hier ist was offen"-Signal bleibt sichtbar. */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-link-badge {
    position: absolute;
    top: 5px;
    right: 8px;
    min-width: 8px;
    width: 8px;
    height: 8px;
    padding: 0;
    font-size: 0;
    line-height: 0;
}
.app-sidebar-link-chevron {
    transition: transform 0.15s;
    opacity: 0.6;
    font-size: 0.7rem;
}
.app-sidebar-module--expanded > .app-sidebar-link .app-sidebar-link-chevron {
    transform: rotate(90deg);
}

.app-sidebar-submenu {
    display: none;
    padding: 0.25rem 0 0.5rem 0;
    background: var(--color-bg);
}
.app-sidebar-module--expanded .app-sidebar-submenu { display: block; }

.app-sidebar-subitem {
    display: block;
    padding: 0.4rem 1.25rem 0.4rem 3rem;
    color: var(--sidebar-ink, var(--color-text-muted));
    text-decoration: none;
    font-size: 0.8rem;
    border-left: 3px solid transparent;
}
.app-sidebar-subitem:hover { color: var(--sidebar-ink-strong, var(--color-text)); background: var(--color-surface); }
.app-sidebar-subitem--active {
    color: var(--color-primary);
    font-weight: 600;
    border-left-color: var(--color-primary);
}

.app-sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.app-sidebar-footer-btn {
    background: none;
    border: none;
    padding: 0.4rem;
    border-radius: var(--radius);
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.app-sidebar-footer-btn:hover { background: var(--color-bg); color: var(--color-text); }
.app-sidebar-footer-profile { margin-left: auto; }

/* Accordion-Toggle: kleiner Button rechtsbuendig ueber der Footer-Trennlinie.
 * Zeigt "1" im Accordion-Modus (nur ein Bereich offen) und "∞" im
 * Mehrfach-Modus. */
.app-sidebar-mode-toggle-row {
    display: flex;
    justify-content: flex-end;
    padding: 0.25rem 0.75rem 0.5rem;
    flex-shrink: 0;
}
.app-sidebar-mode-toggle {
    background: none;
    border: none;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius);
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.app-sidebar-mode-toggle:hover {
    background: var(--color-bg);
    color: var(--color-text);
}
.app-sidebar-mode-toggle .mode-label--manual { display: none; font-size: 0.95rem; }
.app-sidebar-mode-toggle[data-accordion-mode="0"] .mode-label--accordion { display: none; }
.app-sidebar-mode-toggle[data-accordion-mode="0"] .mode-label--manual { display: inline; }

/* Klickbarer User-Chip unten: oeffnet das Settings-Modal (Button-Reset noetig,
 * da im Core ein <button> statt eines <a>). Nur durch eine feine Linie abgesetzt. */
.app-sidebar-user {
    background: none;
    border: none;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    width: calc(100% + 24px);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px -12px 0;
    padding: 12px 12px 2px;
    border-top: 1px solid var(--color-border);
    color: var(--sidebar-ink, var(--color-text-muted));
    text-decoration: none;
    flex-shrink: 0;
}
.app-sidebar-user .nav-avatar,
.app-sidebar-user .nav-avatar-img { flex: 0 0 auto; }
.app-sidebar-user .nav-avatar { background: var(--accent-gradient, var(--color-primary)); }
.app-sidebar-user-meta { min-width: 0; }
.app-sidebar-user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--sidebar-ink-strong, var(--color-text));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar-user-role {
    display: block;
    font-size: 11px;
    color: var(--sidebar-ink, var(--color-text-muted));
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Kein Hover-Umfaerben des Namens: er bleibt --sidebar-ink-strong (weiss/schwarz
 * je nach Sidebar-Farbe, core/Color.php readableInk) statt der Primaerfarbe. */

/* Sidebar-Collapse-Button: sitzt rechts in der Brand-Zeile und klappt die
 * Sidebar zur Icon-Rail ein. Wieder-Aufklappen laeuft ueber die Brand-Marke
 * (app.js). Im eingeklappten Zustand ist der Button daher verborgen. */
.app-sidebar-collapse-btn {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: calc(var(--radius) - 4px);
    border: 0;
    background: transparent;
    color: var(--sidebar-ink, var(--color-text-muted));
    display: grid;
    place-items: center;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s, background 0.15s;
}
.app-sidebar-collapse-btn:hover { opacity: 1; background: var(--sidebar-hover, var(--color-bg)); }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-collapse-btn { display: none; }

/* Responsive: Bei schmalen Bildschirmen faellt die Sidebar auf die Icon-Rail
 * (66px) zurueck, damit der Inhalt Platz bekommt. app.js setzt zusaetzlich
 * data-sidebar-collapsed (blendet die Labels aus); ohne JS bleibt es eine
 * reine Icon-Spalte. Aufklappen ueber die Brand-Marke. */
@media (max-width: 900px) {
    body[data-layout="sidebar"] {
        --sidebar-width: 66px;
        --sidebar-gap: 0px;
    }
    /* Schmale Viewports = Icon-Rail per Media-Query (ohne data-Attribut):
     * Bereichs-Switcher zeigt auch hier nur die Initialen. */
    body[data-layout="sidebar"] .app-sidebar-areas--pill {
        flex-direction: column;
        border-radius: calc(var(--radius) - 3px);
    }
    body[data-layout="sidebar"] .app-sidebar-area-seg {
        padding: 6px 0;
        border-radius: calc(var(--radius) - 3px);
    }
    body[data-layout="sidebar"] .app-sidebar-area-seg-label { display: none; }
    body[data-layout="sidebar"] .app-sidebar-area-seg-initial { display: inline; }
    body[data-layout="sidebar"] .app-sidebar-area-btn { justify-content: center; padding: 7px 0; gap: 0; }
    body[data-layout="sidebar"] .app-sidebar-area-btn-label,
    body[data-layout="sidebar"] .app-sidebar-area-chevron { display: none; }
    body[data-layout="sidebar"] .app-sidebar-area-btn-initial { display: inline; }
    body[data-layout="sidebar"] .app-sidebar-area-menu {
        left: calc(100% + 8px);
        right: auto;
        top: 0;
        min-width: 180px;
    }
}

/* ============================================================
 * Settings-Modal (Vollbild-Overlay mit iframe)
 * Wird vom Avatar-Button im Sidebar-Brand (oder Top-Nav-Profil)
 * geoeffnet. Der iframe laedt die Settings-Routen mit ?embed=1,
 * sodass das embed-Layout ohne App-Sidebar gerendert wird.
 * ============================================================ */
.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.settings-modal[hidden] { display: none; }

/* Container: max. 2/3 der Fensterbreite, zentriert, fixe Hoehe. */
.settings-modal-container {
    width: 100%;
    max-width: 66.666%;
    min-width: 720px;
    height: 100%;
    max-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
@media (max-width: 1100px) {
    .settings-modal-container { max-width: 92%; min-width: 0; }
}

.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.85rem 1.25rem;
    flex-shrink: 0;
}
.settings-modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
}
.settings-modal-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}
.settings-modal-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}
.settings-modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
    position: relative;
}
/* Der Fragment-Wrapper fuellt den Modal-Body und wird beim AJAX-Load ersetzt. */
.settings-fragment {
    display: flex;
    flex: 1;
    min-height: 0;
}
.settings-flash {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    pointer-events: none;
}
.settings-flash .flash { pointer-events: auto; }

/* ============================================================
 * Settings-Unterseiten-Layout
 * Eigene Klassen statt missbrauchter .crm-*: feste Nav links,
 * scrollender Content rechts. Fuellt den Eltern-Container
 * (Settings-Modal-Body oder Full-Page bei Direkt-Aufruf).
 * ============================================================ */
.settings-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    background: var(--color-bg);
}
.settings-nav {
    width: 220px;
    flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.settings-nav-inner {
    flex: 1;
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
}
.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius);
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.15rem;
}
.settings-nav-item:hover {
    background: var(--color-bg);
    color: var(--color-text);
}
.settings-nav-item--active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}
.settings-nav-item--logout {
    border-top: 1px solid var(--color-border);
    color: var(--color-error);
    margin: 0;
    border-radius: 0;
    padding: 0.85rem 1rem;
    flex-shrink: 0;
}
.settings-nav-icon {
    display: flex;
    align-items: center;
    opacity: 0.85;
}
.settings-nav-label { flex: 1; }

.settings-content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 2rem 2.5rem;
}

/* Avatar-Farbauswahl: Runde Dots mit Hover/Active/Selected-State. */
.avatar-color-dot {
    cursor: pointer;
    display: inline-block;
}
.avatar-color-dot input { display: none; }
.avatar-color-dot span {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    box-sizing: content-box;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.avatar-color-dot:hover span {
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}
.avatar-color-dot--selected span,
.avatar-color-dot input:checked + span {
    border-color: var(--color-text);
    transform: scale(1.1);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Passwort-Block eingeklappt (details/summary) */
details.section-card > summary::-webkit-details-marker { display: none; }
details.section-card > summary { user-select: none; }
details.section-card[open] > summary svg {
    transform: rotate(180deg);
}

/* Top-Nav Profil-Button (im Topnav-Layout) */
.nav-profile--btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
}

/* === Page Header === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h1 { margin-bottom: 0; }

.page-subline { color: var(--color-text-muted); font-size: 0.85rem; margin-top: 0.15rem; }

/* === Split-Layout (z.B. Einstellungen: Form links, Vorschau rechts) === */
.split { display: grid; grid-template-columns: 1fr 340px; gap: 1rem; align-items: start; }
.split--ci { grid-template-columns: 1fr 1fr; }
.split > div > .card + .card { margin-top: 1rem; }

@media (max-width: 1100px) {
    .split--ci { grid-template-columns: 1fr; }
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* === Breadcrumb === */
.breadcrumb {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.breadcrumb a { color: var(--color-text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-primary); }

/* === Alerts === */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert--success { background: var(--color-success-light); color: var(--color-success); border: 1px solid rgba(52, 211, 153, 0.2); }
.alert--error   { background: var(--color-error-light); color: var(--color-error);     border: 1px solid rgba(248, 113, 113, 0.2); }
.alert--warning { background: var(--color-warning-light); color: var(--color-warning); border: 1px solid rgba(251, 191, 36, 0.2); }

/* Flash Toast (fixed bottom center) */
.flash-toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    pointer-events: none;
}
.flash-toast {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: flash-in 0.3s ease, flash-out 0.3s ease 3.5s forwards;
    max-width: 500px;
}
.flash-toast--success { background: var(--color-success); color: #fff; }
.flash-toast--error { background: var(--color-error); color: #fff; }
.flash-toast--warning { background: var(--color-warning); color: #000; }
@keyframes flash-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes flash-out { from { opacity: 1; } to { opacity: 0; transform: translateY(10px); } }

/* === Cards === */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow-md); }
.card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--color-text); }
.card h3 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.5rem; }

/* === Section Cards (Bildgenerator-Style) === */
.section-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: visible;
    box-shadow: var(--shadow);
}

.section-card-header {
    padding: 1rem 1rem 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-card-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
}

.section-card-body { padding: 1rem; }

/* Karten-Kopf: Titel + optionale Aktionen in einer Zeile */
.card-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.card-head h3 { margin: 0; }

/* === Tab-Leiste (z.B. Einstellungen-Panels) === */
.tabs { display: inline-flex; gap: 2px; background: var(--color-surface-hover); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 3px; margin-bottom: 1rem; }
.tab { padding: 0.35rem 0.9rem; border-radius: calc(var(--radius) - 3px); font-size: 0.85rem; font-weight: 500; color: var(--color-text-muted); text-decoration: none; }
.tab:hover { color: var(--color-text); text-decoration: none; }
.tab--active { background: var(--color-surface); color: var(--color-text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* === Range-Slider mit Endpunkt-Hinweisen (klein ↔ groß) === */
.range-row { display: flex; align-items: center; gap: 0.6rem; }
.range-row input[type="range"] { flex: 1; min-width: 0; }
.range-row .range-hint { font-size: 0.72rem; color: var(--color-text-muted); white-space: nowrap; }

/* === Forms === */
.form-group { margin-bottom: 1.125rem; }

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-group textarea { min-height: 44px; resize: none; overflow: hidden; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

/* --accent-gradient kommt aus CI (ci-style.php) oder einem Projekt-Theme;
   ohne Wert flacher Primaerfarben-Button. Hover dunkelt per filter ab,
   damit auch ein Verlauf sichtbar reagiert (Background-Tausch wuerde ihn ersetzen). */
.btn--primary { background: var(--accent-gradient, var(--color-primary)); color: #fff; }
.btn--primary:hover { filter: brightness(0.92); color: #fff; box-shadow: var(--shadow-md); }

.btn--outline { background: var(--color-surface); color: var(--color-text-muted); border-color: var(--color-border); }
.btn--outline:hover { border-color: var(--color-primary); color: var(--color-primary); }

.btn--danger { background: var(--color-error); color: #fff; }
.btn--danger:hover { background: #dc2626; color: #fff; }

.btn--success { background: var(--color-success); color: #fff; }
.btn--success:hover { background: #059669; }

.btn--sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn--full { width: 100%; }
.btn--icon { padding: 0.5rem; width: 36px; height: 36px; border-radius: var(--radius); background: var(--color-bg); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.btn--icon:hover { background: var(--color-border-light); color: var(--color-text); }

/* === Login === */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--login-gradient, linear-gradient(135deg, #09090b 0%, #0f0a1f 50%, #09090b 100%));
}

.login-branding { text-align: center; margin-bottom: 1.5rem; }
.login-branding-logo { font-weight: 700; font-size: 1.5rem; letter-spacing: -0.03em; color: var(--color-text); }
.login-branding-logo span { color: var(--color-primary); }
.login-branding-tagline { font-size: 2rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.04em; margin-top: 0.75rem; color: var(--color-text); }
.login-branding-tagline em { font-style: normal; background: linear-gradient(135deg, var(--color-primary), #c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.login-title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--color-text);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.login-legal { text-align: center; margin-top: 1.25rem; font-size: 0.7rem; color: var(--color-text-muted); line-height: 1.5; max-width: 320px; }
.login-legal a { color: var(--color-primary); text-decoration: none; }
.login-legal a:hover { text-decoration: underline; }

/* === Tags/Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.625rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge--success { background: var(--color-success-light); color: var(--color-success); }
.badge--warning { background: var(--color-warning-light); color: var(--color-warning); }
.badge--error   { background: var(--color-error-light); color: var(--color-error); }
.badge--muted   { background: #f3f4f6; color: var(--color-text-muted); }

/* Farben fuer Auswahl-Options (Lead-Phase etc.) — bewusst heller Hintergrund + sattere Textfarbe */
.badge--blue    { background: #dbeafe; color: #1e40af; }
.badge--purple  { background: #ede9fe; color: #6d28d9; }
.badge--teal    { background: #ccfbf1; color: #0f766e; }
.badge--green   { background: #dcfce7; color: #166534; }
.badge--yellow  { background: #fef3c7; color: #92400e; }
.badge--orange  { background: #ffedd5; color: #9a3412; }
.badge--red     { background: #fee2e2; color: #991b1b; }
.badge--pink    { background: #fce7f3; color: #9d174d; }
.badge--brown   { background: #f5e8d8; color: #78350f; }
.badge--gray    { background: #e5e7eb; color: #374151; }

/* Inline-Edit in Tabellen-Zellen */
.db-cell--editable { cursor: pointer; position: relative; }
.db-cell--editable:hover { background: var(--color-surface-hover); }
.db-cell--editable:hover::after {
    content: "▾";
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--color-text-muted);
    pointer-events: none;
}

/* === Tables === */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 0.5rem 0.75rem; font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); border-bottom: 2px solid var(--color-border); }
td { padding: 0.35rem 0.75rem; height: 44px; vertical-align: middle; font-size: 0.85rem; border-bottom: 1px solid var(--color-border-light); }
tr:hover td { background: var(--color-surface-hover); }

/* === Datenlisten (partials/list.php + assets/js/list/) === */
.list-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.list-toolbar .list-count { font-size: 0.8rem; color: var(--color-text-muted); }
.list-toolbar-spacer { flex: 1; }
/* Live-Suchfeld (partials/list.php 'search' + list-page.js) */
.list-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: calc(var(--radius) - 3px);
    padding: 0.4rem 0.65rem;
    width: 260px;
    color: var(--color-text-muted);
}
.list-search svg { flex: none; }
.list-search input {
    border: 0;
    background: transparent;
    padding: 0;
    outline: none;
    color: var(--color-text);
    font-size: 0.85rem;
    width: 100%;
}
.list-search input:focus { box-shadow: none; }
.list-table-wrap { overflow-x: auto; }
tr.clickable-row { cursor: pointer; }

/* Filter-Panel (Markup-Vertrag: assets/js/list/filters.js) */
#filter-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
#filter-rows { display: flex; flex-direction: column; gap: 0.4rem; }
#filter-rows .filter-row { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
#filter-rows .filter-row select,
#filter-rows .filter-row input { font-size: 0.8rem; padding: 0.3rem 0.5rem; }
#filter-panel .filter-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* Pagination unter der Liste */
.list-pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.list-pagination a,
.list-pagination span.page-current,
.list-pagination span.page-gap {
    min-width: 30px;
    padding: 0.3rem 0.55rem;
    text-align: center;
    font-size: 0.8rem;
    border-radius: var(--radius-sm, 6px);
    text-decoration: none;
    color: var(--color-text-muted);
}
.list-pagination a:hover { background: var(--color-surface-hover); color: var(--color-text); }
.list-pagination span.page-current {
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

/* === Charts (core/Chart.php — Inline-SVG) === */
.chart { display: block; width: 100%; height: auto; }
.chart--donut { max-width: 200px; margin: 0 auto; }
.chart--empty {
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* IGEPA_SECTION_SPACING: Abstand zwischen Settings-Boxen */
.settings-content .section-card + .section-card,
.settings-content details.section-card + .section-card,
.settings-content .section-card + details.section-card,
.settings-content details.section-card + details.section-card { margin-top: 1rem; }
.section-card { min-height: 55px; } /* IGEPA_SECTION_MINHEIGHT */

/* === Login/Auth === */
/* Auth-spezifische Overrides (vormals public.css); ergaenzen den Login-Block oben.
   Genutzt von app/views/auth/ (login, 2fa-challenge, reset-/forgot-password, _branding). */
.login-branding { text-align: center; margin-bottom: 1.5rem; }
.login-branding-logo { font-weight: 700; font-size: 1.5rem; letter-spacing: -0.03em; margin-bottom: 0.25rem; }
.login-branding-logo span { color: var(--color-primary); }
.login-branding-tagline { font-size: 0.85rem; color: var(--color-text-muted); }
.login-legal { text-align: center; margin-top: 1.25rem; font-size: 0.7rem; color: var(--color-text-muted); line-height: 1.5; max-width: 320px; margin-left: auto; margin-right: auto; }
.login-legal a { color: var(--color-primary); text-decoration: none; }
.login-legal a:hover { text-decoration: underline; }
/* === Responsive === */
@media (max-width: 768px) {
    .nav { padding: 0 1rem; }
    .nav-link--logout { margin-left: 0; }
    .container, .container--narrow, .container--wide { padding: 1rem; }
    .module-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .lp-hero h1 { font-size: 2.25rem; }
    .lp-hero-grid { grid-template-columns: 1fr !important; text-align: center; }
    .lp-hero-grid .lp-hero-cta { justify-content: center; }
    .lp-grid--3, .lp-grid--4, .lp-grid--5 { grid-template-columns: 1fr; }
    .lp-feature-grid { grid-template-columns: 1fr !important; }
    .lp-feature-grid .lp-card { grid-column: span 1 !important; grid-template-columns: 1fr !important; }
    .lp-steps { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
    .lp-stats { grid-template-columns: repeat(2, 1fr); }
    .lp-footer-grid { grid-template-columns: 1fr 1fr !important; }
    .lp-contact-grid { grid-template-columns: 1fr !important; gap: 2rem !important; }
    .lp-funktionen-grid { grid-template-columns: 1fr !important; }
    .lp-nav-center { display: none; }
    .lp-nav-right { gap: 0.25rem; }
}
/* =========================================================================
 * PWA / Standalone — systemweit, unabhaengig vom Modul.
 *
 * Greift NUR, wenn die App vom Homescreen als installierte App laeuft
 * (display-mode: standalone bzw. iOS legacy navigator.standalone -> .pwa-standalone).
 * Im normalen Browser-Tab bleibt alles unveraendert.
 *
 * Ziel: Inhalte aus den Geraete-"Notches"/Home-Indicator-Bereichen halten
 * (safe-area-insets) und Touch-Bedienung angenehm machen.
 * ========================================================================= */

@media (display-mode: standalone) {
    /* Safe-Area-Padding fuer fixierte Kopf-/Fussleisten und den Body-Rand. */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        /* Kein Pull-to-Refresh / Overscroll-Bounce in der App-Huelle. */
        overscroll-behavior-y: none;
    }

    /* Fixierte Topnav unter die Statusbar/Notch schieben. */
    .topnav,
    .app-header {
        padding-top: calc(env(safe-area-inset-top) + 0.25rem);
    }

    /* Lange Listen/Scrollbereiche unten frei vom Home-Indicator halten. */
    .main-content,
    .app-main {
        padding-bottom: calc(env(safe-area-inset-bottom) + 0.5rem);
    }
}

/* iOS Safari (Legacy) meldet display-mode unzuverlaessig -> Body-Klasse als Fallback,
 * gesetzt per JS aus navigator.standalone. Gleiche Regeln wie oben. */
.pwa-standalone {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior-y: none;
}
.pwa-standalone .topnav,
.pwa-standalone .app-header {
    padding-top: calc(env(safe-area-inset-top) + 0.25rem);
}

/* Touch-Komfort in der installierten App: keine versehentliche Text-Selektion
 * auf Bedien-Elementen, aber Eingabefelder/Inhalte bleiben selektierbar. */
@media (display-mode: standalone) {
    button, .btn, a.btn, nav a {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    input, textarea, select, [contenteditable] {
        -webkit-user-select: text;
        user-select: text;
    }
}
