:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #160e6e;
  --primary-dark: #0d0947;
  --secondary: #e8e7f5;
  --danger: #e0553f;
  --success: #1e7a45;
  --border: #e2e5ec;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topnav .brand { font-weight: 700; font-size: 1.1rem; color: var(--primary); text-decoration: none; margin-right: 12px; }
.topnav a { color: var(--text); text-decoration: none; }
.topnav a:hover { color: var(--primary); }
.searchform { margin-left: auto; }
.searchform input { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); width: 200px; }

.topnav-haupt { background: var(--primary); }
.topnav-haupt .brand { color: #fff; }
.topnav-haupt a.modul-link { color: rgba(255,255,255,0.75); font-weight: 600; padding: 4px 2px; border-bottom: 2px solid transparent; }
.topnav-haupt a.modul-link:hover { color: #fff; }
.topnav-haupt a.modul-link.aktiv { color: #fff; border-bottom-color: #fff; }
.topnav-haupt .spacer { flex: 1; }
.topnav-haupt .meta { color: rgba(255,255,255,0.85); }
.ansicht-form select { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border); }
.topnav-modul { padding: 10px 24px; gap: 16px; }
.topnav-modul:empty { display: none; padding: 0; border-bottom: none; }

.container { max-width: 900px; margin: 0 auto; padding: 24px; }
.container.container-wide { max-width: 1280px; }

h1 { font-size: 1.6rem; margin-bottom: 16px; }
h2 { font-size: 1.2rem; margin-top: 32px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-num { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--muted); margin: 4px 0 12px; font-size: 0.92rem; }
.stat-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: var(--text); }
.btn-secondary:hover { background: #d6dbe7; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c1452f; }
.btn-success { background: var(--success); }
.btn-small { padding: 6px 10px; font-size: 0.85rem; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-outline:hover { background: var(--secondary); }

.form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.form label.full { grid-column: 1 / -1; }
.form label.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.form input, .form select, .form textarea {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-family: inherit;
}

.table { width: 100%; border-collapse: collapse; margin-top: 8px; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.table th { background: var(--secondary); color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }

.meta { color: var(--muted); font-size: 0.88rem; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; margin-left: 8px; vertical-align: middle; }
.badge.score-hoch { background: #fdecea; color: #a13030; }
.badge.score-mittel { background: #fdf0d5; color: #a1650f; }
.badge.score-niedrig { background: #eef1f6; color: var(--muted); }
.badge.kanal-telefon { background: #d9f2e3; color: #1e7a45; }
.badge.kanal-post { background: #e0e7fb; color: #2a3f9d; }
.badge.kanal-ohne { background: #f7dada; color: #a13030; }
.badge.status-vorhanden { background: #d9f2e3; color: #1e7a45; }
.badge.status-unbekannt { background: #eef1f6; color: var(--muted); }
.badge.status-extern { background: #e0e7fb; color: #2a3f9d; }
.badge.status-kein_bedarf { background: #f3e0f7; color: #7a2e94; }

.swipe-layout { display: flex; gap: 24px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
.swipe-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.swipe-card h2 { margin-top: 0; }

.anrede-toggle { display: inline-flex; gap: 2px; background: var(--secondary); border-radius: 999px; padding: 2px; margin-left: 8px; vertical-align: middle; }
.anrede-btn { border: none; background: transparent; padding: 3px 12px; border-radius: 999px; font-size: 0.78rem; cursor: pointer; color: var(--muted); }
.anrede-btn.aktiv { background: var(--primary); color: white; }

.tagesziel-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; }
.tagesziel-kopf { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.95rem; }
.tagesziel-leiste { height: 10px; border-radius: 999px; background: var(--secondary); overflow: hidden; }
.tagesziel-fortschritt { height: 100%; background: var(--danger); border-radius: 999px; transition: width 0.3s; }
.tagesziel-box.erreicht .tagesziel-fortschritt { background: var(--success); }
.tagesziel-box.erreicht .tagesziel-kopf span { color: var(--success); font-weight: 600; }

.skript-box { margin: 14px 0; }
.skript-box summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.skript-box .vorlage-text {
  white-space: pre-wrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.5;
  max-height: 420px;
  overflow-y: auto;
  margin-top: 8px;
}

.fakten-zeile { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0; font-size: 0.92rem; }
.fakten-item { display: flex; flex-direction: column; }
.fakten-label { color: var(--muted); font-size: 0.78rem; }

.sparten-liste { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }

.anlass-box { background: var(--bg); border-radius: 10px; padding: 14px 16px; margin: 14px 0; }
.anlass-box .anlass-titel { font-weight: 600; margin-bottom: 4px; }

.einstieg-variante { background: var(--bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 0.92rem; }
.einstieg-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }

.outcome-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.outcome-felder { display: none; margin-top: 12px; background: var(--bg); border-radius: 10px; padding: 14px; }
.outcome-felder.offen { display: flex; flex-direction: column; gap: 10px; }
.outcome-felder input, .outcome-felder select, .outcome-felder textarea {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); font-family: inherit;
}

.historie-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.historie-eintrag { border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.historie-eintrag:last-child { border-bottom: none; padding-bottom: 0; }
.historie-kopf { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.historie-ergebnis { font-weight: 600; font-size: 0.88rem; margin-top: 3px; }
.historie-text { font-size: 0.85rem; color: var(--muted); margin-top: 2px; white-space: pre-wrap; }

.tag-liste { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.tag-checkbox { display: flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 999px; padding: 4px 10px; font-size: 0.85rem; }

.empty { color: var(--muted); font-size: 1.05rem; margin: 30px 0; text-align: center; }

.notiz-neu-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.notiz-neu-form textarea { width: 100%; border-radius: 8px; border: 1px solid var(--border); padding: 10px; font-family: inherit; font-size: 0.92rem; }
.notiz-neu-form button { align-self: flex-start; }

.notizen-liste { display: flex; flex-direction: column; gap: 10px; }
.notiz-bubble { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.notiz-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.notiz-datum { font-size: 0.78rem; color: var(--muted); }
.notiz-menu { position: relative; }
.notiz-menu-btn { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--muted); padding: 0 6px; line-height: 1; }
.notiz-menu-btn:hover { color: var(--text); }
.notiz-dropdown { display: none; position: absolute; right: 0; top: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 10; min-width: 110px; overflow: hidden; }
.notiz-dropdown.offen { display: block; }
.notiz-dropdown button { display: block; width: 100%; text-align: left; padding: 8px 12px; background: none; border: none; cursor: pointer; font-size: 0.85rem; }
.notiz-dropdown button:hover { background: var(--secondary); }
.notiz-text { white-space: pre-wrap; font-size: 0.92rem; }

.kontakt-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 10px 0; font-size: 0.92rem; }
.kontakt-item { display: flex; align-items: center; gap: 4px; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1rem; padding: 2px 5px; line-height: 1; border-radius: 6px; }
.icon-btn:hover { color: var(--primary); background: var(--secondary); }

.suche-feld { position: relative; }
.suche-vorschlaege { display: none; position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 10; max-height: 220px; overflow-y: auto; }
.suche-vorschlaege.offen { display: block; }
.suche-vorschlaege div { padding: 8px 12px; cursor: pointer; font-size: 0.9rem; }
.suche-vorschlaege div:hover { background: var(--secondary); }
.notiz-edit-form { display: none; margin-top: 6px; }
.notiz-edit-form.offen { display: block; }
.notiz-edit-form textarea { width: 100%; border-radius: 8px; border: 1px solid var(--border); padding: 8px; font-family: inherit; font-size: 0.92rem; margin-bottom: 6px; }
.notiz-edit-aktionen { display: flex; gap: 6px; }

.sparten-tabelle td { vertical-align: middle; }

/* ------------------------------------------------------------------ */
/* Lead-Kompass (ergaenzende/eigene Klassen, Basis-Patterns wie .btn/.stat-card etc. teilen sich beide Module) */
/* ------------------------------------------------------------------ */
:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #160e6e;
  --primary-dark: #0d0947;
  --secondary: #e8e7f5;
  --danger: #e0553f;
  --border: #e2e5ec;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container { max-width: 900px; margin: 0 auto; padding: 24px; }
.container.container-wide { max-width: 1280px; }

h1 { font-size: 1.6rem; margin-bottom: 16px; }
h2 { font-size: 1.2rem; margin-top: 32px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-num { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--muted); margin: 4px 0 12px; font-size: 0.92rem; }
.stat-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: var(--text); }
.btn-secondary:hover { background: #d6dbe7; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c1452f; }
.btn-small { padding: 6px 10px; font-size: 0.85rem; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-outline:hover { background: var(--secondary); }

.kontakt-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 10px 0; font-size: 0.92rem; }
.kontakt-item { display: flex; align-items: center; gap: 4px; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1rem; padding: 2px 5px; line-height: 1; border-radius: 6px; }
.icon-btn:hover { color: var(--primary); background: var(--secondary); }

.vorlage-aktionen { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.form label.full { grid-column: 1 / -1; }
.form label.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.checkbox-reihe { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 6px; }

.kpi-chart { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; overflow-x: auto; }
.form input, .form select, .form textarea {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-family: inherit;
}

.termin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
}
.termin-card-info { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.termine-aktionen { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.aktionen-label { color: var(--muted); font-size: 0.85rem; margin-right: 4px; min-width: 170px; }
.weiter-termin-felder {
  align-items: flex-end; gap: 10px; margin-top: 10px; padding: 10px;
  background: var(--bg); border-radius: 8px;
}
.weiter-termin-felder label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.weiter-termin-felder input, .weiter-termin-felder select { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); }

.table { width: 100%; border-collapse: collapse; margin-top: 8px; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.table th { background: var(--secondary); color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.zeile-warnung { background: #fdeceb; }
.zeile-warnung td { color: #a13030; font-weight: 600; }

.meta { color: var(--muted); font-size: 0.88rem; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; margin-left: 8px; vertical-align: middle; }
.badge.klasse-A { background: #d9f2e3; color: #1e7a45; }
.badge.klasse-B { background: #fdf0d5; color: #a1650f; }
.badge.klasse-C { background: #f7dada; color: #a13030; }
.badge.phase { background: var(--secondary); color: var(--text); }
.badge.manuell { background: #f3e0f7; color: #7a2e94; }
.badge.auto { background: #eef1f6; color: var(--muted); }

.vorlagen-liste { display: flex; flex-direction: column; gap: 8px; }
.vorlage-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.vorlage-item summary { cursor: pointer; font-weight: 600; }
.vorlage-text {
  white-space: pre-wrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  font-size: 0.92rem;
}

.skript-box { margin: 12px 0; }
.skript-box summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.skript-box .vorlage-text { max-height: 420px; overflow-y: auto; font-size: 0.85rem; line-height: 1.5; text-align: left; }

.swipe-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

.swipe-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.swipe-layout .swipe-card { margin: 0; }
.swipe-card h2 { margin-top: 0; }

.swipe-history {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  width: 340px;
  max-height: 640px;
  overflow-y: auto;
}
.swipe-history h3 { margin: 0 0 12px; font-size: 1rem; }
.historie-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.historie-eintrag { border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.historie-eintrag:last-child { border-bottom: none; padding-bottom: 0; }
.historie-kopf { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.historie-icon { font-size: 0.9rem; }
.historie-ergebnis { font-weight: 600; font-size: 0.88rem; margin-top: 3px; }
.historie-text { font-size: 0.85rem; color: var(--muted); margin-top: 2px; white-space: pre-wrap; }

.outcome-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.outcome-form textarea { width: 100%; border-radius: 8px; border: 1px solid var(--border); padding: 8px; font-family: inherit; }
.termin-felder { display: flex; flex-direction: column; gap: 8px; background: var(--bg); padding: 12px; border-radius: 8px; }
.termin-felder input, .termin-felder select { padding: 8px; border-radius: 6px; border: 1px solid var(--border); }
.outcome-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

.kundeninfo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px 16px;
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 8px;
}
.kundeninfo-grid > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kundeninfo-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.kundeninfo-wert { font-size: 0.92rem; overflow-wrap: break-word; }

.empty { color: var(--muted); font-size: 1.1rem; margin: 40px 0; text-align: center; }

.notiz-neu-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.notiz-neu-form textarea { width: 100%; border-radius: 8px; border: 1px solid var(--border); padding: 10px; font-family: inherit; font-size: 0.92rem; }
.notiz-neu-form button { align-self: flex-start; }

.notizen-liste { display: flex; flex-direction: column; gap: 10px; }
.notiz-bubble { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.notiz-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.notiz-datum { font-size: 0.78rem; color: var(--muted); }
.notiz-menu { position: relative; }
.notiz-menu-btn { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--muted); padding: 0 6px; line-height: 1; }
.notiz-menu-btn:hover { color: var(--text); }
.notiz-dropdown { display: none; position: absolute; right: 0; top: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 10; min-width: 110px; overflow: hidden; }
.notiz-dropdown.offen { display: block; }
.notiz-dropdown button { display: block; width: 100%; text-align: left; padding: 8px 12px; background: none; border: none; cursor: pointer; font-size: 0.85rem; }
.notiz-dropdown button:hover { background: var(--secondary); }
.notiz-text { white-space: pre-wrap; font-size: 0.92rem; }
.notiz-edit-form { display: none; margin-top: 6px; }
.notiz-edit-form.offen { display: block; }
.notiz-edit-form textarea { width: 100%; border-radius: 8px; border: 1px solid var(--border); padding: 8px; font-family: inherit; font-size: 0.92rem; margin-bottom: 6px; }
.notiz-edit-aktionen { display: flex; gap: 6px; }
