/**
 * sections/einstellungen/einstellungen.css — SettingsShell (Settings-Framework §4).
 *
 * Self-scoped `.einst-*`/`.setx-*` unter `.einst-wrap` bzw. im Settings-Drawer-Body.
 * NUR Layout/Formsprache der Settings-Fläche — die Bausteine kommen aus den globalen
 * SSOTs (`.app-switch`, `.app-drawer-input`, CustomSelect, `.lod-surface`, `.app-cta-btn`,
 * `.lod-info-banner`). Akzent durchgängig Darkblue/Brand — nie der orange Tertiär-Accent.
 * Formsprache (Spec 2026-07-26): Satz-Formulare, Gruppen-Header, Katalog-Zeilen mit
 * Icon-Chip in Art-Farbe, Kennzahlen-Karten, Drawer-Editor (.setx-*). Vier Breakpoints.
 */

/* Volle Bildschirmbreite (Projektaufnahme-Muster): links Navigations-KARTE,
   rechts EINE große weiße Pane — nichts liegt direkt auf dem grauen Hintergrund. */
.einst-wrap {
  max-width: none;
  margin: 0;
  padding: 0 0 var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 100%;
}

/* ── Such-Treffer-Panel (unter der Section-Toolbar, links verankert) ─────────── */
.lod-section-toolbar { position: relative; }
.einst-search-panel {
  position: absolute; top: 100%; left: var(--space-4); z-index: 40;
  min-width: min(260px, 80vw); max-width: min(340px, 90vw); max-height: 320px; overflow-y: auto;
  background: var(--color-surface); border: 1px solid var(--lod-border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-8);
  padding: var(--space-1);
}
.einst-search-panel[hidden] { display: none; }
.einst-search-hit {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  padding: var(--space-2) var(--space-2-5); border: none; background: none; cursor: pointer;
  border-radius: var(--radius-sm);
}
.einst-search-hit:hover { background: var(--lod-gray-50); }
.einst-search-pfad { font-size: var(--fs-badge, 11px); color: var(--lod-gray-500); }
.einst-search-label { font-size: var(--fs-body, 14px); font-weight: var(--fw-medium); color: var(--color-text); }
.einst-search-leer { padding: var(--space-3); font-size: var(--fs-meta, 12px); color: var(--color-text-muted); }

.einst-banner-box { display: flex; align-items: flex-start; gap: var(--space-2); margin-top: 0; }
.einst-banner-box .ui-ico { flex-shrink: 0; margin-top: 1px; }

/* ── Zwei-Spalten-IA ─────────────────────────────────────────────────────────── */
.einst-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
  flex: 1;
}

/* Navigations-KARTE (weiße Fläche wie der Projektaufnahme-Stepper). */
.einst-nav {
  display: flex; flex-direction: column; gap: var(--space-1);
  position: sticky; top: var(--space-2);
  padding: var(--space-4) var(--space-3) var(--space-5);
}
.einst-nav-group {
  font-size: var(--fs-badge, 11px); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps, .08em); text-transform: uppercase;
  color: var(--lod-gray-500);
  padding: var(--space-2) var(--space-4) var(--space-1);
}
.einst-nav-group:not(:first-child) { margin-top: var(--space-4); border-top: 1px solid var(--lod-gray-100); padding-top: var(--space-4); }
.einst-nav-item { min-height: 40px; }
.einst-nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; text-align: left; cursor: pointer;
  padding: var(--space-2-5) var(--space-4);
  background: transparent;
  border: none; border-left: 3px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--fs-body, 14px); font-weight: var(--fw-medium);
  color: var(--lod-gray-700);
  transition: background var(--duration-fast) var(--ease-soft), color var(--duration-fast) var(--ease-soft);
}
.einst-nav-ico { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; flex-shrink: 0; }
.einst-nav-ico img { width: 20px; height: 20px; opacity: .7; }
.einst-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.einst-nav-dirty {
  flex-shrink: 0; width: 6px; height: 6px; border-radius: var(--radius-circular);
  background: var(--brand-default);
}
.einst-nav-item:hover { background: var(--lod-gray-50); color: var(--lod-darkblue); }
.einst-nav-item:hover .einst-nav-ico img { opacity: .9; }
.einst-nav-item:focus-visible { outline: none; box-shadow: var(--lod-shadow-focus); }
/* Aktiver Bereich = Darkblue gefüllt mit weißer Schrift (App-Konvention, wie der
   aktive ViewSwitcher-Tab) — kein blasser Tint. */
.einst-nav-item.is-active {
  background: var(--lod-darkblue);
  border-left-color: var(--lod-darkblue);
  color: #fff;
  font-weight: var(--fw-semibold);
  box-shadow: 0 1px 2px rgba(15, 46, 72, 0.18);
}
.einst-nav-item.is-active:hover { background: var(--lod-darkblue); color: #fff; filter: brightness(1.1); }
.einst-nav-item.is-active .einst-nav-ico img { opacity: 1; filter: brightness(0) invert(1); }
.einst-nav-item.is-active .einst-nav-dirty { background: #fff; }

.einst-content { min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }

/* ── Breadcrumbs + Intro + Sub-Tabs ──────────────────────────────────────────── */
.einst-crumbs { display: flex; align-items: center; gap: var(--space-1-5); font-size: var(--fs-meta, 12px); color: var(--lod-gray-500); }
.einst-crumbs a { color: var(--lod-gray-500); text-decoration: none; }
.einst-crumbs a:hover { color: var(--lod-darkblue); text-decoration: underline; }
.einst-crumb-sep { color: var(--lod-gray-300); }
.einst-crumb-cur { color: var(--color-text); font-weight: var(--fw-medium); }

.einst-intro { display: flex; align-items: center; gap: var(--space-3); }
.einst-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--lod-darkblue-50);
}
.einst-card-icon img { width: 22px; height: 22px; }
.einst-card-titles { min-width: 0; }
.einst-card-title { margin: 0; font-size: var(--fs-section, 16px); font-weight: var(--fw-semibold); color: var(--color-text); line-height: 1.25; }
.einst-card-thema { margin: 2px 0 0; font-size: var(--fs-meta, 12px); color: var(--color-text-muted); }

.einst-subtabs { display: flex; }

/* ── Die große Settings-Pane (eine weiße Fläche, Sektionen als Blöcke darin) ─── */
.einst-pane {
  padding: var(--space-5) var(--space-6) var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-4);
  min-height: 70vh;
}
.einst-pane .einst-intro { padding-bottom: var(--space-4); border-bottom: 1px solid var(--lod-gray-100); }
.einst-cards { display: flex; flex-direction: column; gap: var(--space-3); }
.einst-card-sec-title { margin: 0 0 var(--space-2); font-size: var(--fs-section, 16px); font-weight: var(--fw-semibold); color: var(--color-text); }
.einst-fields { display: flex; flex-direction: column; }

.einst-group-title {
  margin: var(--space-4) 0 var(--space-1); font-size: var(--fs-badge, 11px); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps, .08em); text-transform: uppercase; color: var(--lod-gray-500);
}
.einst-fields > .einst-group-title:first-child { margin-top: var(--space-1); }

/* ── Setting-Zeile (Skalar) ──────────────────────────────────────────────────── */
.einst-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-3) 0;
  position: relative;
}
.einst-row + .einst-row { border-top: 1px solid var(--lod-gray-100); }
.einst-row--sub { padding-left: var(--space-7); border-left: 2px solid var(--lod-gray-100); margin-left: var(--space-1); }
.einst-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.einst-row-title { font-size: var(--fs-body, 14px); font-weight: var(--fw-semibold); color: var(--color-text); }
/* Typografie der Hilfe steht weiter unten im Typo-Block (eine Quelle). */
.einst-row-ctrl { display: flex; align-items: center; gap: var(--space-2-5); flex-shrink: 0; }
.einst-row-input { display: inline-flex; align-items: center; gap: var(--space-2); }
/* CustomSelect-Trigger in normalen Zeilen: kompakt statt Vollbreite. */
.app-scope .einst-row-input .select[data-cs-trigger] { width: auto; min-width: min(200px, 40vw); max-width: 46vw; }
.einst-input { width: 168px; max-width: 46vw; }
/* Textfelder (Adresse, Register, URLs …) brauchen echte Breite — keine Briefmarken. */
.app-scope .einst-input--text { width: min(380px, 46vw); }
.einst-einheit { font-size: var(--fs-meta, 12px); color: var(--color-text-muted); }

/* Satz-Formular: der Satz IST die Zeile — Inline-Controls in Lesefluss-Typo.
   Spezifität bewusst über .app-scope-Ebene, damit die Drawer-Input-Vollbreite
   (.app-scope .app-drawer-input { width:100% }) und der CustomSelect-Trigger
   (button.select, block) im Satz NICHT gewinnen. */
.einst-row--satz { align-items: center; }
.einst-satz { font-size: var(--fs-body, 14px); color: var(--color-text); flex: 1; min-width: 0; }
.app-scope .einst-satz .einst-inline-num,
.app-scope .einst-inline-num {
  width: 64px; min-width: 64px; height: 28px; text-align: center; font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums; display: inline-block; vertical-align: middle;
  margin: 0 2px;
}
.app-scope .einst-satz .select[data-cs-trigger],
.app-scope .einst-inline-select + .select[data-cs-trigger] {
  display: inline-flex; width: auto; min-width: 96px; max-width: 200px; height: 28px;
  vertical-align: middle; margin: 0 2px;
}
.einst-inline-select { display: inline-block; vertical-align: middle; margin: 0 2px; }
/* Zahl + Einheit als eine Umbruch-Einheit (sonst rutscht die Einheit allein in
   die naechste Zeile und der Satz liest sich zerrissen). */
.einst-satz-teil { white-space: nowrap; }

.einst-changed {
  display: inline-flex; align-items: center; height: 20px; padding: 0 var(--space-2);
  background: var(--brand-light); color: var(--lod-darkblue);
  border-radius: var(--radius-pill-sm); font-size: var(--fs-badge, 11px); font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.einst-saved { display: inline-flex; }
.einst-saved .ui-ico img { width: 16px; height: 16px; }
.einst-row-error { flex-basis: 100%; font-size: var(--fs-meta, 12px); color: var(--status-danger-fg); padding-top: var(--space-1); }

@keyframes einst-hit-blink {
  0% { box-shadow: 0 0 0 3px var(--brand-light); }
  100% { box-shadow: 0 0 0 3px transparent; }
}
.einst-row--hit { animation: einst-hit-blink 1.6s var(--ease-soft) 1; border-radius: var(--radius-sm); }

/* ── Katalog: Zeilen (Abwesenheitsarten) ─────────────────────────────────────── */
.einst-liste { display: flex; flex-direction: column; gap: var(--space-2); }
.einst-liste-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.einst-liste-actions { flex-shrink: 0; }
.einst-liste-loading, .einst-liste-empty { font-size: var(--fs-meta, 12px); color: var(--color-text-muted); padding: var(--space-2) 0; }
.einst-liste-rows { display: flex; flex-direction: column; }

/* Katalog-Tabelle: Kopfzeile + Zeilen teilen EIN Spaltenraster, damit Name,
   Konto, Regeln und Aktionen untereinander stehen (vorher freies Flex-Fließen —
   wirkte unsortiert). Die Konto-Spalte existiert nur bei Katalogen mit
   Konto-Zuordnung (.has-konto), sonst fällt sie ganz weg. */
.einst-kat-table { display: flex; flex-direction: column; --einst-kat-cols: minmax(0, 1fr) auto auto; }
.einst-kat-table.has-regeln { --einst-kat-cols: minmax(0, 1fr) minmax(0, 1.4fr) auto auto; }
.einst-kat-table.has-konto { --einst-kat-cols: minmax(0, 1fr) 150px auto auto; }
.einst-kat-table.has-konto.has-regeln { --einst-kat-cols: minmax(0, 1fr) 150px minmax(0, 1.2fr) auto auto; }
.einst-kat-head, .einst-kat-row { display: grid; grid-template-columns: var(--einst-kat-cols); align-items: center; }

.einst-kat-head {
  padding: 0 var(--space-2-5) var(--space-1-5);
  font-size: var(--fs-badge, 11px); font-weight: var(--fw-semibold);
  letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted);
  border-bottom: 1px solid var(--lod-gray-200);
}
.einst-kat-c-art { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.einst-kat-c-konto, .einst-kat-c-regeln { min-width: 0; display: flex; align-items: center; gap: var(--space-1-5); }
.einst-kat-c-sw, .einst-kat-c-akt { display: flex; align-items: center; justify-content: flex-end; }
.einst-kat-c-sw { padding-right: var(--space-2); }
.einst-kat-leer { font-size: var(--fs-meta, 12px); color: var(--lod-gray-400); }

.einst-kat-row {
  gap: var(--space-3);
  min-height: 52px; padding: var(--space-2) var(--space-2-5);
  cursor: pointer; border-radius: var(--radius-md);
}
.einst-kat-row + .einst-kat-row { border-top: 1px solid var(--lod-gray-100); }
.einst-kat-row:hover { background: var(--lod-gray-50); }
.einst-kat-row:focus-visible { outline: none; box-shadow: var(--lod-shadow-focus); }
.einst-kat-row.is-inaktiv { opacity: .6; }
.einst-kat-row.is-inaktiv .einst-kat-name { color: var(--lod-gray-500); }

/* Icon-Chip: Fläche = Art-Farbe @12%, Symbol via mask in der Art-Farbe. */
.einst-kat-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--art-farbe, var(--lod-gray-400)) 14%, transparent);
}
.einst-kat-ico {
  display: inline-block; width: 18px; height: 18px;
  background-color: var(--art-farbe, var(--lod-gray-500));
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.einst-kat-chip--preview { width: 40px; height: 40px; }
.einst-kat-chip--preview .einst-kat-ico { width: 22px; height: 22px; }
.einst-kat-chip--drawer { width: 28px; height: 28px; }

.einst-kat-name {
  font-size: var(--fs-body, 14px); font-weight: var(--fw-semibold); color: var(--color-text);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.einst-kat-badges { display: flex; align-items: center; gap: var(--space-1-5); min-width: 0; overflow: hidden; }
.einst-kat-schnell { flex-shrink: 0; }
.einst-kat-edit { flex-shrink: 0; }

.einst-row-badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 var(--space-2);
  font-size: var(--fs-badge, 11px); font-weight: var(--fw-semibold);
  background: var(--lod-gray-100); color: var(--lod-gray-700);
  border-radius: var(--radius-pill-sm); white-space: nowrap;
}
.einst-row-badge--konto { background: var(--lod-darkblue-50); color: var(--lod-darkblue); }
.einst-row-badge--off { background: var(--status-danger-soft, #fdecea); color: var(--lod-danger); }
.einst-row-badge[style*="--typ-farbe"] { background: color-mix(in srgb, var(--typ-farbe) 14%, #fff); color: var(--typ-farbe); }

/* ── Katalog: Kennzahlen-Karten (Anspruchskonten) ────────────────────────────── */
.einst-konto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}
.einst-konto-card { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); text-align: left; }
.einst-konto-card.is-inaktiv { opacity: .65; }
.einst-konto-head { display: flex; align-items: center; gap: var(--space-2); }
.einst-konto-name { font-size: var(--fs-section, 16px); font-weight: var(--fw-semibold); color: var(--color-text); flex: 1; min-width: 0; }
.einst-konto-kpis { display: flex; gap: var(--space-5); }
.einst-konto-kpi { display: flex; flex-direction: column; gap: 2px; }
.einst-konto-kpi-wert { font-size: 22px; font-weight: var(--fw-semibold); color: var(--color-text); font-variant-numeric: tabular-nums; }
.einst-konto-kpi-label { font-size: var(--fs-badge, 11px); color: var(--lod-gray-500); }
.einst-konto-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  border-top: 1px solid var(--lod-gray-100); padding-top: var(--space-3); margin-top: auto;
}
.einst-konto-arten { display: flex; flex-wrap: wrap; gap: var(--space-1-5); min-width: 0; }
.einst-konto-arten-leer { font-size: var(--fs-meta, 12px); color: var(--color-text-muted); }

/* ── Drawer-Editor (.setx) ───────────────────────────────────────────────────── */
.setx { display: flex; flex-direction: column; padding: var(--space-1) var(--space-1) var(--space-3); }
.setx .einst-group-title { margin-top: var(--space-5); }
.setx > .einst-group-title:first-child { margin-top: var(--space-1); }
/* EINE Spaltenachse für ALLE Drawer-Zeilen: Label links (nimmt den Rest),
   Eingabe rechts in fester Breite. Vorher bestimmte jede Zeile ihre Breiten
   selbst (Flex + space-between) — gemessen sprangen die Labels zwischen 271
   und 447px und gleichartige Eingaben zwischen 44 und 220px. */
.setx { --setx-ctrl: 260px; }
.setx-row {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--setx-ctrl);
  align-items: center; gap: var(--space-4);
  min-height: 52px; padding: var(--space-2) 0;
}
.setx-row + .setx-row { border-top: 1px solid var(--lod-gray-100); }
.setx-row--sub { padding-left: var(--space-6); border-left: 2px solid var(--lod-gray-100); margin-left: var(--space-1); }
/* Satz-Zeile und volle Zeile spannen über beide Spalten. */
.setx-row--satz { display: block; }
.setx-row--voll { grid-template-columns: minmax(0, 1fr); }
/* Alles in der Control-Spalte füllt sie aus bzw. sitzt rechts — nie irgendwo dazwischen. */
.app-scope .setx-row > .setx-feld,
.app-scope .setx-row > .setx-select-wrap,
.app-scope .setx-row > .setx-input { width: 100%; max-width: none; justify-self: stretch; }
.app-scope .setx-row > .app-switch { justify-self: end; }
.setx-select-wrap { display: flex; min-width: 0; }
.app-scope .setx-select-wrap .select[data-cs-trigger] { width: 100%; min-width: 0; height: 32px; }
/* Option-Text NIE umbrechen (Kyle: „Kein Konto bricht in zwei Zeilen"). */
.app-scope .setx-select-wrap .cs-label {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: var(--fs-body, 14px); line-height: 1.55;
}
/* Mehrzeiler brauchen Höhe UND die volle Zeilenbreite — sonst landet ein
   Abwesenheits-Fließtext in einem 53px-Feld (gemessen). */
.app-scope .setx-row--stapel { grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: var(--space-2); }
.app-scope .setx-textarea { width: 100%; min-height: 92px; resize: vertical; font-size: var(--fs-body, 14px); line-height: 1.55; }
/* „Farbe"/„Symbol": die Klasse hatte KEIN CSS und erbte 16px aus dem Drawer-Body. */
.einst-cell-label { font-size: var(--fs-body, 14px); font-weight: var(--fw-medium, 500); color: var(--color-text); }
.setx-swatch--custom { font-size: var(--fs-body, 14px); font-weight: var(--fw-semibold); }
.setx-konto-hint { padding: 0 0 var(--space-2); }

.setx-footer {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  margin-top: var(--space-5); padding-top: var(--space-4);
  border-top: 1px solid var(--lod-border);
}
.setx-footer-actions { display: inline-flex; gap: var(--space-2); }

/* Erscheinung: Live-Preview + beschriftete Farb-/Symbol-Blöcke. */
.setx-appearance { display: flex; align-items: flex-start; gap: var(--space-5); padding: var(--space-3) 0; }
.setx-appearance-preview { display: flex; flex-direction: column; align-items: center; gap: var(--space-1-5); flex-shrink: 0; }
.setx-appearance-hint { font-size: var(--fs-badge, 11px); color: var(--lod-gray-500); }
.setx-appearance-ctl { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; flex: 1; }
.setx-appearance-symlabel { margin-top: var(--space-2); }
.setx-satz-hint { display: block; line-height: 1.5; margin-top: 2px; }
.setx-swatches { display: flex; flex-wrap: wrap; gap: var(--space-1-5); align-items: center; }
.setx-swatch {
  width: 24px; height: 24px; border-radius: var(--radius-circular);
  border: 2px solid transparent; cursor: pointer; padding: 0; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.setx-swatch:hover { transform: scale(1.1); }
.setx-swatch.is-sel { border-color: var(--brand-default); box-shadow: 0 0 0 2px var(--brand-light); }
.setx-swatch--custom {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--lod-gray-100); color: var(--lod-gray-600); font-weight: var(--fw-bold);
  position: relative; overflow: hidden;
}
.setx-swatch--custom .einst-color { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: none; }

.einst-icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, 34px); gap: var(--space-1);
  padding: var(--space-2);
  background: var(--lod-gray-50); border: 1px solid var(--lod-border); border-radius: var(--radius-md);
}
.einst-icon-grid[hidden] { display: none; }
.einst-icon-opt {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
}
.einst-icon-opt:hover { background: var(--color-surface); border-color: var(--lod-border); }
.einst-icon-opt.is-sel { background: var(--lod-darkblue-50); border-color: var(--brand-default); }

/* Nativer Farb-Input (Fallback „eigene Farbe"). */
.einst-color {
  width: 40px; height: 28px; padding: 2px; cursor: pointer;
  border: 1px solid var(--lod-gray-200); border-radius: var(--radius-md); background: var(--color-surface);
}
.einst-color::-webkit-color-swatch-wrapper { padding: 0; }
.einst-color::-webkit-color-swatch { border: none; border-radius: var(--radius-sm); }

/* ── Responsive (Notebook 1000–1399 · Tablet 600–999 · Mobile <600) ──────────── */
@media (max-width: 1399px) {
  .einst-konto-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  /* Konto-Spalte schmaler, Regeln dürfen zuerst schrumpfen. */
  .einst-kat-table.has-konto { --einst-kat-cols: minmax(0, 1fr) 120px auto auto; }
  .einst-kat-table.has-konto.has-regeln { --einst-kat-cols: minmax(0, 1fr) 120px minmax(0, 1fr) auto auto; }
}
@media (max-width: 999px) {
  .einst-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  /* Tablet: Regeln-Spalte weicht, Konto + Name bleiben lesbar. */
  .einst-kat-table { --einst-kat-cols: minmax(0, 1fr) auto auto; }
  .einst-kat-table.has-konto, .einst-kat-table.has-konto.has-regeln { --einst-kat-cols: minmax(0, 1fr) 120px auto auto; }
  .einst-kat-table.has-regeln { --einst-kat-cols: minmax(0, 1fr) auto auto; }
  .einst-kat-c-regeln { display: none; }
  .einst-nav {
    position: static; flex-direction: row; flex-wrap: nowrap; align-items: center;
    overflow-x: auto; gap: var(--space-2); padding-bottom: var(--space-1);
    -webkit-overflow-scrolling: touch;
  }
  .einst-nav-group { padding: 0 var(--space-1); flex-shrink: 0; }
  .einst-nav-item { width: auto; flex-shrink: 0; border-left: none; border-bottom: 2px solid transparent; border-radius: var(--radius-md); }
  .einst-nav-item.is-active { border-left: none; border-bottom-color: var(--brand-default); }
  .einst-search-panel { left: var(--space-2); right: var(--space-2); max-width: none; }
  .einst-search-panel { left: 0; right: 0; width: auto; }
  .einst-pane { padding: var(--space-4); }
}
@media (max-width: 599px) {
  .einst-wrap { padding: var(--space-4) 0 var(--space-6); }
  .einst-row { flex-wrap: wrap; }
  .einst-row-ctrl { justify-content: flex-end; flex: 1; }
  .einst-input { width: 100%; max-width: none; }
  .einst-kat-badges { display: none; } /* Mobile: Chip+Name+Switch reichen — Details im Drawer */
  /* Mobile: nur noch Name + Aktiv + Bearbeiten; Konto steht im Drawer. */
  .einst-kat-table, .einst-kat-table.has-konto,
  .einst-kat-table.has-regeln, .einst-kat-table.has-konto.has-regeln { --einst-kat-cols: minmax(0, 1fr) auto auto; }
  .einst-kat-c-konto { display: none; }
  .einst-kat-head { display: none; } /* Spaltenköpfe ohne Spalten sind nur Rauschen */
  .einst-row--stapel .einst-row-input { max-width: none; }
  .einst-konto-grid { grid-template-columns: minmax(0, 1fr); }
  .setx-input { width: 100%; max-width: none; }
  .setx-row { flex-wrap: wrap; }
}

/* ── Sektions-Blöcke mit Klapp-Kopf ──────────────────────────────────────────
   Jede Sektion ist ein umrandeter Block mit getöntem Kopf: Titel + Kurztext +
   optionale Primär-Aktion. Der ganze Kopf ist die Klappfläche (Hover sichtbar).
   Zustand pro Nutzer in LoD.prefs; Startzustand aus dem Deskriptor (Feld zugeklappt). */
.einst-sec {
  border: 1px solid var(--lod-gray-150, #e5e8ec);
  border-radius: var(--radius-lg, 10px);
  background: #fff;
  overflow: hidden;
}
.einst-sec-head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--lod-gray-50, #f7f8fa);
  border-bottom: 1px solid var(--lod-gray-150, #e5e8ec);
}
.einst-sec.is-zu .einst-sec-head { border-bottom-color: transparent; }
.einst-sec-toggle {
  display: flex; align-items: center; gap: var(--space-2-5);
  flex: 1; min-width: 0; padding: 0;
  background: none; border: 0; cursor: pointer; text-align: left; color: inherit; font: inherit;
}
.einst-sec-toggle:focus-visible { outline: none; box-shadow: var(--lod-shadow-focus); border-radius: var(--radius-sm); }
.einst-sec-chev {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: var(--radius-circular, 50%);
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--lod-gray-200, #dfe3e8);
  transition: transform var(--duration-fast, .15s) var(--ease-soft, ease), background var(--duration-fast, .15s) var(--ease-soft, ease);
}
.einst-sec-chev img { width: 14px; height: 14px; opacity: .6; }
.einst-sec.is-zu .einst-sec-chev { transform: rotate(-90deg); }
.einst-sec-toggle:hover .einst-sec-chev { background: var(--lod-gray-100, #eef0f3); }
/* Sektionskopf MUSS größer sein als ein Feld-Label. Vorher trugen beide
   13px/600 — vermessen im Browser: eine Überschrift, die genauso schreit wie
   die Zeile darunter, erzeugt genau den „alles durcheinander"-Eindruck. */
.einst-sec-head .einst-card-sec-title { margin: 0; font-size: var(--fs-card-title, 14px); font-weight: var(--fw-semibold); letter-spacing: -.01em; }
.einst-sec-thema {
  font-size: var(--fs-meta, 12px); color: var(--color-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.einst-sec-neu { flex-shrink: 0; }
/* Nicht klappbare Sektion (nur eine Tabelle): gleiche Optik, aber kein Cursor,
   kein Hover, kein Chevron — der Kopf ist reine Überschrift. */
.einst-sec-toggle--fix { cursor: default; background: none; border: none; }
.einst-sec-toggle--fix:hover { background: none; }
.einst-sec--fix .einst-fields { display: block; }
/* Inhalt: eigene Innenluft, damit die erste Zeile nicht am Kopf klebt. */
.einst-sec .einst-fields { padding: var(--space-2) var(--space-4) var(--space-3); }
.einst-sec.is-zu .einst-fields { display: none; }

/* ── Einheitliche Zeilen-Typografie ─────────────────────────────────────────────
   Kyle: „zig unterschiedliche Schriftarten". Drei Ebenen, sauber gestaffelt:
   Sektionskopf 14px/600 → Zeilen-Label 13px/500 → Hilfetext 12px/400. Label- und
   Satz-Zeilen teilen Größe, Farbe und Zeilenhöhe; nur die Anordnung unterscheidet
   sich (Label links/Control rechts vs. Control im Lesefluss). */
.einst-row-title,
.app-scope .einst-satz { font-size: var(--fs-body, 14px); color: var(--color-text); line-height: 1.55; }
.einst-row-title { font-weight: var(--fw-medium, 500); }
.app-scope .einst-satz { font-weight: var(--fw-regular, 400); }
/* Satz-Zeilen brauchen Luft für die Inline-Controls — die kommt aus deren
   Höhe (28px, unten), NICHT aus einer 2.1er Zeilenhöhe, die den Satz optisch
   auseinanderreißt und die Zeile aus dem Rhythmus der Label-Zeilen wirft. */
.app-scope .einst-row--satz { align-items: center; min-height: 56px; }
.app-scope .einst-satz > * { vertical-align: middle; }
/* Hilfetext: 13px statt 12px und ein Maß, das zur Pane-Breite passt. Vermessen:
   `max-width: 78ch` auf 12px = 505px Umbruchkante bei 1144px Container — ein
   Ein-Zeiler brach in drei Zeilen um, während rechts 600px leer blieben
   (Kyle: „Mini Text mit 3410230 Umbrüchen"). Untergeordnet bleibt er über
   Gewicht (400 gegen 500) und Farbe, nicht über Winzigkeit. */
.einst-row-hilfe {
  font-size: var(--fs-body, 14px); font-weight: var(--fw-regular, 400);
  color: var(--color-text-secondary); line-height: 1.5; max-width: 88ch;
}
/* Damit das Maß überhaupt greifen kann, muss die Textspalte den freien Platz
   nehmen — vorher blieb sie auf Content-Breite stehen. */
.einst-row-main { flex: 1 1 auto; }

/* Gestapelte Zeile: Label → Hilfe → Eingabe untereinander, alles am selben
   linken Rand und auf demselben Lesemaß. Nur für breite Eingaben (Freitext,
   Mehrzeiler); schmale Controls bleiben rechts in der Zeile. */
.einst-row--stapel { flex-direction: column; align-items: stretch; gap: var(--space-2); }
.einst-row--stapel .einst-row-ctrl { justify-content: flex-start; flex-wrap: wrap; }
.einst-row--stapel .einst-row-input { flex: 1 1 auto; min-width: 0; max-width: 88ch; }
.app-scope .einst-row--stapel .einst-input--text { width: 100%; }
.app-scope .einst-textarea {
  width: 100%; min-height: 92px; resize: vertical;
  font-size: var(--fs-body, 14px); line-height: 1.55;
}
/* Hilfetext unter einer Satz-Zeile bekommt dieselbe Optik wie unter Label-Zeilen. */
.einst-row--satz .einst-row-hilfe { margin-top: 2px; }

/* ── Wochenplan-Tabelle (Feld-Typ 'wochenplan') ──────────────────────────────
   Sieben Zeilen Mo–So mit Arbeitstag-Schalter und den Zeiten DIREKT in der Zeile.
   Kyle-Feedback 2026-07-26: Zeiten hinter einem Stift pro Tag zu verstecken war
   falsch — die Woche muss auf einen Blick lesbar und sofort editierbar sein.
   Ein Grid mit fixen Spalten sorgt dafür, dass alle Felder gleich groß sind
   (auch im Standort-Drawer, weil dort dieselbe Komponente rendert). */
.einst-wplan-table {
  display: flex; flex-direction: column;
  border: 1px solid var(--lod-gray-150, #e5e8ec);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
}
.einst-wplan-head,
.einst-wplan-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) 92px repeat(4, minmax(96px, 1fr));
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
}
.einst-wplan-head {
  background: var(--lod-gray-50, #f7f8fa);
  border-bottom: 1px solid var(--lod-gray-150, #e5e8ec);
  font-size: var(--fs-badge, 11px); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps, .08em); text-transform: uppercase;
  color: var(--lod-gray-500);
}
.einst-wplan-row + .einst-wplan-row { border-top: 1px solid var(--lod-gray-100, #eef0f3); }
.einst-wplan-row:hover { background: var(--lod-gray-25, #fbfcfd); }
.einst-wplan-c-tag {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-body, 14px); font-weight: var(--fw-medium); color: var(--color-text);
}
.einst-wplan-row.is-aus .einst-wplan-c-tag { color: var(--color-text-muted); }
.einst-wplan-dot {
  width: 6px; height: 6px; border-radius: var(--radius-circular, 50%);
  background: var(--brand-default); flex-shrink: 0;
}
/* Zeit-Eingaben: gleiche Breite in jeder Spalte, kompakt und mittig. */
.app-scope .einst-wplan-zeit {
  width: 100%; min-width: 0; text-align: center;
  font-variant-numeric: tabular-nums;
}
.einst-wplan-row.is-aus .einst-wplan-zeit { opacity: .45; }
.einst-wplan-fuss {
  margin: var(--space-2) 0 0; font-size: var(--fs-meta, 12px); color: var(--color-text-muted);
}
.einst-wplan-loading { padding: var(--space-3); font-size: var(--fs-meta, 12px); color: var(--color-text-muted); }

/* Notebook/Tablet: Pausen-Spalten dürfen schmaler werden, bevor umgebrochen wird. */
@media (max-width: 1399px) {
  .einst-wplan-head,
  .einst-wplan-row { grid-template-columns: minmax(100px, 1.2fr) 84px repeat(4, minmax(84px, 1fr)); gap: var(--space-2); }
}
@media (max-width: 999px) {
  /* Tablet: zwei Zeilen je Tag — Kopfzeile entfällt, Felder tragen aria-label. */
  .einst-wplan-head { display: none; }
  .einst-wplan-row {
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-areas: 'tag tag sw sw' 'von bis pv pb';
    row-gap: var(--space-2);
  }
  .einst-wplan-c-tag { grid-area: tag; }
  .einst-wplan-c-sw { grid-area: sw; justify-self: end; }
}

/* ── Zwei gemessene Ursachen (Playwright, 2026-07-26) ────────────────────────
   1) Der LEERE Banner-Div zählte als Flex-Item und erzeugte über den Wrap-Gap
      16px Extra-Luft ZUSÄTZLICH zur Scroll-Polsterung → Abstand oben war 32px
      statt der üblichen 16px. Leeren Banner ausblenden statt Gaps zu frisieren.
   2) Die Nav-Items sind <button> in .app-scope — der App-Scope-Button-Reset
      (`.app-scope button { padding:0 }`) ist SPEZIFISCHER als `.einst-nav-item`
      und hat mein Padding überstimmt (deshalb klebten Icon und Änderungs-Punkt
      am Rand). Über .app-scope qualifizieren, dann greift es. */
#einst-banner:empty { display: none; }
.app-scope .einst-nav-item {
  padding: var(--space-2-5) var(--space-4);
  border-left: 3px solid transparent;
}
.app-scope .einst-nav-item.is-active { border-left-color: var(--lod-darkblue); }
.app-scope .einst-nav-group { padding: var(--space-2) var(--space-4) var(--space-1); }

/* Hilfetexte über Listen/Tabellen: volle Breite statt schmaler Flex-Spalte.
   Kyle: „Was soll dieser Mini-Text hier mit 3410230 Umbrüchen?" — der Text stand
   als Flex-Kind neben dem Button und brach nach ~400px vierzeilig um. */
.einst-liste-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap;
}
.einst-liste-head .einst-row-hilfe { flex: 1 1 100%; max-width: 92ch; }
.einst-sec .einst-liste-head:has(> span:empty) { display: none; }

/* Wochenplan als Sub-Feld im Editor-Drawer: volle Zeilenbreite (die Tabelle
   braucht Platz), Label darüber statt links daneben. */
.einst-setx-row--voll { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) 0; }
.einst-setx-row--voll .einst-setx-label {
  font-size: var(--fs-body, 14px); font-weight: var(--fw-semibold); color: var(--color-text);
}
.einst-wplan--sub .einst-wplan-head,
.einst-wplan--sub .einst-wplan-row {
  grid-template-columns: minmax(88px, 1fr) 72px repeat(4, minmax(72px, 1fr));
  gap: var(--space-2); padding: var(--space-1-5) var(--space-2);
}
.einst-wplan--sub .einst-wplan-fuss { display: none; }
.einst-wplan--sub { overflow-x: auto; }
.einst-wplan--sub .einst-wplan-table { min-width: 560px; }
.app-scope .einst-wplan--sub .einst-wplan-zeit { padding-left: var(--space-1); padding-right: var(--space-1); }

/* Firmensitz-Kennzeichnung in der Standort-Liste (Kyle: „nirgends ersichtlich,
   dass das der Firmenstandard ist"). */
.einst-row-badge--std {
  background: var(--lod-darkblue); color: #fff; border-color: var(--lod-darkblue);
}

/* ── Variablen-Leiste + Vorschau (LoD.TextVariablen) ─────────────────────────
   Sitzt unter dem Textfeld: Einfuege-Menue, Vorschau-Knopf und die Warnung bei
   unbekannten Platzhaltern. In der gestapelten Zeile spannt sie ueber die Breite. */
.einst-var-host { min-width: 0; }
.einst-row--stapel .einst-var-host { grid-column: 1 / -1; }
.tvar-leiste { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding-top: var(--space-1-5); }
.tvar-warnung {
  font-size: var(--fs-meta, 12px); color: var(--status-warning-fg, #8a5a00);
  background: var(--status-warning-soft, #fff6e5); border-radius: var(--radius-sm);
  padding: 2px var(--space-2); min-width: 0;
}
.tvar-warnung[hidden] { display: none; }

.tvar-vorschau-body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-1) var(--space-1) var(--space-3); }
.tvar-vorschau-hinweis { margin: 0; font-size: var(--fs-body, 14px); color: var(--color-text-secondary); }
.tvar-vorschau-warn { margin: 0; font-size: var(--fs-meta, 12px); color: var(--status-warning-fg, #8a5a00); }
/* Termin-Attrappe: bewusst schlicht (ein Balken + Titel) — sie soll den Betreff
   zeigen, nicht Outlook nachbauen. */
.tvar-vorschau-termin {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-3-5);
  border: 1px solid var(--lod-gray-150, #e5e8ec); border-radius: var(--radius-md);
  background: var(--color-surface, #fff);
}
.tvar-vorschau-termin-bar { width: 4px; align-self: stretch; min-height: 28px; border-radius: var(--radius-pill-sm); background: var(--lod-darkblue); }
.tvar-vorschau-termin-titel { font-size: var(--fs-body, 14px); font-weight: var(--fw-semibold); color: var(--color-text); }

.tvar-vorschau-seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--lod-gray-100, #eef0f3); border-radius: var(--radius-md); align-self: flex-start; }
.app-scope .tvar-seg-btn {
  padding: var(--space-1) var(--space-3); border: none; background: transparent; cursor: pointer;
  font-size: var(--fs-meta, 12px); font-weight: var(--fw-medium); color: var(--lod-gray-700); border-radius: var(--radius-sm);
}
.app-scope .tvar-seg-btn.is-active { background: var(--color-surface, #fff); color: var(--lod-darkblue); font-weight: var(--fw-semibold); box-shadow: var(--shadow-2, 0 1px 2px rgba(0,0,0,.08)); }
/* Mail-HTML laeuft im sandboxed iframe — es traegt eigene Inline-Styles und darf
   die App-Optik nicht anfassen. */
.tvar-vorschau-mail { border: 1px solid var(--lod-gray-150, #e5e8ec); border-radius: var(--radius-md); overflow: hidden; background: #fff; }
.tvar-vorschau-frame { display: block; width: 100%; height: 460px; border: 0; }

@media (max-width: 999px) {
  .tvar-vorschau-frame { height: 380px; }
}
@media (max-width: 599px) {
  .tvar-leiste { gap: var(--space-1-5); }
  .tvar-leiste .app-cta-btn { flex: 1 1 auto; }
  .tvar-vorschau-frame { height: 320px; }
}

/* ── Rich-Text-Feld (typ 'html', LoD.RichText) ───────────────────────────────
   Der Editor bringt seine Optik selbst mit (SunEditor); hier nur die Einbettung:
   volle Zeilenbreite, Rahmen im App-Stil, Lesemaß fuer den Editorbereich. */
.einst-html { grid-column: 1 / -1; min-width: 0; width: 100%; }
.einst-html-host { max-width: 100%; }
/* SunEditor setzt eigene Rahmen/Radien — auf App-Werte ziehen, damit der Editor
   nicht wie ein Fremdkoerper im Formular sitzt. */
.einst-html-host .sun-editor { border-radius: var(--radius-md); border-color: var(--lod-gray-200); }
.einst-html-host .se-toolbar { border-top-left-radius: var(--radius-md); border-top-right-radius: var(--radius-md); }
.einst-html-host .se-wrapper-inner { font-family: var(--font-family-base, 'Segoe UI', Tahoma, Arial, sans-serif); }

@media (max-width: 599px) {
  .einst-html-host .se-toolbar { overflow-x: auto; }
}
