/* === 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-link, 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;
}
/* Logo-Darstellung: ENTWEDER neben dem Schriftzug (--mark, Default) ODER ueber
   die volle Breite mit Titel darunter (--full). Das Logo kann optional eine eigene
   Hintergrundfarbe bekommen (ci_logo_bg = "Marke"), unabhaengig von der Sidebar-
   Farbe — z. B. ein schwarzes Logo auf gelbem Grund. */
.app-sidebar-brand-logo-link { display: inline-flex; text-decoration: none; min-width: 0; }
.app-sidebar-brand-box { display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.app-sidebar-brand-box--bg { padding: 5px 7px; border-radius: 8px; }
.app-sidebar-brand-img { display: block; max-width: 100%; height: auto; }

/* Modus "neben dem Schriftzug": kompaktes Logo in Zeilenhoehe, Titel daneben. */
.app-sidebar-brand--mark .app-sidebar-brand-box { height: 30px; }
.app-sidebar-brand--mark .app-sidebar-brand-box--bg { height: 36px; }
.app-sidebar-brand--mark .app-sidebar-brand-img { height: 100%; width: auto; max-width: 140px; }

/* Modus "volle Breite": Logo oben, Titel darunter. Die Breite (ci_logo_width)
   steht als Inline-Style am Link; Box und Bild fuellen sie. */
.app-sidebar-brand--full {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    position: relative;
}
.app-sidebar-brand--full .app-sidebar-brand-logo-link { align-self: center; max-width: 100%; }
.app-sidebar-brand--full .app-sidebar-brand-box { width: 100%; }
.app-sidebar-brand--full .app-sidebar-brand-img { width: 100%; }
.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: spart Hoehe. */
.app-sidebar-brand--full .app-sidebar-collapse-btn {
    position: absolute;
    top: 0;
    right: 0;
}

/* Eingeklappte Icon-Rail (66px): kein Platz fuers Logo — ausblenden, die Rail
   zeigt nur den Aufklapp-Button (siehe unten). */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-brand-logo-link { display: none; }

.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;
    line-height: 1.4;
}

/* Gruppen-Ueberschrift in der Nav (manifest.nav_group + config app.nav_groups).
   Standardmaessig NICHT eingerueckt: linksbuendig mit der linken Kante der
   Link-Pills (padding-left 0), einheitlich ueber alle Projekte. */
.app-sidebar-group-label {
    padding: 1.5rem 0.5rem 0.35rem 0;
    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)); }
/* Eingeklappt: der Button bleibt sichtbar und ist der Aufklapp-Ausloeser (der
   frueher nur bei Hover erschienene Zustand ist jetzt der Standard). Zentriert in
   der Rail, Pfeil nach rechts gedreht (= aufklappen); die --full-Absolutposition
   wird zurueckgenommen. */
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-collapse-btn {
    margin: 0 auto;
    opacity: 0.85;
}
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-brand--full .app-sidebar-collapse-btn { position: static; }
body[data-layout="sidebar"][data-sidebar-collapsed="1"] .app-sidebar-collapse-btn svg { transform: rotate(180deg); }

/* 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; }
/* CI-Panel: breiter Formularbereich links (fliesst intern zweispaltig, siehe
   .ci-form-grid in components.css), schmale Vorschau-/Theme-Spalte rechts. */
.split--ci { grid-template-columns: minmax(0, 1fr) 280px; }
.split > div > .card + .card { margin-top: 1rem; }
/* Rechte CI-Spalte scrollt mit, bleibt aber am oberen Rand haengen. */
.split--ci .ci-side { position: sticky; top: 1rem; }
.split--ci .ci-side .card + .card { margin-top: 1rem; }

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

.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-group { margin-bottom: 1.125rem; }

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

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

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

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

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

/* --accent-gradient kommt aus CI (ci-style.php) oder einem Projekt-Theme;
   ohne Wert flacher Primaerfarben-Button. Hover dunkelt per filter ab,
   damit auch ein Verlauf sichtbar reagiert (Background-Tausch wuerde ihn ersetzen). */
.btn--primary { background: var(--accent-gradient, var(--color-primary)); color: var(--btn-text, #fff); }
/* Hover bewusst dezent (CI-Default): der Verlauf bleibt sichtbar, nur leicht abgedunkelt. */
.btn--primary:hover { filter: brightness(0.96); color: var(--btn-text, #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-Logo: Standardgroesse (beide Themes). Die Anzeige-Breite ist per CI
   (ci_login_logo_width) uebersteuerbar — dann setzt das Partial inline max-width. */
.login-branding-logo-img { max-width: 200px; max-height: 90px; height: auto; width: auto; display: block; margin: 0 auto; }
/* Frei editierbarer Login-Text (CI ci_login_text) unter dem Logo — bewusst
   praesent: fett und groesser, als Begruessung/Wortmarke unter dem Logo. */
.login-branding-text { margin: 0.85rem auto 0; max-width: 360px; font-size: 1.6rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; color: var(--color-text); }
.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;
}

/* Sicherheitsnetz gegen „Popup oben links":
   Der kanonische Weg oeffnet ein Popup ueber [data-modal-open] / das hidden-
   Attribut — nie ueber inline display. Setzt jemand es doch per
   `el.style.display = 'block'`, wuerde inline `block` die Flex-Zentrierung
   aushebeln und der Inhalt klebte oben links. In genau diesem Fall erzwingen
   wir flex zurueck, damit das Popup trotzdem mittig sitzt. `display:none`
   (verstecken) bleibt unberuehrt. */
.modal[style*="display:block"],   .modal[style*="display: block"],
.am-modal[style*="display:block"], .am-modal[style*="display: block"] {
    display: flex !important;
}

/* === Legacy-Popup „.am-modal" (Herkunft: CRM/Automation-Projekt) ===
 * Neue Popups nehmen .modal (siehe oben) — das ist der dokumentierte Weg.
 * Diese Alt-Konvention wird hier trotzdem ZENTRIERT bereitgestellt, damit ein
 * .am-modal in JEDEM Projekt mittig sitzt und nicht nur dort, wo zufaellig eine
 * projekteigene modal.css mitliegt. Getoggelt wird per inline display
 * (JS: `style.display = 'flex'`); die Basis steht daher auf flex, ein inline
 * display:none blendet aus. Markup: .am-modal > (.am-modal-overlay + .am-modal-content). */
.am-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.am-modal-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
.am-modal-content {
    position: relative;
    z-index: 1;
    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: 95%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.am-modal-content > form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.am-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;
}
.am-modal-header h2, .am-modal-header h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.am-modal-close:not(.btn) {
    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);
}
.am-modal-close:not(.btn):hover { background: var(--color-bg); color: var(--color-text); }
.am-modal-body { padding: 1.25rem; flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.am-modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}
body.am-modal-open { overflow: hidden; }

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

/* --- CI-Panel: Formular in thematische Abschnitte, zweispaltig (Masonry) ---
   Jeder .ci-section-Block bleibt beim Umbruch ganz (break-inside: avoid). Bei
   Platzmangel faellt columns auf eine Spalte zurueck. */
.ci-form-grid { columns: 2 17rem; column-gap: 1rem; }
.ci-section {
    break-inside: avoid;
    margin: 0 0 1rem;
    padding: 0.9rem 1rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}
.ci-section > h4 {
    margin: 0 0 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border-light, var(--color-border));
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-text);
}
.ci-section .crm-field + .crm-field { margin-top: 0.9rem; }
/* Farben im Raster statt untereinander: zwei Spalten, Abstand ueber gap
   (die Abschnitts-Adjacency-Regel oben wird hier neutralisiert). */
.ci-color-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem 0.75rem; margin-bottom: 0.9rem; }
.ci-color-grid .crm-field + .crm-field { margin-top: 0; }
.ci-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.25rem; }

/* Klickbares Logo-Feld: die Anzeige (Label) oeffnet den Dateidialog; Hover
   zeigt „Ändern". Kein separater Datei-Button. Selektoren mit .crm-field-Praefix,
   damit sie die generischen .crm-field label/input-Regeln ueberstimmen. */
.crm-field .logo-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    min-height: 56px;
    max-width: 220px;
    margin-bottom: 0;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: inherit;
    font-weight: 400;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s, background .15s;
}
.crm-field .logo-picker:hover { border-color: var(--color-primary); }
.crm-field .logo-picker:not(.logo-picker--filled) { border-style: dashed; }
.crm-field .logo-picker:not(.logo-picker--filled):hover { background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface)); }
.crm-field .logo-picker--sm { min-width: 52px; min-height: 52px; }
.crm-field .logo-picker-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.crm-field .logo-picker-img { max-width: 100%; max-height: 64px; height: auto; width: auto; object-fit: contain; }
.crm-field .logo-picker--sm .logo-picker-img { max-height: 40px; }
.crm-field .logo-picker-empty { color: var(--color-text-muted); font-size: 0.85rem; padding: 0.35rem 0.55rem; text-align: center; }
.crm-field .logo-picker-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity .15s;
    pointer-events: none;
}
.crm-field .logo-picker--filled:hover .logo-picker-overlay { opacity: 1; }
.crm-field .logo-picker-remove { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0.4rem 0 0; font-weight: 400; font-size: 0.8rem; color: var(--color-text-muted); cursor: pointer; }

/* --- 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;
    }
}
/* ============================================================================
   Postadress Kunden-Cockpit — CI-Feinschliff (Projekt-Erweiterungspunkt)
   Leitbild deutschepost.de/postadress: Post-Gelb als Markenflaeche, Weiss und
   warmes Hellgrau als Ruhe, Text anthrazit, Rot ausschliesslich fuer Buttons.
   Der Core leitet aus ci_accent auch Links, aktive Nav und Charts ab — das
   wird hier gezielt zurueckgenommen, damit Rot nicht alles dominiert.
   ========================================================================== */

/* Sidebar (Post-Gelb): aktiver Eintrag dunkel auf Gelb — wie die Website-
   Navigation (schwarz auf gelb) statt Akzent-Rot. */
body[data-layout="sidebar"] .app-sidebar-link--active {
    /* Toenung aus der Sidebar-Textfarbe: dunkel auf Gelb, hell auf Dunkel —
       funktioniert fuer jede unter /einstellungen gewaehlte Sidebar-Farbe. */
    background: color-mix(in srgb, var(--sidebar-ink-strong, #1d1d1b) 14%, transparent);
    color: var(--sidebar-ink-strong, #1d1d1b);
}
body[data-layout="sidebar"] .app-sidebar-link--active .app-sidebar-link-icon { color: inherit; }
.app-sidebar-group-label { color: var(--sidebar-ink-strong, #1d1d1b); opacity: 0.55; }

/* Links im Inhalt: anthrazit mit dezenter Unterstreichung; Rot bleibt den
   Primaer-Buttons vorbehalten (Website: viel Text, wenige rote CTAs). */
main.main a:not(.btn):not(.tab) {
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--color-text) 28%, transparent);
    text-underline-offset: 2px;
}
main.main a:not(.btn):not(.tab):hover {
    color: var(--color-primary);
    text-decoration-color: currentColor;
}
/* Ausnahme: Links, die als Flaeche funktionieren — Kacheln, Listenzeilen,
   Schritt-Reiter. Sie sind Knoepfe, keine Fliesstext-Links, und brauchen die
   Unterstreichung nicht. Die Regel oben ist spezifischer als eine reine
   Klassenregel, deshalb steht die Ausnahme hier und nicht beim Bauteil. */
main.main a.mlg-name:not(.btn):not(.tab),
main.main a.mlg-ordner-kachel:not(.btn):not(.tab),
main.main a.mlg-archivlink:not(.btn):not(.tab),
main.main a.lp-vorschau:not(.btn):not(.tab),
main.main a.frm-schritt:not(.btn):not(.tab),
main.main a.stat-kachel:not(.btn):not(.tab),
main.main a.pa-attr:not(.btn):not(.tab) {
    text-decoration: none;
}
main.main a.mlg-name:not(.btn):not(.tab):hover { text-decoration: underline; }

/* Charts: Post-Gelb statt Akzent-Rot als Primaerserie (DP-Reporting-Optik). */
.chart {
    --color-primary: #f2c200;
    --color-primary-light: rgba(255, 204, 0, 0.22);
}

/* Tabs/Reiter (falls im Core genutzt): aktiver Tab anthrazit statt rot. */
.tab--active { color: var(--color-text); }

/* Kundenakte (cockpit/kunde): Hauptspalte + rechte Sidebar (Vertraege, Timeline). */
.pa-detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .pa-detail { grid-template-columns: 1fr; } }
.pa-detail .section-title { margin-top: 0; }

/* Kommunikations-/Aktivitaetszeile (wie im CRM: Icon-Kreis + Betreff + Datum). */
.pa-act { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.65rem 0; border-bottom: 1px solid var(--color-border); }
.pa-act:last-child { border-bottom: 0; padding-bottom: 0; }
.pa-act:first-child { padding-top: 0; }
.pa-act-icon { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--color-chart2, #f2c200) 28%, var(--color-surface)); color: var(--color-text); }

/* Stammdaten-Definitionsliste: Label/Wert-Zeilen. */
.pa-dl { display: grid; grid-template-columns: 9rem 1fr; gap: 0.4rem 0.75rem; font-size: 0.85rem; margin: 0; }
.pa-dl dt { color: var(--color-text-muted); margin: 0; }
.pa-dl dd { margin: 0; }

/* KPI-Kacheln: Badge oben rechts statt unter dem Wert (spart Hoehe). */
.pa-kpi-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.pa-kpi-label { font-size: 0.78rem; color: var(--color-text-muted); }
.pa-kpi-head .badge { flex: 0 0 auto; white-space: nowrap; }
.pa-kpi-value { font-size: 1.55rem; font-weight: 700; line-height: 1; margin-top: 0.4rem; }

/* Auswertungen: Hauptspalte (3/4) + rechte Sidebar (1/4). */
.pa-aw { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .pa-aw { grid-template-columns: 1fr; } }

/* Zweispaltiges Boxen-Raster mit Umschalter (Churn-Radar, Datenabgleich). */
.pa-cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.pa-cols2.is-single { grid-template-columns: 1fr; }
.pa-cols2 > [hidden] { display: none !important; }
@media (max-width: 1100px) { .pa-cols2 { grid-template-columns: 1fr; } }

/* Betreuer: Aufgaben-Zeile — Kunde links, Typ-Tag rechtsbuendig. */
.pa-task-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }

/* Datenabgleich: vier Bereiche nebeneinander; Einzelauswahl (is-single)
   zieht die gewaehlte Box auf volle Breite. In der 4er-Ansicht werden die
   Tabellenzeilen kompakt gestapelt (Kunde, darunter EKP + Quellen). */
.pa-cols4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.pa-cols4.is-single { grid-template-columns: 1fr; }
.pa-cols4 > [hidden] { display: none !important; }
.pa-cols4:not(.is-single) .pa-desc { font-size: 0.75rem; }
.pa-cols4:not(.is-single) .section-title { font-size: 0.95rem; }
/* 4er-Ansicht: nur die Spalte "Kunde" mit Kopfzeile — EKP und Quellen
   sind ausgeblendet (volle Tabelle erscheint bei Einzelauswahl). */
.pa-cols4:not(.is-single) table { table-layout: auto; }
.pa-cols4:not(.is-single) colgroup { display: none; }
.pa-cols4:not(.is-single) th:nth-child(n+2),
.pa-cols4:not(.is-single) td:nth-child(n+2) { display: none; }
.pa-cols4:not(.is-single) td:first-child { font-size: 0.85rem; }
@media (max-width: 1150px) { .pa-cols4:not(.is-single) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .pa-cols4 { grid-template-columns: 1fr; } }


/* ==========================================================================
   Newsletter-Modul (portiert aus dem hederlab-CRM): Basisklassen + Builder.
   ========================================================================== */
.hl-muted { color: var(--color-text-muted); }
/* Verlinkte Namen (Kontakt, Unternehmen, Event, Beleg, ...) stehen in
   Textfarbe statt in der Akzentfarbe — in einer Liste ist praktisch jeder
   Name ein Link, eine ganze Spalte in Rot liest sich als Warnung. Der
   Akzent bleibt Aktionen vorbehalten und kommt beim Hover zurueck.
   Die Ausnahmen stehen in :where() und zaehlen damit NICHT zur Spezifitaet:
   die Regel bleibt bei 0-1-1 und laesst sich spaeter normal uebersteuern. */
.main a:not(:where(.btn, .badge, .tab, .hl-chip, .hl-muted, .breadcrumb *, .list-pagination *, .hl-rte *)) {
    color: var(--color-text);
}
.main a:not(:where(.btn, .badge, .tab, .hl-chip, .hl-muted, .breadcrumb *, .list-pagination *, .hl-rte *)):hover {
    color: var(--color-primary);
}
.hl-card-link { cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.hl-card-link:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08); }
.hl-act-icon {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
    color: var(--color-primary);
}
.hl-act-icon svg { width: 15px; height: 15px; }
/* Native <dialog>-Modals (bewusst NICHT die Core-.modal-Klasse — die ist für
   div-Overlays und erzwingt display:flex, was geschlossene Dialoge sichtbar
   machen würde). */
dialog.hl-modal {
    position: fixed;
    inset: 0;
    margin: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 1.2rem 1.4rem;
    width: calc(100% - 2rem);
    max-width: 460px;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
dialog.hl-modal::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog.hl-modal label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.6rem 0 0.15rem; }
dialog.hl-modal input:not([type="checkbox"]):not([type="radio"]),
dialog.hl-modal select,
dialog.hl-modal textarea { width: 100%; }
/* Editor-Layout (Mailing/Newsletter): links Formular, rechts Mail-Vorschau */
.hl-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.hl-mail-frame { display: block; width: 100%; height: 780px; border: 0; background: #f5f4f7; }
/* Newsletter-Block-Editor */
.hl-sticky { position: sticky; top: 1rem; }
/* Vorlagen-Editor */
.hl-color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.hl-color { display: flex; align-items: center; gap: 0.6rem; font-size: 0.82rem; font-weight: 600; border: 1px solid var(--color-border-light); border-radius: 8px; padding: 0.4rem 0.6rem; cursor: pointer; }
.hl-color input[type="color"] { width: 38px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; flex-shrink: 0; }

/* ============================================================
   Newsletter-Builder: Palette+Struktur | Canvas | Eigenschaften
   Overlays (Block-/Text-Werkzeuge) liegen bewusst im Eltern-
   dokument über dem iframe — so landen sie nie im Export-HTML.
   ============================================================ */
.eb-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.eb-top-left { display: flex; align-items: center; gap: 0.7rem; }
.eb-top-right { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
#save-state.is-dirty { color: var(--hl-orange); font-weight: 600; }

.eb-seg { display: inline-flex; border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; }
.eb-seg-btn { border: 0; background: var(--color-surface); color: var(--color-text-muted); padding: 0.3rem 0.5rem; cursor: pointer; display: inline-flex; }
.eb-seg-btn.is-active { background: color-mix(in srgb, var(--color-primary) 12%, transparent); color: var(--color-primary); }

/* Drei Spalten mit Ziehgriffen dazwischen; die Breiten stehen in --eb-links /
   --eb-rechts und werden im Builder gesetzt (localStorage). */
.eb-builder { display: grid; grid-template-columns: var(--eb-links, 264px) 8px minmax(0, 1fr) 8px var(--eb-rechts, 300px); gap: 0.25rem; align-items: stretch; grid-template-rows: 1fr; height: calc(100vh - 150px); min-height: 560px; }
@media (max-width: 1400px) { .eb-builder { grid-template-columns: var(--eb-links, 232px) 8px minmax(0, 1fr) 8px var(--eb-rechts, 272px); } }
@media (max-width: 1100px) { .eb-builder { grid-template-columns: 1fr; gap: 0.8rem; } .eb-split { display: none; } }
.eb-split { position: relative; cursor: col-resize; touch-action: none; }
.eb-split::before { content: ""; position: absolute; left: 50%; top: 10px; bottom: 10px; width: 3px; transform: translateX(-50%); border-radius: 3px; background: var(--color-border); transition: background .12s; }
.eb-split:hover::before, .eb-split.is-drag::before { background: var(--color-primary); }
.eb-split:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; border-radius: 4px; }
body.eb-resizing-side { cursor: col-resize; user-select: none; }

.eb-side { display: grid; grid-template-rows: auto 1fr; gap: 0.8rem; min-height: 0; min-width: 0; }
.eb-panel { background: var(--color-surface); border: 1px solid var(--color-border-light); border-radius: var(--radius); overflow: hidden; }
.eb-panel-head { padding: 0.6rem 0.8rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border-light); }
.eb-panel--grow { display: flex; flex-direction: column; min-height: 0; }
.eb-panel--grow > :last-child { overflow-y: auto; min-height: 0; }

/* Palette */
.eb-palette { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3rem; padding: 0.5rem; }
/* display aus der Klasse schlaegt sonst das hidden-Attribut der Reiter. */
.eb-palette[hidden] { display: none; }
.eb-pal { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem; padding: 0.4rem 0.2rem; min-height: 58px; border: 1px solid var(--color-border-light); border-radius: 9px; background: var(--color-surface); cursor: grab; font-size: 0.66rem; font-weight: 600; line-height: 1.15; color: var(--color-text); transition: background .15s, border-color .15s, transform .12s; text-align: center; }
.eb-pal:hover { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 6%, transparent); }
.eb-pal:active { cursor: grabbing; transform: scale(0.97); }
.eb-pal-ico { font-size: 0.95rem; line-height: 1.1; color: var(--color-primary); }

/* Struktur-Baum */
.eb-tree { padding: 0.5rem; display: grid; grid-template-rows: auto auto 1fr auto; gap: 0.3rem; overflow: hidden; min-height: 0; }
.eb-tree-list { display: grid; gap: 0.25rem; align-content: start; min-height: 40px; overflow-y: auto; padding-right: 2px; }
.eb-tree-empty { font-size: 0.78rem; color: var(--color-text-muted); padding: 0.8rem; border: 1px dashed var(--color-border); border-radius: 8px; text-align: center; }
.eb-zone { display: flex; align-items: center; gap: 0.5rem; width: 100%; text-align: left; padding: 0.5rem 0.6rem; border: 1px solid var(--color-border-light); border-radius: 8px; background: color-mix(in srgb, var(--color-ink, #26221f) 3%, transparent); cursor: pointer; font-size: 0.78rem; color: var(--color-text); }
.eb-zone:hover { border-color: var(--color-primary); }
.eb-zone-ico { color: var(--color-text-muted); }
.eb-zone-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); padding: 0.4rem 0.2rem 0.1rem; }
.eb-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.5rem; border: 1px solid var(--color-border-light); border-radius: 8px; background: var(--color-surface); cursor: pointer; transition: border-color .12s, background .12s; }
.eb-item:hover { border-color: var(--color-border); background: color-mix(in srgb, var(--color-primary) 4%, transparent); }
.eb-item.is-sel { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 10%, transparent); }
.eb-item.is-drag { opacity: 0.45; }
.eb-item.is-over { box-shadow: 0 -2px 0 0 var(--color-primary); }
.eb-item-ico { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--color-primary) 10%, transparent); color: var(--color-primary); font-size: 0.8rem; flex-shrink: 0; }
.eb-item-txt { flex: 1; min-width: 0; display: grid; font-size: 0.75rem; line-height: 1.25; }
.eb-item-txt span { color: var(--color-text-muted); font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eb-item-grip { color: var(--color-text-light, #b3aaa3); cursor: grab; font-size: 0.7rem; letter-spacing: -2px; }

/* Canvas */
.eb-canvas-wrap { min-width: 0; min-height: 0; }
.eb-canvas { position: relative; background: color-mix(in srgb, var(--color-ink, #26221f) 5%, transparent); border: 1px solid var(--color-border-light); border-radius: var(--radius); padding: 0.5rem; height: 100%; }
.eb-canvas-frame { display: block; width: 100%; height: 100%; border: 0; border-radius: 10px; background: transparent; transition: width .18s ease; margin: 0 auto; }
.eb-canvas.is-mobil .eb-canvas-frame { width: 400px; max-width: 100%; }

/* Schwebende Werkzeugleisten (Elterndokument) */
.eb-float { position: absolute; z-index: 30; display: inline-flex; align-items: center; gap: 0.15rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.16); padding: 0.2rem; }
.eb-float[hidden] { display: none; }
.eb-float button, .eb-float label { border: 0; background: transparent; color: var(--color-text); border-radius: 6px; padding: 0.25rem 0.42rem; font-size: 0.78rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.2rem; line-height: 1; }
.eb-float button:hover { background: color-mix(in srgb, var(--color-primary) 12%, transparent); }
.eb-float button.is-danger:hover { background: color-mix(in srgb, var(--color-error) 15%, transparent); color: var(--color-error); }
.eb-float select { border: 1px solid var(--color-border-light); border-radius: 6px; font-size: 0.72rem; padding: 0.15rem 0.3rem; background: var(--color-surface); color: var(--color-text); }
.eb-float-sep { width: 1px; height: 18px; background: var(--color-border-light); margin: 0 0.15rem; }
.eb-float-color { position: relative; }
.eb-float-color span { font-weight: 800; border-bottom: 3px solid var(--color-primary); line-height: 0.9; }
.eb-float-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* Eigenschaften-Panel */
.eb-props { padding: 0.7rem 0.8rem; display: grid; gap: 0.7rem; }
.eb-tools { display: flex; gap: 1px; opacity: 0; transition: opacity .12s; flex-shrink: 0; }
.eb-item:hover .eb-tools, .eb-sec:hover .eb-tools, .eb-item.is-sel .eb-tools, .eb-sec.is-sel .eb-tools, .eb-sec.is-auf .eb-tools { opacity: 1; }
.eb-tools button { border: 0; background: transparent; border-radius: 5px; width: 20px; height: 20px; padding: 0; font-size: 0.72rem; line-height: 1; cursor: pointer; color: var(--color-text-muted); }
.eb-tools button:hover { background: color-mix(in srgb, var(--color-primary) 12%, transparent); color: var(--color-primary); }
.eb-tools button.is-danger:hover { background: color-mix(in srgb, var(--color-error) 12%, transparent); color: var(--color-error); }
.eb-ren { width: 100%; font-size: 0.75rem; padding: 0.15rem 0.3rem; border: 1px solid var(--color-primary); border-radius: 5px; background: var(--color-surface); color: var(--color-text); }
.eb-anteile { display: grid; gap: 0.3rem; }
.eb-anteile label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; color: var(--color-text-muted); }
.eb-anteile label span { flex: 1; }
.eb-anteile label input { width: 62px; padding: 0.25rem 0.35rem; border: 1px solid var(--color-border-light); border-radius: 6px; background: var(--color-surface); color: var(--color-text); font-size: 0.75rem; }
.eb-anteile label em { font-style: normal; }
.eb-field { display: grid; gap: 0.2rem; font-size: 0.75rem; font-weight: 600; }
.eb-field > span { color: var(--color-text-muted); }
.eb-field input, .eb-field select { width: 100%; }
.eb-field em { font-style: normal; font-weight: 400; font-size: 0.68rem; color: var(--color-text-muted); }
.eb-check { display: flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; }
.eb-tip { font-size: 0.75rem; line-height: 1.5; color: var(--color-text-muted); background: color-mix(in srgb, var(--color-primary) 6%, transparent); border-radius: 8px; padding: 0.6rem 0.7rem; }

@media (max-width: 1100px) { .eb-builder { height: auto; } .eb-canvas-frame { height: 70vh; } }

/* Builder: Reiter der Palette (Elemente / Vorlagen) */
.eb-tabs { display: flex; border-bottom: 1px solid var(--color-border-light); }
.eb-tab { flex: 1; border: 0; background: transparent; padding: 0.5rem 0.4rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.eb-tab.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.eb-palette--breit { grid-template-columns: 1fr; }
.eb-pal--vorlage { flex-direction: row; justify-content: flex-start; gap: 0.5rem; min-height: 0; padding: 0.5rem 0.6rem; text-align: left; }
.eb-pal--vorlage .eb-pal-ico { font-size: 0.9rem; letter-spacing: -1px; }

/* Struktur-Baum: Spalteninhalte eingerückt */
.eb-subtree { margin: 0.15rem 0 0.35rem 0.7rem; padding-left: 0.5rem; border-left: 2px solid var(--color-border-light); display: grid; gap: 0.2rem; }
.eb-col-label { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-light, #b3aaa3); padding: 0.15rem 0 0; }
.eb-col-leer { font-size: 0.68rem; color: var(--color-text-muted); border: 1px dashed var(--color-border); border-radius: 6px; padding: 0.3rem 0.4rem; text-align: center; }
.eb-col-leer.is-over { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 8%, transparent); color: var(--color-primary); }
.eb-item.is-tief { background: color-mix(in srgb, var(--color-ink, #26221f) 2%, transparent); }

/* Abschnitt (Hauptelement) im Struktur-Baum — nur der offene zeigt seine Elemente */
.eb-sec { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.5rem; border: 1px solid var(--color-border-light); border-radius: 8px;
    background: color-mix(in srgb, var(--color-ink, #26221f) 4%, transparent); cursor: pointer; transition: border-color .12s, background .12s; }
.eb-sec:hover { border-color: var(--color-border); }
.eb-sec.is-auf { background: color-mix(in srgb, var(--hl-orange, #f39200) 10%, transparent); border-color: color-mix(in srgb, var(--hl-orange, #f39200) 45%, transparent); }
.eb-sec.is-sel { border-color: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-primary); }
.eb-sec.is-drag { opacity: 0.45; }
.eb-sec.is-over { box-shadow: 0 -2px 0 0 var(--color-primary); }
.eb-sec .eb-item-txt strong { font-size: 0.76rem; }
.eb-sec-chev { width: 14px; text-align: center; font-size: 0.7rem; color: var(--color-text-muted); flex-shrink: 0; }
.eb-sec.is-auf .eb-sec-chev { color: var(--hl-orange, #f39200); }
.eb-subtree { margin-top: 0; }


/* „Format entfernen" in der Textleiste deutlicher */
.eb-float-clear { font-size: 0.7rem !important; font-weight: 600; color: var(--color-text-muted) !important; }
.eb-float-clear:hover { color: var(--color-error) !important; background: color-mix(in srgb, var(--color-error) 12%, transparent) !important; }

/* Palette: eigene Abschnittsvorlagen */
.eb-pal-titel { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-light, #b3aaa3); padding: 0.5rem 0.1rem 0.1rem; }
.eb-pal-leer { font-size: 0.68rem; color: var(--color-text-muted); border: 1px dashed var(--color-border); border-radius: 8px; padding: 0.45rem 0.5rem; line-height: 1.35; }
.eb-pal--vorlage { position: relative; padding-right: 1.5rem; }
.eb-pal-del { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; font-size: 0.62rem; color: var(--color-text-light, #b3aaa3); opacity: 0; transition: opacity .12s; }
.eb-pal--vorlage:hover .eb-pal-del { opacity: 1; }
.eb-pal-del:hover { background: color-mix(in srgb, var(--color-error) 12%, transparent); color: var(--color-error); }
.eb-crm-stil { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; color: var(--color-text-muted); padding: 0.1rem 0.1rem 0.3rem; }
.eb-crm-stil select { flex: 1; padding: 0.25rem 0.35rem; border: 1px solid var(--color-border-light); border-radius: 6px; background: var(--color-surface); color: var(--color-text); font-size: 0.74rem; }
.eb-pal-meta { display: block; font-weight: 400; font-size: 0.64rem; color: var(--color-text-muted); }

/* Textüberarbeitung (KI) */
.eb-float-ki { font-weight: 600; color: var(--hl-orange, #f39200) !important; }
.eb-ki-aktionen { display: flex; gap: 0.35rem; flex-wrap: wrap; }
dialog.hl-modal textarea { width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--color-border-light); border-radius: 8px; background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 0.85rem; line-height: 1.45; resize: vertical; }
dialog.hl-modal textarea[readonly] { background: color-mix(in srgb, var(--color-ink, #26221f) 3%, transparent); color: var(--color-text-muted); }

/* ==========================================================================
   Canvas-Editor fuer Automationen (Brevo-Stil): Palette links, gepunkteter
   Canvas mit Karten, Verbindungslinien und Zweig-Ausgaengen. Der Canvas
   laesst sich zoomen (Werkzeugleiste, Strg/Cmd + Mausrad) und mit der Maus
   verschieben.
   ========================================================================== */
.pa-flow { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 1rem; align-items: stretch; height: calc(100vh - 190px); min-height: 540px; }
@media (max-width: 1100px) { .pa-flow { grid-template-columns: 1fr; height: auto; } }
.pa-flow-palette { overflow-y: auto; }

.pa-flow-buehne { position: relative; display: flex; flex-direction: column; min-height: 0; }
/* Zoom-Steuerung schwebt unten rechts ueber dem Canvas (wie in gaengigen
   Flow-Editoren) — der Canvas bleibt dadurch voll nutzbar. */
.pa-flow-werkzeuge {
    position: absolute; right: 0.85rem; bottom: 0.85rem; z-index: 5;
    display: flex; align-items: center; gap: 0.3rem; padding: 0.35rem 0.45rem;
    font-size: 0.8rem; color: var(--color-text-muted);
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: 10px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.pa-flow-werkzeuge #zoom-anzeige { min-width: 3.2rem; text-align: center; font-variant-numeric: tabular-nums; }
.pa-flow-hinweis {
    position: absolute; left: 0.85rem; bottom: 0.85rem; z-index: 5;
    font-size: 0.72rem; color: var(--color-text-muted);
    background: color-mix(in srgb, var(--color-surface) 88%, transparent);
    padding: 0.25rem 0.55rem; border-radius: 8px;
}
.pa-flow-canvas {
    flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--color-border); border-radius: 12px;
    background-color: var(--color-surface-hover);
    background-image: radial-gradient(color-mix(in srgb, var(--color-text-muted) 28%, transparent) 1px, transparent 1px);
    background-size: 18px 18px; cursor: grab;
}
.pa-flow-canvas--zieht { cursor: grabbing; user-select: none; }
.pa-flow-inner { transform-origin: 50% 0; padding: 2.5rem 1.5rem; width: max-content; min-width: 100%; box-sizing: border-box; }

.pa-dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; flex: 0 0 auto; }
.pa-dot--trigger { background: #ec4899; }
.pa-dot--aktion { background: #14b8a6; }
.pa-dot--regel { background: #8b5cf6; }

.pa-pal-hinweis { font-size: 0.75rem; color: var(--color-text-muted); margin: 0 0 0.5rem; }
/* Der Reiter-Umschalter nutzt die volle Panelbreite und bricht nicht ab. */
.pa-flow-palette .tabs { display: flex; width: 100%; flex-wrap: nowrap; }
.pa-flow-palette .tab { flex: 1 1 0; justify-content: center; padding-left: 0.4rem; padding-right: 0.4rem; gap: 0.3rem; white-space: nowrap; }
.pa-pal-item {
    display: flex; align-items: center; gap: 0.55rem; width: 100%;
    border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface);
    padding: 0.55rem 0.7rem; margin-bottom: 0.45rem; font-size: 0.85rem; font-family: inherit;
    color: var(--color-text); cursor: grab; text-align: left;
}
.pa-pal-item:hover { border-color: var(--color-primary); }
.pa-pal-item--zieht { opacity: 0.5; }
.pa-pal-grip { color: var(--color-text-muted); cursor: grab; }
.pa-pal-check { color: var(--color-success); font-weight: 700; visibility: hidden; }

.pa-seq, .pa-branch { display: flex; flex-direction: column; align-items: center; }
.pa-conn { width: 2px; height: 16px; background: var(--pa-linie); flex: 0 0 auto; }
.pa-flow-inner { --pa-linie: color-mix(in srgb, var(--color-text-muted) 45%, transparent); }

/* Verzweigung: waagerechte Linie ueber den Zweigen, je Zweig ein Stummel
   nach unten — zusammen ergibt das die uebliche T-Verbindung. Die Spalten
   sind gleich breit, damit die Linie mittig auf den Zweigen sitzt. */
.pa-branches { display: flex; gap: 2.5rem; align-items: flex-start; }
.pa-branch { position: relative; flex: 1 1 0; min-width: 300px; padding-top: 18px; }
.pa-branch::before {
    content: ''; position: absolute; top: 0; left: calc(50% - 1px);
    width: 2px; height: 18px; background: var(--pa-linie);
}
.pa-branch::after {
    content: ''; position: absolute; top: 0; height: 2px; background: var(--pa-linie);
}
.pa-branch:first-child::after { left: calc(50% - 1px); right: calc(-1.25rem - 1px); }
.pa-branch:last-child::after { left: calc(-1.25rem - 1px); right: calc(50% - 1px); }
.pa-branch:not(:first-child):not(:last-child)::after { left: calc(-1.25rem - 1px); right: calc(-1.25rem - 1px); }

.pa-node {
    width: 270px; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: 10px; padding: 0.55rem 0.7rem; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
    cursor: pointer;
}
.pa-node:hover { border-color: var(--color-primary); }
.pa-node--trigger { border-color: color-mix(in srgb, #ec4899 45%, var(--color-border)); }
.pa-node-kopf { display: flex; align-items: center; gap: 0.5rem; }
.pa-node-titel { flex: 1; font-size: 0.85rem; font-weight: 600; }
.pa-node-tools { display: flex; gap: 0.15rem; }
.pa-node-tools button {
    border: 0; background: transparent; color: var(--color-text-muted); cursor: pointer;
    font-size: 0.8rem; padding: 0.1rem 0.3rem; border-radius: 5px;
}
.pa-node-tools button:hover { background: var(--color-surface-hover); color: var(--color-text); }
.pa-node-sub { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 0.3rem; }
.pa-node-mail {
    display: inline-block; margin-top: 0.5rem; font-size: 0.75rem; text-decoration: none;
    border: 1px solid var(--color-border); border-radius: 6px; padding: 0.2rem 0.5rem;
    color: var(--color-text);
}
.pa-node-mail:hover { border-color: var(--color-primary); color: var(--color-primary); }

.pa-slot {
    width: 26px; height: 26px; border-radius: 50%; border: 1px dashed var(--color-text-muted);
    background: var(--color-surface); color: var(--color-text-muted); cursor: pointer;
    display: grid; place-items: center; font-size: 0.85rem; line-height: 1; padding: 0; flex: 0 0 auto;
    transition: transform .12s ease;
}
.pa-slot:hover { border-style: solid; border-color: var(--color-primary); color: var(--color-primary); }
.pa-slot--ueber { border-style: solid; border-color: var(--color-primary); color: var(--color-primary); transform: scale(1.5); background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface)); }
.pa-ende { font-size: 0.7rem; color: var(--color-text-muted); border: 1px solid var(--color-border); border-radius: 99px; padding: 2px 12px; background: var(--color-surface); }

/* Ablage-Modus: waehrend aus der Palette gezogen wird, treten die
   Einfuegepunkte hervor, damit man sie sicher trifft. */
.pa-flow-canvas--ablage .pa-slot { border-style: solid; border-color: var(--color-primary); color: var(--color-primary); transform: scale(1.2); }
.pa-flow-canvas--ablage { cursor: copy; }

/* Linke Spalte des Automations-Editors: Palette oder Knoten-Panel. */
.pa-flow-links { display: flex; flex-direction: column; min-height: 0; }
.pa-flow-panel { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
/* display in der Klasse wuerde das hidden-Attribut aushebeln. */
.pa-flow-panel[hidden], .pa-flow-palette[hidden] { display: none; }
.pa-panel-kopf {
    display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-border);
}
.pa-panel-icon {
    width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto;
    background: color-mix(in srgb, var(--color-chart2, #f2c200) 30%, var(--color-surface)); font-size: 1rem;
}
.pa-panel-titel { font-weight: 600; font-size: 0.95rem; }
.pa-panel-id { font-size: 0.72rem; color: var(--color-text-muted); }
.pa-panel-x { border: 0; background: transparent; color: var(--color-text-muted); cursor: pointer; font-size: 1rem; padding: 0.1rem 0.35rem; border-radius: 6px; }
.pa-panel-x:hover { background: var(--color-surface-hover); color: var(--color-text); }
.pa-panel-inhalt { flex: 1; overflow-y: auto; padding: 0.85rem 1rem; }
.pa-panel-fuss {
    display: flex; gap: 0.5rem; justify-content: space-between; align-items: center;
    padding: 0.7rem 1rem; border-top: 1px solid var(--color-border); background: var(--color-surface-hover);
}
.pa-panel-abschnitt {
    font-size: 0.72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--color-text-muted); margin: 1rem 0 0.5rem;
}
.pa-panel-abschnitt:first-child { margin-top: 0; }
.pa-panel-vorschau {
    border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; height: 210px;
    background: #fff; position: relative;
}
.pa-panel-vorschau iframe { width: 600px; height: 700px; border: 0; transform: scale(.42); transform-origin: 0 0; pointer-events: none; }
.pa-panel-knoepfe { display: flex; gap: 0.4rem; margin-top: 0.6rem; }

/* Felder im Panel */
.pa-feld { display: block; margin-bottom: 0.75rem; }
.pa-feld > span { display: block; font-size: 0.78rem; font-weight: 600; margin-bottom: 0.25rem; }
.pa-feld input, .pa-feld select {
    width: 100%; box-sizing: border-box; padding: 0.45rem 0.55rem; font-size: 0.85rem;
    font-family: inherit; border: 1px solid var(--color-border); border-radius: 8px;
    background: var(--color-surface); color: var(--color-text);
}
.pa-feld em { display: block; font-size: 0.72rem; color: var(--color-text-muted); font-style: normal; margin-top: 0.25rem; }

/* Gewaehlter Knoten im Canvas */
.pa-node--aktiv { border-color: var(--color-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 35%, transparent); }
.pa-node-thumb {
    margin-top: 0.5rem; border: 1px solid var(--color-border); border-radius: 6px; overflow: hidden;
    height: 96px; background: #fff;
}
.pa-node-thumb iframe { width: 600px; height: 900px; border: 0; transform: scale(.42); transform-origin: 0 0; pointer-events: none; }

/* ── Filter-Builder (Kontakte, Segmente) ──────────────────────────────── */
/* Fusszeile der Filterkarte: links anlegen, rechts die Aktionen. */
.pa-filter-fuss { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.pa-filter-hinweis { font-size: 0.75rem; color: var(--color-text-muted); }
.pa-filter-aktionen { display: flex; gap: 0.4rem; margin-left: auto; }
/* .btn bringt display mit und schlaegt sonst das hidden-Attribut. */
.pa-filter-aktionen .btn[hidden] { display: none; }
/* Reiterleiste mit dem Bestand auf gleicher Hoehe rechts. */
.pa-reiter-zeile { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pa-reiter-zeile .tabs { margin-bottom: 0; }
.pa-bestand { font-size: 0.82rem; color: var(--color-text-muted); white-space: nowrap; }
.pa-bestand strong { color: var(--color-text); font-size: 0.95rem; }

/* Suche steht unter dem Filter — erst eingrenzen, dann im Ergebnis suchen.
   Bewusst ohne eigene Karte: sie gehoert weder in den Filter noch in die
   Tabelle, sondern frei dazwischen. */
.pa-suche-frei { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0.6rem 0 0; }
.pa-suche-frei input { flex: 0 1 33%; min-width: 13rem; max-width: 33%; margin: 0; background: transparent; }
.pa-suche-frei input::placeholder { font-size: 0.78rem; }
@media (max-width: 700px) { .pa-suche-frei input { flex-basis: 100%; max-width: 100%; } }
.pa-treffer { font-size: 0.8rem; color: var(--color-text-muted); white-space: nowrap; margin-left: auto; }

/* Filter-Attribut-Dropdown (Kategorien → Attribute, Suche, zuletzt) */
.pa-dd { position: fixed; z-index: 200; width: 340px; max-width: calc(100vw - 1.5rem); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14); overflow: hidden; }
.pa-dd-kopf { padding: 0.7rem 0.7rem 0.55rem; border-bottom: 1px solid var(--color-border); }
.pa-dd-suche { width: 100%; padding: 0.5rem 0.7rem; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-bg); color: inherit; font-size: 0.88rem; }
.pa-dd-body { max-height: 22rem; overflow-y: auto; padding: 0.35rem; }
.pa-dd-kat, .pa-dd-attr { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%; text-align: left; padding: 0.55rem 0.6rem; border: none; background: none; color: inherit; font: inherit; font-size: 0.9rem; border-radius: 8px; cursor: pointer; }
.pa-dd-kat { font-weight: 600; }
.pa-dd-kat:hover, .pa-dd-attr:hover { background: var(--color-bg); }
.pa-dd-attr { flex-wrap: wrap; }
.pa-dd-attr em { font-style: normal; font-size: 0.76rem; color: var(--color-text-muted); flex-basis: 100%; }
.pa-dd-pfeil { color: var(--color-text-muted); }
.pa-dd-sekt { padding: 0.55rem 0.6rem 0.25rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }
.pa-dd-anzahl { padding: 0.4rem 0.6rem 0.25rem; font-size: 0.74rem; color: var(--color-text-muted); }
.pa-dd-anzahl strong { color: var(--color-text); }

/* Kontakt-Tabelle: kompakt/einzeilig + Auswahl-Spalte */
.mkt-tabelle td, .mkt-tabelle th { padding-top: 0.3rem; padding-bottom: 0.3rem; }
/* Titelleiste höher + eigene Titel-Schriftgröße (Zeilen bleiben kompakt). */
.mkt-tabelle thead th { height: 50px; font-size: 13px; }
.mkt-wahl-sp { width: 2.2rem; text-align: center; padding-left: 0.6rem !important; padding-right: 0 !important; }
.mkt-wahl-sp input { cursor: pointer; }

/* Aktionszeile IM Tabellenkopf: ersetzt die Titelzeile, sobald ausgewählt ist */
.mkt-al-zelle { padding: 0 !important; text-align: left; font-weight: 400; }
.mkt-al-inner { display: flex; align-items: center; gap: 1.1rem; padding: 0.15rem 0.4rem; white-space: nowrap; text-transform: none; letter-spacing: normal; }
.mkt-al-btn { border: none; background: none; color: var(--color-primary); font: inherit; font-weight: 600; font-size: 0.85rem; cursor: pointer; padding: 0.25rem 0; }
.mkt-al-btn:hover { text-decoration: underline; }
.mkt-al-btn-link { border: none; background: none; color: var(--color-primary); font: inherit; font-size: 0.85rem; cursor: pointer; }
.mkt-al-btn-link:hover { text-decoration: underline; }
.mkt-al-rechts { margin-left: auto; display: flex; align-items: center; gap: 1.1rem; }
.mkt-al-anzahl { font-size: 0.85rem; color: var(--color-text); font-weight: 400; }
.mkt-al-mehr { position: relative; }
.mkt-mehr-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; min-width: 210px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14); padding: 0.3rem; white-space: nowrap; }
.mkt-mehr-menu button { display: block; width: 100%; text-align: left; border: none; background: none; color: inherit; font: inherit; font-weight: 400; font-size: 0.88rem; padding: 0.5rem 0.6rem; border-radius: 7px; cursor: pointer; }
.mkt-mehr-menu button:hover { background: var(--color-bg); }
.mkt-mehr-menu .mkt-gefahr { color: #dc2626; }
.pa-dd-weg { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.4rem 0.5rem; font-size: 0.85rem; font-weight: 600; }
.pa-dd-zurueck { border: none; background: none; cursor: pointer; font-size: 1.05rem; color: var(--color-text-muted); padding: 0.15rem 0.4rem; line-height: 1; border-radius: 6px; }
.pa-dd-zurueck:hover { background: var(--color-bg); color: var(--color-text); }
.pa-dd-leer { padding: 0.8rem 0.6rem; font-size: 0.85rem; color: var(--color-text-muted); }
.pa-filter-gruppe { position: relative; border: 1px solid var(--color-border); border-radius: 10px; padding: 0.9rem 2.2rem 0.9rem 0.9rem; margin-bottom: 0.5rem; background: var(--color-surface); }
.pa-filter-gruppe + .pa-filter-gruppe::before { content: "Oder"; position: absolute; top: -0.75rem; left: 0.9rem; background: var(--color-surface); padding: 0 0.4rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); }
.pa-filter-und { display: flex; align-items: center; gap: 0.5rem; margin: 0.55rem 0; color: var(--color-text-muted); font-size: 0.75rem; }
.pa-filter-und::after { content: ""; flex: 1; height: 1px; background: var(--color-border); }
.pa-bed-kopf { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 0.3rem; }
.pa-bed-kopf strong { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.pa-bed-kopf em { font-style: normal; font-size: 0.72rem; color: var(--color-text-muted); }
.pa-bed-zeile { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.pa-bed-zeile select, .pa-bed-zeile input { margin: 0; height: 2.1rem; font-size: 0.82rem; }
.pa-bed-zeile select { flex: 0 0 auto; max-width: 15rem; }
.pa-bed-zeile input { flex: 1 1 12rem; min-width: 8rem; }
.pa-bed-bis { font-size: 0.78rem; color: var(--color-text-muted); }
.pa-filter-weg { border: 0; background: none; cursor: pointer; color: var(--color-text-muted); font-size: 0.9rem; padding: 0.2rem 0.35rem; border-radius: 6px; }
.pa-filter-weg:hover { background: var(--color-surface-hover); color: var(--color-error); }
.pa-filter-gruppe > .pa-filter-weg { position: absolute; top: 0.5rem; right: 0.5rem; }
.pa-attr-gruppe { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); padding: 0.7rem 0.2rem 0.3rem; }
.pa-attr { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer; padding: 0.45rem 0.5rem; border-radius: 8px; }
.pa-attr:hover { background: var(--color-surface-hover); }
.pa-attr span { display: block; font-size: 0.88rem; }
.pa-attr em { display: block; font-style: normal; font-size: 0.74rem; color: var(--color-text-muted); }

/* ── Kundenakte (Marketing-Ansicht, drei Spalten wie in Brevo) ────────── */
.pa-akte { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1200px) { .pa-akte { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .pa-akte > :nth-child(3) { grid-column: 1 / -1; } }
@media (max-width: 800px) { .pa-akte { grid-template-columns: 1fr; } .pa-akte > :nth-child(3) { grid-column: auto; } }
.pa-akte-zahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: 0.9rem; }
.pa-akte-zahl-label { font-size: 0.76rem; color: var(--color-text-muted); }
.pa-akte-zahl { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.pa-akte-zahl-zusatz { font-size: 0.72rem; color: var(--color-text-muted); }
.pa-merkmal-quelle { display: inline-block; margin-left: 0.4rem; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }

/* ── Spaltenwahl der Kontaktliste (grosser, gruppierter Dialog) ─────────
   Selektoren mit dialog davor: dialog.hl-modal setzt Breite, Scrollen und
   das label-Layout und wuerde eine reine Klassenregel schlagen. */
/* display NUR im geoeffneten Zustand setzen: der Browser versteckt einen
   geschlossenen <dialog> mit display:none — eine eigene display-Regel ohne
   [open] haette ihn dauerhaft sichtbar gemacht. */
dialog.mkt-sp-dlg { width: calc(100% - 3rem); max-width: min(66rem, calc(100vw - 3rem)); max-height: calc(100vh - 3rem); overflow: hidden; }
dialog.mkt-sp-dlg[open] { display: flex; flex-direction: column; }
.mkt-sp-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.mkt-sp-zaehler { font-size: 0.8rem; color: var(--color-text-muted); white-space: nowrap; }
.mkt-sp-zaehler strong { color: var(--color-text); font-size: 0.95rem; }
/* Grid statt Spaltenfluss: so wird keine Gruppe mitten im Kopf umgebrochen. */
.mkt-sp-body { margin-top: 0.9rem; flex: 1 1 auto; min-height: 0; overflow-y: auto;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.1rem 1.6rem; align-items: start; }
.mkt-sp-gruppe { min-width: 0; }
.mkt-sp-gruppe-kopf { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); padding: 0 0 0.3rem 0.15rem; border-bottom: 1px solid var(--color-border); margin-bottom: 0.35rem; }
dialog.mkt-sp-dlg .mkt-sp-attr { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0; padding: 0.32rem 0.4rem; border-radius: 7px; cursor: pointer; font-size: 0.86rem; font-weight: 400; }
dialog.mkt-sp-dlg .mkt-sp-attr:hover { background: var(--color-surface-hover); }
dialog.mkt-sp-dlg .mkt-sp-attr.is-an { background: var(--color-surface-hover); font-weight: 600; }
dialog.mkt-sp-dlg .mkt-sp-attr input { margin: 0.18rem 0 0; flex: 0 0 auto; width: auto; }
dialog.mkt-sp-dlg .mkt-sp-attr em { display: block; font-style: normal; font-weight: 400; font-size: 0.72rem; color: var(--color-text-muted); }
dialog.mkt-sp-dlg #spalten-suche { width: 100%; }
.mkt-sp-fuss { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--color-border); }
.mkt-leer { color: var(--color-text-muted); }
.mkt-zusatz { font-size: 0.74rem; color: var(--color-text-muted); }

/* ── Kampagnenuebersicht: Leiste, Kacheln, Kanban ─────────────────────── */
.mlg-leiste { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.25rem; }
.mlg-leiste select, .mlg-leiste input { margin: 0; height: 2.2rem; font-size: 0.85rem; }
.mlg-ansichten { margin: 0; }
.mlg-ansichten .tab { border: 0; background: none; font: inherit; cursor: pointer; }
.mlg-status { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-left: auto; }
.mlg-status .badge { text-decoration: none; }
.mlg-kachel { display: flex; flex-direction: column; }
.mlg-kachel-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
/* Der Titel ist die Kachel/Zeile selbst — ein Unterstrich macht die Liste
   unruhig; erst beim Hover zeigt er, dass er anklickbar ist. */
.mlg-name { font-weight: 700; font-size: 0.98rem; line-height: 1.25; text-decoration: none; }
.mlg-name:hover { text-decoration: underline; }
.mlg-feld { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.25rem 0.6rem; margin: 0.7rem 0 0; font-size: 0.82rem; }
.mlg-feld dt { color: var(--color-text-muted); }
.mlg-feld dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mlg-aktionen { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: auto; padding-top: 0.9rem; }
.mlg-aktionen form { margin: 0; }
.mlg-kanban { display: grid; grid-template-columns: repeat(5, minmax(13rem, 1fr)); gap: 0.75rem; margin-top: 1rem; align-items: start; overflow-x: auto; }
@media (max-width: 1100px) { .mlg-kanban { grid-template-columns: repeat(3, minmax(13rem, 1fr)); } }
@media (max-width: 700px) { .mlg-kanban { grid-template-columns: 1fr; } }
.mlg-spalte { background: var(--color-surface-hover); border-radius: 12px; padding: 0.6rem; min-width: 0; }
.mlg-spalte-kopf { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); padding: 0.1rem 0.25rem 0.5rem; }
.mlg-karte { padding: 0.7rem; margin-bottom: 0.5rem; }
.mlg-karte-zeile { font-size: 0.76rem; color: var(--color-text-muted); margin-top: 0.2rem; overflow-wrap: anywhere; }
.mlg-karte .mlg-aktionen { padding-top: 0.6rem; }
.mlg-leer { font-size: 0.78rem; color: var(--color-text-muted); text-align: center; padding: 0.8rem 0; margin: 0; }
.mlg-archivlink { display: block; font-size: 0.76rem; text-align: center; padding: 0.4rem; }
.mlg-ordnerliste { max-height: 14rem; overflow-y: auto; margin-bottom: 0.6rem; }
.mlg-ordnerzeile { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0; font-size: 0.85rem; border-bottom: 1px solid var(--color-border); }

/* ── Landing Pages: Kacheln mit echter Seitenvorschau ─────────────────── */
/* Vier nebeneinander: breit genug, dass die drei Aktionen in eine Zeile
   passen, statt in der Kachel umzubrechen. */
.lp-raster { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1rem; }
@media (max-width: 1500px) { .lp-raster { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .lp-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .lp-raster { grid-template-columns: 1fr; } }
/* Aktionen in einer Zeile: Bearbeiten und Ansehen links, der Schalter fuer
   Veroeffentlichen/Deaktivieren immer ganz rechts — und alle drei gleich
   hoch, egal ob Link oder Formular-Knopf. */
.lp-kachel .mlg-aktionen { flex-wrap: nowrap; align-items: stretch; }
.lp-kachel .mlg-aktionen > form { margin-left: auto; display: flex; }
.lp-kachel .mlg-aktionen .btn { white-space: nowrap; padding-left: 0.55rem; padding-right: 0.55rem;
    display: inline-flex; align-items: center; }
.lp-kachel { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.lp-vorschau { position: relative; display: block; height: 13rem; overflow: hidden; background: #fff; border-bottom: 1px solid var(--color-border); }
.lp-vorschau iframe { position: absolute; top: 0; left: 50%; width: 1100px; height: 1300px; border: 0;
    transform: translateX(-50%) scale(0.34); transform-origin: top center; pointer-events: none; }
/* Deckel ueber dem iframe: der Klick gehoert der Kachel, nicht der Seite. */
.lp-vorschau-schutz { position: absolute; inset: 0; }
.lp-kachel-text { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; flex: 1; }

/* ── Formular-Editor: Schritte links, Live-Vorschau rechts ────────────── */
.frm-schritte { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
.frm-schritt { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.6rem 0.7rem; border: 1px solid var(--color-border); border-radius: 10px; text-decoration: none; color: inherit; background: var(--color-surface); }
.frm-schritt:hover { background: var(--color-surface-hover); }
.frm-schritt.is-aktiv { border-color: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-primary); }
.frm-nr { flex: 0 0 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--color-surface-hover); display: grid; place-items: center; font-size: 0.78rem; font-weight: 700; }
.frm-schritt.is-aktiv .frm-nr { background: var(--color-primary); color: var(--color-btn-text, #1a1a1a); }
.frm-schritt strong { display: block; font-size: 0.86rem; }
.frm-schritt em { display: block; font-style: normal; font-size: 0.72rem; color: var(--color-text-muted); }
.frm-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1000px) { .frm-editor { grid-template-columns: 1fr; } }
.frm-vorschau { border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; background: #fff; position: sticky; top: 1rem; }
.frm-vorschau-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--color-border); background: var(--color-surface); font-size: 0.8rem; font-weight: 600; }
.frm-vorschau iframe { display: block; width: 100%; height: 32rem; border: 0; background: #fff; }

/* ── Kampagnen: Ordnerbereich und Listenzeilen (Brevo-Aufbau) ─────────── */
.mlg-ordner-bereich { margin: 0.25rem 0 0.75rem; }
.mlg-ordner-bereich > summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; padding: 0.3rem 0; list-style: none; }
.mlg-ordner-bereich > summary::-webkit-details-marker { display: none; }
.mlg-ordner-bereich > summary::before { content: "▸ "; color: var(--color-text-muted); }
.mlg-ordner-bereich[open] > summary::before { content: "▾ "; }
.mlg-ordner-kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.6rem; margin-top: 0.5rem; }
.mlg-ordner-kachel { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.75rem 0.9rem;
    border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); font-size: 0.86rem;
    text-decoration: none; color: inherit; font-family: inherit; cursor: pointer; }
.mlg-ordner-kachel:hover { background: var(--color-surface-hover); text-decoration: none; }
/* Ordnername mit Symbol, ohne Unterstrich — die Kachel ist der Knopf. */
.mlg-ordner-name { display: inline-flex; align-items: center; gap: 0.45rem; min-width: 0; text-decoration: none; }
.mlg-ordner-name .icon { flex: 0 0 auto; color: var(--color-text-muted); }
.mlg-ordner-kachel.is-aktiv .mlg-ordner-name .icon { color: var(--color-text); }
.mlg-ordner-kachel.is-aktiv { border-color: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-primary); }
.mlg-ordner-kachel.is-neu { border-style: dashed; color: var(--color-text-muted); justify-content: center; }
.mlg-zeilen { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1rem; }
/* Feste Spuren fuer Zahlen und Aktion: die Kennzahlen fluchten dadurch ueber
   alle Zeilen, egal wie viele Aktionen eine Kampagne gerade anbietet — und
   der freie Rest gehoert dem Titel. */
.mlg-zeile { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) 30rem 3rem; gap: 1rem; align-items: center; padding: 0.9rem 1rem; }
@media (max-width: 1100px) { .mlg-zeile { grid-template-columns: 1.5rem minmax(0, 1fr) 3rem; } .mlg-zeile .mlg-zahlen { grid-column: 1 / -1; } }
@media (max-width: 700px) { .mlg-zeile { grid-template-columns: 1.5rem minmax(0, 1fr); } }
.mlg-wahl { display: grid; place-items: center; margin: 0; }
.mlg-wahl input { margin: 0; }
/* Auswahlleiste schwebt ueber der Liste, solange etwas gewaehlt ist. */
.mlg-auswahlleiste { position: sticky; bottom: 1rem; z-index: 20; display: flex; align-items: center; gap: 0.6rem;
    flex-wrap: wrap; margin: 1rem auto 0; width: fit-content; padding: 0.6rem 0.9rem; font-size: 0.85rem;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 999px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16); }
.mlg-auswahlleiste[hidden] { display: none; }
.mlg-zeile-titel { min-width: 0; }
.mlg-zeile-meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-size: 0.78rem; margin-top: 0.25rem; }
.mlg-punkt { width: 0.5rem; height: 0.5rem; border-radius: 50%; display: inline-block; }
.mlg-punkt.badge--gray { background: var(--color-text-muted); }
.mlg-punkt.badge--orange { background: var(--color-warning, #f59e0b); }
.mlg-punkt.badge--blue { background: var(--color-info, #3b82f6); }
.mlg-punkt.badge--purple { background: #8b5cf6; }
.mlg-punkt.badge--green { background: var(--color-success, #16a34a); }
.mlg-punkt.badge--red { background: var(--color-error); }
.mlg-zahlen { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; }
.mlg-zahl-label { font-size: 0.72rem; color: var(--color-text-muted); }
.mlg-zahl { font-size: 1.05rem; font-weight: 700; line-height: 1.2; }
.mlg-zahl-quote { font-size: 0.72rem; color: var(--color-text-muted); }
.mlg-zeile-aktionen { justify-self: end; }
/* Aktionsmenue: alles hinter einer Schaltflaeche statt einer Knopfreihe. */
.mlg-menue { position: relative; }
.mlg-menue > summary { list-style: none; cursor: pointer; width: 2rem; height: 2rem; border-radius: 8px;
    display: grid; place-items: center; font-size: 1.1rem; color: var(--color-text-muted); border: 1px solid transparent; }
.mlg-menue > summary::-webkit-details-marker { display: none; }
.mlg-menue > summary:hover, .mlg-menue[open] > summary { background: var(--color-surface-hover); border-color: var(--color-border); color: var(--color-text); }
.mlg-menue-panel { position: absolute; right: 0; top: 2.3rem; z-index: 30; min-width: 13rem; padding: 0.3rem;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14); }
.mlg-menue-panel a, .mlg-menue-panel button { display: block; width: 100%; text-align: left; padding: 0.45rem 0.6rem;
    border: 0; background: none; font: inherit; font-size: 0.85rem; color: inherit; text-decoration: none;
    border-radius: 7px; cursor: pointer; }
.mlg-menue-panel a:hover, .mlg-menue-panel button:hover { background: var(--color-surface-hover); }
.mlg-menue-panel form { margin: 0; }

/* ── Statistiken: Auswahl der Automation bzw. des Formulars ───────────── */
.stat-wahl { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.6rem; }
.stat-kachel { display: block; padding: 0.7rem 0.9rem; border: 1px solid var(--color-border); border-radius: 10px;
    background: var(--color-surface); text-decoration: none; color: inherit; }
.stat-kachel:hover { background: var(--color-surface-hover); }
.stat-kachel.is-aktiv { border-color: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-primary); }
.stat-kachel strong { display: block; font-size: 0.9rem; }
.stat-kachel span { display: block; font-size: 0.76rem; color: var(--color-text-muted); margin-top: 0.15rem; }

/* ── Formular-Editor: einheitliche Feldmaske ──────────────────────────── */
.pa-feld { border: 1px solid var(--color-border); border-radius: 10px; padding: 0.7rem 0.8rem; margin-bottom: 0.6rem; background: var(--color-surface); }
/* Vier Spuren, solange Platz ist. Der Editor nimmt nur die halbe
   Fensterbreite ein — deshalb bricht die Zeile schon bei 1400 px Fenster
   auf zwei Spuren um, sonst schrumpft die Beschriftung auf drei Zeichen. */
.pa-feld-zeile { display: grid; grid-template-columns: minmax(0, 1fr) 10rem 5.5rem 7.5rem; gap: 0.6rem; align-items: end; }
@media (max-width: 1400px) {
    .pa-feld-zeile { grid-template-columns: minmax(0, 1fr) 10rem; }
    .pa-feld-pflicht { grid-column: 1; margin-bottom: 0; }
    .pa-feld-knoepfe { grid-column: 2; justify-content: flex-end; margin-bottom: 0; }
}
@media (max-width: 700px) { .pa-feld-zeile { grid-template-columns: 1fr; } .pa-feld-knoepfe { grid-column: 1; } }
.pa-feld-spalte { display: flex; flex-direction: column; gap: 0.2rem; margin: 0; min-width: 0; font-weight: 400; }
.pa-feld-spalte > span { font-size: 0.72rem; color: var(--color-text-muted); }
.pa-feld-spalte input, .pa-feld-spalte select { margin: 0; width: 100%; height: 2.3rem; font-size: 0.85rem; }
.pa-feld-pflicht { display: flex; align-items: center; gap: 0.35rem; margin: 0 0 0.5rem; font-size: 0.8rem; font-weight: 400; white-space: nowrap; }
.pa-feld-pflicht input { margin: 0; width: auto; }
.pa-feld-knoepfe { display: flex; gap: 0.25rem; margin-bottom: 0.35rem; }
.pa-feld-knoepfe .btn, .pa-feld-luecke { width: 2.2rem; height: 2.2rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.pa-feld-luecke { display: inline-block; }
.pa-feld-optionen { display: flex; flex-direction: column; gap: 0.2rem; margin: 0.6rem 0 0; font-weight: 400; }
.pa-feld-optionen > span { font-size: 0.72rem; color: var(--color-text-muted); }
.pa-feld-optionen textarea { margin: 0; font-size: 0.85rem; }
.pa-feld-optionen[hidden] { display: none; }
/* Schritt-Reiter: Text nicht unterstrichen, auch nicht im aktiven Zustand. */
.frm-schritt-text strong, .frm-schritt-text em { text-decoration: none; }

/* Anzahl in der Ueberschrift — „Titel (n)" in allen Bereichen gleich. */
.pa-anzahl { font-weight: 400; color: var(--color-text-muted); font-size: 0.95rem; }
