/* === 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(91, 75, 196, 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") */

/* Brand-Akzent (faictory, themeunabhaengig): zweifarbiger Verlauf wie auf
   faictory.de fuer Primaer-Buttons + Sidebar-Marke/Nav-Avatar. Core-Default;
   ein Projekt-CI kann --accent/--accent-2/--accent-gradient uebersteuern
   (partials/ci-style.php). Konsumiert via var(--accent-gradient, var(--color-primary))
   in components.css (.btn--primary) und layout.css (Marke, Nav-Avatar). */
:root {
    --accent: #f97467;
    --accent-2: #790a0a;
    --accent-gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
}

/* --- LIGHT (Default) --- */
[data-theme="light"], :root {
    --color-primary: #5b4bc4;
    --color-primary-dark: #4d3fa6;
    --color-primary-light: #efedf9;
    --color-bg: #f6f5fa;
    --color-surface: #ffffff;
    --color-surface-hover: #faf9fd;
    --color-text: #211e33;
    --color-text-muted: #6f6d7a;
    --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 2px rgba(33,30,51,0.05), 0 4px 16px rgba(33,30,51,0.06);
    --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: #897dd5;
    --color-primary-dark: #5b4bc4;
    --color-primary-light: rgba(137, 125, 213, 0.12);
    --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 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.25);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.25);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.45), 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; }
/* === Avatar (Sidebar-Benutzer-Chip + Konto-Popover) ===
   Frueher gab es hier die komplette Top-Navigation (.nav*). Die ist entfernt —
   Sidebar ist das einzige Layout. Nur die Avatar-Klassen bleiben, weil sie der
   Benutzer-Chip und das Konto-Menue (partials/_usermenu-popover.php) nutzen. */
.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; }

/* === 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: 1rem; }

/* ============================================================
 * 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;
}


/* 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: none;
    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; }
/* Eingeklappt: Submenue-Liste ausblenden — die Rail zeigt nur die Modul-Icons. */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-submenu { 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;
}
/* Vollbreiten-Logo (ci_logo_mode = 'full'): Logo oben, Titel darunter — statt
   Logo und Titel nebeneinander. Die Breite kommt als Inline-Style aus ci_logo_width. */
.app-sidebar-brand--full {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}
.app-sidebar-brand-full {
    display: flex;
    justify-content: center;
    text-decoration: none;
}
.app-sidebar-brand-full-img {
    max-width: 100%;
    height: auto;
    display: block;
}
/* Im Vollbreiten-Modus traegt der Titel die Zeile — die kleine Marke waere
   doppelt gemoppelt. */
.app-sidebar-brand--full { position: relative; }
.app-sidebar-brand--full .app-sidebar-brand-mark { display: none; }
.app-sidebar-brand--full .app-sidebar-brand-name {
    flex: none;
    text-align: center;
    align-self: center;
    max-width: 100%;
}
/* Einklapp-Pfeil oben rechts statt in einer eigenen Zeile: sonst kostet er
   Hoehe und schiebt die Navigation nach unten. */
.app-sidebar-brand--full .app-sidebar-collapse-btn {
    position: absolute;
    top: 0;
    right: 0;
}

/* Eingeklappte Icon-Rail (66px): kein Platz fuer ein breites Logo — dort gilt
   wieder die quadratische Marke, unabhaengig vom gewaehlten Modus. */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-brand--full { flex-direction: row; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-brand-full { display: none; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-brand--full .app-sidebar-brand-mark { display: grid; }

.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;
    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; }

/* Nav-Reiter als abgerundete Pills (CI-Default aus CRM): kein Border-Left,
   keine eckige Voll-Breite — Hover/Active liegen als abgerundete Flaeche inset
   in der 12px-Sidebar-Polsterung. Hover = zarter Ink-Wash, Active = Primaerfarbe
   dezent auf Surface. */
.app-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: calc(var(--radius) - 3px);
    color: var(--sidebar-ink, var(--color-text-muted));
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}
.app-sidebar-link:hover {
    background: color-mix(in srgb, var(--sidebar-ink, var(--color-text-muted)) 9%, transparent);
    color: var(--sidebar-ink-strong, var(--color-text));
}
.app-sidebar-link--active {
    background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
    color: var(--color-primary);
    font-weight: 600;
}
.app-sidebar-link-icon { display: flex; align-items: center; flex: 0 0 auto; opacity: 0.75; }
.app-sidebar-link--active .app-sidebar-link-icon { opacity: 1; }
.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);
}

/* Submenue eines Moduls (manifest.sidebar): eingerueckte Pills im GLEICHEN Stil
   wie die Modul-Links — kein Border-Left, kein Fremd-Hintergrund (der frueher die
   dunkle Sidebar als weisse Box durchbrach), abgerundet. Hover = zarter Ink-Wash,
   Active = Primaerfarbe dezent auf Surface. */
.app-sidebar-submenu {
    display: none;
    margin: 2px 0 4px;
    padding-left: 20px;
}
.app-sidebar-module--expanded .app-sidebar-submenu { display: block; }

.app-sidebar-subitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: calc(var(--radius) - 3px);
    color: var(--sidebar-ink, var(--color-text-muted));
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
}
.app-sidebar-subitem:hover {
    background: color-mix(in srgb, var(--sidebar-ink, var(--color-text-muted)) 9%, transparent);
    color: var(--sidebar-ink-strong, var(--color-text));
}
.app-sidebar-subitem--active {
    background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
    color: var(--color-primary);
    font-weight: 600;
}

.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; }

/* 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;
    /* Nach rechts schieben — trug frueher der flex:1-Titel; ohne Titel (leeres
       ci_sidebar_title) muss der Button selbst den Raum nehmen. */
    margin-left: 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;
    }
}

/* Embed-Layout (app/views/layouts/fragment.php, Aufruf mit ?embed=1): Wrapper
   fuer eine Settings-Ansicht ohne App-Sidebar. Rest des frueheren Settings-
   Modals — dessen Styles sind entfernt, diese beiden Klassen sind in Gebrauch. */
.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; }


/* 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);
}

/* === 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; }

/* Core-Version rechts oben im Einstellungs-Header — dezente Marke, kein Blickfang:
   sie soll auffindbar sein (Support/Update-Frage), nicht um Aufmerksamkeit buhlen. */
/* Versions-Badges im Einstellungs-Kopf: Core + Module mit eigenem CHANGELOG,
   je mit Bezeichnung, oben rechts nebeneinander (umbricht bei Enge). */
.version-badges {
    flex: 0 0 auto;
    align-self: flex-start;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}
.version-badge {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-text-muted) 12%, transparent);
    color: var(--color-text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.version-badge-label {
    text-transform: uppercase;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

/* === 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);
}

/* Konto-Menue (Benutzer-Popover) — der eine Weg zu Einstellungen + Abmelden.
   Trigger: .app-sidebar-user (Benutzer-Chip unten in der Sidebar). Popover
   oeffnet nach oben (--up). */
.app-usermenu { position: relative; }
.app-usermenu > [data-usermenu-toggle] { cursor: pointer; background: none; border: 0; font: inherit; }
.app-usermenu-caret { margin-left: auto; color: var(--color-text-muted); flex-shrink: 0; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-usermenu-caret { display: none; }

.app-usermenu-popover {
    position: absolute;
    min-width: 232px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.16));
    padding: 6px;
    z-index: 400;
}
.app-usermenu--up .app-usermenu-popover { bottom: calc(100% + 8px); left: 0; }
.app-usermenu--down .app-usermenu-popover { top: calc(100% + 8px); right: 0; }

.app-usermenu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.app-usermenu-head-meta { display: flex; flex-direction: column; min-width: 0; }
.app-usermenu-head-name { font-weight: 700; color: var(--color-text); }
.app-usermenu-head-email {
    font-size: 0.8rem; color: var(--color-text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-usermenu-sep { height: 1px; background: var(--color-border); margin: 4px 6px; }
.app-usermenu-logout { margin: 0; }
.app-usermenu-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 10px; border-radius: calc(var(--radius) - 2px);
    color: var(--color-text); text-decoration: none;
    background: none; border: 0; font: inherit; text-align: left; cursor: pointer;
}
.app-usermenu-item:hover { background: var(--color-bg, #f5f4f7); }
.app-usermenu-ico { color: var(--color-text-muted); flex-shrink: 0; }
}
.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: none;
}

/* Ruhige Flaechen (CI-Default): kein Hover-Lift, Karten bleiben auf Ruhe-Schatten. */
.card:hover { box-shadow: var(--shadow); }
.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);
    /* Core-Default-Abstand zwischen gestapelten Karten (z.B. Settings-Panels).
       Zentral hier statt per Inline-margin in jeder View — Projekte ueber-
       schreiben bei Bedarf via eigenem CSS (.section-card { margin-bottom: ... }).
       Vertikale Margins benachbarter Karten kollabieren, doppeln also nicht. */
    margin-bottom: 1rem;
}

.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; }
/* Ein Tab. Der Reset (border/background/appearance/font/cursor) laesst
   <button class="tab"> exakt wie <a class="tab"> aussehen — sonst rendert der
   Button seine native graue Box (Grund fuer "Elemente sieht anders aus als
   Einstellungen"). white-space:nowrap: Labels brechen nie um; passt die Leiste
   nicht mehr in ihren Container, schaltet app.js auf das .tabs-select-Dropdown. */
.tab { display: inline-flex; align-items: center; padding: 0.35rem 0.9rem; border: 0; background: transparent; border-radius: calc(var(--radius) - 3px); font-family: inherit; font-size: 0.85rem; font-weight: 500; line-height: 1.4; white-space: nowrap; color: var(--color-text-muted); text-decoration: none; cursor: pointer; appearance: none; -webkit-appearance: 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); }
/* Eingeklappt (app.js: Overflow erkannt) — die Tab-Leiste weicht dem Dropdown. */
.tabs.is-collapsed { display: none; }
/* Dropdown-Ersatz fuer die horizontale Nav auf schmalen Containern. Gleiche
   Optik wie ein Tab-Feld; native <select>-Pfeil durch eigenes Chevron ersetzt. */
.tabs-select {
    display: block;
    max-width: 100%;
    margin-bottom: 1rem;
    padding: 0.45rem 2.1rem 0.45rem 0.9rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    background-color: var(--color-surface);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
.tabs-select:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.tabs-select[hidden] { display: none; }

/* === 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-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) {
    .form-grid { grid-template-columns: 1fr; }
}

.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:not([type="checkbox"]):not([type="radio"]),
.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; }
/* Hover bewusst dezent (CI-Default): der Verlauf bleibt sichtbar, nur leicht abgedunkelt. */
.btn--primary:hover { filter: brightness(0.96); color: #fff; box-shadow: var(--shadow); }

.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; }

/* Dot-Pille (CI-Default): Status-Optik mit vorangestelltem Punkt. Die Farbe
   kommt ueber die .badge--*-Klassen (z.B. class="pill badge--green"), currentColor
   faerbt den Punkt mit. */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}
.pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

/* 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; }
/* Tabellenkopf als Uppercase-Label (CI-Default), luftigere Zellen. */
th { text-align: left; padding: 0.625rem 1rem; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border); white-space: nowrap; }
td { padding: 0.7rem 1rem; height: 44px; vertical-align: middle; font-size: 0.85rem; border-bottom: 1px solid var(--color-border-light); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
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-search:focus-within { border-color: var(--color-border); }
.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);
}

/* Abstand zwischen Settings-Boxen kommt jetzt zentral vom .section-card-Default
   (margin-bottom, siehe oben); der fruehere .settings-content-Adjacency-Block
   war toter Code (kein View nutzt .settings-content). */
.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; }

/* === Modal / Popup (generisch) — Steuerung: assets/js/app.js ===
 * Der kanonische Popup-Baustein. EIN korrektes Verhalten fuer alle Projekte:
 *   - zentriert (Flex align/justify center)
 *   - Hintergrund abgedunkelt + geblurrt
 *   - Hintergrund NICHT scrollbar (body.modal-open sperrt overflow)
 *   - schliesst per X / [data-modal-close] / Backdrop-Klick / ESC
 * Nie wieder pro Projekt neu bauen. Markup-Vertrag siehe app.js. */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    overflow-y: auto;              /* sehr hohe Dialoge scrollen im Overlay ... */
    overscroll-behavior: contain;
}
.modal[hidden] { display: none; }
body.modal-open { overflow: hidden; }   /* ... die Seite dahinter bleibt fix */

/* Bestaetigungs-Dialog (customConfirm() in app.js, u.a. alle .confirm-delete-Forms):
   zentriertes Overlay wie .modal. OHNE diese Regel ist .confirm-dialog
   position:static und haengt unsichtbar am Seitenende — dann scheint "Loeschen"
   wirkungslos. z-index ueber .modal, damit ein Confirm auch im Modal sichtbar ist. */
.confirm-dialog {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.confirm-dialog-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 400px;
    padding: 1.5rem;
}
.confirm-dialog-box p { margin: 0 0 1.25rem; color: var(--color-text); }
.confirm-btns { display: flex; justify-content: flex-end; gap: 0.5rem; }

.modal-dialog {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 3rem);
    margin: auto;                 /* zentriert auch, wenn hoeher als das Overlay */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-dialog--sm { max-width: 360px; }
.modal-dialog--lg { max-width: 760px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.modal-header h2, .modal-header h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius);
}
.modal-close:hover { background: var(--color-bg); color: var(--color-text); }
.modal-body { padding: 1.25rem; overflow-y: auto; }
.modal-body > :last-child { margin-bottom: 0; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

/* === Raster (generisch) ===
 * Gleichmaessige Spalten mit echtem Abstand (gap) — ersetzt handgebaute
 * Flex-/Margin-Konstruktionen. .grid--auto fuellt so viele Spalten wie passen. */
.grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
.grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid--cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(var(--grid-min, 220px), 1fr)); }
@media (max-width: 900px) {
    .grid--cols-3, .grid--cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .grid--cols-2, .grid--cols-3, .grid--cols-4 { grid-template-columns: 1fr; }
}

/* === Abschnitts-Titel: Ueberschrift gehoert UEBER die Box, nicht hinein ===
 * Haeufiger Fehler war die Ueberschrift innerhalb der Card. Kanonisch:
 * <h2 class="section-title">Titel</h2> <div class="card"> Inhalt </div> */
.section-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 0.6rem; color: var(--color-text); }
.section-title + .card, .section-title + .section-card { margin-top: 0; }
.section-lead { font-size: 0.85rem; color: var(--color-text-muted); margin: -0.3rem 0 0.9rem; }

/* === Tab-Panels (Reiter-Inhalt; .tabs/.tab existieren bereits oben) === */
.tab-panel[hidden] { display: none; }

/* === Element-Katalog (showcase/index.php): Demo-Bausteine === */
.demo-swatch {
    height: 44px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
}
.demo-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.demo-note { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 0.5rem; }
.demo-note code, code.inline-code {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 0.05rem 0.35rem;
    font-size: 0.78rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* --- Kompaktes Formular-Grid (Settings-Panels: SMTP, Team, Profil, 2FA) ---
   Basis-Primitive fuer Label-ueber-Feld-Formulare. base.css stylt zwar jedes
   input/select generisch (Rahmen/Padding), aber ohne diese Regeln stehen Labels
   inline in Default-Groesse und die Felder stapeln full-width statt im 2-Spalten-
   Grid. Aus dem faictory-igepa-Projekt (project.css, "Golden-Master modules.css")
   in den Core zurueckportiert, damit alle Feature-Panels sauber rendern. Die
   spezifischeren .stammdaten-grid-Regeln weiter unten ueberschreiben das Label-
   Layout dort bewusst (Label links neben Feld). */
.crm-compact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.375rem 0.75rem; }
@media (max-width: 640px) { .crm-compact-grid { grid-template-columns: 1fr; } }
.crm-field label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--color-text); margin-bottom: 0.3rem; }
.crm-field input, .crm-field select, .crm-field textarea { width: 100%; padding: 0.4rem 0.625rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 0.85rem; background: var(--color-bg); color: var(--color-text); }
/* Checkbox/Radio nie full-width ziehen (die generische .crm-field-input-Regel
   oben wuerde sie sonst strecken → Label rutscht weg, Kontrollkaestchen mittig).
   Betrifft z. B. den Button-Farbverlauf-Schalter im CI-Panel. */
.crm-field input[type="checkbox"], .crm-field input[type="radio"] { width: auto; }
.crm-field textarea { resize: vertical; min-height: 2.5rem; font-family: inherit; }
.crm-field input:focus, .crm-field select:focus, .crm-field textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); }

/* --- Stammdaten (Settings): Split-Layout + Beleg-Fusszeilen-Vorschau --- */
.stammdaten-split { display: grid; grid-template-columns: 1fr 360px; gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .stammdaten-split { grid-template-columns: 1fr; } }
.stammdaten-intro { color: var(--color-text-muted); font-size: 0.8rem; margin: 0 0 1.25rem; line-height: 1.5; }
.stammdaten-sub { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); margin: 1.5rem 0 0.85rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border-light); }
.stammdaten-grid { display: flex; flex-direction: column; }
.stammdaten-grid .crm-field { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: center; gap: 0.5rem 1.25rem; padding: 0.6rem 0; border-bottom: 1px solid var(--color-border-light); }
.stammdaten-grid .crm-field:last-child, .stammdaten-grid .stammdaten-check:last-child { border-bottom: 0; }
.stammdaten-grid .crm-field label { margin: 0; font-size: 0.82rem; font-weight: 500; color: var(--color-text); }
.stammdaten-grid .crm-field input, .stammdaten-grid .crm-field select { width: 100%; }
.stammdaten-check { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0; border-bottom: 1px solid var(--color-border-light); font-size: 0.85rem; color: var(--color-text-muted); cursor: pointer; }
.stammdaten-check input { flex-shrink: 0; }
.stammdaten-actions { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border-light); }
@media (max-width: 640px) { .stammdaten-grid .crm-field { grid-template-columns: 1fr; align-items: start; gap: 0.3rem; } }
.beleg-foot-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; font-size: 0.75rem; line-height: 1.55; color: var(--color-text-muted); padding-top: 12px; border-top: 1px solid var(--color-border-light); }
.beleg-foot-preview strong { color: var(--color-text); }

/* === Busy-State (Ladeanimation fuer Aktions-Buttons/Forms, siehe app.js ctBusy) === */
/* Opt-in per data-busy. Der Spinner ersetzt den Button-Text, waehrend eine Aktion
   laeuft (synchron bis Seitenwechsel oder AJAX-Abschluss). Verhindert Doppel-Klick. */
.ct-busy {
    cursor: progress !important;
    opacity: 0.85;
}
.ct-busy .ct-busy-spinner,
.ct-busy-spinner {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: ct-spin 0.6s linear infinite;
    vertical-align: -0.1em;
    box-sizing: border-box;
}
.ct-busy-text { margin-left: 0.5em; }
@keyframes ct-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .ct-busy-spinner { animation-duration: 1.4s; }
}

/* === Job-Tray (Hintergrund-Jobs Stufe 2, siehe app.js ctJobs) === */
/* Persistente Anzeige aktiver Hintergrund-Jobs unten rechts. Ueberlebt
   Navigation (ctJobs.resume() holt offene Jobs nach jedem Seitenladen). */
.ct-jobs-tray {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(22rem, calc(100vw - 2rem));
    pointer-events: none;
}
.ct-job {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    background: var(--color-surface, #fff);
    color: var(--color-text, #1a1a2e);
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.1));
    border-left: 3px solid var(--color-primary, #4f46e5);
    border-radius: var(--radius, 8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.85rem;
    line-height: 1.3;
}
.ct-job.is-done { border-left-color: var(--color-success, #16a34a); }
.ct-job.is-failed { border-left-color: var(--color-error, #dc2626); }
.ct-job.is-clickable { cursor: pointer; }
.ct-job-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ct-job-meta {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

/* SMTP-Verbindungsstatus (Feature smtp): dauerhaftes Badge je Konto im Panel.
   Zustand kommt als Modifier smtp-status--never|ok|fail aus der View. */
.smtp-status {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    background: var(--color-bg, #f5f4f7);
}
.smtp-status strong { font-size: 0.85rem; }
.smtp-status--never strong { color: var(--color-text-muted, #6b7280); }
.smtp-status--ok strong { color: var(--color-success, #1a7f4b); }
.smtp-status--fail strong { color: var(--color-error, #b42318); }
.smtp-status-when { color: var(--color-text-muted); font-size: 0.78rem; }
.smtp-status-error { flex-basis: 100%; color: var(--color-error); font-size: 0.78rem; }

/* Team-Benutzerliste (Feature team): kompakte Spalten-Zeilen + Akkordeon.
   Spalten: Kürzel · Name · E-Mail (mittig) · Rolle (rechts) · Chevron. */
.team-member { border: 1px solid var(--color-border-light); border-radius: var(--radius); margin-bottom: 0.5rem; }
.team-row {
    display: grid;
    grid-template-columns: 56px minmax(110px, 1.1fr) minmax(150px, 1.6fr) 160px 20px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
}
.team-row--head {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--color-text-muted); font-weight: 600; padding: 0.3rem 0.85rem;
}
.team-row--summary { cursor: pointer; list-style: none; }
.team-row--summary::-webkit-details-marker { display: none; }
.team-row--summary:hover { background: var(--color-bg, #f5f4f7); border-radius: calc(var(--radius) - 2px); }
.team-kuerzel {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 30px; padding: 0 6px;
    border-radius: calc(var(--radius) - 3px); background: var(--color-bg, #f5f4f7);
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; color: var(--color-text-muted);
}
.team-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-email { color: var(--color-text-muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row-role { text-align: right; }
.team-chevron { color: var(--color-text-muted); font-size: 0.8rem; transition: transform 0.15s; text-align: right; }
.team-member[open] .team-chevron { transform: rotate(180deg); }
@media (max-width: 640px) {
    .team-row { grid-template-columns: 44px 1fr auto; }
    .team-row--head, .team-email { display: none; }
}
/* === Responsive === */
@media (max-width: 768px) {
    .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;
    }
}
/* === Wissen-Modul === */
.wissen-folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.wissen-folder-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; padding: 1rem 0.5rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); color: var(--color-text); text-decoration: none; text-align: center; }
.wissen-folder-card:hover { border-color: var(--color-primary); text-decoration: none; }
.wissen-folder-card.is-dragover { border-color: var(--color-primary); background: var(--color-primary-light); }
.wissen-folder-card span:not(.wissen-folder-card-actions) { font-size: 0.82rem; word-break: break-word; }
.wissen-folder-card-actions { position: absolute; top: 0.35rem; right: 0.35rem; display: flex; gap: 0.15rem; }

.wissen-dropzone { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2rem 1rem; border: 2px dashed var(--color-border); border-radius: var(--radius); text-align: center; color: var(--color-text-muted); }
.wissen-dropzone.is-dragover { border-color: var(--color-primary); background: var(--color-primary-light); }
.wissen-upload-liste { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; }
.wissen-upload-liste li { padding: 0.3rem 0.6rem; background: var(--color-surface-hover); border-radius: calc(var(--radius) - 3px); }

.wissen-chat-toolbar { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; }

.wissen-chat-shell { display: flex; gap: 1.5rem; align-items: flex-start; }

/* Verlaufsliste (vergangene Konversationen) — ein-/ausblendbar per Button
   in .wissen-chat-toolbar, standardmaessig ausgeblendet (natives [hidden], siehe chat.js).
   Eigener Hintergrund + abgerundete Ecken statt Trennlinie, um sie farblich vom
   restlichen Chat abzuheben. */
.wissen-chat-verlaufsliste { width: 240px; flex-shrink: 0; flex-direction: column; gap: 0.5rem; max-height: 70vh; overflow-y: auto; padding: 0.75rem; border-radius: var(--radius); background: var(--color-surface); }
.wissen-chat-verlaufsliste:not([hidden]) { display: flex; }
.wissen-chat-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.wissen-chat-liste li { display: flex; align-items: center; gap: 0.25rem; }
.wissen-chat-liste-item { flex: 1; min-width: 0; padding: 0.45rem 0.6rem; border-radius: calc(var(--radius) - 3px); color: var(--color-text-muted); text-decoration: none; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wissen-chat-liste-item:hover { background: var(--color-surface-hover); color: var(--color-text); text-decoration: none; }
.wissen-chat-liste-item.is-active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }

.wissen-chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 70vh; }
.wissen-chat-welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.75rem; text-align: center; padding: 2rem 1rem 7rem; }
.wissen-chat-welcome h2 { font-size: 1.6rem; font-weight: 600; margin: 0; }
.wissen-chat-vorschlaege { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; max-width: 1000px; }
.wissen-chat-vorschlag { cursor: pointer; border: none; background: var(--color-surface); color: var(--color-text); font: inherit; text-align: left; padding: 0.75rem 1rem; border-radius: var(--radius); transition: background 0.15s ease; }
.wissen-chat-vorschlag:hover { background: var(--color-surface-hover); }

.wissen-chat-verlauf { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; width: 100%; max-width: 1000px; margin: 0 auto; padding: 1rem 0 7rem; }
.wissen-msg { display: flex; }
.wissen-msg--user { justify-content: flex-end; }
.wissen-msg--assistant { justify-content: flex-start; }
.wissen-msg-col { display: flex; flex-direction: column; gap: 0.35rem; max-width: 72%; }
.wissen-msg--user .wissen-msg-col { align-items: flex-end; }
.wissen-msg--assistant .wissen-msg-col { align-items: flex-start; }
.wissen-msg-bubble { padding: 0.6rem 0.85rem; border-radius: var(--radius); font-size: 0.88rem; line-height: 1.45; white-space: pre-wrap; }
.wissen-msg--user .wissen-msg-bubble { background: var(--color-primary); color: #fff; }
.wissen-msg--assistant .wissen-msg-bubble { background: var(--color-surface-hover); color: var(--color-text); }

/* System-Hinweise im Verlauf (Skill aktiviert / Agent gestartet) — zentrierte
   Badge statt Sprechblase, da keine Chat-"Aussage" im eigentlichen Sinn. */
.wissen-msg--system { justify-content: center; }
.wissen-msg-system-badge { font-size: 0.76rem; color: var(--color-text-muted); background: var(--color-surface-hover); padding: 0.3rem 0.75rem; border-radius: 999px; }

/* Tool-Aufrufe (Websuche/Code-Ausfuehrung, Responses API) als kleine Chips
   oberhalb der Antwort-Bubble. */
.wissen-msg-toolcalls { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.wissen-msg-toolcall { font-size: 0.74rem; color: var(--color-text-muted); background: var(--color-surface-hover); padding: 0.15rem 0.5rem; border-radius: 999px; }

/* Von Agenten generierte Bilder (Bildgenerierung-Tool). */
.wissen-msg-images { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.wissen-msg-image { max-width: 220px; max-height: 220px; border-radius: calc(var(--radius) - 2px); border: 1px solid var(--color-border); }

.wissen-chat-eingabe { max-width: 1000px; margin: 0 auto; }
.wissen-chat-eingabe-bar { position: relative; display: flex; align-items: flex-end; gap: 0.5rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 999px; padding: 0.5rem 0.5rem 0.5rem 1.25rem; box-shadow: var(--shadow); }
.wissen-chat-eingabe-bar textarea { flex: 1; resize: none; min-height: 2.2rem; max-height: 8rem; border: none; background: transparent; padding: 0.35rem 0; font-size: 0.95rem; }
.wissen-chat-eingabe-bar textarea:focus { outline: none; box-shadow: none; }
.wissen-chat-send-btn { flex-shrink: 0; width: 2.2rem; height: 2.2rem; border: none; border-radius: 50%; background: var(--color-primary); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.wissen-chat-send-btn:disabled { opacity: 0.5; cursor: default; }
#wissen-verlauf-toggle[aria-expanded="true"] { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary); }

/* Chatfenster ganz unten am Browserfenster fixiert (nicht nur am Ende der
   Flex-Spalte) — Offset per --sidebar-width, damit die Sidebar nicht ueberdeckt
   wird; passt sich beim Ein-/Ausklappen der Sidebar automatisch an. Der
   Verlauf/Welcome-Screen bekommt dafuer unten Platz via padding-bottom (s.o.). */
.wissen-chat-eingabe--fixed { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 0.75rem 1.5rem 1.25rem; background: linear-gradient(to top, var(--color-bg) 60%, transparent); }
body[data-layout="sidebar"] .wissen-chat-eingabe--fixed { left: var(--sidebar-width, 240px); transition: left 0.2s ease; }

@media (max-width: 800px) {
    .wissen-chat-shell { flex-direction: column; }
    .wissen-chat-verlaufsliste { width: 100%; max-height: 200px; }
}

/* === Wissen-Modul: Agenten/Prompts/Skills (Phase 5) === */

/* "+"-Button links in der Eingabeleiste, oeffnet die Palette. */
.wissen-chat-plus-btn { flex-shrink: 0; width: 2.2rem; height: 2.2rem; border: 1px solid var(--color-border); border-radius: 50%; background: var(--color-surface); color: var(--color-text-muted); font-size: 1.2rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.wissen-chat-plus-btn:hover { background: var(--color-surface-hover); color: var(--color-text); }
.wissen-chat-plus-btn[aria-expanded="true"] { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary); }

/* Popover-Palette (Skills/Prompts/Agenten/Wissen), oeffnet oberhalb des "+"-Buttons.
   Visuelle Tokens von .settings-modal-container/.app-sidebar-area-menu (layout.css). */
.wissen-palette { position: absolute; bottom: calc(100% + 8px); left: 0; width: 340px; max-height: 420px; display: flex; flex-direction: column; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: calc(var(--radius) - 2px); box-shadow: var(--shadow-lg); z-index: 300; overflow: hidden; }
.wissen-palette[hidden] { display: none; }
.wissen-palette-tabs { display: flex; gap: 0.15rem; padding: 0.4rem; border-bottom: 1px solid var(--color-border); flex-shrink: 0; }
.wissen-palette-tab { flex: 1; border: none; background: transparent; color: var(--color-text-muted); font-size: 0.78rem; font-weight: 600; padding: 0.4rem 0.3rem; border-radius: calc(var(--radius) - 4px); cursor: pointer; }
.wissen-palette-tab:hover { background: var(--color-surface-hover); color: var(--color-text); }
.wissen-palette-tab.is-active { background: var(--color-primary-light); color: var(--color-primary); }
.wissen-palette-panel { display: none; flex-direction: column; gap: 0.15rem; padding: 0.4rem; overflow-y: auto; }
.wissen-palette-panel.is-active { display: flex; }
.wissen-palette-empty { padding: 0.75rem 0.5rem; font-size: 0.82rem; color: var(--color-text-muted); text-align: center; }
.wissen-palette-item { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; width: 100%; border: none; background: transparent; text-align: left; padding: 0.45rem 0.6rem; border-radius: calc(var(--radius) - 4px); cursor: pointer; color: var(--color-text); font: inherit; }
.wissen-palette-item:hover { background: var(--color-surface-hover); }
.wissen-palette-item-name { font-size: 0.85rem; font-weight: 600; }
.wissen-palette-item-desc { font-size: 0.76rem; color: var(--color-text-muted); }
.wissen-palette-footer { border-top: 1px solid var(--color-border); padding: 0.5rem 0.6rem; flex-shrink: 0; }
.wissen-palette-footer a { font-size: 0.78rem; color: var(--color-primary); text-decoration: none; }
.wissen-palette-footer a:hover { text-decoration: underline; }

/* Inline-Mention-Dropdown (@skill, /prompt) — an der Caret-Position im Textarea
   positioniert (mention.js), gleiche Optik wie .wissen-palette-panel. */
.wissen-mention-dropdown { position: absolute; min-width: 220px; max-width: 320px; max-height: 240px; overflow-y: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: calc(var(--radius) - 2px); box-shadow: var(--shadow-lg); z-index: 310; padding: 0.25rem; }
.wissen-mention-dropdown[hidden] { display: none; }
.wissen-mention-item { display: flex; flex-direction: column; gap: 0.05rem; width: 100%; border: none; background: transparent; text-align: left; padding: 0.4rem 0.55rem; border-radius: calc(var(--radius) - 4px); cursor: pointer; color: var(--color-text); font: inherit; }
.wissen-mention-item-name { font-size: 0.82rem; font-weight: 600; }
.wissen-mention-item-desc { font-size: 0.74rem; color: var(--color-text-muted); }
.wissen-mention-item.is-highlighted, .wissen-mention-item:hover { background: var(--color-primary-light); }
.wissen-mention-item.is-highlighted .wissen-mention-item-name { color: var(--color-primary); }

/* Ordner-Baum (Popover-Wissen-Tab + Agent-Formular), <details>-basiert. */
.wissen-ordner-baum { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.85rem; }
.wissen-ordner-baum-node { margin: 0; }
.wissen-ordner-baum-node > summary { display: flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.3rem; border-radius: calc(var(--radius) - 4px); cursor: pointer; list-style: none; }
.wissen-ordner-baum-node > summary::-webkit-details-marker { display: none; }
.wissen-ordner-baum-node > summary:hover { background: var(--color-surface-hover); }
.wissen-ordner-baum-node[open] > summary .wissen-ordner-baum-chevron { transform: rotate(90deg); }
.wissen-ordner-baum-chevron { display: inline-block; flex-shrink: 0; opacity: 0.6; transition: transform 0.1s ease; }
.wissen-ordner-baum-children { margin-left: 1.1rem; padding-left: 0.4rem; border-left: 1px dashed var(--color-border); display: flex; flex-direction: column; gap: 0.1rem; }
.wissen-ordner-baum-label { display: flex; align-items: center; gap: 0.4rem; flex: 1; min-width: 0; }
.form-group .wissen-ordner-baum-label { display: flex; margin-bottom: 0; font-size: inherit; font-weight: normal; }
.wissen-ordner-baum-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Tag-Input fuer Skill-Trigger-Keywords (Chips auf Basis von .chip, Vorbild
   Positionszeilen-Add/Remove aus finanzen/views/doc.php). */
.wissen-tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding: 0.5rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg); }
.wissen-tag-input:focus-within { border-color: var(--color-primary); }
.wissen-tag-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.4rem 0.2rem 0.65rem; border: 1px solid var(--color-border); border-radius: 999px; font-size: 0.78rem; color: var(--color-text-muted); background: var(--color-surface); }
.wissen-tag-chip button { border: none; background: transparent; color: inherit; cursor: pointer; font-size: 0.85rem; line-height: 1; padding: 0.1rem; display: flex; }
.wissen-tag-chip button:hover { color: var(--color-text); }
.wissen-tag-input-field { flex: 1; min-width: 100px; border: none; background: transparent; font-size: 0.85rem; padding: 0.2rem; }
.wissen-tag-input-field:focus { outline: none; box-shadow: none; }

/* Zeichenzaehler (Vorbild: Slider-Live-Value-JS in settings/panels/ci.php). */
.wissen-char-counter { font-size: 0.75rem; color: var(--color-text-muted); text-align: right; margin-top: 0.25rem; }
.wissen-char-counter.is-over { color: var(--color-danger, #dc2626); font-weight: 600; }

/* Sichtbarkeit-Toggle: 2-Segment-Control (Persoenlich/Firma) — eine benannte
   Wahl zwischen zwei Zustaenden. */
.wissen-sichtbarkeit-toggle { display: inline-flex; border: 1px solid var(--color-border); border-radius: 999px; padding: 0.15rem; background: var(--color-surface); }
.wissen-sichtbarkeit-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.wissen-sichtbarkeit-toggle label { padding: 0.35rem 0.9rem; border-radius: 999px; font-size: 0.82rem; font-weight: 500; color: var(--color-text-muted); cursor: pointer; }
.wissen-sichtbarkeit-toggle input:checked + label { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }

/* Tool-Toggle: iOS-artiger Switch, im Agent-Formular dreimal geloopt. */
.wissen-tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
@media (max-width: 720px) {
    .wissen-tool-grid { grid-template-columns: 1fr; }
}
.wissen-tool-toggle { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 0.75rem; border: 1px solid var(--color-border); border-radius: var(--radius); }
.wissen-tool-toggle-label { display: flex; flex-direction: column; gap: 0.1rem; }
.wissen-tool-toggle-name { font-size: 0.88rem; font-weight: 600; color: var(--color-text); }
.wissen-tool-toggle-desc { font-size: 0.76rem; color: var(--color-text-muted); }
.wissen-tool-toggle-switch { position: relative; flex-shrink: 0; display: inline-block; width: 2.4rem; height: 1.4rem; }
.wissen-tool-toggle-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.wissen-tool-toggle-switch-track { position: absolute; inset: 0; background: var(--color-border); border-radius: 999px; transition: background 0.15s ease; }
.wissen-tool-toggle-switch-track::before { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.4rem - 4px); height: calc(1.4rem - 4px); background: #fff; border-radius: 50%; transition: transform 0.15s ease; }
.wissen-tool-toggle-switch input:checked ~ .wissen-tool-toggle-switch-track { background: var(--color-primary); }
.wissen-tool-toggle-switch input:checked ~ .wissen-tool-toggle-switch-track::before { transform: translateX(1rem); }

/* KI-Vorschlag-Vorschau im Skill-Editor ("Mit KI verbessern"). */
.wissen-vorschlag-box { margin-top: 0.5rem; padding: 0.65rem 0.75rem; border: 1px solid var(--color-primary); background: var(--color-primary-light); border-radius: var(--radius); font-size: 0.85rem; white-space: pre-wrap; }
.wissen-vorschlag-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

/* Agenten-Grid auf der Verwaltungsseite + Chat-Karten fuer Agent-Start. */
.wissen-agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.wissen-agent-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.9rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); color: inherit; text-decoration: none; }
.wissen-agent-card:hover { border-color: var(--color-primary); text-decoration: none; }
.wissen-agent-card-name { font-size: 0.92rem; font-weight: 600; }
.wissen-agent-card-desc { font-size: 0.8rem; color: var(--color-text-muted); }
.wissen-agent-card-tools { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-top: 0.15rem; }

/* Kurze Bestaetigung nach Inline-Skill-Aktivierung/Scope-Uebernahme (mention.js, palette.js). */
.wissen-flash-toast { position: fixed; bottom: 24px; right: 24px; background: #1a1a2e; color: #fff; padding: 0.6rem 1.1rem; border-radius: var(--radius); font-size: 0.82rem; font-weight: 500; z-index: 9999; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px); transition: opacity 0.25s, transform 0.25s; pointer-events: none; }
.wissen-flash-toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 800px) {
    .wissen-palette { width: calc(100vw - 2rem); left: -0.5rem; }
}

/* === Knowledge-Graph (graph.js) — 3D-Canvas nach Referenz-Prototyp ===
   Bewusst festes Dark-Theme unabhaengig vom App-Theme: die Buehne ist ein
   in sich geschlossener, dunkler Raum (wie im Prototyp). */
.wg-stage { position: relative; height: 72vh; min-height: 540px; border-radius: 18px; overflow: hidden; background: radial-gradient(120% 120% at 60% 40%, #0b101f, #080c18); box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35); }
/* Full-Bleed: zieht das 1rem-Padding von .container--wide per Negativ-Margin
   heraus, damit die Buehne den kompletten Content-Bereich fuellt. */
.wg-stage--full { margin: -1rem; height: 100vh; min-height: 0; border-radius: 0; box-shadow: none; }
/* CI-Scale (ci-style.php setzt zoom auf .main .container) auf der Graph-Seite
   neutralisieren: 100vh * zoom > Viewport wuerde die Buehne ueberlaufen lassen
   (Chat-Overlay unterm Fold, Seiten-Scrollbar) und Canvas-Hitboxen verschieben.
   Der Canvas skaliert seine Inhalte selbst, CI-Zoom bringt hier nichts.
   :has erhoeht die Spezifitaet ueber die Inline-Regel aus ci-style.php. */
.main .container:has(.wg-stage--full) { zoom: 1; }
#wg-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#wg-canvas.dragging { cursor: grabbing; }
.wg-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2rem; color: #7d8aa5; font-size: 0.88rem; }
.wg-empty[hidden] { display: none; }

/* Menue-Panel links oben; faehrt bei geoeffnetem Detail-Panel nicht weg,
   sondern bleibt links — das Detail-Panel liegt rechts. */
.wg-menu { position: absolute; top: 14px; left: 14px; width: 232px; background: rgba(13, 18, 32, 0.92); border: 1px solid rgba(120, 140, 180, 0.16); border-radius: 14px; backdrop-filter: blur(10px); color: #d6dcea; font-size: 0.78rem; z-index: 5; transition: transform 0.45s cubic-bezier(0.25, 0.9, 0.3, 1); }
.wg-menu-head { display: flex; align-items: center; justify-content: space-between; padding: 0.55rem 0.8rem; border-bottom: 1px solid rgba(120, 140, 180, 0.12); }
.wg-menu-title { font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.68rem; color: #7d8aa5; }
#wg-menu-min { background: none; border: none; color: #7d8aa5; font-size: 1rem; line-height: 1; cursor: pointer; padding: 0 0.2rem; }
#wg-menu-min:hover { color: #d6dcea; }
.wg-menu.min .wg-menu-body { display: none; }
.wg-menu-body { padding: 0.7rem 0.8rem 0.9rem; }
#wg-search { width: 100%; box-sizing: border-box; background: rgba(8, 12, 24, 0.8); border: 1px solid rgba(120, 140, 180, 0.2); border-radius: 8px; color: #d6dcea; padding: 0.42rem 0.6rem; font-size: 0.78rem; margin-bottom: 0.6rem; }
#wg-search::placeholder { color: #566079; }
#wg-search:focus { outline: none; border-color: #3d8bfd; }
.wg-sec { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #566079; margin: 0.55rem 0 0.35rem; }
.wg-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.wg-chip { background: rgba(120, 140, 180, 0.1); border: 1px solid rgba(120, 140, 180, 0.18); border-radius: 999px; color: #aab4c8; font-size: 0.7rem; padding: 0.24rem 0.6rem; cursor: pointer; transition: background 0.15s, color 0.15s; }
.wg-chip:hover { color: #e8ecf5; }
.wg-chip.on { background: #e8ecf5; border-color: #e8ecf5; color: #0b101f; font-weight: 600; }
.wg-chk { display: flex; align-items: center; gap: 0.45rem; padding: 0.18rem 0; cursor: pointer; color: #aab4c8; }
.wg-chk input { accent-color: #3d8bfd; }
.wg-sld-label { display: flex; justify-content: space-between; align-items: baseline; margin: 0.55rem 0 0.15rem; color: #aab4c8; }
.wg-sld-label b { color: #d6dcea; font-weight: 600; font-size: 0.72rem; }
.wg-menu input[type="range"] { --fill: 50%; width: 100%; appearance: none; -webkit-appearance: none; height: 4px; border-radius: 2px; background: linear-gradient(to right, #3d8bfd var(--fill), rgba(120, 140, 180, 0.25) var(--fill)); outline: none; }
.wg-menu input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: none; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.wg-menu input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: none; cursor: pointer; }

/* Tooltip folgt dem Hover-Knoten. */
.wg-tooltip { display: none; position: absolute; z-index: 8; max-width: 280px; background: rgba(10, 14, 25, 0.95); border: 1px solid rgba(120, 140, 180, 0.2); border-radius: 10px; padding: 0.5rem 0.7rem; pointer-events: none; color: #d6dcea; }
.wg-tt1 { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.15rem; }
.wg-tt2 { font-size: 0.68rem; }
.wg-tt2 b { letter-spacing: 0.05em; }
.wg-tt2 span { color: #7d8aa5; }
.wg-tt3 { font-size: 0.66rem; color: #566079; margin-top: 0.1rem; }
.wg-tt4 { font-size: 0.62rem; color: #45506a; margin-top: 0.3rem; border-top: 1px solid rgba(120, 140, 180, 0.12); padding-top: 0.3rem; }

/* Detail-Panel rechts, faehrt von aussen ein. */
.wg-detail { position: absolute; top: 14px; right: 14px; bottom: 14px; width: 400px; box-sizing: border-box; background: rgba(11, 15, 27, 0.96); border: 1px solid rgba(120, 140, 180, 0.16); border-radius: 14px; backdrop-filter: blur(10px); color: #d6dcea; padding: 1rem 1.1rem; overflow-y: auto; z-index: 6; transform: translateX(110%); transition: transform 0.45s cubic-bezier(0.25, 0.9, 0.3, 1); }
.wg-detail.open { transform: translateX(0); }
.wg-close { position: absolute; top: 0.6rem; right: 0.7rem; background: none; border: none; color: #7d8aa5; font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 0.1rem 0.3rem; }
.wg-close:hover { color: #d6dcea; }
.wg-badge { display: inline-block; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; border-radius: 999px; padding: 0.18rem 0.55rem; margin-bottom: 0.5rem; }
.wg-detail h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.25rem; color: #eef2fa; }
.wg-meta { font-size: 0.72rem; color: #7d8aa5; margin-bottom: 0.7rem; }
.wg-content { font-size: 0.78rem; line-height: 1.5; }
.wg-content p { margin: 0 0 0.6rem; color: #aab4c8; }
.wg-content h4 { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #566079; margin: 0.8rem 0 0.35rem; }
.wg-links { display: flex; flex-direction: column; gap: 0.2rem; }
.wg-links a { color: #8fb8f5; cursor: pointer; text-decoration: none; font-size: 0.76rem; }
.wg-links a:hover { text-decoration: underline; }

/* Minimap rechts unten. */
.wg-minimap { position: absolute; right: 14px; bottom: 40px; width: 168px; height: 102px; background: rgba(9, 13, 23, 0.85); border: 1px solid rgba(120, 140, 180, 0.16); border-radius: 10px; overflow: hidden; z-index: 4; }
.wg-stage.detail-open .wg-minimap { right: 428px; transition: right 0.45s cubic-bezier(0.25, 0.9, 0.3, 1); }
#wg-minimap-canvas { display: block; width: 168px; height: 102px; }

/* Bedien-Hinweis unten. */
.wg-hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 0.64rem; color: #45506a; pointer-events: none; z-index: 3; }

/* Hover-Inhaltsvorschau im Detail-Panel (graphNodeContent). */
.wg-snip-doc { display: block; color: #8fb8f5; font-size: 0.74rem; text-decoration: none; margin: 0.4rem 0 0.15rem; }
.wg-snip-doc:hover { text-decoration: underline; }
.wg-content p.wg-snip { font-size: 0.72rem; color: #96a1b8; margin: 0 0 0.45rem; border-left: 2px solid rgba(120, 140, 180, 0.25); padding-left: 0.5rem; }
.wg-content p.wg-snip-lade { color: #566079; font-size: 0.72rem; }

/* Graph-Chat-Overlay links unten (Punkt 7): fragt POST /wissen/graph/chat
   und markiert die genutzten Quellen-Nodes im Canvas. */
.wg-chat { position: absolute; left: 14px; bottom: 14px; width: 340px; max-height: 46vh; display: flex; flex-direction: column; background: rgba(13, 18, 32, 0.94); border: 1px solid rgba(120, 140, 180, 0.16); border-radius: 14px; backdrop-filter: blur(10px); color: #d6dcea; font-size: 0.78rem; z-index: 7; overflow: hidden; }
.wg-chat-head { display: flex; align-items: center; justify-content: space-between; padding: 0.55rem 0.8rem; border-bottom: 1px solid rgba(120, 140, 180, 0.12); }
.wg-chat-title { font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.68rem; color: #7d8aa5; }
.wg-chat-actions button { background: none; border: none; color: #7d8aa5; font-size: 0.95rem; line-height: 1; cursor: pointer; padding: 0 0.25rem; }
.wg-chat-actions button:hover { color: #d6dcea; }
.wg-chat.min .wg-chat-body { display: none; }
.wg-chat-body { display: flex; flex-direction: column; min-height: 0; }
.wg-chat-log { overflow-y: auto; padding: 0.6rem 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; min-height: 0; }
.wg-chat-log:empty { display: none; }
.wg-msg p { margin: 0 0 0.35rem; }
.wg-msg p:last-child { margin-bottom: 0; }
.wg-msg--user { align-self: flex-end; background: rgba(61, 139, 253, 0.18); border: 1px solid rgba(61, 139, 253, 0.3); border-radius: 10px 10px 2px 10px; padding: 0.35rem 0.6rem; max-width: 85%; }
.wg-msg--assistant { color: #aab4c8; line-height: 1.45; }
#wg-chat-form { display: flex; gap: 0.4rem; padding: 0.55rem 0.8rem 0.7rem; border-top: 1px solid rgba(120, 140, 180, 0.12); }
#wg-chat-input { flex: 1; min-width: 0; background: rgba(8, 12, 24, 0.8); border: 1px solid rgba(120, 140, 180, 0.2); border-radius: 8px; color: #d6dcea; padding: 0.42rem 0.6rem; font-size: 0.78rem; }
#wg-chat-input::placeholder { color: #566079; }
#wg-chat-input:focus { outline: none; border-color: #3d8bfd; }
#wg-chat-form button { background: #3d8bfd; border: none; border-radius: 8px; color: #fff; padding: 0 0.7rem; cursor: pointer; font-size: 0.8rem; }
#wg-chat-form button:hover { background: #5c9ffd; }

/* Quellen-Chips unter einer Graph-Chat-Antwort: Dokument + Score +
   Pool-Badges (V/S/G = Vektor/Stichwort/Graph). */
.wg-chips-src { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.45rem; align-items: center; }
.wg-src { display: inline-flex; align-items: center; gap: 0.3rem; background: rgba(120, 140, 180, 0.1); border: 1px solid rgba(120, 140, 180, 0.2); border-radius: 999px; color: #aab4c8; font-size: 0.66rem; padding: 0.2rem 0.55rem; cursor: pointer; max-width: 100%; }
.wg-src:hover { color: #e8ecf5; border-color: rgba(140, 170, 220, 0.4); }
.wg-src-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-src-score { color: #7d8aa5; }
.wg-pool { font-size: 0.58rem; font-weight: 700; border-radius: 4px; padding: 0.05rem 0.25rem; line-height: 1.2; }
.wg-pool--vector { background: rgba(124, 196, 242, 0.2); color: #7cc4f2; }
.wg-pool--keyword { background: rgba(164, 224, 134, 0.2); color: #a4e086; }
.wg-pool--graph { background: rgba(240, 160, 221, 0.2); color: #f0a0dd; }
.wg-src-trace { color: #566079; font-size: 0.64rem; text-decoration: none; }
.wg-src-trace:hover { color: #8fb8f5; text-decoration: underline; }

@media (max-width: 900px) {
    .wg-detail { width: calc(100vw - 6rem); max-width: 400px; }
    .wg-minimap { display: none; }
    .wg-chat { width: calc(100vw - 4rem); max-width: 340px; }
}

/* === Wissen-Modul: Datei-Detailansicht (Phase "PDF & Detail") === */

/* Dateiliste: Name als klickbarer Link zur Detailansicht. */
.wissen-datei-link { text-decoration: none; color: inherit; }
.wissen-datei-link:hover .cell-main { color: var(--color-primary); text-decoration: underline; }

/* Status-Stepper (hochgeladen -> verarbeitung -> bereit). */
.wissen-detail-status { margin-bottom: 1rem; }
.wissen-stepper { list-style: none; display: flex; gap: 0; margin: 0; padding: 0.25rem 0; }
.wissen-stepper-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; position: relative; font-size: 0.8rem; color: var(--color-text-muted); }
.wissen-stepper-step::before { content: ""; position: absolute; top: 7px; left: -50%; width: 100%; height: 2px; background: var(--color-border); z-index: 0; }
.wissen-stepper-step:first-child::before { display: none; }
.wissen-stepper-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--color-border); z-index: 1; }
.wissen-stepper-step.is-done .wissen-stepper-dot { background: var(--color-primary); }
.wissen-stepper-step.is-done::before { background: var(--color-primary); }
.wissen-stepper-step.is-current .wissen-stepper-label { color: var(--color-primary); font-weight: 600; }
.wissen-detail-fehler { display: flex; flex-direction: column; gap: 0.2rem; color: var(--color-danger, #dc2626); }
.wissen-detail-quelle { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem; font-size: 0.85rem; }
.wissen-detail-quelle a { overflow-wrap: anywhere; }

/* Kennzahlen-Raster. */
.wissen-detail-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.wissen-detail-metaitem { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0.75rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.wissen-detail-metaitem span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }
.wissen-detail-metaitem strong { font-size: 0.95rem; }

/* Zweispaltiges Grid: Original | Markdown. */
.wissen-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.wissen-detail-panel { margin-bottom: 1rem; }
.wissen-detail-panel h2 { font-size: 1rem; margin: 0 0 0.5rem; }
.wissen-detail-hint { font-size: 0.8rem; color: var(--color-text-muted); margin: 0 0 0.75rem; }
.wissen-detail-pdf { width: 100%; height: 760px; border: 1px solid var(--color-border); border-radius: calc(var(--radius) - 2px); }
.wissen-detail-bild { max-width: 100%; border: 1px solid var(--color-border); border-radius: calc(var(--radius) - 2px); }
.wissen-detail-markdown { max-height: 760px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 0.82rem; line-height: 1.5; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: calc(var(--radius) - 2px); padding: 0.75rem; margin: 0; }

@media (max-width: 900px) { .wissen-detail-grid { grid-template-columns: 1fr; } }

/* 4-Varianten-Tabs (Original / Markdown / Chunks / Vektoren). */
.wissen-detail-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--color-border); margin-bottom: 0.75rem; }
.wissen-detail-tab { appearance: none; background: none; border: none; cursor: pointer; padding: 0.5rem 0.75rem; font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.wissen-detail-tab:hover { color: var(--color-text); }
.wissen-detail-tab.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.wissen-detail-tab-count { display: inline-block; margin-left: 0.3rem; font-size: 0.72rem; font-weight: 600; color: var(--color-text-muted); background: var(--color-surface-hover); border-radius: 999px; padding: 0.05rem 0.4rem; }
.wissen-detail-tabpanel[hidden] { display: none; }

/* Excel-Vorschau — wie in Excel dargestellt (Tabellenansicht je Sheet). */
.wissen-detail-xlsx-heading { font-size: 0.88rem; margin: 0 0 0.4rem; }
.wissen-detail-xlsx-heading:not(:first-child) { margin-top: 1rem; }
.wissen-detail-tabelle-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--color-border); border-radius: calc(var(--radius) - 2px); margin-bottom: 0.75rem; }
.wissen-detail-tabelle { border-collapse: collapse; width: 100%; font-size: 0.8rem; white-space: nowrap; }
.wissen-detail-tabelle th, .wissen-detail-tabelle td { border: 1px solid var(--color-border); padding: 0.3rem 0.55rem; text-align: left; }
.wissen-detail-tabelle th { position: sticky; top: 0; background: var(--color-surface-hover); font-weight: 600; }
.wissen-detail-tabelle tr:nth-child(even) td { background: var(--color-bg); }

/* PowerPoint-Vorschau — eine Karte je Folie. */
.wissen-detail-folien { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.wissen-detail-folie { border: 1px solid var(--color-border); border-radius: calc(var(--radius) - 2px); padding: 0.6rem 0.75rem; background: var(--color-bg); }
.wissen-detail-folie-nr { display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); margin-bottom: 0.3rem; }
.wissen-detail-folie p { margin: 0; font-size: 0.85rem; line-height: 1.5; white-space: pre-wrap; }

/* Chunk-Liste mit Vektor-Sparkline. */
.wissen-chunk { border: 1px solid var(--color-border); border-radius: calc(var(--radius) - 2px); padding: 0.6rem 0.75rem; margin-bottom: 0.6rem; }
.wissen-chunk-head { display: flex; align-items: center; gap: 0.6rem; font-size: 0.78rem; margin-bottom: 0.4rem; color: var(--color-text-muted); }
.wissen-chunk-spark { display: block; width: 100%; height: 36px; background: var(--color-bg); border-radius: 4px; margin-bottom: 0.4rem; }
.wissen-chunk-spark polyline { fill: none; stroke: var(--color-primary); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.wissen-chunk-spark-point { fill: var(--color-primary); opacity: 0; cursor: crosshair; }
.wissen-chunk-spark-point:hover { opacity: 1; }
.wissen-chunk-text { font-size: 0.82rem; line-height: 1.5; color: var(--color-text); margin: 0; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.wissen-chunk-rohdaten { font-size: 0.78rem; }
.wissen-chunk-rohdaten summary { cursor: pointer; color: var(--color-text-muted); user-select: none; }
.wissen-chunk-rohdaten summary:hover { color: var(--color-text); }
.wissen-chunk-rohdaten-werte { margin: 0.4rem 0 0; padding: 0.5rem 0.6rem; background: var(--color-bg); border-radius: calc(var(--radius) - 2px); font-family: ui-monospace, monospace; font-size: 0.72rem; line-height: 1.5; color: var(--color-text-muted); white-space: pre-wrap; max-height: 200px; overflow: auto; }

/* Performance-Seite: Antwort/Quellen-Expand je Anfrage. */
.wissen-perf-detail-row td { padding-top: 0; padding-bottom: 0.75rem; border-top: none; }
.wissen-perf-detail { font-size: 0.82rem; }
.wissen-perf-detail summary { cursor: pointer; color: var(--color-text-muted); user-select: none; }
.wissen-perf-detail summary:hover { color: var(--color-text); }
.wissen-perf-antwort { margin: 0.5rem 0 0; padding: 0.6rem 0.75rem; background: var(--color-bg); border-radius: calc(var(--radius) - 2px); color: var(--color-text); line-height: 1.5; white-space: pre-wrap; }
.wissen-perf-quellen { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.wissen-perf-quellen li { font-size: 0.8rem; }
.wissen-perf-quelle-name { font-weight: 500; color: var(--color-text); }

/* Graph-Verknuepfungen. */
.wissen-detail-entities { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.wissen-detail-entitytype { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.wissen-detail-entitylabel { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); min-width: 92px; }
.wissen-detail-relations { list-style: none; margin: 0.5rem 0 0.75rem; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.wissen-detail-relations li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.85rem; }
.wissen-rel-node { font-weight: 600; }
.wissen-rel-label { font-size: 0.76rem; color: var(--color-text-muted); background: var(--color-surface-hover); padding: 0.1rem 0.5rem; border-radius: 999px; }

/* Kurzbeschreibung unter einer Seitenueberschrift (Wissen-Dateiliste). */
.page-desc { margin: 0.15rem 0 0.35rem; font-size: 0.9rem; color: var(--color-text-muted); }

/* === Wissen-Modul: Performance / Modellvergleich (Phase 6) === */
.wissen-vergleich-form { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.wissen-vergleich-form label { font-size: 0.85rem; font-weight: 600; }
.wissen-vergleich-form textarea { width: 100%; resize: vertical; }
.wissen-vergleich-actions { display: flex; justify-content: flex-end; }
.wissen-vergleich-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.wissen-vergleich-card { display: flex; flex-direction: column; gap: 0.5rem; }
.wissen-vergleich-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.wissen-vergleich-antwort { font-size: 0.88rem; line-height: 1.5; white-space: pre-wrap; }
.wissen-vergleich-stacks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.wissen-vergleich-stack { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.75rem; border: 1px solid var(--color-border); border-radius: var(--radius); }
.wissen-vergleich-stack legend { font-size: 0.8rem; font-weight: 600; padding: 0 0.3rem; }
.wissen-vergleich-stack label { font-size: 0.78rem; font-weight: 500; color: var(--color-text-muted); }
.wissen-vergleich-stack select { width: 100%; }

/* Datenqualität (Findings): Scan-Aktionen, Segment-Switch + Auto-Toggle, 3-Spalten-Grid */
.wissen-dq-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.wissen-dq-actions #wissen-scan-form { display: flex; align-items: center; gap: 0.6rem; }
.wissen-dq-voll { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; cursor: pointer; }
.wissen-dq-letzter { font-size: 0.78rem; }
.wissen-dq-leiste { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.wissen-dq-switch { display: inline-flex; border: 1px solid var(--color-border); border-radius: 999px; padding: 0.15rem; background: var(--color-surface); }
.wissen-dq-seg { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.9rem; border-radius: 999px; font-size: 0.84rem; font-weight: 500; color: var(--color-text-muted); text-decoration: none; white-space: nowrap; }
.wissen-dq-seg:hover { color: var(--color-text); text-decoration: none; }
.wissen-dq-seg.is-active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }
.wissen-dq-zahl { display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem; border-radius: 999px; background: var(--color-surface-hover); color: var(--color-text-muted); font-size: 0.74rem; font-weight: 600; }
.wissen-dq-seg.is-active .wissen-dq-zahl { background: var(--color-primary); color: #fff; }
.wissen-dq-auto { display: inline-flex; align-items: center; gap: 0.6rem; margin: 0; }
.wissen-dq-auto-label { font-size: 0.84rem; color: var(--color-text-muted); }
.wissen-dq-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: start; }
.wissen-dq-grid.is-solo { grid-template-columns: 1fr; }

/* Bausteine-Reiter — Segment-Switch (Agenten / Prompts / Skills / Personas) */
.wissen-bs-switch { display: inline-flex; border: 1px solid var(--color-border); border-radius: 999px; padding: 0.15rem; background: var(--color-surface); margin-bottom: 1rem; }
.wissen-bs-seg { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.9rem; border-radius: 999px; font-size: 0.84rem; font-weight: 500; color: var(--color-text-muted); text-decoration: none; white-space: nowrap; }
.wissen-bs-seg:hover { color: var(--color-text); text-decoration: none; }
.wissen-bs-seg.is-active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }
.wissen-bs-zahl { display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem; border-radius: 999px; background: var(--color-surface-hover); color: var(--color-text-muted); font-size: 0.74rem; font-weight: 600; }
.wissen-bs-seg.is-active .wissen-bs-zahl { background: var(--color-primary); color: #fff; }
.wissen-dq-spalte { display: flex; flex-direction: column; gap: 0.5rem; }
.wissen-dq-titel { font-size: 1rem; margin: 0 0 0.25rem; }
.wissen-dq-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.wissen-dq-item { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.6rem 0; border-top: 1px solid var(--color-border); }
.wissen-dq-item:first-child { border-top: none; }
.wissen-dq-item-titel { font-size: 0.9rem; font-weight: 500; color: var(--color-text); text-decoration: none; overflow-wrap: anywhere; }
.wissen-dq-item-titel:hover { color: var(--color-primary); text-decoration: none; }
.wissen-dq-item-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; }
.wissen-dq-item-grund { font-size: 0.8rem; line-height: 1.35; }
.wissen-dq-mehr { font-size: 0.82rem; margin: 0.25rem 0 0; }
@media (max-width: 900px) { .wissen-dq-grid { grid-template-columns: 1fr; } }
.wissen-vergleich-snippet { font-size: 0.76rem; margin-top: 0.1rem; }

/* === Wissen-Modul: Freigabe-/Rechte-Modal === */
.wperms-table th, .wperms-table td { vertical-align: middle; }
.wperms-table td input[type="checkbox"] { margin: 0; }
.wperms-add { margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--color-border); }
.wperms-add h4 { margin: 0 0 0.5rem; font-size: 0.9rem; }
.wperms-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.wperms-add-row select { min-width: 120px; }
.wperms-add-row label { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; }

/* Detailansicht v2: kompakte Meta + Inhalt/Zugriff zweispaltig. */
.wissen-detail-meta--kompakt { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.wissen-detail-grid2 { display: grid; grid-template-columns: 3fr 1fr; gap: 1rem; align-items: start; }
.wissen-detail-sidebar { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
@media (max-width: 900px) { .wissen-detail-grid2 { grid-template-columns: 1fr; } }
.wissen-zugriff-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.wissen-zugriff-liste li { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; }
.wissen-zugriff-name { font-weight: 500; }

/* === Wissen-Modul: Dateien-Tab (Ordner-Baum links + Kontextmenue) === */
.wissen-dateien-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 1rem; align-items: start; }
.wissen-dateien-main { transition: opacity 0.12s ease; }
.wissen-dateien-main.is-loading { opacity: 0.5; }
/* pjax-Reiterwechsel: kurzer Dimm-Effekt beim Nachladen des Inhalts */
.main .container.is-pjax-loading { opacity: 0.55; transition: opacity 0.12s ease; }
@media (max-width: 900px) { .wissen-dateien-layout { grid-template-columns: 1fr; } }
.wissen-dateien-main { min-width: 0; }

/* Ordner-Navigation (Baum) */
.wissen-ordnernav { padding: 1rem 0.85rem; }
.wissen-ordnernav h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }
.wissen-ordnernav-baum { display: flex; flex-direction: column; gap: 1px; }
.wissen-ordnernav-alle,
.wissen-ordnernav-link { display: flex; align-items: center; gap: 0.45rem; flex: 1; min-width: 0; padding: 0.3rem 0.4rem; border-radius: calc(var(--radius) - 3px); color: var(--color-text); text-decoration: none; font-size: 0.9rem; }
/* "Alle Dokumente" hat keinen Aufklapp-Pfeil — per Einzug auf die Icon-Spalte
   der Ordner mit Pfeil/Platzhalter ausrichten. */
.wissen-ordnernav-alle { margin-bottom: 0.15rem; padding-left: calc(20px + 0.4rem); }
.wissen-ordnernav-alle:hover, .wissen-ordnernav-link:hover { background: var(--color-surface-hover); text-decoration: none; }
.wissen-ordnernav-alle.is-active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }
.wissen-ordnernav-link svg, .wissen-ordnernav-alle svg { flex: 0 0 auto; color: var(--color-text-muted); }
.wissen-ordnernav-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.wissen-ordnernav-count { flex: 0 0 auto; color: var(--color-text-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
/* Aktiv-Markierung liegt auf demselben Element (dem Link) wie der Hover —
   gleiche Breite/Form, Pfeil + ⋯ bleiben außerhalb der Markierung. */
.wissen-ordnernav-row { display: flex; align-items: center; gap: 0.1rem; padding-right: 2px; }
.wissen-ordnernav-row.is-active .wissen-ordnernav-link { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }
.wissen-ordnernav-row.is-active .wissen-ordnernav-link svg { color: var(--color-primary); }
.wissen-ordnernav-row.is-dragover { outline: 2px dashed var(--color-primary); outline-offset: -2px; }
.wissen-ordnernav-toggle { flex: 0 0 auto; width: 20px; height: 20px; border: none; background: none; color: var(--color-text-muted); cursor: pointer; font-size: 0.72rem; line-height: 1; transition: transform 0.12s; padding: 0; }
.wissen-ordnernav-node.is-open > .wissen-ordnernav-row > .wissen-ordnernav-toggle { transform: rotate(90deg); }
.wissen-ordnernav-spacer { flex: 0 0 auto; width: 20px; }
.wissen-ordnernav-menu.btn-icon { opacity: 0; flex: 0 0 auto; width: 22px; height: 22px; font-size: 0.95rem; border-radius: calc(var(--radius) - 4px); }
.wissen-ordnernav-row:hover .wissen-ordnernav-menu, .wissen-ordnernav-row.is-active .wissen-ordnernav-menu { opacity: 1; }
.wissen-ordnernav-menu.btn-icon:hover { background: rgba(127, 127, 127, 0.18); color: var(--color-text); }
.wissen-ordnernav-children { display: none; margin-left: 0.95rem; }
.wissen-ordnernav-node.is-open > .wissen-ordnernav-children { display: block; }

/* Neuer-Ordner-Formular */
.wissen-ordnernav-neu { margin-top: 0.85rem; padding-top: 0.85rem; border-top: 1px solid var(--color-border); display: flex; flex-direction: column; gap: 0.4rem; }
.wissen-ordnernav-neu select, .wissen-ordnernav-neu input { width: 100%; }
.wissen-ordnernav-neu-row { display: flex; gap: 0.4rem; }
.wissen-ordnernav-neu-row input { flex: 1; }
.wissen-ordnernav-add { flex: 0 0 auto; width: 38px; padding: 0; border-radius: 50%; font-size: 1.2rem; line-height: 1; }

/* Gemeinsames Kontextmenue */
.wissen-ctxmenu { position: fixed; z-index: 400; min-width: 210px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 0.3rem; }
.wissen-ctxmenu[hidden] { display: none; }
.wissen-ctxmenu-item { display: block; width: 100%; text-align: left; border: none; background: none; font: inherit; color: var(--color-text); padding: 0.5rem 0.65rem; border-radius: calc(var(--radius) - 3px); cursor: pointer; }
.wissen-ctxmenu-item:hover { background: var(--color-surface-hover); }
.wissen-ctxmenu-sep { border-top: 1px solid var(--color-border); margin: 0.3rem 0; }

/* Icon-Buttons (⋯, Aktionen): kein Rahmen/Hintergrund, Hover = abgerundetes graues Quadrat. */
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: none; background: none; color: var(--color-text-muted); border-radius: 8px; cursor: pointer; font-size: 1.05rem; line-height: 1; }
.btn-icon:hover { background: var(--color-surface-hover); color: var(--color-text); }

/* Zugriffsrechte: Ordner-Checkbox-Matrix je Gruppe. */
.wissen-rechte-baum { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.wissen-rechte-node { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; cursor: pointer; }
.wissen-rechte-node input { margin: 0; }
.wissen-rechte-actions { border-top: 1px solid var(--color-border); padding-top: 0.85rem; }

/* Dokumentenversionierung: Versionsverlauf-Panel auf der Detailseite. */
.wissen-detail-versionen-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.wissen-detail-versionen-kopf > div { flex-shrink: 0; }
.wissen-detail-versionen-kopf h2 { margin: 0; }
.wissen-versionen-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.wissen-versionen-liste li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; font-size: 0.88rem; padding: 0.5rem 0.65rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.wissen-version-nr { font-weight: 600; flex: 0 0 auto; }
.wissen-version-name { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wissen-version-groesse, .wissen-version-datum { color: var(--color-text-muted); flex: 0 0 auto; }
.wissen-version-aktionen { display: flex; gap: 0.4rem; margin-left: auto; }


/* ==== Content-Modul (aus der Garage) ==== */
/* project.css — projekt-eigene Styles (Erweiterungspunkt, kommt als letzte
   Datei ins Bundle; Core-CSS bleibt beim Core-Update unangetastet). */

/* === ct-Modal (Content-Modul: Neuanlage/Bearbeiten in Overlay) ===
   Bewusst eigener Namespace "ct-" — unabhängig von Core-Konventionen.
   Öffnen/Schließen über [data-modal-open]/[data-modal-close] (project.js). */
.ct-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 1rem;
    background: rgba(15, 23, 42, 0.55);
    overflow-y: auto;
}
.ct-modal.is-open { display: flex; }

.ct-modal__dialog {
    width: 100%;
    max-width: 560px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    margin: auto 0;
}
.ct-modal__dialog--wide { max-width: 720px; }
/* Zielgruppen-Maske: zwoelf Felder brauchen Platz — 70 % der Fensterbreite.
   Auf schmalen Schirmen faellt das auf volle Breite zurueck, sonst waeren die
   Dreier-Raster nicht mehr lesbar. */
.ct-modal__dialog--audience { max-width: 70vw; }
@media (max-width: 900px) { .ct-modal__dialog--audience { max-width: 100%; } }

.ct-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}
.ct-modal__head h2 { margin: 0; font-size: 1rem; }

.ct-modal__close {
    border: none;
    background: none;
    color: var(--color-text-muted);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
}
.ct-modal__close:hover { color: var(--color-text); background: var(--color-surface-hover); }

.ct-modal__body { padding: 1.25rem; }

/* Seite hinterm offenen Modal nicht scrollen. */
body.ct-modal-open { overflow: hidden; }

/* === ct-Multi (Content-Seite: Persönlichkeiten-Mehrfachauswahl) ===
   <details>-basiert — funktioniert ohne JS; project.js hält nur den Zähler
   im Summary aktuell und schließt das Panel bei Klick außerhalb. */
.ct-multi { position: relative; }

.ct-multi > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    font-size: 0.9rem;
    user-select: none;
}
.ct-multi > summary::-webkit-details-marker { display: none; }
.ct-multi > summary::after { content: "▾"; color: var(--color-text-muted); font-size: 0.75rem; }
.ct-multi[open] > summary::after { content: "▴"; }

.ct-multi__panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ct-multi__option {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}
.ct-multi__option:hover { background: var(--color-surface-hover); }
.ct-multi__option input { margin-top: 0.2rem; }

/* ---------------------------------------------------------------------------
 * Sidebar-Reiter: Pill-Look statt Border-Left-Marker (übernommen aus dem CRM).
 * Hover = leichter transparenter Balken + aufgehellte Schrift, Aktiv = weich
 * eingefärbte Pille. Der Rand links entfällt komplett.
 * ------------------------------------------------------------------------ */
.app-sidebar-link {
    margin: 0 0.6rem;
    padding: 0.5rem 0.7rem;
    border-left: 0;
    border-radius: 10px;
}
.app-sidebar-link:hover {
    background: color-mix(in srgb, var(--sidebar-ink, var(--color-text-muted)) 9%, transparent);
    color: var(--sidebar-ink-strong, var(--color-text));
}
.app-sidebar-link--active {
    background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
    color: var(--color-primary);
    font-weight: 600;
}
.app-sidebar-link--active .app-sidebar-link-icon { opacity: 1; }

/* ---------------------------------------------------------------------------
 * Prompts-Reiter: erste Ebene (Bereich) + Darstellung als Filterleiste,
 * darunter die Prompt-Karten wahlweise als Liste oder als 3er-Kachelraster.
 * ------------------------------------------------------------------------ */
.prompt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.prompt-filters { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.prompt-filter {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-decoration: none;
}
.prompt-filter:hover { background: var(--color-surface-hover); }
.prompt-filter--active {
    background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
}

.prompt-cards { display: grid; gap: 1rem; }
.prompt-cards--liste { grid-template-columns: minmax(0, 720px); }
.prompt-cards--grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .prompt-cards--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px)  { .prompt-cards--grid { grid-template-columns: minmax(0, 1fr); } }

.prompt-card {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    background: var(--color-surface);
}


/* ============================================================
   Personal-Branding-Ansicht „Dein Raum" (.pb-*) — HUD-Layout
   Vollflächige, warme Bühne (Creme / Rosé / Gold), themeunabhaengig.
   Diorama liegt als Szene im Hintergrund, Cards schweben in den Ecken.
   Bricht mit margin:-2rem aus dem .container--wide-Padding aus.
   ============================================================ */
.pb-hud {
    --pb-cream:   #f6efe6;
    --pb-card:    #fffdf9;
    --pb-ink:     #3b2f2a;
    --pb-muted:   #8c7d72;
    --pb-line:    #e7dccd;
    --pb-rose:    #d98b7d;
    --pb-rose-2:  #c26f60;
    --pb-gold:    #c99a4b;
    --pb-soft:    #f3e6dd;

    position: relative;
    box-sizing: border-box;
    height: 100vh;                 /* exakt Fensterhöhe — kein Scrollen, Überstand wird abgeschnitten */
    margin: -2rem;
    padding: 1.75rem;
    background: #ece2d8;
    color: var(--pb-ink);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 1.25rem;
    overflow: hidden;
}
@media (max-width: 768px) { .pb-hud { margin: -1rem; padding: 1.1rem; } }

/* Diorama als Hintergrund-Szene, mittig */
.pb-scene {
    position: absolute; inset: 0; z-index: 0; pointer-events: none;
    display: flex; align-items: center;
    padding-left: 30px;
}
.pb-scene img {
    position: relative;
    object-fit: contain;
    width: 65vw;
}

/* Ecken-Zonen */
.pb-zone { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.pb-zone--tl { grid-column: 1; grid-row: 1; align-self: start; flex-direction: row; align-items: center; gap: 1.75rem; }
.pb-head { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.pb-zone--tr { grid-column: 2; grid-row: 1; justify-self: end; width: 100%; max-width: 360px; }
.pb-zone--bl { grid-column: 1; grid-row: 3; align-self: stretch; }
.pb-zone--br { grid-column: 2; grid-row: 3; align-self: stretch; width: 100%; }
/* Untere Zonen gleich hoch: Karten füllen ihre (gleich hohen) Zonen komplett. */
.pb-zone--bl .pb-card, .pb-zone--br .pb-card { height: 100%; }

/* Kopf oben links */
.pb-eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--pb-rose-2); margin: 0 0 0.15rem; }
.pb-title { font-size: clamp(1.4rem, 2.8vw, 2rem); font-weight: 800; line-height: 1.1; margin: 0; color: var(--pb-ink); }
.pb-subtitle { font-size: 0.86rem; color: var(--pb-muted); margin: 0.25rem 0 0; }

/* Level-Navigation (Simulation): Pfeile links/rechts vom Titel */
.pb-title-nav { display: flex; align-items: center; gap: 0.6rem; }
.pb-nav { flex: none; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--pb-card); border: 1px solid var(--pb-line); color: var(--pb-rose-2);
    box-shadow: 0 4px 12px rgba(120, 80, 40, 0.10); text-decoration: none; transition: transform 0.12s, background 0.12s; }
.pb-nav:hover { background: var(--pb-soft); transform: translateY(-1px); }
.pb-nav.is-off { opacity: 0.32; box-shadow: none; cursor: default; }
.pb-sim-note { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--pb-rose-2); font-weight: 600; }
.pb-sim-note .icon { flex: none; }
.pb-sim-note a { color: var(--pb-rose-2); font-weight: 700; }

/* XP-Kreis */
.pb-xp { display: flex; align-items: center; gap: 1rem; flex: none; margin-top: 0;
    background: rgba(255, 253, 249, 0.82); border: 1px solid var(--pb-line); border-radius: 20px;
    padding: 0.6rem 1.1rem 0.6rem 0.7rem; box-shadow: 0 8px 22px rgba(120, 80, 40, 0.10);
    backdrop-filter: blur(3px); }
.pb-xp-ring { position: relative; width: 122px; height: 122px; flex: none; }
.pb-xp-ring::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--pb-card); box-shadow: 0 6px 18px rgba(120, 80, 40, 0.12); }
.pb-xp-ring svg { position: relative; transform: rotate(-90deg); display: block; }
.pb-xp-track { fill: none; stroke: var(--pb-soft); stroke-width: 9; }
.pb-xp-fill  { fill: none; stroke: var(--pb-gold); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.pb-xp-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pb-xp-num { font-size: 1.45rem; font-weight: 800; line-height: 1; color: var(--pb-ink); }
.pb-xp-cap { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--pb-muted); margin-top: 0.15rem; }
.pb-xp-meta { display: flex; flex-direction: column; gap: 0.1rem; }
.pb-xp-frac { font-size: 1.05rem; font-weight: 800; color: var(--pb-ink); }
.pb-xp-frac b { color: var(--pb-rose-2); }
.pb-xp-meta strong { font-size: 0.9rem; font-weight: 700; color: var(--pb-rose-2); }
.pb-xp-meta span { font-size: 0.78rem; color: var(--pb-muted); }

/* Card-Basis */
.pb-card {
    background: var(--pb-card); border: 1px solid var(--pb-line); border-radius: 16px;
    padding: 1.05rem 1.15rem; box-shadow: 0 8px 26px rgba(120, 80, 40, 0.10);
    display: flex; flex-direction: column; gap: 0.5rem;
}
.pb-card h3 { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pb-muted); margin: 0; }
.pb-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.pb-link { font-size: 0.78rem; font-weight: 700; color: var(--pb-rose-2); text-decoration: none; }
.pb-link:hover { text-decoration: underline; }
.pb-empty { font-size: 0.83rem; color: var(--pb-muted); margin: 0; }

/* Wochenfortschritt (oben rechts) */
.pb-week { flex-direction: row; align-items: center; gap: 0.9rem; }
.pb-week-body { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.pb-week-body h3 { font-size: 0.92rem; font-weight: 800; letter-spacing: 0; text-transform: none; color: var(--pb-ink); }
.pb-week-body p { margin: 0; font-size: 0.8rem; font-weight: 600; color: var(--pb-rose-2); }
.pb-week-art { flex: none; width: 56px; height: 56px; border-radius: 14px; background: var(--pb-soft); color: var(--pb-rose-2); display: flex; align-items: center; justify-content: center; }
.pb-bar { height: 9px; border-radius: 999px; background: var(--pb-soft); overflow: hidden; }
.pb-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--pb-gold), var(--pb-rose)); }

/* Beitrag erstellen (rechts, unter Wochenfortschritt) */
.pb-cta { flex-direction: row; align-items: center; gap: 0.85rem; text-decoration: none; background: linear-gradient(135deg, var(--pb-rose) 0%, var(--pb-rose-2) 100%); border-color: transparent; color: #fff; }
.pb-cta-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, 0.2); display: flex; align-items: center; justify-content: center; }
.pb-cta-body { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.pb-cta-title { font-weight: 800; font-size: 1rem; }
.pb-cta-sub { font-size: 0.78rem; color: rgba(255, 255, 255, 0.9); line-height: 1.35; }
.pb-cta > .icon { flex: none; opacity: 0.9; }
.pb-cta:hover { filter: brightness(1.04); }

/* Content-Ziele (rechts, unter „Beitrag erstellen") — manuell gepflegte Todo-Liste */
.pb-goals { gap: 0.55rem; }
.pb-goals-count { font-size: 0.82rem; font-weight: 600; color: var(--pb-muted); }
.pb-goals-count b { font-weight: 800; color: var(--pb-ink); }
.pb-goal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pb-goal { display: flex; align-items: center; gap: 0.6rem; padding: 0.42rem 0; }
.pb-goal + .pb-goal { border-top: 1px solid var(--pb-line); }
.pb-goal-toggle, .pb-goal-del { margin: 0; display: flex; flex: none; }
.pb-goal-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--pb-rose); background: transparent; color: var(--pb-rose-2); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.pb-goal-check:hover { background: var(--pb-soft); }
.pb-goal.is-done .pb-goal-check { background: var(--pb-soft); border-color: var(--pb-rose-2); }
.pb-goal-text { flex: 1; font-size: 0.9rem; color: var(--pb-ink); min-width: 0; line-height: 1.3; }
.pb-goal.is-done .pb-goal-text { color: var(--pb-muted); text-decoration: line-through; }
.pb-goal-del { opacity: 0; transition: opacity 0.15s; }
.pb-goal:hover .pb-goal-del { opacity: 1; }
.pb-goal-x { border: none; background: transparent; color: var(--pb-muted); cursor: pointer; padding: 2px; display: flex; }
.pb-goal-x:hover { color: var(--pb-rose-2); }
.pb-goal-add { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.15rem; }
.pb-goal-input { flex: 1; min-width: 0; border: 1px solid var(--pb-line); border-radius: 10px; padding: 0.42rem 0.65rem; font-size: 0.85rem; font-family: inherit; background: #fff; color: var(--pb-ink); }
.pb-goal-input::placeholder { color: var(--pb-muted); }
.pb-goal-input:focus { outline: none; border-color: var(--pb-rose); }
.pb-goal-plus { flex: none; width: 32px; height: 32px; border-radius: 10px; border: none; background: var(--pb-soft); color: var(--pb-rose-2); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.pb-goal-plus:hover { background: var(--pb-rose); color: #fff; }

/* Geplante Beiträge (unten links) */
.pb-plan-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6rem; }
@media (max-width: 1180px) { .pb-plan-row { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); } }
.pb-plan-item { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.pb-plan-thumb { aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--pb-soft); border: 1px solid var(--pb-line); display: flex; align-items: center; justify-content: center; color: var(--pb-muted); }
.pb-plan-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-plan-head { font-size: 0.8rem; font-weight: 700; line-height: 1.25; color: var(--pb-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pb-plan-plat { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; font-weight: 600; color: var(--pb-muted); }
.pb-plan-plat .icon { color: var(--pb-rose-2); flex: none; }

/* Raum-Upgrades (unten rechts) */
.pb-up-card h3 { font-size: 0.95rem; font-weight: 800; letter-spacing: 0; text-transform: none; color: var(--pb-ink); }
.pb-up-card h3 span { font-weight: 600; font-size: 0.85rem; color: var(--pb-muted); }
.pb-up-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; margin: 0.35rem 0 0.6rem; }
.pb-up { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.pb-up-circle { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--pb-soft); color: var(--pb-muted); border: 1px solid var(--pb-line); }
.pb-up-cap { font-size: 0.72rem; font-weight: 600; color: var(--pb-muted); }
.pb-up--done .pb-up-circle { background: var(--pb-gold); color: #fff; border-color: transparent; }
.pb-up--done .pb-up-cap { color: var(--pb-ink); }
.pb-up--current .pb-up-circle { background: linear-gradient(135deg, var(--pb-rose), var(--pb-rose-2)); color: #fff; border-color: transparent; box-shadow: 0 0 0 3px rgba(217, 139, 125, 0.25); }
.pb-up--current .pb-up-cap { color: var(--pb-ink); }
.pb-up-note { font-size: 0.78rem; color: var(--pb-muted); margin: 0; }

/* Leerer Zustand (kein Level-Katalog) */
.pb-hud-setup { position: relative; z-index: 1; grid-column: 1 / -1; grid-row: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 0.5rem; }
.pb-setup { max-width: 460px; color: var(--pb-muted); font-size: 0.9rem; line-height: 1.5; margin: 0.5rem 0 0; }
.pb-setup a { color: var(--pb-rose-2); font-weight: 600; }

/* Schmale Viewports: Ecken zu einer Spalte, Szene inline */
@media (max-width: 900px) {
    .pb-hud { grid-template-columns: 1fr; grid-template-rows: none; height: auto; min-height: 100vh; overflow: visible; }
    .pb-zone { max-width: none; width: auto; justify-self: stretch; align-self: stretch; grid-column: 1; grid-row: auto; }
    .pb-zone--tl { order: 1; } .pb-scene { position: relative; inset: auto; order: 2; padding: 0.5rem 0; }
    .pb-zone--tr { order: 3; } .pb-zone--bl { order: 4; } .pb-zone--br { order: 5; }
    .pb-scene img { max-width: 78%; max-height: 320px; }
}

/* ============================================================
   Personal-Branding-Shell (body[data-shell="personal"])
   Warmer „Dein Raum"-Look für Sidebar + User-Chip, Farben aus den
   Referenz-Screenshots. Greift nur, wenn der Nutzer den Personal-
   Dashboard-Modus gewählt hat; Enterprise-CI bleibt unberührt.
   ============================================================ */
body[data-shell="personal"] {
    --pb-cream:  #f6efe6;
    --pb-card:   #fffdf9;
    --pb-ink:    #3b2f2a;
    --pb-muted:  #8c7d72;
    --pb-line:   #e7dccd;
    --pb-rose:   #d98b7d;
    --pb-rose-2: #c26f60;
    --pb-gold:   #c99a4b;
    --pb-soft:   #f3e6dd;
}

/* Sidebar heller als der Content (Bühne = #ece2d8), feiner Schatten rechts */
body[data-shell="personal"] .app-sidebar {
    background: var(--pb-cream);
    border-right: 1px solid var(--pb-line);
    box-shadow: 3px 0 12px rgba(120, 80, 40, 0.08);
    z-index: 5;
}

/* Marke: goldener Serif-Schriftzug */
body[data-shell="personal"] .app-sidebar-brand-name {
    color: var(--pb-gold);
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0.02em;
}
body[data-shell="personal"] .app-sidebar-group-label { color: var(--pb-muted); opacity: 0.85; }

/* Nav-Links: inaktiv grau; aktiv = rosa Pille mit weinrotem Icon */
body[data-shell="personal"] .app-sidebar-link {
    color: var(--pb-muted);
    border-left-color: transparent;
    border-radius: 12px;
    margin: 2px 8px;
    padding: 0.55rem 0.85rem;
}
body[data-shell="personal"] .app-sidebar-link .app-sidebar-link-icon { color: #b3a99b; opacity: 1; }
body[data-shell="personal"] .app-sidebar-link:hover {
    background: var(--pb-soft);
    color: var(--pb-ink);
}
body[data-shell="personal"] .app-sidebar-link--active {
    background: #f4dbd7;
    color: var(--pb-rose-2);
    border-left-color: transparent;
    font-weight: 600;
}
body[data-shell="personal"] .app-sidebar-link--active .app-sidebar-link-icon { color: #8f2f2a; opacity: 1; }

/* User-Chip unten links (Screenshot 1): eigene Box mit rundem Avatar,
   „Willkommen," (geschwungen) über {Vorname} ♡, goldene Krone + Rolle + Chevron */
body[data-shell="personal"] .app-sidebar-user--personal {
    align-items: center;
    gap: 12px;
    margin: 10px;
    padding: 12px 14px;
    background: var(--pb-card);
    border: 1px solid var(--pb-line);
    border-radius: 18px;
    box-shadow: 0 6px 18px rgba(120, 80, 40, 0.10);
}
body[data-shell="personal"] .app-sidebar-user--personal:hover {
    border-color: #dccdb8;
    box-shadow: 0 8px 22px rgba(120, 80, 40, 0.14);
}
body[data-shell="personal"] .app-sidebar-user--personal.app-sidebar-user--active {
    border-color: var(--pb-rose);
}
body[data-shell="personal"] .app-sidebar-user--personal .nav-avatar,
body[data-shell="personal"] .app-sidebar-user--personal .nav-avatar-img {
    width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
}
body[data-shell="personal"] .app-sidebar-user--personal .nav-avatar {
    background: linear-gradient(135deg, var(--pb-rose), var(--pb-rose-2));
    color: #fff; font-weight: 700;
}
body[data-shell="personal"] .app-sidebar-user--personal .app-sidebar-user-name {
    display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
    color: var(--pb-ink);
    overflow: visible;
}
/* „Willkommen," — feiner, geschwungener Schriftzug (System-Script, keine externen Fonts) */
body[data-shell="personal"] .app-sidebar-user-greet {
    font-family: 'Snell Roundhand', 'Apple Chancery', 'Segoe Script', 'Brush Script MT', cursive;
    font-style: italic;
    font-weight: 400;
    font-size: 17px;
    line-height: 1;
    color: var(--pb-muted);
}
body[data-shell="personal"] .app-sidebar-user-first {
    display: flex; align-items: center; gap: 5px;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--pb-ink);
}
body[data-shell="personal"] .app-sidebar-user-heart { color: var(--pb-rose); font-size: 14px; line-height: 1; }
body[data-shell="personal"] .app-sidebar-user--personal .app-sidebar-user-role {
    display: flex; align-items: center; gap: 5px;
    color: var(--pb-rose-2);
    opacity: 1;
    font-size: 11px;
    font-weight: 600;
    margin-top: 5px;
    overflow: visible;
}
body[data-shell="personal"] .app-sidebar-user-crown { color: var(--pb-gold); display: inline-flex; }
body[data-shell="personal"] .app-sidebar-user-caret { color: var(--pb-muted); display: inline-flex; margin-left: auto; }

/* Akkordeon-/Manuell-Umschalter unten in der Sidebar hat im Personal-Brand-
   Look keine Funktion und zeigte nur eine verwaiste „1" — ausblenden. */
body[data-shell="personal"] .app-sidebar-mode-toggle-row { display: none; }

/* User-Chip darf nie breiter als die Sidebar werden: border-box + Rolle/Name
   kappen statt die Box zu sprengen. */
body[data-shell="personal"] .app-sidebar-user--personal {
    box-sizing: border-box;
    max-width: calc(100% - 20px);
    overflow: hidden;
}
body[data-shell="personal"] .app-sidebar-user--personal .app-sidebar-user-name,
body[data-shell="personal"] .app-sidebar-user--personal .app-sidebar-user-role {
    min-width: 0;
    max-width: 100%;
}

/* ---- Farbschema tab-übergreifend: die Enterprise-Design-Tokens im Personal-
   Shell auf die warme „Dein Raum"-Palette umbiegen, damit Profil, Radar,
   Content, Kalender, Performance & Einstellungen denselben Look wie das
   Dashboard tragen. Semantische Farben (success/error/warning) bleiben, damit
   Status erkennbar bleibt. ---- */
body[data-shell="personal"] {
    --color-primary:        var(--pb-rose-2);
    --color-primary-dark:   #a8574a;
    --color-primary-light:  var(--pb-soft);
    --color-bg:             #efe6da;
    --color-surface:        var(--pb-card);
    --color-surface-hover:  var(--pb-soft);
    --color-text:           var(--pb-ink);
    --color-text-muted:     var(--pb-muted);
    --color-text-light:     #a89a8d;
    --color-border:         var(--pb-line);
    --color-border-light:   #f0e7db;
    --color-favorite:       var(--pb-gold);
}
/* Content-Fläche selbst warm einfärben (der .main-Hintergrund liegt hinter den
   Karten) und die weiße Trennlinie am linken Content-Rand entfernen. */
body[data-shell="personal"] .main {
    background: var(--color-bg);
    border-left: none;
    box-shadow: none;
}

/* Der globale Content-Zoom (ci_scale, per CI einstellbar) skaliert die
   Content-Region — bei der vollflächigen HUD (height:100vh) drückt selbst ein
   1.05er Zoom sie 36px über den Viewport → Scrollbalken. Die HUD bringt ihre
   eigene Größenlogik mit, daher hier den Content-Zoom auf 1 zurücknehmen. */
body[data-shell="personal"] .main .container { zoom: 1; }

/* Chatbot-Detailseite: Formular links, Einbindung/Demo/Sicherheit rechts */
.wissen-chatbot-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 0 1rem; align-items: start; }
.wissen-chatbot-layout--neu { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
.wissen-chatbot-layout .form-footer { display: flex; align-items: center; gap: 0.5rem; }
@media (max-width: 1100px) { .wissen-chatbot-layout { grid-template-columns: minmax(0, 1fr); } }

/* ===== Datengruppen (Live-Daten) ===== */
.badge--warn { background: #fef3c7; color: #92400e; }
.page-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.radio-zeile { display: block; margin: 0.25rem 0; font-weight: normal; }

/* Records-Tabelle */
.table-card { padding: 0; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 0.6rem 0.9rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.data-table th { font-size: 0.8rem; color: var(--color-text-muted); font-weight: 600; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table-actions { text-align: right; white-space: nowrap; }

/* Gruppen-Bereich auf der Daten-Seite */
.wissen-gruppen { margin: 0 0 1.75rem; }
.wissen-gruppen-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; }
.wissen-gruppen-kopf h2 { font-size: 1.05rem; margin: 0; }
.wissen-gruppen-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.wissen-gruppe-karte { display: flex; flex-direction: column; gap: 0.85rem; padding: 1.15rem 1.25rem; border: 1px solid var(--color-border); border-radius: 14px; background: var(--color-surface); text-decoration: none; color: var(--color-text); transition: background 0.15s, border-color 0.15s, box-shadow 0.15s; }
.wissen-gruppe-karte:hover { background: var(--color-surface-hover); border-color: var(--color-primary); box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.wissen-gruppe-kopf { display: flex; align-items: center; gap: 0.6rem; }
.wissen-gruppe-icon { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--color-bg); color: var(--color-primary); }
.wissen-gruppe-name { font-weight: 700; font-size: 1.02rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wissen-gruppe-zahl { font-size: 0.9rem; color: var(--color-text-muted); }
.wissen-gruppe-zahl strong { font-size: 1.5rem; font-weight: 800; color: var(--color-text); margin-right: 0.15rem; }
.wissen-gruppe-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; }

/* Nachtraegliches Umbenennen einer Datengruppe (Detailansicht) */
.wissen-rename { margin-top: 0.5rem; font-size: 0.82rem; }
.wissen-rename > summary { display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; color: var(--color-text-muted); list-style: none; width: fit-content; }
.wissen-rename > summary::-webkit-details-marker { display: none; }
.wissen-rename > summary:hover { color: var(--color-primary); }
.wissen-rename-form { display: flex; gap: 0.5rem; margin-top: 0.55rem; max-width: 480px; }
.wissen-rename-form input[type="text"] { flex: 1; padding: 0.45rem 0.6rem; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-bg); color: inherit; font: inherit; }

/* Feld-Maske eines Datengruppen-Datensatzes (Dokument-Detail, statt Markdown) */
.wissen-maske { display: flex; flex-direction: column; gap: 1.25rem; }
.wissen-maske-felder { margin: 0; display: flex; flex-direction: column; }
.wissen-maske-feld { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--color-border); }
.wissen-maske-feld:last-child { border-bottom: none; }
.wissen-maske-feld dt { margin: 0; font-size: 0.82rem; font-weight: 600; color: var(--color-text-muted); }
.wissen-maske-feld dd { margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--color-text); word-break: break-word; }
.wissen-maske-liste { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.2rem; }
.wissen-maske-gruppe { border: 1px solid var(--color-border); border-radius: 12px; padding: 0.5rem 1.1rem 0.9rem; background: var(--color-surface); }
.wissen-maske-gruppe > h3 { font-size: 0.92rem; margin: 0.6rem 0 0.3rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--color-border); color: var(--color-primary); }
.wissen-maske-gruppe .wissen-maske-gruppe { margin-top: 0.75rem; background: var(--color-bg); }
@media (max-width: 640px) { .wissen-maske-feld { grid-template-columns: 1fr; gap: 0.2rem; } }

/* Mapping-Maske (WYSIWYG: Vorschau links gross, Mapping rechts) */
.mapping-app { margin-top: 1rem; }
.mapping-wysiwyg { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }

/* Buehne — die Vorschau als Editierflaeche */
.mapping-buehne { min-width: 0; }
.buehne-toolbar { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.buehne-beispiel { margin-left: auto; }
.buehne-karte { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); padding: 1rem 1.25rem; }
.v-titel { font-size: 1.35rem; margin: 0 0 0.75rem; }
.v-dropzone { min-height: 12px; display: flex; flex-direction: column; gap: 0.3rem; padding: 0.15rem; border-radius: var(--radius); }
.v-dropzone.is-dragover { outline: 2px dashed var(--color-primary); outline-offset: 2px; background: var(--color-primary-light); }

.v-feld { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.4rem; border-radius: var(--radius); }
.v-feld:hover { background: var(--color-surface-hover); }
.v-feld.is-dragging { opacity: 0.5; }
.v-feld--komposit { background: var(--color-primary-light); }
.v-feld-sel { flex: 0 0 auto; }
.v-feld-griff { color: var(--color-text-muted); cursor: grab; }
.v-feld-label { flex: 0 0 auto; width: 160px; font-weight: 600; border: 1px solid transparent; background: transparent; padding: 0.15rem 0.3rem; border-radius: 4px; }
.v-feld-label:hover, .v-feld-label:focus { border-color: var(--color-border); background: var(--color-bg); }
.v-feld-sep { color: var(--color-text-muted); }
.v-feld-wert { flex: 1; min-width: 0; }
.v-feld-liste { flex: 1; margin: 0; padding-left: 1.1rem; }
.v-feld-badge { font-size: 0.68rem; color: var(--color-primary); border: 1px solid var(--color-primary); border-radius: 3px; padding: 0 0.3rem; }
.v-leer { color: var(--color-text-muted); list-style: none; }
.v-feld-x { flex: 0 0 auto; }

.v-gruppe { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 0.5rem 0.6rem; margin: 0.6rem 0; }
.v-gruppe-kopf { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.35rem; }
.v-gruppe-name { flex: 1; font-weight: 700; border: 1px solid transparent; background: transparent; padding: 0.15rem 0.3rem; border-radius: 4px; }
.v-gruppe-name:hover, .v-gruppe-name:focus { border-color: var(--color-border); background: var(--color-bg); }
.v-untergruppen { margin-left: 1rem; border-left: 2px solid var(--color-border); padding-left: 0.6rem; }

/* Sidebar — kompaktes Feld-/Rollen-Mapping */
.mapping-seite { position: sticky; top: 1rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); padding: 0.85rem 1rem; }
.seite-titel { font-weight: 700; margin-bottom: 0.2rem; }
.seite-hint { font-size: 0.78rem; color: var(--color-text-muted); margin: 0 0 0.6rem; }
.seite-felder { display: flex; flex-direction: column; gap: 0.35rem; max-height: 60vh; overflow-y: auto; }
.seite-feld { display: flex; align-items: center; gap: 0.5rem; }
.seite-feld-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.seite-feld-pfad { font-family: monospace; font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seite-feld-sample { font-size: 0.72rem; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seite-feld-rolle { flex: 0 0 auto; }
.seite-save { margin-top: 0.85rem; width: 100%; }

/* Zusammenfassen-Dialog */
.mapping-dialog-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.mapping-dialog { background: var(--color-surface); border-radius: var(--radius); padding: 1.25rem; width: min(460px, 92vw); box-shadow: var(--shadow-lg); }
.mapping-dialog h3 { margin: 0 0 0.5rem; }
.mapping-dialog-feld { display: block; margin: 0.6rem 0; font-size: 0.85rem; }
.mapping-dialog-feld input, .mapping-dialog-feld select { width: 100%; margin-top: 0.2rem; }
.mapping-dialog-vorschau { margin: 0.6rem 0; padding: 0.5rem 0.6rem; background: var(--color-bg); border-radius: var(--radius); font-size: 0.85rem; }
.mapping-dialog-foot { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.75rem; }

.wissen-rechte-subhead { font-size: 0.9rem; margin: 1rem 0 0.4rem; color: var(--color-text-muted); }

@media (max-width: 900px) { .mapping-wysiwyg { grid-template-columns: minmax(0, 1fr); } .mapping-seite { position: static; } }

/* Daten: Mehrfachauswahl + Sammel-Löschen */
.data-table .tk-check { width: 34px; text-align: center; }
.wissen-bulkbar { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; background: var(--color-primary-light); border: 1px solid var(--color-primary); border-radius: var(--radius); }
.wissen-bulkbar[hidden] { display: none; }
/* Chatbot: Datenquellen-Picker (Datengruppen + externe Quellen) */
.wissen-quellen-picker { display: flex; flex-direction: column; gap: 0.15rem; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 0.4rem 0.5rem; max-height: 240px; overflow-y: auto; }
.wissen-quelle-option { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.35rem; border-radius: calc(var(--radius) - 3px); font-size: 0.9rem; cursor: pointer; }
.wissen-quelle-option:hover { background: var(--color-surface-hover); }
.wissen-quelle-option .wissen-quelle-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Datenqualität: „Wissen ergänzen"-Formular (Text/Datei-Umschalter) */
.wissen-ergaenzen-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; }
.wissen-ergaenzen-tabs .chip { cursor: pointer; }
.wissen-ergaenzen-tabs .chip input { margin-right: 0.35rem; }
.wissen-ergaenzen-tabs .chip:has(input:checked) { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary); }
.wissen-ergaenzen-form .form-group { margin-bottom: 0.75rem; }
/* Chatbot-Liste als Kacheln — 3 pro Zeile, mit Nutzungs-Stats + 7-Tage-Chart */
.wissen-bot-karten { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 1024px) { .wissen-bot-karten { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .wissen-bot-karten { grid-template-columns: 1fr; } }
.wissen-bot-karte { display: flex; flex-direction: column; gap: 0.6rem; padding: 1.25rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); color: var(--color-text); text-decoration: none; transition: border-color 0.12s, box-shadow 0.12s; }
.wissen-bot-karte:hover { border-color: var(--color-primary); box-shadow: var(--shadow); text-decoration: none; }
.wissen-bot-karte-kopf { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.wissen-bot-name { font-weight: 600; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wissen-bot-titel { font-size: 0.86rem; }
.wissen-bot-scope { font-size: 0.8rem; display: flex; align-items: center; gap: 0.4rem; }
.wissen-bot-scope svg { color: var(--color-text-muted); flex: 0 0 auto; }
.wissen-bot-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; margin-top: 0.35rem; padding-top: 0.75rem; border-top: 1px solid var(--color-border); }
.wissen-bot-stat { display: flex; flex-direction: column; gap: 0.1rem; }
.wissen-bot-stat-wert { font-size: 1.15rem; font-weight: 600; color: var(--color-text); font-variant-numeric: tabular-nums; }
.wissen-bot-stat-label { font-size: 0.72rem; color: var(--color-text-muted); }
.wissen-bot-chart-titel { font-size: 0.72rem; margin-top: 0.35rem; }
.wissen-bot-chart { display: flex; align-items: flex-end; gap: 5px; height: 52px; }
.wissen-bot-bar { flex: 1; min-height: 3px; background: var(--color-primary); opacity: 0.85; border-radius: 3px 3px 0 0; transition: opacity 0.12s; }
.wissen-bot-karte:hover .wissen-bot-bar { opacity: 1; }
/* Chatbot-Detail: häufigste Fragen (Top 5) */
.wissen-topfragen { margin: 0.25rem 0 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: 0.4rem; }
.wissen-topfragen li { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.wissen-topfrage-text { min-width: 0; }
.wissen-topfrage-count { flex: 0 0 auto; color: var(--color-text-muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
/* Kompakte Variante in der Chatbot-Kachel: lange Fragen einzeilig kürzen */
.wissen-topfragen--kompakt { padding-left: 1.2rem; gap: 0.25rem; font-size: 0.82rem; }
.wissen-topfragen--kompakt li { color: var(--color-text); }
.wissen-topfragen--kompakt .wissen-topfrage-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wissen-topfragen--kompakt .wissen-topfrage-count { font-size: 0.76rem; }
.wissen-bulkbar-info { font-weight: 600; }
.btn--danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn--danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* Datengruppe: Indexierungs-Fortschritt */
.wissen-index-fortschritt { margin-bottom: 1rem; }
.fortschritt-kopf { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.5rem; }
.fortschritt-bar { height: 8px; background: var(--color-bg); border-radius: 999px; overflow: hidden; }
.fortschritt-bar-fill { height: 100%; background: var(--color-primary); border-radius: 999px; transition: width 0.5s ease; }
.fortschritt-hinweis { font-size: 0.8rem; margin-top: 0.5rem; }
