/* =========================================================
   3016 Dialer · Design System & Performance-Tuned Stylesheet
   - Konsistentes Spacing/Typo/Farb-Token-System
   - GPU-freundlich: transform/opacity statt box-shadow/filter Animationen
   - Keine teuren backdrop-filter/background-attachment-Hotspots
   ========================================================= */

:root {
  /* Farben (Basis) */
  --bg: #0b1020;
  --bg-2: #131a32;
  --bg-3: #1c2547;
  --panel: rgba(255,255,255,0.04);
  --panel-2: rgba(255,255,255,0.07);
  --panel-3: rgba(255,255,255,0.10);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --txt: #eaf0ff;
  --txt-muted: #9aa6c8;
  --txt-dim: #7a86a8;
  --accent: #6d8bff;
  --accent-2: #9c6dff;
  --gold: #f7c948;
  --green: #4ade80;
  --green-2: #22c55e;
  --red: #f87171;
  --orange: #fb923c;
  --blue: #60a5fa;
  --grey: #94a3b8;

  /* Akzente (sek.) */
  --c-blue:   #60a5fa;
  --c-violet: #c084fc;
  --c-pink:   #f472b6;
  --c-rose:   #fb7185;
  --c-orange: #fb923c;
  --c-amber:  #fbbf24;
  --c-lime:   #a3e635;
  --c-mint:   #34d399;
  --c-cyan:   #22d3ee;
  --c-grey:   #94a3b8;

  /* Gradienten */
  --grad-primary: linear-gradient(135deg, #6d8bff 0%, #9c6dff 100%);
  --grad-success: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  --grad-warn:    linear-gradient(135deg, #fbbf24 0%, #fb923c 100%);
  --grad-danger:  linear-gradient(135deg, #fb7185 0%, #ef4444 100%);
  --grad-gold:    linear-gradient(135deg, #fde68a 0%, #f59e0b 100%);

  /* Spacing-Skala (4-pt) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;

  /* Radien */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 22px;
  --r-pill: 999px;

  /* Typo-Skala */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 22px;
  --fs-2xl: 28px;

  /* Schatten (kompakter, GPU-freundlich) */
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.25);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.32);
  --shadow-lg: 0 12px 30px rgba(0,0,0,0.40);
  --shadow: var(--shadow-md);

  /* Safe-Area */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* =========================================================
   Reset & Base
   ========================================================= */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior-y: contain;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

/* Body-Hintergrund: einfacher gemustertes Mesh ohne background-attachment
   (background-attachment: fixed kostet auf Mobil massiv FPS beim Scrollen). */
body {
  min-height: 100vh;
  background:
    radial-gradient(70% 40% at 0% 0%, rgba(109,139,255,0.18), transparent 70%),
    radial-gradient(60% 40% at 100% 0%, rgba(156,109,255,0.18), transparent 70%),
    radial-gradient(50% 35% at 100% 100%, rgba(34,211,153,0.08), transparent 70%),
    var(--bg);
  padding-top: calc(56px + var(--safe-top));
  padding-bottom: calc(72px + var(--safe-bottom));
}

h1, h2, h3 { margin: 0 0 var(--sp-2); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); letter-spacing: -0.005em; }
h3 { font-size: 13px; color: var(--txt-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }

input, select, textarea, button {
  font-family: inherit; font-size: 16px; color: var(--txt);
}

/* =========================================================
   Topbar / Brand / HUD
   ========================================================= */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--sp-2) + var(--safe-top)) var(--sp-4) var(--sp-2);
  background: rgba(11,16,32,0.92);
  border-bottom: 1px solid var(--border);
}
/* Backdrop-blur ist teuer — nur dort, wo Hardware ihn günstig kann.
   `@supports` greift gezielt auf Browser, die ihn unterstützen, der Fallback
   ist eine deckendere Vollfarbe. */
@supports ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
  .topbar { background: rgba(11,16,32,0.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
}

.brand { display: flex; align-items: center; gap: var(--sp-2); font-weight: 700; letter-spacing: 0.4px; font-size: 17px; }
.brand .logo { color: var(--gold); display: inline-flex; align-items: center; }
.brand .logo .icon { width: 22px; height: 22px; }

.hud { display: flex; gap: 6px; }
.hud-item {
  display: flex; align-items: center; gap: var(--sp-1);
  padding: 6px 10px; border-radius: var(--r-pill);
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.hud-icon { display: inline-flex; align-items: center; }
.hud-icon .icon { width: 14px; height: 14px; }
.hud-item:nth-child(1) .hud-icon { color: var(--gold); }
.hud-item:nth-child(2) .hud-icon { color: var(--c-orange); }
.hud-item:nth-child(3) .hud-icon { color: var(--c-mint); }

/* =========================================================
   Bottom-Nav
   ========================================================= */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: rgba(11,16,32,0.95);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
@supports ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
  .bottom-nav { background: rgba(11,16,32,0.78); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}
.nav-btn {
  position: relative;
  background: none; border: 0; color: var(--txt-muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: var(--sp-2) 2px 6px; cursor: pointer; font-size: 10px;
  min-width: 0; overflow: hidden;
  transition: color .2s ease;
}
.nav-btn .nav-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; line-height: 1;
  transition: opacity .2s ease, transform .2s ease;
}
.nav-btn .nav-ico .icon { width: 22px; height: 22px; }
.nav-btn b {
  font-weight: 600; font-size: 10px;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--txt-muted); transition: color .2s ease;
}

.nav-btn[data-tab="stats"]    .nav-ico { color: var(--c-blue); }
.nav-btn[data-tab="leads"]    .nav-ico { color: var(--c-violet); }
.nav-btn[data-tab="dialer"]   .nav-ico { color: var(--c-mint); }
.nav-btn[data-tab="agenda"]   .nav-ico { color: var(--c-amber); }
.nav-btn[data-tab="search"]   .nav-ico { color: var(--c-pink); }
.nav-btn[data-tab="settings"] .nav-ico { color: var(--c-grey); }

.nav-btn:not(.active) .nav-ico { opacity: 0.55; }
.nav-btn.active { color: currentColor; }
.nav-btn.active .nav-ico { opacity: 1; transform: translateY(-2px); }
.nav-btn.active b { color: var(--txt); }
.nav-btn.active::before {
  content: '';
  position: absolute; top: 4px; left: 50%;
  width: 26px; height: 3px; border-radius: 2px;
  background: currentColor; opacity: 0.55;
  transform: translateX(-50%);
}

/* iOS-/Android-Style Benachrichtigungs-Badge. */
.nav-icon-wrap { position: relative; display: inline-block; line-height: 1; }
.nav-badge[hidden] { display: none !important; }
#agenda-badge { font-size: 10px !important; }
#agenda-badge.is-wide { font-size: 11px !important; }
.nav-badge {
  position: absolute;
  top: -6px; left: -10px;
  display: inline-flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1;
  width: 18px; height: 18px;
  min-width: 18px;
  border-radius: 50%;
  font-size: 7px;
  font-weight: 700;
  line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  letter-spacing: -0.2px;
  border: 2px solid var(--bg, #0b1020);
  color: #fff;
  pointer-events: none;
  z-index: 2;
}
.nav-badge.is-wide { width: 22px; height: 22px; min-width: 22px; font-size: 8px; }
.nav-badge.is-green  { background: linear-gradient(135deg, #34d27a 0%, #1fa85b 100%); }
.nav-badge.is-yellow { background: linear-gradient(135deg, #ffd252 0%, #f0b400 100%); color: #1a1300; }
.nav-badge.is-red {
  background: linear-gradient(135deg, #ff5b5b 0%, #e02d3c 100%);
  /* GPU-freundliches Pulsieren: nur transform animieren, kein box-shadow. */
  animation: badgePulse 1.4s ease-in-out infinite;
  will-change: transform;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}

/* =========================================================
   View / Page-Header Pattern
   ========================================================= */
main#view {
  padding: var(--sp-3) var(--sp-3) var(--sp-6);
  max-width: 720px;
  margin: 0 auto;
  /* Sanfter Tab-Wechsel — einmaliger Fade, keine teure Wiederholung. */
  animation: viewIn .22s ease-out;
}
@keyframes viewIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* Konsistenter Page-Header für alle Tabs. */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-1) var(--sp-3);
  margin-bottom: var(--sp-2);
}
.page-title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.015em;
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.page-title .icon { width: 22px; height: 22px; }
.page-subtitle {
  color: var(--txt-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  margin-top: 2px;
}
.page-header-actions { display: flex; gap: var(--sp-2); align-items: center; flex-shrink: 0; }

/* =========================================================
   Karten & Layout
   ========================================================= */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-4);
  box-shadow: var(--shadow);
  margin-bottom: var(--sp-3);
}

.row { display: flex; gap: var(--sp-2); }
.col { display: flex; flex-direction: column; gap: var(--sp-2); }
.gap-4 { gap: var(--sp-1); }
.gap-8 { gap: var(--sp-2); }
.gap-12 { gap: var(--sp-3); }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.spacer { height: var(--sp-2); }

/* Spacing-Utilities — ersetzen verstreute inline-style-Margins. */
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: var(--sp-1); }
.mt-4 { margin-top: var(--sp-2); }
.mt-6 { margin-top: var(--sp-3); }
.mt-8 { margin-top: var(--sp-4); }
.mt-12 { margin-top: var(--sp-5); }

/* Muted-Klassen — ersetzen inline `font-size:11/12/13px;color:#…`. */
.muted { color: var(--txt-muted); font-size: 13px; }
.muted-sm { color: var(--txt-muted); font-size: var(--fs-sm); line-height: 1.4; }
.muted-xs { color: var(--txt-dim); font-size: var(--fs-xs); line-height: 1.4; }
.text-danger { color: #fca5a5; }

/* =========================================================
   Section-Header in Karten (statt h3 mit Inline-Margins)
   ========================================================= */
.section-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.section-head h2,
.section-head h3 {
  margin: 0;
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.section-head .section-meta { color: var(--txt-muted); font-size: 13px; }

/* =========================================================
   Inputs / Forms
   ========================================================= */
input, select, textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  width: 100%;
  outline: none;
  color: var(--txt);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 3px rgba(109,139,255,0.18);
}
textarea { min-height: 80px; resize: vertical; }
label {
  display: block; font-size: var(--fs-xs); color: var(--txt-muted);
  margin: 6px 2px;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--grad-primary);
  color: white; border: 0; border-radius: var(--r-md);
  font-weight: 700;
  cursor: pointer; min-height: 44px;
  box-shadow: 0 4px 12px rgba(109,139,255,0.32);
  transition: transform .12s ease, box-shadow .15s ease;
  position: relative;
  user-select: none;
}
.btn:hover:not([disabled]) { transform: translateY(-1px); }
.btn:active:not([disabled]) { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn.secondary {
  background: var(--panel-2); border: 1px solid var(--border);
  box-shadow: none; color: var(--txt);
}
.btn.ghost {
  background: transparent; border: 1px solid var(--border);
  box-shadow: none; color: var(--txt);
}
.btn.danger {
  background: var(--grad-danger);
  box-shadow: 0 4px 12px rgba(239,68,68,0.30);
}
.btn.full { width: 100%; }
.btn .icon { vertical-align: -0.18em; margin-right: 4px; }
.btn.full .icon, .btn.grow .icon { margin-right: 6px; }

/* =========================================================
   Status-Pills
   ========================================================= */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 700;
  white-space: nowrap;
}
.status-pill .icon { vertical-align: -0.2em; margin-right: 3px; }
.status-neu        { background: rgba(96,165,250,0.18);  color: var(--blue); }
.status-nicht_ran  { background: rgba(148,163,184,0.18); color: #cbd5e1; }
.status-absage     { background: rgba(248,113,113,0.18); color: var(--red); }
.status-termin     { background: rgba(34,197,94,0.20);   color: var(--green-2); box-shadow: 0 0 0 1px rgba(34,197,94,0.4) inset; }
.status-ungeeignet { background: rgba(120,113,108,0.25); color: #d6d3d1; }
.status-followup   { background: rgba(251,146,60,0.20);  color: var(--orange); }
.status-sonstige   { background: rgba(168,85,247,0.20);  color: #c084fc; }

/* =========================================================
   Lead-Card
   ========================================================= */
.lead-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-3);
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: var(--sp-2);
  cursor: pointer;
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
  /* Off-screen-Cards werden vom Browser ausgelassen → scrollt deutlich flüssiger
     bei langen Listen. */
  content-visibility: auto;
  contain-intrinsic-size: 0 84px;
}
.lead-card:hover { transform: translateY(-1px); border-color: var(--border-strong); background: rgba(255,255,255,0.06); }
.lead-card:active { transform: scale(0.99); }
.lead-card .name { font-weight: 700; font-size: var(--fs-md); line-height: 1.3; }
.lead-card .meta { font-size: var(--fs-sm); color: var(--txt-muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.lead-card .meta span { display: inline-flex; align-items: center; gap: 4px; }
.lead-card .meta .icon { width: 12px; height: 12px; vertical-align: middle; }
.lead-card .meta .icon-briefcase { color: var(--gold); }
.lead-card .meta .icon-phone     { color: var(--c-mint); }
.lead-card .meta .icon-map-pin   { color: var(--c-rose); }
.lead-card .meta .icon-folder    { color: var(--c-violet); }
.lead-card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--sp-1); }
.lead-card .actions .btn { padding: 8px 12px; font-size: 13px; min-height: 38px; flex: 1 1 auto; }

.gf-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(247,201,72,0.16); color: var(--gold);
  border-radius: var(--r-sm); padding: 2px 8px;
  font-size: var(--fs-sm); font-weight: 600;
  border: 1px solid rgba(247,201,72,0.20);
}
.gf-tag .icon { vertical-align: -0.2em; }

/* =========================================================
   Inline-SVG Icons (Lucide)
   ========================================================= */
.icon {
  display: inline-block;
  vertical-align: -0.2em;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
}
.icon-inline { vertical-align: -0.18em; margin-right: 4px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 32px; height: 32px; }

/* Modal-Close, GF-Tag, Status, Goal-Meta, Agenda-Badge, Lead-Detail */
.modal-close .icon { vertical-align: middle; }
.goal-meta .icon { vertical-align: -0.18em; margin-right: 4px; }
.agenda-badge .icon { vertical-align: -0.15em; margin-right: 3px; }

/* =========================================================
   Agenda-Liste
   ========================================================= */
.agenda-list { margin-top: var(--sp-2); }
.agenda-item {
  cursor: pointer;
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
}
.agenda-item:hover { border-color: var(--accent); }
.agenda-item.is-overdue { border-color: #ff6b6b; box-shadow: inset 3px 0 0 #ff6b6b; }
.agenda-badge {
  display: inline-block; margin-left: 6px;
  font-size: var(--fs-xs); font-weight: 700;
  padding: 2px 6px; border-radius: 6px;
}
.agenda-badge.overdue { background: rgba(255,107,107,0.18); color: #ff6b6b; }
.agenda-badge.soon    { background: rgba(247,201,72,0.18); color: var(--gold); }
.agenda-badge.today   { background: rgba(91,140,255,0.18); color: #8ab0ff; }

/* =========================================================
   KPI-Grid
   ========================================================= */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-3); }
.kpi {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-3);
  text-align: center;
  transition: transform .12s ease, border-color .15s ease;
}
.kpi:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.kpi b { font-size: var(--fs-xl); display: block; font-weight: 800; letter-spacing: -0.01em; }
.kpi small { color: var(--txt-muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

/* =========================================================
   Filter-Bar (Dialer)
   ========================================================= */
.filter-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.filter-bar > .gf-scrape-btn { margin-right: auto; }
.filter-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--txt-muted);
  padding: 7px 12px;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  max-width: 100%;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.filter-btn:hover { background: rgba(255,255,255,0.07); color: var(--txt); }
.filter-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.filter-btn .cog { display: inline-flex; align-items: center; line-height: 1; }
.filter-btn .filter-summary {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 64vw;
}
.filter-bar.is-active .filter-btn {
  background: rgba(109,139,255,0.14);
  border-color: rgba(109,139,255,0.40);
  color: var(--txt);
}
.filter-btn .cog .icon { color: var(--c-blue); }
.gf-scrape-btn .cog .icon { color: var(--gold); }

/* =========================================================
   Modal
   ========================================================= */
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--sp-2);
}
.modal-head h3 { margin: 0; font-size: var(--fs-lg); display: inline-flex; align-items: center; gap: var(--sp-2); }
.modal-head h3 .icon { color: var(--accent); }
.modal-close {
  background: transparent; border: 0; color: var(--txt-muted);
  font-size: var(--fs-lg); cursor: pointer;
  padding: 6px 10px; border-radius: var(--r-sm);
  transition: background .15s ease, color .15s ease;
}
.modal-close:hover { background: rgba(255,255,255,0.06); color: var(--txt); }
.modal-body { padding: var(--sp-1) 0; }
.modal-foot {
  display: flex; gap: var(--sp-2); justify-content: flex-end;
  margin-top: var(--sp-4);
}
.modal-foot .btn { min-width: 110px; }
.modal-section-label {
  display: block;
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--txt-muted); font-weight: 700;
  margin: 6px 2px var(--sp-2);
}
.filter-chip-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.filter-chip-grid--single { grid-template-columns: minmax(0, 1fr); }
.filter-chip {
  display: flex; align-items: center; gap: var(--sp-2);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  transition: background .15s ease, border-color .15s ease;
  min-width: 0;
}
.filter-chip > span { min-width: 0; overflow-wrap: anywhere; word-break: break-word; line-height: 1.25; }
.filter-chip input { accent-color: var(--accent); width: 16px; height: 16px; flex: 0 0 auto; }
.filter-chip:has(input:checked) {
  background: rgba(109,139,255,0.14);
  border-color: rgba(109,139,255,0.40);
}
.filter-select {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--txt);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: var(--fs-base);
  font-weight: 600;
}

/* Aktiv-Filter-Badge auf dem "Erweiterte Filter"-Button */
.filter-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px; font-weight: 800;
  margin-left: 6px;
  line-height: 1;
}

/* Tri-State (mit / egal / ohne) */
.tri-state {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2);
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.tri-state-label {
  font-size: var(--fs-base);
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--txt);
}
.tri-state-label .icon { color: var(--txt-muted); }
.tri-state-buttons {
  display: inline-flex;
  gap: 4px;
  background: rgba(0,0,0,0.18);
  padding: 3px;
  border-radius: var(--r-pill);
}
.tri-btn {
  background: transparent; border: 0;
  color: var(--txt-muted);
  padding: 6px 10px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 3px;
  min-height: 28px;
  transition: background .15s ease, color .15s ease;
}
.tri-btn:hover { color: var(--txt); }
.tri-btn.active { color: #fff; }
.tri-btn.active.is-yes { background: var(--c-mint); color: #06321a; }
.tri-btn.active.is-no  { background: var(--c-rose); color: #2c0710; }
.tri-btn.active.is-any { background: var(--panel-3); color: var(--txt); }

.adv-result-bar {
  display: flex; align-items: baseline; justify-content: space-between;
  background: rgba(109,139,255,0.10);
  border: 1px solid rgba(109,139,255,0.25);
  border-radius: var(--r-md);
  padding: 10px 14px;
}
.adv-result-bar b { font-size: var(--fs-lg); font-weight: 800; color: var(--accent); }

/* =========================================================
   Suche-Tab
   ========================================================= */
.name-unknown { color: var(--txt-muted); font-style: italic; }

.search-result-card {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px; margin-bottom: 6px;
  display: flex; align-items: center; gap: var(--sp-2);
}
.search-result-card.is-skipped { opacity: 0.4; filter: grayscale(0.5); }
.search-result-card.is-skipped::after {
  content: 'übersprungen';
  margin-left: var(--sp-2);
  font-size: 10px; color: var(--txt-muted);
  text-transform: uppercase; letter-spacing: .08em;
}
.search-result-card.is-new {
  background: rgba(46, 196, 124, 0.10);
  border-color: rgba(46, 196, 124, 0.45);
}
.search-result-card.is-new .info .n { color: #6ee7a7; }
.search-result-card .new-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: #6ee7a7;
  background: rgba(46, 196, 124, 0.16);
  border: 1px solid rgba(46, 196, 124, 0.35);
  border-radius: var(--r-pill);
  padding: 3px 8px; flex: 0 0 auto;
}
.search-result-card.is-existing {
  background: rgba(229, 72, 77, 0.10);
  border-color: rgba(229, 72, 77, 0.45);
}
.search-result-card.is-existing .info .n { color: #ff8d8f; }
.search-result-card .dup-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: #ff8d8f;
  background: rgba(229, 72, 77, 0.16);
  border: 1px solid rgba(229, 72, 77, 0.35);
  border-radius: var(--r-pill);
  padding: 3px 8px; flex: 0 0 auto;
}
.search-result-card .info { flex: 1; min-width: 0; }
.search-result-card .info .n { font-weight: 700; font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-card .info .a { font-size: var(--fs-xs); color: var(--txt-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#s-progress { margin-top: var(--sp-3); }
.search-progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--r-pill); overflow: hidden;
}
.search-progress-bar > div {
  height: 100%; width: 0;
  background: var(--grad-primary);
  border-radius: var(--r-pill);
  transition: width .3s ease;
}
.search-progress-text { font-size: var(--fs-xs); margin-top: 4px; }

/* =========================================================
   Usage-Card
   ========================================================= */
.usage-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; padding: 4px 0; color: var(--txt-muted);
}
.usage-row b { color: var(--txt); font-weight: 700; font-variant-numeric: tabular-nums; }
.usage-row.big { font-size: var(--fs-md); padding: 6px 0; }
.usage-row.big b { font-size: var(--fs-lg); }
.usage-divider { height: 1px; background: var(--border); margin: var(--sp-2) 0; }
.usage-bar {
  margin-top: 10px; height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--r-pill); overflow: hidden;
}
.usage-bar > div {
  height: 100%; border-radius: var(--r-pill);
  background: var(--grad-primary);
  transition: width .35s ease;
}
.usage-bar.is-warn   > div { background: var(--grad-warn); }
.usage-bar.is-danger > div { background: var(--grad-danger); }
.usage-danger { color: #fca5a5; }

/* =========================================================
   Calendar-Status
   ========================================================= */
.cal-status {
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 13px;
  background: rgba(248,113,113,0.10);
  border: 1px solid rgba(248,113,113,0.30);
  color: #fca5a5;
  display: inline-flex; align-items: center; gap: 6px;
}
.cal-status.ok {
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.35);
  color: #86efac;
}
.cal-status .icon { color: var(--c-rose); }
.cal-status.ok .icon { color: var(--c-mint); }

/* =========================================================
   Danger-Zone
   ========================================================= */
.danger-zone {
  border: 1px solid rgba(239,68,68,0.30);
  background: linear-gradient(180deg, rgba(239,68,68,0.08), rgba(239,68,68,0.02));
}
.danger-zone h2 { color: #fca5a5; }

/* =========================================================
   Goal-Card
   ========================================================= */
.goal-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 14px 16px;
  margin-bottom: var(--sp-3);
}
.goal-card.goal-done {
  background: linear-gradient(180deg, rgba(34,197,94,0.14), rgba(34,197,94,0.04));
  border-color: rgba(34,197,94,0.30);
}
.goal-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: var(--sp-3);
}
.goal-label {
  font-size: var(--fs-xs);
  text-transform: uppercase; letter-spacing: .10em;
  color: var(--txt-muted); font-weight: 600;
}
.goal-count { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.goal-count b { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.01em; }
.goal-count span { color: var(--txt-muted); font-size: var(--fs-base); font-weight: 600; }
.goal-meta { color: var(--txt-muted); font-size: var(--fs-sm); font-weight: 600; }
.goal-card.goal-done .goal-meta { color: var(--green-2); }
.goal-card.goal-done .goal-meta .icon { color: var(--c-amber); }
.goal-bar {
  margin-top: 10px;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.goal-bar > div {
  height: 100%;
  background: var(--grad-primary);
  border-radius: var(--r-pill);
  transition: width .35s ease;
}
.goal-card.goal-done .goal-bar > div {
  background: linear-gradient(90deg, var(--c-mint), var(--green-2));
}

/* =========================================================
   Dialer-Card  (Hero-Bereich)
   ========================================================= */
.dialer-card {
  background:
    radial-gradient(60% 50% at 20% 0%, rgba(109,139,255,0.28), transparent 70%),
    radial-gradient(60% 60% at 100% 100%, rgba(156,109,255,0.22), transparent 70%),
    linear-gradient(180deg, rgba(20,28,52,0.85), rgba(20,28,52,0.55));
  border: 1px solid rgba(109,139,255,0.30);
  border-radius: var(--r-2xl);
  padding: var(--sp-5);
  margin-bottom: var(--sp-3);
  position: relative;
  box-shadow: 0 14px 40px rgba(109,139,255,0.16), inset 0 1px 0 rgba(255,255,255,0.08);
}
.dialer-name {
  display: block;
  font-size: var(--fs-xl);
  font-weight: 800;
  line-height: 1.2;
  color: var(--txt);
  text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
a.dialer-name { border-bottom: 1px dashed rgba(255,255,255,0.18); padding-bottom: 1px; }
a.dialer-name:active { opacity: 0.8; }
.dialer-sub {
  color: var(--txt-muted);
  margin-top: 4px;
  font-size: var(--fs-base);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.dialer-rating {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px; font-size: 13px; color: var(--txt);
  font-variant-numeric: tabular-nums;
}
.dialer-rating-value { font-weight: 700; }
.dialer-rating-count { color: var(--txt-muted); font-size: var(--fs-sm); }
.dialer-stars {
  position: relative; display: inline-block; line-height: 1;
  font-size: var(--fs-base); letter-spacing: 1px;
}
.dialer-stars-empty { color: rgba(255,255,255,0.18); }
.dialer-stars-fill {
  position: absolute; top: 0; left: 0;
  overflow: hidden; white-space: nowrap;
  color: var(--gold);
}
.dialer-card .gf-tag { background: rgba(247,201,72,0.18); }
.dialer-card .gf-tag .icon { color: var(--gold); }

/* Call-Button: GPU-freundlicher Pulse-Ring via Pseudo-Element + transform/opacity. */
.call-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  width: 100%; padding: 18px; margin-top: 14px;
  background: var(--grad-success);
  color: white; font-weight: 800; font-size: 18px; border: 0;
  border-radius: var(--r-2xl);
  box-shadow: 0 6px 18px rgba(16,185,129,0.40);
  cursor: pointer; min-height: 56px;
  text-decoration: none;
  isolation: isolate;
  transition: transform .12s ease;
}
.call-btn::before {
  content: ''; position: absolute; inset: 0;
  border-radius: inherit;
  border: 2px solid rgba(52,211,153,0.55);
  pointer-events: none;
  z-index: -1;
  animation: callPulseRing 2.4s ease-out infinite;
  will-change: transform, opacity;
}
@keyframes callPulseRing {
  0%   { transform: scale(1);    opacity: 0.55; }
  80%  { transform: scale(1.06); opacity: 0;    }
  100% { transform: scale(1.06); opacity: 0;    }
}
.call-btn:active { transform: scale(0.98); }
.call-btn:active::before { animation: none; }

/* =========================================================
   Status-Grid (Dialer)
   ========================================================= */
.status-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); margin-top: 14px; }
.status-grid .btn {
  position: relative; overflow: hidden;
  padding: 13px 10px 13px 14px;
  font-size: var(--fs-base); font-weight: 600;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--txt);
  box-shadow: none;
  letter-spacing: 0.01em;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.status-grid .btn:hover { background: rgba(255,255,255,0.07); border-color: var(--border-strong); }
.status-grid .btn::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: rgba(255,255,255,0.18);
}
.status-btn-termin::before     { background: var(--c-mint); }
.status-btn-followup::before   { background: var(--c-orange); }
.status-btn-absage::before     { background: var(--c-rose); }
.status-btn-nicht_ran::before  { background: var(--grey); }
.status-btn-ungeeignet::before { background: #78716c; }
.status-btn-sonstige::before   { background: var(--c-violet); }
.status-btn-termin {
  background: rgba(34,197,94,0.10);
  border-color: rgba(34,197,94,0.28);
}
.status-btn-termin:hover { background: rgba(34,197,94,0.16); }
.status-btn-termin     .icon { color: var(--c-mint); }
.status-btn-followup   .icon { color: var(--c-orange); }
.status-btn-absage     .icon { color: var(--c-rose); }
.status-btn-nicht_ran  .icon { color: var(--c-grey); }
.status-btn-ungeeignet .icon { color: #a8a29e; }
.status-btn-sonstige   .icon { color: var(--c-violet); }

/* =========================================================
   Chips (Lead-Filter)
   ========================================================= */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 10px;
  border-radius: var(--r-pill);
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 4px;
  transition: background .15s ease, border-color .15s ease;
}
.chip .icon { vertical-align: -0.18em; }
.chip:hover { border-color: var(--border-strong); }
.chip.active {
  background: var(--grad-primary);
  color: white;
  border-color: transparent;
}

/* =========================================================
   Progress (Stats)
   ========================================================= */
.progress {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--gold));
  transition: width .4s ease;
}

/* =========================================================
   Achievements
   ========================================================= */
.achievements {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--sp-2);
}
.ach {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px;
  text-align: center;
  opacity: 0.4;
  filter: grayscale(0.7);
  font-size: var(--fs-sm);
  transition: opacity .2s ease, transform .12s ease;
}
.ach.unlocked {
  opacity: 1; filter: none;
  background: linear-gradient(135deg, rgba(247,201,72,0.16), rgba(156,109,255,0.16));
  border-color: rgba(247,201,72,0.4);
}
.ach.unlocked:hover { transform: translateY(-2px); }
.ach .ico { font-size: 26px; display: inline-flex; align-items: center; justify-content: center; }
.ach b { font-size: var(--fs-sm); display: block; margin-top: 4px; }

.ach-tier { margin-top: 14px; }
.ach-tier:first-of-type { margin-top: 6px; }
.ach-tier-head {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 13px;
  margin-bottom: var(--sp-2);
  letter-spacing: .02em;
  padding-left: 10px;
  border-left: 3px solid var(--border);
}
.tier-1 .ach-tier-head { border-left-color: var(--grey); }
.tier-2 .ach-tier-head { border-left-color: var(--green-2); }
.tier-3 .ach-tier-head { border-left-color: var(--gold); }
.tier-4 .ach-tier-head { border-left-color: var(--orange); }
.tier-5 .ach-tier-head { border-left-color: var(--red); color: #fca5a5; }
.tier-1 .ach.unlocked { background: linear-gradient(135deg, rgba(148,163,184,0.18), rgba(148,163,184,0.05)); border-color: rgba(148,163,184,0.40); }
.tier-2 .ach.unlocked { background: linear-gradient(135deg, rgba(34,197,94,0.16),  rgba(34,197,94,0.05));  border-color: rgba(34,197,94,0.40); }
.tier-3 .ach.unlocked { background: linear-gradient(135deg, rgba(247,201,72,0.16), rgba(247,201,72,0.05)); border-color: rgba(247,201,72,0.40); }
.tier-4 .ach.unlocked { background: linear-gradient(135deg, rgba(251,146,60,0.18), rgba(251,146,60,0.06)); border-color: rgba(251,146,60,0.45); }
.tier-5 .ach.unlocked {
  background: linear-gradient(135deg, rgba(248,113,113,0.20), rgba(156,109,255,0.16));
  border-color: rgba(248,113,113,0.50);
}
.tier-1 .ach.unlocked .ico { color: var(--c-grey); }
.tier-2 .ach.unlocked .ico { color: var(--c-mint); }
.tier-3 .ach.unlocked .ico { color: var(--c-amber); }
.tier-4 .ach.unlocked .ico { color: var(--c-orange); }
.tier-5 .ach.unlocked .ico { color: var(--c-rose); }

/* =========================================================
   Toast
   ========================================================= */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(86px + var(--safe-bottom));
  background: rgba(20,28,52,0.96); color: white;
  padding: 12px 18px; border-radius: var(--r-pill);
  font-weight: 600;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 100; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast.success { background: var(--grad-success); }
#toast.error   { background: var(--grad-danger); }

/* =========================================================
   Modal-Root
   ========================================================= */
#modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(2,6,20,0.78);
  pointer-events: auto;
  display: flex; align-items: flex-end; justify-content: center;
}
@supports ((backdrop-filter: blur(6px)) or (-webkit-backdrop-filter: blur(6px))) {
  .modal-backdrop { background: rgba(2,6,20,0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  width: 100%; max-width: 600px;
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  padding: var(--sp-5) var(--sp-4) calc(var(--sp-5) + var(--safe-bottom));
  max-height: 88vh; overflow-y: auto;
  animation: modalIn .25s ease-out;
  box-shadow: var(--shadow-lg);
}
@keyframes modalIn {
  from { transform: translateY(40px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

/* =========================================================
   Empty-State
   ========================================================= */
.empty {
  text-align: center;
  padding: 40px var(--sp-4);
  color: var(--txt-muted);
}
.empty .big {
  font-size: 56px;
  margin-bottom: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--gold);
}
.empty .big .icon { width: 56px; height: 56px; }
.empty b { color: var(--txt); display: block; margin-bottom: 4px; }

/* =========================================================
   Misc
   ========================================================= */
.linklike { color: var(--accent); text-decoration: none; }
.linklike:hover { text-decoration: underline; }
.divider { height: 1px; background: var(--border); margin: 10px 0; }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  animation: spin .8s linear infinite;
  display: inline-block; vertical-align: middle;
  will-change: transform;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-banner {
  background: linear-gradient(135deg, rgba(109,139,255,0.18), rgba(156,109,255,0.10));
  border: 1px solid rgba(109,139,255,0.30);
  border-radius: var(--r-md);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; margin-bottom: 10px;
}

/* =========================================================
   Confetti (nur kurz, daher OK)
   ========================================================= */
#confetti-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden;
}
.confetti {
  position: absolute; top: -10px; width: 8px; height: 14px;
  border-radius: 2px; opacity: 0.95;
  animation: fall 1.6s ease-in forwards;
  will-change: transform, opacity;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* =========================================================
   Charts
   ========================================================= */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 200px;
  margin-top: 6px;
}
.chart-wrap-lg { height: 260px; }
.chart-wrap > canvas { width: 100% !important; height: 100% !important; display: block; }

/* =========================================================
   PWA-Install Button
   ========================================================= */
#pwa-install-btn {
  position: fixed;
  right: 12px;
  top: calc(env(safe-area-inset-top, 0px) + 56px);
  z-index: 50;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--grad-primary);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .2px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}
#pwa-install-btn:active { transform: scale(.97); }
@media (display-mode: standalone) { #pwa-install-btn { display: none !important; } }

/* =========================================================
   Scrollbar (WebKit)
   ========================================================= */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* =========================================================
   Responsiv
   ========================================================= */
@media (min-width: 720px) {
  main#view { padding-top: 18px; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .status-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  /* iOS zoomt Inputs < 16px automatisch — daher mind. 16px. */
  input, select, textarea { font-size: 16px; }
  .page-header { padding: 0 0 var(--sp-2); }
  .page-title { font-size: 20px; }
}

/* =========================================================
   Reduced Motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .call-btn::before { display: none; }
  .nav-badge.is-red { animation: none; }
}
