/* ================= CRM Light – Styles (Viakom-Branding, Farben von viakom.de) ================= */
:root {
  --viakom-primary-blue: #00517A;
  --viakom-dark-blue: #002D43;
  --viakom-green: #DEDC00;
  --bg: #f4f4f4;               /* viakom-hell-gray */
  --panel: #ffffff;
  --border: #e2e7ee;
  --text: #353535;             /* viakom-text */
  --muted: #66788c;
  --accent: var(--viakom-primary-blue);
  --accent-soft: #e0ecf3;
  --blue: var(--viakom-primary-blue);
  --green: #1e8a4c;
  --amber: #c07f10;
  --red: #c23b3b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20,35,60,.08);
  /* semantische Töne (Dark Mode überschreibt sie in body.theme-dark) */
  --hover: #f7f9fc;
  --line-soft: #eef1f6;
  --thead-bg: #fafbfd;
  --input-bg: #ffffff;
  --kcol-bg: #eef1f6;
  --outcome-bg: #f2f0ec;
  --badge-bg: #edf1f6;
  --badge-text: #44586e;
  --border-strong: #b9c4d2;
  --side-bg: #ffffff;
  --side-line: #e2e7ee;
  --side-text: #3d4f60;
  --side-muted: #9aa9b7;
  --chart-won: #00917c;   /* validiert (CVD) gegen helle Fläche */
  --chart-lost: #dd5871;
  font-size: 15px;
}

/* ---------- Dark Mode (Umschalter in der Sidebar; Default folgt dem OS) ---------- */
body.theme-dark {
  --bg: #0e161e;
  --panel: #16212c;
  --border: #26364a;
  --text: #dde6ee;
  --muted: #8ea3b5;
  --accent: #3d9bd4;
  --accent-soft: #14324a;
  --blue: #5db3e6;
  --green: #56c48a;
  --amber: #e0a23e;
  --red: #e57373;
  --shadow: 0 1px 3px rgba(0,0,0,.45);
  --hover: #1b2836;
  --line-soft: #223140;
  --thead-bg: #19242f;
  --input-bg: #0f1922;
  --kcol-bg: #121c26;
  --outcome-bg: #171e26;
  --badge-bg: #24344a;
  --badge-text: #b9c9d8;
  --border-strong: #3b5268;
  --side-bg: #101a24;
  --side-line: #223140;
  --side-text: #c3d2df;
  --side-muted: #71879a;
  --chart-won: #00997e;   /* validiert (CVD) gegen dunkle Fläche */
  --chart-lost: #dd5871;
}
body.theme-dark .badge.green { background: #14352a; color: #6fd39c; }
body.theme-dark .badge.amber { background: #3a2d12; color: #eab965; }
body.theme-dark .badge.blue { background: #14324a; color: #7cc4ef; }
body.theme-dark .badge.red { background: #3d1d1d; color: #ef9a9a; }
body.theme-dark .badge.acc { background: #14324a; color: #7cc4ef; }
body.theme-dark .kcard.warn { background: #2a1a1a; border-color: #5a3030; }
body.theme-dark .dupe-box { background: #33270f; border-color: #5c4a1e; }
body.theme-dark .funnelviz .fbar { color: #eaf3fa; }
* { box-sizing: border-box; margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); height: 100vh; overflow: hidden;
}

/* ---------- Offline-Banner ---------- */
#offline-banner {
  display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: #c07f10; color: #fff; text-align: center; font-size: 13px; padding: 7px 12px;
}
body.offline #offline-banner { display: block; }

/* ---------- Login ---------- */
#login-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,#002D43 0%,#00517A 100%);
}
.login-card {
  background: #fff; border-radius: 14px; padding: 38px 42px; width: 420px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card label { font-size: 13px; color: var(--muted); display:block; margin: 14px 0 4px; }
.login-card input, .login-card button { width: 100%; }
.login-error {
  margin-top: 14px; background: #fbe7e7; color: var(--red);
  border-radius: 8px; padding: 10px 12px; font-size: 13px;
}
.brandmark { color: var(--accent); font-weight: 800; letter-spacing: .5px; }

/* ---------- Layout ---------- */
#app { display: none; height: 100vh; }
#app.active { display: grid; grid-template-columns: 220px 1fr; }
aside {
  background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column;
  border-right: 1px solid var(--side-line);
}
.side-brand { padding: 16px 14px 13px 18px; border-bottom: 1px solid var(--side-line); display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.side-brand .t1 { font-weight: 800; font-size: 17px; color: var(--viakom-dark-blue); }
body.theme-dark .side-brand .t1 { color: #fff; }
.side-brand .t1-accent { color: var(--viakom-primary-blue); }
body.theme-dark .side-brand .t1-accent { color: var(--viakom-green); }
.side-brand .t2 { font-size: 11.5px; color: var(--side-muted); margin-top: 3px; line-height: 1.35; }
.side-iconbtn {
  background: transparent; border: none; color: var(--side-muted); padding: 3px 9px;
  font-size: 15px; border-radius: 7px; cursor: pointer; line-height: 1.2;
}
.side-iconbtn:hover { background: var(--hover); color: var(--text); border-color: transparent; }
/* ---------- Firmenfokus (globaler Filter in der Sidebar) ---------- */
.side-filter { padding: 12px 14px; border-bottom: 1px solid var(--side-line); position: relative; background: var(--thead-bg); }
.side-filter .sf-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--side-muted); margin-bottom: 6px; }
.side-filter .sf-box { display: flex; gap: 4px; }
#gf-input { flex: 1; min-width: 0; background: var(--input-bg); border: 1px solid var(--border); color: var(--text); padding: 6px 8px; font-size: 12.5px; }
#gf-input::placeholder { color: var(--muted); }
#gf-input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
#gf-clear { display: none; background: var(--input-bg); border: 1px solid var(--border); color: var(--muted); padding: 4px 9px; }
#gf-clear:hover { border-color: var(--accent); }
.gf-drop {
  display: none; position: absolute; left: 10px; right: 10px; top: 62px;
  background: var(--panel); color: var(--text); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); z-index: 120; max-height: 320px; overflow: auto;
}
.gf-item { padding: 8px 10px; font-size: 12.5px; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.gf-item:last-child { border-bottom: none; }
.gf-item:hover { background: var(--hover); }
.gf-item .sub { color: var(--muted); font-size: 11px; }
.side-filter .chk { display: flex; gap: 6px; align-items: center; margin-top: 8px; color: var(--side-text); font-size: 12px; cursor: pointer; }
#gf-info { margin-top: 6px; color: var(--side-muted); font-size: 11.5px; min-height: 14px; }

/* Forecast: Projektsuche (Typeahead in der Toolbar, nutzt die gf-Item-Optik) */
.fc-search { position: relative; flex: 1; max-width: 460px; }
.fc-search input { width: 100%; }
/* Der aufklappbare Kasten zum Hinzuholen (#134): steht zwischen Kopfzeile und
   Filterleiste, damit das Erweitern der Liste nicht zwischen den Filtern sitzt. */
.fc-addbox { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.fc-drop { left: 0; right: 0; top: calc(100% + 4px); border: 1px solid var(--line-soft); }

/* ---------- Forecast: Planungsraster (Painter, lesend — DESIGN.md #34) ----------
   Sequenzielle Blau-Rampe (ein Farbton, monoton hell→dunkel; Textkontrast je
   Stufe ≥ 4,5:1, mit dem dataviz-Validator geprüft). Dark Mode bekommt eigene
   Stufen gegen die dunkle Fläche — kein automatischer Flip. */
:root {
  --fc-h1: #d9e8f2; --fc-h2: #aecfe3; --fc-h3: #7fb2d1;
  --fc-h4: #37749f; --fc-h5: #2a5f88; --fc-h6: #143c5c;
  --fc-ink-low: #26343f;   /* Text auf hellen Stufen */
  --fc-ink-high: #ffffff;  /* Text auf dunklen Stufen */
  --fc-holi: #fdf3e0;      /* feiertagsgemindertes Segment (leere Zelle) */
}
body.theme-dark {
  --fc-h1: #1c3245; --fc-h2: #244661; --fc-h3: #2e5d80;
  --fc-h4: #4b8cb8; --fc-h5: #6dabd6; --fc-h6: #8fc4e8;
  --fc-ink-low: #dde6ee;
  --fc-ink-high: #0e161e;
  --fc-holi: #2e2712;
}
.fc-scroll { overflow: auto; max-height: calc(100vh - 340px); border: 1px solid var(--border); border-radius: 8px; }
/* Fester Spaltenraster: table-layout fixed + colgroup ⇒ alle KW-Spalten exakt
   gleich breit, unabhängig vom Inhalt (explizit wichtig). */
table.fc-grid { table-layout: fixed; width: max-content; border-collapse: separate; border-spacing: 0; font-size: 11.5px; }
.fc-grid th, .fc-grid td { border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); white-space: nowrap; overflow: hidden; }
.fc-grid thead th { position: sticky; top: 0; z-index: 3; background: var(--thead-bg); padding: 3px 4px; height: 24px; font-size: 11px; text-transform: none; letter-spacing: 0; text-align: center; }
.fc-grid thead tr + tr th { top: 24px; height: 30px; }
.fc-grid thead th.fc-monat { text-align: left; font-weight: 700; }
.fc-grid thead th.fc-kw { padding: 2px 1px; line-height: 1.15; vertical-align: top; }
.fc-grid .fc-at { font-size: 9px; color: var(--muted); font-weight: 400; }
.fc-grid .fc-at-holi { color: var(--amber); font-weight: 700; }
.fc-grid .fc-name { position: sticky; left: 0; z-index: 2; background: var(--panel); text-align: left; padding: 5px 10px; font-weight: 600; font-size: 12.5px; }
.fc-grid thead .fc-name { z-index: 4; background: var(--thead-bg); }
.fc-grid .fc-name .badge { margin-left: 6px; font-size: 10px; padding: 1px 6px; }
.fc-grid tbody td, .fc-grid tfoot td { padding: 0; }
.fc-grid tbody td.fc-name, .fc-grid tfoot td.fc-name { padding: 5px 10px; }
.fc-grid .fc-cell { height: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.fc-grid .fc-sumcol { text-align: right; padding: 5px 8px; font-weight: 700; font-variant-numeric: tabular-nums; position: sticky; right: 0; z-index: 2; background: var(--panel); border-left: 1px solid var(--border); }
.fc-grid thead .fc-sumcol { background: var(--thead-bg); z-index: 4; }
.fc-grid tfoot td { border-top: 1px solid var(--border); background: var(--thead-bg); font-weight: 700; }
.fc-grid tfoot td.fc-name, .fc-grid tfoot td.fc-sumcol { background: var(--thead-bg); }
.fc-grid tbody tr:hover { background: transparent; }  /* Heatmap nicht überdecken */
/* Heat-Stufen (Zellhintergrund trägt die Magnitude, Text bleibt lesbar) */
.fc-h1 { background: var(--fc-h1); color: var(--fc-ink-low); }
.fc-h2 { background: var(--fc-h2); color: var(--fc-ink-low); }
.fc-h3 { background: var(--fc-h3); color: var(--fc-ink-low); }
.fc-h4 { background: var(--fc-h4); color: var(--fc-ink-high); }
.fc-h5 { background: var(--fc-h5); color: var(--fc-ink-high); }
.fc-h6 { background: var(--fc-h6); color: var(--fc-ink-high); }
/* ---------- Soll/Ist-Teilspalten + Auslastungsfarbe (DESIGN.md #47) ----------
   Tinten: Text-Kontrast ≥ 9:1 (validate_palette.js contrast()); Delta-Pole =
   --chart-won/--chart-lost (CVD-validiert, #25) mit Kursiv/Schraffur als
   Zweitkodierung. Dark Mode eigene Tinten, kein automatischer Flip. */
:root {
  --fc-dplus: #d3ece6;   /* Mehrleistung (Ist > Soll) */
  --fc-dminus: #f8dde3;  /* Minderleistung */
  --fc-luft: #ddf0e4;    /* Restkapa > 0 — Stunden erhöhbar */
  --fc-voll: #e0ecf3;    /* exakt ausgeplant */
  --fc-ueber: #f6d9d9;   /* überbucht (zusätzlich Schraffur) */
}
body.theme-dark {
  --fc-dplus: #113b33; --fc-dminus: #43222b;
  --fc-luft: #14352a; --fc-voll: #14324a; --fc-ueber: #3d1d1d;
}
.fc-grid td.fc-luft { background: var(--fc-luft); }
.fc-grid td.fc-voll { background: var(--fc-voll); }
.fc-grid td.fc-ueber { background: var(--fc-ueber); }
.fc-grid td.fc-schraffur { background-image: repeating-linear-gradient(45deg,
  transparent 0 4px, rgba(194,59,59,.30) 4px 6px); }
body.theme-dark .fc-grid td.fc-schraffur { background-image: repeating-linear-gradient(45deg,
  transparent 0 4px, rgba(229,115,115,.35) 4px 6px); }
/* Soll|Ist-Teilspalte: rechts kursiv das Ist, getönt nach Delta-Richtung */
.fc-si { display: flex; align-items: stretch; height: 100%; }
.fc-si .s { flex: 1 1 50%; text-align: right; padding: 5px 3px 0 0; }
.fc-si .i { flex: 1 1 50%; text-align: right; font-style: italic;
  border-left: 1px solid var(--border-strong); padding: 5px 3px 0 0; }
.fc-si .i.plus { background: var(--fc-dplus); }
.fc-si .i.minus { background: var(--fc-dminus); }
.fc-legend i.fc-luft { background: var(--fc-luft); }
.fc-legend i.fc-voll { background: var(--fc-voll); }
.fc-legend i.fc-ueber-i { background: var(--fc-ueber); background-image: repeating-linear-gradient(45deg,
  transparent 0 3px, rgba(194,59,59,.30) 3px 5px); }
.fc-legend i.fc-dplus-i { background: var(--fc-dplus); }
.fc-legend i.fc-dminus-i { background: var(--fc-dminus); }

/* Feiertagsgemindertes Segment: leere Zellen getönt, Kopf mit AT-Zahl in Amber */
.fc-grid td.fc-holi { background: var(--fc-holi); }
.fc-grid th.fc-holi { box-shadow: inset 0 -2px 0 var(--amber); }
/* Heute: linke Markierungslinie über Kopf und Spalte */
.fc-grid th.fc-today, .fc-grid td.fc-today { border-left: 2px solid var(--amber); }
/* Projekt-Termine (nur Markierung, nie Grenze) */
.fc-grid .fc-mark { color: var(--accent); font-size: 10px; margin-left: 1px; }
.fc-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); margin-top: 10px; }
.fc-legend i { display: inline-block; width: 13px; height: 13px; border-radius: 3px; margin-right: 4px; vertical-align: -2px; border: 1px solid var(--border); }
.fc-legend i.fc-holi { background: var(--fc-holi); }
.fc-legend i.fc-today-i { background: transparent; border: none; border-left: 2px solid var(--amber); border-radius: 0; width: 6px; }

/* ---------- Forecast: Zoom, Soll/Ist, Zeitraumwahl (Ticket 11, DESIGN.md #43) ---------- */
.fc-viewbar { padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.fc-viewbar .fc-brush { padding: 3px 10px; font-weight: 600; font-size: 12.5px; }
.fc-viewbar .fc-brush .badge { margin-left: 4px; }
.fc-fwsel { padding: 4px 6px; font-size: 12.5px; max-width: 130px; }

/* ---------- Forecast: Malen + Speichern (DESIGN.md #35) ---------- */
.fc-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.fc-brush { border: 2px solid var(--border-strong); border-radius: 8px; padding: 4px 12px;
  font-weight: 700; background: var(--panel); color: var(--text); cursor: pointer; }
.fc-brush.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.fc-custom { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.fc-custom input { width: 64px; padding: 4px 6px; }
.fc-tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.fc-tb-spacer { flex: 1; }
.fc-empsearch { min-width: 220px; max-width: 340px; }
/* Ein Balken, zwei Töne: rot für Konflikte/Beendet, amber für die
   EK/VK-Warnung oben auf der Projektseite (DESIGN.md #51) */
.fc-conflict, .fc-warnbar { padding: 8px 12px; border-radius: 8px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fc-conflict { margin: 0 0 10px; background: #fbe7e7; color: var(--red); }
body.theme-dark .fc-conflict { background: #3d1d1d; }
/* Ganzflächig klickbar — der Klick springt zur EK/VK-Karte */
.fc-warnbar { margin: 10px 0 0; background: #fdf3e0; color: var(--amber); cursor: pointer; }
body.theme-dark .fc-warnbar { background: #3a2d12; }
.fc-flash { animation: fc-flash 1.2s ease-out; }
@keyframes fc-flash { from { box-shadow: 0 0 0 2px var(--amber); } to { box-shadow: none; } }
.fc-grid { user-select: none; -webkit-user-select: none; }
.fc-grid td.fc-paint { cursor: crosshair; }
.fc-grid td.fc-dirty { box-shadow: inset 0 0 0 2px var(--accent); }
.fc-grid td.fc-lock { cursor: not-allowed;
  background-image: repeating-linear-gradient(45deg, transparent 0 3px, rgba(128,128,128,.28) 3px 5px); }
.fc-rowdel { border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 11px; padding: 0 2px; margin-left: 4px; }
.fc-rowdel:hover { color: var(--red); }
/* „Mitarbeiter austauschen" auf jeder Mitarbeiterzeile (DESIGN.md #37/#49) */
.fc-swaprow { border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 12px; padding: 0 2px; margin-left: 2px; }
.fc-swaprow:hover { color: var(--accent); }
.fc-swap-list { margin-top: 6px; max-height: 220px; overflow: auto;
  border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel); }
/* Umfangswahl des Austausch-Dialogs (#49): Radios + Grenz-Datum in einer Zeile */
#fc-swap-umfang { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#fc-swap-umfang > .muted:first-child { width: 100%; margin-bottom: -4px; }
.fc-swap-radio { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.fc-swap-radio input { margin: 0; }
#fc-swap-datum:disabled { opacity: .5; }
#fc-swap-kw { width: 100%; font-size: 11px; }
/* Projektwahl des projektübergreifenden Austauschs (Ticket 08, DESIGN.md #92):
   alle Projekte der Quellperson mit Stunden, einzeln abwählbar. */
.fc-swap-proj { display: flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 5px 10px; font-size: 12px; border-bottom: 1px solid var(--line-soft); }
.fc-swap-proj:last-child { border-bottom: none; }
.fc-swap-proj:hover { background: var(--thead-bg); }
.fc-swap-proj input { margin: 0; }
.fc-swap-proj > .muted { margin-left: auto; white-space: nowrap; }
/* Merkname der NN-Platzhalter (Ticket 05, DESIGN.md #54): im Projektkontext
   ist der Merkname der Zeilenname, der Kontoname steht klein darunter. */
.fc-nnbtn { border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 11px; padding: 0 2px; margin-left: 2px; }
.fc-nnbtn:hover { color: var(--accent); }
.fc-nnsub { font-size: 10.5px; font-weight: 400; color: var(--muted); margin-top: 1px; }
input.fc-nnedit { display: block; width: 100%; margin-top: 3px; font-size: 11px;
  padding: 2px 4px; font-weight: 400; }
.fc-nnmerk { font-size: 11px; margin-left: 4px; }
.fc-swap-merk { margin: 0 0 12px; padding: 8px 10px; border-radius: 8px;
  background: var(--thead-bg); }
.fc-legend i.fc-dirty-i { background: var(--panel); box-shadow: inset 0 0 0 2px var(--accent); }

/* Kapazitäts-Abgleich (DESIGN.md #36): der frühere rote Überbuchungs-Rahmen
   ist in der Auslastungsfarbe (#47, fc-ueber + Schraffur) aufgegangen */
/* Aufklappzeilen: andere Projekte + Verfügbar (Personio) + Delta (frei) */
.fc-exp { border: none; background: none; cursor: pointer; color: var(--muted);
  padding: 0 5px 0 0; font-size: 10px; vertical-align: 1px; }
.fc-exp:hover { color: var(--accent); }
.fc-grid tr.fc-caprow td { background-color: var(--thead-bg); height: 22px; color: var(--muted); }
.fc-grid tr.fc-caprow td.fc-capname { font-weight: 400; font-size: 11px; padding: 2px 10px 2px 24px; }
.fc-grid tr.fc-caprow td.fc-capcell { text-align: center; font-variant-numeric: tabular-nums; font-size: 10.5px; padding: 0 1px; }
.fc-grid tr.fc-caprow td.fc-capmsg { text-align: left; padding: 2px 10px; font-size: 11px; font-style: italic; }
/* Bearbeitbare Fremdprojekt-Zellen der Aufklappzeilen (Ticket 08, DESIGN.md #74):
   dieselbe Mal-Mechanik wie im Hauptraster, die Aufklappzeile bleibt aber
   optisch zurückgenommen — malbar erkennt man an Cursor und normaler
   Textfarbe (der Rest der Zeile ist gedämpft). Die Sperr-Schraffur kommt aus
   der einen Regel oben (`td.fc-lock`) — deshalb setzt die Zeile ihre Farbe als
   `background-color` und nicht als `background`-Shorthand, der das
   `background-image` der Schraffur weggeräumt hätte. Die Auslastungsfarbe
   bleibt bewusst dem Hauptraster vorbehalten (#47), damit die Hierarchie
   Zeile ⟶ Aufklappzeile lesbar bleibt. */
.fc-grid tr.fc-caprow td.fc-paint { color: var(--text); }
.fc-capaussen { color: var(--amber); font-size: 10px; }
.fc-capdelta { display: inline-block; min-width: 20px; border-radius: 3px; padding: 0 2px; }
.fc-capdelta.over { background: #fbe4e4; color: var(--red); font-weight: 700; }
body.theme-dark .fc-capdelta.over { background: #4a1f1f; }
.fc-legend i.fc-lock-i { background-image: repeating-linear-gradient(45deg, transparent 0 3px, rgba(128,128,128,.35) 3px 5px); }
.fc-chg-list { margin: 4px 0 10px; max-height: 260px; overflow: auto; display: grid; gap: 8px; }
.fc-chg-list .fc-chg-del { color: var(--red); }
/* ---------- Teamübersicht (DESIGN.md #87) ----------
   Eine durchgehende Tabelle im Raster-Look (.fc-grid, #34/#47): je Team zuerst
   die **gefärbte** Team-Summenzeile (abgesetzt wie ein Gruppenkopf, die Farbe
   kommt aus derselben Auslastungslogik wie die Zellen), darunter die neutrale
   Zeile „davon NN", dann die Personenzeilen. Keine neuen Farbwerte.
   **Wichtig:** Die Team-Summenzeile hinterlegt nur Namens- und Σ-Spalte — ihre
   Datenzellen bleiben der Auslastungsfarbe überlassen (eine Regel
   `tr.fc-team td { background }` hätte `td.fc-luft` & Co. überstimmt und die
   Zeile wäre grau statt gefärbt). Die NN-Zeile darf ganz hinterlegt werden:
   sie wird nie gefärbt. */
.fc-grid tr.fc-team td { font-weight: 700;
  border-top: 2px solid var(--border-strong); }
.fc-grid tr.fc-team td.fc-name, .fc-grid tr.fc-team td.fc-sumcol {
  background: var(--thead-bg); }
.fc-grid tr.fc-team td.fc-name { font-size: 12px; }
.fc-grid tr.fc-teamsammel td.fc-name { font-style: italic; }
.fc-grid tr.fc-teamnn td { background-color: var(--thead-bg); color: var(--muted);
  font-weight: 400; height: 22px; }
.fc-grid tr.fc-teamnn td.fc-name { font-weight: 400; font-size: 11px; }
.fc-teaminfo { font-weight: 400; font-size: 10.5px; color: var(--muted); margin-left: 6px; }
.fc-teampct { font-weight: 400; font-size: 10px; color: var(--muted); }
.fc-teammerk { font-weight: 400; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.fc-grid td.fc-teamperson { padding-left: 24px; }
/* KPI-Kachelzeile der Teamübersicht (Ticket 05): dieselben Kacheln wie im
   Portfolio (.fc-kpi). Nur die Überbuchungs-Kachel ist klickbar und trägt das
   sichtbar; die markierten Zeilen bekommen eine Kante an der Namensspalte
   (keine neue Farbe — das Rot der Überbuchung ist schon vergeben). */
.fc-kpi-klick { cursor: pointer; }
.fc-kpi-klick:hover { border-color: var(--accent); }
.fc-kpi-aktiv { border-color: var(--red); }
.fc-grid tr.fc-teamhit td.fc-name { box-shadow: inset 3px 0 0 var(--red); }
/* Aufklappzeilen der Teamübersicht (Ticket 06): dieselben `fc-caprow`-Zeilen
   wie im Painter. Die Namensspalte rückt eine Stufe tiefer ein als die
   Personenzeile, und der Rest/die Überbuchung steht als zweite Zeile unter den
   verfügbaren Stunden — im KW-Zoom passen zwei Zahlen nicht nebeneinander. */
.fc-grid tr.fc-teamdrill td.fc-capname { padding-left: 38px; }
.fc-grid tr.fc-teamdrill td.fc-capcell .fc-capdelta { display: block; font-size: 9.5px;
  line-height: 1.15; min-width: 0; }
/* Organigramm-Filter als Dropdown (Ticket 04): ein Popover über der Matrix,
   Optik des Firmenfokus-Dropdowns (Panel, Rahmen, Schatten). Der Baum kommt
   flach vom Server, die Einrückung setzt `tiefe` als Inline-Padding. */
.fc-teamddwrap { position: relative; display: inline-block; }
.fc-teamdd { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0;
  min-width: 340px; max-height: 70vh; overflow: auto; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.25); }
.fc-teamddkopf { display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 6px; }
.fc-teamddfuss { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px; }
.fc-teamnode { display: flex; align-items: center; gap: 6px; padding: 3px 0;
  font-size: 12px; white-space: nowrap; }
.fc-teamnode label { display: flex; align-items: center; gap: 6px; cursor: pointer;
  overflow: hidden; }
.fc-teamnodetxt { overflow: hidden; text-overflow: ellipsis; }
.fc-teamsub { background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 5px; font-size: 10px; padding: 1px 5px; cursor: pointer; flex: 0 0 auto; }
.fc-teamsub.on { background: var(--accent); border-color: transparent; color: #fff; }
/* ---------- Forecast-Detailseite: gemeinsame Tabellen-Optik (DESIGN.md #55) ----------
   Rechenweg (#39), Gewinn & Verlust (#40) und EK/VK-Sätze (#38) sprechen die visuelle
   Sprache des Painter-Rasters (#34/#47): kompakter Kopf ohne Versalien,
   Zell-Raster mit Spaltentrennern, Namensspalte etwas größer, tabellarische
   Ziffern, betonte Summenzeile und abgesetzte Gesamt-Spalte. Eine Quelle für
   alle drei Karten — die Karten selbst tragen nur noch, was ihnen eigen ist.
   Bewusst KEINE Pixel-Fluchtung mit dem Raster und keine Zoom-/Zeitraum-Kopplung:
   jede Tabelle behält ihre eigenen (automatischen) Spaltenbreiten. */
table.fc-tbl { font-size: 11.5px; }
.fc-tbl th, .fc-tbl td { border-right: 1px solid var(--line-soft); }
.fc-tbl th:last-child, .fc-tbl td:last-child { border-right: none; }
.fc-tbl thead th { padding: 3px 8px; height: 24px; font-size: 11px;
  text-transform: none; letter-spacing: 0; white-space: nowrap; }
.fc-tbl tbody td { padding: 4px 8px; vertical-align: middle; }
/* Erste Spalte = Zeilenname, wie die Namensspalte des Rasters */
.fc-tbl tbody td:first-child { font-weight: 600; font-size: 12.5px; }
/* Beitexte in den Zellen (Kontoname, Pflege-Hinweis) eine Stufe leiser als der
   Zellentext — wie .fc-nnsub im Raster; Knöpfe bleiben unberührt */
.fc-tbl td.small, .fc-tbl td div.small { font-size: 10.5px; }
.fc-tbl th.num, .fc-tbl td.num { text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Summenzeile in der Optik des Raster-Fußes (tfoot) */
.fc-tbl tr.fc-tbl-sum td { border-top: 1px solid var(--border-strong);
  background: var(--thead-bg); font-weight: 700; }
/* Gesamt-Spalte wie die Summenspalte des Rasters (.fc-sumcol) */
.fc-tbl th.fc-tbl-ges, .fc-tbl td.fc-tbl-ges { border-left: 1px solid var(--border);
  font-weight: 700; }
/* … außer wo die Gesamt-Zelle bloß einen Hinweis trägt (Rechenweg: „Default x %“) */
.fc-tbl td.fc-tbl-ges.muted { font-weight: 400; font-size: 11px; }
/* Zahlen-Eingaben in den Zellen: kompakt und rechtsbündig wie die Zahlen daneben.
   Dieselbe Quelle trägt die Projekt-Default-Felder des Rechenwegs (.fc-rwf) —
   sie stehen in der Toolbar außerhalb der Tabelle, sollen aber wie die
   Monatsfelder darunter aussehen (Review-Befund zu #55; Breite bleibt
   karteneigen). */
.fc-tbl input[inputmode="decimal"], .fc-rw input.fc-rwf { padding: 2px 6px; font-size: 12px;
  text-align: right; font-variant-numeric: tabular-nums; }

/* EK/VK-Pflege (Metadaten-Modul, DESIGN.md #38) */
.fc-meta input.fc-rate { width: 96px; }
.fc-meta tr.fc-meta-del td { opacity: .55; }
.fc-meta tr.fc-meta-del .fc-meta-nm { text-decoration: line-through; }
.fc-meta .fc-chg-del { color: var(--red); }

/* Artikelgruppen-Kette (Umsatzplanung Ticket 04, DESIGN.md #62): Picker je
   Zeile (Override) und der Projekt-Standard über der Tabelle. */
.fc-meta select.fc-gruppe { max-width: 240px; font-size: 12px; padding: 2px 4px; }
.fc-gruppe-standard { display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin: 0 0 10px; }
.fc-gruppe-standard select.fc-gruppe { max-width: 260px; }

/* Risikomodell + Rechenweg (Ticket 07, DESIGN.md #39): editierbare
   Monats-Faktoren; ein Monats-Override ist farblich markiert und per ↩
   entfernbar (zurück zum Projekt-Default). */
/* Zahlen-Ausrichtung, Zell-Kompaktheit und Summenzeile kommen aus der
   gemeinsamen Tabellen-Optik (.fc-tbl, #55) — hier steht nur das Karteneigene. */
.fc-rw input.fc-rwf { width: 56px; }
.fc-rw input.fc-rwf.fc-rw-ovr { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.fc-rw .fc-rw-del { border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 12px; padding: 0 2px; margin-left: 2px; }
.fc-rw .fc-rw-del:hover { color: var(--red); }
.fc-rw tr.fc-rw-fakt td:first-child { color: var(--muted); font-weight: 400; }
.fc-rw .fc-rw-def { display: inline-flex; align-items: center; gap: 6px; }
.fc-rw-ovr-i { display: inline-block; padding: 0 5px; border: 1px solid var(--accent);
  background: var(--accent-soft); border-radius: 4px; font-weight: 700; }

/* Stunden-Budget + Budget-Kennzahlen (Ticket 09, DESIGN.md #41/#52):
   KPI-Zeile des Fußbereichs (Muster des Prototyp-Fußbereichs) mit dem
   direkt editierbaren Stunden-Budget in der ersten Kachel. Die Ampel an
   „noch zu verplanen" nutzt die semantischen Töne (--green/--amber/--red,
   Dark Mode inklusive). */
.fc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px; margin-top: 14px; }
.fc-kpi { background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; }
.fc-kpi-l { font-size: 11.5px; color: var(--muted); }
.fc-kpi-v { font-size: 19px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.fc-kpi-s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.fc-ampel { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 5px; vertical-align: baseline; }
.fc-ampel-gruen { background: var(--green); }
.fc-ampel-gelb { background: var(--amber); }
.fc-ampel-rot { background: var(--red); }
.fc-neg { color: var(--red); font-weight: 600; }
/* Das Stunden-Budget wird in der Kachel selbst editiert — das Feld trägt
   darum die Optik des Kachelwerts (groß, rechtsbündig, tabellarisch). */
.fc-kpi input.fc-kpi-inp { width: 84px; padding: 1px 6px; text-align: right;
  font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Projekt-Termine im Statusblock (DESIGN.md #72): die Datumsfelder sitzen in
   den kv-Zellen und tragen darum deren Textgröße statt der Formular-Optik.
   Die Aktionszeile (Speichern/Verwerfen) erscheint nur mit Entwurf. */
.fc-termin input[type="date"] { padding: 2px 6px; font-size: 13px; }
.fc-termin-akt { display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap; margin-top: 12px; }

/* Projekt-Detailseite: die gestapelten Blöcke (Stammdaten, Raster, KPI-Zeile,
   Rechenweg, P&L, EK/VK) bekommen einen einheitlichen
   vertikalen Abstand — .card selbst hat bewusst keinen Margin. Muss nach
   .fc-kpis stehen (gleiche Spezifität, Reihenfolge entscheidet). */
.fc-stack > * + * { margin-top: 16px; }

/* Mitarbeitersicht (Ebene 3, Ticket 14, DESIGN.md #46): Gruppenkopf der
   Übersicht (Abteilung / Extern / NN-Pool) und der Namens-Link aus der
   Painter-Zeile bzw. auf die Projektzeilen der Vollansicht. */
tr.fc-grp td { background: var(--thead-bg); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px; color: var(--muted);
  padding: 7px 12px; border-bottom: 1px solid var(--border); }
.fc-emplink { color: inherit; cursor: pointer; text-decoration: none; }
.fc-emplink:hover { color: var(--accent); text-decoration: underline; }

/* Gewinn & Verlust je Monat (P&L) + Chart (Ticket 08, DESIGN.md #40). Die drei Serienfarben sind
   mit dem dataviz-Validator geprüft (hell gegen #ffffff, dunkel gegen #16212c;
   CVD- und Normalsicht-Abstände bestanden — der Kontrast-WARN des Grüns auf
   heller Fläche ist durch die Tabelle direkt über dem Chart abgedeckt). */
:root { --fc-s1: #2a78d6; --fc-s2: #eb6834; --fc-s3: #1baf7a; }
body.theme-dark { --fc-s1: #3987e5; --fc-s2: #d95926; --fc-s3: #199e70; }
/* Zahlen-Ausrichtung und Summenzeilen: gemeinsame Tabellen-Optik (.fc-tbl, #55) */
.fc-pnl tr.fc-pl-warn td { color: var(--amber); }
.fc-pl-warntext { color: var(--amber); }
.fc-pl-chartbox { overflow-x: auto; margin-top: 12px; }
.fc-pl-grid { stroke: var(--line-soft); stroke-width: 1; }
.fc-pl-grid.fc-pl-null { stroke: var(--border-strong); }
.fc-pl-tick { fill: var(--muted); font-size: 10px; }
.fc-pl-s1 { fill: var(--fc-s1); } .fc-pl-s2 { fill: var(--fc-s2); } .fc-pl-s3 { fill: var(--fc-s3); }
.fc-pl-grp:hover path { filter: brightness(1.08); }
.fc-pltip { position: fixed; z-index: 60; max-width: 260px; pointer-events: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; box-shadow: var(--shadow); }
.fc-pltip .fc-pltip-t { font-weight: 700; margin-bottom: 2px; }
.fc-pltip i { display: inline-block; width: 10px; height: 4px; border-radius: 2px;
  margin-right: 6px; vertical-align: 2px; }

/* Gesamtaufwand je Mitarbeiter × Monat (Ticket 05 forecast-ist, DESIGN.md #59).
   Die Tabelle trägt komplett die gemeinsame Optik (.fc-tbl, #55) — hier steht
   nur das Karteneigene: die nicht abrechenbaren Stunden stehen als „+x" leise
   neben der abrechenbaren Zahl (auch in der Summenzeile, darum das explizite
   font-weight gegen deren fett). Keine neuen Farbwerte, nur --muted — der
   Dark Mode (#24) zieht ohne Zutun mit. */
.fc-ga .fc-ga-nb { color: var(--muted); font-weight: 400; font-size: 10.5px; }

/* Umsatzpositionen je Projekt (Ticket 01 Umsatzplanung, DESIGN.md #61).
   Die Tabelle trägt komplett die gemeinsame Optik (.fc-tbl, #55) — hier steht
   nur das Karteneigene: editierbare Betrags-Zellen (Doppelklick), der
   Wareneinsatz als rotes Minus, die Artikelgruppe als leiser Inline-Select am
   Zeilenkopf und die durchgestrichene Stunden-Zeile bei Umsatzherkunft
   „Zahlungsplan". Keine neuen Farbwerte (--red/--muted/--accent) — der Dark
   Mode (#24) zieht ohne Zutun mit. */
.fc-umsatz td.fc-u-cell { cursor: cell; }
.fc-umsatz td.fc-u-cell:hover { background: var(--accent-soft); }
.fc-umsatz .fc-u-we { color: var(--red); }
.fc-umsatz .fc-u-bez { font-weight: 600; }
.fc-umsatz select.fc-u-ag { margin-top: 2px; max-width: 240px; font-size: 10.5px;
  padding: 1px 4px; color: var(--muted); font-weight: 400; }
.fc-umsatz select.fc-u-ag:hover, .fc-umsatz select.fc-u-ag:focus { color: var(--accent); }
.fc-umsatz input.fc-u-inp { width: 92px; padding: 1px 4px; text-align: right;
  font-size: 12px; font-variant-numeric: tabular-nums; }
.fc-umsatz .fc-u-aussen { color: var(--muted); font-weight: 400; white-space: nowrap; }
.fc-umsatz .fc-u-aussenbar { margin-top: 8px; padding: 6px 10px; border-radius: 8px;
  border: 1px dashed var(--border-strong); color: var(--muted); }
/* Nicht zählende Zeile: durchgestrichen, aber sichtbar (Umsatzherkunft
   „Zahlungsplan", #64) — in der Umsatzkarte und in der Gewinn-&-Verlust-
   Rechnung derselbe Griff; das erklärende Badge bleibt lesbar. */
.fc-umsatz tr.fc-u-aus td, .fc-pnl tr.fc-u-aus td {
  text-decoration: line-through; opacity: .6; }
.fc-umsatz tr.fc-u-aus .badge, .fc-pnl tr.fc-u-aus .badge { text-decoration: none; }
/* Zwischenüberschrift der beiden festen Abschnitte (Ticket 01 Runde 3,
   DESIGN.md #68) — Umsatz und Wareneinsatz. Optik des Tabellenkopfs (#55:
   Fläche var(--thead-bg), 11 px, fett, **keine** Versalien und kein
   Letterspacing), über die ganze Breite; ohne neuen Farbwert. */
.fc-umsatz tr.fc-u-abschnitt td { background: var(--thead-bg); font-size: 11px;
  font-weight: 700; }
.fc-umsatz tr.fc-u-abschnitt td .small { font-weight: 400; }
/* Zahlungsplan-Delta (Ticket 04 Runde 3, DESIGN.md #70): abgeleitete Zeilen
   unter dem Rohertrag — leiser als die Summenzeilen, mit dünner Trennlinie
   darüber; die Ampel-Punkte der Gesamt-Spalte sind die des Stunden-Budgets
   (.fc-ampel), also kein neuer Farbwert. */
.fc-umsatz tr.fc-u-delta td { color: var(--muted); }
/* Trennlinie nur **über dem Block**: die erste Δ-Zeile folgt auf die
   Rohertrag-Summenzeile, die weiteren aufeinander. */
.fc-umsatz tr.fc-tbl-sum + tr.fc-u-delta td { border-top: 1px dashed var(--border-strong); }
.fc-umsatz tr.fc-u-delta td.fc-tbl-ges { color: inherit; }
.fc-umsatz tr.fc-u-delta .fc-ampel { margin-right: 5px; }
.fc-umsatz td.fc-u-btns { text-align: right; }
.fc-umsatz .fc-u-add { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Komfort-Interaktionen der Karte (Ticket 02 Umsatzplanung, DESIGN.md #63):
   Malen entlang der Monate (Rahmen wie die ungespeicherten Zellen des Rasters,
   #35), ⠿-Griff und Drop-Kante der Sortierung, Inline-Feld der Bezeichnung.
   Wieder ohne neue Farbwerte — der Dark Mode (#24) zieht mit. */
.fc-umsatz td.fc-u-cell { user-select: none; }   /* keine Textauswahl beim Malen */
.fc-umsatz td.fc-u-malen { box-shadow: inset 0 0 0 2px var(--accent);
  background: var(--accent-soft); }
.fc-umsatz .fc-u-griff { cursor: grab; opacity: .45; margin-right: 6px;
  font-weight: 400; }
.fc-umsatz .fc-u-griff:hover { opacity: 1; color: var(--accent); }
.fc-umsatz .fc-u-name { cursor: text; }
.fc-umsatz .fc-u-name:hover { text-decoration: underline dotted; }
.fc-umsatz tr.fc-u-ziel-o td { border-top: 2px solid var(--accent); }
.fc-umsatz tr.fc-u-ziel-u td { border-bottom: 2px solid var(--accent); }
.fc-umsatz input.fc-u-bezinp { width: 100%; max-width: 260px; font-size: 12px;
  padding: 1px 4px; font-weight: 400; }

/* Ebene „Umsatzplan" (Ticket 05 Umsatzplanung, DESIGN.md #66).
   Zwei Matrizen untereinander (Umsatz, Wareneinsatz) in der gemeinsamen
   Tabellen-Optik (.fc-tbl, #55) — hier steht nur das Ebenen-eigene: die
   Bereichs-Überschrift, der Aufklapp-Pfeil der Artikelgruppe, die eingerückte
   Projektzeile und der Hinweiskasten. Keine neuen Farbwerte (--muted /
   --border-strong / --accent) — der Dark Mode (#24) zieht ohne Zutun mit. */
.fc-up-titel { margin: 18px 0 6px; font-size: 13px; font-weight: 700; }
.fc-up-caret { display: inline-block; width: 14px; transition: transform .15s; }
tr.fc-up-offen .fc-up-caret { transform: rotate(90deg); }
/* Projektzeile: eingerückt und eine Stufe leiser als der Gruppenkopf */
.fc-tbl tr.fc-up-proj td:first-child { padding-left: 28px; font-weight: 400;
  font-size: 11.5px; }
.fc-up-hinweis { margin-top: 12px; padding: 8px 12px; border-radius: 8px;
  border: 1px dashed var(--border-strong); color: var(--muted);
  display: grid; gap: 4px; }
.fc-up-hinweis strong { color: inherit; }

/* Filter-Hinweisleiste (DESIGN.md #98): eine Leiste je Seite für alle aktiven
   globalen Filter. Je Filter ein Chip mit Namen und eigenem ✕ — deshalb kein
   `margin-left:auto` mehr am Knopf, der jetzt zum Chip gehört. */
.filter-bar {
  background: var(--accent-soft); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; margin-bottom: 14px; font-size: 13px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.filter-bar .fb-lead { font-weight: 700; color: var(--accent); flex: 0 0 auto; }
.filter-bar .fb-chip {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 3px 4px 3px 9px;
}
.filter-bar .fb-x { padding: 1px 6px; font-size: 12px; line-height: 1.4; }

/* Vertriebsmitarbeiter-Filter (DESIGN.md #98): Knopf mit Zustandstext plus
   Checkbox-Popover, Optik des Organigramm-Filters (`.fc-teamdd`). Der Knopf
   trägt bei aktiver Auswahl den Akzent — eine gefilterte Seite ist nie zu
   übersehen. */
.vsf-wrap { position: relative; display: inline-block; }
.vsf-btn.on { background: var(--accent); border-color: transparent; color: #fff; font-weight: 700; }
.vsf-dd { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0;
  min-width: 300px; max-height: 70vh; overflow: auto; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.25); }
.vsf-ddkopf { display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 6px; }
.vsf-ddakt { display: flex; gap: 6px; flex: 0 0 auto; }
.vsf-ddfuss { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px; }
.vsf-person { display: flex; align-items: center; padding: 3px 0;
  font-size: 12px; white-space: nowrap; }
.vsf-person label { display: flex; align-items: center; gap: 6px; cursor: pointer;
  overflow: hidden; }
.vsf-persontxt { overflow: hidden; text-overflow: ellipsis; }

/* Zeitraumfilter (DESIGN.md #103): dieselbe Bauform wie der
   Vertriebsmitarbeiter-Filter — Knopf mit Zustandstext plus Popover. Im Popover
   stehen die Vorgaben gruppiert untereinander; die gewählte trägt den Akzent.
   Farben und Rahmen kommen aus den Design-Variablen, damit Hell und Dunkel
   ohne Sonderregel stimmen. */
.zr-wrap { position: relative; display: inline-block; }
.zr-btn.on { background: var(--accent); border-color: transparent; color: #fff; font-weight: 700; }
.zr-dd { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0;
  min-width: 240px; max-height: 70vh; overflow: auto; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.25); }
.zr-ddkopf { display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 6px; }
.zr-gruppe { margin-top: 8px; }
.zr-gruppentitel { text-transform: uppercase; letter-spacing: .6px; font-size: 10px;
  margin-bottom: 3px; }
/* Jede Vorgabe eine eigene Zeile — eine Liste liest sich schneller als ein
   Block aus Knöpfen, und die Gruppen bleiben erkennbar. */
.zr-dd .zr-item { display: block; width: 100%; text-align: left; margin-bottom: 2px;
  white-space: nowrap; }
.zr-item.on { background: var(--accent); border-color: transparent; color: #fff; font-weight: 700; }
.zr-ddfuss { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px;
  max-width: 260px; white-space: normal; }
/* Hinweis, wenn der gewählte Zeitraum hinter den geladenen Bestand zurückreicht */
.zr-luecke { margin: -6px 0 12px; padding: 7px 11px; border-radius: 8px;
  border: 1px dashed var(--border-strong); color: var(--muted); }
.zr-luecke strong { color: inherit; }

/* Doppelkalender-Dialog (DESIGN.md #104): Vorgaben-Spalte links, zwei
   Monatskalender rechts — ohne Fremdbibliothek, alle Farben aus den
   Design-Variablen (Hell und Dunkel ohne Sonderregel). */
.zr-dlg { display: grid; grid-template-columns: minmax(150px, auto) 1fr; gap: 18px; }
.zr-dlg-vorgaben { border-right: 1px solid var(--border); padding-right: 14px;
  max-height: 60vh; overflow: auto; }
.zr-dlg-vorgaben .zr-item { display: block; width: 100%; text-align: left;
  margin-bottom: 2px; white-space: nowrap; }
.zr-dlg-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.zr-dlg-nav span { margin: 0 4px; }
.zr-dlg-kalpaar { display: flex; gap: 16px; flex-wrap: wrap; }
.zr-kal-kopf { font-weight: 700; font-size: 13px; text-align: center; margin-bottom: 4px; }
.zr-kal-tbl { border-collapse: collapse; }
.zr-kal-tbl th { font-size: 10.5px; color: var(--muted); font-weight: 600;
  padding: 2px 0; text-align: center; width: 30px; }
.zr-kal-tbl td { padding: 1px; text-align: center; }
/* Der Tag selbst ist ein Knopf — Klickfläche und Tastaturfokus inklusive. */
.zr-tag { width: 28px; height: 26px; padding: 0; font-size: 12px; border-radius: 6px;
  background: transparent; border: 1px solid transparent; color: inherit; cursor: pointer; }
.zr-tag:hover { border-color: var(--border-strong); }
.zr-kal-tbl td.zr-t-in .zr-tag { background: var(--accent-soft); color: var(--accent); }
.zr-kal-tbl td.zr-t-von .zr-tag, .zr-kal-tbl td.zr-t-bis .zr-tag {
  background: var(--accent); border-color: transparent; color: #fff; font-weight: 700; }
.zr-kal-tbl td.zr-t-heute .zr-tag { text-decoration: underline; }
.zr-dlg-fuss { grid-column: 1 / -1; border-top: 1px solid var(--border);
  padding-top: 8px; }
@media (max-width: 700px) {
  .zr-dlg { grid-template-columns: 1fr; }
  .zr-dlg-vorgaben { border-right: none; border-bottom: 1px solid var(--border);
    padding-right: 0; padding-bottom: 10px; }
}

nav { flex: 1; padding: 8px 0; overflow-y: auto; }
nav .ngroup-t {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--side-muted); margin: 14px 18px 4px; font-weight: 700;
}
nav .ngroup:first-child .ngroup-t { margin-top: 4px; }
nav a {
  display: flex; align-items: center; gap: 9px; margin: 1px 10px; padding: 8px 10px;
  border-radius: 8px; color: var(--side-text); text-decoration: none; font-size: 14px; font-weight: 500;
}
nav a:hover { background: var(--hover); }
nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
nav .nico { width: 18px; height: 18px; flex: 0 0 18px; color: var(--side-muted); }
nav .nico svg { width: 18px; height: 18px; display: block; }
nav a.active .nico { color: var(--accent); }
nav .ntxt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user {
  padding: 12px 14px; border-top: 1px solid var(--side-line); font-size: 12.5px;
  display: grid; grid-template-columns: 38px 1fr; gap: 2px 10px; align-items: center;
}
.side-user .avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--viakom-primary-blue);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13.5px; grid-row: 1;
}
.side-user .who { min-width: 0; }
.side-user .name { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .role { color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .erp { font-size: 11px; color: var(--side-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .erp a { color: var(--side-muted); text-decoration: none; }
.side-user .erp a:hover { color: var(--accent); text-decoration: underline; }
.side-tools { grid-column: 1 / -1; display: flex; gap: 6px; margin-top: 8px; }
.side-tools button.small { flex: 1; }

/* ---------- Sidebar einklappbar ---------- */
body.nav-collapsed #app.active { grid-template-columns: 64px 1fr; }
body.nav-collapsed .side-brand { padding: 14px 8px; justify-content: center; }
body.nav-collapsed .side-brand > div { display: none; }
body.nav-collapsed .side-filter { display: none; }
body.nav-collapsed nav .ngroup-t { display: none; }
body.nav-collapsed nav a { justify-content: center; margin: 2px 8px; padding: 10px 8px; }
body.nav-collapsed nav a .ntxt { display: none; }
body.nav-collapsed .side-user { grid-template-columns: 1fr; justify-items: center; padding: 10px 6px; }
body.nav-collapsed .side-user .who, body.nav-collapsed .side-tools { display: none; }

main { overflow-y: auto; padding: 26px 30px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 14px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Komponenten ---------- */
button, .btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  border-radius: 8px; padding: 8px 14px; font-size: 13.5px; cursor: pointer;
}
button:hover { border-color: var(--border-strong); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: #003f5f; }
button.small { padding: 4px 9px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:disabled:hover { border-color: var(--border); }
button.primary:disabled:hover { background: var(--accent); }

input, select, textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  font-size: 13.5px; font-family: inherit; background: var(--input-bg); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--blue); }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search] { min-width: 260px; flex: 1; max-width: 380px; }
.toolbar label.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

/* Aktiv-Zustand lokaler Filter (DESIGN.md #108): **eine** Klasse für alle
   Seiten — sobald ein Suchfeld, ein Select, ein Haken oder ein Filterknopf
   nicht im Neutralzustand steht, trägt das Bedienelement den Akzent. Dieselbe
   Farbkombination wie `.chip.on` und `.badge.acc` (Rahmen `--accent` auf
   `--accent-soft`), damit Hell und Dunkel ohne Sonderregel stimmen.
   Der Klassenname steht in `FilterLogic.LOKALFILTER_KLASSE`.

   Bei Text- und Auswahlfeldern bleibt die **Schriftfarbe** bewusst unverändert:
   der eingegebene Suchbegriff und der gewählte Wert müssen gut lesbar bleiben,
   markiert wird der Rahmen. */
input.f-on, select.f-on {
  border-color: var(--accent); background: var(--accent-soft); font-weight: 600;
}
label.chk.f-on, .toolbar label.chk.f-on { color: var(--accent); font-weight: 600; }
button.f-on {
  border-color: var(--accent); background: var(--accent-soft);
  color: var(--accent); font-weight: 600;
}
/* Chip-Gruppen mit Neutralzustand „alle an" (Typ-Chips der Historie): dort
   bedeutet der Akzent am einzelnen Chip schon „eingeblendet", darum trägt die
   Gruppe den Aktiv-Zustand — ein zarter Rahmen, der die Chips nicht verschiebt. */
.hist-chips.f-on {
  border: 1px solid var(--accent); background: var(--accent-soft);
  border-radius: 22px; padding: 3px 6px; margin: -4px -7px;
}

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 18px 20px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border);
  background: var(--thead-bg); position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:hover { background: var(--hover); }
tbody tr.clickable { cursor: pointer; }
.table-wrap { max-height: calc(100vh - 240px); overflow: auto; border-radius: var(--radius); }
td.num, th.num { text-align: right; }

/* Fuß der Anzeige-Kappung (DESIGN.md #109): ehrlicher Zähler links, die beiden
   Anzeige-Knöpfe rechts. Bewusst **außerhalb** von `.table-wrap` — der Kasten
   scrollt, der Fuß soll stehen bleiben und ohne Scrollen erreichbar sein. */
.cap-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 8px 12px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
}
.cap-foot .cap-zaehler { font-weight: 700; flex: 0 0 auto; }
.cap-foot .cap-akt { display: flex; gap: 6px; flex: 0 0 auto; margin-left: auto; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px;
  font-weight: 600; background: var(--badge-bg); color: var(--badge-text); white-space: nowrap;
}
.badge.acc { background: var(--accent-soft); color: var(--accent); }
.badge.green { background: #e2f3e9; color: var(--green); }
.badge.amber { background: #fdf3e0; color: var(--amber); }
.badge.blue { background: #e3eef8; color: var(--blue); }
.badge.red { background: #fbe7e7; color: var(--red); }

/* Speicher-Chip (DESIGN.md #96/#118): die eine Statusanzeige je Seite —
   „Speichert …", solange die Schreib-Warteschlange arbeitet, danach kurz
   „Gespeichert". Er ersetzt die Erfolgs-Toasts der Autosave-Pfade (die sich
   gegenseitig überschrieben); Toasts bleiben Fehlern vorbehalten. Optik wie ein
   Badge, damit er in der Kopfzeile nicht schreit — der Punkt pulst, solange
   etwas unterwegs ist. */
.save-chip {
  display: inline-flex; align-items: center; gap: 6px; align-self: center;
  padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.save-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.save-chip-speichert { background: var(--accent-soft); color: var(--accent); }
.save-chip-speichert::before { animation: save-chip-puls 1s ease-in-out infinite; }
.save-chip-gespeichert { background: #e2f3e9; color: var(--green); }
@keyframes save-chip-puls { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) {
  .save-chip-speichert::before { animation: none; }
}

.star { text-decoration: none; font-size: 16px; color: #b9c4d2; }
.star:hover { color: #e0a800; }
.star.on { color: #e0a800; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
a.ext { color: var(--blue); text-decoration: none; }
a.ext:hover { text-decoration: underline; }
/* Klickpfad-Muster (DESIGN.md #145): der Stift ✎ neben jedem klickbaren
   Firmennamen öffnet das Modal „Firma bearbeiten" — dezent (muted), erst
   der Hover macht ihn deutlich; die Farben kommen aus den Design-Variablen,
   damit Hell und Dunkel ohne Sonderregel stimmen. */
button.firma-stift {
  background: transparent; border: none; color: var(--muted);
  padding: 0 3px; margin-left: 3px; font-size: 12px; line-height: 1.2;
  border-radius: 5px; cursor: pointer; vertical-align: baseline;
}
button.firma-stift:hover { color: var(--accent); background: var(--hover); }

/* ---------- Dashboard ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { padding: 16px 18px; }
.kpi .num { font-size: 24px; font-weight: 700; }
.kpi .lbl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
/* Anklickbare Kennzahl (Drilldown, DESIGN.md #112): Zeiger und ein deutlicher
   Hover-Zustand — man muss dem Element ansehen, dass es zu den Zeilen hinter
   der Zahl führt. Farben aus den Design-Variablen, damit Hell und Dunkel ohne
   Sonderregel stimmen. */
.kpi-klick { cursor: pointer; transition: border-color .12s, background .12s, transform .12s; }
.kpi-klick:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.kpi-klick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Drilldown-Auslöser, die keine Kachel sind (#113): Funnel-Balken,
   Forecast-Zeilen, Verteilungs-Balken, Zellen der Team-Tabelle. Der Zustand
   hängt am `data-dd` selbst — so kann kein Element klickbar aussehen, ohne
   eines zu sein, und keines klickbar sein, ohne so auszusehen. */
[data-dd] { cursor: pointer; }
.funnelviz .fbar[data-dd]:hover { filter: brightness(1.1); }
.bar-row[data-dd]:hover .bar-fill { filter: brightness(1.15); }
.bar-row[data-dd]:hover > span:first-child { color: var(--accent); }
td[data-dd]:hover { color: var(--accent); text-decoration: underline; }
/* Säulen eines Verlaufs-Diagramms und die Win-Rate-Kachel (#114) */
.colgroup[data-dd]:hover .colbar { filter: brightness(1.28); }
.colgroup[data-dd]:hover .collbl, .colgroup[data-dd]:hover .colval { color: var(--accent); }
.kpi[data-dd]:hover .num, .muted[data-dd]:hover { color: var(--accent); }

/* ---------- Kundenakte (DESIGN.md #136) ---------- */
.akte-tabs { display: flex; gap: 4px; margin: 4px 0 16px; border-bottom: 2px solid var(--border); flex-wrap: wrap; }
.akte-tabs button { border: none; background: transparent; padding: 8px 14px; cursor: pointer;
  font-size: 13.5px; color: inherit; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.akte-tabs button.akt { border-bottom-color: var(--accent); font-weight: 650; }
.akte-tabs button:hover { color: var(--accent); }
/* Alarm-Kachel (Mahnstopp): rote Zahl, dezent roter Rahmen */
.kpi.akte-alarm { border-color: color-mix(in srgb, var(--red) 55%, transparent); }
.kpi.akte-alarm .num { color: var(--red); }
/* Dezentes Firmen-Badge an Zeilen einer Tochter (Konzernsicht) */
.badge.akte-dim { opacity: .75; }
/* Balkenreihe „Umsatz je Kalenderjahr" (Ticket 03): eine Zeile je Jahr —
   Jahr · Balken · exakter Betrag; negatives Jahr (Gutschriften überwiegen) rot */
.akte-jahre { display: grid; gap: 6px; max-width: 560px; }
.akte-jahr { display: grid; grid-template-columns: 44px 1fr 110px; gap: 10px;
  align-items: center; font-size: 12.5px; }
.akte-jahr .track { height: 12px; border-radius: 6px; background: var(--badge-bg); overflow: hidden; }
.akte-jahr .fill { display: block; height: 100%; border-radius: 6px 0 0 6px;
  background: var(--accent); opacity: .75; }
.akte-jahr .fill.neg { background: var(--red); }
.akte-jahr .num { text-align: right; font-variant-numeric: tabular-nums; }
.akte-jahr .num.neg { color: var(--red); }
/* Tab „Verträge" (Ticket 04): Gruppenkopf je Auftrag + Frühwarn-Ampel.
   Die Ampel färbt die Spalte „Kündbar bis"; „Frist abgelaufen" bleibt dezent
   (Badge), „stillschweigend verlängert"/„kein Laufzeitende" sind bewusst
   warnfarbenfrei (Kontroll- bzw. Pflegehinweis, kein Terminrisiko). */
.akte-vgrp td { background: var(--badge-bg); font-size: 12.5px; padding-top: 9px; padding-bottom: 9px; }
.akte-dat-rot { color: var(--red); font-weight: 650; }
.akte-dat-gelb { color: var(--amber); font-weight: 650; }
tr.akte-vpos { cursor: pointer; }
.akte-vcaret { display: inline-block; width: 14px; color: var(--muted); transition: transform .12s; }
tr.akte-vpos.offen .akte-vcaret { transform: rotate(90deg); }
.akte-vdetail td { background: var(--hover); }
.akte-vdetail .kv-grid { padding: 6px 2px; }
/* Belegkette (Ticket 06): Aufklapp-Detail eines Auftrags — sechs Blöcke mit
   kompakten Untertabellen; Beleg-Positionen werden lazy nachgeladen. */
.akte-kdetail { padding: 4px 2px 8px 14px; }
.akte-kdetail h4 { margin: 10px 0 4px; font-size: 11.5px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.akte-kdetail h4:first-child { margin-top: 2px; }
.akte-subtbl { border-collapse: collapse; min-width: 50%; }
.akte-subtbl td, .akte-subtbl th { padding: 4px 10px 4px 0; font-size: 12.5px;
  border-bottom: 1px solid var(--line-soft); text-align: left; }
.akte-subtbl th { color: var(--muted); font-weight: 600; }
.akte-subtbl td.num, .akte-subtbl th.num, .akte-subtbl .num { text-align: right;
  font-variant-numeric: tabular-nums; }
/* Körbe der Belegkette (Runde 2, Ticket 02): zugeklappte Abschnitte — die
   Kopfzeile ist ein Knopf (Tastatur + `aria-expanded` ohne Zusatzcode, Muster
   `fc-hist-kopf`), sieht aber aus wie die übrigen `h3` der Abschnitte. */
.akte-korb-kopf { background: none; border: none; padding: 0; font: inherit;
  color: inherit; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.akte-korb-kopf:hover { color: var(--accent); }
.akte-korb-pfeil { color: var(--muted); font-size: 12px; width: 10px; }
/* Tab „Aufwand" (Ticket 07): klick-sortierbare Spaltenköpfe */
th.akte-sort { cursor: pointer; user-select: none; white-space: nowrap; }
th.akte-sort:hover { color: var(--accent); }
/* Filterzeile des Tabellen-Baukastens (Runde 2, Ticket 03, DESIGN #149):
   zweite `<thead>`-Zeile mit einem Bedienelement je Spalte. Beide Kopfzeilen
   kleben oben — die Filterzeile direkt unter der Überschriftenzeile, darum
   bekommt diese eine **feste Höhe** (ihre Beschriftungen sind über
   `th.akte-sort` ohnehin einzeilig). */
table.akte-baukasten thead tr:first-child th {
  /* 9 + 16 + 10 + 1 px Rahmen = 36 px (Rahmen zählt mit, `box-sizing:
     border-box` gilt global) — die Zahl steht darum auch unten im `top`. */
  height: 36px; line-height: 16px; padding-top: 9px; padding-bottom: 10px;
}
table.akte-baukasten thead tr.akte-tfilter th {
  top: 36px; padding: 4px 6px; text-transform: none; letter-spacing: 0;
  font-weight: 400; z-index: 1;
}
.akte-spf {
  width: 100%; min-width: 62px; max-width: 190px; padding: 3px 6px;
  font-size: 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel); color: var(--text);
}
.akte-spf::placeholder { color: var(--muted); opacity: .8; font-style: italic; }
/* Werte-Auswahl der Filterzeile (DESIGN #156): Dropdown-Knopf mit
   Checkbox-Liste statt eines Einfach-Selects. Der Knopf sieht aus wie die
   übrigen Felder der Zeile (`.akte-spf`) und trägt bei wirksamer Auswahl den
   Aktiv-Zustand über `button.f-on`.

   Der Popover ist `position: fixed` und wird in JS positioniert
   (`App._aktePopPos`) — ein absolut positioniertes Kind würde vom scrollenden
   `.table-wrap` (`overflow: auto`) abgeschnitten und käme nie über die
   klebende Kopfzeile. */
.akte-wahl { position: relative; display: block; }
.akte-wahlbtn {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  cursor: pointer; text-align: left; line-height: 16px;
}
/* Dasselbe Element in der **Werkzeugleiste** (DESIGN #157, Wohnort-Regel): Der
   Knopf ersetzt dort die früheren Selects (Ampelzustand, Firma) und trägt
   darum deren Maße statt der schmalen Filterzeilen-Optik. Weil neben ihm keine
   Spaltenüberschrift steht, nennt er sein Kriterium selbst
   (`.akte-wahlname` — „Firma: alle"). */
.akte-wahltb {
  min-width: 150px; max-width: 300px; padding: 8px 10px; font-size: 13.5px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--input-bg); color: var(--text);
}
.akte-wahlname { flex: 0 0 auto; color: var(--muted); font-weight: 400; }
.akte-wahlbtn.f-on .akte-wahlname { color: inherit; }
.akte-wahltxt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-right: auto; }
.akte-wahlpfeil { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.akte-wahlbtn.f-on .akte-wahlpfeil { color: var(--accent); }
.akte-wahlpop {
  position: fixed; z-index: 60; left: 0; top: 0;
  min-width: 200px; max-width: 340px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.25);
  font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--text);
}
.akte-wahlkopf { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 6px; }
.akte-wahlliste { max-height: 46vh; overflow: auto; }
.akte-wahlzeile { display: flex; align-items: center; gap: 6px; padding: 2px 0;
  cursor: pointer; }
.akte-wahlzeile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.akte-wahlfuss { margin-top: 6px; border-top: 1px solid var(--border);
  padding-top: 5px; white-space: normal; }
/* Schreibhilfe der Betrags- und Datumsfelder (DESIGN #158): Der Rahmen umschließt
   das getippte Feld und trägt den ▾-Knopf **im** Feld an seinem rechten Rand
   (darum die eigene Innenraum-Regel für das Feld) — geöffnet wird nur per Klick
   darauf, Fokus und Tippen öffnen nie etwas. Der Popover selbst ist derselbe
   `.akte-wahlpop` wie bei der Werte-Auswahl (eine Optik, eine Mechanik). */
.akte-hilfe { position: relative; display: block; max-width: 190px; }
.akte-hilfe .akte-spf { padding-right: 20px; }
.akte-hilfebtn {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 10px; line-height: 1; padding: 3px 3px; border-radius: 4px;
}
.akte-hilfebtn:hover { color: var(--accent); background: var(--hover); }
.akte-hilfepop { min-width: 230px; }
.akte-hilfemodi { display: flex; flex-wrap: wrap; gap: 4px; }
.akte-hilfemodi button { padding: 3px 7px; font-size: 11.5px; }
/* Der gewählte Modus: dieselbe Farbkombination wie `.chip.on`, aber bewusst
   nicht die Klasse `f-on` — die bedeutet app-weit „dieser Filter greift", ein
   Modus ist nur eine Auswahl. */
.akte-hilfemodi button.on {
  border-color: var(--accent); background: var(--accent-soft);
  color: var(--accent); font-weight: 600;
}
.akte-hilfefelder { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.akte-hilfefeld { display: flex; flex-direction: column; gap: 2px; }
.akte-hilfefeld input { padding: 3px 6px; font-size: 12px; border-radius: 6px; }
/* Interner Sprung (Vertragszeile → Auftragsblock): kurzes Aufleuchten des
   Sprungziels — dasselbe Muster nutzen Aufwand und Geliefertes. */
tr.akte-flash > td { animation: akte-flash 1.6s ease-out; }
@keyframes akte-flash { from { background: color-mix(in srgb, var(--amber) 35%, transparent); }
  to { background: transparent; } }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }
.list-row { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }

/* ---------- Historie (Dashboard) ---------- */
.hist-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.hist-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--panel); border-radius: 20px;
  padding: 4px 12px; font-size: 12px; cursor: pointer; color: var(--text);
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
/* Gewählt, aber **neutral**: der zweistufige Umschalter „Offen | Alle" von
   „Meine Seite" braucht eine Stellung, die gewählt aussieht, ohne einen Filter
   zu behaupten (#108) — kein Akzent, nur volle Deckkraft und fetter Text. */
.chip.sel { border-color: var(--border-strong); font-weight: 600; }
.chip:not(.on):not(.sel) { opacity: .55; }
.day-head {
  font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; margin: 14px 0 4px; padding-bottom: 3px; border-bottom: 1px solid var(--border);
}
.hist-row {
  display: flex; align-items: baseline; gap: 10px; padding: 7px 2px;
  border-bottom: 1px solid var(--line-soft); cursor: pointer; font-size: 13.5px;
}
.hist-row:hover { background: var(--hover); }
.hist-row .badge { flex: 0 0 auto; }
.hist-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-amt { flex: 0 0 auto; text-align: right; white-space: nowrap; font-weight: 600; }

/* ---------- Pipeline (Kanban) ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start; }
@media (max-width: 1100px) { .kanban { grid-template-columns: 1fr 1fr; } }
.kcol { background: var(--kcol-bg); border-radius: var(--radius); padding: 10px; min-height: 220px; max-height: calc(100vh - 210px); overflow-y: auto; }
.kcol h4 { font-size: 13px; margin: 2px 2px 10px; display: flex; justify-content: space-between; position: sticky; top: -10px; background: var(--kcol-bg); padding: 8px 2px 6px; z-index: 1; }
.kcard {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer;
}
.kcard:hover { border-color: var(--border-strong); }
.kcard .t { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.kcard .m { font-size: 12px; color: var(--muted); }
.kcard .v { font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.qsum { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.qsum .badge { font-size: 10.5px; padding: 1px 7px; }
.qlist { margin-top: 6px; border-top: 1px solid var(--line-soft); }
.qrow { padding: 5px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.qrow:hover { background: var(--hover); }

/* Funnel-Board: viele Spalten → horizontal scrollen statt quetschen */
.kanban.funnel {
  display: flex; overflow-x: auto; padding-bottom: 8px;
  grid-template-columns: none;
}
/* Feste volle Höhe: die ganze Spaltenfläche ist Drop-Zone, auch wenn sie
   (fast) leer ist — Karten müssen nicht auf bestehende Karten gezogen werden */
.kanban.funnel .kcol { flex: 0 0 240px; height: calc(100vh - 210px); }
.kanban.funnel .kcol.outcome { flex-basis: 210px; background: var(--outcome-bg); }
.ksum { font-size: 11.5px; font-weight: 600; margin: -4px 2px 10px; color: var(--muted); }
.kcard[draggable="true"] { cursor: grab; }
.kcol.dragover { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
/* Verfärbung nach letzter Aktivität (14/30 Tage) */
.kcard.rot-yellow { border-left: 4px solid #e6a817; }
.kcard.rot-red { border-left: 4px solid #cc3b3b; }
.kcard.warn { background: #fdf3f3; border-color: #e6b8b8; }
/* Beleglage widerspricht der Phase: Angebot existiert, Karte steht aber noch
   vor der Angebotsphase → roter Rahmen, manuell einsortieren (DESIGN.md #26) */
.kcard.mismatch { border: 2px solid #cc3b3b; }
/* Direkt-Angebote: schlanke Übergangskarten, nicht ziehbar */
.kcard.qslim { background: var(--thead-bg); border-style: dashed; }
/* Schwelle vor der Angebotsphase: ab hier automatisches Angebot, kein Zurück */
.kanban.funnel .kdivider { flex: 0 0 3px; border-radius: 2px; background: var(--text); margin: 0 3px; align-self: stretch; }
/* Schnell-Dropdown für die Wahrscheinlichkeit (Karte + Detailseite) */
select.qprob {
  font-size: 11.5px; font-weight: 600; padding: 1px 4px; margin-left: 4px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel); color: var(--text); cursor: pointer;
}
/* Angebotszeilen auf Karten: zweizeilig — oben Nummer, darunter Betrag + Wahrsch. */
.qrow .qvals { font-weight: 600; margin-top: 1px; }
.qrow.qact { margin-top: 6px; font-size: 11.5px; border-bottom: none; }
/* Beleglage-Hinweis: dezenter roter Text (der Kartenrahmen trägt die Warnung) */
.mismatch-hint { color: #cc3b3b; font-weight: 600; margin-top: 6px; }
/* Betreuungszeile der Karte + ihr Info-Popover (DESIGN.md #79). Die Zeile
   bleibt kompakt; Mouseover (auf Touch: Tippen) zeigt die letzten drei
   Aktivitäten und den nächsten geplanten Termin. Das Popover selbst nimmt
   keine Zeigerereignisse an — sonst flackerte es über der eigenen Karte. */
.carebox { cursor: help; }
.carebox:hover { color: var(--text); }
.care-pop {
  position: fixed; z-index: 60; min-width: 220px; max-width: 340px;
  pointer-events: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow);
}
.care-pop .care-t { font-weight: 700; margin-bottom: 4px; }
.care-pop .care-row { display: flex; gap: 8px; padding: 2px 0; }
.care-pop .care-when { white-space: nowrap; color: var(--muted); }
.care-pop .care-what { font-weight: 600; overflow-wrap: anywhere; }
.care-pop .care-none { color: var(--muted); }
.care-pop .care-next {
  margin-top: 6px; padding-top: 5px; font-weight: 700;
  border-top: 1px solid var(--line-soft);
}
.care-pop .care-next .care-row { font-weight: 400; }
/* Phasen-Info (#30): ⓘ im Spaltenkopf — Hover zeigt Kurztext, Klick alle */
.phase-info { cursor: help; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.phase-info:hover { color: var(--accent); }
/* Preisabgleich (#29): Chance weicht vom neuesten aktiven Angebot ab */
.kcard.pricediff { border: 2px solid #e6a817; }
.pricediff-hint { color: #a87200; font-weight: 600; margin-top: 6px; }
body.theme-dark .pricediff-hint { color: #e6a817; }

/* Auswertung: klassische Funnel-Grafik (Breite ∝ Anzahl je Stage) */
.funnelviz { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.funnelviz .fbar {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  background: var(--accent); color: #fff; border-radius: 7px;
  padding: 9px 16px; font-size: 12.5px; min-width: 230px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 14px 100%);
}
.funnelviz .fbar .fl { font-weight: 600; white-space: nowrap; }
.funnelviz .fbar .fr { white-space: nowrap; opacity: .9; }

/* ---------- Balken (Auswertung) ---------- */
.bar-row { display: grid; grid-template-columns: 200px 1fr 200px; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; }
.bar-track { background: var(--kcol-bg); border-radius: 6px; height: 20px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--blue); min-width: 2px; }
.bar-fill.late { background: var(--chart-lost); }

/* Säulen-Charts (Sales Overview, „Verlauf") */
.colchart { display: flex; align-items: flex-end; gap: 6px; margin-top: 12px; }
.colgroup { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.colval { font-size: 10.5px; color: var(--muted); height: 14px; white-space: nowrap; }
.colbars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; height: 92px; }
.colbar {
  width: 100%; max-width: 26px; min-height: 2px;
  background: var(--accent); border-radius: 4px 4px 0 0;
}
.colbar.win { background: var(--chart-won); }
.colbar.lost { background: var(--chart-lost); }
.colgroup:hover .colbar { filter: brightness(1.12); }
.collbl { font-size: 10.5px; color: var(--muted); height: 14px; white-space: nowrap; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend .dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.legend .dot.win { background: var(--chart-won); }
.legend .dot.lost { background: var(--chart-lost); }

/* ---------- Detail ---------- */
.detail-head { display:flex; justify-content: space-between; align-items:flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-head h2 { font-size: 20px; }
.subsection { margin-top: 22px; }
.subsection h3 { font-size: 15px; margin-bottom: 10px; display:flex; align-items:center; gap:10px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 12px 20px; }
.kv-grid .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.kv-grid .v { font-size: 13.5px; margin-top: 2px; }
.desc-box { white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; }

/* ---------- Modal (Anlage-Dialoge) ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,25,40,.5); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 150; overflow-y: auto;
}
.modal {
  background: var(--panel); border-radius: 14px; width: 680px; max-width: 100%;
  box-shadow: 0 18px 60px rgba(0,0,0,.3); padding: 24px 26px;
}
.modal h3 { margin-bottom: 16px; font-size: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.form-grid input, .form-grid select { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; margin-top: 20px; gap: 8px; }
.modal-status { font-size: 12.5px; margin-top: 10px; min-height: 16px; }
/* Lese-Modale (die ℹ️-Erklärtexte): Der globale Reset nimmt allen Elementen
   ihre Abstände — Absätze, Listen und Beispiel-Auszeichnungen der Erklärtexte
   brauchen sie darum ausdrücklich (Runde 2, Ticket 03: die Kurzsyntax der
   Filterzeile steht als Beispiel-Liste im Modal). */
.modal p + p, .modal p + ul, .modal ul + p { margin-top: 10px; }
.modal ul { padding-left: 20px; }
.modal li { margin: 3px 0; }
.modal code { background: var(--badge-bg); border-radius: 4px; padding: 0 4px;
  font-size: 12.5px; }
.modal-status.err { color: var(--red); }
/* Tabelle im rein lesenden Drilldown-Modal (DESIGN.md #116): eigener Scroll-Kasten,
   damit die Summenzeile bei vielen Belegen nicht aus dem Bild wandert. Die
   Voreinstellung von `.table-wrap` rechnet mit der ganzen Seitenhöhe und ist
   hier zu hoch. */
.dd-modal-tbl { max-height: 52vh; border: 1px solid var(--line-soft); }
.dd-modal-tbl tfoot th { position: sticky; bottom: 0; background: var(--panel); }
.dupe-box {
  margin-top: 6px; background: #fdf3e0; border: 1px solid #ecd9ae;
  border-radius: 8px; padding: 8px 10px; font-size: 12.5px;
}
.dupe-box .row { padding: 3px 0; }
.dupe-box a { color: var(--blue); cursor: pointer; text-decoration: none; }
.dupe-box a:hover { text-decoration: underline; }
.sugg-wrap { position: relative; }
.sugg-drop {
  position: absolute; left: 0; right: 0; top: 100%; background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18);
  z-index: 160; max-height: 220px; overflow: auto; display: none;
}
.sugg-drop .item { padding: 7px 10px; font-size: 12.5px; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.sugg-drop .item:hover { background: var(--hover); }

.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--viakom-dark-blue); color: #fff;
  padding: 12px 18px; border-radius: 10px; font-size: 13.5px; z-index: 99;
  box-shadow: 0 8px 24px rgba(0,0,0,.3); opacity: 0; transition: opacity .25s; pointer-events: none;
}
.toast.show { opacity: 1; }
.empty { padding: 30px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ↗-Direktlinks ins Original-ERPNext */
.rowext {
  color: var(--muted); text-decoration: none; font-size: 14px;
  padding: 2px 7px; border-radius: 5px; display: inline-block;
}
.rowext:hover { color: var(--accent); background: var(--accent-soft); }

/* Adressblock im Firmen-Detail */
.addr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.addr-card { padding: 14px; font-size: 13.5px; line-height: 1.5; }
.addr-head { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }

/* Zeilen-Editor für E-Mail-/Telefonlisten im Kontakt-Dialog */
.list-edit-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.list-edit-row input:not([type=radio]):not([type=checkbox]) { flex: 1; }
.list-edit-row .chk { white-space: nowrap; }

/* ---------------- KI-Chat (Prototyp; Freischaltung über ?ki=1) ---------------- */
#ai-fab {
  display: none; position: fixed; right: 22px; bottom: 22px; z-index: 150;
  width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 21px;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  align-items: center; justify-content: center;
}
#ai-fab:hover { filter: brightness(1.12); }
body.ai-on #app.active ~ #ai-fab { display: flex; }
body.ai-open #ai-fab { display: none !important; }

#ai-panel {
  display: none; position: fixed; right: 22px; bottom: 22px; z-index: 160;
  width: 440px; max-width: calc(100vw - 44px);
  height: 580px; max-height: calc(100vh - 44px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.30);
  flex-direction: column; overflow: hidden;
}
body.ai-on.ai-open #app.active ~ #ai-panel { display: flex; }

.ai-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft); background: var(--thead-bg);
}
.ai-head .ai-spacer { flex: 1; }

.ai-msgs { flex: 1; overflow: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.ai-hello { color: var(--muted); font-size: 12.5px; line-height: 1.5; padding: 6px 4px; }
.ai-hello .ex { display: block; margin-top: 4px; font-style: italic; }

.ai-msg { max-width: 92%; padding: 8px 11px; border-radius: 12px; font-size: 13px; line-height: 1.5; overflow-wrap: break-word; }
.ai-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.ai-msg.bot { align-self: flex-start; background: var(--hover); border: 1px solid var(--line-soft); border-bottom-left-radius: 4px; }
.ai-msg.bot.err { border-color: var(--red); color: var(--red); }
.ai-msg.bot code { background: var(--badge-bg); border-radius: 4px; padding: 0 4px; font-size: 12px; }
.ai-msg.bot ul { margin: 4px 0 4px 18px; }
.ai-msg.bot li { margin: 2px 0; }

.ai-steps { align-self: flex-start; max-width: 92%; font-size: 11.5px; color: var(--muted); }
.ai-steps summary { cursor: pointer; user-select: none; }
.ai-steps .step { padding: 3px 0 3px 10px; border-left: 2px solid var(--line-soft); margin: 4px 0 4px 4px; }
.ai-steps .step.fail { border-left-color: var(--red); }
.ai-steps .step code { font-size: 10.5px; word-break: break-all; }

.ai-typing { align-self: flex-start; color: var(--muted); font-size: 12.5px; padding: 4px 2px; }
.ai-typing .dot { display: inline-block; animation: aiblink 1.2s infinite; }
.ai-typing .dot:nth-child(2) { animation-delay: .2s; }
.ai-typing .dot:nth-child(3) { animation-delay: .4s; }
@keyframes aiblink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.ai-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line-soft); }
.ai-input textarea { flex: 1; resize: none; font-size: 13px; }
.ai-input button { align-self: flex-end; }

/* Zusatzangabe an der Summenspalte des Planungsrasters (Ticket 03 der Spec
   „Echte Ist-Stunden im Forecast", DESIGN.md #57): nicht abrechenbar gebuchte
   Stunden als kleiner Nebenwert unter der Σ-Zahl — bewusst unauffällig
   (Nebenwert, kein Badge) und in der 64-px-Spalte umbruchfrei. */
.fc-grid .fc-sumna { font-size: 9.5px; font-weight: 400; line-height: 1.2;
  color: var(--muted); white-space: nowrap; letter-spacing: -.2px; }

/* „Projekt verschieben ± n Monate" (Ticket 06 Umsatzplanung, DESIGN.md #65):
   Monatswahl mit Schnellknöpfen in einer Zeile, darunter die servergerechnete
   Vorschau (Umfang + Zielzeitraum) — sie steht vor jedem Schreibvorgang. */
.fc-shift-wahl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fc-shift-wahl input[type="number"] { width: 74px; }
.fc-shift-vorschau { margin-top: 12px; padding: 10px; border-radius: 8px;
  background: var(--thead-bg); font-size: 12.5px; line-height: 1.45;
  min-height: 44px; }
.fc-shift-vorschau .err { color: var(--red); }

/* Projekt-Historie (Ticket 02 projekt-historie, DESIGN.md #126): letzte Karte
   der Projektdetailseite. Zugeklappt ist die Karte nur ihre Kopfzeile — der
   Knopf trägt darum die Optik einer Überschrift, nicht die eines Knopfes. */
.fc-hist .fc-hist-kopf { background: none; border: none; padding: 0;
  font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer;
  display: flex; align-items: center; gap: 7px; }
.fc-hist .fc-hist-kopf:hover { color: var(--accent); }
.fc-hist .fc-hist-pfeil { color: var(--muted); font-size: 12px; width: 10px; }
.fc-hist .table-wrap { margin-top: 12px; }
/* Der Satz ist der Inhalt der Zeile: normal gesetzt (die gemeinsame
   Tabellen-Optik macht die erste Spalte fett, hier zählt die Mitte). */
.fc-hist .fc-tbl td.fc-hist-satz { font-weight: 400; font-size: 12.5px;
  line-height: 1.4; }
.fc-hist .fc-tbl tbody td:first-child { font-weight: 400; font-size: 11.5px;
  color: var(--muted); white-space: nowrap; }
.fc-hist .fc-hist-mehr { margin-top: 10px; }
