/* ============================================================================
   Zeiterfassung Simple — CSS
   Quelle der Tokens: brand-assets/tokens/ss-tokens.css
   Theme: Light (Brand-konform) ist Default; Dark optional.
   ========================================================================== */

/* ---- Reset / Basis ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink-soft);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
h1, h2, h3 { font-family: 'Source Serif 4', Georgia, serif; font-weight: 500; color: var(--ink); letter-spacing: -0.01em; }
.mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- Theme: Light (SS Brand) ---- */
:root, html[data-theme="light"] {
  /* Topbar-Höhe als zentraler Bezugspunkt für alle Sticky-Elemente.
     Wenn sich die Topbar in der Höhe ändert, hier anpassen — alle sticky
     Header/Filter ziehen automatisch nach. */
  --topbar-h:     64px;
  /* Maximalbreite des Inhalts (Topbar + Content). Gilt fuer BEIDE Themes —
     muss im :root stehen, sonst ist sie im Light-Theme undefiniert und der
     Inhalt waere unbegrenzt breit. */
  --content-max: 1800px;
  --bg:           #FAF5EC;            /* ss-cream */
  --surface:      #FFFFFF;            /* ss-paper */
  --surface-2:    #F1E4D2;            /* ss-sand */
  --ink:          #2A1F18;            /* ss-ink */
  --ink-soft:     #4A382C;            /* ss-ink-2 */
  --ink-faint:    #8A6F5C;            /* ss-muted */
  --line:         rgba(42, 31, 24, 0.12);
  --line-strong:  rgba(42, 31, 24, 0.24);
  --primary:      #8C2D14;            /* ss-brick */
  --primary-soft: rgba(140, 45, 20, 0.10);
  --primary-deep: #7A2A14;            /* ss-rust (hover) */
  --accent:       #E08B2C;            /* ss-amber */
  --accent-soft:  rgba(224, 139, 44, 0.18);
  --accent-deep:  #E8B547;            /* ss-honey (hover) */
  --danger:       #A83218;
  --warn:         #C77A1B;
  --ok:           #4F6E2D;
  --info:         #3D5A7C;            /* gedämpftes Schiefer-Blau — neutraler Akzent fuer „spaeter"-Fristen, klar abgegrenzt von Brick/Danger */
}

/* ---- Theme: Dark (optional, gespiegelt) ---- */
html[data-theme="dark"] {
  --bg:           #2A1F18;
  --surface:      #3A2B21;
  --surface-2:    #4A382C;
  --ink:          #FAF5EC;
  --ink-soft:     #F1E4D2;
  --ink-faint:    #B5A18B;
  --line:         rgba(250, 245, 236, 0.10);
  --line-strong:  rgba(250, 245, 236, 0.22);
  --primary:      #C8472A;
  --primary-soft: rgba(200, 71, 42, 0.18);
  --primary-deep: #E08B2C;
  --accent:       #E08B2C;
  --accent-soft:  rgba(224, 139, 44, 0.20);
  --accent-deep:  #E8B547;
  --danger:       #E07050;
  --warn:         #E8B547;
  --ok:           #94B566;
  --info:         #8AB0D8;
}

/* ---- App-Layout: schwebende sticky Sidebar + scrollbaren Main-Bereich ---- */
.app {
  display: flex;
  align-items: flex-start;
  min-height: 100vh; min-height: 100dvh;
}
.sidebar {
  position: sticky; top: 12px;
  flex: 0 0 240px;
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  margin: 12px 0 12px 12px;
  padding: 16px 14px;
  display: flex; flex-direction: column;
  z-index: 30;
  overflow-y: auto;
  overflow-x: visible;
  border-radius: 22px;
  /* Liquid-Glass */
  background: rgba(255, 252, 246, 0.78);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow:
    0 12px 32px -10px rgba(42, 31, 24, 0.18),
    0 4px 12px -4px rgba(42, 31, 24, 0.08),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.65);
  /* Scrollbar dezent */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar::-webkit-scrollbar { width: 0; height: 0; }
.sidebar:hover { scrollbar-width: thin; }
.sidebar:hover::-webkit-scrollbar { width: 6px; }
.sidebar:hover::-webkit-scrollbar-thumb { background: rgba(42,31,24,0.18); border-radius: 3px; }
html[data-theme="dark"] .sidebar {
  background: rgba(58, 43, 33, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 12px 32px -10px rgba(0, 0, 0, 0.55),
    0 4px 12px -4px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .sidebar:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); }
/* Kopf der Sidebar: Brand (Logo + Schriftzug) links, kleiner Einklapp-Toggle
   rechts. Logo/Schriftzug bewusst weit links (geringes Padding + kleiner Gap),
   damit rechts Platz fuer den Toggle bleibt und nichts umbricht. */
.sidebar-head {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 6px 12px 4px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  flex: 1; min-width: 0;
  color: var(--ink); text-decoration: none;
}
.brand > div { min-width: 0; }
/* Schriftzug darf NICHT umbrechen — sonst entstehen die ungewollten Zeilen. */
.brand-title, .brand-sub { white-space: nowrap; }
/* Kleiner Einklapp-Toggle rechts neben dem Schriftzug — so klein, dass kein
   Umbruch entsteht; schrumpft nie weg (flex-shrink: 0). */
.sidebar-toggle-btn {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  border: 0; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--ink-faint);
  transition: background .12s ease, color .12s ease;
}
.sidebar-toggle-btn:hover { background: var(--surface-2); color: var(--ink); }
.sidebar-toggle-btn .ico-svg { width: 16px; height: 16px; }
.brand-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-title {
  font-family: 'Source Serif 4', serif;
  font-weight: 500; font-size: 18px;
  color: var(--ink); line-height: 1;
}
.brand-sub {
  display: block; margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-faint);
}

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--ink-soft); text-decoration: none;
  border: 0; background: transparent; text-align: left; width: 100%;
  font-size: 14px; font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item .ico { width: 18px; height: 18px; display: inline-grid; place-items: center; flex-shrink: 0; }

/* Lucide-Icon-System (siehe ICONS.md) */
.ico-svg {
  width: 18px; height: 18px;
  stroke-width: 2; flex-shrink: 0; vertical-align: middle;
}
.bottombar-btn .ico-svg { width: 22px; height: 22px; }
.btn .ico-svg { width: 16px; height: 16px; margin-right: 4px; }
.btn-large .ico-svg { width: 20px; height: 20px; margin-right: 6px; }
/* Icon-Only-Buttons: den fuer Text-Buttons gedachten rechten Icon-Abstand
   (.btn .ico-svg margin-right) zuruecknehmen, sonst sitzt das Icon im
   quadratischen Rahmen leicht links statt mittig. */
.icon-btn .ico-svg { width: 16px; height: 16px; margin: 0; }
.topbar .ico-svg { width: 18px; height: 18px; }
.sidebar .spacer { flex: 1; }

/* ---- Einklappbare Sidebar (Desktop) — schmale Icon-Leiste ---- */
/* Umschalten ueber die Klasse .sidebar-collapsed auf .app. Nur >768px, damit
   das mobile Bottom-Sheet (Drawer) voellig unberuehrt bleibt. */
@media (min-width: 769px) {
  .sidebar { transition: flex-basis .22s ease, padding .22s ease; }
  .app.sidebar-collapsed .sidebar {
    flex-basis: 66px;
    padding-left: 8px; padding-right: 8px;
  }
  /* Eingeklappt: nur Logo + Toggle (eigene Zeile darunter), beide zentriert. */
  /* Eingeklappt: Logo + Toggle gestapelt, beide zentriert in der 66px-Leiste. */
  .app.sidebar-collapsed .sidebar-head { flex-direction: column; gap: 8px; padding: 4px 0 12px; }
  .app.sidebar-collapsed .brand { flex: none; gap: 0; justify-content: center; }
  .app.sidebar-collapsed .brand > div:not(.brand-mark) { display: none; }
  .app.sidebar-collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
  .app.sidebar-collapsed .nav-item > span:not(.ico) { display: none; }
  .app.sidebar-collapsed #appVersion { display: none; }
}

.main {
  flex: 1;
  min-width: 0;
  background: transparent;
}
/* Topbar: aussen unsichtbar, der Glas-Effekt sitzt auf .topbar-inner als
   schwebende Pille mit unten abgerundeten Ecken (oben kommt sie auf 0px
   an, damit das Liquid-Glass-Bild beim Scrollen nahtlos auf dem Bildschirm-
   rand „klebt"). Horizontal an dieselbe Breite wie der Content-Bereich
   gebunden (--content-max + 24px Padding ringsum), damit Topbar und Karten
   darunter exakt buendig stehen — auch bei sehr großen Bildschirmen. */
.topbar {
  position: sticky; top: 0; z-index: 30;
  /* Aussen transparent — der sichtbare „Liquid Glass"-Balken sitzt auf
     .topbar-inner (wie die Sidebar). So scrollt der Inhalt UNTER dem Glas
     durch und es entsteht keine Linie auf deckendem Hintergrund. */
  background: transparent;
  padding: 0 24px;
  /* Garantiert, dass die Topbar IMMER exakt --topbar-h hoch ist —
     unabhängig davon, was als Inhalt durchpasst. Damit greifen die
     `top: var(--topbar-h)`-Sticky-Offsets darunter ohne Lücke. */
  min-height: var(--topbar-h);
}
/* Liquid-Glass-Balken wie die Sidebar: durchscheinendes Cream + Blur, mit unten
   abgerundeten Ecken (oben buendig am Bildschirmrand). Etwas hoehere Deckkraft
   als die Sidebar (0.85), damit unter der Topbar durchscrollender Inhalt sauber
   maskiert bleibt. */
.topbar-inner {
  display: flex; align-items: center; gap: 12px;
  max-width: var(--content-max);
  padding: 16px 20px;
  border-radius: 0 0 22px 22px;
  background: rgba(255, 252, 246, 0.85);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-top: none;
  box-shadow: 0 8px 22px -12px rgba(42, 31, 24, 0.18);
}
html[data-theme="dark"] .topbar-inner {
  background: rgba(58, 43, 33, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 22px -12px rgba(0, 0, 0, 0.5);
}
.topbar h1 {
  margin: 0; font-size: 18px; font-weight: 500;
  font-family: 'Source Serif 4', serif;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 6px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line);
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 500;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn-primary {
  background: var(--primary); color: var(--bg);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
.btn-accent {
  background: var(--accent); color: var(--ink);
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-large { padding: 14px 28px; font-size: 16px; border-radius: 8px; }

/* ---- Content ----
   Maximalbreite identisch zu .topbar-inner → beide enden links und rechts
   exakt buendig. Beide haben kein margin: 0 auto, sind also linksbuendig
   im Main-Bereich neben der Sidebar. */
.content { padding: 24px; max-width: var(--content-max); }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 20px; margin-bottom: 16px;
}
.card-warm { background: var(--surface-2); }
.card h2 {
  margin: 0 0 12px; font-size: 22px;
  font-family: 'Source Serif 4', serif; font-weight: 500;
  color: var(--ink);
}
.card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--ink); font-family: 'Inter', sans-serif; }

/* ----- Einklappbare Cards (Accordion-Pattern) -----
   .card-collapsible bekommt einen klickbaren Header mit Chevron rechts.
   Body wird über display:none ausgeblendet. Der Zustand wird via
   localStorage gemerkt (siehe setupCollapsibleCards in JS). */
.card-collapsible { padding: 0; }
/* Kein overflow:hidden hier — sonst greift position:sticky auf <th>
   innerhalb nicht. Der collapsed-Zustand clippt via display:none unten,
   nicht über overflow. */
.card-collapsible > .card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  cursor: pointer; user-select: none;
  gap: 12px;
  transition: background .12s;
  /* Border-Radius matched die Eltern-Card (10px). Wenn die Card collapsed
     ist, sind ALLE vier Ecken rund (siehe Regel weiter unten), sonst nur
     die beiden oberen — damit der Hover-Hintergrund nicht über die runden
     Card-Kanten hinausragt. */
  border-radius: 10px 10px 0 0;
}
.card-collapsible.collapsed > .card-head { border-radius: 10px; }
.card-collapsible > .card-head:hover { background: var(--surface-2); }
.card-collapsible > .card-head h2,
.card-collapsible > .card-head h3 { margin: 0; }
.card-collapsible > .card-head .card-head-right {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-faint);
}
.card-collapsible > .card-head .chevron {
  transition: transform .2s; flex-shrink: 0; color: var(--ink-faint);
}
.card-collapsible.collapsed > .card-head .chevron { transform: rotate(-90deg); }
.card-collapsible > .card-body {
  padding: 0 20px 20px;
}
.card-collapsible.collapsed > .card-body { display: none; }

/* ----- Berechtigungs-Editor (vertikales Layout) ----- */
.perm-editor {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
}
@media (max-width: 700px) {
  .perm-editor { grid-template-columns: 1fr; }
}
.perm-userlist {
  display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--line);
  padding-right: 14px;
}
@media (max-width: 700px) {
  .perm-userlist { border-right: none; padding-right: 0; flex-direction: row; flex-wrap: wrap; }
}
.perm-user-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  text-align: left; cursor: pointer;
  background: transparent; border: 0;
  font: inherit; color: var(--ink-soft);
  width: 100%;
}
.perm-user-btn:hover { background: var(--surface-2); color: var(--ink); }
.perm-user-btn.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.perm-user-btn .perm-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); color: var(--ink-soft);
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.perm-user-btn.active .perm-user-avatar { background: var(--primary); color: var(--surface); }
.perm-user-btn .perm-user-role {
  font-size: 10px; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-left: auto;
}
.perm-detail-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.perm-detail-head h3 { margin: 0; }
.perm-modules {
  display: flex; flex-direction: column;
}
.perm-mod-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.perm-mod-row:last-child { border-bottom: none; }
.perm-mod-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.perm-mod-info .ico-svg { color: var(--ink-faint); flex-shrink: 0; }
.perm-mod-info strong { display: block; font-weight: 500; color: var(--ink); }
.perm-mod-info small { font-size: 12px; color: var(--ink-faint); }
.perm-mod-locked {
  font-size: 11px; color: var(--ink-faint);
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* Toggle-Switch (iOS-Style) — wiederverwendbar */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; transition: .2s;
}
.switch-slider::before {
  position: absolute; content: ""; left: 2px; top: 50%;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px rgba(42,31,24,0.3);
  transform: translateY(-50%);
  transition: .2s;
}
.switch input:checked + .switch-slider { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translate(20px, -50%); }
.switch input:disabled + .switch-slider { opacity: 0.4; cursor: not-allowed; }

/* ===== View-Tabs (zentrale UI-Komponente für Ansichts-Wechsel) =====
   Verwendet als .view-toggle und .fak-viewmode (Legacy-Aliase).
   Pattern: dezente Underline-Tabs — Brand-Linie unten verbindet den
   aktiven Tab visuell mit dem Inhalt darunter. Kein eigener Hintergrund,
   kein Pill-Look — wirkt als integrale Sektions-Navigation, nicht als
   "Toolbar-Aufkleber".
   Tokens: --line (Trennstrich), --primary (aktiver Tab),
           --ink-faint (inaktiv), --ink (Hover). */
.view-toggle,
.fak-viewmode {
  display: inline-flex; gap: 0;
  background: transparent;
  border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; padding: 0; overflow: visible;
}
.view-toggle button, .view-toggle .btn,
.fak-viewmode button {
  background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 16px; margin-bottom: -1px;
  font: 500 13px 'Inter', sans-serif;
  color: var(--ink-faint); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 0; box-shadow: none;
  transition: color 0.15s, border-color 0.15s;
}
.view-toggle button:hover, .view-toggle .btn:hover,
.fak-viewmode button:hover {
  color: var(--ink); background: transparent;
  border-bottom-color: var(--line-strong, var(--ink-faint));
}
.view-toggle button.active, .view-toggle .btn.active,
.fak-viewmode button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: transparent;
  box-shadow: none;
}
/* Mobil: In-Content-Reiter (z. B. „Bereit zum Einzug / Laufend / Abgeschlossen")
   nicht mehr mitten im Wort umbrechen, sondern als EINE horizontal scrollbare
   Leiste. Die Seiten-Tabs in .page-tabs-card behalten ihr Wrap-Verhalten
   (hoehere Spezifitaet weiter unten). */
@media (max-width: 640px) {
  .view-toggle, .fak-viewmode { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .view-toggle::-webkit-scrollbar, .fak-viewmode::-webkit-scrollbar { display: none; }
  .view-toggle button, .view-toggle .btn, .fak-viewmode button { flex: 0 0 auto; white-space: nowrap; }
}

/* Schwebende Tab-Pillen-Karte (Unterseiten-Umschalter) oberhalb der
   Inhalts-Karte — einheitlicher Look fuer alle Seiten mit Unterseiten
   (Aufgaben, Fristen, Mandanten, Fakturierung, Leistungen, Monat).
   overflow-x: auto sorgt dafuer, dass die Tabs auf schmalen (mobilen)
   Viewports horizontal scrollen statt umzubrechen.
   overflow-y: hidden verhindert, dass eine sinnlose vertikale Scrollbar
   erscheint, falls der Inhalt minimal ueberhaengt (z. B. durch hoehere
   Action-Buttons in der rechten Spalte). Eine Kopfzeile soll niemals
   vertikal scrollen.
   Flex-Layout: linke Tab-Reihe + optionale rechte Action-Reihe. */
.page-tabs-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 2px 20px 0;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px -8px rgba(42, 31, 24, 0.08);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-tabs-card .view-toggle {
  border-bottom: none;
  min-width: max-content;
}
/* Rechte Action-Reihe in der Tabs-Card. Buttons werden mit einer
   schmalen, ghost-artigen Optik dargestellt — passt zur dezenten Tab-Bar
   und ist deutlich kompakter als ein regulaerer .btn. */
.page-tabs-card .page-tabs-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: max-content;
  padding: 6px 0;
}
.page-tabs-card .page-tabs-actions .btn,
.page-tabs-card .page-tabs-actions button {
  font-size: 12px;
  padding: 6px 10px;
  height: auto;
  line-height: 1.2;
}
@media (max-width: 768px) {
  /* Mobil: Tabs + Aktionen umbrechen statt horizontal zu scrollen — sonst
     ist die letzte Aktion (z. B. „Lex-Status abgleichen") halb abgeschnitten
     hinter einem unscheinbaren Scrollbalken versteckt. So sind alle sicht- und
     erreichbar. overflow-x: visible hebt den internen Scroll-Kontext auf. */
  .page-tabs-card { flex-wrap: wrap; row-gap: 4px; overflow-x: visible; }
  .page-tabs-card .view-toggle { min-width: 0; flex-wrap: wrap; }
  .page-tabs-card .page-tabs-actions { padding: 4px 0 6px; flex-wrap: wrap; min-width: 0; }
}

/* Chart-Paar (Auswertung): zwei Diagramme nebeneinander, auf Mobile gestapelt. */
.chart-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .chart-pair { grid-template-columns: 1fr; } }

/* Karten-Grid: passt sich an die Bildschirmbreite an. Mit minmax(420px, 1fr)
   passen auf dem 1800-px-Layout max. 3 Karten in eine Reihe, bei mittleren
   Bildschirmen 2, mobil 1.
   align-items: stretch (Default) sorgt zusammen mit Flex-Layout innerhalb
   der Karte (.fak-card unten) dafür, dass alle Karten einer Reihe gleich
   hoch sind und der Footer immer unten anschlaegt. */
.fak-cards {
  display: grid;
  /* min(420px, 100%) statt nur 420px: auf schmalen Viewports (Mobil) wird die
     Spalte nie breiter als der Container — sonst läuft die Karte rechts aus dem
     Bild (Stunden/Status abgeschnitten + horizontaler Seiten-Scroll). */
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  gap: 18px;
  padding: 20px 20px 24px;
}
/* Innerhalb einer Karte: Gruppe wird bei sehr schmalen Karten umbrochen. */
@media (max-width: 500px) {
  .fak-group {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .fak-group-stats, .fak-group-amount { text-align: left; }
}
.fak-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px 20px;
  /* Spalten-Flex sorgt zusammen mit margin-top:auto am Footer dafür,
     dass alle Karten einer Reihe gleich hoch sind und der Footer immer
     bündig am unteren Rand sitzt. */
  display: flex;
  flex-direction: column;
}
.fak-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  /* min-height reserviert Platz fuer max. 2-zeilige Mandanten-Namen
     (z.B. "Dr. Jens Linek und Dr. Monika Linek GbR"). Dadurch starten
     die Leistungs-Sub-Karten in ALLEN Karten auf gleicher Y-Linie. */
  min-height: 62px;
}
.fak-card-head h3 {
  margin: 0; font-family: 'Source Serif 4', serif; font-weight: 500;
  font-size: 18px; color: var(--ink); line-height: 1.3;
  /* Min-Height am Titel zusaetzlich — verhindert dass ein 1-zeiliger Name
     zusammen mit der LEX-Meta-Nummer baseline-bedingt nach oben springt. */
  min-height: 47px;
}
/* LEX-Meta soll vertikal mit der ersten Title-Zeile starten, nicht
   mit dem optisch zentrierten Block — sieht so aus als haengt sie
   "am Kopf" der Karte. */
.fak-card-head > div { padding-top: 3px; }
/* Mandanten-Name in der Karte klickbar (öffnet Stammdaten-Dialog). */
.fak-card-head h3.clickable {
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
  transition: background .12s, color .12s;
}
.fak-card-head h3.clickable:hover { background: var(--surface-2); color: var(--primary); }
.fak-card-meta {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--ink-faint); letter-spacing: 0.06em;
}
/* Leistung pro Mandant — komplett umrandet als kleine Sub-Karte. Hebt
   sich klar von der äußeren Mandanten-Karte ab und ist auf einen Blick
   einzeln einordbar (z. B. wenn 3-4 verschiedene Leistungen für einen
   Mandant auftauchen). */
.fak-group {
  display: grid;
  /* minmax(0, 1fr) erlaubt Spalte 1 zu schrumpfen, statt die rechten Spalten
     visuell zu ueberlagern, wenn Name + Badge zusammen zu breit werden. */
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
}
/* Bei Serienrechnungs-Gruppen ist die Stunden-Spalte redundant zur Meta-Zeile
   ("X Eintr. · Y h"). Wir lassen sie weg und nutzen ein 2-Spalten-Grid. */
.fak-group.fak-group-flat_recurring {
  grid-template-columns: minmax(0, 1fr) auto;
}
.fak-group:last-of-type { margin-bottom: 14px; }
.fak-group.clickable { cursor: pointer; transition: border-color .15s, background .15s; }
.fak-group.clickable:hover { border-color: var(--primary); background: var(--surface-2); }
/* Wrapper fuer Name + Mode-Badge: flex-wrap sorgt dafuer, dass das Badge bei
   schmalen Karten sauber unter den Namen rutscht statt das Badge selbst in
   zwei Zeilen umzubrechen. */
.fak-group-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 4px;
}
.fak-group-name { font-weight: 500; color: var(--ink); }
/* Leistungs-Name innerhalb der Gruppe klickbar — öffnet die Vereinbarung
   (wenn vorhanden) oder den Leistungs-Stammdaten-Dialog. */
.fak-group-name.clickable {
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
  display: inline-block;
  transition: background .12s, color .12s;
}
.fak-group-name.clickable:hover { background: var(--surface-2); color: var(--primary); }
.fak-group-mode {
  display: inline-flex; align-items: center;
  /* margin-left entfaellt — gap im .fak-group-name-row uebernimmt den Abstand */
  font-size: 10px; font-weight: 500;
  padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.06em;
  /* Badge selbst NIE intern umbrechen */
  white-space: nowrap;
}
.fak-group-mode.flat_recurring { background: var(--surface-2); color: var(--ink-soft); }
.fak-group-mode.flat_project   { background: var(--accent-soft); color: var(--accent-deep); }
/* Meta-Zeile (X Eintr. · Y h · alle geprueft) — eigene Zeile, dezent. */
.fak-group-meta {
  font-size: 12px; font-weight: 400;
  color: var(--ink-faint);
  line-height: 1.4;
}
.fak-group-stats {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  color: var(--ink-soft); white-space: nowrap;
}
.fak-group-amount {
  font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 600;
  color: var(--primary); white-space: nowrap;
}
.fak-group-internal {
  display: block; font-size: 11px; color: var(--ink-faint);
  font-weight: 400; margin-top: 2px;
}
.fak-group-actions {
  grid-column: 1 / -1;
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 2px;
}
.fak-group-actions .btn { padding: 5px 12px; font-size: 12px; }
/* Budget-Fortschrittsbalken in der Faktura-Karte */
.fak-budget-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.fak-budget-bar {
  flex: 1; height: 6px; background: var(--surface-2);
  border-radius: 3px; overflow: hidden;
}
.fak-budget-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.fak-budget-label { font-size: 11px; white-space: nowrap; font-weight: 600; }
.fak-group-status {
  font-size: 11px; color: var(--ink-faint);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
}

.fak-card-foot {
  /* margin-top: auto drueckt den Footer ans untere Ende der Karte —
     so steht er bei allen gleich-hohen Karten einer Reihe buendig.
     padding-top: 14px gibt zusaetzlich visuellen Abstand zur letzten Gruppe
     auch wenn keine "leere Hoehe" verbleibt (langer Karteninhalt). */
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  /* Vertikales Stacking: Stats-Block oben, Button-Reihe unten. Mit
     deterministischen min-heights an beiden Bloecken haben Foots in
     ALLEN Karten exakt dieselbe Hoehe — die Buttons enden in einer
     Linie ueber alle Karten der Reihe. */
  display: flex; flex-direction: column; gap: 10px;
}
.fak-card-foot-stats {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  color: var(--ink-soft);
  display: flex; flex-direction: column; gap: 2px;
}
.fak-card-foot-stats strong { color: var(--primary); }
/* Zweite Stats-Zeile (Pauschal-Stunden bei flat_recurring). Auch wenn
   leer, reserviert sie die Zeilenhoehe — sodass die Button-Reihe unten
   bei allen Mandanten auf gleicher Y-Linie sitzt. */
.fak-card-foot-stats-secondary {
  font-size: 12px; color: var(--ink-faint);
  min-height: 18px; line-height: 1.4;
}
.fak-card-foot-buttons {
  display: flex; gap: 8px; flex-wrap: wrap;
  /* Reserviert Button-Hoehe auch fuer Mandanten ohne fakturierbare
     Leistungen — der Footer bleibt konstant hoch. */
  min-height: 36px;
}

/* Audit-Log: aufklappbare Detail-Zeile mit Diff */
.audit-row .ico-svg { color: var(--ink-faint); transition: transform .15s; }
.audit-row:hover .ico-svg { color: var(--primary); }
.audit-entity-badge {
  display: inline-block;
  padding: 3px 8px; border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  white-space: nowrap;
}
.audit-detail-row td { background: var(--surface-2); padding: 0; }
.audit-detail {
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px;
}
.audit-diff-row {
  display: grid;
  grid-template-columns: 130px 1fr auto 1fr;
  gap: 12px; align-items: center;
  padding: 6px 10px; background: var(--surface); border-radius: 6px;
}
.audit-diff-field {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em;
}
.audit-diff-old { color: var(--ink-soft); text-decoration: line-through; }
.audit-diff-arrow { color: var(--accent); font-weight: 600; }
.audit-diff-new { color: var(--ink); font-weight: 500; }

/* Abschnitts-Überschriften im Stammdaten-Dialog */
/* Mandanten-Stammdaten: Zweispalten-Layout mit Sprungnavigation statt
   Akkordeon (Variante B, Wunsch Stephan 19.08.2026). Links thematische
   Gruppen mit Füllstands-Punkten (grün = Sektion hat Inhalt), rechts alle
   Sektionen dauerhaft offen — Klick springt, Scroll-Spy markiert die aktive
   Sektion. Farb-Akzent pro Gruppe kommt als --c / --c-soft inline aus
   STAMM_CLUSTERS. Auf schmalen Screens wird die Navigation zur horizontalen
   Chip-Leiste oben (sticky). */
/* Die Navigation steht FEST, gescrollt wird nur die rechte Sektionsspalte
   (.stamm-secs). Bewusst ohne position:sticky gelöst: der Modal-Body wird
   für diesen Dialog zum nicht scrollenden Flex-Rahmen (.stamm-body, setzt
   buildStammdatenLayout) — sticky war in der Praxis unzuverlässig
   (Safari/Scroll-Kontext), eine eigene Scroll-Spalte ist es nie. */
.modal-body.stamm-body { overflow: hidden; display: flex; flex-direction: column; }
.modal-body.stamm-body > :not(.stamm-layout) { flex: 0 0 auto; }
.stamm-layout { display: flex; gap: 20px; flex: 1 1 auto; min-height: 0; }
.stamm-nav {
  flex: 0 0 236px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 2px 6px 10px;
  overflow-y: auto; min-height: 0;
}
.stamm-nav-grp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 12px 10px 5px; color: var(--c, var(--ink-faint));
}
.stamm-nav-it {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 10px; border-radius: 7px; border: 0; background: transparent;
  font-family: 'Inter', sans-serif; font-size: 13.5px; font-weight: 500;
  color: var(--ink-soft); cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.stamm-nav-it:hover { background: var(--surface-2); color: var(--ink); }
.stamm-nav-it.active { background: var(--c-soft, var(--accent-soft)); color: var(--ink); font-weight: 600; }
.stamm-nav-it .stamm-nav-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stamm-nav-dot { width: 7px; height: 7px; border-radius: 99px; flex: 0 0 auto; background: var(--ok); }
.stamm-nav-dot.empty { background: transparent; border: 1.5px solid var(--line-strong); box-sizing: border-box; }
.stamm-nav-dot.none { visibility: hidden; }
/* display:flex überstimmt sonst das hidden-Attribut (Person/Firma-Toggle) */
.stamm-nav-it[hidden], .stamm-sec[hidden] { display: none !important; }
.stamm-secs { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; padding-right: 6px; }
/* Gruppen-Überschriften innerhalb einer Sektion (z. B. die Steuerarten-
   Gruppen): größer und kontrastreicher als die Mono-Eyebrows (Wunsch
   Stephan 19.08.2026) — Tinte statt Grau, 12,5px statt 11px. */
.cust-rdl-grouph {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.cust-rdl-grouph::after { content: ''; flex: 1; height: 1px; background: var(--line-strong); }
.stamm-sec { padding: 0 0 16px; border-bottom: 1px solid var(--line); margin: 0 0 16px; }
.stamm-sec:last-child { border-bottom: 0; margin-bottom: 0; }
.stamm-sec-head { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; }
.stamm-sec-ico {
  width: 24px; height: 24px; border-radius: 7px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--c-soft, var(--accent-soft)); color: var(--c, var(--accent));
}
.stamm-sec-ico svg { width: 13px; height: 13px; }
.stamm-sec-head .stammdaten-section {
  margin: 0; padding: 0; border: 0;
  font-family: 'Inter', sans-serif; font-size: 13.5px; font-weight: 600;
  letter-spacing: 0; text-transform: none; color: var(--ink);
}
@media (max-width: 860px) {
  .stamm-layout { flex-direction: column; gap: 0; }
  .stamm-nav {
    display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden;
    flex: 0 0 auto; margin-bottom: 12px; padding: 6px;
    background: var(--surface);
    box-shadow: 0 8px 16px -12px rgba(0, 0, 0, 0.35);
  }
  .stamm-nav-grp { display: none; }
  .stamm-nav-it { flex: 0 0 auto; white-space: nowrap; width: auto; }
  .stamm-secs { padding-right: 0; }
}
.stammdaten-section {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.stammdaten-section:first-of-type { margin-top: 8px; }
.card p  { margin: 0 0 8px; color: var(--ink-soft); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
/* ---- Zeitraum-Kopfzeile (Zeiten: Heute/Woche/Monat/Jahr) ----
   EINE kompakte Zeile statt frueher drei: Navigation (Pfeile + „Aktuelle")
   und Titel links, Stundensumme + CSV-Export rechts. Spart gegenueber dem
   alten Layout (Titelzeile + separate Button-Reihe) eine komplette Zeile.
   Auf allen Zeiten-Reitern identisch — „Heute" zeigt nur Titel + Summe. */
.period-head {
  display: flex; align-items: center; gap: 10px 14px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.period-head .period-title {
  margin: 0; font-size: 18px;
  font-family: 'Source Serif 4', serif; font-weight: 500; color: var(--ink);
}
/* Navigations-Gruppe: zwei Pfeil-Buttons + kompakter „Aktuelle"-Knopf. */
.period-nav-group { display: inline-flex; align-items: center; gap: 4px; }
.period-nav-arrow {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink-soft);
  transition: background .15s, border-color .15s, color .15s;
}
.period-nav-arrow:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.period-nav-arrow .ico-svg { width: 18px; height: 18px; margin: 0; }
.period-nav-now { padding: 7px 13px; font-size: 12.5px; }
/* Rechte Gruppe: Stundensumme + Export, immer rechtsbuendig (auch im Umbruch). */
.period-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; }
.period-sum-wrap { text-align: right; line-height: 1.15; }
.period-sum {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px; font-weight: 600; color: var(--primary);
}
.period-sum-dec { font-size: 12px; color: var(--ink-faint); font-weight: 400; }
.period-extra {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--info); margin-top: 1px;
}
@media (max-width: 640px) {
  /* Mobil: Nav-Gruppe volle Breite, „Aktuelle" dehnt sich zwischen den
     Pfeilen; rechte Gruppe (Summe + CSV) ebenfalls volle Breite. */
  .period-nav-group { flex: 1 1 100%; }
  .period-nav-group .period-nav-now { flex: 1 1 auto; justify-content: center; text-align: center; }
  .period-actions { margin-left: 0; width: 100%; justify-content: space-between; }
}
.stack-2 > * + * { margin-top: 8px; }
.stack-4 > * + * { margin-top: 16px; }

/* ---- Filter-Bar + Page-Actions (app-weit einheitliches Pattern) ----
   .filter-bar       kompakte Filter-Reihe oberhalb einer Tabelle.
                     Felder schrumpfen gemeinsam, wrappen erst wenn nötig.
   .filter-field     einzelner Filter (Input + Label). Default min-width 150px.
   .filter-field.wide   für Volltext-Suchfelder (min-width 220px, flex 2).
   .filter-field.narrow für sehr kurze Filter wie Jahr (min-width 100px).
   .page-actions     rechte Button-Reihe in der Kopfzeile (Reset + primäre
                     Aktionen alle in einer Linie). */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
}
.filter-bar .filter-field { flex: 1 1 150px; min-width: 0; }
.filter-bar .filter-field.wide   { flex: 2 1 220px; }
.filter-bar .filter-field.narrow { flex: 0 1 110px; min-width: 110px; }
/* Datumsfelder brauchen mehr Platz: „TT.MM.JJJJ" + Kalender-Icon passt nicht in
   110px (das Jahr wird sonst abgeschnitten, z. B. „05.06.2" statt „05.06.2026"). */
.filter-bar .filter-field.narrow:has(.app-date) { flex-basis: 152px; min-width: 152px; }
/* Mobil: aus dem unvorhersehbaren Flex-Wrap wird ein kompaktes 2-Spalten-Grid.
   Halbiert die Hoehe gegenueber voll gestapelten Feldern — die eigentliche
   Tabelle/Liste ist dadurch deutlich schneller erreichbar. */
@media (max-width: 640px) {
  /* Filter sind auf Mobil standardmaessig EINGEKLAPPT (siehe .filter-toggle-btn),
     damit die Liste/Tabelle ohne langes Scrollen sichtbar ist. Geoeffnet wird
     ein kompaktes 2-Spalten-Grid. */
  .filter-bar { display: none; }
  .filter-bar.filter-open {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    align-items: end;
  }
  .filter-bar .filter-field,
  .filter-bar .filter-field.wide,
  .filter-bar .filter-field.narrow { flex: none; min-width: 0; }
  /* Suchfeld spannt beide Spalten (braucht die Breite). */
  .filter-bar .filter-field.wide { grid-column: 1 / -1; }
}
/* Filter-Umschalter — nur auf Mobil sichtbar. */
.filter-toggle-btn { display: none; }
@media (max-width: 640px) {
  .filter-toggle-btn {
    display: inline-flex; align-items: center; gap: 8px;
    width: 100%; min-height: 44px; margin: 0;
    padding: 11px 20px;
    background: var(--bg); border: none;
    border-bottom: 1px solid var(--line);
    font: 500 13px 'Inter', sans-serif; color: var(--ink-soft);
    cursor: pointer;
  }
  .filter-toggle-btn .ico-svg { width: 16px; height: 16px; }
  .filter-toggle-btn .filter-toggle-caret { margin-left: auto; display: inline-flex; transition: transform 0.15s; }
  .filter-toggle-btn.open .filter-toggle-caret { transform: rotate(180deg); }
  /* Wenn die Filter offen sind, schliesst die Leiste direkt an den Button an. */
  .filter-toggle-btn.open { border-bottom-color: transparent; }
  /* Ausserhalb von .tbl-wrap (freistehende Filter-Bar) etwas absetzen. */
  :not(.tbl-wrap) > .filter-toggle-btn { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; }
}
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 8px;
}

/* ---- Formulare ---- */
input, textarea, select {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; font-size: 14px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
label { display: block; font-size: 12px; color: var(--ink-faint); margin-bottom: 6px; font-weight: 500; }

/* ---- Stempeluhr ---- */
.stempel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 16px;
}
.stempel-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
}
.stempel-status.running { color: var(--accent); }
.stempel-status.paused { color: var(--warn); }
.stempel-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 64px; font-weight: 500;
  color: var(--ink); line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.stempel-timer.running { color: var(--primary); }
.stempel-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--ink-faint);
  margin-bottom: 24px;
}
.stempel-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 480px) {
  .stempel-timer { font-size: 52px; }
}

/* ---- Eintrags-Liste ---- */
.entry-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px; margin-bottom: 8px;
  display: flex; gap: 14px; align-items: center;
  transition: background .12s, border-color .12s;
}
.entry-item.row-clickable { cursor: pointer; }
.entry-item.row-clickable:hover { background: var(--surface-2); border-color: var(--accent-soft); }
/* Mobil: engere Abstände + schmalere Dauer-Spalte, damit der Textbereich
   (Mandant/Leistung) nicht auf ~120px gequetscht wird und kurze Mandanten-
   namen nicht unnötig umbrechen. */
@media (max-width: 640px) {
  .entry-item { gap: 8px; padding: 12px 14px; }
  .entry-item .entry-duration { min-width: 0; }
  .entry-item .entry-actions { gap: 2px; }
}
.entry-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px; font-weight: 500;
  color: var(--ink);
  min-width: 130px;
  font-variant-numeric: tabular-nums;
}
.entry-duration {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px; font-weight: 600;
  color: var(--primary);
  min-width: 70px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.entry-meta { flex: 1; min-width: 0; }
.entry-note {
  font-size: 13px; color: var(--ink-soft);
  white-space: pre-wrap; word-break: break-word;
}
/* Kompakte Note-Variante für dichte Tabellen (Fakturierung, Wochenansicht):
   max. 4 Zeilen, überlaufender Text wird mit … gekuerzt. Voller Inhalt ist
   über title="" als Tooltip verfügbar und beim Klick auf die Zeile sichtbar. */
.entry-note-compact {
  font-size: 13px; color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  max-width: 420px;
  line-height: 1.35;
}
/* Aktions-Icons in der Fakturierung in EINER Reihe, aber sehr kompakt:
   kleines Padding + kleinere Icons → niedrige Zeilenhoehe.
   Spaltenbreite wird durch max-width gedeckelt; überlaufende Icons können
   nicht entstehen, da wir maximal 5 Aktionen haben. */
.entry-actions-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 1px;
  justify-content: flex-end;
  margin-left: auto;
}
.entry-actions-grid .icon-btn {
  padding: 3px 4px;
  font-size: 13px;
}
.entry-actions-grid .icon-btn .ico-svg { width: 15px; height: 15px; }
.entry-actions-grid .badge { align-self: center; }
/* Mandant + Leistung: max. Breite + Umbruch erzwingen, damit lange Namen die
   Zeile nicht in die Breite ziehen und mehr Platz für die Bemerkung bleibt. */
.cell-wrap {
  max-width: 140px;
  word-break: break-word;
  line-height: 1.3;
}
/* (.tbl-dense Definition siehe Tabellen-System weiter unten) */

/* Urlaubsstand-Anzeige auf der Abwesenheit-Seite — kompakte Statistik-Reihe.
   Jede Stat-Einheit ist eine kleine Saeule: Zahl gross oben, Label klein
   darunter. Resturlaub wird hervorgehoben. */
.vac-summary {
  display: flex; gap: 28px; flex-wrap: wrap; align-items: center;
  padding: 14px 18px;
  background: var(--surface-2);
  border-radius: 10px;
  margin-bottom: 14px;
}
.vac-summary-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-right: 4px;
}
.vac-stat { display: flex; flex-direction: column; gap: 2px; min-width: 60px; }
.vac-stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px; font-weight: 600;
  color: var(--ink); line-height: 1.1;
}
.vac-stat-lbl {
  font-size: 11px; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.vac-stat.is-rest .vac-stat-num { font-size: 28px; color: var(--primary); }
.vac-stat.is-warn .vac-stat-num { color: var(--accent); }
.vac-stat.is-neg  .vac-stat-num { color: var(--danger); }
.vac-stat-sep { color: var(--ink-faint); font-size: 16px; }
/* Mobil: die Rechen-Operatoren (+ − =) landen beim Umbruch sonst allein am
   Zeilenanfang und wirken zusammenhanglos. Stattdessen: Titel volle Breite,
   Operatoren ausblenden, Kennzahlen als gleichmaessiges Raster. */
@media (max-width: 640px) {
  .vac-summary { gap: 12px 18px; }
  .vac-summary .vac-summary-title { flex-basis: 100%; margin: 0 0 2px; }
  .vac-summary .vac-stat-sep { display: none; }
  .vac-summary .vac-stat { min-width: 0; flex: 1 0 26%; }
}
.entry-badges { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--surface-2); color: var(--ink-soft);
}
.badge-running { background: var(--accent-soft); color: var(--accent); }
.badge-manual  { background: var(--primary-soft); color: var(--primary); }
.badge-user    { background: var(--ink); color: var(--bg); }
.badge-billed   { background: rgba(79, 110, 45, 0.14); color: var(--ok); }
.badge-onhold   { background: rgba(199, 122, 27, 0.16); color: var(--warn); }
.badge-nobill   { background: rgba(42, 31, 24, 0.08); color: var(--ink-faint); }
.badge-reviewed { background: rgba(74, 56, 44, 0.10); color: var(--ink-soft); }
.badge-danger   { background: rgba(168, 50, 24, 0.14); color: var(--danger); }
.badge-info     { background: rgba(61, 90, 124, 0.13); color: var(--info); }
.entry-actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn {
  background: transparent; border: 0; padding: 6px 8px;
  color: var(--ink-faint); border-radius: 6px; font-size: 14px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* Topbar-Icon-Buttons (z.B. Theme-Toggle): quadratisch, rechtsbuendig,
   gleiche Hoehe wie die Connection-Pille. */
.topbar-icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  padding: 0;
  color: var(--ink-soft);
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.topbar-icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}
.topbar-icon-btn .ico-svg { width: 18px; height: 18px; }

/* --- Benachrichtigungen: Glocke + Zaehler-Badge + Dropdown (Migration 063) --- */
.notif-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
#notifBtn { position: relative; overflow: visible; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; box-sizing: border-box;
  background: var(--danger, #cc4343); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
  border: 1.5px solid var(--surface);
  pointer-events: none;
}
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 340px; max-width: calc(100vw - 32px); max-height: 70vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(42,31,24,0.16);
  z-index: 3000; padding: 6px;
}
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.notif-panel-head strong { font-size: 13px; color: var(--ink); }
.notif-mark-all {
  background: transparent; border: 0; color: var(--accent); cursor: pointer;
  font-size: 12px; padding: 4px 6px; border-radius: 6px;
}
.notif-mark-all:hover { background: var(--surface-2); }
.notif-mark-all[disabled] { color: var(--ink-faint); cursor: default; }
/* Ein dunkelroter Knopf, der nicht reagiert, ist ein Rätsel — deaktivierte
   Schaltflächen sehen jetzt überall deaktiviert aus. */
.btn:disabled, .tbl-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn:disabled:hover, .tbl-btn:disabled:hover { filter: none; }
.notif-item {
  display: flex; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: 0; cursor: pointer;
  padding: 9px 10px; border-radius: 8px;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item.unread:hover { background: var(--primary-soft); filter: brightness(0.97); }
.notif-item-dot {
  flex-shrink: 0; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%;
  background: var(--primary);
}
.notif-item.read .notif-item-dot { background: transparent; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 13px; color: var(--ink); line-height: 1.35; }
.notif-item-title b { font-weight: 600; }
.notif-item-excerpt {
  font-size: 12px; color: var(--ink-faint); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.notif-item-time { font-size: 11px; color: var(--ink-faint); margin-top: 3px; }
.notif-empty { padding: 22px 12px; text-align: center; color: var(--ink-faint); font-size: 13px; }

/* Hilfe-Button neben dem Seitentitel — dezent, erklaert die aktuelle Seite. */
.page-help-btn {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  padding: 0; margin-left: 2px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.page-help-btn:hover { background: var(--primary-soft); color: var(--primary); }
.page-help-btn[hidden] { display: none; }
.page-help-btn .ico-svg { width: 17px; height: 17px; }

/* Inhalt des Seiten-Hilfe-Popups */
.page-help-body { font-size: 14px; color: var(--ink-soft); line-height: 1.6; }
.page-help-body p { margin: 0 0 12px; }
.page-help-body p:last-child { margin-bottom: 0; }
.page-help-body strong { color: var(--ink); font-weight: 600; }
.page-help-body ul { margin: 0 0 12px; padding-left: 20px; }
.page-help-body li { margin-bottom: 4px; }

/* ============================================================
   TABELLEN-SYSTEM (Standard — siehe Tabellen-System.html)
   Anatomie: .tbl-wrap > .tbl-toolbar + .tbl-filters + .tbl + .tbl-pagination
   ============================================================ */

/* Wrapper — gibt jeder Tabelle ihre Karte mit Rand, Radius, Schatten */
.tbl-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  /* WICHTIG: overflow:hidden würde das `position: sticky` auf den
     Tabellen-Headern brechen — der Header würde nur INNERHALB des Wraps
     sticken statt am Viewport-Rand (top:64). `overflow: clip` erfüllt
     die visuelle Aufgabe (Inhalte am Border-Radius abschneiden) OHNE
     einen neuen Scroll-Kontext zu etablieren. Browser-Support: Chrome
     90+, Safari 16+, Firefox 81+ — für unsere Mac-Nutzer OK. */
  overflow: clip;
  box-shadow: 0 1px 2px rgba(42, 31, 24, 0.04);
}
.tbl-wrap.flush { box-shadow: none; }

/* Toolbar über der Tabelle (Titel + Suche + Buttons) */
.tbl-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.tbl-toolbar .ti { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tbl-toolbar .ti .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin: 0;
}
.tbl-toolbar .ti h3 {
  font-family: 'Source Serif 4', serif;
  font-weight: 500; font-size: 18px; color: var(--ink);
  margin: 0;
}
.tbl-toolbar .spacer { flex: 1; }
.tbl-toolbar .ctl-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Inline-Suche in der Toolbar (Pill-Form) */
.tbl-search {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; min-width: 220px;
}
.tbl-search input {
  border: 0; background: transparent; outline: none;
  flex: 1; font: inherit; color: var(--ink);
  padding: 0; box-shadow: none;
}
.tbl-search input::placeholder { color: var(--ink-faint); }
.tbl-search .ico-svg { width: 14px; height: 14px; color: var(--ink-faint); flex-shrink: 0; }

/* Toolbar-Buttons (klein, dezent) */
.tbl-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 500 12px/1 'Inter', sans-serif;
  color: var(--ink);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.tbl-btn:hover { background: var(--surface-2); }
.tbl-btn.primary { background: var(--primary); color: var(--bg); border-color: var(--primary); }
.tbl-btn.primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
.tbl-btn .ico-svg { width: 12px; height: 12px; }

/* Filter-Chip (aktive Filter, anklickbar zum Entfernen) */
.tbl-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 12px;
  background: var(--surface-2);
  border-radius: 999px;
  font: 500 11px/1.4 'Inter', sans-serif;
  color: var(--primary);
}
.tbl-chip .x { font-family: 'JetBrains Mono', monospace; cursor: pointer; opacity: 0.6; }
.tbl-chip .x:hover { opacity: 1; }

/* Filter-Reihe (Chip-Variante über der Tabelle, alternativ zum globalen .filter-bar) */
.tbl-filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.tbl-filters .lab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.14em; color: var(--ink-faint);
  text-transform: uppercase; margin-right: 4px;
}

/* ── Kern-Tabelle ── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }

.tbl thead th {
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
  /* Header ist `relative` für die ::after-Trennlinie. Sticky-Verhalten
     wird unten nur INNERHALB von .tbl-wrap eingeschaltet — sonst kommt
     es bei Tabellen in .card oder mit overflow-x-Wrapper zu falscher
     Offset-Positionierung. */
  position: relative;
  user-select: none;
}
/* Sticky-Header NUR in .tbl-wrap. Dort hat der Wrapper overflow: clip
   (siehe oben), was sticky NICHT bricht — der Header sticht sauber am
   Viewport-Rand var(--topbar-h) (unter der Topbar). */
.tbl-wrap .tbl thead th {
  position: sticky;
  top: var(--topbar-h);
  z-index: 5;
}
.tbl thead th.right  { text-align: right; }
.tbl thead th.center { text-align: center; }
.tbl thead th .sort {
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer; color: inherit;
}
.tbl thead th .sort .ico-svg { width: 10px; height: 10px; opacity: 0.5; }
.tbl thead th .sort.active { color: var(--primary); }
.tbl thead th .sort.active .ico-svg { opacity: 1; }
.tbl th.th-sort:hover { background: var(--surface-2); cursor: pointer; }
.tbl th.th-sort.active { color: var(--primary); }
/* Subtile vertikale Trennlinie zwischen Header-Spalten — nutzt den
   Positions-Kontext, den `position: sticky` oben bereits etabliert. */
.tbl thead th:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0; top: 25%; bottom: 25%;
  border-right: 1px solid var(--line);
  pointer-events: none;
}

.tbl tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(241,228,210,0.5); }
.tbl tbody tr.row-selected td { background: rgba(232,181,71,0.16); }
.tbl tbody tr.row-selected:hover td { background: rgba(232,181,71,0.24); }
/* Karten-Tabellen (.tbl-nocard — Dashboard-Listen wie „Anstehende Fristen",
   „Meine Aufgaben"): Zeilen-Highlights (Hover/Auswahl) mit gerundeten Enden.
   Diese Tabellen liegen IN einer runden Karte — ein eckiger Vollbreiten-
   Balken wirkt dort wie ein Fremdkoerper. Die grossen Seiten-Tabellen im
   .tbl-wrap bleiben bewusst edge-to-edge mit durchgehendem Balken
   (Tabellen-System). Radius liegt permanent auf den Rand-Zellen und wird
   erst durch die Hover-/Auswahl-Faerbung sichtbar. */
.tbl.tbl-nocard > tbody > tr > td:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.tbl.tbl-nocard > tbody > tr > td:last-child  { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
html[data-theme="dark"] .tbl tbody tr:hover td { background: rgba(250,245,236,0.06); }
html[data-theme="dark"] .tbl tbody tr.row-selected td { background: rgba(224,139,44,0.20); }
.tbl tr.row-clickable { cursor: pointer; }
.tbl td.mono { font-family: 'JetBrains Mono', monospace; }
.tbl td.right { text-align: right; }
.tbl td.center { text-align: center; }
.tbl td.num { font-family: 'JetBrains Mono', monospace; text-align: right; color: var(--ink); }
.tbl td.id { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-faint); }
.tbl td.primary-cell { color: var(--ink); font-weight: 500; }

/* Kompakte / dichte Variante */
.tbl.compact thead th { padding: 8px 14px; }
.tbl.compact tbody td { padding: 8px 14px; font-size: 12px; }
.tbl-dense thead th { padding: 8px 14px; }
.tbl-dense tbody td { padding: 8px 14px; font-size: 12px; }

/* Zebra-Variante */
.tbl.zebra tbody tr:nth-child(even) td { background: rgba(241,228,210,0.28); }
.tbl.zebra tbody tr:hover td { background: rgba(232,181,71,0.16); }

/* Gruppen-Zeile (z. B. „Operating Excellence — 2 Projekte") */
.tbl tr.group-row td {
  background: var(--surface-2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  padding: 8px 16px;
}

/* Pillen (.pill-System, Status mit Punkt-Prefix) */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font: 500 11px/1.4 'Inter', sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.pill.green   { background: rgba(79,110,45,0.12);  color: #4F6E2D; }
.pill.green::before   { background: #4F6E2D; }
.pill.amber   { background: rgba(199,122,27,0.16); color: #8A4F11; }
.pill.amber::before   { background: #C77A1B; }
.pill.red     { background: rgba(168,50,24,0.14);  color: #A83218; }
.pill.red::before     { background: #A83218; }
.pill.ink     { background: var(--ink); color: var(--bg); }
.pill.ink::before     { background: var(--accent); }
.pill.ghost   { background: transparent; color: var(--ink-faint); border: 1px solid var(--line); }
.pill.ghost::before   { display: none; }

/* Personen-Zelle (Avatar + Name) */
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 500;
  flex-shrink: 0;
}
.avatar.c2 { background: var(--accent-deep); }
.avatar.c3 { background: var(--primary); color: var(--bg); }
.avatar.c4 { background: var(--primary-deep); color: var(--bg); }
.avatar.c5 { background: var(--ink); color: var(--accent-deep); }
.person .name { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .meta { font-size: 11px; color: var(--ink-faint); }

/* Fortschritts-Balken */
.progress { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.progress .track {
  flex: 1;
  height: 6px; background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress .fill {
  height: 100%; background: var(--accent); border-radius: inherit;
  transition: width .3s;
}
.progress .fill.danger  { background: var(--danger); }
.progress .fill.warning { background: var(--warn); }
.progress .fill.success { background: var(--ok); }
.progress .val { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink); min-width: 36px; text-align: right; }

/* Trend-Pfeil (▲ / ▼ / →) */
.trend { display: inline-flex; align-items: center; gap: 4px; font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.trend.up   { color: var(--ok); }
.trend.down { color: var(--danger); }
.trend.flat { color: var(--ink-faint); }
.trend .ico-svg { width: 10px; height: 10px; }

/* Sparkline */
.sparkline { vertical-align: middle; display: inline-block; }

/* Row-Actions (3-Punkte-Menü, beim Hover sichtbarer) */
.row-actions { display: flex; gap: 4px; opacity: 0.45; transition: opacity .12s; }
.tbl tbody tr:hover .row-actions { opacity: 1; }
.row-actions button {
  width: 26px; height: 26px; border-radius: 4px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.row-actions button:hover { background: var(--surface-2); color: var(--primary); }
.row-actions .ico-svg { width: 14px; height: 14px; }

/* Footer (Totals) — dunkler Hintergrund + Amber-Akzentlinie */
.tbl tfoot td {
  background: var(--ink);
  color: var(--bg);
  padding: 14px 16px;
  font-weight: 500;
  border-top: 2px solid var(--accent);
  border-bottom: 0;
}
.tbl tfoot td.num,
.tbl tfoot td.mono,
.tbl tfoot td.right {
  font-family: 'JetBrains Mono', monospace; color: var(--accent-deep);
}

/* Pagination */
.tbl-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  font-size: 12px; color: var(--ink-faint);
}
.tbl-pagination .pages { display: flex; gap: 4px; }
.tbl-pagination .pages button {
  width: 28px; height: 28px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  font: 500 12px/1 'Inter', sans-serif;
  color: var(--ink-soft);
  cursor: pointer;
}
.tbl-pagination .pages button:hover { background: var(--surface-2); }
.tbl-pagination .pages button.active { background: var(--primary); color: var(--bg); }
.tbl-pagination .pages button:disabled { opacity: 0.35; cursor: not-allowed; }
.tbl-pagination .count strong { color: var(--ink); font-weight: 600; }

/* Empty-State (statt leerem Body) */
.tbl-empty { padding: 64px 32px; text-align: center; }
.tbl-empty h4 {
  font-family: 'Source Serif 4', serif;
  font-weight: 500; font-size: 18px; color: var(--ink);
  margin: 12px 0 4px;
}
.tbl-empty p { font-size: 13px; color: var(--ink-faint); margin: 0; }
.tbl-empty .ico-svg { width: 36px; height: 36px; color: var(--ink-faint); opacity: 0.6; }

/* Loading-Skeleton */
.skeleton {
  display: inline-block; height: 10px;
  background: var(--surface-2); border-radius: 2px;
  animation: pulse 1.4s infinite ease-in-out;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Inline-Empty-State (alte Variante in <tbody>) */
.tbl .empty-state { text-align: center; padding: 32px 16px; color: var(--ink-faint); font-style: italic; }

/* Icon-only Spalten-Header (z. B. Erledigt-Häkchen in Aufgaben) — leicht
   größer als die normale Mono-Schrift, damit das Symbol als Spalten-Sinn
   sofort erkennbar ist. */
.tbl thead th .th-icon {
  display: inline-flex; align-items: center; justify-content: center;
}
.tbl thead th .th-icon .ico-svg { width: 14px; height: 14px; }

/* Wenn die globale .filter-bar innerhalb eines .tbl-wrap sitzt, sitzt sie
   edge-to-edge mit eigener Hintergrundfarbe (Cream) und Trennlinie. */
.tbl-wrap > .filter-bar {
  padding: 12px 20px;
  margin: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

/* Hilfetext / Beschreibung innerhalb eines .tbl-wrap. Pflicht-Klasse für
   alle freistehenden Erklärtexte zwischen Toolbar/Filter-Bar und Tabelle
   bzw. unterhalb der Tabelle. Hat das gleiche horizontale Padding (20 px)
   wie .tbl-toolbar und .filter-bar — damit der Text nicht direkt am Rand
   der Box klebt. Variante .top hat Border unten, .bottom hat Border oben.
   Default ist .top (zwischen Header und Body).
   Auch direkte <p> in .tbl-wrap bekommen das Padding als Fallback — aber
   die Klasse ist die saubere Variante. */
.tbl-wrap > .tbl-wrap-note,
.tbl-wrap > p {
  margin: 0;
  padding: 12px 20px;
  background: var(--bg);
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.5;
}
.tbl-wrap > .tbl-wrap-note { border-bottom: 1px solid var(--line); }
.tbl-wrap > .tbl-wrap-note.bottom { border-top: 1px solid var(--line); border-bottom: 0; }
.tbl-wrap > p { border-top: 1px solid var(--line); }
/* Bulk-Bar in tbl-wrap — Sticky-Form ohne Outset */
.tbl-wrap > .bulk-bar { border-radius: 0; margin: 0; padding: 10px 20px; }

/* Sticky-Filter-Bar (z. B. Fakturierung): die ganze Filter-Reihe bleibt
   beim Scrollen unter der Topbar stehen. Auf solchen Seiten muss der
   Tabellen-Header tiefer ankern, damit er nicht hinter der Filter-Bar
   verschwindet. */
.filter-bar.filter-bar-sticky {
  position: sticky;
  top: var(--topbar-h);
  z-index: 6;             /* über dem Tabellen-Header (z-index 5) */
  background: var(--bg);
  box-shadow: 0 1px 0 var(--line);
}
.tbl-wrap:has(> .filter-bar-sticky) .tbl thead th {
  /* Tabellen-Header rutscht UNTER die sticky Filter-Bar.
     --sticky-filter-h wird in JS (updateStickyFilterOffsets) dynamisch
     anhand der TATSÄCHLICHEN Filter-Bar-Höhe gesetzt — damit gibt es
     keine Lücke, wenn der Filter-Bar weniger oder mehr Felder enthält
     oder in 2 Reihen wrappt. Fallback 108px für den ersten Render.
     NIEMALS einen festen Wert hier hardcoden! */
  top: calc(var(--topbar-h) + var(--sticky-filter-h, 108px));
}
/* Mobil: Sticky abschalten. Eine 2-reihige Filter-Bar ist auf schmalen
   Screens so hoch, dass sie beim Scrollen fast den ganzen Viewport
   verdecken würde — die Daten verschwänden dahinter. Sie scrollt stattdessen
   normal mit weg. (Der Tabellen-Header ist auf Mobil ohnehin nicht sticht,
   da die Tabelle als Karten gerendert wird — thead: display:none.) */
@media (max-width: 640px) {
  .filter-bar.filter-bar-sticky { position: static; z-index: auto; box-shadow: none; }
}

/* App-Style Checkbox */
.checkbox { position: relative; display: inline-flex; align-items: center; cursor: pointer; vertical-align: middle; }
.checkbox input[type=checkbox] {
  /* Echtes Input transparent ueber die .checkbox-box legen, damit der Klick
     auch bei <span class="checkbox"> (ohne umschliessendes <label>) ankommt.
     z-index hebt es ueber die .checkbox-box (position:relative, im DOM danach),
     sonst faengt die Box den Klick ab. */
  position: absolute; inset: 0; z-index: 1; opacity: 0; cursor: pointer;
  width: 100%; height: 100%; margin: 0; padding: 0;
}
.checkbox-box {
  display: inline-block; width: 18px; height: 18px;
  border: 1.5px solid var(--line-strong); border-radius: 4px;
  background: var(--surface); transition: all .15s;
  position: relative;
}
.checkbox:hover .checkbox-box { border-color: var(--primary); }
.checkbox input[type=checkbox]:checked + .checkbox-box {
  background: var(--primary); border-color: var(--primary);
}
.checkbox input[type=checkbox]:checked + .checkbox-box::after {
  content: ''; position: absolute;
  left: 6px; top: 2px;
  width: 4px; height: 9px;
  border: solid var(--bg); border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checkbox input[type=checkbox]:focus-visible + .checkbox-box {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------------------------------------------------------------------------
   Erledigt-Toggle (Häkchen-Kreis, Pattern wie Todoist / Apple Erinnerungen).
   Sieht bewusst ANDERS aus als die rechteckige .checkbox — damit beim
   Nebeneinander (z. B. in der Aufgaben-Tabelle) sofort klar ist, was den
   Status togglet (Kreis) und was die Zeile auswählt (Quadrat).
   --------------------------------------------------------------------------- */
.task-done-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  padding: 0;
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  transition: background .12s, border-color .12s, transform .08s;
}
.task-done-btn .ico-svg {
  width: 12px; height: 12px;
  color: transparent;
  transition: color .12s;
  stroke-width: 3px;
}
.task-done-btn:hover {
  border-color: var(--ok);
  background: rgba(79, 110, 45, 0.06);
}
.task-done-btn:hover .ico-svg { color: var(--ok); }
.task-done-btn:active { transform: scale(0.92); }
.task-done-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.task-done-btn.is-done {
  background: var(--ok);
  border-color: var(--ok);
}
.task-done-btn.is-done .ico-svg { color: var(--bg); }
.task-done-btn.is-done:hover { background: var(--ok); opacity: 0.85; }

/* App-Select (Custom-Dropdown, Brand-Style) */
.app-select { position: relative; display: block; user-select: none; }
.app-select-btn {
  width: 100%;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 14px; font: 400 15px/1.2 'Inter', sans-serif;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  text-align: left;
}
.app-select-btn:hover { border-color: var(--line-strong); }
.app-select.open .app-select-btn,
.app-select-btn:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.app-select.disabled .app-select-btn { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.app-select-label {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-select-label.placeholder { color: var(--ink-faint); }
.app-select-btn .ico-svg { color: var(--ink-faint); transition: transform .2s; flex-shrink: 0; }
.app-select.open .app-select-btn .ico-svg { transform: rotate(180deg); }

/* App-Select-Menue wird per JS an document.body angehängt (Portal-Pattern),
   um Clipping in scroll-baren Modals/Containern zu verhindern. Position
   wird via fixed gesetzt, basierend auf getBoundingClientRect des Buttons. */
.app-select-menu {
  position: fixed;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(42,31,24,0.18), 0 4px 12px rgba(42,31,24,0.08);
  z-index: 2000;
  max-height: 380px; display: flex; flex-direction: column;
  overflow: hidden;
}
.app-select-menu[hidden] { display: none !important; pointer-events: none; }
.app-select-search {
  width: 100%;
  padding: 12px 14px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  font-size: 14px;
  background: var(--surface);
}
.app-select-search:focus { outline: none; box-shadow: none; border-bottom-color: var(--accent); }
.app-select-list { overflow-y: auto; padding: 6px; }
.app-select-option {
  padding: 11px 14px; border-radius: 6px; cursor: pointer; font-size: 15px;
  color: var(--ink); display: flex; align-items: center; gap: 8px;
}
.app-select-option:hover { background: var(--surface-2); }
.app-select-option.active { background: var(--surface-2); }
.app-select-option.selected { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.app-select-option[hidden] { display: none; }
.app-select-empty { padding: 14px; color: var(--ink-faint); font-size: 14px; text-align: center; }

/* App-DatePicker (Custom-Kalender, Brand-Style) */
.app-date { position: relative; display: block; }
.app-date-input {
  width: 100%;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 40px 12px 14px;
  font: 400 15px/1.2 'Inter', sans-serif;
  transition: border-color .15s, box-shadow .15s;
}
.app-date-input::placeholder { color: var(--ink-faint); }
.app-date-input:hover { border-color: var(--line-strong); }
.app-date.open .app-date-input,
.app-date-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.app-date-cal {
  position: absolute; top: 0; right: 0; height: 100%; width: 40px;
  display: grid; place-items: center;
  background: transparent; border: 0; cursor: pointer;
  color: var(--ink-faint); border-radius: 0 6px 6px 0;
  transition: color .15s;
}
.app-date-cal:hover { color: var(--ink); }
.app-date-cal .ico-svg { width: 18px; height: 18px; flex-shrink: 0; }

/* App-Date-Pop wird per JS an document.body angehängt (Portal-Pattern),
   um Clipping in scroll-baren Modals/Containern zu verhindern. Position
   wird via fixed gesetzt, basierend auf getBoundingClientRect des Buttons. */
.app-date-pop {
  position: fixed;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(42,31,24,0.14), 0 4px 8px rgba(42,31,24,0.06);
  z-index: 2000;
  padding: 12px; min-width: 260px;
}
.app-date-pop[hidden] { display: none !important; pointer-events: none; }
.app-date-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; gap: 4px;
}
.app-date-head-title {
  font-family: 'Source Serif 4', serif; font-weight: 500; font-size: 15px;
  color: var(--ink); flex: 1; text-align: center;
}
.app-date-nav {
  background: transparent; border: 0; padding: 6px;
  border-radius: 6px; cursor: pointer; color: var(--ink-soft);
  display: inline-grid; place-items: center;
}
.app-date-nav:hover { background: var(--surface-2); color: var(--ink); }
.app-date-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; margin-bottom: 4px;
}
.app-date-wd {
  text-align: center; font: 500 11px/1 'JetBrains Mono', monospace;
  color: var(--ink-faint); padding: 6px 0; letter-spacing: 0.04em;
}
.app-date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.app-date-cell {
  aspect-ratio: 1; display: grid; place-items: center;
  border-radius: 6px; cursor: pointer; font-size: 13px;
  background: transparent; border: 0; color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}
.app-date-cell:hover { background: var(--surface-2); }
.app-date-cell.muted { color: var(--ink-faint); opacity: 0.5; }
.app-date-cell.today {
  outline: 1.5px solid var(--accent); outline-offset: -2px; font-weight: 600;
}
.app-date-cell.selected {
  background: var(--primary); color: var(--bg); font-weight: 600;
}
.app-date-cell.selected:hover { background: var(--primary-deep); }
.app-date-foot {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex; gap: 6px; justify-content: space-between;
}
.app-date-foot .btn { font-size: 12px; padding: 6px 12px; }

/* Dashboard (Admin-Cockpit) */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 800px) { .dashboard-grid { grid-template-columns: 1fr; } }
/* Grid-Items müssen unter ihre Inhalts-Mindestbreite schrumpfen dürfen, sonst
   bläht ein breites verschachteltes Grid (Action-Kacheln) die 1fr-Spalte auf
   und die Karten laufen rechts aus dem Viewport (horizontaler Scroll). */
.dashboard-grid > * { min-width: 0; }
.dash-actions-grid, .dash-actions-grid > *,
.dash-fak-grid > *, .dash-fristen-grid > * { min-width: 0; }
.dashboard-grid .card { margin: 0; }
.dashboard-grid h3 {
  margin: 0 0 14px; font-size: 15px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-faint);
}
/* Action-Tiles: 2x2-Grid mit klickbaren Kacheln */
.dash-card-actions { grid-column: 1 / -1; }
.dash-card-full    { grid-column: 1 / -1; }
.dash-fristen-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}
@media (max-width: 900px) { .dash-fristen-grid { grid-template-columns: 1fr; } }
.dash-actions-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
@media (max-width: 800px) { .dash-actions-grid { grid-template-columns: 1fr 1fr; } }
/* Sehr schmale Phones: 1-spaltig. Bei 2 Spalten bleiben pro Kachel nur ~40px
   für den Text — lange Labels („Urlaubsantrag") überlaufen dann den Pfeil. */
@media (max-width: 460px) { .dash-actions-grid { grid-template-columns: 1fr; } }
.dash-action {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; text-align: left; width: 100%;
  transition: border-color .15s, transform .12s;
}
.dash-action:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.dash-action:disabled { opacity: 0.5; cursor: default; }
.dash-action.has-items { border-color: var(--primary-soft); background: var(--primary-soft); }
.dash-action.has-items:hover { border-color: var(--primary); }
.dash-action-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
  color: var(--ink-soft);
}
.dash-action.has-items .dash-action-icon { color: var(--primary); }
.dash-action-body { flex: 1; min-width: 0; }
.dash-action-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 600; line-height: 1.1;
  color: var(--ink);
}
.dash-action.has-items .dash-action-count { color: var(--primary); }
.dash-action-label { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.dash-action-arrow { color: var(--primary); flex-shrink: 0; }

/* Mitarbeiter-Dashboard „Mein Tag" — Begrüßung, Wochen-Karte, Tagesbalken.
   Design-System-Bestandteil (CLAUDE.md 6a): Balken-Styling kommt aus den
   Brand-Tokens, Klassen sind Layout/Position. */
.dash-emp-greet { grid-column: 1 / -1; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dash-emp-greet h2 { font-family: 'Source Serif 4', Georgia, serif; font-size: 26px; font-weight: 700; margin: 2px 0 0; }
.dash-emp-week { display: grid; grid-template-columns: minmax(170px, 1fr) 2fr minmax(150px, auto); gap: 26px; align-items: end; }
@media (max-width: 900px) { .dash-emp-week { grid-template-columns: 1fr; } }
.dash-emp-kpi { font-family: 'JetBrains Mono', monospace; font-size: 26px; font-weight: 600; color: var(--ink); }
.dash-emp-kpi small { font-size: 13px; color: var(--ink-faint); font-weight: 400; }
.dash-emp-daybars { display: flex; gap: 12px; align-items: flex-end; }
.dash-emp-daybar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.dash-emp-daybar .bar { width: 100%; max-width: 40px; height: 92px; background: var(--surface-2); border-radius: 7px; position: relative; overflow: hidden; }
.dash-emp-daybar .bar .fill { position: absolute; bottom: 0; left: 0; right: 0; background: var(--primary); border-radius: 7px 7px 0 0; }
.dash-emp-daybar.today .bar .fill { background: var(--accent); }
.dash-emp-daybar .h { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--ink-soft); }
.dash-emp-daybar .d { font-family: 'JetBrains Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); }
.dash-emp-daybar.today .d { color: var(--accent); font-weight: 600; }
.dash-emp-vac-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(42,31,24,0.07); font-size: 13px; }
.dash-emp-vac-row:last-child { border-bottom: none; }

/* Faktura-Übersicht — kompakte 4-Spalten-Statistik */
.dash-card-faktura { grid-column: 1 / -1; }
.dash-fak-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 800px) { .dash-fak-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .dash-fak-grid { grid-template-columns: 1fr; } }
.dash-fak-stat {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  text-align: left; cursor: pointer; width: 100%;
  transition: border-color .15s, transform .12s, box-shadow .15s;
  border-left: 3px solid var(--accent-color, var(--line));
}
.dash-fak-stat:hover {
  border-color: var(--accent-color, var(--primary));
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px rgba(42,31,24,0.18);
}
.dash-fak-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 600;
  color: var(--accent-color, var(--ink)); line-height: 1.1;
}
.dash-fak-stat-meta {
  display: flex; gap: 6px;
  font-size: 11px; color: var(--ink-faint);
}
.dash-fak-stat-label {
  margin-top: 6px;
  font-size: 12px; color: var(--ink-soft);
  font-weight: 500;
}

/* Geld-Karte */
.dash-card-money { grid-column: 1 / -1; }
.dash-money-summary {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; padding: 14px; background: var(--surface-2);
  border-radius: 10px; margin-bottom: 8px;
}
.dash-money-big {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px; font-weight: 600;
  color: var(--primary);
}
.dash-money-sub { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
@media (max-width: 700px) { .dash-money-summary { grid-template-columns: 1fr; } }

/* Team-Karte */
.dash-team-block { margin-bottom: 14px; }
.dash-team-block:last-child { margin-bottom: 0; }
.dash-team-label {
  font-size: 11px; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.dash-team-empty { color: var(--ink-faint); font-size: 13px; font-style: italic; }
.dash-team-list { display: flex; flex-direction: column; gap: 6px; }
.dash-team-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px; background: var(--surface-2);
  font-size: 14px;
}
.dash-team-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  animation: pulse-dot 1.6s ease-in-out infinite;
}

/* Hinweise-Karte */
.dash-warnings-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.dash-warnings-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface-2); border-radius: 8px;
  font-size: 14px;
}
.dash-warnings-list .ico-svg-wrap .ico-svg { width: 18px; height: 18px; }

/* Lexware-Karte */
.dash-lexware-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.dash-lexware-row:last-of-type { border-bottom: none; }
.dash-lexware-label { color: var(--ink-soft); }
.dash-lexware-row .lex-warn { color: var(--accent); font-weight: 600; }

/* Bulk-Action-Bar — sticky oberhalb der Tabelle. Sie steht standardmäßig
   direkt über dem Tabellen-Header und bleibt beim Scrollen unter der Topbar
   hängen, damit die Aktionen immer erreichbar sind.
   z-index 25 liegt UEBER dem Tabellen-Header (z-index 5), aber UNTER der
   Topbar (z-index 30) — beim Scrollen überdeckt die Bulk-Bar also nahtlos
   den `<th>`-Sticky-Header und schiebt sich nicht vor die Topbar. */
.bulk-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: rgba(252, 244, 232, 0.96);
  border: 1px solid var(--primary);
  border-radius: 14px;
  padding: 10px 18px;
  position: sticky;
  top: var(--topbar-h);
  z-index: 25;
  margin-bottom: 12px;
  box-shadow: 0 12px 32px -8px rgba(42, 31, 24, 0.28),
              0 4px 12px -4px rgba(42, 31, 24, 0.14);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  animation: bulk-bar-in 0.18s ease-out;
}
@keyframes bulk-bar-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bulk-bar .btn { padding: 8px 14px; font-size: 13px; }
.bulk-bar .row { gap: 4px; }
html[data-theme="dark"] .bulk-bar {
  background: rgba(58, 43, 33, 0.92);
}
@media (max-width: 700px) {
  .bulk-bar { padding: 12px 14px; }
}
.bulk-info { color: var(--primary); font-size: 14px; }
.bulk-info strong { font-size: 16px; }
/* (alte .tbl tfoot-Regel entfernt — neue Definition oben im Tabellen-System) */

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(42, 31, 24, 0.45);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 14px;
  max-width: 480px; width: 100%;
  border: 1px solid var(--line);
  max-height: 90vh;
  box-shadow: 0 12px 32px rgba(42, 31, 24, 0.18);
  display: flex; flex-direction: column;
  overflow: hidden;     /* Container clippt, der Body scrollt */
  position: relative;   /* Bezug für das Schließen-X */
}
/* Schließen-X oben rechts in jedem Dialog (Wunsch Stephan 20.08.2026) */
.modal-x {
  position: absolute; top: 14px; right: 14px; z-index: 6;
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--ink-faint); cursor: pointer;
  transition: background .12s, color .12s;
}
.modal-x:hover { background: var(--surface-2); color: var(--ink); }
.modal-x svg { width: 16px; height: 16px; }
.modal > h3 { padding-right: 56px; }  /* Platz fürs X bei langen Titeln */
.modal.modal-wide { max-width: 760px; }
.modal.modal-xl   { max-width: 920px; }
/* xxl: Stammdaten-Dialog — viele Felder + lange Checklisten, die sonst in
   einer schmalen Spalte endlos untereinander stehen. */
.modal.modal-xxl  { max-width: 1240px; }

/* ----- Form-Grid: konsistentes Eingabe-Layout für alle Dialoge -----
   Setzt feste Spaltenzahl per Klasse (cols-1..4). Labels haben eine
   min-height, sodass auch zwei-zeilige Labels die Input-Position der
   Nachbar-Spalten nicht verschieben. Inputs/Selects/Date-Pickers haben
   eine einheitliche Hoehe (42px), damit alle Felder einer Reihe optisch
   auf gleicher Baseline stehen. Auf schmalen Bildschirmen wechselt das
   Grid automatisch auf eine Spalte. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: 12px 14px;
  margin-bottom: 14px;
}
.form-grid.cols-1 { --cols: 1; }
.form-grid.cols-2 { --cols: 2; }
.form-grid.cols-3 { --cols: 3; }
.form-grid.cols-4 { --cols: 4; }
.form-grid.cols-5 { --cols: 5; }
.form-grid .field-full { grid-column: 1 / -1; }

.form-field {
  display: flex; flex-direction: column;
  min-width: 0;
}
.form-field > label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
  min-height: 32px;        /* zweizeilige Labels reservieren denselben Platz */
  line-height: 1.3;
}
.form-field > input,
.form-field > textarea,
.form-field > .app-date,
.form-field > .app-select {
  width: 100%;
}
/* Einheitliche Hoehe: alle Eingabe-Elemente in einem Form-Grid 42px hoch */
.form-grid input,
.form-grid select,
.form-grid .app-select-trigger {
  height: 42px;
  box-sizing: border-box;
}
.form-grid textarea {
  min-height: 80px;
  height: auto;
  resize: vertical;
  padding: 10px 14px;
}
/* Buttons in einer Form-Grid-Reihe haben dieselbe Hoehe wie die Inputs daneben,
   damit „E-Mail ändern" und Co. optisch buendig mit dem E-Mail-Feld sind. */
.form-grid .form-field > .btn {
  height: 42px;
  align-self: stretch;
  box-sizing: border-box;
}
/* Zusatz-/Hilfetext unter einem Eingabefeld. EINHEITLICHE Logik fuer die
   ganze App: immer als Block, linksbuendig zum Feld, dezenter Abstand nach
   oben — nie ueberlappend. Funktioniert in zwei Kontexten:
   1) innerhalb eines .form-field (direkt unter einem einzelnen Input)
   2) als eigene volle Zeile direkt im .form-grid (Standalone-Hinweis). */
.form-help {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-faint);
  margin: 6px 0 0;
}
.form-grid > .form-help {
  grid-column: 1 / -1;
  margin: -4px 0 10px;
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr !important; }
}
.modal h3 {
  margin: 0; padding: 24px 24px 16px; font-size: 20px;
  font-family: 'Source Serif 4', serif; font-weight: 500;
  color: var(--ink);
  flex-shrink: 0;
}
.modal-body {
  /* Standard: 24px Luft oben — wirkt wenn KEIN h3 darüber steht (z.B. bei
     appConfirm/appAlert ohne Titel). Wenn ein h3 davor ist, fuellt dessen
     padding-bottom den Abstand und wir setzen body padding-top auf 0. */
  padding: 24px 24px 16px;
  overflow-y: auto;
  flex: 1 1 auto;
  /* Safari-Flexbox-Fix: ohne min-height:0 schrumpft ein scrollbares Flex-Kind
     in Safari NICHT — der Body bleibt so hoch wie sein Inhalt und schiebt den
     Aktions-Footer (Speichern/Abbrechen) aus dem 90vh-Modal heraus, sodass er
     unklickbar wird. min-height:0 erlaubt das Schrumpfen + internes Scrollen. */
  min-height: 0;
}
.modal h3 + .modal-body {
  padding-top: 0;
}
.modal-actions {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex; justify-content: flex-end; gap: 8px;
  flex-shrink: 0;
  /* leicht erhoeht, damit beim Scrollen klar wird dass es eine Bar ist */
  box-shadow: 0 -4px 12px -8px rgba(42, 31, 24, 0.12);
}

/* Inline-Fehlerbanner im Modal — sitzt direkt ueber dem Aktions-Footer und ist
   damit IMMER sichtbar (flex-shrink:0), auch wenn der Body gescrollt ist oder
   auf Mobil die Tastatur offen ist. Ersetzt den unsichtbaren Toast bei
   Pflichtfeld-Validierung. */
.modal-error {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 24px;
  background: rgba(168, 50, 24, 0.09);
  color: var(--danger);
  font-size: 13px; font-weight: 500;
  border-top: 1px solid rgba(168, 50, 24, 0.22);
  flex-shrink: 0;
}
.modal-error .ico-svg { width: 17px; height: 17px; flex-shrink: 0; }
/* Pflichtfeld, das beim Speichern fehlte — rote Umrandung als Wegweiser. */
.field-invalid,
.app-select.field-invalid .app-select-trigger,
.app-date.field-invalid .app-date-input {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(168, 50, 24, 0.14) !important;
}

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 12px 20px; border-radius: 999px;
  /* Toasts über Modals und allem anderen sichtbar */
  z-index: 3000; font-size: 13px;
  opacity: 0; transition: opacity 0.2s ease;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(42, 31, 24, 0.18);
}
.toast.show { opacity: 1; }
.toast.ok  { background: var(--ok); }
.toast.err { background: var(--danger); }
/* Auf Mobil sitzt der Toast OBEN unter der Topbar — sonst wird er bei offenem
   Bottom-Sheet-Modal oder offener Tastatur von unten verdeckt (bottom:90px lag
   genau in der Tastatur-Zone → Validierungs-Hinweise waren unsichtbar). */
@media (max-width: 640px) {
  .toast {
    bottom: auto;
    top: calc(env(safe-area-inset-top, 0px) + 16px);
    max-width: calc(100vw - 32px);
    text-align: center;
  }
}

/* ---- Bottom-Nav (Mobile) ----
   Bau-Pilot-Pattern: 4 Tabs + „Mehr" — schwebt am unteren Rand mit Liquid-Glass.
   Aktive Tab bekommt die Brand-Farbe + Pille hinter dem Icon. */
.bottombar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(255, 252, 246, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid rgba(42, 31, 24, 0.08);
  padding: 8px env(safe-area-inset-right) calc(8px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  z-index: 90;
  justify-content: space-around;
  box-shadow: 0 -8px 24px -12px rgba(42, 31, 24, 0.18);
}
html[data-theme="dark"] .bottombar {
  background: rgba(42, 31, 24, 0.78);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.bottombar-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px 4px;
  min-height: 56px;
  background: transparent; border: 0; color: var(--ink-faint);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.02em;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  transition: color .15s;
}
.bottombar-btn:active { transform: scale(0.96); transition: transform .08s; }
.bottombar-btn.active { color: var(--primary); }
.bottombar-btn .ico {
  display: inline-grid; place-items: center;
  width: 44px; height: 28px;
  border-radius: 14px;
  transition: background .2s;
}
.bottombar-btn.active .ico { background: var(--primary-soft); }
.bottombar-btn .ico-svg { width: 22px; height: 22px; }
.bottombar-btn .lbl {
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Drawer (Mobile-Sidebar als Off-Canvas) ---- */
/* Geoeffnet wird ueber den „Mehr"-Button der Bottom-Nav, geschlossen per
   Backdrop-Tap, Escape, Navigation oder Runterwischen (Bottom-Sheet-Geste). */

/* Backdrop fuer offenen Drawer — schliesst beim Klick */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(42, 31, 24, 0.55);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
  -webkit-tap-highlight-color: transparent;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
html[data-theme="dark"] .drawer-backdrop { background: rgba(0, 0, 0, 0.65); }

/* Waehrend der Wisch-Geste keine Transition — der Sheet folgt dem Finger 1:1. */
.sidebar.sheet-dragging { transition: none; }

/* Pull-to-Refresh-Indikator: schwebender Kreis, der beim Runterziehen
   von oben einfaehrt. JS steuert transform/opacity live. */
.ptr-indicator {
  position: fixed; top: -44px; left: 50%; margin-left: -19px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 6px 18px -6px rgba(42, 31, 24, 0.3);
  color: var(--primary);
  z-index: 60; opacity: 0; pointer-events: none;
  transform: translateY(0);
}
.ptr-indicator .ico-svg { width: 19px; height: 19px; }
.ptr-indicator.refreshing .ico-svg { animation: spin 0.8s linear infinite; }

/* ---- Mobile (Bottom-Sheet-Menue + Bottom-Nav) ---- */
@media (max-width: 768px) {
  /* Sidebar wird zum Bottom-Sheet: faehrt vom unteren Bildschirmrand hoch.
     So sind die Menue-Eintraege in Daumenreichweite (statt am oberen Rand).
     Inhalt als 2-Spalten-Raster — kompakt und gut treffbar. */
  .sidebar {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto;
    margin: 0;
    width: 100%; max-width: 100%;
    height: auto; max-height: 86vh; max-height: 86dvh;
    border-radius: 24px 24px 0 0;
    transform: translateY(110%);
    transition: transform .3s cubic-bezier(.32, .72, 0, 1);
    z-index: 100;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto;
    box-shadow: 0 -16px 48px -12px rgba(42, 31, 24, 0.3);
  }
  .sidebar.open { transform: translateY(0); }

  /* Greif-Leiste oben (Bottom-Sheet-Konvention) */
  .sidebar::before {
    content: '';
    display: block; flex-shrink: 0;
    width: 44px; height: 5px;
    border-radius: 999px;
    background: var(--line-strong);
    margin: 2px auto 14px;
  }

  /* Brand kompakt im Sheet */
  .sidebar .brand { padding: 0 4px 12px; }

  /* Spacer raus — Eintraege direkt stapeln, kein Auseinanderziehen */
  .sidebar .spacer { display: none; }

  /* Nav-Eintraege als 2-Spalten-Raster: kompakt + naeher am Daumen */
  .sidebar .nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 0;
  }
  #sidebarNavBottom { margin-top: 8px; }
  .sidebar .nav-item {
    padding: 14px 12px;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--ink);
    font-size: 13px;
  }
  .sidebar .nav-item > span:last-child {
    min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .sidebar .nav-item.active { background: var(--primary-soft); color: var(--primary); }
  #logoutBtn {
    margin-top: 8px;
    justify-content: center;
    background: var(--surface-2);
    border-radius: 12px;
    padding: 14px 12px;
  }

  .main { margin-left: 0; }
  .bottombar { display: flex; }

  /* Content: mehr Bottom-Padding, damit die Bottom-Nav den Inhalt nicht ueberdeckt */
  .content { padding: 16px 14px calc(100px + env(safe-area-inset-bottom)); }

  /* Topbar kompakter */
  .topbar { padding: 0 12px; }
  .topbar-inner { padding: 12px 14px; gap: 8px; }
  /* Sidebar-Einklapp-Toggle gibt es nur auf Desktop — Mobile nutzt den Drawer. */
  .sidebar-toggle-btn { display: none; }
  .topbar h1 {
    font-size: 17px;
    /* Sehr lange Titel abschneiden statt umbrechen — der Hamburger
       und die Action-Icons bleiben damit sichtbar. */
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0;
  }
  /* Verbindungs-Pille ausblenden — die Info ist Mobil zu eng */
  #connectionIndicator { display: none; }

  /* Cards/Tabellen-Padding etwas kleiner */
  .card { padding: 16px; border-radius: 12px; }
  .tbl-toolbar { padding: 12px 14px; flex-wrap: wrap; }
  .tbl-toolbar .ti h3 { font-size: 16px; }
  /* In-Card-Titel, der nur den Seitentitel (Topbar) wiederholt, ausblenden —
     die Eyebrow-Zeile darueber traegt bereits Kontext + Anzahl. */
  .tbl-toolbar .ti h3.title-dup-mobile { display: none; }
  .tbl-toolbar .ti:has(h3.title-dup-mobile) .eyebrow { margin-bottom: 0; }

  /* Opt-out: kompakte Mini-Tabellen (ohne thead, wenige schmale Spalten — z. B.
     Dashboard-Listen „Anstehende Fristen" / „Meine Aufgaben") bleiben auf Mobil
     eine echte Tabelle statt zu Karten zu zerfallen (die Karten-Logik braucht
     Spaltenkoepfe als Label). */
  table.tbl.tbl-nocard { display: table; width: 100%; }
  table.tbl.tbl-nocard > tbody { display: table-row-group; }
  table.tbl.tbl-nocard > tbody > tr {
    display: table-row; background: none; border: 0; margin: 0;
    border-radius: 0; padding: 0; overflow: visible;
  }
  table.tbl.tbl-nocard > tbody > tr > td {
    display: table-cell; width: auto; gap: 0;
    text-align: left; justify-content: flex-start;
    padding: 9px 8px; border: 0; border-bottom: 1px solid var(--line);
    white-space: normal; vertical-align: top;
  }
  table.tbl.tbl-nocard > tbody > tr > td::before { display: none; }
  table.tbl.tbl-nocard > tbody > tr > td.right { text-align: right; }

  /* ===== Tabellen als Karten auf Mobile =====
     Statt horizontalem Scrollen (versteckt die wichtigen rechten Spalten
     wie Stunden/Wert/Status ohne Hinweis) wird jede Tabellenzeile zu einer
     eigenen Karte. Die Spaltenueberschrift erscheint als Label vor dem Wert
     (per data-label, gesetzt von applyTableLabels + MutationObserver).
     Best Practice fuer komplexe Datentabellen auf schmalen Viewports. */
  .tbl-wrap { overflow-x: visible; overflow-y: visible; }
  table.tbl, table.tbl tbody, table.tbl tfoot, table.tbl tr { display: block; width: auto; }
  table.tbl thead { display: none; }
  table.tbl > tbody > tr, table.tbl > tfoot > tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin: 0 12px 10px;
    padding: 2px 0;
    overflow: hidden;
  }
  table.tbl td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    text-align: right;
    padding: 7px 14px;
    border: none;
    border-bottom: 1px solid var(--bg);
    white-space: normal;
  }
  table.tbl td:last-child { border-bottom: none; }
  /* Leere Zellen (z. B. Luecken in der Summenzeile) erzeugen sonst Leerzeilen */
  table.tbl td:empty { display: none; }
  table.tbl td::before {
    content: attr(data-label);
    flex: 0 0 40%;
    text-align: left;
    font: 600 11px/1.35 'Inter', sans-serif;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }
  /* Spalten ohne Ueberschrift (Checkbox, Aktions-Buttons): kein Label, rechts */
  table.tbl td.cell-nolabel { justify-content: flex-end; }
  table.tbl td.cell-nolabel::before { display: none; }
  /* Fuehrende Steuerspalten (Auswahl-Checkbox, Erledigt-Toggle) ohne Header
     erzeugten je eine eigene LEERE Karten-Zeile (sah aus wie ein Render-Bug).
     Jetzt sitzen sie inline gebuendelt in EINER schmalen Zeile oben in der
     Karte — kompakt, voll funktionsfaehig, ohne Leerzeilen. */
  table.tbl > tbody > tr td.cell-lead {
    display: inline-flex; width: auto; min-height: 0;
    padding: 8px 6px; border-bottom: none; justify-content: flex-start;
  }
  table.tbl > tbody > tr td.cell-lead:first-child { padding-left: 12px; padding-top: 10px; }
  table.tbl > tbody > tr td.cell-lead .checkbox { transform: scale(1.15); transform-origin: left center; }
  /* Volle-Breite-Zellen (Empty-State mit colspan) */
  table.tbl td[colspan] { display: block; text-align: center; border-bottom: none; }
  table.tbl td[colspan]::before { display: none; }
  /* Fuss-Zeile (Summe) als abgesetzte dunkle Karte */
  table.tbl > tfoot > tr { background: var(--ink); border-color: var(--ink); }
  table.tbl tfoot td { color: var(--bg); border-bottom-color: rgba(255, 255, 255, 0.12); }
  table.tbl tfoot td::before { color: rgba(250, 245, 236, 0.6); }
  table.tbl tfoot td.num { color: var(--accent-deep); }

  /* Monats-Kalender kompakter: schmale Zellen, kein Mini-Eintragstext
     (auf ~50px Spaltenbreite unlesbar) — Tageszahl + Tagessumme reichen. */
  .month-grid { gap: 3px; }
  .month-cell { min-height: 52px; padding: 5px 4px; }
  .month-cell-day { font-size: 12px; }
  .month-cell-sum { font-size: 10px; }
  .month-cell-list { display: none; }
  .month-cell-holiday-name { font-size: 8px; }
  .month-wd { font-size: 9px; padding: 4px 0; }

  /* Modale als Bottom-Sheet auf Mobile */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal,
  .modal.modal-wide,
  .modal.modal-xl,
  .modal.modal-xxl {
    max-width: 100%; width: 100%;
    max-height: 92vh; max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal h3 { padding: 18px 18px 12px; font-size: 18px; }
  .modal-body { padding: 18px; }
  /* Aktions-Footer auf Mobil: umbrechen statt horizontal abschneiden.
     Frueher liefen mehrere Buttons (z. B. im Notiz-Editor: Loeschen / Aufgabe
     erstellen / Als Vorlage / Abbrechen / Speichern) rechts aus dem Bild und
     „Speichern" war nicht mehr erreichbar. Jetzt: 2-Spalten-Raster, die letzte
     allein stehende (primaere) Aktion fuellt die ganze Breite unten aus. */
  .modal-actions {
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-actions .btn { flex: 1 1 calc(50% - 4px); min-width: 0; }

  /* Buttons: bequeme Touch-Hoehe (mind. 44px) */
  .btn { padding: 11px 16px; min-height: 44px; }
  .btn-large { padding: 14px 22px; min-height: 52px; }
  .topbar-icon-btn { width: 40px; height: 40px; }
  /* Hilfe-Button groesser fuer Touch */
  .page-help-btn { width: 36px; height: 36px; }
  .page-help-btn .ico-svg { width: 19px; height: 19px; }

  /* Tab-Pillen-Karte kompakter auf Mobile, damit mehr Tabs sichtbar sind
     (der Rest scrollt horizontal). */
  .page-tabs-card { padding-left: 12px; padding-right: 12px; }
  .page-tabs-card .view-toggle button { padding-left: 12px; padding-right: 12px; gap: 5px; }

  /* Inputs: größer auf Touch (iOS-Zoom verhindern: font-size >= 16px) */
  input, textarea, select { font-size: 16px; }
}

@media (max-width: 480px) {
  .topbar-inner { padding: 10px 12px; }
  .topbar h1 { font-size: 16px; }
  .content { padding: 14px 12px calc(96px + env(safe-area-inset-bottom)); }
  .card { padding: 14px; }
  .card h2 { font-size: 19px; }
}

/* ---- Login-Screen ---- */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 20px;
  background: var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px;
  max-width: 420px; width: 100%;
  box-shadow: 0 4px 12px rgba(42, 31, 24, 0.06);
}
.login-card .brand {
  padding: 0 0 24px;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.login-card .brand-mark { width: 56px; height: 56px; }
.login-card .brand-title { font-size: 22px; }
.login-card .brand-sub { text-align: center; }

/* ---- Connection-Indicator ---- */
.connection-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
  background: rgba(79, 110, 45, 0.14); color: var(--ok);
  font-family: 'JetBrains Mono', monospace;
}
.connection-pill.offline { background: rgba(199, 122, 27, 0.15); color: var(--warn); }
.connection-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--ink-faint);
}
.empty-state .eyebrow { margin-bottom: 16px; }

.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Pulse für laufende Stempelung */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.stempel-status.running::before {
  content: ''; display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-right: 8px;
  animation: pulse-dot 1.6s ease-in-out infinite;
  vertical-align: middle;
}

/* Monats-Kalender-Grid */
.month-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px; margin-top: 8px;
}
.month-wd {
  text-align: center; font: 500 11px/1 'JetBrains Mono', monospace;
  color: var(--ink-faint); padding: 6px 0; letter-spacing: 0.04em;
}
.month-cell {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  min-height: 80px; padding: 8px; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer; transition: border-color .15s;
}
.month-cell:hover { border-color: var(--primary); }
/* Tages-Heat: zeigt auf einen Blick, an welchen Tagen wie viel gearbeitet
   wurde. Bewusst dezent — die Zelle traegt Text. is-extra = Tag mit
   ausschliesslich gesondert verguteten Stunden (Info-Ton). */
.month-cell.mh1 { background: rgba(140, 45, 20, 0.05); }
.month-cell.mh2 { background: rgba(140, 45, 20, 0.10); }
.month-cell.mh3 { background: rgba(140, 45, 20, 0.16); }
.month-cell.mh4 { background: rgba(140, 45, 20, 0.24); border-color: rgba(140, 45, 20, 0.35); }
.month-cell.is-extra.mh1 { background: rgba(61, 90, 124, 0.06); }
.month-cell.is-extra.mh2 { background: rgba(61, 90, 124, 0.12); }
.month-cell.is-extra.mh3 { background: rgba(61, 90, 124, 0.18); }
.month-cell.is-extra.mh4 { background: rgba(61, 90, 124, 0.26); border-color: rgba(61, 90, 124, 0.38); }
html[data-theme="dark"] .month-cell.mh1 { background: rgba(200, 71, 42, 0.10); }
html[data-theme="dark"] .month-cell.mh2 { background: rgba(200, 71, 42, 0.18); }
html[data-theme="dark"] .month-cell.mh3 { background: rgba(200, 71, 42, 0.26); }
html[data-theme="dark"] .month-cell.mh4 { background: rgba(200, 71, 42, 0.34); }
html[data-theme="dark"] .month-cell.is-extra.mh1 { background: rgba(120, 160, 205, 0.10); }
html[data-theme="dark"] .month-cell.is-extra.mh2 { background: rgba(120, 160, 205, 0.18); }
html[data-theme="dark"] .month-cell.is-extra.mh3 { background: rgba(120, 160, 205, 0.26); }
html[data-theme="dark"] .month-cell.is-extra.mh4 { background: rgba(120, 160, 205, 0.34); }
.month-cell.muted { background: transparent; border-style: dashed; opacity: 0.45; }
.month-cell.today { border-color: var(--accent); border-width: 2px; }
.month-cell.holiday { background: rgba(232, 181, 71, 0.16); border-color: rgba(232, 181, 71, 0.5); }
.month-cell.holiday .month-cell-day { color: var(--accent); }
.month-cell-holiday-name {
  font-size: 10px; color: var(--accent); font-weight: 500;
  font-family: 'Inter', sans-serif; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.month-cell-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 4px;
}
.month-cell-day {
  font-family: 'JetBrains Mono', monospace; font-weight: 600;
  font-size: 14px; color: var(--ink);
}
.month-cell-sum {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--primary); font-weight: 600;
}
.month-cell-empty .month-cell-day { color: var(--ink-faint); font-weight: 400; }
.month-cell-list {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 10px; color: var(--ink-soft);
  overflow: hidden;
}
.month-cell-item {
  background: var(--surface-2); padding: 2px 6px; border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.month-cell-more { color: var(--ink-faint); font-size: 10px; padding: 2px 6px; }

@media (max-width: 768px) {
  .month-cell { min-height: 56px; padding: 4px; }
  .month-cell-list { display: none; }
  .month-cell-day { font-size: 12px; }
  .month-cell-sum { font-size: 11px; }
}

/* Jahresansicht — 12 Mini-Kalender im Grid */
.year-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-top: 8px;
}
@media (max-width: 1100px) { .year-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width:  800px) { .year-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width:  500px) { .year-grid { grid-template-columns: 1fr; } }

.mini-month {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px 12px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 6px;
}
.mini-month:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(42,31,24,0.06); }
.mini-month.current { border-color: var(--accent); }
.mini-month-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-family: 'Source Serif 4', serif; font-weight: 500; font-size: 14px; color: var(--ink);
}
.mini-month-sum {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  font-weight: 600; color: var(--primary);
}
.mini-month-wd, .mini-month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
}
.mini-month-wd-cell {
  text-align: center; font: 500 9px/1 'JetBrains Mono', monospace;
  color: var(--ink-faint); padding: 2px 0;
}
.mini-month-cell {
  aspect-ratio: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px; overflow: hidden;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; line-height: 1;
  color: var(--ink); border-radius: 3px; background: transparent;
}
/* Stundenzahl unter dem Tag — klein, aber lesbar; nur an Tagen mit Zeiten. */
.mini-month-cell-h { font-size: 8px; font-weight: 600; opacity: 0.92; font-variant-numeric: tabular-nums; }
.mini-month-cell.muted { color: var(--ink-faint); opacity: 0.4; }
.mini-month-cell.today { outline: 1.5px solid var(--accent); outline-offset: -1px; font-weight: 600; }
/* Heat-Map: kleine Auspraegungen über surface-2 bis primary */
.mini-month-cell.h1 { background: rgba(140, 45, 20, 0.10); }
.mini-month-cell.h2 { background: rgba(140, 45, 20, 0.22); }
.mini-month-cell.h3 { background: rgba(140, 45, 20, 0.38); color: var(--bg); }
.mini-month-cell.h4 { background: var(--primary); color: var(--bg); font-weight: 600; }
/* Tage, an denen NUR gesondert verguetet gearbeitet wurde: Info-Ton statt
   Primaerfarbe — sichtbar, aber als „zaehlt nicht in den Saldo" erkennbar. */
.mini-month-cell.is-extra.h1 { background: rgba(61, 90, 124, 0.12); }
.mini-month-cell.is-extra.h2 { background: rgba(61, 90, 124, 0.24); }
.mini-month-cell.is-extra.h3 { background: rgba(61, 90, 124, 0.40); color: var(--bg); }
.mini-month-cell.is-extra.h4 { background: var(--info); color: var(--bg); font-weight: 600; }
html[data-theme="dark"] .mini-month-cell.h1 { background: rgba(200, 71, 42, 0.18); }
html[data-theme="dark"] .mini-month-cell.h2 { background: rgba(200, 71, 42, 0.34); }
html[data-theme="dark"] .mini-month-cell.h3 { background: rgba(200, 71, 42, 0.55); color: var(--ink); }
html[data-theme="dark"] .mini-month-cell.is-extra.h1 { background: rgba(120, 160, 205, 0.18); }
html[data-theme="dark"] .mini-month-cell.is-extra.h2 { background: rgba(120, 160, 205, 0.34); }
html[data-theme="dark"] .mini-month-cell.is-extra.h3 { background: rgba(120, 160, 205, 0.55); color: var(--ink); }
.mini-month-sum-extra { color: var(--info); font-weight: 600; }

/* Toggle-Buttons (Liste/Kalender) */
/* ===== Fristen: Monatsübersicht + Gantt ===== */
.fr-month-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
@media (max-width: 1000px) { .fr-month-row { grid-template-columns: 1fr; } }
.fr-month {
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--surface);
}
.fr-month-title {
  font-weight: 600; font-size: 14px; color: var(--ink); margin-bottom: 10px;
  text-transform: capitalize;
}
.fr-month-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  font-size: 10px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.fr-month-weekdays > span { text-align: center; padding: 4px 0; }
.fr-month-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px;
}
.fr-day {
  min-height: 64px; border-radius: 4px; padding: 4px 5px; min-width: 0;
  background: var(--surface-2); display: flex; flex-direction: column; gap: 2px;
  cursor: default; transition: background 0.15s;
}
.fr-day.has-deadlines { cursor: pointer; }
.fr-day.has-deadlines:hover { background: rgba(140,45,20,0.06); }
.fr-day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.fr-day.other-month { opacity: 0.35; }
.fr-day-num { font-size: 11px; color: var(--ink-soft); font-weight: 500; }
.fr-day.today .fr-day-num { color: var(--accent); font-weight: 700; }
.fr-pill {
  font-size: 10px; padding: 1px 5px; border-radius: 3px; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500;
}
.fr-pill-more {
  font-size: 10px; color: var(--ink-faint); font-style: italic; padding: 0 4px;
}

/* Gantt — Pillen-Variante */
/* ===== Aufgabenmanagement (Asana-Light) ===== */

/* Pillen-Reihe zur Auswahl der Ansicht (Liste/Board/Gantt). Re-nutzt das
   Pattern von .page-tabs-card, nur kompakter und mit weniger Top-Padding. */
.aufg-view-switch { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin-bottom: 12px; }
.aufg-view-switch button { background: transparent; border: 0; padding: 6px 14px; font: 500 12px 'Inter'; color: var(--ink-faint); cursor: pointer; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.aufg-view-switch button:hover { color: var(--ink); }
.aufg-view-switch button.active { background: var(--primary); color: white; }
.aufg-view-switch button.active .ico-svg { color: white; }

/* Toggle „Fristen-Aufgaben einblenden" */
.aufg-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.aufg-toggle input { width: 14px; height: 14px; cursor: pointer; }

/* Kanban-Board */
/* Echtes Kanban: alle Spalten in EINER Reihe nebeneinander, bei vielen Spalten
   (Fristen + Status + eigene Tags) horizontal scrollen statt umbrechen. */
.aufg-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
@media (max-width: 600px) { .aufg-board { grid-auto-columns: minmax(220px, 86%); } }
.aufg-board-col { background: var(--surface-2); border-radius: 10px; padding: 10px; min-height: 60px; transition: background .15s; }
.aufg-board-col.drag-over { background: rgba(140, 45, 20, 0.08); outline: 2px dashed var(--primary); outline-offset: -2px; }
.aufg-board-col-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; }
.aufg-board-col-title { font: 600 12px 'Inter'; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 6px; }
.aufg-board-col-dot   { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.aufg-board-col-count { font: 500 11px 'JetBrains Mono', monospace; color: var(--ink-faint); }
.aufg-board-list { display: flex; flex-direction: column; gap: 8px; }

/* Karte im Board */
.aufg-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(42,31,24,0.04); }
.aufg-card:hover { border-color: var(--line-strong); box-shadow: 0 2px 8px rgba(42,31,24,0.08); }
.aufg-card.dragging { opacity: 0.4; cursor: grabbing; }
/* Karten-Kopf: Titel links, Erledigt-Button rechts. */
.aufg-card-top { display: flex; align-items: flex-start; gap: 8px; }
.aufg-card-top .aufg-card-title { flex: 1; }
.aufg-card-top .task-done-btn { flex-shrink: 0; cursor: pointer; }
.aufg-card.is-done .aufg-card-title { text-decoration: line-through; color: var(--ink-faint); }
.aufg-card-title { font: 500 13px/1.35 'Inter'; color: var(--ink); margin: 0 0 6px; word-break: break-word; }
.aufg-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; color: var(--ink-faint); }
.aufg-card-meta .badge { font-size: 10px; padding: 2px 6px; }
.aufg-card-due { font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.aufg-card-due.overdue { color: var(--danger); font-weight: 600; }
.aufg-card-due.soon { color: var(--accent); }
.aufg-card-due.later { color: var(--info); }
.aufg-card-prio-high { color: var(--danger); }
.aufg-card-prio-low  { color: var(--ink-faint); }
.aufg-card-sub { font: 400 11px 'Inter'; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 3px; }

/* Subtask-Checkliste im Modal */
.aufg-subtasks { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 12px; }
.aufg-subtask-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; }
.aufg-subtask-row:hover { background: var(--surface-2); }
.aufg-subtask-row.done .aufg-subtask-text { text-decoration: line-through; color: var(--ink-faint); }
.aufg-subtask-text { flex: 1; font-size: 13px; cursor: text; }
.aufg-subtask-text[contenteditable]:focus { outline: 1px solid var(--accent); border-radius: 3px; padding: 1px 4px; }
.aufg-subtask-del { background: transparent; border: 0; color: var(--ink-faint); cursor: pointer; padding: 4px; opacity: 0; transition: opacity .15s; }
.aufg-subtask-row:hover .aufg-subtask-del { opacity: 1; }
.aufg-subtask-add { display: flex; align-items: center; gap: 8px; padding: 6px 8px; color: var(--ink-faint); cursor: pointer; border-radius: 6px; }
.aufg-subtask-add:hover { background: var(--surface-2); color: var(--ink); }
.aufg-subtask-add input { flex: 1; border: 0; background: transparent; font-size: 13px; outline: none; }

/* Liste-Ansicht: Inline-Tag-Dropdown direkt in der Zeile */
.aufg-inline-status { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 12px; color: var(--ink-soft); cursor: pointer; }
.aufg-inline-status:hover { border-color: var(--line-strong); }

/* Tag-Chip — kleine farbige Pille mit Punkt, ersetzt das alte Status-Badge im Tabellen-Kontext */
.aufg-tag-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px; border-radius: 999px; font: 500 11px 'Inter'; color: var(--ink-soft); background: color-mix(in srgb, var(--tag-c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--tag-c) 28%, transparent); white-space: nowrap; }
.aufg-tag-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--tag-c); flex-shrink: 0; }

/* Tag-Mehrfachfilter (Aufgaben) — anklickbare Toggle-Chips statt Single-Select.
   Inaktiv: dezent grau mit farbigem Punkt. Aktiv (.on): in Tag-Farbe gefuellt. */

/* Status/Tags-Mehrfachauswahl als Dropdown (ersetzt die Chip-Reihe + die
   „Fristen"-Checkbox). Optik wie .app-select; Menue per position:fixed, damit
   das overflow:clip der .tbl-wrap es nicht abschneidet. */
.tagms { position: relative; }
.tagms-btn {
  width: 100%; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 14px; font: 400 15px/1.2 'Inter', sans-serif;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s;
}
.tagms-btn:hover { border-color: var(--line-strong); }
.tagms.open .tagms-btn { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.tagms-btn-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tagms-btn-label.placeholder { color: var(--ink-faint); }
.tagms-btn .ico-svg { color: var(--ink-faint); transition: transform .2s; flex-shrink: 0; }
.tagms.open .tagms-btn .ico-svg { transform: rotate(180deg); }
.tagms-menu {
  position: fixed; z-index: 2000;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(42,31,24,0.18), 0 4px 12px rgba(42,31,24,0.08);
  max-height: 360px; overflow-y: auto; padding: 6px;
}
.tagms-menu[hidden] { display: none; }
.tagms-list { display: flex; flex-direction: column; gap: 2px; }
.tagms-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 6px; cursor: pointer;
  font: 500 13px 'Inter', sans-serif; color: var(--ink-soft);
  background: transparent; border: 0; text-align: left; width: 100%;
}
.tagms-opt:hover { background: var(--surface-2); }
.tagms-opt.on { color: var(--ink); font-weight: 600; }
.tagms-check { width: 16px; flex-shrink: 0; display: inline-flex; align-items: center; color: var(--primary); }
.tagms-check .ico-svg { width: 15px; height: 15px; }
.tagms-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tag-c); flex-shrink: 0; }
.tagms-opt-label { flex: 1; min-width: 0; }
/* „Fristen"-Eintrag optisch vom Status-Block abgesetzt. */
.tagms-opt-fristen { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 11px; }
.tagms-add {
  display: flex; align-items: center; gap: 6px; width: 100%;
  margin-top: 4px; padding: 9px 12px; border-radius: 6px;
  border: 0; border-top: 1px solid var(--line); background: transparent;
  color: var(--primary); font: 500 12px 'Inter', sans-serif; cursor: pointer;
}
.tagms-add:hover { background: var(--surface-2); }
.tagms-add .ico-svg { width: 14px; height: 14px; }

/* Board-Spalten: Header-Menü + „+ Tag"-Button */
.aufg-board-col-actions { display: inline-flex; align-items: center; gap: 4px; }
.aufg-board-col-menu { background: transparent; border: 0; color: var(--ink-faint); padding: 2px 4px; cursor: pointer; border-radius: 4px; display: inline-flex; align-items: center; }
.aufg-board-col-menu:hover { background: rgba(0,0,0,0.05); color: var(--ink); }
/* „+ Aufgabe"-Knopf am Fuss jeder Board-Spalte (Trello-Pattern) */
.aufg-board-add { width: 100%; margin-top: 2px; background: transparent; border: 1px dashed var(--line-strong); color: var(--ink-faint); border-radius: 8px; padding: 8px 10px; font: 500 12px 'Inter'; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: border-color .15s, color .15s, background .15s; }
.aufg-board-add:hover { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, transparent); }
.aufg-board-add svg { width: 14px; height: 14px; }
/* Eigene "Fristen"-Spalte — dezent brick-getoent, damit sie sich von den
   Status-Spalten abhebt. Karten darin sind klickbar (Detail), aber nicht ziehbar. */
.aufg-board-col-fristen { background: color-mix(in srgb, var(--primary) 6%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent); }

/* Gantt — wir recyceln spaeter .fr-gantt; eigene Klasse fuer kleine Anpassungen */
.aufg-gantt-bar { position: absolute; height: 18px; border-radius: 4px; padding: 1px 6px; font: 500 10px/16px 'Inter'; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.aufg-gantt-bar { background: var(--ink-faint); }
.aufg-gantt-bar.is-done { opacity: 0.55; }

/* Mention-Popover (Phase 3) */
.aufg-mention-pop { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(42,31,24,0.12); padding: 4px; min-width: 200px; max-height: 240px; overflow-y: auto; z-index: 2000; }
.aufg-mention-pop button { display: flex; align-items: center; gap: 8px; width: 100%; background: transparent; border: 0; padding: 6px 10px; cursor: pointer; border-radius: 4px; font-size: 13px; color: var(--ink); text-align: left; }
.aufg-mention-pop button:hover, .aufg-mention-pop button.active { background: var(--surface-2); }

/* Kommentare */
/* ---- Aufgaben-Anhaenge (Datei-Uploads + Vorschau) ---- */
.aufg-att-count { color: var(--ink-faint); font-weight: 500; }
.aufg-att-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.aufg-att-empty { font-size: 12px; color: var(--ink-faint); padding: 6px 2px; }
.aufg-att-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface);
}
.aufg-att-ico { display: inline-flex; color: var(--ink-faint); flex: none; }
.aufg-att-ico .ico-svg { width: 17px; height: 17px; }
.aufg-att-name {
  flex: 1; min-width: 0; text-align: left; background: transparent; border: 0; cursor: pointer;
  font: 500 13px 'Inter', sans-serif; color: var(--primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0;
}
.aufg-att-name:hover { text-decoration: underline; }
.aufg-att-size { font: 500 11px 'JetBrains Mono', monospace; color: var(--ink-faint); flex: none; }
.aufg-att-item .icon-btn { width: 30px; height: 30px; flex: none; }
.aufg-att-drop {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 14px; border: 1.5px dashed var(--line-strong); border-radius: 8px;
  background: var(--bg); color: var(--ink-soft); font-size: 13px; cursor: pointer;
  transition: border-color .15s, background .15s, opacity .15s;
}
.aufg-att-drop:hover, .aufg-att-drop.hover { border-color: var(--accent); background: var(--accent-soft); }
.aufg-att-drop.busy { opacity: .55; pointer-events: none; }
.aufg-att-drop .ico-svg { width: 18px; height: 18px; }
/* Link-Anhang */
.aufg-att-item-link .aufg-att-name { color: var(--info); }
.aufg-att-rename-input { flex: 1; min-width: 0; font-size: 13px; padding: 6px 10px; }
.aufg-att-linkadd {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  background: transparent; border: 0; cursor: pointer; padding: 4px 2px;
  font: 500 12.5px 'Inter', sans-serif; color: var(--ink-soft);
}
.aufg-att-linkadd:hover { color: var(--primary); }
.aufg-att-linkadd .ico-svg { width: 15px; height: 15px; }
.aufg-att-linkform {
  display: flex; flex-direction: column; gap: 8px; margin-top: 8px;
  padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
}
.aufg-att-linkform input { width: 100%; }
.aufg-att-linkform-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* Karten-Indikator (Anzahl Anhaenge) */
.aufg-att-chip { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-faint); font-size: 11px; }
.aufg-att-chip .ico-svg { width: 13px; height: 13px; }
/* Veranlagungszeitraum einer Frist-Aufgabe — mono, damit Jahre/Quartale
   („2025", „Q3/26") auf einen Blick als Zeitraum lesbar sind. */
.aufg-vz-chip {
  display: inline-flex; align-items: center;
  font: 600 10.5px 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.02em; padding: 1px 6px; border-radius: 5px;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap;
}

/* ===== Reporting-Modul ===== */
.rep-head { margin-bottom: 18px; }
/* Schrittleiste: wo steht der Fall gerade? */
.rep-steps { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.rep-step {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px;
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px;
  background: var(--surface-2); color: var(--ink-soft); font-size: 13.5px;
  font-family: 'Inter', sans-serif; text-align: left; cursor: default;
  transition: border-color .15s, background .15s;
}
.rep-step.is-open { cursor: pointer; }
.rep-step.is-open:hover { border-color: var(--primary); background: var(--surface); }
.rep-step:disabled { opacity: .55; }
.rep-step-no {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--line); color: var(--ink-soft); font: 600 12px 'JetBrains Mono', monospace;
}
.rep-step-no .ico-svg { width: 13px; height: 13px; }
.rep-step.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--ink); font-weight: 500; }
.rep-step.is-active .rep-step-no { background: var(--primary); color: var(--bg); }
.rep-step.is-done .rep-step-no { background: var(--ok); color: var(--bg); }

/* Abgelegte Unterlagen — kompakt, keine Tabelle */
.rep-files { display: grid; gap: 6px; margin-top: 16px; }
.rep-file {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--surface-2);
}
.rep-file-kind {
  font: 600 10.5px 'JetBrains Mono', monospace; letter-spacing: .05em; text-transform: uppercase;
  color: var(--primary); white-space: nowrap;
}
.rep-file-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-file-meta { font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }
.rep-flow-actions {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
}

/* Knopfleiste der Klärungskarte: eine Linie, gleiche Höhe, gleiche Breite.
   Vorher standen zwei kleine Tabellenknöpfe neben einem großen — das sah
   zusammengewürfelt aus. */
.rep-card-nav { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.rep-card-nav .btn {
  min-height: 40px; justify-content: center; white-space: nowrap;
  font-size: 13px; line-height: 1;
}
.rep-nav-btn { min-width: 118px; }
.rep-nav-ok  { min-width: 176px; }
.rep-nav-ok.is-done {
  background: var(--ok-soft, rgba(79,110,45,.12)); border-color: transparent;
  color: var(--ok); font-weight: 500; cursor: default;
}
.rep-card-nav .btn:disabled { opacity: .4; cursor: default; }
@media (max-width: 560px) {
  .rep-card-nav { width: 100%; }
  .rep-nav-btn { flex: 1; min-width: 0; }
  .rep-nav-ok { flex: 1 0 100%; }
}

/* Blätterleiste unter der Klärungskarte: zeigt den ganzen Stapel auf einen
   Blick — erledigt, aktuell, offen — und springt per Klick dorthin. */
.rep-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
}
.rep-dots { display: flex; align-items: center; gap: 8px; }
.rep-dot {
  width: 26px; height: 6px; border-radius: 999px; border: 0; padding: 0; cursor: pointer;
  background: var(--line); transition: background .15s, transform .15s;
}
.rep-dot:hover { transform: scaleY(1.6); }
.rep-dot.is-done { background: var(--ok, #4f6e2d); opacity: .55; }
.rep-dot.is-now  { background: var(--primary); }
.rep-pager-hint { font-size: 11.5px; color: var(--ink-faint); }
@media (max-width: 640px) { .rep-pager-hint { display: none; } }

/* Warnband über dem E-Mail-Entwurf: fehlende Vergleichswerte dürfen nicht
   unbemerkt in einer Mandanten-Mail landen. */
.rep-warn {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin: 0 0 18px; padding: 14px 16px; border-radius: 10px;
  background: rgba(224, 139, 44, .10); border-left: 3px solid var(--warn, #e08b2c);
}
.rep-warn-title { font-size: 13.5px; font-weight: 600; }
.rep-warn-text { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; max-width: 72ch; }

/* Klärungskarten */
.rep-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px; margin-top: 16px; box-shadow: 0 1px 2px rgba(42,31,24,.04);
}
.rep-card.is-done { border-color: rgba(79,110,45,.3); }
.rep-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.rep-card-head h3 { margin: 2px 0 0; font-family: 'Source Serif 4', Georgia, serif; font-size: 1.15rem; }
.rep-card-no {
  font: 600 10.5px 'JetBrains Mono', monospace; letter-spacing: .1em;
  text-transform: uppercase; color: var(--primary);
}
.rep-card-points { display: grid; gap: 2px; margin-top: 14px; }
.rep-point {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 0; border-top: 1px solid var(--line-soft);
}
/* Erledigt heißt nicht unleserlich: kein Durchstreichen, kein Ausgrauen —
   ein grüner Rand links und ein Häkchen genügen. Durchgestrichene Fließtexte
   über drei Zeilen kann niemand mehr lesen. */
.rep-point.is-done {
  border-left: 3px solid rgba(79,110,45,.45); padding-left: 13px; margin-left: -16px;
  background: linear-gradient(90deg, rgba(79,110,45,.05), transparent 55%);
}
.rep-point.is-done .rep-point-q { color: var(--ink-soft); }
.rep-point-check { margin-top: 3px; }
.rep-point-body { flex: 1; min-width: 0; }
.rep-point-top { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between; }
.rep-point-q {
  font-size: 15px; line-height: 1.55; margin: 0; max-width: 88ch; font-weight: 450;
}
.rep-point-tags { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.rep-point-sum {
  font: 600 12.5px 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums;
  white-space: nowrap; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}
/* Der Zahlenkontext war ein Fließsatz. Als einzelne Fakten ist er scanbar. */
.rep-facts {
  list-style: none; margin: 10px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.rep-facts li {
  font-size: 12px; line-height: 1.45; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: 7px; padding: 5px 9px;
}
.rep-point-answer {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 10px;
  font-size: 12.5px; color: var(--ok); background: rgba(79,110,45,.10);
  border-radius: 999px; padding: 5px 12px 5px 9px;
}
.rep-point-answer .ico-svg { width: 13px; height: 13px; flex-shrink: 0; }
.rep-point-by { color: var(--ink-soft); }
.rep-point-by:before { content: '·'; margin-right: 6px; }
.rep-point-note { width: 100%; margin-top: 10px; font-size: 13px; }
@media (max-width: 640px) {
  .rep-point-top { flex-direction: column; gap: 8px; }
  .rep-point-tags { order: -1; }
}

/* Nachweis-Aufklapper im letzten Schritt */
.rep-details {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 20px; margin-top: 26px;
}
.rep-details summary { cursor: pointer; font-size: 13.5px; color: var(--ink-soft); }
.rep-details-body { margin-top: 14px; }
/* Luft zwischen den Abschnitten eines Reiters — Karten und Tabellenblöcke
   standen vorher fast auf Kante. */
#repTabBody > * + * { margin-top: 26px; }
#repTabBody > .card { padding: 22px 24px; }
.rep-gates { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-top: 16px; }
.rep-gate {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2);
}
.rep-gate-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.rep-gate.is-blocked .rep-gate-dot { background: var(--danger); }
.rep-gate.is-clear   .rep-gate-dot { background: var(--ok); }
.rep-gate.is-blocked { border-color: rgba(168, 50, 24, 0.35); }
.rep-gate-label  { font-weight: 600; font-size: 13.5px; }
.rep-gate-detail { font-size: 12px; color: var(--ink-soft); }

/* Ablagefläche für die Auswertungen */
.rep-drop {
  border: 2px dashed var(--line-strong); border-radius: 12px; padding: 20px;
  transition: border-color .15s, background .15s;
}
.rep-drop.is-over { border-color: var(--primary); background: var(--primary-soft); }
.rep-drop-inner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rep-drop-inner > .ico-svg { width: 22px; height: 22px; color: var(--ink-faint); flex-shrink: 0; }
.rep-drop-inner > div { flex: 1; min-width: 220px; }
.rep-progress { margin-top: 12px; font-size: 12.5px; color: var(--ink-soft); font-family: 'JetBrains Mono', monospace; }
/* Die KI liest 60 Seiten PDF — das dauert ein bis zwei Minuten. Ohne
   sichtbaren Fortschritt wirkt die App eingefroren. */
/* Der Blitz ist eine Umrisslinie und läuft bei 16 px fast zu — im KI-Knopf
   wird er gefüllt und weiß, sonst verschwindet er im dunklen Rot. */
.rep-ai-btn { color: #fff; }
.rep-ai-btn .ico-svg { color: #fff; fill: currentColor; stroke: currentColor; stroke-width: 1; }

.rep-working {
  margin-top: 14px; padding: 14px 16px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.rep-working-head { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 500; }
.rep-working-sub { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.rep-working-bar { margin-top: 10px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.rep-working-bar span {
  display: block; height: 100%; width: 35%; border-radius: 999px; background: var(--primary);
  animation: repWorking 1.6s ease-in-out infinite;
}
/* Wenn die Schritte bekannt sind, zeigt der Balken echten Fortschritt statt
   einer Endlosschleife — dann sieht man, wann wirklich Schluss ist. */
.rep-working-bar.is-step span { animation: none; width: 0; transition: width .25s ease; }
.rep-working-steps { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.rep-working-step {
  font-size: 12px; color: var(--ink-faint); display: flex; align-items: center; gap: 6px;
}
.rep-working-step.is-done { color: var(--ink-soft); }
.rep-working-step.is-now { color: var(--ink); font-weight: 500; }
.rep-working-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: 0 0 auto;
}
.rep-working-step.is-done .rep-working-dot { background: var(--ok, #4f6e2d); }
.rep-working-step.is-now .rep-working-dot { background: var(--primary); }
@keyframes repWorking {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}
@media (prefers-reduced-motion: reduce) {
  .rep-working-bar span { animation: none; width: 100%; opacity: .5; }
}

/* Zahleneingaben der Kennzahlen-Tabelle */
input.rep-num {
  text-align: right; font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}

/* Rückfragen-Detail */
.rep-qdetail { padding: 18px 22px; background: var(--surface-2); display: grid; gap: 10px; }
.rep-qtext { font-size: 14px; line-height: 1.6; color: var(--ink); max-width: 76ch; }
.rep-qmeta { font-size: 12.5px; color: var(--ink-soft); }
.rep-qsection {
  font: 600 10.5px 'JetBrains Mono', monospace; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); margin-top: 6px;
}
.rep-answer { border-left: 2px solid var(--line-strong); padding: 8px 0 8px 12px; }
.rep-answer + .rep-answer { margin-top: 8px; }
.rep-answer-head { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-faint); }
.rep-answer-text { font-size: 13.5px; white-space: pre-wrap; margin-top: 3px; }
.rep-answer-ev { margin-top: 5px; display: flex; gap: 8px; flex-wrap: wrap; }
.rep-answer-empty { font-size: 13px; color: var(--ink-faint); font-style: italic; }
.rep-answer-form { display: grid; gap: 8px; }
.rep-answer-form textarea { width: 100%; }
.rep-answer-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rep-answer-controls .app-select { min-width: 160px; }
.rep-ans-files { font-size: 12px; color: var(--ink-soft); }
.rep-review-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rep-review-form input { flex: 1; min-width: 240px; }

/* Bericht & Versand */
.rep-release {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: center;
}
.rep-release-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--ink-soft); }
.rep-approvals { display: grid; gap: 8px; }
.rep-appr {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2);
}
.rep-appr.is-done { border-color: rgba(79, 110, 45, 0.4); }
.rep-appr-label { font-weight: 600; font-size: 13.5px; }
.rep-appr-hint  { font-size: 12px; color: var(--ink-soft); }
.rep-send {
  margin-top: 16px; padding: 16px 18px; border-radius: 12px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
}
.rep-send.is-locked { background: rgba(168, 50, 24, 0.08); border: 1px solid rgba(168, 50, 24, 0.3); }
.rep-send.is-open   { background: rgba(79, 110, 45, 0.10); border: 1px solid rgba(79, 110, 45, 0.35); }
.rep-send-title { font-weight: 600; }
.rep-send-hint  { font-size: 12.5px; color: var(--ink-soft); max-width: 62ch; }
/* Breite Tabellen (Kennzahlen, Rückfragen) dürfen seitlich scrollen, statt
   rechts abgeschnitten zu werden — .tbl-wrap selbst schneidet ab. */
/* Der seitlich scrollbare Rahmen bricht das Sticky-Verhalten der Tabellenköpfe:
   Der Kopf klebt dann an der Oberkante DIESES Kastens statt an der Topbar und
   legt sich beim Scrollen über die erste Zeile. Innerhalb des Rahmens scrollt
   der Kopf deshalb normal mit. */
.tbl-wrap .rep-tblscroll .tbl thead th,
.rep-tblscroll .tbl thead th { position: static; top: auto; z-index: auto; }
.rep-tblscroll { overflow-x: auto; }
.rep-tblscroll > table { min-width: 760px; }
/* Die Kennzahlen-Tabelle trägt sieben Spalten mit Eingaben — sie braucht mehr
   Grundbreite, sonst schrumpfen die Zahlenfelder auf drei Ziffern. */
.rep-tblscroll.is-wide > table { min-width: 1040px; }
.rep-tblscroll input[type="text"] { width: 100%; }

/* ---- Datei-Vorschau-Overlay (PDF/Bild) — ueber dem Dialog ---- */
.att-preview-overlay { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.att-preview-backdrop { position: absolute; inset: 0; background: rgba(42, 31, 24, 0.62); }
html[data-theme="dark"] .att-preview-backdrop { background: rgba(0, 0, 0, 0.72); }
.att-preview-box {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  width: min(1000px, 96vw); height: min(90vh, 1200px);
  background: var(--surface); border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(42, 31, 24, 0.35);
}
.att-preview-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); flex: none;
}
.att-preview-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; color: var(--ink); }
.att-preview-title > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-preview-title .ico-svg { width: 18px; height: 18px; color: var(--ink-faint); flex: none; }
.att-preview-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.att-preview-body { flex: 1; min-height: 0; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.att-preview-frame { width: 100%; height: 100%; border: 0; }
.att-preview-img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* PDF auf Canvas (selbst gehostetes pdf.js) — scrollbare Seiten */
.att-pdf-scroll { width: 100%; height: 100%; overflow: auto; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; -webkit-overflow-scrolling: touch; }
.att-pdf-page { background: #fff; box-shadow: 0 2px 14px rgba(42, 31, 24, 0.20); border-radius: 2px; max-width: 100%; }
.att-preview-loading { color: var(--ink-faint); font-size: 14px; padding: 24px; text-align: center; }
@media (max-width: 640px) {
  .att-preview-overlay { padding: 0; }
  .att-preview-box { width: 100vw; height: 100dvh; border-radius: 0; }
}

.aufg-comments { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.aufg-comment { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.aufg-comment:first-child { border-top: 0; padding-top: 0; }
.aufg-comment-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.aufg-comment-body { flex: 1; min-width: 0; }
.aufg-comment-head { display: flex; gap: 8px; align-items: baseline; font-size: 12px; }
.aufg-comment-author { font-weight: 600; color: var(--ink); }
.aufg-comment-time { color: var(--ink-faint); }
.aufg-comment-text { font-size: 13px; color: var(--ink-soft); line-height: 1.5; white-space: pre-wrap; margin-top: 2px; word-break: break-word; }
.aufg-comment-text .mention { color: var(--primary); font-weight: 500; background: var(--primary-soft); padding: 0 4px; border-radius: 3px; }
.aufg-comment-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.aufg-comment:hover .aufg-comment-actions { opacity: 1; }
.aufg-comment-input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 13px; resize: vertical; min-height: 60px; }
.aufg-comment-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.fr-gantt {
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); overflow-x: auto;
  /* 6 Monate × ~130px + 220px Mandant-Spalte = ~1000px. Passt auf
     den meisten Screens ohne Scroll. */
}
.fr-gantt-header,
.fr-gantt-row {
  min-width: 1000px;
}
.fr-gantt-header {
  display: flex; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.fr-gantt-label-spacer {
  flex: 0 0 220px;   /* EXAKT gleiche Breite wie .fr-gantt-label,
                        sonst rutschen Header und Track auseinander */
  padding: 10px 14px; box-sizing: border-box;
  font-size: 11px; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  border-right: 1px solid var(--line);
  display: flex; align-items: center;
}
.fr-gantt-months {
  flex: 1; display: flex; position: relative;
}
.fr-gantt-month {
  text-align: center; padding: 10px 4px; font-size: 12px; font-weight: 500;
  color: var(--ink-soft); text-transform: capitalize;
  flex-shrink: 0; box-sizing: border-box;
  /* Trennlinien werden über absolute .fr-gantt-divider gezogen — identisch
     in Header + Track. Keine border-left auf den Spalten selbst, sonst
     verzerrt die Breite. */
}
/* Vertikale Spalten-Trennlinie, identisch in Header und Track positioniert */
.fr-gantt-divider {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--line); pointer-events: none; z-index: 1;
}
/* Navigations-Toolbar oberhalb des Gantt (Pfeile + Heute + Sichtfenster) */
.fr-gantt-nav {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.fr-gantt-nav-range {
  font-size: 13px; color: var(--ink-soft); font-weight: 500;
  padding: 0 8px;
}

/* Sammel-Modal "Vorlagen für Mandant" — Checkbox-Liste pro Frist-Typ */
.cust-rdl-group { margin-bottom: 12px; }
.cust-rdl-row {
  display: grid; grid-template-columns: 24px 1fr auto; gap: 10px;
  align-items: center; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px;
  margin-bottom: 4px; cursor: pointer;
  background: var(--surface); transition: background 0.12s, border-color 0.12s;
}
.cust-rdl-row:hover { background: var(--surface-2); }
.cust-rdl-row.is-active { border-color: var(--primary); background: rgba(140, 45, 20, 0.04); }
.cust-rdl-name { font-size: 13px; color: var(--ink); font-weight: 500; }
.cust-rdl-meta { font-size: 11px; color: var(--ink-faint); font-family: 'JetBrains Mono', monospace; }
/* Checklisten mehrspaltig, sobald Platz da ist (Stammdaten-Dialog ist xxl) —
   sonst steht die Steuerarten-Liste als endlose Einzelspalte da. */
.cust-rdl-cols {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 6px; align-items: start;
}
.cust-rdl-cols .cust-rdl-row { margin-bottom: 0; }

/* Mandant-Gruppe in der Vorlagen-Liste (klickbare Gruppen-Zeile) */
.rdl-group-header {
  background: var(--surface-2); cursor: pointer;
}
.rdl-group-header:hover { background: rgba(140,45,20,0.05); }
.rdl-group-header td { font-weight: 600; padding: 10px 14px; }

.fr-gantt-body { /* horizontal scroll gemeinsam mit Header via .fr-gantt;
                    vertikal scrollt die Seite */ }
.fr-gantt-row {
  display: flex; border-bottom: 1px solid var(--line); min-height: 36px;
}
.fr-gantt-row:last-child { border-bottom: 0; }
.fr-gantt-label {
  flex: 0 0 220px;   /* EXAKT gleiche Breite wie .fr-gantt-label-spacer */
  padding: 8px 12px; box-sizing: border-box; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-right: 1px solid var(--line); display: flex; align-items: center;
  gap: 8px;
}
/* Mandant-Header-Zeile: etwas prominenter, klickbar */
.fr-gantt-row-header {
  background: rgba(42, 31, 24, 0.025);
  border-top: 1px solid var(--line);
}
.fr-gantt-row-header:first-child { border-top: 0; }
.fr-gantt-label-header { color: var(--ink); font-weight: 600; }
.fr-gantt-label-text {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
}
.fr-gantt-label-text:hover { color: var(--primary); }
.fr-gantt-toggle {
  background: transparent; border: 0; padding: 2px 4px;
  color: var(--ink-faint); cursor: pointer; display: inline-flex; align-items: center;
  border-radius: 4px;
}
.fr-gantt-toggle:hover { background: var(--surface-2); color: var(--ink); }
/* Platzhalter wenn der Mandant nur 1 Frist-Typ hat — gleicher Platzbedarf,
   damit Mandanten-Namen alle bündig ausgerichtet sind. */
.fr-gantt-toggle-spacer { display: inline-block; width: 22px; flex-shrink: 0; }
.fr-gantt-chev { display: inline-flex; transition: transform 0.15s; }
.fr-gantt-chev .ico-svg { width: 14px; height: 14px; }
.fr-gantt-row-count {
  font-size: 11px; color: var(--ink-faint);
  background: var(--surface-2); padding: 1px 6px; border-radius: 999px;
  font-weight: 500;
}
/* Sub-Zeile (pro Frist-Typ) */
.fr-gantt-row-sub { min-height: 32px; }
.fr-gantt-label-sub {
  padding-left: 36px;   /* Einrückung unter dem Mandant */
  font-size: 12px; color: var(--ink-soft); font-weight: 400;
}
.fr-gantt-track {
  flex: 1; position: relative; min-height: 44px;
  overflow: hidden;  /* Pillen, die theoretisch über den Rand laufen würden
                        (translate(-50%) bei left:0), sauber abschneiden —
                        kein Überlappen in die Mandant-Spalte. */
}
/* Alternierende Spalten-Streifen für bessere Monatstrennung */
.fr-gantt-band {
  position: absolute; top: 0; bottom: 0;
  background: rgba(42, 31, 24, 0.025); pointer-events: none;
}
.fr-gantt-today-line {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--accent); opacity: 0.7; z-index: 2; pointer-events: none;
}
/* Gantt-Pillen NUTZEN das Design-System (.badge + .badge-<status>).
   Diese Klasse fügt nur Positionierung + Klickbarkeit hinzu. Etwas
   größere Font + Padding als das Standard-Badge, weil die Pillen
   hier die Hauptinformation tragen (Tag + Frist-Kürzel). */
/* Pille mittig in der Monatszelle (-50% vom left:Mitte-des-Monats-%) */
.fr-gantt-pill {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  cursor: pointer; z-index: 3;
  font-size: 11px; padding: 3px 9px;
  min-width: 64px; text-align: center;
  box-shadow: 0 1px 2px rgba(42,31,24,0.12);
  transition: transform 0.12s, box-shadow 0.12s;
  white-space: nowrap;
}
.fr-gantt-pill:hover {
  transform: translate(-50%, -50%) scale(1.06); z-index: 5;
  box-shadow: 0 2px 6px rgba(42,31,24,0.2);
}
/* Monats-Counter in Mandant-Header (bei multi-sub) — klickbar, expandiert
   die Mandant-Gruppe falls collapsed, sonst nur Hover-Highlight. */
.fr-gantt-month-count {
  position: absolute; top: 50%; left: 0;
  transform: translate(-50%, -50%);
  font-size: 11px; font-weight: 600;
  font-family: inherit;
  color: var(--ink-soft);
  background: var(--surface-2);
  padding: 2px 9px; border-radius: 999px;
  min-width: 26px; text-align: center;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.fr-gantt-month-count:hover {
  background: var(--primary-soft); color: var(--primary);
  border-color: var(--primary);
  transform: translate(-50%, -50%) scale(1.08);
}
.fr-gantt-label { cursor: pointer; }
.fr-gantt-label:hover { color: var(--primary); }

.fr-gantt-legend {
  padding: 12px 16px; font-size: 12px; color: var(--ink-soft);
  background: var(--surface-2); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.fr-gantt-legend-group { display: inline-flex; align-items: center; gap: 16px; }
.fr-gantt-legend-dot {
  display: inline-block; width: 14px; height: 14px; border-radius: 7px;
  margin-right: 4px; vertical-align: middle;
}

/* (alte .view-toggle-Pillen-Variante ersetzt durch zentrale Underline-Tabs
    weiter oben in dieser Datei — siehe Block "View-Tabs"). */

/* Tagesgruppe in Wochenliste (Mobile + Monat-Listenansicht) */
.day-group { margin-bottom: 18px; }
.day-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px; padding: 0 4px;
}
.day-title {
  font-family: 'Source Serif 4', serif; font-weight: 500;
  font-size: 16px; color: var(--ink);
}
.day-sum {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px; font-weight: 600; color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* Wochenansicht — Kalenderblatt: 7 Spalten nebeneinander */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.week-day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: flex; flex-direction: column; gap: 6px;
  min-height: 200px;
  /* Hoehe auf den Viewport begrenzen: zu lange Tage scrollen INNERHALB der
     Spalte (siehe .week-day-list), statt ueber den Rahmen hinauszulaufen.
     --week-col-max wird nach jedem Render dynamisch gemessen (setWeekColMaxHeight),
     der calc()-Wert dient nur als Fallback vor der ersten Messung. */
  max-height: var(--week-col-max, calc(100dvh - 300px));
}
.week-day { cursor: pointer; transition: border-color .15s, background .15s; }
.week-day:hover { border-color: var(--accent); }
.week-day.today { border-color: var(--accent); border-width: 2px; }
.week-day.weekend { background: var(--surface-2); opacity: 0.85; }
.week-day.holiday {
  background: rgba(232, 181, 71, 0.14);
  border-color: rgba(232, 181, 71, 0.45);
}
.week-day-holiday-label {
  text-align: center; font-size: 10px; color: var(--accent);
  font-weight: 500; padding: 2px 0;
}
.week-day-head {
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
  text-align: center;
  flex-shrink: 0;   /* Kopf bleibt fix — nur die Eintragsliste darunter scrollt */
}
.week-day-name {
  font: 500 11px/1 'JetBrains Mono', monospace;
  color: var(--ink-faint); letter-spacing: 0.08em; text-transform: uppercase;
}
.week-day-date {
  font-family: 'Source Serif 4', serif; font-weight: 500;
  font-size: 18px; color: var(--ink); margin-top: 4px;
}
.week-day-sum {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  margin-top: 2px;
}
.week-day-sum-main {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 600; color: var(--primary);
}
/* Gesondert-Zeile: IMMER gerendert (bei 0 unsichtbar), damit jeder Tageskopf
   gleich hoch ist und die Karten darunter strikt auf einer Linie beginnen. */
.week-day-extra {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 400; color: var(--info);
}
.week-day-empty {
  padding: 12px 4px; font-size: 11px; color: var(--ink-faint);
  display: flex; align-items: center; justify-content: center;
  opacity: 0.4; transition: opacity .15s;
}
.week-day:hover .week-day-empty { opacity: 0.9; color: var(--accent); }
.week-day-empty .ico-svg { width: 18px; height: 18px; }

/* Hinweis-Zeile in Listen-/Mobile-Wochenansicht, wenn ein Tag leer ist */
.day-empty-hint {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px; margin: 2px 4px;
  font-size: 12px; color: var(--ink-faint);
  border: 1px dashed var(--line); border-radius: 6px;
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.day-empty-hint:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }
.day-empty-hint .ico-svg { width: 14px; height: 14px; }
.day-group { cursor: pointer; }
.week-day-list {
  display: flex; flex-direction: column; gap: 6px;
  /* Fuellt die restliche Spaltenhoehe und scrollt INTERN, wenn der Tag zu lang
     wird — so bleibt alles innerhalb des Rahmens. min-height:0 ist noetig, damit
     ein Flex-Kind kleiner als sein Inhalt werden und scrollen darf. */
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  /* Scrollbar komplett ausblenden — Scrollen bleibt moeglich (wie Sidebar). */
  scrollbar-width: none; -ms-overflow-style: none;
}
.week-day-list::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* Kompakter Eintrag für Wochenansicht */
.week-entry {
  position: relative;   /* Anker für den Kopier-Button oben rechts */
  background: var(--surface-2);
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  cursor: pointer;
  border-left: 3px solid var(--primary);
}
.week-entry:hover { background: var(--surface); border-color: var(--primary); }
/* Kopier-Button auf der Wochen-Karte — nur beim Hover sichtbar (Desktop).
   Styling kommt aus .icon-btn, hier nur Position + kompakte Größe. */
.week-entry .week-entry-copy {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; padding: 0;
  display: none; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  opacity: 0.95;
}
.week-entry:hover .week-entry-copy { display: inline-flex; }
.week-entry .week-entry-copy .ico-svg { width: 13px; height: 13px; }
/* Drag & Drop: Eintrag auf einen anderen Tag ziehen (gleiche Optik wie
   Aufgaben-Board: .aufg-card.dragging / .aufg-board-col.drag-over) */
.week-entry.dragging { opacity: 0.4; cursor: grabbing; }
.week-day.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; background: rgba(140, 45, 20, 0.08); }
.week-entry.billed { border-left-color: var(--ok); }
.week-entry.on_hold { border-left-color: var(--warn); }
.week-entry.no_billing { border-left-color: var(--ink-faint); }
.week-entry-cust { font-weight: 600; color: var(--ink); }
.week-entry-act  { color: var(--ink-soft); font-size: 11px; }
.week-entry-dur {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600; color: var(--primary); margin-top: 4px;
}
.week-entry-note {
  font-size: 11px; color: var(--ink-faint);
  margin-top: 3px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.week-entry-user { font-size: 10px; color: var(--ink-faint); margin-top: 2px; }

@media (max-width: 1100px) {
  .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .week-grid { grid-template-columns: 1fr; }
  /* Einspaltig: Tage fliessen natuerlich, Seite scrollt — kein internes Scrollen. */
  .week-day { min-height: auto; max-height: none; }
  .week-day-list { overflow: visible; }
}

/* ==========================================================================
   Dokument-Vorlagen (Word/.docx — Arbeitsverträge, Kündigung, Fragebogen …)
   Vorlagen-Karten-Grid + Ausfüll-Formular im Erstellen-Dialog.
   ========================================================================== */
.doc-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.doc-tpl-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.doc-tpl-card:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 26px -16px rgba(42, 31, 24, 0.28);
}
.doc-tpl-card .doc-tpl-ico {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: rgba(140, 45, 20, 0.10);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.doc-tpl-card .doc-tpl-ico .ico-svg { width: 22px; height: 22px; }
.doc-tpl-card h4 { margin: 0; font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-tpl-card p { margin: 0; font-size: 12.5px; color: var(--ink-faint); line-height: 1.5; flex: 1; }
.doc-tpl-card .doc-tpl-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.doc-tpl-card .doc-tpl-actions .btn { font-size: 12.5px; padding: 7px 11px; }

/* Ausfüll-Status im Erstellen-Dialog — bleibt beim Scrollen oben sichtbar */
.docx-status {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  padding: 8px 0;
  margin: 4px 0 2px;
}

/* Pflichtfeld-Markierung: leeres Feld beim Erstellen-Versuch */
.form-field.missing > label { color: var(--danger); }
.form-field.missing input,
.form-field.missing textarea,
.form-field.missing .app-select-btn,
.form-field.missing .app-date-input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(168, 50, 24, 0.10);
}

/* Öffentliche Einmal-Link-Seite (#fragebogen/<token>) — breitere Karte,
   oben ausgerichtet und scrollbar, sonst identisch zur Login-Optik */
.public-fb-wrap { place-items: start center; padding: 28px 14px 64px; }
.public-fb-card { max-width: 720px; }
.public-fb-card .docx-status { top: -8px; }

/* ============================================================================
   MODUL: Notizen — Karten-Raster, Editor, Checklisten, Vorlagen
   ============================================================================ */
.note-content-area { min-height: 200px; }
.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; padding: 16px;
}
.note-card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 130px; padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: 10px; box-shadow: 0 1px 2px rgba(42, 31, 24, 0.04);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}
.note-card:hover { box-shadow: 0 4px 14px rgba(42, 31, 24, 0.10); transform: translateY(-1px); }
.note-card.pinned { border-left-color: var(--accent); }
.note-card.nc-amber { border-left-color: var(--accent); }
.note-card.nc-sand  { border-left-color: var(--surface-2); }
.note-card.nc-brick { border-left-color: var(--primary); }
.note-card.nc-sage  { border-left-color: var(--ok); }
.note-card-top { display: flex; align-items: flex-start; gap: 8px; }
.note-card-title {
  flex: 1; min-width: 0;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--ink);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.note-pin {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border: none; background: transparent; cursor: pointer;
  color: var(--ink-faint); border-radius: 6px; opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.note-card:hover .note-pin, .note-pin.on { opacity: 1; }
.note-pin:hover { background: var(--surface-2); color: var(--ink); }
.note-pin.on { color: var(--accent); }
.note-pin .ico-svg { width: 15px; height: 15px; }
.note-card-snippet {
  flex: 1; font-size: 12.5px; line-height: 1.5; color: var(--ink-soft);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  white-space: pre-wrap; word-break: break-word;
}
.note-card-snippet.empty { color: var(--ink-faint); font-style: italic; }
.note-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 4px; }
.note-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 500; letter-spacing: 0.03em;
  background: var(--surface-2); color: var(--ink-soft);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-badge .ico-svg { width: 11px; height: 11px; flex: none; }
.note-badge.private { background: rgba(74, 56, 44, 0.10); color: var(--ink-soft); }
.note-badge.team    { background: var(--primary-soft); color: var(--primary); }
.note-badge.shared  { background: var(--accent-soft); color: var(--accent-deep); }
.note-badge.kind    { background: var(--accent-soft); color: var(--accent-deep); }
.note-card-date { margin-left: auto; font-size: 10px; color: var(--ink-faint); font-family: 'JetBrains Mono', monospace; flex: none; }

/* Empty-State + Vorlagen-Auswahl */
.note-empty { padding: 32px 20px; text-align: center; }
.note-empty-hd { margin-bottom: 22px; }
.note-empty-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; margin: 0 auto 12px;
  border-radius: 14px; background: var(--surface-2); color: var(--primary);
}
.note-empty-ico .ico-svg { width: 26px; height: 26px; }
.note-empty-hd h3 { margin: 0 0 4px; font-size: 17px; }
.note-empty-hd p { margin: 0; font-size: 13px; color: var(--ink-faint); }
.note-tpl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; max-width: 720px; margin: 0 auto;
}
/* Im Modal: etwas Luft oben/unten, sonst klebt die erste Kartenreihe am
   Scroll-Rand des .modal-body (padding-top:0 bei Titel) und der Hover-Lift
   (+ Rahmen/Schatten) der Karten wird oben abgeschnitten. */
.note-tpl-grid.in-modal { max-width: none; padding: 6px 2px 4px; }
/* Empty-State: alle Vorlagen-Karten in EINER Reihe (5 Stueck), auf Mobil 2 Spalten */
.note-empty .note-tpl-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 900px; }
@media (max-width: 800px) { .note-empty .note-tpl-grid { grid-template-columns: repeat(2, 1fr); max-width: 380px; } }
.note-tpl-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.note-tpl-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(42, 31, 24, 0.08); transform: translateY(-1px); }
.note-tpl-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--primary);
}
.note-tpl-ico .ico-svg { width: 20px; height: 20px; }
.note-tpl-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.note-tpl-tag {
  position: absolute; top: 8px; right: 8px;
  font-size: 9px; padding: 1px 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-deep);
}

/* Editor */
.note-edit-wrap { display: flex; flex-direction: column; gap: 12px; }
.note-title-input {
  width: 100%; background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 11px 14px; font-family: 'Source Serif 4', Georgia, serif;
  font-size: 18px; font-weight: 600; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.note-title-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.note-title-input::placeholder { color: var(--ink-faint); font-weight: 400; }
/* Titel + Notiz-Datum nebeneinander */
.note-title-row { display: flex; gap: 10px; align-items: stretch; }
.note-title-row .note-title-input { flex: 1; min-width: 0; }
.note-date-field { flex: 0 0 156px; display: flex; }
.note-date-field .app-date { width: 100%; }
.note-date-ro { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink-soft); font-size: 14px; white-space: nowrap; }
.note-date-ro .ico-svg { width: 15px; height: 15px; flex: none; }
@media (max-width: 560px) { .note-title-row { flex-direction: column; } .note-date-field { flex: none; } }
.note-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2);
}
.note-tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 30px; border: none; border-radius: 6px;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.note-tool:hover { background: var(--surface); color: var(--ink); }
.note-tool .ico-svg { width: 16px; height: 16px; }
.note-tool-sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 4px; }
.note-editor {
  min-height: 240px; max-height: 48vh; overflow-y: auto; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px; line-height: 1.6; color: var(--ink);
}
.note-editor:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.note-editor.readonly { background: var(--bg); color: var(--ink-soft); cursor: default; }
.note-editor h2 { font-family: 'Source Serif 4', Georgia, serif; font-size: 18px; margin: 14px 0 6px; color: var(--ink); }
.note-editor h3 { font-family: 'Source Serif 4', Georgia, serif; font-size: 15px; font-weight: 600; margin: 12px 0 4px; color: var(--ink); }
.note-editor p { margin: 0 0 8px; }
.note-editor ul, .note-editor ol { margin: 0 0 8px; padding-left: 22px; }
.note-editor a { color: var(--primary); text-decoration: underline; }
/* Checkliste (Editor + Karten-Vorschau) */
.note-editor ul.note-check, .note-card-snippet ul.note-check { list-style: none; padding-left: 0; margin: 0 0 8px; }
.note-check li { position: relative; padding-left: 28px; margin: 0 0 4px; min-height: 20px; line-height: 1.5; }
.note-check li::before {
  content: ''; position: absolute; left: 0; top: 2px; width: 16px; height: 16px;
  border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface);
  cursor: pointer; box-sizing: border-box;
}
.note-check li[data-done="true"]::before {
  background: var(--ok); border-color: var(--ok);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 12px; background-position: center; background-repeat: no-repeat;
}
.note-check li[data-done="true"] { color: var(--ink-faint); text-decoration: line-through; }
.note-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.note-meta-ro { padding: 10px 0; color: var(--ink-soft); font-size: 14px; }
@media (max-width: 640px) {
  .note-meta-grid { grid-template-columns: 1fr; }
  .note-grid { padding: 12px; gap: 12px; }
  /* Editor-Werkzeugleiste: groessere Touch-Ziele auf dem Smartphone. */
  .note-toolbar { gap: 4px; }
  .note-tool { width: 40px; height: 38px; }
  .note-tool .ico-svg { width: 18px; height: 18px; }
  /* Editorflaeche etwas niedriger, damit der Aktions-Footer bei offener
     Tastatur ohne langes Scrollen erreichbar bleibt. */
  .note-editor { min-height: 180px; max-height: 38vh; }
}
/* ============================================================
   simply. — KI-Assistent (Chat-Seite)
   Token-basiert, funktioniert in Light + Dark.
   ============================================================ */
.sim-wrap { display: flex; gap: 16px; height: calc(100dvh - var(--topbar-h) - 48px); min-height: 420px; }
.sim-rail { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.sim-new { justify-content: center; width: 100%; }
.sim-chatlist { flex: 1; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 0; }
.sim-group { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); padding: 10px 8px 4px; }
.sim-chat-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 8px; cursor: pointer; position: relative; }
.sim-chat-item:hover { background: var(--surface-2); }
.sim-chat-item.active { background: var(--primary-soft); }
.sim-chat-pin { flex-shrink: 0; color: var(--accent); display: inline-flex; }
.sim-chat-pin .ico-svg { width: 13px; height: 13px; }
/* Team-Freigabe: Symbol am Listeneintrag + aktiver Zustand des Teilen-Knopfs */
.sim-chat-sharedico { flex-shrink: 0; color: var(--primary); display: inline-flex; }
.sim-chat-sharedico .ico-svg { width: 13px; height: 13px; }
.sim-chat-actions .icon-btn.sim-shared-on { color: var(--primary); background: var(--primary-soft); }
.sim-chat-main { flex: 1; min-width: 0; }
.sim-chat-title { display: block; font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-chat-item.active .sim-chat-title { color: var(--primary); }
.sim-chat-meta { display: block; font-size: 10.5px; color: var(--ink-faint); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-chat-author { color: var(--primary); font-weight: 500; }
/* Aktionen als schwebende Werkzeugleiste rechts über dem Eintrag — quetscht
   den Titel nicht zusammen und wirkt wie EIN aufgeräumtes Bedienfeld. */
.sim-chat-actions { display: none; gap: 2px; flex-shrink: 0; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; box-shadow: 0 4px 12px rgba(42, 31, 24, .12); z-index: 2; }
.sim-chat-item:hover .sim-chat-actions { display: inline-flex; }
.sim-chat-actions .icon-btn { width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); border-radius: 6px; }
.sim-chat-actions .icon-btn:hover { color: var(--primary); background: var(--surface-2); }
/* Arbeits-/Fertig-Status rechts am Listeneintrag: pulsierende Punkte solange
   simply. dort arbeitet, grüner Haken bis der Chat gelesen wurde. Beim Hover
   weichen sie den Aktions-Knöpfen. */
.sim-chat-state { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; }
.sim-chat-state.working span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: simPulse 1.2s infinite; }
.sim-chat-state.working span:nth-child(2) { animation-delay: .2s; }
.sim-chat-state.working span:nth-child(3) { animation-delay: .4s; }
.sim-chat-state.done { color: var(--ok); }
.sim-chat-state.done .ico-svg { width: 14px; height: 14px; }
.sim-chat-item:hover .sim-chat-state { display: none; }
.sim-chat-actions .ico-svg { width: 14px; height: 14px; }
.sim-empty-list { font-size: 12px; color: var(--ink-faint); padding: 10px; margin: 0; }

.sim-chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.sim-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.sim-head-t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sim-head-t strong { font-family: 'Source Serif 4', serif; font-weight: 500; font-size: 16px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-readonly { margin-left: auto; font-size: 11px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.sim-ava { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--accent-deep); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sim-ava .ico-svg { width: 15px; height: 15px; }
.sim-rail-toggle { display: none; }

.sim-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; background: var(--bg); min-height: 0; }
.sim-msg { display: flex; gap: 10px; max-width: 86%; }
.sim-msg.user { align-self: flex-end; }
.sim-msg.ai { align-self: flex-start; }
.sim-bubble { border-radius: 12px; padding: 10px 14px; font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; min-width: 0; }
.sim-msg.user .sim-bubble { background: var(--surface-2); color: var(--ink); border-bottom-right-radius: 4px; }
.sim-msg.ai .sim-bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; color: var(--ink-soft); }
.sim-bubble p { margin: 0 0 8px; }
.sim-bubble p:last-child { margin-bottom: 0; }
.sim-bubble .sim-ul { margin: 4px 0 8px; padding-left: 18px; }
.sim-bubble .sim-ul li { margin: 2px 0; }
.sim-bubble .sim-h { display: block; font-weight: 600; color: var(--ink); margin: 8px 0 4px; }
.sim-bubble strong { color: var(--ink); }
.sim-bubble code { font-family: 'JetBrains Mono', monospace; font-size: 12px; background: var(--surface-2); border-radius: 4px; padding: 1px 4px; }
.sim-code { font-family: 'JetBrains Mono', monospace; font-size: 12px; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 6px 0; white-space: pre-wrap; }
.sim-att { display: inline-flex; align-items: center; gap: 6px; margin: 8px 6px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 12px; color: var(--ink); cursor: pointer; max-width: 100%; }
.sim-att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-att .ico-svg { width: 13px; height: 13px; color: var(--primary); flex-shrink: 0; }
/* Ergebnis-Karte: von simply. ERSTELLTE Datei — das Arbeitsergebnis, deutlich
   hervorgehoben (Amber-Kante, Icon-Kachel, Vorschau per Klick, Download-Knopf) */
.sim-file-card { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--accent); border-left: 4px solid var(--accent); border-radius: 10px; cursor: pointer; max-width: 480px; box-shadow: 0 2px 8px rgba(42, 31, 24, .06); }
.sim-file-card:hover { background: var(--accent-soft); }
.sim-file-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: var(--accent-deep); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sim-file-ico .ico-svg { width: 19px; height: 19px; }
.sim-file-info { min-width: 0; flex: 1; }
.sim-file-name { display: block; font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-file-meta { display: block; font-size: 11px; color: var(--ink-faint); margin-top: 2px; }
.sim-file-acts { flex-shrink: 0; display: inline-flex; gap: 6px; }
.sim-file-acts .btn { padding: 6px 11px; font-size: 12px; }
/* Tabellen-/Text-Vorschau im Anhang-Overlay */
.att-sheet-scroll { overflow: auto; padding: 14px 18px; background: var(--surface); max-height: 100%; }
.att-sheet-name { font-size: 13px; margin: 12px 0 6px; color: var(--ink); font-family: 'Source Serif 4', serif; font-weight: 500; }
.att-sheet-scroll table { border-collapse: collapse; font-size: 12px; }
.att-sheet-scroll td { border: 1px solid var(--line); padding: 3px 8px; white-space: nowrap; color: var(--ink-soft); }
.att-preview-pre { padding: 16px 20px; font-family: 'JetBrains Mono', monospace; font-size: 12px; white-space: pre-wrap; overflow: auto; color: var(--ink-soft); margin: 0; }

.sim-typing { display: inline-flex; gap: 4px; align-items: center; }
.sim-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); animation: simPulse 1.2s infinite; }
.sim-typing span:nth-child(2) { animation-delay: .2s; }
.sim-typing span:nth-child(3) { animation-delay: .4s; }
/* Streaming: blinkender Cursor am Ende der live wachsenden Antwort */
.sim-streaming::after { content: ''; display: inline-block; width: 7px; height: 14px; margin-left: 2px; vertical-align: text-bottom; background: var(--primary); border-radius: 2px; animation: simPulse 1s infinite; }
/* Unbeantwortete Nachricht: Hinweis + "Erneut versuchen" */
.sim-retry { display: flex; align-items: center; gap: 10px; align-self: flex-start; font-size: 12px; color: var(--ink-faint); }
.sim-retry .btn { padding: 5px 12px; font-size: 12px; }
/* Suchfeld über der Unterhaltungs-Leiste */
.sim-search { display: flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.sim-search > .ico-svg { width: 14px; height: 14px; color: var(--ink-faint); flex-shrink: 0; }
.sim-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12.5px; padding: 0; }
.sim-search input::placeholder { color: var(--ink-faint); }
.sim-search .icon-btn { width: 22px; height: 22px; padding: 2px; flex-shrink: 0; }
.sim-search .icon-btn .ico-svg { width: 12px; height: 12px; }
.sim-search:focus-within { border-color: var(--accent); }
/* Tastatur-Bedienung: sichtbarer Fokus, Aktionen auch per Fokus erreichbar */
.sim-chat-item:focus-visible, .sim-proj-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sim-chat-item:focus-within .sim-chat-actions, .sim-proj-head:focus-within .sim-proj-actions { display: inline-flex; }
/* Markdown-Tabellen in Antworten (BWA-Vergleiche u. Ä.) */
.sim-tblwrap { overflow-x: auto; margin: 8px 0; }
.sim-tbl { border-collapse: collapse; font-size: 12.5px; }
.sim-tbl th { background: var(--primary); color: var(--bg); text-align: left; padding: 6px 10px; font-weight: 600; white-space: nowrap; }
.sim-tbl td { border: 1px solid var(--line); padding: 5px 10px; color: var(--ink-soft); }
.sim-tbl tr:nth-child(even) td { background: var(--surface-2); }
.sim-bubble a { color: var(--primary); text-decoration: underline; }
/* Fußnoten-Marker + Quellenbereich unter fachlichen Antworten */
.sim-fn { color: var(--primary); font-weight: 700; font-size: .72em; }
.sim-sources { margin-top: 4px; padding: 10px 14px; background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 8px; }
.sim-sources-t { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); display: block; margin-bottom: 6px; }
.sim-sources-list { list-style: none; margin: 0; padding: 0; }
.sim-sources-list li { font-size: 12px; color: var(--ink-soft); margin: 3px 0; line-height: 1.5; overflow-wrap: anywhere; }
.sim-fn-n { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--primary); font-weight: 700; margin-right: 7px; }
/* Ungelesen-Zähler am Nav-Eintrag "simply." (Sidebar + Bottom-Bar) */
/* line-height = Kreis-Höhe zentriert die Ziffer zuverlässig (line-height:1
   ließ sie bei 10px-Inter optisch nach oben rutschen). */
.nav-unread { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px; margin-left: 6px; border-radius: 999px; background: var(--primary); color: var(--bg); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; box-sizing: border-box; }
.bottombar-btn { position: relative; }
.bottombar-btn .nav-unread { position: absolute; top: 3px; right: 12px; margin-left: 0; }
/* Mobile: Backdrop hinter der aufgeklappten Unterhaltungs-Leiste */
.sim-rail-backdrop { display: none; }
/* Angehängte Dateien im Composer: deutliche Upload-Karten statt Mini-Chips */
.sim-files { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.sim-upload-card { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--accent); border-left: 4px solid var(--accent); border-radius: 10px; min-width: 240px; max-width: 360px; }
.sim-upload-card .sim-file-ico { width: 34px; height: 34px; border-radius: 8px; }
.sim-upload-card .sim-file-ico .ico-svg { width: 16px; height: 16px; }
.sim-upload-rm { flex-shrink: 0; width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); border-radius: 6px; }
.sim-upload-rm:hover { color: var(--danger); background: var(--surface); }
/* Datei-Drop aus dem Finder: der ganze Chat-Bereich ist Ablagefläche */
.sim-chat { position: relative; }
.sim-chat.sim-filedrop::after {
  content: 'Dateien hier ablegen — PDF, Excel, Word, CSV oder Bild';
  position: absolute; inset: 8px; z-index: 5; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--accent); border-radius: 12px;
  /* Hintergrund weichzeichnen: der Chat tritt zurück, die Ablagefläche
     ist unübersehbar (Cream-Schleier + Blur; Safari braucht -webkit-). */
  background: rgba(250, 245, 236, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-size: 15px; font-weight: 600; color: var(--primary);
}
@keyframes simPulse { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.sim-welcome { margin: auto; text-align: center; max-width: 480px; padding: 20px; }
.sim-welcome .sim-ava { width: 46px; height: 46px; margin: 0 auto 12px; }
.sim-welcome .sim-ava .ico-svg { width: 22px; height: 22px; }
.sim-welcome h2 { font-family: 'Source Serif 4', serif; font-weight: 500; font-size: 22px; color: var(--ink); margin: 0 0 6px; }
.sim-welcome p { font-size: 13px; color: var(--ink-soft); margin: 0 0 14px; }
.sim-suggest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sim-suggest button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; cursor: pointer; }
.sim-suggest button:hover { border-color: var(--primary); color: var(--primary); }

.sim-composer { border-top: 1px solid var(--line); padding: 12px 16px; background: var(--surface); flex-shrink: 0; }
.sim-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.sim-file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 8px; padding: 4px 8px; font-size: 12px; color: var(--ink); }
.sim-file-chip .ico-svg { width: 12px; height: 12px; }
.sim-file-chip button { border: 0; background: transparent; cursor: pointer; color: var(--ink-faint); display: inline-flex; padding: 0; }
.sim-file-chip button:hover { color: var(--danger); }
.sim-inputrow { display: flex; align-items: center; gap: 8px; }
.sim-inputrow textarea { flex: 1; resize: none; max-height: 160px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; background: var(--bg); color: var(--ink); font-family: inherit; line-height: 1.45; overflow-y: hidden; }
.sim-inputrow textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sim-send { padding: 9px 12px; flex-shrink: 0; }
.sim-send .ico-svg { width: 15px; height: 15px; }
/* 12px + ink-soft statt 10.5px/faint: Der Vier-Augen-Hinweis ist wichtig und
   war vorher der am schwersten lesbare Text der Seite (Kontrast-Audit). */
.sim-hint { font-size: 12px; color: var(--ink-soft); margin-top: 8px; text-align: center; }
/* "Datei wird erstellt"-Karte im Stream: Spinner + Wanderpunkte + sanfter Glow */
.sim-filebuild { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; margin: 6px 0; border: 1px dashed rgba(140,45,20,.45); border-radius: 10px; background: var(--surface-2); color: var(--ink-soft); font-size: 13px; font-weight: 600; animation: simFbGlow 1.6s ease-in-out infinite; }
.sim-fb-spin { width: 15px; height: 15px; border: 2px solid rgba(140,45,20,.2); border-top-color: var(--primary); border-radius: 50%; animation: simFbSpin .7s linear infinite; flex: 0 0 auto; }
.sim-fb-dots::after { display: inline-block; width: 16px; text-align: left; content: ''; animation: simFbDots 1.2s steps(1, end) infinite; }
@keyframes simFbSpin { to { transform: rotate(360deg); } }
@keyframes simFbDots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@keyframes simFbGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(224,139,44,0); } 50% { box-shadow: 0 0 0 5px rgba(224,139,44,.14); } }
/* Fußnoten-Marker mit hinterlegter Quelle: Hover zeigt die URL (title), Klick öffnet sie. */
a.sim-fn-link { text-decoration: none; }
a.sim-fn-link:hover .sim-fn { text-decoration: underline; }

/* Feedback-Daumen unter simply.-Antworten (Icon + Text) */
.sim-bubble-col { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.sim-fb { display: flex; gap: 4px; margin-top: 4px; }
.sim-fb-btn { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--ink-faint); font-size: 11.5px; font-weight: 500; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.sim-fb-btn:hover { color: var(--ink); background: var(--surface-2); }
.sim-fb-btn.active { color: var(--primary); background: var(--primary-soft); }
.sim-fb-btn .ico-svg { width: 13px; height: 13px; }

/* Aktiv-Zeile im Wissensbasis-Editor */
.sim-kb-active-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.sim-kb-active-row strong { font-size: 13px; color: var(--ink); }
/* Der Schalter ist ein <label> — das globale label-margin (6px unten) würde
   ihn aus der Mittellinie schieben. Hier neutralisieren, damit Schalter,
   Stift und Papierkorb exakt auf einer Linie mittig sitzen. */
.sim-kb-row .switch, .sim-kb-active-row .switch { margin: 0; }
.sim-kb-row .icon-btn { flex-shrink: 0; }
.sim-fb-ico { display: inline-flex; }
.sim-fb-ico.up .ico-svg { width: 13px; height: 13px; color: var(--ok); }
.sim-fb-ico.down .ico-svg { width: 13px; height: 13px; color: var(--danger); }

/* Wissensbasis-Verwaltung (Modal) */
.sim-kb-btn { width: 100%; justify-content: center; }
/* Bewusst KEINE eigene max-height/Scrollbox — der Modal-Body scrollt bereits.
   Eine innere Scrollbox schnitt die letzte Zeile am Rand ab (verschachteltes
   Scrollen). */
.sim-kb-list { display: flex; flex-direction: column; gap: 6px; }
.sim-kb-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.sim-kb-row.inactive { opacity: .55; }
.sim-kb-info { flex: 1; min-width: 0; }
.sim-kb-info strong { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); }
.sim-kb-meta { display: block; font-size: 11px; color: var(--ink-faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Projekte (Chat-Ordner) in der Leiste */
.sim-rail-top { display: flex; gap: 8px; }
.sim-rail-top .sim-new { flex: 1; }
.sim-newproj { flex-shrink: 0; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; }
.sim-newproj .ico-svg { width: 16px; height: 16px; }
.sim-proj-head { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.sim-proj-head:hover { background: var(--surface-2); }
.sim-proj-head > .ico-svg { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; }
.sim-proj-caret { display: inline-flex; flex-shrink: 0; color: var(--ink-faint); transition: transform .15s ease; }
.sim-proj-caret .ico-svg { width: 13px; height: 13px; }
.sim-proj.collapsed .sim-proj-caret { transform: rotate(-90deg); }
.sim-proj-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-proj-count { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--ink-faint); flex-shrink: 0; }
/* Projekt-Aktionen: gleiche schwebende Werkzeugleiste wie bei den Chats */
.sim-proj-head { position: relative; }
.sim-proj-actions { display: none; gap: 2px; flex-shrink: 0; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; box-shadow: 0 4px 12px rgba(42, 31, 24, .12); z-index: 2; }
.sim-proj-head:hover .sim-proj-actions { display: inline-flex; }
.sim-proj-head:hover .sim-proj-count { display: none; }
.sim-proj-actions .icon-btn { width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); border-radius: 6px; }
.sim-proj-actions .icon-btn:hover { color: var(--primary); background: var(--surface-2); }
.sim-proj-actions .ico-svg { width: 14px; height: 14px; }
.sim-proj-chats { margin: 0 0 4px 14px; padding-left: 10px; border-left: 1px solid var(--line); }
.sim-proj.collapsed .sim-proj-chats { display: none; }
.sim-proj-badge .ico-svg { width: 11px; height: 11px; }

/* Drag & Drop: Chats in Projekte ziehen */
.sim-chat-item[draggable="true"] { cursor: grab; }
.sim-chat-item.dragging { opacity: .45; }
.sim-proj.drag-over > .sim-proj-head { background: var(--accent-soft); }
.sim-proj.drag-over { outline: 1.5px dashed var(--accent); outline-offset: 2px; border-radius: 8px; }
.sim-drop.drag-over { outline: 1.5px dashed var(--accent); outline-offset: 2px; border-radius: 8px; background: var(--accent-soft); }

/* simply.-Schriftzug in der Sidebar (Serif wie das Branding) */
.nav-item[data-route="simply"] > span:last-child { font-family: 'Source Serif 4', serif; font-size: 15px; }

@media (max-width: 768px) {
  .sim-wrap { height: calc(100dvh - var(--topbar-h) - 130px); position: relative; }
  .sim-rail { position: absolute; top: 0; bottom: 0; left: 0; width: min(85%, 300px); z-index: 40; background: var(--bg); padding: 8px; border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); display: none; }
  .sim-rail.open { display: flex; }
  .sim-rail-backdrop { display: block; position: absolute; inset: 0; z-index: 35; background: rgba(42, 31, 24, .28); border-radius: 12px; }
  .sim-rail-toggle { display: inline-flex; }
  /* Kein Hover auf Touch: Aktionen dauerhaft, aber als schlichte Inline-Reihe
     (die schwebende Leiste würde den Titel permanent verdecken) */
  .sim-chat-actions, .sim-proj-actions { display: inline-flex; position: static; transform: none; box-shadow: none; border: 0; background: transparent; padding: 0; }
  .sim-proj-head .sim-proj-count { display: none; }
  .sim-msg { max-width: 95%; }
}
