/* ---- Stornofabrik-CI ---- */
@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;500;600;700&display=swap');

:root {
  /* CR Admin 2026-05-27: Helles Design — komplett auf Light umgestellt.
     Dark-Werte sind als Kommentar erhalten für späteren Theme-Toggle. */
  --bg: #f5f3ef;         /* vorher: #0b0b0b */
  --surface: #ffffff;     /* vorher: #191919 */
  --surface-2: #f0ece4;   /* vorher: #2a2a2a */
  --border: #d9d2c4;      /* vorher: #333 */
  --text: #1a1a1a;        /* vorher: #eedec4 */
  --text-dim: #5a5346;    /* vorher: #c8bba7 */
  --accent: #d73238;
  --accent-2: #ab1f24;
  --success: #047857;     /* vorher: #10b981 — dunkler für Light-Hintergrund */
  --warn: #b45309;        /* vorher: #f59e0b */
  --danger: #d73238;
  --info: #475569;        /* vorher: #64748b */
  --radius: 8px;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-display: 'Work Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 12px;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

/* Keine horizontale Bewegung außer in explizit scrollbaren Bereichen (Kanban). */
body { position: relative; width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ---- Login ---- */
.page-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, #191919, #0b0b0b 70%);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}
.login-logo { display: block; height: 48px; width: auto; margin: 0 auto 20px; }
.login-card h1 { margin: 0 0 4px; font-size: 2.2rem; text-align: center; }
.login-card .login-sub { text-align: center; }
.login-sub { color: var(--text-dim); margin: 0 0 24px; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 14px;
  background: #fff; color: #1f1f1f !important;
  border: 1px solid #dadce0; border-radius: 6px;
  font-size: 0.95rem; font-weight: 500;
  text-decoration: none !important;
  margin-bottom: 16px;
  transition: background 0.15s;
}
.google-btn:hover { background: #f8faff; }
.google-btn:active { background: #eef3fe; }
.login-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0 16px;
  color: var(--text-dim); font-size: 0.8rem;
}
.login-divider::before,
.login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.login-card label { font-size: 0.85rem; color: var(--text-dim); display: block; margin-bottom: 6px; }
.login-card input {
  width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); margin-bottom: 16px; font-size: 1rem;
}
.login-card button {
  width: 100%; padding: 10px; background: var(--accent); color: white; border: none;
  border-radius: 6px; cursor: pointer; font-size: 1rem; font-weight: 600;
}
.login-card button:hover { background: var(--accent-2); }
.error { color: var(--danger); margin-top: 8px; }

/* ---- Dashboard ---- */
.page-dashboard { height: 100vh; display: grid; grid-template-rows: 56px 1fr; }

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  gap: 24px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 1.25rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0;
  color: var(--text);
  white-space: nowrap;
}
.brand-logo {
  height: 32px; width: auto; display: block;
}
.brand-text { display: inline-block; }
.brand-accent { color: var(--accent); }
/* Legacy fallback für Seiten die noch <span> direkt im .brand nutzen */
.brand > span:not(.brand-text):not(.brand-accent) { color: var(--accent); }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs button {
  background: transparent; border: none; color: var(--text-dim);
  padding: 8px 12px; cursor: pointer; border-radius: 6px; font-size: 0.9rem;
  white-space: nowrap;
}
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.tabs button.active { background: var(--surface-2); color: var(--text); }
.badge {
  display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px;
  background: var(--border); font-size: 0.75rem; margin-left: 4px; text-align: center;
}
.badge-critical { background: var(--danger); color: white; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-actions button {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}
.topbar-actions button:hover { background: var(--border); }
/* Burger ist auf Desktop versteckt — Tabs sind direkt sichtbar. */
.burger-btn { display: none; font-size: 1.2rem; padding: 6px 10px; }
.mobile-menu-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 49;
}
.mobile-menu-backdrop[hidden] { display: none; }

main#view-container { overflow-y: auto; padding: 20px; }
.view { max-width: 100%; }

h2 { margin-top: 0; }

/* ---- Tables ---- */
table.data {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
table.data th, table.data td {
  padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left;
  vertical-align: top;
}
table.data th { background: var(--surface-2); color: var(--text-dim); font-weight: 600; font-size: 0.85rem; }
table.data tr:hover { background: var(--surface-2); cursor: pointer; }
table.data tr:last-child td { border-bottom: none; }

/* ---- Berater-Verwaltung: Gruppen-Header ---- */
table.berater-table th.grp {
  text-align: center; text-transform: uppercase; letter-spacing: 0.04em;
  font-size: 0.72rem; color: var(--text); background: var(--surface-2);
  border-bottom: 2px solid var(--border);
}
table.berater-table th.grp.blank { background: transparent; border-bottom: none; }
table.berater-table th.grp-start,
table.berater-table td.grp-start { border-left: 2px solid var(--border); }
table.berater-table td.col-leads label { font-weight: 600; }
.berater-legend {
  margin: 12px 0 0; padding: 12px 14px; background: var(--surface-2);
  border-radius: var(--radius); font-size: 0.82rem; color: var(--text-dim);
}
.berater-legend b { color: var(--text); }
.berater-legend li { margin: 3px 0; }

/* ---- Status-Pill ---- */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem;
  font-weight: 600; color: white;
}
.age-green { color: var(--success); }
.age-orange { color: var(--warn); }
.age-red { color: var(--danger); font-weight: 600; }

/* ---- Toolbar ---- */
.toolbar {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center;
}
.toolbar input, .toolbar select {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: 6px; font-size: 0.9rem;
}
.toolbar button {
  background: var(--accent); color: white; border: none; padding: 6px 14px; border-radius: 6px;
  cursor: pointer; font-size: 0.9rem;
}
.toolbar button:hover { background: var(--accent-2); }
.toolbar button.secondary { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.toolbar button.danger { background: var(--danger); }

/* ---- Pipeline Kanban ---- */
.kanban {
  display: grid;
  grid-template-columns: repeat(8, minmax(220px, 1fr));
  gap: 8px;
  overflow: auto;
  /* Eigener Scroll-Container, damit kanban-col h3 sticky am oberen Spaltenrand klebt
     und die Toolbar darüber sichtbar bleibt. */
  max-height: calc(100vh - 220px);
  padding-bottom: 8px;
}
.kanban-col {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 400px;
}
.kanban-col h3 {
  padding: 10px 12px; margin: 0; border-bottom: 1px solid var(--border);
  font-size: 1.05rem; color: var(--text); display: flex; justify-content: space-between;
  align-items: center; gap: 8px;
  /* Sticky beim vertikalen Scroll des Dashboards (Container: main#view-container). */
  position: sticky; top: 0; z-index: 5;
  background: var(--surface);
  border-top-left-radius: var(--radius); border-top-right-radius: var(--radius);
}
.kanban-col h3 > span:last-child {
  /* Lead-Anzahl rechts: kleiner als der Titel, nicht uppercase */
  font-family: var(--font-body); font-size: 0.85rem; font-weight: 600;
  color: var(--text-dim); align-self: center;
}
.col-meta {
  display: flex; align-items: center; gap: 8px;
}
.col-sort-toggle {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer;
  border-radius: 4px; padding: 2px 6px;
  font-size: 0.9rem; line-height: 1;
}
.col-sort-toggle:hover { color: var(--text); background: var(--surface-2); }
.fresh-badge {
  display: inline-block; font-size: 0.8rem;
  margin-left: 4px; vertical-align: middle;
}

/* Quick-Actions am Karten-Fuß (User-Spec Lars 2026-05-21) */
.card-quick-actions {
  display: flex; gap: 4px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}
.qa-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; min-height: 28px;
}
.qa-btn:hover { background: var(--surface); border-color: var(--accent); }
/* CR Christian 2026-06-08: prominenter Übernehmen-Button auf freien Karten. */
.qa-btn.qa-claim {
  background: var(--accent); color: #fff; border-color: var(--accent);
  font-weight: 600; font-size: 0.82rem; gap: 4px; flex: 1;
}
.qa-btn.qa-claim:hover { background: var(--accent-2); border-color: var(--accent-2); }

/* Next-Step-Box im Lead-Drawer (User-Spec Admin 2026-05-21) */
.next-step-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 6px 0 14px;
}
.next-step-main {
  display: flex; align-items: baseline; gap: 10px;
}
.next-step-due {
  font-weight: 700; font-size: 0.9rem;
}
.next-step-date {
  color: var(--text-dim); font-size: 0.85rem;
}
.next-step-text {
  grid-column: 1 / -1;
  font-size: 0.9rem;
  color: var(--text);
  white-space: pre-wrap;
}
.next-step-done-btn {
  align-self: start;
  white-space: nowrap;
}

/* Aktivitäts-Timeline im Lead-Detail (User-Spec Lars 2026-05-22) */
.lead-timeline {
  list-style: none;
  padding: 0 0 0 6px;
  margin: 8px 0 0;
  position: relative;
}
.lead-timeline::before {
  content: '';
  position: absolute;
  left: 14px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border);
}
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 6px 0 10px;
}
.timeline-icon {
  position: relative; z-index: 1;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 0.85rem;
}
.timeline-meta {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-bottom: 2px;
}
.timeline-kind {
  font-weight: 600; color: var(--text);
  font-size: 0.85rem;
}
.timeline-text {
  font-size: 0.9rem;
  color: var(--text);
  white-space: pre-wrap;
}
.kanban-list { padding: 10px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.kanban-card {
  background: var(--surface-2); padding: 12px 14px; border-radius: 8px; cursor: grab;
  border-left: 4px solid var(--accent);
  font-size: 0.9rem;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  /* Spam-Eingaben ohne Leerzeichen dürfen die Karte nicht sprengen */
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card-vertrieb {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.kanban-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
/* Ampel-Streifen am Kartenrand nach Liegezeit (User-Spec Lars 2026-05-21):
   0–3d grün, 4–7d gelb, >7d rot. Wird von .unassigned und .card-overdue
   überschrieben, weil die fachlich höhere Priorität haben. */
.kanban-card.age-bucket-fresh { border-left-color: var(--success); }
.kanban-card.age-bucket-warm  { border-left-color: var(--warn); }
.kanban-card.age-bucket-hot   { border-left-color: var(--danger); }

/* CR Admin 2026-05-27: Ampel-Legende oben am Board. */
.ampel-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding: 6px 4px 10px; font-size: 0.82rem; color: var(--text-dim);
}
.ampel-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.ampel-dot {
  display: inline-block; width: 14px; height: 4px; border-radius: 2px;
}
.ampel-dot.ampel-fresh { background: var(--success); }
.ampel-dot.ampel-warm  { background: var(--warn); }
.ampel-dot.ampel-hot   { background: var(--danger); }

/* CR Admin 2026-05-27: Nächster Schritt auf Kanban-Karte. */
/* CR Lars 2026-06-18 (#2): Plan-Hinweis als prägnantes Badge — klar sichtbar,
   dass eine Wiedervorlage / ein nächster Schritt geplant ist. */
.card-next-step {
  font-size: 0.78rem; color: #1d4ed8; font-weight: 600;
  background: rgba(37,99,235,0.10); border: 1px solid rgba(37,99,235,0.22);
  border-radius: 6px; padding: 1px 7px; margin-top: 2px;
  display: inline-block; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* CR Admin 2026-05-27: Freigeben-Bar fuer geschlossene Leads. */
.release-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 16px;
  background: rgba(251, 191, 36, 0.08); border-bottom: 1px solid var(--border);
}
.release-bar .hint { font-size: 0.82rem; }

/* CR Admin 2026-05-27: Skripte & Prozesse. */
.skripte-kat { margin-bottom: 24px; }
.skripte-kat h3 {
  font-size: 1.05rem; margin: 0 0 8px;
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.skripte-list { list-style: none; padding: 0; margin: 0; }
.skripte-list li {
  padding: 8px 0; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.skripte-list li:last-child { border-bottom: none; }
.skripte-list a {
  color: var(--accent); text-decoration: none; font-weight: 600;
}
.skripte-list a:hover { text-decoration: underline; }

/* Spielregeln (Berater-Portal): begünstigt / bestraft */
.regeln-block { margin-bottom: 28px; }
.regeln-block h3 {
  font-size: 1.05rem; margin: 0 0 10px;
  border-bottom: 1px solid var(--border); padding-bottom: 6px;
}
.regeln-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.regel-item {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card, #fff);
}
.regel-item strong { display: block; margin-bottom: 4px; }
.regel-item p { margin: 0; font-size: 0.92rem; color: var(--muted, #555); line-height: 1.45; }

/* Einmaliger Hinweis-Banner auf den Spielregeln-Tab (oben) */
.regeln-hint-banner {
  position: fixed;
  top: 12px; left: 12px; right: 12px;
  max-width: 560px; margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 600;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.regeln-hint-banner .txt { font-size: 0.88rem; line-height: 1.4; color: var(--text); }
.regeln-hint-banner .txt strong { color: var(--accent); }
.regeln-hint-actions { display: flex; gap: 8px; }
.regeln-hint-banner button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
  white-space: nowrap;
}
.regeln-hint-banner button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.kanban-card.dragging { opacity: 0.5; }
.kanban-col.drag-over { background: rgba(59, 130, 246, 0.12); }
.kanban-card .meta {
  font-size: 0.75rem; color: var(--text-dim); margin-top: 4px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.kanban-card.unassigned { border-left-color: var(--warn); border-left-style: dashed; }
.unassigned-tag {
  /* User-Spec Lars 2026-05-21: dezenter, weil der gestrichelte Kartenrand
     (.kanban-card.unassigned) den Zustand schon klar zeigt. Doppelte Botschaft
     reduziert die Aufmerksamkeit für echte Prios. */
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  background: rgba(245,158,11,0.18); color: var(--warn);
  font-size: 0.7rem; font-weight: 600;
}
.calendar-badge {
  display: inline-block; padding: 1px 5px; border-radius: 3px;
  background: #10b981; color: #fff; font-size: 0.7rem; font-weight: 600;
  margin-left: 4px;
}
.calendar-badge.calendar-badge-overdue { background: #ef4444; }

/* Hot-Lead-Markierung (CR Admin 2026-07-30, #7). Der Admin vergibt die Flamme,
   im Weekly Call ist sie die Agenda. Bewusst nur ein warmer Rand statt einer
   knalligen Fläche — die Ampelfarben der Karte müssen lesbar bleiben. */
.hot-badge { display: inline-block; font-size: 0.85rem; margin-left: 4px; vertical-align: middle; }
.kanban-card.card-hot {
  border-left: 3px solid #f97316;
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.25);
}
.lead-header-hot-wrap { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.hot-toggle-btn {
  padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 0.8rem;
}
.hot-toggle-btn:hover { border-color: #f97316; }
.hot-toggle-btn.is-hot { background: #f97316; border-color: #f97316; color: #fff; font-weight: 600; }
.lead-header-card.lead-header-hot { border-left: 3px solid #f97316; }

/* Leadmagnet-Status auf der Karte (CR Lars 2026-08-03, #9): sagt dem Berater
   vor dem Anruf, ob der Lead das VSL überhaupt gesehen hat — damit der
   Einstieg passt, statt auf gut Glück nach dem Video zu fragen. */
.vsl-badge {
  display: inline-block; padding: 1px 5px; border-radius: 3px;
  font-size: 0.7rem; font-weight: 600; margin-left: 4px; white-space: nowrap;
}
.vsl-badge-watched  { background: #10b981; color: #fff; }
.vsl-badge-opened   { background: #f59e0b; color: #fff; }
.vsl-badge-unopened { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
/* Funnel-Herkunft (welcher Funnel/Kampagne) — Farbe kommt je Funnel aus
   --funnel-color (gesetzt in renderFunnelBadge, api.js). Dezent gefuellt,
   damit es Prioritaets-Signale (Ampel) nicht uebertoent. */
.funnel-badge {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  border: 1px solid var(--funnel-color, #64748b);
  color: var(--funnel-color, #64748b);
  background: color-mix(in srgb, var(--funnel-color, #64748b) 12%, transparent);
  font-size: 0.7rem; font-weight: 600; line-height: 1.4;
}
.card-funnel { margin: 3px 0 1px; }
/* Funnel-Verlauf im Lead-Drawer: chronologische Touchpoint-Liste. */
.funnel-timeline { display: flex; flex-direction: column; gap: 4px; }
.funnel-tp { display: flex; align-items: center; gap: 7px; font-size: 0.8rem; }
.funnel-dot {
  flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%;
  background: var(--funnel-color, #64748b);
}
.funnel-tp-label { font-weight: 600; }
/* CR Lars 2026-06-18 (#2): verplante Leads (Wiedervorlage) ruhig/hell statt
   komplett ausgegraut — das Plan-Badge (.card-next-step) bleibt klar lesbar. */
.kanban-card.card-wv { background: var(--surface-2); border-left-color: #94a3b8; }
.kanban-card.card-wv .meta-wv { color: var(--text-dim); font-style: italic; }
.kanban-card.card-overdue { border-left-color: #ef4444; background: rgba(239,68,68,0.08); }

/* ---- Impersonate-Banner (Admin schaut als Berater) ---- */
.impersonate-banner {
  background: #f59e0b; color: #1e1e1e;
  padding: 8px 16px;
  display: flex; align-items: center; gap: 12px;
  font-weight: 600; font-size: 0.9rem;
  border-bottom: 2px solid #b45309;
  position: sticky; top: 0; z-index: 100;
}
.impersonate-banner b { font-weight: 700; }
.impersonate-banner button {
  margin-left: auto;
  background: #1e1e1e; color: #fff; border: none;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}
.impersonate-banner button + button { margin-left: 8px; }
.impersonate-banner button.secondary { background: #fff; color: #1e1e1e; border: 1px solid #1e1e1e; }
.impersonate-banner button:hover { opacity: 0.85; }

.score-badge {
  display: inline-block; padding: 1px 6px; border-radius: 10px;
  font-size: 0.7rem; font-weight: 700; min-width: 22px; text-align: center;
  margin-left: 4px;
}
.score-badge.score-low  { background: #ef4444; color: #fff; }
.score-badge.score-mid  { background: #f59e0b; color: #1e1e1e; }
.score-badge.score-high { background: #10b981; color: #fff; }

/* ---- View-Toggle (Liste/Board in Meine Leads) ---- */
.view-toggle { display: inline-flex; gap: 0; margin-right: 8px; }
.view-toggle button { border-radius: 4px; padding: 6px 10px; font-size: 0.85rem; }
.view-toggle button:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.view-toggle button:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* ---- Lead-Notizen-Log ---- */
.notes-list { max-height: 240px; overflow-y: auto; margin-bottom: 8px; }
.note-entry { padding: 6px 0; border-bottom: 1px solid var(--border); }
.note-entry:last-child { border-bottom: none; }
.note-meta { font-size: 0.75rem; color: var(--text-dim); margin-bottom: 2px; }
.note-text { font-size: 0.9rem; white-space: pre-wrap; word-wrap: break-word; }
.notes-add textarea {
  width: 100%; padding: 6px 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  color: var(--text); font-size: 0.9rem; font-family: inherit;
  resize: vertical; margin-bottom: 6px;
}

/* ---- Drawer ---- */
.drawer {
  position: fixed; right: 0; top: 0; height: 100vh; width: 560px; max-width: 95vw;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -10px 0 20px rgba(0,0,0,0.4);
  display: flex; flex-direction: column; z-index: 100;
}
.drawer[hidden] { display: none; }
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  z-index: 90; cursor: pointer;
}
.drawer-backdrop[hidden] { display: none; }

.lead-header-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px;
}
.lead-header-main { flex: 1; min-width: 0; }
.lead-header-name {
  font-size: 1.2rem; font-weight: 700; color: var(--text);
  margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis;
}
.lead-header-phone { font-size: 0.95rem; color: var(--text-dim); }
.lead-header-phone a { color: var(--accent); font-weight: 600; }
/* CR Admin 2026-05-27: Leadquelle-Hinweis im Header (Kampagne/Ad). */
.lead-source-hint {
  font-size: 0.82rem; color: var(--text-dim);
  margin: 2px 0 4px;
}
.lead-header-call-btn {
  background: var(--accent); color: white; border: none; border-radius: 6px;
  padding: 10px 18px; font-size: 1rem; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.lead-header-call-btn:hover { background: var(--accent-2); }
.lead-header-call-count {
  display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 11px;
  background: rgba(0,0,0,0.35); font-size: 0.8rem; text-align: center;
}
/* CR 2026-06-09: Datum/Uhrzeit des letzten Anrufversuchs direkt unter dem Button. */
.lead-header-call-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.lead-header-call-when { font-size: 0.78rem; color: var(--text-dim); white-space: nowrap; }

.erstgespraech-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px;
}
/* CR Admin 2026-05-27: Wenn ein Erstgespräch gebucht ist, soll die Card +
   der Ja-Button auf den ersten Blick als "Termin steht" erkennbar sein. */
.erstgespraech-card.eg-booked {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}
.eg-booked-badge {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  font-size: 0.78rem; font-weight: 600;
  background: #dc2626; color: #fff; border-radius: 999px;
  vertical-align: middle;
}
.toggle-group button.eg-ja-booked {
  background: #dc2626; color: #fff; border-color: #dc2626;
}
.toggle-group button.eg-ja-booked:hover { background: #b91c1c; border-color: #b91c1c; }
/* Attendance-Toggle: stattgefunden = grün, No-Show = rot (nur im aktiven Zustand gesetzt). */
.toggle-group button.att-ja { background: #16a34a; color: #fff; border-color: #16a34a; }
.toggle-group button.att-no { background: #dc2626; color: #fff; border-color: #dc2626; }
.erstgespraech-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.eg-nein-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.eg-slot-day { margin-bottom: 14px; }
.eg-slot-day-label {
  font-weight: 600; color: var(--text-dim); margin-bottom: 6px; font-size: 0.85rem;
}
.eg-slot-times { display: flex; flex-wrap: wrap; gap: 6px; }
.eg-slot-btn {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 0.85rem;
}
.eg-slot-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 1.5rem; font-weight: 600; color: var(--text); }
.drawer-head button {
  background: none; border: none; color: var(--text-dim); font-size: 1.5rem; cursor: pointer;
}
.drawer-body { padding: 0; overflow: hidden; flex: 1; display: flex; flex-direction: column; }
.drawer-body section { margin-bottom: 20px; }
.drawer-body h3 {
  font-size: 1.15rem; color: var(--text);
  margin: 0 0 8px;
}
.drawer-body dl { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 0.9rem; }
.drawer-body dt { color: var(--text-dim); }
.drawer-body dd { margin: 0; word-break: break-word; }

/* Qualifizierungs-Karten — visuell deutlich getrennt (Erstes Telefonat vs Erstgespräch) */
.qual-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  border-left-width: 4px;
}
.qual-card h3 { margin-top: 0; padding-top: 0; }
.qual-card--telefonat { border-left-color: #3b82f6; }     /* Blau */
.qual-card--erstgespraech { border-left-color: #8b5cf6; } /* Violett */
details.qual-card > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  user-select: none;
}
details.qual-card > summary::-webkit-details-marker { display: none; }
details.qual-card > summary::before {
  content: '▶'; font-size: 0.8rem; color: var(--text-dim); transition: transform 0.15s;
}
details.qual-card[open] > summary::before { transform: rotate(90deg); }

/* Ja/Nein-Toggle (CR-001) */
.toggle-group { display: inline-flex; gap: 0; border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.toggle-group button {
  background: var(--surface); color: var(--text-dim); border: none;
  padding: 6px 14px; cursor: pointer; font-size: 0.85rem;
}
.toggle-group button:not(:last-of-type) { border-right: 1px solid var(--border); }
.toggle-group button.active { background: var(--accent); color: white; font-weight: 600; }
.toggle-group button:disabled { cursor: not-allowed; opacity: 0.6; }
.toggle-group button:not(.active):not(:disabled):hover { background: var(--surface-2); color: var(--text); }

/* Info-Button (z.B. neben Position) */
.info-btn {
  display: inline-block; padding: 0 6px; margin-left: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 50%; cursor: pointer; font-size: 0.75rem; line-height: 1.4;
}
.info-btn:hover { background: var(--accent); color: white; }

/* Drawer Tabs (CR-009) */
.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 12px;
  flex-shrink: 0;
}
.drawer-tabs button {
  background: transparent; border: none; color: var(--text-dim);
  padding: 10px 14px; font-size: 0.85rem; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.drawer-tabs button.active {
  color: var(--text); border-bottom-color: var(--accent);
}
.drawer-tabs button:hover { color: var(--text); }
.drawer-tab-content { padding: 16px; overflow-y: auto; flex: 1; }
.drawer-tab-content[hidden] { display: none; }
.drawer-bottom-bar {
  display: flex; gap: 8px; padding: 10px 16px;
  border-top: 1px solid var(--border); background: var(--surface);
  flex-shrink: 0;
}
.drawer-bottom-bar button { padding: 8px 16px; }
.drawer-bottom-bar button.primary {
  background: var(--accent); color: white; border: none; border-radius: 6px;
  cursor: pointer; font-size: 0.9rem; font-weight: 600;
}
.drawer-bottom-bar button.primary:hover { background: var(--accent-2); }
.drawer-bottom-bar button.secondary {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; cursor: pointer; font-size: 0.9rem;
}
.drawer-body textarea, .drawer-body input[type=text], .drawer-body input[type=email],
.drawer-body input[type=tel], .drawer-body input[type=datetime-local],
.drawer-body input[type=number], .drawer-body input[type=date], .drawer-body select {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 6px 8px; border-radius: 4px; font-size: 0.9rem; margin-bottom: 8px;
  font-family: inherit;
}
.drawer-body textarea { min-height: 80px; }

/* Subhint unter Section-H3 — leiser als die Headline */
.section-subhint {
  font-size: 0.75rem; color: var(--text-dim); font-weight: 400;
  margin: -8px 0 10px 0; text-transform: none; letter-spacing: 0;
}

/* Side-by-side Felder im Drawer (Vor-/Nachname, Email/Telefon) */
.field-row {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.field-row > * { flex: 1 1 120px; min-width: 0; }

/* Falsche-Daten-Modal: Fragen-Liste */
.junk-questions {
  margin: 8px 0 0 0; padding-left: 20px;
  font-size: 0.9rem; line-height: 1.5;
}
.junk-questions li { margin: 4px 0; color: var(--text); }

/* Status-Bar über den Drawer-Tabs */
.drawer-status-bar {
  padding: 12px 16px 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Status-Pipeline-Bar (CR-009) */
.status-pipeline {
  display: flex; gap: 0; margin: 8px 0;
  border-radius: 6px; overflow-x: auto; overflow-y: visible;
  background: var(--surface-2); padding: 4px; border: 1px solid var(--border);
}
.status-pipeline button.step {
  flex: 1; min-width: 70px;
  background: transparent; color: var(--text-dim);
  border: 1px solid transparent; border-radius: 4px;
  padding: 8px 6px; cursor: pointer;
  font-size: 0.75rem; font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.status-pipeline button.step.done {
  background: rgba(16,185,129,0.18); color: #6ee7b7;
}
.status-pipeline button.step.current {
  background: var(--accent); color: #fff; font-weight: 600;
  box-shadow: 0 1px 4px rgba(59,130,246,0.4);
}
.status-pipeline button.step.upcoming { color: var(--text-dim); opacity: 0.7; }
.status-pipeline button.step:not(.current):hover {
  background: var(--bg); color: var(--text);
}
.status-secondary { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.status-secondary button {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 0.8rem;
}
.status-secondary button:hover { border-color: var(--accent); color: var(--text); }
.status-secondary button.active {
  background: var(--danger); color: #fff; border-color: var(--danger);
}
.status-secondary button.disabled,
.status-secondary button:disabled {
  opacity: 0.4; cursor: not-allowed; color: var(--text-dim);
}
.status-secondary button.disabled:hover,
.status-secondary button:disabled:hover {
  border-color: var(--border); color: var(--text-dim);
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 200;
  display: grid; place-items: center;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; min-width: 400px; max-width: 90vw; max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin-top: 0; }
.modal label { display: block; font-size: 0.85rem; color: var(--text-dim); margin: 8px 0 4px; }
.modal input, .modal select, .modal textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 4px; margin-bottom: 12px;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.modal-actions button { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; }
.modal-actions button.primary { background: var(--accent); color: white; }
.modal-actions button.secondary { background: var(--surface-2); color: var(--text); }

/* ---- Toasts ---- */
#toast-stack {
  position: fixed; bottom: 16px; right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 6px; min-width: 240px; box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

/* ---- Alerts-Grouped ---- */
.alert-group { margin-bottom: 24px; }
.alert-group h3 { margin: 0 0 8px; }
.alert-card {
  background: var(--surface); border: 1px solid var(--border); padding: 10px 12px; border-radius: 6px;
  margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.alert-card.warn { border-left: 3px solid var(--warn); }
.alert-card.critical { border-left: 3px solid var(--danger); }
.alert-card.info { border-left: 3px solid var(--info); }
.alert-card .meta { font-size: 0.75rem; color: var(--text-dim); }
.alert-card button { background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 0.8rem; }

/* ---- KPI cards ---- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.kpi-card .label { font-size: 0.8rem; color: var(--text-dim); }
.kpi-card .value { font-size: 1.8rem; font-weight: 700; margin-top: 4px; }
.kpi-card .value.big { font-size: 2.4rem; }
.kpi-card .sub { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }
.kpi-card.small { padding: 10px 12px; min-width: 120px; }
.kpi-card.small .value { font-size: 1.4rem; }

/* Funnel-/Art-Kacheln in EINER Reihe — nie untereinander; bei Enge horizontal scrollen */
.kpi-strip, .kpi-cards-strip {
  display: flex; gap: 12px; margin-bottom: 16px;
  overflow-x: auto; padding-bottom: 4px;
}
.kpi-strip .kpi-card { flex: 1 0 150px; }
.kpi-cards-strip .kpi-card { flex: 0 0 auto; }

/* ---- KPI Steuerleiste ---- */
.kpi-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px;
}
.kpi-seg-group { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kpi-seg {
  background: var(--surface); color: var(--text); border: none; border-right: 1px solid var(--border);
  padding: 6px 12px; cursor: pointer; font-size: 0.85rem; font-family: inherit;
}
.kpi-seg:last-child { border-right: none; }
.kpi-seg.active { background: var(--accent); color: #fff; }
.kpi-daterange { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 0.85rem; }
.kpi-daterange input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 5px 8px; border-radius: 4px; font-family: inherit;
}

/* ---- ZDF-Filterbar ---- */
.kpi-filterbar {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 18px;
}
.kpi-filterbar-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.kpi-filter-row { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.kpi-filter-label { flex: 0 0 130px; font-size: 0.8rem; font-weight: 600; color: var(--text-dim); padding-top: 4px; }
.kpi-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kpi-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 3px 8px; border-radius: 999px; cursor: pointer; font-size: 0.8rem; font-family: inherit;
}
.kpi-chip:hover { border-color: var(--accent); }
.kpi-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.kpi-chip-n {
  font-size: 0.72rem; background: rgba(0,0,0,0.08); border-radius: 999px; padding: 0 6px;
}
.kpi-chip.active .kpi-chip-n { background: rgba(255,255,255,0.25); }
/* „nicht gepflegt": gestrichelt und gedimmt, damit er nicht wie ein echter Wert wirkt */
.kpi-chip.leer { border-style: dashed; color: var(--text-dim); font-style: italic; }
.kpi-chip.leer.active { color: #fff; border-style: solid; }

/* ---- Leads-reingekommen ---- */
.kpi-summary { display: flex; gap: 16px; flex-wrap: wrap; align-items: stretch; margin-bottom: 16px; }
.kpi-big {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; flex: 0 0 auto; min-width: 220px;
}
.kpi-big .label { font-size: 0.8rem; color: var(--text-dim); }
.kpi-big .value.big { font-size: 2.6rem; font-weight: 700; }
.kpi-big .sub { font-size: 0.82rem; color: var(--text-dim); margin-top: 2px; }
.kpi-summary .kpi-cards-strip { flex: 1 1 300px; margin-bottom: 0; }

.kpi-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 8px; }
.kpi-two-col h4 { margin: 0 0 8px; }
@media (max-width: 820px) { .kpi-two-col { grid-template-columns: 1fr; } }

/* Timeseries-Balken */
.kpi-bars { display: flex; flex-direction: column; gap: 4px; }
.kpi-bar-row { display: grid; grid-template-columns: 90px 1fr 44px; align-items: center; gap: 8px; font-size: 0.82rem; }
.kpi-bar-lbl { color: var(--text-dim); }
.kpi-bar-track { background: var(--surface-2); border-radius: 4px; height: 14px; overflow: hidden; }
.kpi-bar-fill { display: block; height: 100%; background: var(--accent); }
.kpi-bar-val { text-align: right; font-variant-numeric: tabular-nums; }

/* Quoten-Boxen */
.kpi-quotes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi-quote { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; background: var(--surface); }
.kpi-quote-top { display: flex; justify-content: space-between; align-items: baseline; }
.kpi-quote-top b { font-size: 1.15rem; }
.kpi-quote.good b { color: var(--success); }
.kpi-quote.warn b { color: var(--warn); }

/* Quoten-Tabelle */
.table-scroll { overflow-x: auto; }
.kpi-quota-table th { text-align: center; }
.kpi-quota-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: right; }

.linklike { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.error-box { background: #fdecec; border: 1px solid var(--danger); color: var(--accent-2); padding: 12px 14px; border-radius: var(--radius); }

/* ---- Aktivitäts-Heatmap (GitHub-Style) ---- */
.hm-wrap { overflow-x: auto; padding-bottom: 6px; }
.hm-berater { margin-bottom: 16px; width: max-content; }
.hm-name { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.heatmap { }
.hm-months { display: flex; padding-left: 26px; margin-bottom: 2px; }
.hm-mcell { width: 13px; flex: 0 0 13px; font-size: 9px; color: var(--text-dim); white-space: nowrap; overflow: visible; }
.hm-body { display: flex; gap: 4px; }
.hm-weekdays { display: grid; grid-template-rows: repeat(7, 11px); gap: 2px; width: 22px; font-size: 9px; color: var(--text-dim); }
.hm-weekdays span { line-height: 11px; }
.hm-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); grid-auto-columns: 11px; gap: 2px; }
.hm-cell { width: 11px; height: 11px; border-radius: 2px; display: block; }
.hm-cell.l0 { background: #e7e2d6; }
.hm-cell.l1 { background: #b7e4c7; }
.hm-cell.l2 { background: #74c69d; }
.hm-cell.l3 { background: #40916c; }
.hm-cell.l4 { background: #1b4332; }
.hm-cell.future { background: transparent; }
.hm-legend { display: flex; align-items: center; gap: 3px; font-size: 0.75rem; color: var(--text-dim); margin-top: 8px; }
.hm-legend .hm-cell { display: inline-block; }
.hm-grid-wrap { display: flex; flex-wrap: wrap; gap: 26px 34px; }

/* ---- KPI: mehr Luft zwischen Sektionen ---- */
[data-view=kpi] h3 { margin-top: 36px; margin-bottom: 12px; }
[data-view=kpi] .kpi-section-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 36px; margin-bottom: 12px; }
[data-view=kpi] .kpi-section-head h3 { margin: 0; }

/* ---- Gestapelter Leads-je-Art-Balken (Quoten-Tabelle) ---- */
.art-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 8px; }
.art-leg { display: inline-flex; align-items: center; gap: 5px; }
.art-leg-sw { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.art-bar-cell { min-width: 240px; }
.art-bar-row { display: flex; align-items: center; gap: 8px; }
.art-bar { display: flex; height: 16px; border-radius: 4px; min-width: 4px; }
.art-seg { position: relative; height: 100%; transition: filter .1s, transform .1s; }
.art-seg:first-child { border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.art-seg:last-child { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
/* Beim Hover: übrige Segmente abdunkeln, das gehoverte hervorheben */
.art-bar:hover .art-seg { filter: grayscale(0.4) opacity(0.45); }
.art-bar .art-seg:hover { filter: none; transform: scaleY(1.35); z-index: 3; box-shadow: 0 0 0 1px rgba(0,0,0,0.35); }
.art-seg-tip {
  position: absolute; bottom: 150%; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 3px 7px; border-radius: 4px;
  font-size: 0.74rem; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .1s; z-index: 4;
}
.art-seg:hover .art-seg-tip { opacity: 1; }
.art-bar-total { font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--text-dim); }
.geschnappt-hot { color: var(--success); font-weight: 700; }

/* ---- Pipeline-Fluss (Arc-Diagramm) ---- */
.flow-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 4px; }
.flow-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.flow-sw { width: 16px; height: 4px; border-radius: 2px; display: inline-block; }
.flow-sw-dash { background-image: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; }
.flow-wrap { overflow-x: auto; }
.flow-svg { width: 100%; min-width: 720px; height: auto; display: block; }
.flow-ribbon { transition: fill-opacity .1s; cursor: pointer; }
.flow-svg:hover .flow-ribbon { fill-opacity: 0.12; }
.flow-svg .flow-ribbon:hover { fill-opacity: 0.9; }
#flow-detail:not(:empty) { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.flow-detail-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.flow-detail-head .linklike { margin-left: auto; }
.flow-detail-table tr[data-open-lead] { cursor: pointer; }
.flow-detail-table tbody tr[data-open-lead]:hover { background: var(--surface-2); }

/* ---- Settings ---- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.settings-fullwidth { margin-bottom: 16px; }
.settings-card h3 { margin-top: 0; }
.settings-card label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-top: 10px; }
.settings-card input, .settings-card select, .settings-card textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 6px 8px; border-radius: 4px; margin-top: 4px;
}
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.toggle-row span { font-size: 0.9rem; }

/* ---- Automation groups ---- */
.auto-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 14px;
  background: var(--bg);
}
.auto-group-head h4 { margin: 0 0 4px; font-size: 1rem; }
.auto-group-desc { margin: 0 0 12px; color: var(--text-dim); font-size: 0.85rem; line-height: 1.5; }
.auto-blocks { display: flex; flex-direction: column; gap: 10px; }
.auto-block {
  display: grid;
  gap: 14px;
  align-items: start;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.auto-block-toggle { grid-template-columns: 52px 1fr; align-items: center; }
.auto-block-input { grid-template-columns: 1fr 200px; align-items: center; }
.auto-block-text { min-width: 0; }
.auto-block-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 2px; }
.auto-block-desc { color: var(--text-dim); font-size: 0.82rem; line-height: 1.4; }
.auto-block-control { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.auto-block-control input,
.auto-block-control select {
  width: 100%;
  margin-top: 0;
  text-align: right;
}
.auto-block-control select { text-align: left; }
.auto-unit {
  font-size: 0.82rem; color: var(--text-dim);
  white-space: nowrap;
}

/* ---- iOS-style Switch ---- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; margin: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background-color: var(--border);
  transition: 0.2s;
  border-radius: 24px;
  cursor: pointer;
}
.switch .slider::before {
  position: absolute; content: "";
  height: 18px; width: 18px;
  left: 3px; top: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}
.switch input:checked + .slider { background-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

@media (max-width: 900px) {
  .auto-block-input { grid-template-columns: 1fr; }
  .auto-block-control { justify-content: flex-start; }
}

/* ================= MOBILE ================= */
@media (max-width: 640px) {
  html, body { font-size: 15px; -webkit-text-size-adjust: 100%; }

  /* ----- Topbar: saubere 2 Zeilen ----- */
  .page-dashboard { grid-template-rows: auto 1fr; }
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-auto-rows: auto;
    padding: 0;
    height: auto;
    gap: 0;
    align-items: center;
  }
  .brand { padding: 10px 14px; font-size: 1rem; }
  .topbar-actions { padding: 8px 10px; gap: 6px; }
  .topbar-actions #who { display: none; }
  .topbar-actions button {
    min-width: 40px; min-height: 40px; padding: 6px 10px;
    font-size: 0.85rem;
  }
  /* User-Spec Lars 2026-05-15: Mobile-Tabs als Off-Canvas-Menü statt horizontal-
     scrollender Leiste — schont Bildschirmfläche und vermeidet Überlappungen. */
  .burger-btn { display: inline-flex; align-items: center; justify-content: center; }
  .tabs {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(80vw, 280px);
    background: var(--surface);
    border-left: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 60px 12px 12px;
    overflow-y: auto;
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.18s ease;
    border-top: none;
  }
  .tabs.open { transform: translateX(0); }
  .tabs button {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.95rem;
    text-align: left;
    width: 100%;
    border-radius: 6px;
  }

  /* Main */
  main#view-container { padding: 12px 10px; }
  h2 { font-size: 1.15rem; margin-bottom: 10px; }

  /* ----- Toolbar kompakt ----- */
  .toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    align-items: center;
    margin-bottom: 10px;
  }
  .toolbar input[type="text"],
  .toolbar input[type="search"] {
    grid-column: 1 / -1;
    width: 100%; min-height: 42px; font-size: 16px;
    padding: 10px 12px;
  }
  .toolbar select {
    min-height: 40px; font-size: 15px;
    padding: 6px 28px 6px 10px;
  }
  .toolbar label {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.85rem; color: var(--text-dim);
    padding: 0 4px;
  }
  .toolbar label input[type="checkbox"] {
    width: 20px; height: 20px; margin: 0;
  }
  .toolbar button {
    min-height: 40px; padding: 8px 14px;
    font-size: 0.9rem;
  }
  .toolbar .hint { display: none; }

  /* Drawer-Scroll ist eigenständig; Body darf nicht hinter dem Drawer weiterbewegen. */
  .drawer-body {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* ----- Tabellen → Card-Layout auf Mobile ----- */
  table.data,
  table.data tbody,
  table.data tr,
  table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data { background: transparent; box-shadow: none; border-radius: 0; }
  table.data tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-auto-rows: auto;
    gap: 6px 10px;
    align-items: center;
    cursor: pointer;
  }
  table.data tr:hover { background: var(--surface); }
  table.data td {
    padding: 0; border: none;
    color: var(--text-dim); font-size: 0.8rem;
  }
  /* Erste Zelle (Name) groß oben links */
  table.data td:nth-child(1) {
    font-size: 1rem; font-weight: 600; color: var(--text);
    grid-column: 1; grid-row: 1;
  }
  /* Zweite Zelle (Status-Pill) oben rechts */
  table.data td:nth-child(2) {
    grid-column: 2; grid-row: 1;
    text-align: right;
  }
  /* Dritte Zelle (Telefon als Call-Button) zweite Zeile spannt */
  table.data td:nth-child(3) {
    grid-column: 1 / -1; grid-row: 2;
  }
  /* Weitere Zellen darunter zusammen */
  table.data td:nth-child(n+4):not(:empty) {
    grid-column: 1 / -1;
    font-size: 0.78rem; color: var(--text-dim);
  }
  table.data td:empty { display: none; }
  /* Empty-State-Zeile (colspan) */
  table.data tr td[colspan] {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
  }
  /* Claim-Button in "Offen" volle Breite */
  table.data td button {
    width: 100%; min-height: 44px; font-size: 0.95rem;
  }

  /* Telefon-Link als großer Call-Button (Mobile-primary-action) */
  table.data a[href^="tel:"] {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--accent);
    color: white !important;
    font-weight: 600; font-size: 1rem;
    text-decoration: none !important;
    min-height: 48px;
    width: 100%;
  }
  table.data a[href^="tel:"]::before {
    content: "📞";
    font-size: 1.1rem;
  }
  table.data a[href^="tel:"]:active { background: var(--accent-2); transform: scale(0.98); }

  /* ----- Drawer: Vollbild ----- */
  .drawer { width: 100vw; max-width: 100vw; left: 0; right: 0; }
  .drawer-head { padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); }
  .drawer-head h2 { font-size: 1.35rem; }
  .drawer-body {
    padding: 14px 14px max(80px, env(safe-area-inset-bottom));
  }
  .drawer-body section { margin-bottom: 18px; }
  .drawer-body dl { grid-template-columns: 1fr; gap: 0; }
  .drawer-body dt {
    font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 0.05em; margin-top: 10px;
  }
  .drawer-body dd { margin: 2px 0 0; }
  .drawer-body input, .drawer-body select, .drawer-body textarea {
    font-size: 16px; padding: 10px 12px; min-height: 44px;
    width: 100%;
  }
  .drawer-body textarea { min-height: 80px; }
  .drawer-body a[href^="tel:"],
  .drawer-body a[href^="mailto:"] {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 16px; margin: 4px 0;
    border-radius: 8px;
    background: var(--accent); color: white !important;
    font-weight: 600; font-size: 1rem;
    text-decoration: none !important; min-height: 44px;
  }
  .drawer-body a[href^="tel:"]::before { content: "📞"; }
  .drawer-body a[href^="mailto:"] {
    background: var(--surface-2); color: var(--text) !important;
    border: 1px solid var(--border);
  }

  /* Kanban: swipeable */
  .kanban {
    grid-template-columns: repeat(8, 85vw);
    gap: 8px;
    scroll-snap-type: x mandatory;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    /* Mobile: max-height vom Desktop nicht erzwingen, normales Page-Scroll */
    max-height: none;
    overflow-y: visible;
  }
  .kanban-col { scroll-snap-align: start; min-height: 260px; }
  .kanban-card { padding: 12px 14px; font-size: 0.95rem; }
  .kanban-card .meta { font-size: 0.8rem; }

  /* Modals */
  .modal {
    min-width: auto; width: 95vw; max-height: 92vh; padding: 16px;
  }
  .modal input, .modal select, .modal textarea {
    min-height: 42px; font-size: 16px;
  }
  .modal-actions { flex-direction: column-reverse; gap: 8px; }
  .modal-actions button { width: 100%; min-height: 44px; }

  button { min-height: 40px; }

  .alert-card { flex-direction: column; align-items: stretch; gap: 8px; }
  .alert-card > div:last-child { display: flex; gap: 6px; }
  .alert-card button { flex: 1; }

  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-card { padding: 10px 12px; }
  .kpi-card .value { font-size: 1.4rem; }

  #toast-stack { bottom: 8px; right: 8px; left: 8px; }
  .toast { min-width: auto; }
}

/* ================= iOS Home-Bildschirm-Banner ================= */
.ios-install-banner {
  position: fixed;
  bottom: 12px; left: 12px; right: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 500;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.ios-install-banner .txt {
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text);
}
.ios-install-banner .txt strong { color: var(--accent); }
.ios-install-banner .share-icon {
  display: inline-block;
  width: 16px; height: 20px;
  vertical-align: -4px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 20'><path fill='%233b82f6' d='M8 0L4 4h3v9h2V4h3L8 0zm-5 8v10c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V8h-2v10H5V8H3z'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
}
.ios-install-banner button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
}

/* iOS safe-area (Notch) */
@supports (padding: max(0px)) {
  .topbar { padding-top: max(8px, env(safe-area-inset-top)); }
  main#view-container { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}

/* ---- Checkbox ---- */
input[type=checkbox] { accent-color: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .kanban { grid-template-columns: repeat(8, 240px); }
  .settings-grid { grid-template-columns: 1fr; }
}

/* ---- Misc ---- */
.hint { color: var(--text-dim); font-size: 0.85rem; }
.small { font-size: 0.8rem; }
.bar {
  background: var(--surface-2); border-radius: 4px; overflow: hidden; height: 18px; min-width: 80px;
  position: relative;
}
.bar-fill { background: var(--accent); height: 100%; }
.bar-label { position: absolute; left: 6px; top: 1px; font-size: 0.75rem; color: var(--text); mix-blend-mode: difference; }

/* ---- Kalender (Berater-Portal) ---- */
.cal-connection {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; margin: 12px 0 20px;
}
.cal-connection.ok { border-left: 4px solid #10b981; }
.cal-connection.off { border-left: 4px solid #f59e0b; }
.cal-connection a.primary-btn {
  background: var(--accent); color: white; padding: 10px 16px; border-radius: 6px;
  text-decoration: none; font-weight: 500; white-space: nowrap;
}
.cal-connection a.primary-btn:hover { background: var(--accent-2); }

.cal-section { margin-top: 20px; }
.cal-section h3 { margin-bottom: 6px; }
/* CR Berater-Self-Service 2026-05-30: Profil-Block (WhatsApp + Lead-Time) */
.profile-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.profile-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.profile-block h4 { margin: 0 0 8px; font-size: 1rem; }
.profile-block .checkbox-row {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 6px;
  font-size: 0.9rem;
}
.profile-block .checkbox-row input[type=checkbox] { margin: 0; }

.slot-grid {
  display: grid; gap: 12px; margin-top: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.slot-day {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 12px;
}
.slot-day h4 { margin: 0 0 10px; font-size: 1.1rem; color: var(--text); }
/* CR Lars 2026-08-04 (#10): Zeitfenster direkt in der Zeile editierbar
   (Calendly-Modell) statt über ein Modal mit Dauer- und Puffer-Feldern. */
.slot-rule {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); padding: 6px 10px; border-radius: 4px;
  margin-bottom: 6px; font-size: 0.85rem;
}
.slot-rule input[type=time] {
  flex: 1 1 0; min-width: 0; margin: 0;
  padding: 3px 6px; font-size: 0.85rem;
}
.slot-rule .slot-dash { color: var(--muted); flex: 0 0 auto; }
.slot-rule .link-btn { flex: 0 0 auto; }
.slot-empty { font-size: 0.8rem; margin-bottom: 8px; }
.link-btn {
  background: none; border: none; color: var(--accent); cursor: pointer;
  padding: 4px 6px; font-size: 0.85rem;
}
.link-btn:hover { color: var(--accent-2); text-decoration: underline; }
.link-btn[data-del] { color: #ef4444; }
.link-btn[data-del]:hover { color: #dc2626; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 720px) {
  .slot-grid { grid-template-columns: 1fr; }
  .cal-connection { flex-direction: column; align-items: stretch; text-align: left; }
  .cal-connection a.primary-btn { text-align: center; }
}

/* ---- Lead-Bewertung ---- */
.rating-card {
  background: var(--surface); border-radius: var(--radius); padding: 16px;
  margin-bottom: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  border-left: 4px solid var(--accent);
}
.rating-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  margin-bottom: 12px;
}
.rating-head-main { min-width: 0; flex: 1; }
.rating-lead-name {
  margin: 0 0 6px 0; font-size: 1.5rem; font-weight: 700; color: var(--text);
  line-height: 1.2;
}
.rating-vertrieb {
  display: inline-block; background: var(--accent); color: white;
  padding: 3px 10px; border-radius: 12px; font-size: 0.9rem; font-weight: 600;
  margin-bottom: 6px;
}
.rating-vertrieb-missing {
  background: var(--surface-2); color: var(--text-dim); font-weight: 400;
  border: 1px dashed var(--border);
}
.rating-open-lead {
  color: var(--text); text-decoration: none; border-bottom: 2px solid transparent;
  transition: border-color 0.1s;
}
.rating-open-lead:hover {
  color: var(--accent); border-bottom-color: var(--accent); text-decoration: none;
}
.rating-open-btn {
  margin-top: 8px; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); padding: 4px 10px; border-radius: 4px;
  cursor: pointer; font-size: 0.8rem;
}
.rating-open-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.rating-total { text-align: center; min-width: 80px; }
.rating-total-num {
  font-size: 2rem; font-weight: 700; color: var(--accent);
  line-height: 1;
}
.rating-body {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 18px;
}
.rating-breakdown table.data.compact { font-size: 0.85rem; }
.rating-breakdown table.data.compact th,
.rating-breakdown table.data.compact td { padding: 5px 8px; }
.rating-breakdown table.data.compact tr:hover { background: transparent; cursor: default; }
.rating-breakdown .rating-detail { color: var(--text-dim); }
.range-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.range-chip {
  display: inline-block; font-size: 0.72rem; padding: 2px 6px; border-radius: 10px;
  background: var(--surface); color: var(--text-dim); border: 1px solid var(--border);
}
.range-chip.active {
  background: #fbbf24; color: #1a202c; border-color: #fbbf24; font-weight: 600;
}

@keyframes field-error-flash-kf {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.45); }
}
.field-error-flash {
  animation: field-error-flash-kf 0.7s ease-in-out 2;
  outline: 2px solid #ef4444 !important;
  outline-offset: 1px;
}
.rating-breakdown .rating-points { text-align: right; font-weight: 600; }
.rating-breakdown .rating-weight { text-align: left; color: var(--text-dim); }
.rating-breakdown tfoot td { background: var(--surface-2); }

.rating-mine {
  background: var(--surface-2); border-radius: var(--radius); padding: 12px;
}
.rating-mine-label { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 6px; }
.rating-stars { display: flex; gap: 4px; margin-bottom: 8px; }
.star-btn {
  background: none; border: none; color: #4a5568; font-size: 1.6rem; cursor: pointer;
  padding: 0; line-height: 1; transition: color 0.1s;
}
.star-btn:hover, .star-btn.filled { color: #fbbf24; }
.rating-comment {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); padding: 6px 8px; font-family: inherit;
  font-size: 0.85rem; resize: vertical;
}
.rating-actions { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.rating-actions button {
  background: var(--accent); color: white; border: none; padding: 5px 12px;
  border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}
.rating-actions button:hover { background: var(--accent-2); }
.rating-actions button.secondary {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.rating-other { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.other-rating { font-size: 0.85rem; margin-bottom: 6px; }
.other-rating .rating-comment-text {
  color: var(--text-dim); font-style: italic; margin-top: 2px;
}
.stars-static { color: #4a5568; letter-spacing: 1px; }
.stars-static .filled { color: #fbbf24; }

/* Pipeline-Karten: kompakte Sternreihe pro Lead (nur Admin-Sicht). */
.kanban-card .card-stars { margin: 2px 0 4px; font-size: 0.9rem; line-height: 1; }
.kanban-card .card-stars.unrated { opacity: 0.4; }
/* Felder-Counter auf unbewerteten Karten: deutlicher als die blassen Sterne,
   damit man den Bearbeitungs-Fortschritt sieht. */
.kanban-card .card-stars.incomplete {
  opacity: 1;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim, #94a3b8);
}
.kanban-card .card-stars.ready { opacity: 0.55; }

@media (max-width: 900px) {
  .rating-body { grid-template-columns: 1fr; }
}

/* ---- Feedback Admin-Tab ---- */
.feedback-card .feedback-beschr {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; color: var(--text-dim);
}
.feedback-card.dimmed { opacity: 0.6; }
.feedback-card.dimmed:hover { opacity: 1; }

.feedback-verworfen-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.feedback-detail {
  background: var(--surface); padding: 20px 22px; border-radius: var(--radius);
  max-width: 720px; width: 95vw; max-height: 90vh; overflow-y: auto;
}
.feedback-detail-head {
  display: flex; justify-content: space-between; align-items: flex-start;
}
.feedback-detail-close {
  background: none; border: none; color: var(--text-dim); font-size: 1.3rem; cursor: pointer;
}
.feedback-status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 0.8rem; font-weight: 600;
}
.feedback-status-offen     { background: rgba(245,158,11,0.18); color: #92400e; }
.feedback-status-in_arbeit { background: rgba(59,130,246,0.18); color: #1e40af; }
.feedback-status-erledigt  { background: rgba(16,185,129,0.18); color: #065f46; }
.feedback-status-verworfen { background: rgba(239,68,68,0.18);  color: #991b1b; }

.feedback-detail-beschr {
  background: var(--surface-2); border-radius: 6px; padding: 12px 14px;
  white-space: pre-wrap; margin-bottom: 14px; font-size: 0.9rem; line-height: 1.5;
}
.feedback-detail-screenshot { margin-bottom: 14px; }
.feedback-detail-screenshot img {
  max-height: 260px; max-width: 100%; border-radius: 6px;
  border: 1px solid var(--border); display: block;
}
.feedback-antwort-label {
  display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 4px;
}
.feedback-detail textarea {
  width: 100%; box-sizing: border-box;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-family: inherit; font-size: 0.9rem;
  resize: vertical;
}
.feedback-actions {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 12px;
}
.feedback-status-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.feedback-detail button {
  background: var(--accent); color: white; border: none; padding: 6px 14px;
  border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}
.feedback-detail button:hover:not(:disabled) { background: var(--accent-2); }
.feedback-detail button.secondary {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.feedback-detail button.danger { background: #ef4444; }
.feedback-detail button.danger:hover { background: #dc2626; }
.feedback-verwerf-inline {
  margin-top: 12px; padding: 12px; background: var(--surface-2);
  border-radius: 6px; border-left: 3px solid #ef4444;
}

/* ---- Description (HTML-Render im Drawer) ---- */
.description-section .description-head {
  display: flex; justify-content: space-between; align-items: center;
}
.description-toggle {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 4px 10px; border-radius: 4px; font-size: 0.8rem; cursor: pointer;
}
.description-toggle:hover { background: var(--accent); color: white; border-color: var(--accent); }
.description-view {
  background: var(--surface-2); border-radius: 6px; padding: 12px 14px;
  font-size: 0.9rem; line-height: 1.5; word-wrap: break-word;
}
/* Reiner Klartext (von Hand getippt, kein Import-HTML): Zeilenumbrüche erhalten. */
.description-view--plain { white-space: pre-wrap; }
.description-view h1, .description-view h2, .description-view h3, .description-view h4 {
  font-size: 1rem; margin: 12px 0 4px; color: var(--text);
}
.description-view h1:first-child, .description-view h2:first-child,
.description-view h3:first-child, .description-view h4:first-child { margin-top: 0; }
.description-view p { margin: 6px 0; }
.description-view ul, .description-view ol { margin: 6px 0; padding-left: 24px; }
.description-view li { margin: 2px 0; }
.description-view strong { color: var(--text); }
.description-view a { color: var(--accent); }
.description-view blockquote {
  margin: 6px 0; padding: 4px 12px; border-left: 3px solid var(--accent);
  background: var(--surface); color: var(--text-dim);
}
.description-edit {
  width: 100%; min-height: 200px; box-sizing: border-box;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px; font-family: ui-monospace, monospace; font-size: 0.85rem;
}

/* ---- Weissglut-Report: Bewertung in der Lead-Tabelle + Quoten ---- */
.wg-stars { color: #f59e0b; letter-spacing: 1px; white-space: nowrap; }
.wg-stars-empty { color: var(--border); }
.wg-rating { margin-bottom: 2px; }
.wg-rating:last-child { margin-bottom: 0; }
.wg-rater { font-size: 0.8rem; color: var(--text-dim); }
.wg-comment { font-size: 0.85rem; white-space: pre-wrap; }
.wg-comment + .wg-comment { margin-top: 4px; }
/* „Nächster Schritt – wann" in der Vergangenheit bei offenem Lead */
.wg-overdue { color: var(--danger); font-weight: 600; }
.wg-kanal {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 0.8rem; white-space: nowrap;
}
/* ---- Trichter (CAC-Waterfall) ---- */
.wg-funnel {
  display: flex; align-items: stretch; gap: 4px; overflow-x: auto;
  padding: 4px 0 8px;
}
.wg-funnel-stage {
  flex: 1 1 0; min-width: 140px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 10px; display: flex; flex-direction: column; gap: 4px;
}
.wg-funnel-title { font-size: 0.8rem; color: var(--text-dim); }
.wg-funnel-value { font-size: 1.5rem; font-weight: 700; }
.wg-funnel-rate { font-size: 0.9rem; font-weight: 600; color: var(--success, #16a34a); }
.wg-funnel-sub { font-size: 0.8rem; color: var(--text-dim); }
.wg-funnel-arrow {
  display: flex; align-items: center; color: var(--text-dim);
  font-size: 1.3rem; flex: 0 0 auto;
}
/* Trichter mit sieben Stufen: schmaler, damit mehr aufs Bild passt — der
   Container scrollt ohnehin horizontal, wenn es eng wird. */
.wg-funnel-wide .wg-funnel-stage { min-width: 118px; padding: 10px 8px; }
.wg-funnel-wide .wg-funnel-value { font-size: 1.25rem; }
.wg-funnel-wide .wg-funnel-arrow { font-size: 1.05rem; }
.wg-funnel-muted { opacity: 0.6; }
/* Quote über 100 % = der Nenner ist untererfasst (nicht markierte Termine). */
.wg-funnel-rate.warn { color: var(--warn, #d97706); }

/* Stufen sind auswählbar — der Klick filtert nur die Lead-Liste darunter. */
.wg-funnel-click { cursor: pointer; }
.wg-funnel-click:hover { border-color: var(--accent); }
.wg-funnel-click:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wg-funnel-stage.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.wg-funnel-stage.active .wg-funnel-title { color: var(--accent); }
/* Kleinzahlen unter „stattgefunden": gestrichelt = auswählbar, aber keine Stufe. */
.wg-funnel-subbtn {
  font: inherit; font-size: 0.8rem; line-height: 1.4; color: var(--text-dim);
  background: none; border: 1px dashed var(--border); border-radius: 999px;
  padding: 1px 8px; cursor: pointer;
}
.wg-funnel-subbtn:hover { border-color: var(--accent); color: var(--accent); }
.wg-funnel-subbtn.active {
  border-style: solid; border-color: var(--accent); color: var(--accent);
}

/* ---- Lead-Ebene zum Trichter ---- */
.wg-leads-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.wg-leads-head h3 { margin: 0; }
.wg-leads-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.wg-leads-head-actions button {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 0.9rem;
}
.wg-leads-head-actions button:hover { border-color: var(--accent); }
/* Während die Liste nachgeladen wird: alter Stand bleibt stehen, nur gedimmt. */
#wg-lead-table.wg-loading { opacity: 0.5; pointer-events: none; }
.wg-lead-table th.wg-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.wg-lead-table th.wg-sortable:hover { color: var(--accent); }
.wg-lead-table th.wg-sortable.active { color: var(--accent); }
/* Spalten per Drag verschieben: der Griff liegt immer im Fluss und wird beim
   Überfahren nur eingeblendet — sonst würde die Kopfzeile springen. */
.wg-th-grip { opacity: 0; margin-right: 6px; color: var(--text-dim); cursor: grab; }
.wg-lead-table th.wg-sortable:hover .wg-th-grip { opacity: 0.7; }
.wg-lead-table th.wg-drag-src { opacity: 0.4; }
.wg-lead-table th.wg-drop-before { box-shadow: inset 3px 0 0 0 var(--accent); }
.wg-lead-table th.wg-drop-after  { box-shadow: inset -3px 0 0 0 var(--accent); }
.wg-lead-table td { white-space: nowrap; vertical-align: top; }
/* Begründung ist Freitext: umbrechen statt die Tabelle in die Breite ziehen,
   auf drei Zeilen gedeckelt — der volle Text steht im title der Zelle. */
.wg-lead-table td.wg-cell-text { white-space: normal; min-width: 200px; max-width: 380px; }
.wg-lead-table td.wg-cell-text .wg-comment {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.wg-lead-link { color: var(--accent); text-decoration: none; }
.wg-lead-link:hover { text-decoration: underline; }

/* Spalten-Modal: Liste mit Drag-Griff.
   `.modal input` setzt global width:100% + Padding + Rahmen + margin-bottom —
   das traf auch die Häkchen hier und machte aus jeder Zeile einen Klotz mit
   verrutschtem Text. Checkbox und Label werden deshalb explizit zurückgesetzt. */
.wg-col-list {
  list-style: none; margin: 12px 0; padding: 0;
  max-height: 60vh; overflow-y: auto; min-width: 300px;
}
.wg-col-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px; margin-bottom: 6px;
  background: var(--surface); cursor: grab;
}
.wg-col-row:hover { border-color: var(--accent); }
.wg-col-row.dragging { opacity: 0.45; }
.wg-col-row label {
  display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer;
  margin: 0; font-size: 0.95rem; color: var(--text);
}
.wg-col-row input[type=checkbox] {
  width: auto; flex: 0 0 auto; margin: 0; padding: 0;
  border: none; border-radius: 0; background: none;
}
.wg-col-grip { color: var(--text-dim); cursor: grab; flex: 0 0 auto; }

.wg-quotas .wg-total td { font-weight: 700; border-top: 2px solid var(--border); }
.wg-quotas .wg-dim td { opacity: 0.55; }

/* ---- Kampagnen-Ziele (Modal) ---- */
.cg-scroll { max-height: 55vh; overflow-y: auto; margin-top: 12px; }
.cg-table td { vertical-align: top; }
.cg-table select { width: 100%; max-width: 260px; }
.cg-table .cg-state { margin-top: 4px; }
.wg-thin {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-dim); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px;
}

/* ---- Weissglut-Reimport UI ---- */
.reimport-section .file-input-wrap {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px;
}
.reimport-section input[type="file"] {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 4px; padding: 4px 8px;
}
.reimport-diff {
  margin-top: 12px; padding: 12px; background: var(--surface-2); border-radius: 6px;
  max-height: 480px; overflow-y: auto; font-size: 0.85rem;
}
.reimport-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px;
  margin-bottom: 12px;
}
.reimport-summary > div {
  background: var(--surface); border-radius: 6px; padding: 8px 12px; text-align: center;
}
.reimport-summary .num { font-size: 1.4rem; font-weight: 700; color: var(--accent); }
.reimport-summary .label { font-size: 0.75rem; color: var(--text-dim); }
.reimport-edge-cases {
  margin-top: 10px; padding: 10px; background: rgba(239,68,68,0.1);
  border-left: 3px solid #ef4444; border-radius: 4px;
}
.reimport-edge-cases ul { margin: 4px 0 0; padding-left: 20px; }
.reimport-changes-list { max-height: 200px; overflow-y: auto; }
.reimport-changes-list table { width: 100%; font-size: 0.8rem; }
.reimport-changes-list td { padding: 3px 6px; border-bottom: 1px solid var(--border); }
