/* =========================================================================
   Kontaktformular · Reporting Dashboard
   ganztags. UI-System (Tagwerk-Linie) — Variante OHNE Sidebar (Topbar + Main)
   Kern (Tokens, Base, Komponenten) 1:1 aus dem Design-System übernommen,
   moneten-spezifische Teile (Invoice-Editor/CSV) entfernt, dafür um die
   Dashboard-Visualisierungen (Funnel, Feld-Balken, Verlauf) erweitert.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

/* ---------- Design Tokens ---------- */
:root {
    /* Brand & Accents */
    --brand: #ae0037;
    --brand-dim: #8a002b;
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-500: #2563eb;
    --primary-600: #1d4ed8;
    --primary-700: #1e40af;

    --success-50: #e7f4ee;
    --success-100: #c2e3d2;
    --success-500: #1f8a6a;
    --success-600: #1a7559;
    --success-900: #0e3f30;

    --warning-50: #fdf8f0;
    --warning-100: #f7ebd1;
    --warning-500: #c97b00;
    --warning-600: #a86700;

    --danger-50: #fdf2f3;
    --danger-100: #fae1e4;
    --danger-500: #d7263d;
    --danger-600: #b61f33;
    --danger-700: #93192a;
    --danger-900: #570f19;

    --amber-50: #fffbeb;
    --amber-100: #fef3c7;
    --amber-400: #fbbf24;
    --amber-700: #b45309;
    --amber-900: #78350f;

    /* Neutrals (Light) */
    --bg: #f8f9fa;
    --surface: #ffffff;
    --surface-2: #f3f4f6;
    --surface-3: #f9fafb;
    --border: #e5e7eb;
    --border-soft: #f3f4f6;
    --text: #1f2937;
    --text-strong: #111827;
    --text-soft: #4b5563;
    --text-muted: #6b7280;
    --text-dim: #9ca3af;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
    --shadow-md: 0 4px 8px -2px rgba(17, 24, 39, 0.08), 0 2px 4px -2px rgba(17, 24, 39, 0.04);
    --shadow-lg: 0 12px 24px -8px rgba(17, 24, 39, 0.16);

    /* Layout */
    --topbar-h: 3.5rem;
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 10px;
    --radius-pill: 9999px;

    /* Typography */
    --font-sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* ---- Chart-Palette (ganztags. Styleguide, aus Referenz gemessen) ----
       Kategoriale Serien-Skala. Hauptserie = dunkles Blau (#004D94). */
    --chart-1: #004d94;   /* Ocean Blueprint — Hauptserie / Primär */
    --chart-2: #0085ff;   /* helles Azurblau — zweite Serie */
    --chart-3: #ff77a2;   /* Pink — Akzent / Highlight */

    /* Semantische Chart-Tokens (im Dark Mode überschrieben) */
    --chart-primary: var(--chart-1);
    --chart-primary-hover: #013a72;
    --chart-fill: rgba(0, 77, 148, 0.12);
    --chart-accent: var(--chart-3);
    --chart-accent-ink: #b83a62;            /* lesbarer dunkler Pink (Text/Border) */
    --chart-accent-soft: rgba(255, 119, 162, 0.14);
    --chart-grid: var(--border);
}

html.dark {
    --bg: #111827;
    --surface: #1f2937;
    --surface-2: #1f2937;
    --surface-3: #111827;
    --border: #374151;
    --border-soft: #374151;
    --text: #f9fafb;
    --text-strong: #f9fafb;
    --text-soft: #d1d5db;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 24px -8px rgba(0, 0, 0, 0.6);

    /* Dunkles Blau wird auf near-black zu dunkel — Chart-Primär aufhellen */
    --chart-primary: #2f8eff;
    --chart-primary-hover: #5aa5ff;
    --chart-fill: rgba(47, 142, 255, 0.18);
    --chart-accent: #ff77a2;
    --chart-accent-ink: #ff9bbb;
    --chart-accent-soft: rgba(255, 119, 162, 0.18);
    --chart-grid: var(--border);
}

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

html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    transition: background-color 0.2s ease, color 0.2s ease;
    min-height: 100dvh;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    color: var(--text-strong);
    font-weight: 700;
    line-height: 1.25;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
p { margin: 0; }

a { color: var(--primary-500); text-decoration: none; }
a:hover { color: var(--primary-600); }
img { max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- App Layout (no sidebar: Topbar + Main) ---------- */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

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

/* Topbar — anders als im Referenz-System hier auf ALLEN Breiten sichtbar,
   da keine Sidebar existiert. Sticky statt fixed, damit Main keinen
   Offset braucht. */
.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.625rem;
    height: var(--topbar-h);
    padding: 0 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
    .topbar { height: 4rem; padding: 0 2rem; }
}
@media (min-width: 1024px) {
    .topbar { padding: 0 3rem; }
}

/* Logo = echtes ganztags.-Zeichen. currentColor: Brand-Rot (Light) / Weiß (Dark). */
.brand { display: flex; align-items: center; flex-shrink: 0; }
.brand-logo { color: var(--brand); height: 1.75rem; width: auto; display: block; }
html.dark .brand-logo { color: #ffffff; }

.topbar-spacer { flex: 1 1 auto; }
.topbar__actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

/* Editierbarer Tool-Titel (linke Seite, aus Referenz übernommen).
   Höhere Spezifität als input[type="text"], um die Form-Defaults zu überschreiben. */
.topbar .project-title {
    width: auto;
    min-width: 6rem;
    max-width: 42vw;
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-strong);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 0.25rem 0.5rem;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.topbar .project-title:hover { background: var(--surface-2); }
.topbar .project-title:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
html.dark .topbar .project-title:focus { background: #374151; }

.main { flex: 1; padding: 1rem; max-width: 100%; }
@media (min-width: 768px) { .main { padding: 2rem; } }
@media (min-width: 1024px) { .main { padding: 3rem; } }

.container { max-width: 1280px; margin: 0 auto; }
.container-fluid { width: 100%; max-width: none; }

/* ---------- Theme toggle (im Topbar statt Sidebar-Foot) ---------- */
.theme-toggle {
    display: flex;
    background: var(--border);
    border-radius: var(--radius);
    padding: 0.25rem;
    gap: 0.125rem;
}
.theme-toggle__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.5rem;
    color: var(--text-muted);
    border-radius: 5px;
    transition: background 0.12s ease, color 0.12s ease;
}
.theme-toggle__btn:hover { color: var(--text-strong); }
.theme-toggle__btn.is-active {
    background: var(--surface);
    color: var(--text-strong);
    box-shadow: var(--shadow-sm);
}
.theme-toggle__btn svg { width: 1rem; height: 1rem; }

/* ---------- Page Header ---------- */
.page-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}
@media (min-width: 768px) {
    .page-header { flex-direction: row; align-items: center; justify-content: space-between; }
}
.page-header__title { font-size: 1.5rem; font-weight: 700; color: var(--text-strong); }
.page-header__subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.25rem; font-family: var(--font-mono); }
.page-header__actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card > :last-child { margin-bottom: 0; }
.card-title { font-size: 1.125rem; font-weight: 700; color: var(--text-strong); margin-bottom: 1rem; }
.card-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: -0.75rem; margin-bottom: 1rem; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.card-header .card-title { margin-bottom: 0; }

/* ---------- Stats / KPI ---------- */
.stats-section { margin-bottom: 2rem; }
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
/* 4-spaltige Variante für die vier Funnel-KPIs */
@media (min-width: 1024px) { .stats-grid--4 { grid-template-columns: repeat(4, 1fr); } }

.stat-item {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-label { font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.stat-value { font-family: var(--font-mono); font-size: 2.25rem; font-weight: 700; line-height: 1.1; color: var(--text-strong); }
.metric-note { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
    background: var(--surface);
    color: var(--text-strong);
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 1rem; height: 1rem; }
.btn-primary { background: var(--primary-500); border-color: var(--primary-500); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; box-shadow: none; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text-strong); background: var(--surface-2); }
.btn--sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

/* Segmented (view-toggle) — für die Funnel-Basis */
.view-toggle { display: inline-flex; background: var(--surface-2); padding: 0.25rem; border-radius: var(--radius); gap: 0.125rem; }
.btn-toggle {
    background: transparent;
    border: 0;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 5px;
    box-shadow: none;
}
.btn-toggle:hover { color: var(--text-strong); }
.btn-toggle.is-active { background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-sm); }

/* ---------- Notices ---------- */
.notice {
    background: var(--primary-50);
    color: var(--primary-700);
    border: 1px solid var(--primary-100);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}
html.dark .notice { background: rgba(37, 99, 235, 0.12); border-color: rgba(37, 99, 235, 0.25); color: #bfdbfe; }

/* ---------- Forms ---------- */
.form-label { font-size: 0.8125rem; font-weight: 500; color: var(--text-soft); }

input[type="text"],
input[type="date"],
input[type="search"],
select,
textarea {
    width: 100%;
    font: inherit;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
html.dark input[type="text"],
html.dark input[type="date"],
html.dark input[type="search"],
html.dark select,
html.dark textarea { background: #374151; border-color: #4b5563; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
select { cursor: pointer; }
input::placeholder { color: var(--text-dim); }
.select-inline { width: auto; min-width: 11rem; }

/* ---------- Due / Tag pills ---------- */
.due {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-mono);
}
.due.negative { background: var(--danger-50); color: var(--danger-700); }
html.dark .due.negative { background: rgba(215, 38, 61, 0.2); color: #fca5a5; }

/* "Kritisch"-Pill — passend zur Chart-Akzentfarbe (Pink) */
.tag-critical {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    background: var(--chart-accent-soft);
    color: var(--chart-accent-ink);
}

/* ---------- Utilities ---------- */
.muted { color: var(--text-muted); }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: var(--font-mono); }
.cluster { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.cluster--tight { gap: 0.5rem; }
[hidden] { display: none !important; }

/* =========================================================================
   Dashboard-Erweiterungen (projektspezifische Visualisierungen)
   ========================================================================= */

/* Funnel + Feld-Korrekturen nebeneinander */
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: 1.5fr 1fr; align-items: stretch; } }
.dash-grid .card { margin-bottom: 0; }

/* ---- Funnel ---- */
.funnel__note { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); margin-bottom: 1rem; }
.funnel__chart { position: relative; height: 220px; margin-bottom: 1.25rem; }
.funnel__chart svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#funnelFill { fill: var(--chart-fill); }
#funnelStroke { fill: none; stroke: var(--chart-primary); stroke-width: 1.75px; vector-effect: non-scaling-stroke; }

.funnel__steps { display: grid; grid-template-columns: repeat(4, 1fr); }
.funnel__step { display: flex; flex-direction: column; gap: 0.125rem; padding: 0 1rem; border-left: 1px solid var(--border); }
.funnel__step:first-child { padding-left: 0; border-left: none; }
.funnel__step:last-child { padding-right: 0; }
.funnel__pct { font-family: var(--font-mono); font-weight: 700; font-size: 1.875rem; line-height: 1.1; color: var(--text-strong); }
.funnel__step-name { font-size: 0.875rem; font-weight: 600; color: var(--text-strong); margin-top: 0.375rem; }
.funnel__step-sub { font-size: 0.75rem; color: var(--text-muted); }

/* ---- Feld-Korrekturen (horizontale Balken) ---- */
.fields__list { display: flex; flex-direction: column; gap: 0.875rem; }
.field-row { display: grid; grid-template-columns: 110px 1fr 3.25rem 5.25rem; align-items: center; gap: 0.875rem; }
.field-row__name { font-size: 0.875rem; font-weight: 500; color: var(--text); }
.field-row--critical .field-row__name { font-weight: 700; color: var(--text-strong); }
.field-row__track { height: 0.5rem; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.field-row__fill { height: 100%; min-width: 4px; background: var(--chart-primary); border-radius: var(--radius-pill); }
.field-row--critical .field-row__fill { background: var(--chart-accent); }
.field-row__val { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--text); text-align: right; }
.field-row__tag-wrap { display: flex; justify-content: flex-end; }

@media (max-width: 560px) {
    .field-row { grid-template-columns: 84px 1fr 3rem; }
    .field-row__tag-wrap { display: none; }
}

/* ---- Conversion-Verlauf ---- */
.trend__plot { position: relative; padding-top: 1.25rem; }
.trend__avg { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--text-dim); pointer-events: none; z-index: 1; }
.trend__avg-label {
    position: absolute;
    right: 0;
    top: -8px;
    background: var(--surface);
    padding: 0 4px;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--text-muted);
}
.trend__bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; border-bottom: 1px solid var(--border); position: relative; z-index: 2; }
.trend__col { flex: 1; position: relative; height: 100%; display: flex; align-items: flex-end; cursor: pointer; }
.trend__bar { width: 100%; min-height: 3px; background: var(--chart-primary); border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: background 0.12s ease; }
.trend__col:hover .trend__bar { background: var(--chart-primary-hover); }
.trend__tip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-strong);
    color: var(--surface);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    white-space: nowrap;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
    z-index: 5;
}
.trend__col:hover .trend__tip { opacity: 1; }
.trend__note-line { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); border-left: 1px dashed var(--chart-accent); pointer-events: none; z-index: 1; }
.trend__pin {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--chart-accent-ink);
    border-radius: 999px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--chart-accent-ink);
    z-index: 3;
}
.trend__axis { display: flex; justify-content: space-between; margin-top: 0.5rem; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-muted); }
.trend__legend { display: flex; gap: 1.25rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border-soft); font-family: var(--font-mono); font-size: 0.75rem; color: var(--text); }
.trend__legend-muted { color: var(--text-muted); }
.trend__hint { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Draft-Editor (Annotation hinzufügen) */
.draft {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: var(--chart-accent-soft);
    border: 1px solid var(--chart-accent);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-top: 1rem;
}
.draft__label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--chart-accent-ink);
    white-space: nowrap;
}
.draft__input { flex: 1; min-width: 0; }

/* Annotations-Liste */
.anns { margin-top: 1rem; padding-top: 0.5rem; border-top: 1px solid var(--border-soft); }
.anns__title { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 0.5rem 0; }
.ann { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.625rem 0; border-bottom: 1px solid var(--border-soft); }
.ann:last-child { border-bottom: none; }
.ann__num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: var(--surface);
    border: 1.5px solid var(--chart-accent-ink);
    color: var(--chart-accent-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 700;
    margin-top: 1px;
}
.ann__body { flex: 1; min-width: 0; }
.ann__date { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-muted); }
.ann__text { font-size: 0.875rem; color: var(--text-strong); margin-top: 1px; }
.ann__remove { flex-shrink: 0; font-size: 0.75rem; color: var(--text-muted); padding: 2px 4px; border-radius: var(--radius-sm); }
.ann__remove:hover { color: var(--danger-500); background: var(--surface-2); }

/* =========================================================================
   Reporting-Manager: Switcher, Modal, Lade-/Auth-Zustände
   ========================================================================= */

/* ---- Topbar-Switcher (Reporting-Auswahl) ---- */
.switcher { position: relative; }
.switcher__btn { gap: 0.375rem; max-width: 14rem; }
.switcher__btn .switcher__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher__btn svg { width: 0.875rem; height: 0.875rem; flex-shrink: 0; }
.switcher__menu {
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    min-width: 15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    z-index: 40;
}
.switcher__list { display: flex; flex-direction: column; max-height: 16rem; overflow-y: auto; }
.switcher__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text);
}
.switcher__item:hover { background: var(--surface-2); }
.switcher__item.is-active { background: var(--surface-2); font-weight: 600; color: var(--text-strong); }
.switcher__item .switcher__check { width: 1rem; flex-shrink: 0; color: var(--primary-500); }
.switcher__sep { height: 1px; background: var(--border); margin: 0.375rem 0; }
.switcher__action {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-soft);
}
.switcher__action:hover { background: var(--surface-2); color: var(--text-strong); }
.switcher__action--danger:hover { color: var(--danger-500); }
.switcher__empty { padding: 0.5rem 0.625rem; font-size: 0.8125rem; color: var(--text-muted); }

/* ---- Modal (natives <dialog>) ---- */
dialog.modal {
    width: min(40rem, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
dialog.modal::backdrop { background: rgba(17, 24, 39, 0.45); }
.modal__form { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
.modal__header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.modal__header h2 { font-size: 1.125rem; }
.modal__body { padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface-3);
}
.modal__footer .modal__footer-left { margin-right: auto; }

/* Formularraster im Modal */
.form-control { display: flex; flex-direction: column; gap: 0.375rem; }
.form-row { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .form-row--2 { grid-template-columns: 1fr 1fr; } }
.field-hint { font-size: 0.75rem; color: var(--text-muted); }
.section-label {
    font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); margin-top: 0.25rem;
}

/* Funnel-Schritt-Editor (genau 4 Zeilen) */
.step-editor { display: flex; flex-direction: column; gap: 0.5rem; }
.step-editor-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.step-editor-row .sname { flex: 1 1 130px; }
.step-editor-row .stype { flex: 0 0 8.5rem; }
.step-editor-row .smatch { flex: 0 0 8.5rem; }
.step-editor-row .svalue { flex: 2 1 150px; }
.step-editor-row input, .step-editor-row select { width: auto; padding: 0.375rem 0.5rem; font-size: 0.8125rem; }

/* Aufklappbarer Feld-Korrektur-Block */
.fc-toggle { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--text); cursor: pointer; }
.fc-toggle input { width: auto; }
.fc-body { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .fc-body { grid-template-columns: 1fr 1fr; } }
.fc-body[hidden] { display: none; }

/* ---- Lade-Overlay + Auth-Gate ---- */
.overlay {
    position: fixed; inset: 0; z-index: 60;
    display: flex; align-items: center; justify-content: center;
    background: rgba(248, 249, 250, 0.82);
    backdrop-filter: blur(2px);
}
html.dark .overlay { background: rgba(17, 24, 39, 0.82); }
.overlay[hidden] { display: none; }
.overlay__box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    text-align: center;
    max-width: 24rem;
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.overlay__title { font-size: 1.125rem; font-weight: 700; color: var(--text-strong); }
.overlay__text { font-size: 0.875rem; color: var(--text-muted); }
.spinner {
    width: 1.75rem; height: 1.75rem; border-radius: 50%;
    border: 3px solid var(--border); border-top-color: var(--primary-500);
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Statuszeile ---- */
.status { font-size: 0.8125rem; color: var(--text-muted); min-height: 1.25rem; }
.status.error { color: var(--danger-500); }
.status.success { color: var(--success-500); }
.topbar__meta { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-dim); }

/* Einspaltiges Dash, wenn die Feld-Karte ausgeblendet ist */
.dash-grid--single { grid-template-columns: 1fr !important; }
