/*
  ============================================================================
  THEME KOMMANDOZENTRALE — Testdesign C, 2026-07-13. Kopie-Theme, Original ist theme.css.
  ============================================================================
  Designsprache "Kommandozentrale" (Raycast/Linear-Niveau):
    - Dark (Hauptdesign): warmes Violett-Anthrazit (#14121a-Basis), 1px-Inset-
      Lichtkante auf allen Flaechen, tiefe weiche Schatten.
    - Light: kuehles Hellgrau-Weiss mit violett-grauen Tints, mehrschichtige
      reale Schatten, gleiche Inset-Kante als dunkle Hairline.
    - Interaktion: Elektro-Kobalt (#4f7cff dark / #3b63e8 light) ersetzt das
      Feedgy-Blau #232F84 als --brand. Feedgy-Gelb #FDB913 bleibt --accent,
      nur fuer CTAs/Highlights (FAB, Today-Marker, Edit-Zonen).
    - Fokus-Ringe: 2px Kobalt, deutlich. Selektion: Kobalt mit niedriger
      Deckkraft (rgba(79,124,255,.12) dark / rgba(59,99,232,.10) light).
    - Fonts: UI/Headings 'Inter' (400/500/600), Mono 'JetBrains Mono'
      (die Fonts laedt die HTML-Seite, hier nur font-family-Werte).

  STRUKTUR (identisch zu theme.css):
    1. Brand-Konstanten
    2. Light-Theme Tokens   (:root)
    3. Dark-Theme Tokens    (html.dark)
    4. Komponenten-Styles   (.surface, .btn-*, .card, ...)
    5. Tailwind-Class-Overrides (text-ink-*, bg-cyan-*, ...)
  ============================================================================
*/

/* === 1. DESIGN-TOKENS ==============================================
   EINE Wahrheit fuer Farbe, Radius, Schatten, Typo (Umbau 06.09.2026).
   Regeln: EIN Akzent (Kobalt), 10-stufige Grauskala, Gelb nur Warnung,
   keine Verlaeufe auf Flaechen, Schatten nur sm/md, Radius 4/6/10.
   ================================================================== */
:root {
  /* Akzent — der einzige Buntton fuer Interaktion */
  --brand:       #2f5bd7;
  --brand-dark:  #2549b0;
  --brand-light: #5b82ff;
  /* Semantik */
  --success:      #1a7a52;
  --success-soft: #e7f4ed;
  --warning:      #8a6410;   /* Gelb ausschliesslich fuer Warnung */
  --warning-soft: #fdf3dd;
  --danger:       #b03432;
  --danger-soft:  #fbeaea;
  /* Rueckwaertskompatibel: --accent war Gelb, ist jetzt die Warnfarbe */
  --accent:      #8a6410;
  --accent-dark: #6f5009;

  /* Radius */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  /* Typografie */
  --font-ui:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --track-tight: -0.011em;
  --track-tighter: -0.02em;

  /* Bewegung */
  --dur-fast: 90ms;
  --dur-base: 140ms;
}

/* === 2. LIGHT-THEME (10-stufige Grauskala) ======================== */
:root {
  --g-0:   #ffffff;
  --g-25:  #fbfbfc;
  --g-50:  #f6f7f9;
  --g-100: #edeff3;
  --g-200: #e0e3e9;
  --g-300: #c8ccd5;
  --g-400: #9ba2ae;
  --g-500: #666d7b;
  --g-600: #4f5663;
  --g-700: #3d434e;
  --g-800: #272c34;
  --g-900: #15181d;

  --bg:             #f6f7f9;
  --bg-soft:        #edeff3;
  --bg-softer:      #e0e3e9;
  --surface:        #ffffff;
  --surface-2:      #f6f7f9;

  --border:         #e0e3e9;
  --border-soft:    #edeff3;
  --border-strong:  #c8ccd5;

  --ink:            #15181d;
  --ink-2:          #272c34;
  --ink-3:          #3d434e;
  --ink-muted:      #4f5663;
  --ink-subtle:     #666d7b;

  /* Nur zwei Schattenstufen */
  --shadow-sm:     0 1px 2px rgba(21,24,29,0.06);
  --shadow-md:     0 4px 12px -4px rgba(21,24,29,0.14);
  --shadow-card:   0 1px 2px rgba(21,24,29,0.06);
  --shadow-hover:  0 1px 2px rgba(21,24,29,0.06);
  --shadow-modal:  0 4px 12px -4px rgba(21,24,29,0.14);

  --selection-bg:    rgba(47,91,215,0.10);
  --focus-ring:      0 0 0 2px #ffffff, 0 0 0 4px rgba(47,91,215,0.65);

  --table-header-bg: #f6f7f9;
  --input-bg:        #ffffff;
  --input-border:    #c8ccd5;
  --modal-backdrop:  rgba(21,24,29,0.32);
  --scrollbar-thumb: #c8ccd5;
  --scrollbar-track: #edeff3;
}

/* === 3. DARK-THEME ================================================ */
html.dark {
  --brand:       #5b82ff;
  --brand-dark:  #4169e6;
  --brand-light: #86a3ff;

  --success:      #52c48c;
  --success-soft: rgba(82,196,140,0.14);
  --warning:      #e0b455;
  --warning-soft: rgba(224,180,85,0.14);
  --danger:       #ef8a84;
  --danger-soft:  rgba(239,138,132,0.14);
  --accent:       #e0b455;
  --accent-dark:  #c99b3e;

  --g-0:   #0d0f13;
  --g-25:  #101318;
  --g-50:  #14171d;
  --g-100: #191d24;
  --g-200: #222730;
  --g-300: #2e343f;
  --g-400: #454c58;
  --g-500: #8d959f;
  --g-600: #a0a7b2;
  --g-700: #c3c8d0;
  --g-800: #e2e5ea;
  --g-900: #f2f4f7;

  --bg:             #0d0f13;
  --bg-soft:        #14171d;
  --bg-softer:      #222730;
  --surface:        #101318;
  --surface-2:      #191d24;

  --border:         #2e343f;
  --border-soft:    #222730;
  --border-strong:  #454c58;

  --ink:            #f2f4f7;
  --ink-2:          #e2e5ea;
  --ink-3:          #c3c8d0;
  --ink-muted:      #a0a7b2;
  --ink-subtle:     #8d959f;

  --shadow-sm:     0 1px 2px rgba(0,0,0,0.5);
  --shadow-md:     0 8px 24px -12px rgba(0,0,0,0.7);
  --shadow-card:   0 1px 2px rgba(0,0,0,0.5);
  --shadow-hover:  0 1px 2px rgba(0,0,0,0.5);
  --shadow-modal:  0 8px 24px -12px rgba(0,0,0,0.7);

  --selection-bg:    rgba(91,130,255,0.16);
  --focus-ring:      0 0 0 2px #101318, 0 0 0 4px rgba(91,130,255,0.7);

  --table-header-bg: #14171d;
  --input-bg:        #14171d;
  --input-border:    #2e343f;
  --modal-backdrop:  rgba(0,0,0,0.55);
  --scrollbar-thumb: #2e343f;
  --scrollbar-track: #14171d;
}

/* Typografie-Grundlage: Inter 400/500/600, Headings mit negativem Tracking */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-ui); font-weight: 600; letter-spacing: var(--track-tight); }
h1, .text-2xl, .text-xl { letter-spacing: var(--track-tighter); }
.font-bold { font-weight: 600 !important; }   /* keine 700er-Schwere im Produkt-Tier */
.font-mono, .tabular-nums, td.num, th.num { font-variant-numeric: tabular-nums; }

/* Sichtbarer Fokusring (A5) */
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
/* Fokusring ueber Nachbarn heben — aber NIE bei Dialogen/Panels: die sind position:fixed, und 'position:relative;
   z-index:2' warf das fokussierte Anlagen-Popup unter die Liste (Emir 06.09.: Pfeil blendet aus, Mausklick zeigt wieder). */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible:not(.detail-panel):not(.modal-content):not([role=dialog]):not(.menu-panel) { position: relative; z-index: 2; }

/* Text-Selektion konsequent in Kobalt */
::selection { background: var(--selection-bg); }

/* Inline-Marker-Labels (Leistung + Jahr) bei hohem Zoom */
.leaflet-tooltip.map-marker-label {
  background: rgba(255,255,255,0.94);
  color: #3b63e8;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  border: none;
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 rgba(20,18,26,0.05), 0 1px 3px rgba(20,18,26,0.14);
  white-space: nowrap;
  letter-spacing: 0.1px;
}
.leaflet-tooltip.map-marker-label::before { display: none; }
html.dark .leaflet-tooltip.map-marker-label {
  background: rgba(30,27,40,0.94);
  color: #7a9bff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.045), 0 1px 3px rgba(0,0,0,0.5);
}

/* Leaflet interne Panes nutzen z-index 200-700. Container auf z:1 packen damit Modals
   (die ausserhalb z:40-50 liegen) zuverlaessig DARUEBER liegen. */
.leaflet-container { z-index: 1 !important; }
/* Modale (Anlage-Detail, Mail, Call, Kunde etc.) muessen IMMER ueber Karten-Layer liegen */
.modal-backdrop { z-index: 9999 !important; }

/* === MAP: vollbreit, floating filter, leaflet-fullscreen === */
/* --tb wird via JS aus tatsaechlicher Topbar/Nav-Hoehe gesetzt -> kein Bottom-Overflow mehr */
.map-fullbleed {
  position: relative;
  width: calc(100vw - var(--sbw, 0px));
  margin-left: calc((100% - 100vw + var(--sbw, 0px)) / 2);
  margin-bottom: calc(-1 * var(--main-pad-b, 24px));  /* kompensiert main py-bottom */
  box-sizing: border-box;
  max-width: calc(100vw - var(--sbw, 0px));
  height: calc(100vh - var(--tb, 160px));
  padding: 0;
  overflow: hidden;
}
.leaflet-fullscreen {
  width: 100%;
  height: 100%;
  min-height: 500px;
}
.map-filter-floating {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: rgba(250,250,250,0.55);
  border: 1px solid rgba(20,18,26,0.08);
  border-radius: var(--r-lg);
  padding: 8px 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 8px 24px -12px rgba(20,18,26,0.16);
  opacity: 0.6;
  transition: opacity 200ms ease, background 200ms ease;
  max-width: calc(100% - 80px);
}
.map-filter-floating:hover { opacity: 1; background: rgba(255,255,255,0.94); }
html.dark .map-filter-floating {
  background: rgba(25,23,34,0.55);
  border-color: rgba(255,255,255,0.07);
}
html.dark .map-filter-floating:hover { background: rgba(25,23,34,0.94); }

/* === MOBILE (< 768px): Tap-Targets, kein overflow, lesbare Schrift === */
@media (max-width: 767px) {
  main { padding: 8px 6px !important; }
  /* Topbar kompakter */
  header.surface .h-12 { height: 44px; }
  /* Tabs scrollbar horizontal aber gewohnt swipe-bar */
  nav .tab-pill, .tab-pill { padding: 6px 10px !important; font-size: 12px !important; }
  /* Modals: Vollbild auf Mobile */
  .modal-content { max-width: 100vw !important; width: 100vw !important; margin: 0 !important; border-radius: 0 !important; min-height: 100vh; }
  .modal-backdrop { padding: 0 !important; }
  /* Tabellen Mobile: horizontal scroll im Container, Zellen kompakter */
  table.data-table { font-size: 12px; }
  table.data-table td, table.data-table th { padding: 6px 8px !important; }
  /* Cards mit weniger Padding */
  .card { padding: 12px !important; }
  .surface { padding: 12px !important; }
  /* Kanban-Spalten Mobile: schon Fallback per 768px-Media; siehe unten */
  /* Calendar FAB unter Toolbar nicht verstecken */
  .calendar-fab { bottom: 70px !important; }
  /* Emir 06.09.: auf Mobil nur EINE Filterleiste - die oberhalb der Karte. Das schwebende
     Overlay verdeckte die Karte; Min-Score und Zaehler stehen mobil in der oberen Leiste. */
  .map-filter-floating { display: none !important; }
  /* Form-Felder Mobile: voll lesbar */
  .input, input.input, select.input, textarea.input { font-size: 16px !important; }  /* 16px verhindert iOS-Auto-Zoom */
  /* Dropdowns + Modal-Footer scrollen mit */
  footer { padding: 12px 14px !important; flex-wrap: wrap; gap: 8px !important; }
  /* Btn-Mindestgroesse fuer Tap */
  button, .btn-primary, .btn-secondary, .btn-ghost { min-height: 38px; }
}

/* === Settings Quick-Nav-Pills === */
.settings-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  border-radius: var(--r-md);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.settings-nav-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 124, 255, 0.35);
}
/* Highlight-Flash beim Scroll-To */
.section-highlight {
  animation: section-flash 1.5s ease-out;
}
@keyframes section-flash {
  0% { box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.5); }
  100% { box-shadow: 0 0 0 0 rgba(79, 124, 255, 0); }
}

/* === GLOBAL: volle Breite, hidden scrollbars (Funktion bleibt), kein Bottom-Overflow === */
html, body {
  overflow-x: hidden !important;
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge */
}
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }  /* Chrome/Safari */

/* Auch innerhalb der App: alle .scroll-area / overflow-Container ohne sichtbare Scrollbar */
.scroll-area, [class*="overflow-"], main, .surface {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scroll-area::-webkit-scrollbar,
[class*="overflow-"]::-webkit-scrollbar,
main::-webkit-scrollbar { display: none; }

/* === KANBAN: vollbreit, hidden scrollbar, moderne Pipeline === */
/* Full-Bleed-Pattern: --sbw wird per JS gesetzt (siehe initFullBleedScrollbar),
   damit 100vw NICHT um die vertikale Scrollbar überschiesst. */
.kanban-fullbleed {
  position: relative;
  width: calc(100vw - var(--sbw, 0px));
  margin-left: calc((100% - 100vw + var(--sbw, 0px)) / 2);
  padding: 8px 0 24px 0;
  box-sizing: border-box;
  max-width: calc(100vw - var(--sbw, 0px));
}
.kanban-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 8px 24px 16px 24px;
}
.kanban-filter-title { display: flex; flex-direction: column; gap: 2px; }
.kanban-headline {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--ink);
  margin: 0;
}
.kanban-sub { font-size: 11px; color: var(--ink-muted); }
.kanban-strip {
  overflow-x: hidden;       /* KEIN horizontaler Overflow - alle Spalten teilen sich die Breite */
  overflow-y: hidden;
  padding: 0 12px 16px 12px;
}
.kanban-row {
  display: flex;
  gap: 8px;
  width: 100%;
  align-items: stretch;
}
.kanban-strip .kanban-col {
  flex: 1 1 0;             /* gleiche Anteile am verfuegbaren Platz */
  min-width: 0;            /* erlaubt Flex-Shrink unter Content-Breite */
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.kanban-strip .kanban-col.drag-over {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(79,124,255,0.30), 0 8px 20px rgba(59,99,232,0.18);
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(127,127,140,0.05);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  min-height: 38px;
}
.kanban-col-header .badge {
  font-size: 11px;
  padding: 2px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.kanban-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 200px;
}
.kanban-strip .kanban-card {
  padding: 8px 10px;
  font-size: 12px;
}
.kanban-strip .kanban-card .text-sm { font-size: 12px; line-height: 1.3; }
.kanban-strip .kanban-card .text-xs { font-size: 11px; }
/* Hidden scrollbar — funktioniert weiter, sieht aber sauber aus */
.no-scrollbar {
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE/Edge */
}
.no-scrollbar::-webkit-scrollbar { display: none; }  /* Chrome/Safari/Edge */

/* Zusätzliche Badge-Farben fuer 9-Status-Pipeline — ruhige Tints, keine Neons */
/* Statusfarben zentral weiter unten (EINE Wahrheit) */

/* Auf sehr schmalen Screens (< 1100px) wird's mit 9 Spalten zu eng -> dann doch horizontaler Scroll als Fallback */
@media (max-width: 1100px) {
  .kanban-strip { overflow-x: auto; }
  .kanban-row { width: max-content; min-width: 100%; }
  .kanban-strip .kanban-col { flex: 0 0 200px; min-width: 200px; max-width: 200px; }
}
@media (max-width: 768px) {
  .kanban-filter-bar { padding: 4px 12px 10px 12px; }
  .kanban-strip { padding: 0 8px 10px 8px; }
  .kanban-strip .kanban-col { flex: 0 0 220px; min-width: 220px; max-width: 220px; max-height: calc(100vh - 240px); }
}

/* === KALENDER: vollbreit, modern, schwebende semi-transparente Buttons === */
.calendar-fullbleed {
  position: relative;
  width: calc(100vw - var(--sbw, 0px));
  margin-left: calc((100% - 100vw + var(--sbw, 0px)) / 2);
  padding: 16px 0 32px 0;
  box-sizing: border-box;
  max-width: calc(100vw - var(--sbw, 0px));
}
/* User-Color-Legende — UNTEN LINKS, kein Konflikt mit FC-Toolbar oben rechts */
.calendar-legend-floating {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: rgba(250,250,250,0.45);
  border: 1px solid rgba(20,18,26,0.07);
  border-radius: var(--r-lg);
  padding: 5px 9px;
  opacity: 0.55;
  transition: opacity 200ms ease, background 200ms ease;
  max-width: 50vw;
}
.calendar-legend-floating:hover { opacity: 1; background: rgba(255,255,255,0.92); }
html.dark .calendar-legend-floating {
  background: rgba(25,23,34,0.45);
  border-color: rgba(255,255,255,0.06);
}
html.dark .calendar-legend-floating:hover { background: rgba(25,23,34,0.92); }

/* FAB: Floating Action Button — "+ Termin" unten rechts, PROMINENT in Brand-Gold,
   immer voll sichtbar (kein Transparenz-Default), klassischer Material-FAB-Look. */
.calendar-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background var(--dur-base);
}
.calendar-fab svg { flex-shrink: 0; stroke-width: 2; }
.calendar-fab:hover { background: var(--brand-dark); }
.calendar-fab-label { letter-spacing: 0; text-transform: none; }
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--r-md);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
}
html.dark .legend-chip { color: rgba(244,242,248,0.85); }
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.calendar-modern {
  padding: 0 12px;
  min-height: calc(100vh - 200px);
}
/* FullCalendar-Modernisierung */
.calendar-modern .fc {
  --fc-border-color: rgba(127,127,140,0.14);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: transparent;
  --fc-today-bg-color: rgba(253,185,19,0.05);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}
.calendar-modern .fc-toolbar.fc-header-toolbar {
  margin-bottom: 16px;
  padding: 0 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.calendar-modern .fc-toolbar-title {
  font-family: var(--font-ui);
  font-size: 22px !important;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
}
.calendar-modern .fc-button {
  background: rgba(127,127,140,0.08) !important;
  border: 1px solid rgba(127,127,140,0.16) !important;
  color: var(--ink-2) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 6px 12px !important;
  border-radius: var(--r-md) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  box-shadow: none !important;
  transition: background 150ms ease, border-color 150ms ease;
}
.calendar-modern .fc-button:hover {
  background: rgba(59,99,232,0.10) !important;
  border-color: rgba(79,124,255,0.35) !important;
}
.calendar-modern .fc-button-primary:not(:disabled).fc-button-active,
.calendar-modern .fc-button-primary:not(:disabled):active {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}
.calendar-modern .fc-event {
  border-radius: var(--r-md) !important;
  border: none !important;
  padding: 2px 6px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  box-shadow: 0 1px 2px rgba(20,18,26,0.10);
  cursor: pointer;
}
.calendar-modern .fc-event:hover {
  box-shadow: 0 4px 12px rgba(59,99,232,0.28);
  transform: translateY(-1px);
}
.calendar-modern .fc-daygrid-day:hover { background: rgba(59,99,232,0.04); }
.calendar-modern .fc-day-today { box-shadow: inset 0 0 0 1px rgba(79,124,255,0.35); }
.calendar-modern .fc-col-header-cell {
  background: transparent;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-muted);
  padding: 10px 0;
}
.calendar-modern .fc-scrollgrid { border: none !important; }
.calendar-modern .fc-scrollgrid td, .calendar-modern .fc-scrollgrid th { border-color: rgba(127,127,140,0.09); }
@media (max-width: 768px) {
  .calendar-legend-floating { bottom: 80px; left: 10px; padding: 4px 8px; opacity: 0.85; max-width: calc(100vw - 20px); }
  .calendar-fab { bottom: 16px; right: 16px; padding: 10px 14px; font-size: 13px; opacity: 0.9; }
  .calendar-modern { padding: 0 8px; min-height: 500px; }
  .calendar-modern .fc-toolbar-title { font-size: 18px !important; }
}

/* === BRAND-LOGO: Theme-abhaengiger Wechsel zwischen weiss/farbe === */
.brand-logo-light { display: inline-block; }   /* Default = Light-Mode = farbiges Logo */
.brand-logo-dark  { display: none; }
html.dark .brand-logo-light { display: none; }
html.dark .brand-logo-dark  { display: inline-block; }

/* === 4. KOMPONENTEN-STYLES ======================================== */
*, *::before, *::after { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { background: var(--bg); color: var(--ink); }
body { font-family: 'Inter', system-ui, sans-serif; min-height: 100vh; overflow-x: hidden; transition: background 0.2s, color 0.2s; }

/* Hintergrund-Animation: Sichtbarkeit regelt der Umbau-Abschnitt am Dateiende */

/* Surface — Inset-Lichtkante oben via --shadow-card */
.surface { background: var(--surface); border: 1px solid var(--border-soft); box-shadow: var(--shadow-sm); border-radius: var(--r-lg); }
.surface-light { background: var(--surface-2); border: 1px solid var(--border-soft); }
.glow-border { position: relative; }
.glow-border { border: 1px solid var(--brand); }

/* text-gradient: bewusst flach (kein Verlauf auf Text) */
.text-gradient { color: var(--ink); }

/* Scrollbars */
.scroll-area::-webkit-scrollbar { width: 6px; height: 6px; }
.scroll-area::-webkit-scrollbar-track { background: transparent; }
.scroll-area::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: var(--r-sm); }
body::-webkit-scrollbar { width: 8px; }
body::-webkit-scrollbar-track { background: var(--scrollbar-track); }
body::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: var(--r-sm); }

/* Inputs / Selects / Textareas */
.input, input[type="text"]:not(.input):not([class*="bg-"]), input[type="email"]:not(.input):not([class*="bg-"]),
input[type="tel"]:not(.input):not([class*="bg-"]), input[type="number"]:not(.input):not([class*="bg-"]),
input[type="date"]:not(.input):not([class*="bg-"]), input[type="datetime-local"]:not(.input):not([class*="bg-"]),
input[type="password"]:not(.input):not([class*="bg-"]), input[type="search"]:not(.input):not([class*="bg-"]),
textarea:not(.input):not([class*="bg-"]), select:not([class*="bg-"]) {
  background: var(--input-bg); border: 1.5px solid var(--input-border); color: var(--ink);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast); border-radius: var(--r-md);
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--ink-subtle); }
.input:focus, input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: var(--focus-ring);
}
html.dark .input:focus, html.dark input:focus, html.dark textarea:focus, html.dark select:focus {
  box-shadow: var(--focus-ring); border-color: var(--brand);
}
.input:disabled, input:disabled, textarea:disabled, select:disabled { opacity: 0.5; cursor: not-allowed; background: var(--bg-softer); }

/* Buttons */
.btn-primary { background: var(--brand); color: #fff; font-weight: 500; transition: background var(--dur-fast); border: 1px solid var(--brand); border-radius: var(--r-md); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary { background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); font-weight: 500; transition: background var(--dur-fast); border-radius: var(--r-md); }
.btn-secondary:hover { background: var(--bg-soft); border-color: var(--border-strong); }
html.dark .btn-secondary { color: var(--brand-light); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--ink-3); transition: background var(--dur-fast); border-radius: var(--r-md); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-soft); border-color: var(--border-strong); color: var(--ink); }
html.dark .btn-ghost:hover:not(:disabled) { color: var(--brand-light); border-color: var(--brand); }
.btn-danger { background: var(--danger-soft); border: 1px solid var(--danger); color: var(--danger); transition: background var(--dur-fast); border-radius: var(--r-md); }
html.dark .btn-danger { background: rgba(224,92,92,0.14); border-color: rgba(224,92,92,0.38); color: #eba9a9; }
.btn-danger:hover { background: #f6cfcf; }
.btn-accent { background: var(--brand); color: #fff; font-weight: 500; transition: background var(--dur-fast); border: 1px solid var(--brand); border-radius: var(--r-md); }
.btn-accent:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }

/* Tab pills — aktive Tabs in Kobalt */
.tab-pill { color: var(--ink-subtle); transition: all 0.15s; position: relative; border-radius: var(--r-md); }
.tab-pill:hover { color: var(--brand); background: var(--selection-bg); }
html.dark .tab-pill:hover { color: var(--brand-light); background: var(--selection-bg); }
.tab-pill.active { color: var(--brand); font-weight: 600; }
html.dark .tab-pill.active { color: var(--brand-light); }
.tab-pill.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; background: var(--brand); border-radius: var(--r-sm); }

/* Cards — Inset-Lichtkante via --shadow-card */
.card { background: var(--surface); border: 1px solid var(--border-soft); transition: border-color var(--dur-base); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card:hover { border-color: var(--border-strong); }
html.dark .card:hover { border-color: var(--brand); }

/* Stat tile — gelber Balken links (CTA-Highlight bleibt Gold) */
.stat-tile { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); padding: 14px 16px; transition: border-color var(--dur-base); position: relative; box-shadow: var(--shadow-sm); }
.stat-tile:hover { border-color: var(--border-strong); }
html.dark .stat-tile:hover { border-color: var(--brand); }

/* Table */
/* Dichte: 36-px-Zeilen, tabellarische Zahlen, Hover nur als Grauwert (A3) */
table.data-table { min-width: 720px; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data-table tbody tr { transition: background var(--dur-fast); cursor: pointer; }
table.data-table tbody tr:hover { background: var(--bg-soft); }
table.data-table tbody tr.is-selected { background: var(--selection-bg); }
table.data-table thead th { background: var(--table-header-bg); color: var(--ink-muted); font-weight: 500; font-size: 11px; letter-spacing: 0.01em; border-bottom: 1px solid var(--border); padding: 0 10px; height: 32px; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
table.data-table tbody td { border-bottom: 1px solid var(--border-soft); color: var(--ink-2); padding: 0 10px; height: 36px; }
table.data-table td.num, table.data-table th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12px; }

/* Status badges — ruhige Tints, gleiche Saettigungslogik in beiden Themes */
.badge { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: var(--r-sm); font-size: 11px; font-weight: 500; letter-spacing: 0; }
/* Statusfarben: EIN Akzent + Semantik. Grau = neutral, Kobalt = aktiv,
   Gruen = Erfolg, Rot = Verlust, Gelb ausschliesslich als Warnung (ueberfaellig). */
.badge-neu               { background: var(--bg-softer); color: var(--ink-muted); border: 1px solid var(--border); }
.badge-in_kontaktaufnahme{ background: var(--bg-softer); color: var(--ink-2);     border: 1px solid var(--border); }
.badge-nicht_erreicht    { background: var(--bg-softer); color: var(--ink-2);     border: 1px solid var(--border); }
.badge-kontaktiert       { background: var(--selection-bg); color: var(--brand);  border: 1px solid var(--brand); }
.badge-terminiert        { background: var(--selection-bg); color: var(--brand);  border: 1px solid var(--brand); }
.badge-angebot           { background: var(--selection-bg); color: var(--brand);  border: 1px solid var(--brand); }
.badge-interessiert      { background: var(--selection-bg); color: var(--brand);  border: 1px solid var(--brand); }
.badge-gewonnen          { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.badge-abgeschlossen     { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.badge-geantwortet       { background: var(--selection-bg); color: var(--brand);  border: 1px solid var(--brand); }
.badge-verloren          { background: var(--danger-soft);  color: var(--danger);  border: 1px solid var(--danger); }
.badge-nicht_interessiert{ background: var(--bg-softer);    color: var(--ink-muted); border: 1px solid var(--border); }
.badge-terminiert-overdue{ background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning); }

.modal-backdrop { background: var(--modal-backdrop); }
.modal-content { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); border-radius: var(--r-lg); color: var(--ink); }

/* Floating chat */
.fab { position: fixed; bottom: 24px; right: 24px; z-index: 50; width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: #fff; box-shadow: var(--shadow-md); cursor: pointer; transition: background var(--dur-base); display: flex; align-items: center; justify-content: center; }
.fab:hover { background: var(--brand-dark); }
.fab-panel { position: fixed; bottom: 96px; right: 24px; z-index: 49; width: min(90vw, 380px); height: min(80vh, 560px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-modal); display: flex; flex-direction: column; overflow: hidden; }
@media (max-width: 640px) { .fab { bottom: 16px; right: 16px; width: 52px; height: 52px; } .fab-panel { bottom: 80px; right: 16px; left: 16px; width: auto; max-height: calc(100vh - 110px); } }

/* Kanban */
.kanban-col { background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--r-lg); min-width: 268px; max-width: 268px; }
.kanban-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 7px 9px; cursor: grab; transition: border-color var(--dur-fast); user-select: none; box-shadow: none; }
.kanban-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.kanban-card.dragging { opacity: 0.4; cursor: grabbing; }
.kanban-col.drag-over { background: var(--selection-bg); border-color: var(--brand); }

/* FullCalendar */
.fc { font-family: inherit; --fc-border-color: var(--border-soft); --fc-page-bg-color: transparent; --fc-neutral-bg-color: var(--bg-soft); --fc-list-event-hover-bg-color: rgba(59,99,232,0.06); }
.fc .fc-toolbar-title { color: var(--ink); font-weight: 700; font-family: var(--font-ui); }
.fc .fc-button { background: var(--surface); border: 1.5px solid var(--border); color: var(--brand); padding: 0.4em 0.85em; font-weight: 500; }
html.dark .fc .fc-button { color: var(--brand-light); }
.fc .fc-button:hover, .fc .fc-button-active { background: var(--brand); border-color: var(--brand); color: white; }
.fc-col-header-cell, .fc-list-day-cushion { background: var(--bg-soft) !important; color: var(--ink-muted) !important; }
.fc-day-today { background: var(--selection-bg, rgba(79,124,255,0.07)) !important; }
.fc-event { border: none !important; padding: 1px 4px; border-radius: var(--r-md); cursor: pointer; background: var(--brand) !important; color: white !important; }

/* Animations */
@keyframes slideUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.animate-slide-up { animation: slideUp 120ms ease-out; }
/* A4: Fade-In ohne Zweck entfernt */
.animate-fade-in { animation: none; }
/* M-10: pulse-glow entfernt (Dekor ohne Zweck) */
.animate-pulse-glow { animation: none; }

.nav-scroll::-webkit-scrollbar { display: none; }
.nav-scroll { -ms-overflow-style: none; scrollbar-width: none; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 500; flex-shrink: 0; }

@media (max-width: 640px) {
  .fc-toolbar.fc-header-toolbar { display: flex; flex-direction: column; gap: 0.5rem; }
  .fc-toolbar-title { font-size: 1rem !important; }
}

/* Onboarding */
.tour-overlay { position: fixed; inset: 0; z-index: 100; pointer-events: auto; background: var(--modal-backdrop); }
.tour-spotlight { position: fixed; z-index: 101; border-radius: var(--r-lg); pointer-events: none; box-shadow: 0 0 0 9999px rgba(20,18,26,0.7), 0 0 40px 4px rgba(253,185,19,0.5); transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); border: 2px solid var(--accent); animation: tour-pulse 2s infinite; }
@keyframes tour-pulse { 0%, 100% { box-shadow: 0 0 0 9999px rgba(20,18,26,0.7), 0 0 40px 4px rgba(253,185,19,0.5); } 50% { box-shadow: 0 0 0 9999px rgba(20,18,26,0.7), 0 0 60px 12px rgba(253,185,19,0.7); } }
.tour-card { position: fixed; z-index: 102; max-width: 380px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-md); border-radius: var(--r-lg); padding: 20px; color: var(--ink); }
.tour-progress { display: flex; gap: 4px; margin-bottom: 12px; }
.tour-progress-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-soft); transition: all 0.3s; }
.tour-progress-dot.active { background: var(--accent); width: 24px; border-radius: var(--r-sm); }

/* Hero Card — Kobalt in beiden Modi, alle Texte zwangsweise hell */
.hero-power { background: var(--surface); color: var(--ink); border-radius: 0; padding: 16px; position: relative; }




.hero-power .text-gradient { color: var(--ink) !important; }


/* Template-Chips im Mail-Compose — visuell pro Kategorie unterschieden */
.tpl-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-md);
  font-size: 12px;
  border: 1.5px solid transparent;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(20,18,26,0.04), 0 1px 2px rgba(20,18,26,0.05);
}
.tpl-chip:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.tpl-chip-neutral { border-color: var(--border-soft); }
.tpl-chip-cyan    { border-color: var(--border); background: var(--surface-2); color: var(--ink-3); }
.tpl-chip-blue    { border-color: var(--border); background: var(--surface-2); color: var(--brand); }
.tpl-chip-green   { border-color: var(--border); background: var(--surface-2); color: var(--success); }
.tpl-chip-violet  { border-color: var(--border); background: var(--surface-2); color: var(--ink-2); }
.tpl-chip-gold    { border-color: var(--border); background: var(--surface-2); color: var(--warning); font-weight: 600; }
.tpl-chip-active {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px rgba(59,99,232,0.45), 0 6px 16px -6px rgba(59,99,232,0.35);
  border-color: var(--brand) !important;
}
html.dark .tpl-chip { background: var(--surface-2); color: var(--ink-2); }
html.dark .tpl-chip-cyan    { color: #93cfe0; }
html.dark .tpl-chip-blue    { color: #aabff5; }
html.dark .tpl-chip-green   { color: #8fd9b6; }
html.dark .tpl-chip-violet  { color: #c4b3f2; }
html.dark .tpl-chip-gold    { color: #ecc879; }
html.dark .tpl-chip-active  { box-shadow: 0 0 0 2px rgba(79,124,255,0.55), 0 6px 16px -6px rgba(0,0,0,0.55); border-color: var(--brand) !important; }

/* Editier-Zonen in der Mail-Vorschau — klare visuelle Markierung (Gold = Highlight) */
.email-canvas [data-edit-zone] {
  transition: outline-color 0.15s, background-color 0.15s;
}
.email-canvas [data-edit-zone]:hover {
  outline-color: rgba(253,185,19,0.7) !important;
  background-color: rgba(253,185,19,0.1) !important;
}
.email-canvas [data-edit-zone]:focus {
  outline: 2px solid #4f7cff !important;
  background-color: rgba(79,124,255,0.12) !important;
}

/* Brand-Text-Helfer (Logo-Wortmarke) — flippt im Dark-Mode auf helles Kobalt */
.brand-text { color: var(--brand); }
html.dark .brand-text { color: var(--brand-light); }

/* Theme-Toggle-Button */
.theme-toggle { width: 32px; height: 32px; border-radius: var(--r-md); background: transparent; border: 1px solid var(--border); color: var(--ink-3); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--dur-fast); }
.theme-toggle:hover { background: var(--bg-soft); border-color: var(--border-strong); color: var(--ink); }
html.dark .theme-toggle:hover { color: var(--brand-light); border-color: var(--brand); }
.theme-toggle .sun, html.dark .theme-toggle .moon { display: none; }
.theme-toggle .moon { display: block; }
html.dark .theme-toggle .sun { display: block; }

/* === 5. TAILWIND-CLASS-OVERRIDES =================================== */
/* Tailwind generiert text-ink-* / bg-ink-* mit FIXEN Hex-Werten — die werden
   im Dark-Mode NICHT automatisch geflippt. Daher hier explizite Overrides. */

/* Cyan/Brand-Highlights → Marke (theme-aware, Kobalt in beiden Modi) */
.text-cyan-300, .text-cyan-400, .text-cyan-500 { color: var(--brand) !important; }
html.dark .text-cyan-300, html.dark .text-cyan-400, html.dark .text-cyan-500 { color: var(--brand-light) !important; }
.text-cyan-300:hover, .hover\:text-cyan-300:hover, .hover\:text-cyan-200:hover { color: var(--brand-dark) !important; }
.bg-cyan-500, .bg-cyan-400 { background-color: var(--brand) !important; }
.border-cyan-400\/40, .border-cyan-400\/60 { border-color: var(--brand) !important; }
.bg-cyan-400\/10, .bg-cyan-400\/20, .bg-cyan-400\/15 { background-color: rgba(59,99,232,0.08) !important; }
html.dark .bg-cyan-400\/10, html.dark .bg-cyan-400\/20, html.dark .bg-cyan-400\/15 { background-color: rgba(79,124,255,0.12) !important; }
.bg-brand-500\/5 { background-color: rgba(59,99,232,0.04) !important; }
.bg-brand-500, .bg-brand-400 { background-color: var(--brand) !important; }
.text-brand-400, .text-brand-500 { color: var(--brand) !important; }
html.dark .text-brand-400, html.dark .text-brand-500 { color: var(--brand-light) !important; }

/* Akzent-Farben (Emerald/Amber/Rose/Violet) — gemutet in beiden Modi */
/* Semantik: gruen = Erfolg, rot = Gefahr, gelb NUR Warnung, violett -> neutral */
.text-emerald-200, .text-emerald-300, .text-emerald-400, .text-emerald-500, .text-green-400 { color: var(--success) !important; }
.text-amber-200, .text-amber-300, .text-amber-400, .text-amber-500, .text-yellow-400, .text-orange-300, .text-orange-400 { color: var(--warning) !important; }
.text-rose-200, .text-rose-300, .text-rose-400, .text-rose-500, .text-red-400, .text-red-500 { color: var(--danger) !important; }
.text-violet-300, .text-violet-400, .text-purple-200, .text-purple-300 { color: var(--ink-2) !important; }
.bg-emerald-500\/10, .bg-emerald-500\/15, .bg-emerald-500\/20, .bg-emerald-500\/25, .bg-emerald-500\/30 { background-color: var(--success-soft) !important; }
.bg-amber-500\/10, .bg-amber-500\/15, .bg-amber-500\/20, .bg-amber-500\/25, .bg-amber-400\/15, .bg-orange-500\/15 { background-color: var(--warning-soft) !important; }
.bg-rose-500\/10, .bg-rose-500\/15, .bg-rose-500\/20, .bg-red-500\/15, .bg-red-500\/20 { background-color: var(--danger-soft) !important; }
.bg-purple-500\/15, .bg-purple-500\/20, .bg-violet-500\/15 { background-color: var(--bg-softer) !important; }
.border-amber-500\/30, .border-amber-500\/40 { border-color: var(--warning) !important; }
.border-rose-500\/30, .border-red-500\/30 { border-color: var(--danger) !important; }
.border-emerald-500\/30 { border-color: var(--success) !important; }
.border-cyan-400, .border-cyan-300, .border-brand-500\/20, .border-brand-500\/30 { border-color: var(--brand) !important; }

/* white-Surfaces -> theme-aware */
.bg-white\/\[0\.02\], .bg-white\/\[0\.03\], .bg-white\/\[0\.05\] { background-color: var(--bg-soft) !important; }
.hover\:bg-white\/\[0\.02\]:hover, .hover\:bg-white\/\[0\.05\]:hover { background-color: var(--bg-softer) !important; }
.bg-white\/5 { background-color: var(--bg-soft) !important; }

/* Border-overrides → theme-aware */
.border-white\/\[0\.06\], .border-white\/\[0\.08\], .border-white\/\[0\.1\], .border-white\/10, .border-white\/20 { border-color: var(--border-soft) !important; }

/* Ink-Skala im Dark-Mode invertieren — violettgraue Skala statt Slate */
html.dark .text-ink-100, html.dark .text-ink-50 { color: var(--g-900) !important; }
html.dark .text-ink-200 { color: var(--g-800) !important; }
html.dark .text-ink-300 { color: var(--g-700) !important; }
html.dark .text-ink-400 { color: var(--g-600) !important; }
html.dark .text-ink-500 { color: var(--g-500) !important; }
html.dark .text-ink-600 { color: var(--g-400) !important; }

html.dark .bg-ink-900, html.dark .bg-ink-950, html.dark .bg-ink-800 { background-color: var(--surface) !important; }
html.dark .bg-obsidian-800, html.dark .bg-obsidian-900, html.dark .bg-obsidian-950 { background-color: var(--surface) !important; }

/* Slate/Gray-Klassen im Dark-Mode */
html.dark .text-slate-100, html.dark .text-slate-200, html.dark .text-gray-100, html.dark .text-gray-200 { color: var(--g-800) !important; }
html.dark .text-slate-300, html.dark .text-gray-300 { color: var(--g-700) !important; }
html.dark .text-slate-400, html.dark .text-gray-400 { color: var(--g-600) !important; }
html.dark .text-slate-500, html.dark .text-gray-500 { color: var(--g-500) !important; }

html.dark .bg-white { background-color: var(--surface) !important; }
html.dark .bg-gray-50, html.dark .bg-slate-50 { background-color: var(--bg-soft) !important; }
html.dark .bg-gray-100, html.dark .bg-slate-100 { background-color: var(--bg-softer) !important; }

/* MW-Pipeline-Leiste im Kanban (2026-09-03) */
.kanban-mw-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 0 16px 12px; }
@media (max-width: 900px) { .kanban-mw-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kanban-mw-tile { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); padding: 8px 12px; }
.kanban-mw-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3, #94a3b8); font-weight: 600; }
.kanban-mw-value { font-size: 20px; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kanban-mw-sub { font-size: 11px; color: var(--ink-4, #64748b); margin-top: 2px; }
.kanban-col-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }


/* ====================================================================
   UMBAU 06.09.2026 — Seitenpanel, Statusmenue, Bulk-Leiste, Skeletons
   ==================================================================== */

/* --- B1: Detail als Seitenpanel rechts (Liste bleibt sichtbar) --- */
.detail-panel-scrim {
  /* B3-1/R5: beginnt UNTER der Kopfzeile, damit Glocke, Suche und Reiter bei offenem
     Panel bedienbar bleiben (gemessener Befund: Scrim fing alle Kopfzeilen-Klicks ab). */
  position: fixed; top: var(--tb, 96px); left: 0; right: 0; bottom: 0;
  z-index: 44; background: transparent;
  /* Abnahme: der Scrim fing bei offenem Panel jeden Klick ab (Kundenzeile,
     Kanban-Statusmenue, Verknuepfen-Knopf). Er dunkelt nur ab - Klicks gehen durch,
     das Schliessen uebernimmt panelAussenKlick. */
  pointer-events: none;
}
.detail-panel {
  /* Emir 06.09.: Anlagen-Detail als zentriertes Popup wie vor dem Umbau (gleicher Inhalt, neue Tokens),
     kein Seitenpanel. Beginnt unter der Kopfzeile, damit Navigation/Suche/Glocke bedienbar bleiben. */
  position: fixed; top: calc(var(--tb, 96px) + 12px); left: 50%; right: auto; bottom: 12px; z-index: 45; /* ueber dem Kundenfenster (z-40) */
  transform: translateX(-50%);
  width: min(1400px, 94vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg, 10px);
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
}
.detail-panel-head {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  border-radius: var(--r-lg, 10px) var(--r-lg, 10px) 0 0;
}
.detail-panel .card, .detail-panel .surface { box-shadow: none; }
@media (max-width: 767px) {
  /* Mobil: Vollbild unter der Kopfzeile (Mehr-Menue bleibt erreichbar) */
  .detail-panel { width: 100vw; left: 0; right: 0; transform: none; top: var(--tb, 96px); bottom: 0; border: none; border-radius: 0; }
  .detail-panel .grid[class*="lg:grid-cols-"],
  .detail-panel .grid[class*="md:grid-cols-2"] { grid-template-columns: minmax(0,1fr) !important; }
}

/* --- B2: Statusmenue an der Pill --- */
.status-menu {
  position: absolute; z-index: 60; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  padding: 4px; text-align: left;
}
.status-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 5px 8px; border-radius: var(--r-sm); font-size: 12px;
  color: var(--ink-2); background: transparent; cursor: pointer;
}
.status-menu button:hover { background: var(--bg-soft); }
.status-menu button[disabled] { opacity: 0.45; cursor: default; }
.status-pill-btn { cursor: pointer; }
.status-pill-btn:hover { border-color: var(--border-strong); }

/* --- B6: Bulk-Leiste unten --- */
.bulk-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 45;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  padding: 8px 12px; max-width: calc(100vw - 32px);
}
.bulk-bar .bulk-count { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--ink); }

/* --- A5: Skeletons statt leerer Flaeche --- */
.skeleton { background: var(--bg-soft); border-radius: var(--r-sm); position: relative; overflow: hidden; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: var(--bg-softer); opacity: 0; animation: skel 1.2s ease-in-out infinite;
}
@keyframes skel { 0%, 100% { opacity: 0; } 50% { opacity: 0.7; } }
.skeleton-row { height: 36px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 12px; padding: 0 10px; }
.skeleton-row > span { height: 9px; border-radius: var(--r-sm); background: var(--bg-softer); display: block; }

/* --- A5: Zero-State mit Handlung --- */
.zero-state { padding: 40px 20px; text-align: center; color: var(--ink-muted); font-size: 13px; }
.zero-state .zero-title { color: var(--ink-2); font-weight: 500; margin-bottom: 4px; }
.zero-state .zero-actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* --- A5: Fehler inline --- */
.inline-error {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--danger); background: var(--danger-soft); color: var(--danger);
  border-radius: var(--r-md); padding: 7px 10px; font-size: 12px;
}

/* --- B4/B7: Tastenkuerzel + Speicher-Statuszeile --- */
kbd, .kbd {
  display: inline-block; min-width: 18px; text-align: center;
  font-family: var(--font-mono); font-size: 11px; line-height: 16px;
  padding: 1px 5px; border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: var(--r-sm); background: var(--bg-soft); color: var(--ink-3);
}
.save-line { font-size: 11px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.save-line[data-state="saving"] { color: var(--brand); }
.save-line[data-state="error"] { color: var(--danger); }

/* --- A4: Three.js-Hintergrund unter dem Inhalt, dezent --- */
#bg-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; opacity: 0.28;
}
html.no-bg-animation #bg-canvas { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  #bg-canvas { display: none !important; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Karten-/Kalender-Overlays ohne Glas-Optik */
.map-filter-floating, .calendar-legend-floating { background: var(--surface) !important; opacity: 1 !important; border: 1px solid var(--border) !important; }


/* --- Kontrast-Korrekturen (axe color-contrast, gemessen 06.09.2026) --- */
/* Weiss auf Kobalt braucht im Dark-Modus den dunkleren Ton (4,8:1 statt 3,45:1) */
html.dark .btn-primary { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
html.dark .btn-primary:hover:not(:disabled) { background: #3556c4; border-color: #3556c4; }
html.dark .bg-brand-500, html.dark .bg-brand-400, html.dark .bg-cyan-500, html.dark .bg-cyan-400 { background-color: var(--brand-dark) !important; }
html.dark .fab, html.dark .calendar-fab { background: var(--brand-dark); border-color: var(--brand-dark); }
/* Kobalt-Badges im Dark-Modus heller (auf getoenter Flaeche 6,5:1 statt 4,4:1) */
html.dark .badge-kontaktiert, html.dark .badge-terminiert, html.dark .badge-angebot, html.dark .badge-geantwortet, html.dark .badge-interessiert {
  color: var(--brand-light); border-color: var(--brand-light);
}
html.dark .text-brand-400, html.dark .text-brand-500, html.dark .text-cyan-300, html.dark .text-cyan-400, html.dark .text-cyan-500 { color: var(--brand-light) !important; }

/* Kobalt-Badges im Light-Modus dunkler (auf getoenter Flaeche 6,4:1 statt 4,41:1) */
.badge-kontaktiert, .badge-terminiert, .badge-angebot, .badge-geantwortet, .badge-interessiert { color: #24479f; border-color: #24479f; }
html.dark .badge-kontaktiert, html.dark .badge-terminiert, html.dark .badge-angebot, html.dark .badge-geantwortet, html.dark .badge-interessiert { color: var(--brand-light); border-color: var(--brand-light); }

/* --- Kontrast-Nachzug (axe, gemessen 06.09.2026, Runde 2) --- */
/* Zaehler-Badges: Weiss auf Rot/Cyan braucht den dunkleren Ton (AA bei 10-11px) */
.bg-red-500, .bg-rose-500 { background-color: var(--danger) !important; }
html.dark .bg-red-500, html.dark .bg-rose-500 { background-color: #a8322d !important; }
.bg-cyan-500 { background-color: var(--brand) !important; }
html.dark .bg-cyan-500 { background-color: var(--brand-dark) !important; }
/* Sehr helle Grauwerte auf getoenter Flaeche: eine Stufe dunkler (Light-Modus) */
.text-ink-600 { color: var(--ink-subtle) !important; }
html.dark .text-ink-600 { color: var(--g-400) !important; }
/* Blaue Hinweis-Chips (Angebot/Kampagne) auf Semantik-Tokens */
.bg-blue-500\/15, .bg-blue-500\/25 { background-color: var(--selection-bg) !important; }
.text-blue-300, .text-blue-400 { color: var(--brand) !important; }
html.dark .text-blue-300, html.dark .text-blue-400 { color: var(--brand-light) !important; }
/* Leaflet-Attribution lesbar (Fremd-CSS) */
.leaflet-control-attribution, .leaflet-control-attribution a { color: var(--ink-muted) !important; }
html.dark .leaflet-control-attribution { background: rgba(0,0,0,0.55) !important; }

/* Sensitivitaets-Balken (Wirtschaftlichkeit): Spur, Balken, Nulllinie.
   Die Position kommt per :style aus Alpine, die Optik gehoert ins Theme. */
.sens-track { position: relative; height: 8px; background: var(--bg-soft); border-radius: var(--r-sm); }
.sens-bar { position: absolute; top: 0; bottom: 0; background: var(--brand); border-radius: var(--r-sm); }
.sens-zero { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--border-strong); }

/* --- BL-3: Bedienbarkeit auf kleinen Schirmen (Runde 3) --- */
@media (max-width: 767px) {
  /* Touch-Ziele: mindestens 32 px in jeder Richtung */
  button, [role="menuitem"], .theme-toggle, .badge.status-pill-btn, a.btn-ghost, a.btn-primary { min-height: 32px; }
  button.status-pill-btn, .status-menu button { min-height: 32px; }
  /* Kopfzeile darf nicht ueberlaufen */
  header.surface .h-12 { gap: 6px; }
  header.surface select, header.surface .theme-toggle { flex-shrink: 0; }
  /* Chat-FAB haelt Abstand zu Leisten am unteren Rand */
  .fab { bottom: 84px; right: 12px; }
  .bulk-bar { bottom: 8px; }
}

/* ====================================================================
   RUNDE 3: EIN Farbsystem (M-2) und Mindest-Textgroessen (M-4)
   ==================================================================== */
/* Alle verbliebenen Buntfamilien laufen auf Tokens: Grau (neutral), Kobalt (aktiv),
   Gruen (Erfolg), Rot (Verlust), Gelb (nur Warnung). */
.text-cyan-200, .text-cyan-300, .text-cyan-400, .text-cyan-500,
.text-violet-200, .text-violet-300, .text-violet-400,
.text-purple-200, .text-purple-300, .text-purple-400,
.text-indigo-300, .text-indigo-400 { color: var(--brand) !important; }
html.dark .text-cyan-200, html.dark .text-cyan-300, html.dark .text-cyan-400, html.dark .text-cyan-500,
html.dark .text-violet-200, html.dark .text-violet-300, html.dark .text-violet-400,
html.dark .text-purple-200, html.dark .text-purple-300, html.dark .text-purple-400,
html.dark .text-indigo-300, html.dark .text-indigo-400 { color: var(--brand-light) !important; }

.bg-cyan-400\/10, .bg-cyan-400\/15, .bg-cyan-400\/20, .bg-cyan-500\/15, .bg-cyan-500\/25,
.bg-violet-400\/15, .bg-violet-500\/15, .bg-violet-500\/20,
.bg-purple-400\/15, .bg-indigo-500\/15 { background-color: var(--selection-bg) !important; }
.border-violet-400, .border-purple-400, .border-cyan-400, .border-indigo-400 { border-color: var(--brand) !important; }
.border-l-violet-400, .border-l-cyan-400, .border-l-purple-400 { border-left-color: var(--brand) !important; }
.border-l-amber-400 { border-left-color: var(--warning) !important; }
.border-l-emerald-400 { border-left-color: var(--success) !important; }
.border-l-rose-400, .border-l-red-400 { border-left-color: var(--danger) !important; }
.border-l-blue-400 { border-left-color: var(--brand) !important; }
.border-l-orange-400 { border-left-color: var(--warning) !important; }
.bg-orange-400\/15, .bg-orange-500\/20 { background-color: var(--warning-soft) !important; }
.text-orange-200, .text-orange-300, .text-orange-400 { color: var(--warning) !important; }
.bg-slate-600\/30, .bg-gray-500\/20 { background-color: var(--bg-softer) !important; }

/* M-4: keine 10-px-Schrift mehr (Mindestgroesse 11 px, Tabellenzellen 13 px) */
.text-\[10px\], .text-\[9px\] { font-size: 11px !important; line-height: 1.35 !important; }
table.data-table tbody td { font-size: 13px; }

/* M-3: dl/dt/dd-Struktur der Tastenhilfe bleibt gueltig (jede Zeile ist ein div in dl) */
.keys-list > div { display: flex; }

/* M-8: Bei offenem Seitenpanel zeigt die Liste nur die Kernspalten
   (Name, Ort bleibt fuer die Orientierung, Leistung, Status). */
.liste-kompakt table.data-table th:nth-child(3), .liste-kompakt table.data-table td:nth-child(3),
.liste-kompakt table.data-table th:nth-child(5), .liste-kompakt table.data-table td:nth-child(5),
.liste-kompakt table.data-table th:nth-child(7), .liste-kompakt table.data-table td:nth-child(7),
.liste-kompakt table.data-table th:nth-child(8), .liste-kompakt table.data-table td:nth-child(8),
.liste-kompakt table.data-table th:nth-child(9), .liste-kompakt table.data-table td:nth-child(9) { display: none; }
.liste-kompakt table.data-table { min-width: 0; }

/* Kontrast-Nachzug Runde 3: kleine Sekundaertexte auf getoenter Flaeche (axe, Dark) */
html.dark .text-ink-500, html.dark .text-ink-600 { color: var(--g-600) !important; }
/* View-As-Auswahl: Touch-Ziel >= 32 px */
header.surface select { min-height: 32px; }

/* Aufklappmenues sind KEINE Modals: sie duerfen die Mobile-Vollbildregel von
   .modal-content nicht erben (Runde 3, gemessen: 366 px breit, 100vh hoch). */
.menu-panel {
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-md); border-radius: var(--r-lg); color: var(--ink);
}
@media (max-width: 767px) {
  .menu-panel { max-width: min(92vw, 260px) !important; width: max-content !important; min-height: 0 !important; border-radius: var(--r-lg) !important; }
}

/* ====================================================================
   RUNDE 4: Farbfamilien auf Tokens (M2-2), Kontraste (B2-3), Groessen (M2-4)
   ==================================================================== */
/* EINE Rot-, EINE Gruen-, EINE Warnfamilie + Akzent. red-* faellt auf danger. */
.text-red-200, .text-red-300, .text-red-400, .text-red-500, .text-red-600 { color: var(--danger) !important; }
.bg-red-500\/10, .bg-red-500\/15, .bg-red-500\/20, .bg-red-400\/10, .bg-red-400\/15 { background-color: var(--danger-soft) !important; }
.border-red-400, .border-red-500, .border-red-400\/30, .border-red-500\/30 { border-color: var(--danger) !important; }
.text-green-300, .text-green-400, .text-green-500 { color: var(--success) !important; }
.bg-green-500\/10, .bg-green-500\/15, .bg-green-400\/15 { background-color: var(--success-soft) !important; }
.text-slate-300, .text-slate-400, .text-gray-300, .text-gray-400 { color: var(--ink-muted) !important; }
.bg-slate-600\/40, .bg-slate-700\/40, .bg-slate-700\/50, .bg-slate-700\/60, .bg-gray-600\/30 { background-color: var(--bg-softer) !important; }
/* Abnahme 6.matrix.anfragen.light: bg-slate-700/50 blieb im hellen Thema eine dunkle
   Halbtransparenz; dunkler Text darauf kam auf 3.77:1. Jetzt Flaeche aus dem Token. */
.text-blue-200, .text-blue-300, .text-blue-400, .text-blue-500 { color: var(--brand) !important; }
html.dark .text-blue-200, html.dark .text-blue-300, html.dark .text-blue-400, html.dark .text-blue-500 { color: var(--brand-light) !important; }

/* B2-3: Kanban-Summenleiste — die Kennzahlen tragen Textfarben, keine Buntwerte */
.kanban-mw-value.text-brand-400, .kanban-mw-value.text-emerald-400,
.kanban-mw-value.text-rose-400, .kanban-mw-value.text-ink-300 { color: var(--ink) !important; }
.kanban-mw-label, .kanban-mw-sub { color: var(--ink-muted) !important; }

/* B2-3: FullCalendar-Knoepfe und Termine erben die Token-Farben */
.fc .fc-button, .fc .fc-button-primary { background: var(--surface) !important; border: 1px solid var(--border) !important; color: var(--ink-2) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active,
.fc .fc-button:hover { background: var(--brand) !important; border-color: var(--brand) !important; color: #fff !important; }
html.dark .fc .fc-button-primary:not(:disabled).fc-button-active, html.dark .fc .fc-button:hover { background: var(--brand-dark) !important; border-color: var(--brand-dark) !important; }
.fc .fc-event, .fc .fc-event-title, .fc .fc-event-time { color: #fff !important; font-size: 11px !important; }
.fc .fc-toolbar-title, .fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--ink) !important; }
.fc .fc-list-day-text, .fc .fc-list-day-side-text, .fc .fc-list-event-title a { color: var(--ink) !important; }

/* B2-3: Avatar traegt weisse Schrift auf Nutzerfarbe -> Mindestkontrast durch dunkleren Grund */
.avatar { text-shadow: 0 1px 2px rgba(0,0,0,0.55); }
.avatar::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,0.18); pointer-events: none; }
.avatar { position: relative; }

/* B2-3: btn-accent = Primaerfarbe (weisser Text auf Kobalt statt auf Gelb) */
.btn-accent { background: var(--brand) !important; border-color: var(--brand) !important; color: #fff !important; }
html.dark .btn-accent { background: var(--brand-dark) !important; border-color: var(--brand-dark) !important; }

/* M2-4: Aktualisieren- und andere Icon-Knoepfe mindestens 32 px */
button.btn-secondary, button.btn-ghost, .theme-toggle, button[aria-label] { min-height: 32px; }
table.data-table button[aria-label], .status-menu button { min-height: 28px; }


/* B2-3 (Runde 4): Weiss auf Kobalt erreicht AA erst mit dem dunkleren Ton */
.fc .fc-event, .fc .fc-event-main, .fc .fc-neuerTermin-button,
html.dark .fc .fc-event, html.dark .fc .fc-event-main { background: var(--brand-dark) !important; border-color: var(--brand-dark) !important; }
html.dark .fc .fc-event, html.dark .fc .fc-event-main { background: #3556c4 !important; border-color: #3556c4 !important; }
.fc .fc-event, .fc .fc-event *, .fc .fc-neuerTermin-button { font-size: 11px !important; }
/* Hilfe-Kacheln: Verweise in Textfarbe statt hellem Markenton */
.text-brand-300 { color: var(--brand) !important; }
html.dark .text-brand-300 { color: var(--brand-light) !important; }
.bg-brand\/20 span, .bg-brand\/20 { color: var(--brand) !important; }
html.dark .bg-brand\/20 span, html.dark .bg-brand\/20 { color: var(--brand-light) !important; }

/* H2-4 (Runde 4): Mindestgroesse gezielt dort, wo Regeln unter 11 px lagen */
.kanban-col-header .badge, .kanban-strip .kanban-card .text-xs, .kanban-strip .kanban-card .text-sm { font-size: 11px !important; }
.badge { font-size: 11px; }

/* Kalender: Mindestgroesse gezielt (max(11px,1em) hatte alle Groessen auf 16 px gezogen) */
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number, .fc .fc-timegrid-slot-label-cushion,
.fc .fc-list-day-text, .fc .fc-list-event-title { font-size: 12px; }

/* M2-4: Bedienknoepfe mindestens 32 px hoch. Ausgenommen bleiben Inline-Elemente
   in 36-px-Tabellenzeilen und auf Kanban-Karten (dort waere 32 px hoeher als die Zeile). */
.btn-primary, .btn-secondary, .btn-ghost, .btn-accent, .btn-danger,
a.btn-primary, a.btn-secondary, a.btn-ghost,
header button, header select, .fc .fc-button { min-height: 32px; }
table.data-table .btn-ghost, table.data-table .btn-primary, table.data-table button,
.kanban-card button, .status-menu button, .status-pill-btn { min-height: 0; }

/* M2-4: Auswahl- und Eingabefelder ebenfalls mindestens 32 px (Formulare, Filter). */
select.input, input.input, textarea.input, select:not([size]), input[type="text"], input[type="email"],
input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"] { min-height: 32px; }
table.data-table input[type="checkbox"], .status-menu select { min-height: 0; }

/* ====================================================================
   RUNDE 5: Klickflaechen (B3-4) und Reiterleiste (B3-3)
   ==================================================================== */
/* Auswahlzelle: die ganze Zelle ist 32x32 gross und waehlt aus (Panel oeffnet
   nur der Klick auf die Namensspalte). */
.auswahl-zelle { padding: 0 !important; width: 36px; }
.auswahl-flaeche {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; min-width: 32px; min-height: 32px;
  cursor: pointer; border-radius: var(--r-sm);
}
.auswahl-flaeche:hover { background: var(--bg-soft); }
.auswahl-flaeche input { width: 15px; height: 15px; cursor: pointer; }

/* Statusknopf auf der Kanban-Karte: volles Touch-Ziel */
.status-knopf { min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }

/* Drill-Verweise im Reporting sind Schaltflaechen, keine Textfetzen */
.drill-link { min-height: 32px; display: inline-flex; align-items: center; padding: 0 8px; border-radius: var(--r-sm); }
.drill-link:hover { background: var(--bg-soft); }

/* Loeschen-Kreuze und andere Icon-Schaltflaechen */
.icon-knopf { min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; }

/* B3-3: Reiterleiste rollt weich und hat sichtbare Blaetter-Schaltflaechen
   (kein Verlauf als Andeutung - der waere reine Optik und nicht bedienbar). */
.nav-fade { position: relative; scroll-behavior: smooth; }
.nav-blaettern {
  min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--ink-3);
  flex: 0 0 auto;
}
.nav-blaettern:hover { background: var(--bg-soft); }

/* ====================================================================
   RUNDE 5 (B3-4): Touch-Ziele auf 32 px, ohne die 36-px-Zeilen zu sprengen
   ==================================================================== */
/* Die Checkbox fuellt ihre 32x32-Flaeche vollstaendig aus und zeichnet sich selbst. */
.auswahl-flaeche input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 32px; height: 32px; margin: 0; cursor: pointer;
  background: transparent; border: none; position: relative;
}
.auswahl-flaeche input[type="checkbox"]::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 15px; height: 15px;
  transform: translate(-50%, -50%);
  border: 1.5px solid var(--border-strong); border-radius: var(--r-sm); background: var(--input-bg);
}
.auswahl-flaeche input[type="checkbox"]:checked::before { background: var(--brand); border-color: var(--brand); }
.auswahl-flaeche input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 8px;
  transform: translate(-50%, -60%) rotate(45deg);
  border: solid #fff; border-width: 0 2px 2px 0;
}
.auswahl-flaeche input[type="checkbox"]:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--r-sm); }

/* Kanban-Statusknopf: die Regel aus Runde 4 hatte ihn wieder auf 0 gesetzt. */
.kanban-card button.status-knopf { min-width: 32px; min-height: 32px; }

/* Loesch-Kreuze und aehnliche Icon-Schaltflaechen in Einstellungen/Listen */
.icon-knopf { min-width: 32px; min-height: 32px; }

/* Labels mit Checkbox sind vollwertige Klickziele (B3-4). */
label:has(> input[type="checkbox"]) { min-height: 32px; display: inline-flex; align-items: center; }
input[type="checkbox"]:not(.auswahl-flaeche input) { width: 18px; height: 18px; }

/* Drill-Verweise sind Schaltflaechen und behalten 32 px, auch in Tabellen
   (die Zeilen-Ausnahme aus Runde 4 hatte sie wieder auf 0 gesetzt). */
table.data-table .drill-link, .drill-link { min-height: 32px !important; display: inline-flex; align-items: center; }

/* ====================================================================
   RUNDE 5, Nachzug: restliche Trefferflaechen auf 32 px
   ==================================================================== */
/* Drill-Verweise brauchen auch Breite (Zahlen wie "3" waren 23 px breit). */
.drill-link { min-width: 32px !important; justify-content: flex-end; }

/* Listeneintraege, die verlinken (Registeralarme, Aktivitaetsliste), sind
   Zeilen - keine Fliesstext-Links - und bekommen volle Zeilenhoehe. */
.zeilen-link { min-height: 32px; display: inline-flex; align-items: center; }

/* Aufklapper und Dateiauswahl */
summary { min-height: 32px; display: flex; align-items: center; }
input[type="file"] { min-height: 32px; }

/* Checkboxen zeichnen sich in einer 32er-Flaeche selbst (wie die Auswahlzelle),
   damit das Bedienziel und nicht nur das Label 32 px misst. */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 32px; height: 32px; margin: 0; cursor: pointer; position: relative;
  background: transparent; border: none; flex: 0 0 auto;
}
input[type="checkbox"]::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px;
  transform: translate(-50%, -50%);
  border: 1.5px solid var(--border-strong); border-radius: var(--r-sm); background: var(--input-bg);
}
input[type="checkbox"]:checked::before { background: var(--brand); border-color: var(--brand); }
input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 9px;
  transform: translate(-50%, -60%) rotate(45deg);
  border: solid #fff; border-width: 0 2px 2px 0;
}
input[type="checkbox"]:disabled { opacity: 0.5; cursor: not-allowed; }
input[type="checkbox"]:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--r-sm); }

/* Nachzug: Tailwind-Groessenklassen (w-4 h-4) duerfen das 32-px-Ziel nicht unterlaufen. */
input[type="checkbox"] { width: 32px !important; height: 32px !important; }
table.data-table .auswahl-flaeche input[type="checkbox"] { width: 32px !important; height: 32px !important; }
/* Schmale Icon-Schaltflaechen (z. B. Anrufliste) */
button.btn-ghost, button.btn-secondary, button.btn-primary { min-width: 32px; }
/* Leaflet-Bedienelemente (Fremdbibliothek) auf Zielgroesse */
.leaflet-control-zoom a { width: 32px !important; height: 32px !important; line-height: 32px !important; }

/* Zaehler-Badges in der Navigation: dunklerer Marken-Ton auf getoenter Flaeche (AA). */
.bg-brand-500\/20, .bg-brand-500\/10, .bg-brand-400\/15 { background-color: var(--selection-bg) !important; }
.text-brand-200, .text-brand-300 { color: #24479f !important; }
html.dark .text-brand-200, html.dark .text-brand-300 { color: var(--brand-light) !important; }

/* B4-8: Termine im Kalender und Anhang-Verweise sind Bedienziele (>= 32 px). */
.fc .fc-event, .fc .fc-daygrid-event, .fc .fc-list-event-title a { min-height: 32px; display: flex; align-items: center; }
.fc .fc-timegrid-event .fc-event-main { min-height: 28px; }
.anhang-link { min-height: 32px; display: inline-flex; align-items: center; }

/* ====================================================================
   RUNDE 6, B4-8: Kalender-Spaltenkoepfe sind Verweise auf die Tagesansicht
   und massen 22 px Hoehe (gemessen in der Wochenansicht).
   ==================================================================== */
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 6px;
}

/* Achsenbeschriftung "Ganztaegig" lief bei 16 px ueber die 61 px breite Spalte
   hinaus (im Screenshot als "Ganztae..." abgeschnitten sichtbar). */
.fc .fc-timegrid-axis-frame { justify-content: flex-end; padding-inline-end: 6px; }
.fc .fc-timegrid-axis-cushion {
  font-size: 11px;
  line-height: 1.25;
  white-space: normal;
  text-align: right;
  max-width: 100%;
}
/* Die Achsenspalte war 48-61 px breit; "Ganztaegig" braucht 57 px und wurde
   von FullCalendars overflow:hidden geschnitten. FullCalendar setzt die Breite
   ueber <col> in der Scrollgrid-Tabelle - dort muss die Korrektur ansetzen. */
.fc .fc-scrollgrid colgroup col:first-child { width: 84px !important; }
.fc .fc-timegrid-axis, .fc .fc-timegrid-slot-label { min-width: 84px; }
.fc .fc-timegrid-axis-frame { overflow: visible; }

/* ====================================================================
   Abnahme 1.dialog.Statusmenue: bei offenem Seitenpanel lagen die rechten
   Spalten der Liste (Status-Pille bei x=1132) unter dem Panel ab x=1040 -
   sichtbar, aber nicht bedienbar. Der Inhalt weicht dem Panel jetzt aus.
   ==================================================================== */
@media (min-width: 768px) {
  main.inhalt-neben-panel { padding-right: min(560px, 50vw); }
}

/* ====================================================================
   Abnahme 5.mobil: der Chat-Knopf verdeckte bei 375 px Bedienelemente
   (Kunden, Anfragen, Profil, Einstellungen). Unter 768 px fuehrt der Weg
   zum Chat ueber das Mehr-Menue, das nichts ueberlagert.
   ==================================================================== */
@media (max-width: 767px) {
  .fab { display: none !important; }
}

/* ====================================================================
   Abgeschwaechte Eintraege (Spam, abgelehnt, erledigt, vergangen, widerrufen).
   Frueher opacity-50/60/70: die Deckkraft mischte den Text mit dem Hintergrund und
   der Kontrast fiel auf 2.71-4.09 (axe). Jetzt wird die Flaeche gedaempft, der Text
   bleibt voll deckend und nutzt die gedaempfte Textfarbe des Themes.
   ==================================================================== */
.eintrag-gedaempft { background: var(--bg-soft) !important; }
.eintrag-gedaempft .text-ink-100,
.eintrag-gedaempft .text-ink-200 { color: var(--ink-2) !important; }
.eintrag-gedaempft .text-ink-300,
.eintrag-gedaempft .text-ink-400,
.eintrag-gedaempft .text-ink-500 { color: var(--ink-muted) !important; }

/* ====================================================================
   Karte: eine Kachelquelle (OpenStreetMap) fuer beide Themen. Im dunklen
   Thema wird die helle Kachel gefiltert statt einen zweiten Anbieter zu laden
   (CARTO lieferte ab 06.09.2026 "API KEY REQUIRED"-Kacheln).
   ==================================================================== */
html.dark .leaflet-tile-pane .tiles-dunkel {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.35);
}

/* ====================================================================
   Kunden-Detail: zentriertes Fenster (Emir: "das Popup war besser"),
   Aufteilung wie vor dem Umbau, Gestaltung aus den Tokens.
   ==================================================================== */
.kunden-modal {
  max-width: min(1200px, 92vw);
  width: min(1200px, 92vw);
}
.kunden-modal-kopf {
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
}
@media (max-width: 640px) {
  .kunden-modal { max-width: 100vw; width: 100vw; }
}

/* Fortschritt beim ersten Laden der Karte (vorher: leere Flaeche ohne Hinweis). */
.karten-fortschritt {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 500; display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 10px 14px; font-size: 13px; color: var(--ink-2); box-shadow: var(--shadow-md);
}
.karten-fortschritt .lade-punkt {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
  animation: lade-punkt 1s ease-in-out infinite;
}
@keyframes lade-punkt { 0%, 100% { transform: scale(0.7); } 50% { transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .karten-fortschritt .lade-punkt { animation: none; } }

/* Emir 06.09.: scrollbar, aber ohne sichtbare Leiste — in Popups, Menues und Listenflaechen.
   Die Seite selbst hat bereits keine sichtbare Leiste (GLOBAL-Block oben). */
.detail-panel, .modal-content, .menu-panel, .kanban-col, .kanban-column, .table-wrap, .scroll-still {
  scrollbar-width: none; -ms-overflow-style: none;
}
.detail-panel::-webkit-scrollbar, .modal-content::-webkit-scrollbar, .menu-panel::-webkit-scrollbar,
.kanban-col::-webkit-scrollbar, .kanban-column::-webkit-scrollbar, .table-wrap::-webkit-scrollbar, .scroll-still::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Kalender: Termintexte nicht hart abschneiden, Tooltip beim Hovern (Emir 06.09.) */
.fc .fc-event-title, .fc .fc-event-time { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; line-height: 1.25 !important; }
.fc .fc-timegrid-event .fc-event-main { overflow: hidden; }
.fc .fc-event-tip { cursor: pointer; }
.fc .fc-event-tip:hover { z-index: 5 !important; filter: brightness(1.12); }

/* === Mail-Editor (Tiptap) im Compose — nur der Nachrichtenteil der Vorlage === */
.mail-werkzeuge .wz { min-width: 30px; height: 28px; padding: 0 8px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.mail-werkzeuge .wz:hover { background: var(--bg); border-color: var(--border); color: var(--ink); }
.mail-werkzeuge .wz.aktiv { background: rgba(79,124,255,0.16); border-color: rgba(79,124,255,0.5); color: var(--brand-light, #4f7cff); }
.mail-werkzeuge .wz-trenner { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.mail-editor { position: relative; }
.mail-editor .ProseMirror { outline: none; min-height: 140px; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 25px; color: #1a1a1a; }
.mail-editor .ProseMirror p { margin: 0 0 14px 0; padding-left: 22px; border-left: 4px solid #FDB913; border-image: linear-gradient(180deg,#FDB913,#e0a30b) 1; }
.mail-editor[data-modus="frei"] .ProseMirror p { padding-left: 0; border-left: 0; }
.mail-editor .ProseMirror ul, .mail-editor .ProseMirror ol { margin: 0 0 14px 0; padding-left: 42px; }
.mail-editor .ProseMirror h2 { margin: 0 0 14px 0; padding-left: 22px; border-left: 4px solid #FDB913; font-size: 17px; line-height: 26px; color: #232F84; }
.mail-editor .ProseMirror a { color: #232F84; text-decoration: underline; }
.mail-editor .ProseMirror img { max-width: 100%; height: auto; border-radius: 8px; }
.mail-editor .ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: #9ca3af; float: left; height: 0; pointer-events: none; }
.mail-editor .ProseMirror:focus-within { box-shadow: 0 0 0 2px rgba(79,124,255,0.25); border-radius: 6px; }

/* A2: Variablen im Editor und als Chips */
.mail-editor .ProseMirror .var-token { background: rgba(253,185,19,0.22); border: 1px solid rgba(224,163,11,0.5); border-radius: 4px; padding: 0 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #6b4e00; }
.mail-editor .ProseMirror .var-token.var-leer { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.6); color: #991b1b; text-decoration: underline wavy #ef4444; }
.var-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--ink-2); font-size: 11px; cursor: pointer; max-width: 260px; }
.var-chip:hover { border-color: var(--brand); color: var(--ink); }
.var-chip .var-chip-wert { color: var(--ink-3); font-family: ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.var-chip.var-chip-leer { border-color: rgba(239,68,68,0.5); color: #f87171; }

/* A3: Textbaustein-Popover im Compose */
.snippet-popover { position: absolute; z-index: 30; left: 16px; right: 16px; max-width: 560px; margin-top: 2px; background: var(--surface); border: 1px solid var(--border-strong, var(--border)); border-radius: 10px; box-shadow: 0 18px 40px -18px rgba(0,0,0,0.6); overflow: hidden; }
.snippet-zeile { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 6px 10px; font-size: 12px; background: transparent; border: 0; color: var(--ink-2); cursor: pointer; }
.snippet-zeile:hover, .snippet-zeile.aktiv { background: rgba(79,124,255,0.12); }

/* Reporting: Mail-Leistung (E1) */
.rp-kachel { padding: 10px 12px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--border-soft, var(--border)); }
.rp-kachel-l { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.rp-kachel-w { font-size: 20px; font-weight: 700; color: var(--ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
/* Sequenzen (C1–C5): Editor, Schritte, Liste, Report */
.seq-editor, .seq-report { padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-soft); margin-bottom: 12px; }
.seq-schritte { display: flex; flex-direction: column; gap: 6px; }
.seq-schritt { display: grid; grid-template-columns: 24px 88px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border-soft, var(--border)); border-left: 3px solid var(--brand); }
.seq-schritt[data-typ="wait"] { border-left-color: var(--ink-3); }
.seq-schritt[data-typ="condition"] { border-left-color: #f59e0b; }
.seq-schritt[data-typ="task"] { border-left-color: #10b981; }
.seq-schritt-nr { width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--bg-soft); color: var(--ink-2); }
.seq-schritt-typ { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.seq-schritt-knoepfe { display: flex; gap: 6px; font-size: 14px; }
.seq-schritt-knoepfe button { min-width: 24px; min-height: 24px; }
.seq-zeile { display: flex; align-items: center; gap: 10px; font-size: 12px; padding: 6px 12px; border-radius: 8px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); }
.seq-punkt { width: 8px; height: 8px; border-radius: 999px; background: var(--ink-3); flex-shrink: 0; }
.seq-punkt.an { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }
.seq-kpi { padding: 4px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border-soft, var(--border)); color: var(--ink-2); }
.seq-kpi b { color: var(--ink); }
.seq-tabelle { width: 100%; font-size: 12px; border-collapse: collapse; }
.seq-tabelle th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 4px 8px; border-bottom: 1px solid var(--border); }
.seq-tabelle td { padding: 5px 8px; border-bottom: 1px solid var(--border-soft, var(--border)); color: var(--ink-2); }
@media (max-width: 767px) {
  .seq-schritt { grid-template-columns: 24px 1fr auto; }
  .seq-schritt-felder { grid-column: 1 / -1; }
  .seq-schritt-knoepfe button { min-width: 38px; min-height: 38px; }
}

/* ====================================================================
   COMPOSE als rechtes Panel (F1) — Kontext links, Nachricht rechts; mobil Vollbild
   ==================================================================== */
.mail-scrim { position: fixed; inset: 0; z-index: 9000; background: var(--modal-backdrop); display: flex; justify-content: flex-end; animation: fadeIn 160ms ease-out; }
.mail-panel { position: relative; height: 100%; width: min(1240px, 92vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: -24px 0 60px -30px rgba(0,0,0,0.6); display: flex; flex-direction: column; min-height: 0; animation: mailSlideIn 260ms cubic-bezier(.22,.8,.3,1); }
@keyframes mailSlideIn { from { transform: translateX(28px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.mail-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border-soft, var(--border)); flex-shrink: 0; }
.mail-panel-body { display: flex; flex: 1; min-height: 0; }
.mail-rail { width: 300px; flex-shrink: 0; overflow-y: auto; padding: 14px 14px 20px 16px; border-right: 1px solid var(--border-soft, var(--border)); background: var(--bg-soft); display: flex; flex-direction: column; gap: 8px; }
.mail-rail-titel { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.mail-rail-kontext { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border-soft, var(--border)); }
.mail-rail .tpl-row { font-size: 12px; }
.mail-rail .max-h-\[280px\] { max-height: none !important; }
.mail-main { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; position: relative; }
.mail-main-kopf { padding: 12px 18px 10px 18px; border-bottom: 1px solid var(--border-soft, var(--border)); flex-shrink: 0; }
.mail-kopf { display: flex; flex-direction: column; gap: 6px; }
.mail-zeile { display: flex; align-items: center; gap: 10px; }
.mail-label { width: 58px; flex-shrink: 0; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); text-align: right; }
.mail-chips { flex: 1; min-height: 34px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); cursor: text; }
.mail-chips:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,124,255,0.18); }
.mail-feld { flex: 1; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--ink); font-size: 13px; }
.mail-feld:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,124,255,0.18); }
.mail-feld-betreff { font-weight: 600; font-size: 14px; }
.mail-main > .mail-werkzeuge, .mail-main > [id="mail-variablen"] { flex-shrink: 0; }
.mail-main > footer { flex-shrink: 0; border-radius: 0; }
@media (max-width: 1023px) { .mail-rail { width: 240px; } }
@media (max-width: 767px) {
  .mail-panel { width: 100vw; border-left: none; }
  .mail-panel-body { flex-direction: column; overflow-y: auto; }
  .mail-rail { width: 100%; border-right: none; border-bottom: 1px solid var(--border-soft, var(--border)); max-height: 34vh; }
  .mail-label { width: 48px; }
  .mail-main { min-height: 60vh; }
  .mail-main > footer { position: sticky; bottom: 0; z-index: 5; padding: 8px 12px !important; }
  /* Kritiker P1-7/P2-7: 16-px-Felder (kein iOS-Zoom), Touch-Ziele >= 38 px */
  .mail-feld, .mail-chips input, #compose-subject { font-size: 16px !important; }
  .mail-werkzeuge .wz, .var-chip, .snippet-zeile { min-height: 38px; }
  .mail-werkzeuge .wz { min-width: 38px; }
  .mail-main-kopf { padding: 10px 12px 8px 12px; }
  .mail-rail { padding: 10px 12px 12px 12px; }
}

/* ====================================================================
   POSTFACH dreispaltig (F2): Liste · Faden · Kontext
   ==================================================================== */
.postfach { display: flex; flex-direction: column; gap: 10px; }
/* Postfach: Hauptbildschirm fest, nur Liste/Faden/Kontext rollen (Emir 07.09.). Mobil bleibt die Seite rollbar. */
@media (min-width: 1024px) {
  html.pf-fest, html.pf-fest body { overflow: hidden; height: 100%; }
  .postfach { height: calc(100vh - var(--pf-oben, 120px) - 12px); }
  .postfach > .pf-banner { flex-shrink: 0; }
  .postfach > .pf-raster { flex: 1 1 auto; min-height: 0; height: auto; }
}
.pf-banner { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; font-size: 12px; border: 1px solid; }
.pf-banner-rot { background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.4); color: #fca5a5; }
.pf-banner-gelb { background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.4); color: #fcd34d; }
.pf-banner-grau { background: var(--bg-soft); border-color: var(--border); color: var(--ink-2); }
.pf-raster { display: grid; grid-template-columns: minmax(280px, 320px) minmax(0, 1fr) 250px; gap: 10px; height: calc(100vh - var(--tb, 96px) - 44px); min-height: 520px; }
.pf-raster.pf-kontext-zu { grid-template-columns: minmax(280px, 320px) minmax(0, 1fr); }
.pf-raster.pf-kontext-zu > .pf-kontext { display: none; }
.pf-liste, .pf-faden, .pf-kontext { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.pf-liste-kopf { padding: 10px 12px; border-bottom: 1px solid var(--border-soft, var(--border)); flex-shrink: 0; }
.pf-liste-koerper { flex: 1; overflow-y: auto; }
.pf-filter { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.pf-filter.aktiv { border-color: var(--brand); color: var(--brand-light, #4f7cff); background: rgba(79,124,255,0.12); }
.pf-zeile { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 10px 12px 10px 8px; border-bottom: 1px solid var(--border-soft, var(--border)); background: transparent; border-left: 3px solid transparent; transition: background var(--dur-fast, 120ms); }
.pf-zeile:hover { background: var(--bg-soft); }
.pf-zeile.aktiv { background: rgba(79,124,255,0.10); border-left-color: var(--brand); }
.pf-punkt { width: 7px; height: 7px; border-radius: 999px; margin-top: 8px; flex-shrink: 0; background: transparent; }
.pf-zeile.ungelesen .pf-punkt { background: var(--brand); box-shadow: 0 0 0 3px rgba(79,124,255,0.18); }
.pf-avatar { width: 30px; height: 30px; border-radius: 999px; flex-shrink: 0; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.pf-leer { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 20px; }
.pf-faden-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-soft, var(--border)); flex-shrink: 0; flex-wrap: wrap; }
.pf-faden-kopf > .flex { flex-wrap: wrap; }
.pf-faden-koerper { flex: 1; min-height: 0; overflow: hidden; padding: 10px 14px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.pf-verlauf { flex: 0 1 auto; max-height: 30%; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.pf-nachricht { display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; }
.pf-nachricht.aus { background: rgba(79,124,255,0.06); border-color: rgba(79,124,255,0.14); margin-left: 28px; }
.pf-nachricht.ein { background: var(--bg-soft); border-color: var(--border-soft, var(--border)); margin-right: 28px; }
.pf-nachricht.offen { border-color: var(--brand); }
.pf-reader { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: 4px; }
.pf-iframe { width: 100%; height: 100%; min-height: 0; border: 0; flex: 1 1 auto; }
.pf-kontext { overflow-y: auto; }
.pf-kontext-titel { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.pf-vorschlag { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); }
.pf-vorschlag:hover { border-color: var(--brand); background: rgba(79,124,255,0.08); }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 1279px) { .pf-raster { grid-template-columns: minmax(250px, 290px) minmax(0, 1fr) 230px; } .pf-raster.pf-kontext-zu { grid-template-columns: minmax(250px, 290px) minmax(0, 1fr); } }
@media (max-width: 1023px) {
  /* Mobil/Tablet: EINE Spalte je Sicht (Liste → Faden → Kontext), F4 */
  .pf-raster { grid-template-columns: minmax(0, 1fr); height: auto; min-height: calc(100vh - var(--tb, 96px) - 40px); }
  .pf-raster > * { display: none; }
  .pf-raster.pf-sicht-list > .pf-liste, .pf-raster.pf-sicht-reader > .pf-faden, .pf-raster.pf-sicht-kontext > .pf-kontext { display: flex; }
  .pf-raster.pf-kontext-zu.pf-sicht-kontext > .pf-kontext { display: flex; }
  .pf-faden-koerper { overflow-y: auto; }
  .pf-verlauf { max-height: none; overflow: visible; }
  .pf-reader { flex: none; min-height: 60vh; }
  .pf-iframe { min-height: 60vh; }
  .pf-faden, .pf-liste, .pf-kontext { height: calc(100vh - var(--tb, 96px) - 40px); }
}
