:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e3e3e6;
  --coral: #d97757;
  --coral-ink: #b95d3f;
  --blue: #4f8ef7;
  --orange: #e8a33d;
  --green: #2fa95f;
  --green-dark: #1f7a44;
  --grey: #9aa0a6;
  --red: #d64545;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line);
  z-index: 500;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.logo {
  width: 40px; height: 40px; border-radius: 11px; background: var(--coral);
  color: #fff; font-weight: 700; font-size: 20px; display: grid; place-items: center;
}
.brand-title { font-weight: 600; font-size: 17px; }
.brand-sub { font-size: 12px; color: var(--muted); }

.kpis { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.kpi {
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 14px; min-width: 84px;
}
.kpi .num { font-size: 20px; font-weight: 650; line-height: 1; }
.kpi .lbl { font-size: 11px; color: var(--muted); margin-top: 3px; }
.kpi.goal .num { font-size: 15px; }
.kpi.hit .num { color: var(--green); }

.top-actions { display: flex; gap: 8px; }

/* Buttons */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 9px 15px; border-radius: 10px; font-size: 13px; font-weight: 550;
  cursor: pointer; text-decoration: none; display: inline-block; transition: .15s;
}
.btn:hover { background: #fafafa; }
.btn.primary { background: var(--coral); color: #fff; border-color: var(--coral); width: 100%; }
.btn.primary:hover { background: var(--coral-ink); }
.btn.primary:disabled { opacity: .55; cursor: wait; }
.btn.ghost { background: var(--card); }
.btn.danger { color: var(--red); border-color: #f0cccc; }

/* Banner */
.banner { background: #fff4e6; border-bottom: 1px solid #f0d9b8; color: #8a5a12; padding: 10px 20px; font-size: 13px; }
.banner code { background: #fff; padding: 1px 6px; border-radius: 5px; }

/* Workspace */
.workspace { flex: 1; display: grid; grid-template-columns: 300px 1fr 360px; min-height: 0; }
.controls { padding: 14px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg); }
#map { height: 100%; z-index: 1; }
.leads { border-left: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; min-height: 0; }

/* Cards / forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 15px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 12px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 11px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.hint { color: var(--grey); font-weight: 400; text-transform: none; }
input, select, textarea {
  width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 14px; background: #fff; color: var(--ink); font-family: inherit;
}
label.check input { width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--coral); }
.scrape-status { font-size: 12px; color: var(--muted); margin-top: 8px; min-height: 16px; }

/* Legend */
.legend .row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 7px; }
.legend .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }

/* Lead list */
.leads-head { padding: 12px 14px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); }
#lead-list { overflow-y: auto; flex: 1; padding: 10px; }
.lead-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; margin-bottom: 9px; cursor: pointer; transition: .12s;
}
.lead-card:hover { border-color: var(--coral); transform: translateY(-1px); }
.lead-card .lc-top { display: flex; align-items: center; gap: 8px; }
.lc-status { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lc-name { font-weight: 600; font-size: 14px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.lc-tags { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.tag { font-size: 10.5px; padding: 2px 7px; border-radius: 20px; font-weight: 600; }
.tag.wechsel { background: #fdeee8; color: var(--coral-ink); }
.tag.menu { background: #e9f3ec; color: var(--green-dark); }
.tag.ex { background: #fbe6e6; color: var(--red); }
.tag.rating { background: #f3f0e8; color: #8a6d1a; }
.tag.gastro-unklar { background: #fff4e0; color: #9a6a12; }
.tag.gastro-nein { background: #ececf0; color: #6b7280; }
.tag.act { background: #eef2fb; color: #3b5bdb; }
.user-chip { font-size: 12.5px; font-weight: 600; color: #444; background: #eef0f4; padding: 5px 10px; border-radius: 20px; margin-left: 4px; }

/* --- CRM: Ansprechpartner + Aktivitaeten --- */
.crm-block { margin-top: 14px; }
.crm-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: #444; }
.mini-btn { border: 1px solid #d8d8dd; background: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; cursor: pointer; color: #555; }
.mini-btn:hover { background: #f2f2f5; }
.mini-btn.del { border-color: #f0c8c8; color: #c0392b; }
.small { font-size: 12px; }
.contact-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.3fr auto; gap: 5px; margin-bottom: 5px; }
.contact-row input { width: 100%; padding: 5px 7px; border: 1px solid #dcdce1; border-radius: 6px; font-size: 12.5px; }
.act-form { display: grid; grid-template-columns: auto auto 1fr auto; gap: 6px; margin-bottom: 10px; }
.act-form select, .act-form input { padding: 6px 8px; border: 1px solid #dcdce1; border-radius: 6px; font-size: 12.5px; }
.act-list { display: flex; flex-direction: column; gap: 7px; max-height: 240px; overflow-y: auto; }
.act-item { display: flex; gap: 9px; align-items: flex-start; padding: 7px 9px; background: #f7f7f9; border-radius: 8px; }
.act-ico { font-size: 15px; line-height: 1.3; }
.act-body { flex: 1; min-width: 0; }
.act-text { font-size: 13px; color: #222; word-break: break-word; }
.act-meta { font-size: 11px; color: #9aa0a6; margin-top: 2px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 1000; padding: 20px; }
.modal { background: var(--card); border-radius: 18px; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px 8px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.x { background: none; border: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-body { padding: 4px 20px 8px; }
.modal-foot { padding: 12px 20px 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.d-cat { font-size: 13px; color: var(--muted); margin: 2px 20px 10px; }
.d-badges { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 20px 12px; }
.d-links { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 14px; }
.d-links a, .scan-btn { font-size: 13px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; color: var(--ink); background: #fff; cursor: pointer; }
.d-links a.call { background: var(--green); color: #fff; border-color: var(--green); }

/* Report */
.report-text { padding: 4px 20px 12px; font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 12.5px; white-space: pre-wrap; line-height: 1.55; }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 11px; font-size: 13px; z-index: 2000; box-shadow: var(--shadow); }
.hidden { display: none !important; }

/* Leaflet pin */
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.28); }

/* Saubere weisse Cluster-Bubbles (statt bunter Default-Kreise) */
.cluster-wrap { background: transparent !important; }
.cluster-bubble { width: 100%; height: 100%; display: grid; place-items: center; background: #fff; color: #1d1d1f; border-radius: 50%; font-size: 13px; font-weight: 650; border: 1px solid rgba(0,0,0,.08); box-shadow: 0 2px 10px rgba(0,0,0,.16); }
.leaflet-control-attribution { font-size: 10px; background: rgba(255,255,255,.7); color: #9aa0a6; }

/* ===== Pipeline-Bar (ganz oben) ===== */
.pipeline-bar { display: flex; align-items: center; gap: 14px; padding: 8px 20px; background: #141210; color: #fff; }
.pb-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--coral); font-weight: 700; }
.pipeline-tabs { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.pipe-tab { background: rgba(255,255,255,.08); color: #cfcfcf; border: 1px solid rgba(255,255,255,.12); padding: 7px 16px; border-radius: 9px; font-size: 13px; font-weight: 550; cursor: pointer; transition: .15s; }
.pipe-tab:hover { background: rgba(255,255,255,.16); color: #fff; }
.pipe-tab.active { background: var(--coral); border-color: var(--coral); color: #fff; }
.view-toggle { display: flex; background: rgba(255,255,255,.08); border-radius: 9px; padding: 3px; gap: 3px; }
.view-toggle button { background: transparent; color: #cfcfcf; border: none; padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 550; cursor: pointer; }
.view-toggle button.active { background: #fff; color: #141210; }

.kpi.hot .num { color: var(--red); }

/* ===== Board (Kanban) ===== */
.workspace.view-board { grid-template-columns: 300px 1fr; }
#board { overflow-x: auto; display: flex; gap: 14px; padding: 16px; align-items: flex-start; }
.board-col { background: #eef0f2; border-radius: 14px; width: 250px; min-width: 250px; max-height: 100%; display: flex; flex-direction: column; }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-size: 13px; font-weight: 650; }
.board-col-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.board-col-head .cnt { margin-left: auto; background: #fff; border-radius: 20px; padding: 1px 9px; font-size: 12px; color: var(--muted); }
.board-col-body { flex: 1; overflow-y: auto; padding: 0 10px 12px; min-height: 60px; }
.board-col-body.over { outline: 2px dashed #c3c9cf; outline-offset: -4px; border-radius: 10px; }
.kanban-card { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; margin-bottom: 9px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.kanban-card:hover { border-color: var(--coral); }
.kanban-card.dragging { opacity: .4; }
.kc-top { display: flex; align-items: center; gap: 6px; }
.kc-name { font-weight: 600; font-size: 13.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kc-foot { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.kc-flags { font-size: 12px; color: var(--muted); }
.chip { width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.chip.none { background: #d0d3d7; }

/* Temperatur */
.temp-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px #fff; }
.temp-badge { font-size: 11px; font-weight: 700; color: #fff; padding: 2px 9px; border-radius: 20px; margin-left: 8px; }
.tag.bestand { background: #fff6da; color: #8a6d1a; }

/* Angebots-Box */
.offer-box { margin: 2px 20px 12px; background: #f7f5f2; border: 1px solid #ece7df; border-radius: 13px; padding: 13px 15px; }
.offer-head { font-size: 13px; font-weight: 650; display: flex; align-items: center; }
.offer-box .muted { font-size: 12px; color: var(--muted); margin: 7px 0; }
.offer-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.offer-actions .btn { padding: 8px 13px; }
.demo-note { font-size: 11px; color: #b0752a; margin-top: 9px; }
.btn.ghost:disabled { opacity: .45; cursor: not-allowed; }

/* Detail-Layout */
.row2 { display: flex; gap: 10px; }
.row2 label { flex: 1; }
.check.big { font-size: 14px; font-weight: 550; padding: 8px 0; }
.empty { padding: 20px; color: #9aa0a6; font-size: 13px; }
