:root {
  --radius: 10px;
  --radius-sm: 6px; /* fuer kleine Elemente (Badges, Status-Pills) - der
    gleiche Pixelwert wie --radius wuerde auf einer ~24px hohen Pille viel
    staerker gerundet wirken als auf einem ~40px hohen Button; --radius-sm
    gleicht das Hoehe-zu-Radius-Verhaeltnis an, damit beides gleich "leicht
    gerundet" aussieht statt pixel-identisch zu sein. */
  --bg: #f4f5f7;
  --panel: #ffffff;
  --input-bg: #f1f2f5;
  --border: #e3e5ea;
  --text: #14171f;
  --muted: #6b7280;
  --accent: #16a34a;
  --good: #16a34a;
  --medium: #d97706;
  --bad: #dc2626;
  --none: #6b7280;
  --social: #db2777;
  --shadow: 0 4px 16px rgba(20,23,31,0.08);
  --shadow-lg: 0 10px 30px rgba(20,23,31,0.14);
}

* { box-sizing: border-box; }

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

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

header h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

.subtitle {
  margin: 0 0 24px;
  color: var(--muted);
}

.banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
}
.banner.warning {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.search-box {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field input[type="text"] {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  min-width: 220px;
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: var(--shadow);
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.status {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
}
.status.error { color: var(--bad); }

.filters {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.filter-group label {
  font-size: 12px;
  color: var(--muted);
}
.filter-group select,
.filter-group input[type="number"] {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 14px;
  width: 100px;
}
.filter-group input[type="range"] {
  accent-color: var(--accent);
  width: 140px;
}
.filter-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-checkboxes label,
.checkbox-field-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}
.results-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:hover td { background: rgba(20,23,31,0.02); }

.badge {
  display: inline-block;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}
.badge.good { background: rgba(22,163,74,0.12); color: var(--good); }
.badge.medium { background: rgba(217,119,6,0.12); color: var(--medium); }
.badge.bad { background: rgba(220,38,38,0.12); color: var(--bad); }
.badge.none { background: rgba(107,114,128,0.12); color: var(--none); }
.badge.social { background: rgba(219,39,119,0.12); color: var(--social); }

.reason {
  color: var(--muted);
  font-size: 12px;
}

a.website-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}
a.website-link:hover { text-decoration: underline; }

.hidden { display: none !important; }

.actions {
  position: sticky;
  bottom: 0;
  margin-top: 20px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  justify-content: flex-end;
}

/* ---- Karte / Städte ---- */
.app-wide { max-width: 1300px; }

.brand-logo {
  height: 26px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand-logo-fallback {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Stadt-Ansicht: echter 50/50-Split (Karte links, Call-Center-Inbox
   rechts) statt schwebender Overlays - eliminiert Ueberlappungen
   strukturell statt per z-index-Patch. Nur city.html nutzt das; map.html
   bleibt beim einfacheren Full-Bleed-Layout unten. ---- */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.map-pane {
  flex: 0 0 50%;
  position: relative;
  min-width: 0;
}
.map-fill { position: absolute; inset: 0; }

.inbox-pane {
  flex: 0 0 50%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  transition: flex-basis 0.2s ease;
}

/* ---- Leads/Build/Send: Build und Send sind bewusst kein Splitscreen -
   die Karte kollabiert auf 0 Breite (bleibt aber im DOM/initialisiert,
   damit ein Zurueckwechseln zu Leads sofort geht, kein Mapbox-Reinit). ---- */
.app-shell.tab-build .map-pane,
.app-shell.tab-send .map-pane {
  flex-basis: 0;
  min-width: 0;
  overflow: hidden;
}
.app-shell.tab-build .inbox-pane,
.app-shell.tab-send .inbox-pane {
  flex-basis: 100%;
  border-left: none;
}

/* ---- Bottom-App-Nav (Leads/Build/Send), verankert unten mittig auf der
   Karte - wie ein natives App-Tabbar-Pill. ---- */
/* Direktes Kind von .app-shell (nicht von .map-pane!) - .map-pane
   kollabiert im Build/Send-Tab auf Breite 0 mit overflow:hidden, ein Kind
   davon wuerde mitverschwinden. left:25% zentriert die Nav ueber der
   linken (Karten-)Haelfte im Leads-Tab; im Build/Send-Tab (Karte weg)
   wandert sie auf 50%, ueber die volle Breite zentriert. */
.map-tab-nav {
  position: absolute;
  bottom: 20px;
  left: 25%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px;
  box-shadow: var(--shadow-lg);
  transition: left 0.2s ease;
}
.app-shell.tab-build .map-tab-nav,
.app-shell.tab-send .map-tab-nav {
  left: 50%;
}
.map-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--muted);
  padding: 7px 18px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.map-tab:hover { color: var(--text); }
.map-tab.active { color: var(--accent); background: var(--accent-soft, rgba(22,163,74,0.1)); }

/* ---- Filter, verankert oben links auf der Karte (statt in der Liste zu
   ueberlappen). Toggle-Button und Panel sind EIN durchgehendes Element
   (gemeinsamer Rahmen/Radius/Schatten), das beim Oeffnen einfach hoeher
   wird, statt zwei getrennt schwebende Karten mit Abstand zu sein. ---- */
.map-filter {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
  max-width: calc(100% - 32px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.map-filter-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  background: transparent;
  color: var(--text);
  border: none;
  box-shadow: none;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.map-filter-toggle:hover { color: var(--accent); }
.map-filter-toggle[aria-expanded="true"] { color: var(--accent); }

.map-filter-body {
  width: 300px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.map-filter-body.hidden { display: none; }

/* ---- Status-Pills: als Filter (Mehrfachauswahl) und als Schnell-
   Umschalter pro Lead (Einfachauswahl). Jede Pille traegt ihre Farbe als
   --pill-solid/--pill-pale Custom Properties (siehe statusPillsHtml in
   city.js) - im Ruhezustand sehr blass, bei Hover UND wenn aktiv
   ausgewaehlt kraeftig/voll eingefaerbt mit weissem Text. ---- */
.status-pill-group { display: flex; gap: 6px; flex-wrap: wrap; }
.status-pill {
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  background: var(--pill-pale);
  color: var(--muted);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.12s ease, color 0.12s ease;
}
.status-pill:hover,
.status-pill.active {
  background: var(--pill-solid);
  color: #fff;
  transform: translateY(-1px);
}
.status-pill:active { transform: scale(0.96); }
.status-pill.active { box-shadow: 0 1px 4px rgba(0,0,0,0.18); }
.status-pill-sm { padding: 4px 9px; font-size: 11px; }

.inbox-header {
  flex-shrink: 0;
  padding: 16px 18px 0;
  border-bottom: 1px solid var(--border);
}
.inbox-header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 14px;
}
.inbox-header-top .topbar-title { flex: 1; min-width: 0; }
.inbox-header-top #collect-btn { white-space: nowrap; }

.inbox-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
  padding-bottom: 10px;
}
.inbox-status.error { color: var(--bad); }
.inbox-status:empty { display: none; }

.inbox-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 14px;
}
.inbox-search-row input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
}
.inbox-search-row input[type="text"]:focus { border-color: var(--accent); }

.inbox-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 20px;
}

.inbox-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 12px;
}
.inbox-actions-row button { margin-left: auto; }

.start-session-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 12px;
  padding: 13px 20px;
}

.current-call-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .map-pane { flex: 0 0 42vh; }
  .inbox-pane { flex: 1; border-left: none; border-top: 1px solid var(--border); }
  /* Gestapeltes Layout: Karte liegt oben ueber die volle Breite, die Nav
     bleibt also horizontal zentriert (left:50%) und sitzt am unteren Rand
     der Karten-Zeile statt am unteren Rand des ganzen Viewports. */
  .map-tab-nav { left: 50%; bottom: auto; top: calc(42vh - 56px); }
  .app-shell.tab-build .map-tab-nav,
  .app-shell.tab-send .map-tab-nav { top: 16px; }
  /* Ohne die 42vh-hohe Karte darueber wuerde die Nav sonst den oberen Rand
     des Inbox-Headers (Zurueck-Pfeil/Stadtname/Button) ueberlappen. */
  .app-shell.tab-build .inbox-header,
  .app-shell.tab-send .inbox-header { padding-top: 62px; }
}

.icon-btn-round { padding: 10px 13px; }

.topbar-title {
  font-weight: 700;
  font-size: 15px;
  padding: 0 2px;
  white-space: nowrap;
}

.search-pill {
  flex: 1;
  min-width: 220px;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 6px 5px 16px;
  box-shadow: var(--shadow);
}

/* ---- Homepage: Begruessung + Logo direkt in der Such-Pille ---- */
.home-greeting { padding-bottom: 16px; }
.home-greeting h1 { margin: 0 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.home-greeting p { margin: 0; color: var(--muted); font-size: 14px; }

.search-pill-brand {
  max-width: none;
  width: 100%;
  padding: 6px 6px 6px 14px;
  margin-bottom: 14px;
}
.search-pill-brand .brand-logo { height: 20px; flex-shrink: 0; }
.search-pill-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  margin: 2px 2px 2px 12px;
  flex-shrink: 0;
}
.search-pill input[type="text"] {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  outline: none;
  padding: 8px 0;
  min-width: 0;
}
.search-pill button {
  border-radius: var(--radius);
  padding: 9px 16px;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .map-filter-body { width: calc(100vw - 34px); }
}

.icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow);
  text-decoration: none;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn[aria-expanded="true"] { background: var(--accent); color: white; border-color: var(--accent); }

.results-count-pill {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.filter-checkboxes-scroll {
  max-height: 160px;
  overflow-y: auto;
  padding: 6px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.filter-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.filter-toggle-links {
  font-size: 11px;
  white-space: nowrap;
}
.filter-toggle-links a {
  color: var(--accent);
  text-decoration: none;
}
.filter-toggle-links a:hover { text-decoration: underline; }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.filter-help {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
  line-height: 1.4;
}

.lead-cards { padding: 2px; }

.lead-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.lead-card:hover { border-color: var(--accent); }
.lead-card.active { border-color: var(--accent); background: rgba(22,163,74,0.08); }

.lead-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.lead-card-main { flex: 1; min-width: 0; }
.lead-card-name { font-weight: 700; font-size: 14px; }
.lead-card-branche { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lead-card-address { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lead-card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
/* Aufgeklappt: Adresse/Website-Link/Badge stehen NICHT mehr eingerueckt
   neben dem Avatar, sondern buendig ganz links, wie die Notizen darunter. */
.lead-card-flush { margin-top: 8px; }
.lead-card-flush .lead-card-branche,
.lead-card-flush .lead-card-address { margin-top: 0; margin-bottom: 2px; }
.lead-card-flush .website-link-inline { margin-bottom: 10px; }
.lead-card-contact { font-size: 13px; margin-bottom: 10px; line-height: 1.6; }
.lead-card .status-pill-group { margin-bottom: 10px; }
.tag-hint {
  font-size: 10px;
  color: var(--accent);
  background: rgba(22,163,74,0.12);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.lead-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lead-card-actions select { flex: 1; min-width: 100px; }

/* ---- Marker-Popup: nur die wichtigsten Eckdaten (Name/Ansprechpartner/
   Adresse) - der volle Lead lebt in der Karte rechts, zu der beim Klick
   automatisch gescrollt wird. ---- */
.lead-popup {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
  font-size: 13px;
}
.lead-popup-name { font-weight: 700; font-size: 14px; }
.lead-popup-contact-name { font-size: 12px; color: var(--muted); }
.lead-popup-row { font-size: 13px; color: var(--muted); }


/* ---- Aufgeklappte Karte (statt separatem Call-Panel) ---- */
.lead-card.expanded {
  background: var(--panel);
  border-color: var(--accent);
  cursor: default;
  padding-bottom: 16px;
}
.call-panel-progress {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.call-panel-name { font-size: 22px; font-weight: 700; }
.call-panel-contact-name { font-size: 14px; color: var(--text); margin-top: 4px; }
/* Telefonnummer/Website-Link/Bewertung teilen sich mit den Status-Pillen und
   Aktions-Buttons dieselbe "Pillen"-Groesse (Padding/Schrift/Radius) - die
   ganze aufgeklappte Karte soll wie EIN einheitliches System wirken, das
   sich nur ueber Farbe unterscheidet, siehe .status-pill/.btn-small/.badge. */
.lead-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--medium);
  text-decoration: none;
  cursor: pointer;
  margin: 2px 0 10px;
}
.lead-rating:hover { text-decoration: underline; }
.lead-rating-count { color: var(--muted); font-weight: 500; }
.website-link-inline { display: inline-block; margin-top: 3px; font-weight: 600; }
.card-close-btn {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 19px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.card-close-btn:hover { background: rgba(220,38,38,0.1); }
.call-panel-field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
}
.call-panel-notes {
  display: block;
  width: 100%;
  min-height: 140px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 22px;
}
/* Mehr Luft speziell zwischen der aufgeklappten Ergebnis-Pillenreihe und der
   Aktionsreihe darunter (Website bauen / Schließen) - war wiederholt zu eng. */
.lead-card.expanded .status-pill-group { margin-bottom: 22px; }
.lead-card.expanded .lead-card-actions { margin-top: 4px; }

.map-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  cursor: pointer;
}

.city-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.city-item:last-child { border-bottom: none; }

.city-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.city-name {
  flex: 1;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.city-name:hover { color: var(--accent); }

.city-status-select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  border-radius: var(--radius);
  font-size: 12px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
}
.btn-icon:hover { color: var(--bad); }

/* Gleiche Groesse wie .status-pill/.badge (Padding/Schrift/Radius/kein
   Rand) - unterscheidet sich bewusst nur ueber die Farbe, nicht ueber die
   Form, damit "Website bauen" & Co. sich wie Teil desselben Pillen-Systems
   anfuehlen statt wie ein andersartiger Button-Typ. */
.btn-small {
  background: rgba(79,124,255,0.1);
  border: none;
  color: #4f7cff;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.btn-small:hover { background: rgba(79,124,255,0.2); }
.btn-call { background: rgba(22,163,74,0.1); color: var(--accent); }
.btn-call:hover { background: rgba(22,163,74,0.18); }
/* Neutral/grau statt einer weiteren eigenen Farbe - "Website bauen" ist eine
   sekundaere Aktion, die nicht mit Anrufen (gruen) oder den Status-Pillen
   um Aufmerksamkeit konkurrieren soll. */
.btn-neutral { background: rgba(107,114,128,0.12); color: var(--none); }
.btn-neutral:hover { background: rgba(107,114,128,0.22); }
.btn-disabled { background: rgba(107,114,128,0.08); color: var(--muted); cursor: default; }

.call-status-select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--radius);
  font-size: 12px;
}

/* ---- Mapbox Popup Theming ---- */
.mapboxgl-popup-content {
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-lg);
}
.mapboxgl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
.mapboxgl-popup-content a { color: var(--accent); }
.mapboxgl-popup-close-button { color: var(--muted); font-size: 16px; }
.mapboxgl-ctrl-group { background: var(--panel) !important; box-shadow: var(--shadow) !important; }
.mapboxgl-ctrl-group button { background: var(--panel) !important; }

/* ---- Modal (Website-Generator) ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 960px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  margin: 0;
  font-size: 15px;
  flex: 1;
}
.template-picker select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 13px;
}
.site-preview {
  flex: 1;
  border: none;
  width: 100%;
  background: white;
}
.modal-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* ---- Modal-Werkzeuge: Prompt-Anpassung (Claude) + Mail-Versand ---- */
.modal-tools {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  max-height: 220px;
  overflow-y: auto;
}
.modal-tool-row { display: flex; flex-direction: column; gap: 6px; }
.modal-tool-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.modal-tool-inline { display: flex; gap: 8px; align-items: flex-end; }
.modal-tool-inline textarea {
  flex: 1;
  min-height: 40px;
  max-height: 90px;
  resize: vertical;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}
.modal-tool-inline button { flex-shrink: 0; }
.modal-tool-status { font-size: 12px; color: var(--muted); min-height: 16px; }
.modal-tool-status.error { color: var(--bad); }
.modal-tool-status.ok { color: var(--good); }

/* ---- Build/Send: Karten-Galerie im Stil eines Website-Baukastens ---- */
.site-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding: 4px;
}
.site-gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 60px 20px;
}
.gallery-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.gallery-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.gallery-thumb {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: var(--input-bg);
  border-bottom: 1px solid var(--border);
}
.gallery-thumb iframe {
  position: absolute;
  top: 0; left: 0;
  width: 286%;
  height: 286%;
  border: none;
  transform: scale(0.35);
  transform-origin: top left;
  pointer-events: none;
}
.gallery-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 12px;
}
.gallery-card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.gallery-card-name { font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.gallery-card-meta { font-size: 12px; color: var(--muted); }
.gallery-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
