/* Böhms Umzüge – CRM */
:root {
  --navy: #0f2a4a; --navy-2: #163a63; --navy-text: #c9d6e8;
  --blue: #1f5fd6; --blue-600: #1a50b5; --blue-50: #eaf1fd; --blue-100: #d5e3fb;
  --bg: #f3f5f8; --surface: #ffffff; --line: #dde3ea; --line-2: #eef1f5;
  --text: #1b2533; --muted: #637083; --faint: #8d98a8;
  --red: #d4312b; --red-50: #fdecea; --amber: #b7791f; --amber-50: #fdf5e6; --green: #15803d; --green-50: #e8f6ee;
  --radius: 8px; --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(15, 42, 74, .06), 0 2px 8px rgba(15, 42, 74, .05);
  --shadow-lg: 0 12px 40px rgba(15, 42, 74, .18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --side: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; color: var(--muted); font-weight: 600; }
.num, .tab-num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--navy); color: var(--navy-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 10px; color: #fff; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--blue); display: grid; place-items: center; font-weight: 800; }
.brand b { display: block; font-size: 15px; } .brand span { font-size: 11.5px; color: var(--navy-text); }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 7px; color: var(--navy-text); font-weight: 500; }
.nav a:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--blue); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .badge { margin-left: auto; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12.5px; }
.side-user { display: flex; align-items: center; gap: 9px; color: #fff; }
.side-user .who { min-width: 0; flex: 1; } .side-user .who span { color: var(--navy-text); display: block; font-size: 11.5px; }
.side-user button { color: var(--navy-text); }
.install-btn { background: none; border: 0; padding: 0; font: inherit; text-align: left; width: 100%; }
.install-btn svg { width: 16px; height: 16px; }
.install-btn:hover { color: #fff; }
.avail { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--navy-text); cursor: pointer; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: rgba(243,245,248,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 10px 24px; }
.top .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--faint); }
.search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
.search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 420px; overflow: auto; z-index: 50; }
.search-results a { display: flex; gap: 10px; padding: 9px 12px; color: var(--text); border-bottom: 1px solid var(--line-2); }
.search-results a:hover, .search-results a.sel { background: var(--blue-50); text-decoration: none; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.live.on i { background: #22a35a; }
.content { padding: 22px 24px 60px; max-width: 1600px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .spacer { flex: 1; }
kbd { font: 11px var(--font); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--muted); background: var(--surface); }

/* ---------- Controls ---------- */
button { font: inherit; cursor: pointer; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 550; white-space: nowrap; }
.btn:hover { border-color: #c4ccd7; background: #fafbfc; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-600); }
.btn.danger { color: var(--red); } .btn.danger:hover { background: var(--red-50); border-color: #f2b8b4; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(15,42,74,.06); }
.btn.sm { padding: 5px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; padding: 6px; border-radius: 6px; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(15,42,74,.07); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
input, select, textarea { font: inherit; color: inherit; }
.input, .select, textarea.input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-100); }
textarea.input { resize: vertical; min-height: 70px; }
.select.sm, .input.sm { padding: 5px 8px; font-size: 13px; width: auto; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 550; }
label.field.inline { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 500; font-size: 14px; }
.field-err { color: var(--red); font-size: 12px; }
.input.err { border-color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 6px; color: var(--muted); font-weight: 550; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--blue-50); color: var(--blue); }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #c7cfda; border-radius: 20px; transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Badges / Pills ---------- */
.badge { display: inline-flex; align-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; justify-content: center; }
.badge.blue { background: var(--blue); } .badge.grey { background: #8d98a8; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 12px; font-size: 12.5px; font-weight: 550; background: var(--line-2); color: var(--text); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.prio { font-size: 12px; font-weight: 600; }
.prio-dringend { color: var(--red); } .prio-hoch { color: var(--amber); } .prio-niedrig { color: var(--faint); }
.overdue { color: var(--red); font-weight: 650; }
.today { color: var(--blue); font-weight: 600; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; background: #8d98a8; }
.avatar.lg { width: 34px; height: 34px; font-size: 13px; }
.tag { font-size: 11.5px; padding: 1px 7px; border-radius: 4px; background: var(--blue-50); color: var(--blue-600); font-weight: 600; }
.tag.warn { background: var(--amber-50); color: var(--amber); } .tag.red { background: var(--red-50); color: var(--red); } .tag.green { background: var(--green-50); color: var(--green); }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.panel-head h3 { flex: 1; }
.panel-body { padding: 14px 16px; }
.empty { padding: 26px 16px; text-align: center; color: var(--muted); }

/* ---------- Tabelle ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius-lg); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.t th { position: sticky; top: 0; background: #f8f9fb; text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; user-select: none; }
.t th.sortable { cursor: pointer; } .t th.sortable:hover { color: var(--text); }
.t th .arr { opacity: .6; margin-left: 3px; }
.t td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.t tbody tr { cursor: pointer; }
.t tbody tr:hover td { background: #f7f9fc; }
.t tbody tr.sel td { background: var(--blue-50); }
.t td.chk, .t th.chk { width: 36px; padding-right: 0; cursor: default; }
.t .name { font-weight: 600; }
.t input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }
.bulkbar { position: sticky; top: 56px; z-index: 15; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 14px; margin-bottom: 10px; background: var(--navy); color: #fff; border-radius: 10px; }
.bulkbar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.bulkbar .btn:hover { background: rgba(255,255,255,.08); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 6px 10px; border-radius: 16px; font-size: 13px; font-weight: 550; color: var(--muted); }
.chip.on { border-color: var(--blue); color: var(--blue); background: var(--blue-50); }
.chip .badge { height: 18px; min-width: 18px; font-size: 11px; }
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 13px; }
.pager .spacer { flex: 1; }
.lead-cards { display: none; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; grid-auto-flow: dense; }
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 118px; position: relative; overflow: hidden; }
.widget.w1 { grid-column: span 1; } .widget.w2 { grid-column: span 2; } .widget.w3 { grid-column: span 3; } .widget.w4 { grid-column: span 4; }
.widget.h2 { grid-row: span 2; } .widget.h3 { grid-row: span 3; }
.widget-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px 0; }
.widget-head h3 { font-size: 13.5px; font-weight: 600; color: var(--muted); flex: 1; }
.widget-body { padding: 8px 14px 14px; flex: 1; min-height: 0; overflow: auto; }
.widget .tools { display: none; gap: 2px; }
.editing .widget { outline: 2px dashed var(--blue-100); cursor: grab; }
.editing .widget .tools { display: flex; }
.editing .widget.dragging { opacity: .4; }
.editing .widget.drop-target { outline-color: var(--blue); }
.widget .resize { position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; cursor: nwse-resize; display: none; color: var(--faint); }
.editing .widget .resize { display: block; }
.kpi { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi.red { color: var(--red); }
.kpi-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.widget.alert { border-color: #f2b8b4; background: linear-gradient(var(--red-50), var(--surface) 70%); }
.widget.alert .widget-head h3 { color: var(--red); }
.list-rows { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover .lr-title { color: var(--blue); }
.lr-main { flex: 1; min-width: 0; } .lr-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .lr-sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-right { text-align: right; font-size: 12.5px; white-space: nowrap; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .track { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; display: flex; }
.bar-row .fill { height: 100%; background: var(--blue); }
.bar-row .fill.won { background: var(--green); }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spark { width: 100%; height: 120px; display: block; }
.funnel-row { display: grid; grid-template-columns: 170px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; padding: 3px 0; }
.funnel-row .track { height: 16px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.funnel-row .fill { height: 100%; border-radius: 4px; }
.formula { background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }

/* ---------- Drawer (Lead-Detail) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15,42,74,.32); z-index: 60; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: .4; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(1080px, 94vw); background: var(--bg); z-index: 61; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .18s ease-out; }
.drawer-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 20px 0; }
.dh-top { display: flex; align-items: flex-start; gap: 12px; }
.dh-top h2 { font-size: 21px; }
.dh-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; color: var(--muted); font-size: 13px; }
.route { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; font-size: 14px; }
.route .city { font-weight: 650; }
.route .line { flex: 0 1 140px; height: 2px; background: repeating-linear-gradient(90deg, var(--blue) 0 6px, transparent 6px 10px); position: relative; min-width: 40px; }
.route .line::after { content: ""; position: absolute; right: -2px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--blue); }
.callbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 0; }
.call-btn { display: inline-flex; align-items: center; gap: 9px; background: var(--green); color: #fff; padding: 10px 16px; border-radius: 9px; font-weight: 650; font-size: 15px; border: 0; }
.call-btn:hover { background: #116a32; text-decoration: none; color: #fff; }
.call-btn svg { width: 18px; height: 18px; }
.call-btn .num { font-weight: 500; opacity: .9; }
.outcome { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 8px 11px; font-weight: 550; display: inline-flex; gap: 6px; align-items: center; }
.outcome:hover { border-color: var(--blue); color: var(--blue); }
.outcome kbd { margin-left: 2px; }
.outcome.o-nicht_erreicht:hover { border-color: var(--amber); color: var(--amber); }
.outcome.o-abgesagt:hover { border-color: var(--red); color: var(--red); }
.drawer-tabs { display: flex; gap: 2px; margin-top: 2px; }
.drawer-tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.drawer-tabs button.on { color: var(--blue); border-bottom-color: var(--blue); }
.drawer-body { flex: 1; overflow: auto; padding: 16px 20px 40px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.fields .full { grid-column: 1 / -1; }
.fields label.field input, .fields label.field select, .fields label.field textarea { color: var(--text); font-weight: 400; }
.saved-flag { font-size: 12px; color: var(--green); opacity: 0; transition: opacity .3s; }
.saved-flag.show { opacity: 1; }
.services { display: flex; flex-wrap: wrap; gap: 6px; }
.services label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 16px; padding: 4px 10px; font-size: 13px; cursor: pointer; color: var(--text); font-weight: 500; }
.services label:has(input:checked) { border-color: var(--blue); background: var(--blue-50); color: var(--blue-600); }
.services input { accent-color: var(--blue); }
.quicknote { display: flex; gap: 8px; align-items: flex-end; }
.quicknote textarea { min-height: 42px; }
.timeline { position: relative; }
.tl-item { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 8px 0; }
.tl-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); color: var(--muted); }
.tl-icon svg { width: 14px; height: 14px; }
.tl-item.t-anruf .tl-icon { background: var(--blue-50); color: var(--blue); }
.tl-item.t-anruf.o-nicht_erreicht .tl-icon { background: var(--amber-50); color: var(--amber); }
.tl-item.t-anruf.o-abgesagt .tl-icon { background: var(--red-50); color: var(--red); }
.tl-item.t-notiz .tl-icon { background: #f1ecfb; color: #6d3fc0; }
.tl-item.t-eingang .tl-icon { background: var(--green-50); color: var(--green); }
.tl-item.t-dublette .tl-icon { background: var(--amber-50); color: var(--amber); }
.tl-when { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-body { white-space: pre-wrap; word-break: break-word; }
.tl-item.t-notiz .tl-body { background: #faf8fe; border: 1px solid #ece4fa; padding: 7px 10px; border-radius: 8px; margin-top: 3px; }
.match-box { border: 1px solid #f0d9a8; background: var(--amber-50); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.task-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.task-item:last-child { border-bottom: 0; }
.task-item.done .ti-title { text-decoration: line-through; color: var(--faint); }
.task-item input[type=checkbox] { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--blue); }
.ti-main { flex: 1; min-width: 0; }
.ti-title { font-weight: 600; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 10px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(15,42,74,.36); animation: fade .12s; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 4px 10px; font-size: 12.5px; }
.presets button.on, .presets button:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-50); }
.suggest { display: flex; gap: 10px; align-items: center; background: var(--blue-50); border-radius: 9px; padding: 10px 12px; font-size: 13px; }
.suggest b { color: var(--blue-600); }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 380px; display: flex; gap: 10px; align-items: center; animation: fade .15s; }
.toast.err { background: var(--red); }
.toast button { color: #fff; border: 1px solid rgba(255,255,255,.35); background: transparent; border-radius: 6px; padding: 3px 8px; }

/* ---------- Anrufe ---------- */
.call-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.call-row:last-child { border-bottom: 0; }
.call-row.missed { background: linear-gradient(90deg, var(--red-50), transparent 60%); }
.call-dir { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); flex: none; }
.call-row.missed .call-dir { background: var(--red-50); color: var(--red); }
.call-dir svg { width: 15px; height: 15px; }
.call-main { flex: 1; min-width: 0; }
.call-main .tag { margin-left: 4px; }
.call-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.call-ai { margin-top: 8px; padding: 9px 11px; background: #faf8fe; border: 1px solid #ece4fa; border-radius: 8px; font-size: 13.5px; }
.tl-item.t-telefonie .tl-icon { background: var(--green-50); color: var(--green); }
.tl-item.t-telefonie.o-verpasst .tl-icon { background: var(--red-50); color: var(--red); }

/* ---------- Kanban ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: calc(100vh - 190px); }
.col { flex: 0 0 272px; background: #e9edf2; border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 190px); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; font-weight: 650; font-size: 13.5px; }
.col-head .dot { width: 9px; height: 9px; border-radius: 50%; }
.col-head .count { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.col-body { padding: 4px 8px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; min-height: 60px; }
.col.over { background: var(--blue-100); }
.card { background: var(--surface); border-radius: 9px; padding: 9px 11px; box-shadow: 0 1px 2px rgba(15,42,74,.1); border: 1px solid transparent; cursor: grab; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.card:hover { border-color: var(--blue-100); }
.card .c-name { font-weight: 650; }
.card .c-route { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .c-foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 12px; color: var(--muted); }
.card .c-foot .avatar { width: 20px; height: 20px; font-size: 9.5px; margin-left: auto; }
.card.ghost { position: fixed; pointer-events: none; z-index: 90; box-shadow: var(--shadow-lg); transform: rotate(2deg); width: 256px; }
.card.placeholder { opacity: .35; }
.col-more { text-align: center; font-size: 12.5px; color: var(--muted); padding: 4px; }

/* ---------- Kalender ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--surface); border-radius: 0 0 12px 12px; overflow: hidden; }
.cal-dow { padding: 8px; font-size: 12px; font-weight: 600; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f8f9fb; }
.cal-day { min-height: 118px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other { background: #fafbfc; } .cal-day.other .cal-num { color: var(--faint); }
.cal-day.is-today .cal-num { background: var(--blue); color: #fff; }
.cal-num { font-size: 12px; font-weight: 650; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.cal-ev { font-size: 11.5px; padding: 2px 5px; border-radius: 4px; background: var(--blue-50); color: var(--blue-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal-ev.move { background: var(--green-50); color: var(--green); }
.cal-ev.overdue { background: var(--red-50); color: var(--red); }
.cal-ev.done { text-decoration: line-through; opacity: .6; }
.cal-list { display: none; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(360px, 460px); }
.login-art { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h1 { font-size: 34px; line-height: 1.15; max-width: 480px; }
.login-art p { color: var(--navy-text); max-width: 440px; font-size: 15px; }
.login-art svg.route-art { position: absolute; right: -40px; bottom: 40px; width: 560px; opacity: .55; }
.login-form { background: var(--surface); padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.login-form h2 { font-size: 22px; margin-bottom: 4px; }
.alert-box { padding: 9px 12px; border-radius: 8px; background: var(--red-50); color: var(--red); font-size: 13px; }
.info-box { padding: 10px 12px; border-radius: 8px; background: var(--blue-50); color: var(--blue-600); font-size: 13px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: #f3f5f8; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; word-break: break-all; white-space: pre-wrap; }

/* ---------- Einstellungen ---------- */
.settings { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; }
.settings-nav button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; color: var(--muted); font-weight: 550; }
.settings-nav button.on { background: var(--surface); color: var(--blue); box-shadow: var(--shadow); }
.stage-row { display: grid; grid-template-columns: 22px 34px 1fr 140px 170px auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.stage-row input[type=color] { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: var(--surface); }
.handle { cursor: grab; color: var(--faint); display: grid; place-items: center; }
.stage-row.dragging { opacity: .4; }
.perm-grid { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; font-size: 13.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .widget.w3, .widget.w4 { grid-column: span 2; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 70; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .top { padding: 8px 12px; } .top .menu-btn { display: inline-grid; }
  .top .live span, .top-actions .hide-m { display: none; }
  .content { padding: 14px 12px 80px; }
  .dash-grid { grid-template-columns: 1fr; gap: 10px; }
  .widget.w1, .widget.w2, .widget.w3, .widget.w4 { grid-column: span 1; }
  .widget.h2, .widget.h3 { grid-row: span 1; }
  .kpi-row-m .widget { min-height: 96px; }
  .drawer { width: 100vw; }
  .drawer-head { padding: 10px 14px 0; } .drawer-body { padding: 12px 14px 90px; }
  .callbar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 10px; z-index: 62; overflow-x: auto; flex-wrap: nowrap; }
  .callbar .outcome kbd, .call-btn .num { display: none; }
  .fields, .grid2, .grid3 { grid-template-columns: 1fr; }
  .table-desktop { display: none; }
  .lead-cards { display: flex; flex-direction: column; }
  .call-row { flex-wrap: wrap; } .call-actions { width: 100%; justify-content: flex-start; padding-left: 42px; }
  .lead-card { display: flex; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line-2); align-items: center; }
  .lead-card .lc-main { flex: 1; min-width: 0; }
  .lead-card a.tel { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--green-50); color: var(--green); }
  .cal { display: none; } .cal-list { display: block; }
  .settings { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .settings-nav button { white-space: nowrap; }
  .login { grid-template-columns: 1fr; } .login-art { display: none; }
  .stage-row { grid-template-columns: 22px 34px 1fr auto; }
  .stage-row .s-kind, .stage-row .s-auto { grid-column: 3 / 4; }
  .bulkbar { top: 50px; }
  .kv { grid-template-columns: 110px 1fr; }
  .funnel-row { grid-template-columns: 110px 1fr 34px; }
  .page-head h1 { font-size: 19px; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg button { white-space: nowrap; }
  #quick { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .chip { white-space: nowrap; }
  .lead-card a.tel svg { width: 18px; height: 18px; }
  .outcome, .call-btn { white-space: nowrap; flex: none; }
}
@media print { .side, .top, .callbar { display: none; } }

/* App-Modus (installiert, iPhone mit Notch) */
@supports (padding: env(safe-area-inset-top)) {
  .side { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .top { padding-top: max(10px, env(safe-area-inset-top)); }
  .drawer-head { padding-top: max(14px, env(safe-area-inset-top)); }
  @media (max-width: 860px) {
    .top { padding-top: max(8px, env(safe-area-inset-top)); }
    .callbar { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
    .toasts { bottom: max(16px, env(safe-area-inset-bottom)); }
  }
}

/* ---------- Sprachassistent ---------- */
.assistant-fab { position: fixed; right: 20px; bottom: 20px; z-index: 55; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--blue); color: #fff;
  box-shadow: 0 8px 24px rgba(31,95,214,.4); display: grid; place-items: center; cursor: pointer; }
.assistant-fab svg { width: 26px; height: 26px; }
.assistant-fab:hover { background: var(--blue-600); }
.assistant-fab.on { background: var(--red); }
.assistant-overlay { position: fixed; inset: 0; z-index: 95; background: radial-gradient(circle at 50% 35%, #163a63, #0b1e36 70%); color: #fff; display: flex; flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); animation: fade .15s; }
.as-top { display: flex; align-items: center; }
.as-title { font-weight: 650; flex: 1; color: var(--navy-text); }
.as-close { color: #fff; }
.as-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; }
.as-orb { width: 170px; height: 170px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.06); transition: transform .3s; }
.as-orb span { width: 110px; height: 110px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 60px rgba(59,120,231,.7); transition: background .2s, transform .2s; }
.as-orb[data-state=listening] span { animation: as-breathe 2.2s ease-in-out infinite; }
.as-orb[data-state=speaking] span { background: #3b82f6; animation: as-talk .45s ease-in-out infinite alternate; }
.as-orb[data-state=thinking] span, .as-orb[data-state=working] span, .as-orb[data-state=connecting] span { background: #7c8db0; animation: as-breathe 1s ease-in-out infinite; }
.as-orb[data-state=muted] span { background: #4b5563; box-shadow: none; }
.as-orb[data-state=error] span { background: var(--red); box-shadow: 0 0 40px rgba(212,49,43,.6); }
@keyframes as-breathe { 50% { transform: scale(1.12); } }
@keyframes as-talk { from { transform: scale(.95); } to { transform: scale(1.18); } }
.as-status { font-size: 22px; font-weight: 650; }
.as-hint { color: var(--navy-text); font-size: 14px; max-width: 460px; line-height: 1.6; }
.as-log { max-height: 34vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; margin: 0 auto 14px; width: 100%; max-width: 620px; }
.as-line { padding: 8px 12px; border-radius: 10px; font-size: 15px; line-height: 1.4; }
.as-user { background: rgba(255,255,255,.08); align-self: flex-end; max-width: 85%; }
.as-assistant { background: rgba(59,120,231,.25); align-self: flex-start; max-width: 85%; }
.as-action { background: rgba(21,128,61,.35); display: flex; gap: 8px; align-items: center; font-weight: 600; }
.as-action svg { width: 18px; height: 18px; flex: none; }
.as-error { background: rgba(212,49,43,.35); }
.as-bottom { display: flex; gap: 12px; justify-content: center; }
.as-bottom button { border: 0; border-radius: 14px; padding: 16px 26px; font-size: 18px; font-weight: 650; }
.as-mute { background: rgba(255,255,255,.12); color: #fff; }
.as-stop { background: var(--red); color: #fff; min-width: 160px; }
@media (max-width: 860px) { .assistant-fab { bottom: 84px; right: 14px; } }
@media (prefers-reduced-motion: reduce) { .as-orb span { animation: none !important; } }

/* ---------- KI-Chat ---------- */
.ai-chat { position: fixed; right: 16px; bottom: 16px; z-index: 90; width: min(440px, calc(100vw - 32px)); height: min(640px, calc(100vh - 100px)); background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: fade .15s; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line-2); }
.ai-head svg { width: 18px; height: 18px; }
.ai-msgs { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.ai-msg { padding: 9px 12px; border-radius: 12px; max-width: 88%; white-space: pre-wrap; line-height: 1.45; }
.ai-me { align-self: flex-end; background: var(--blue); color: #fff; }
.ai-bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.ai-action { align-self: flex-start; background: var(--green-50); color: var(--green); font-weight: 600; font-size: 13px; }
.ai-wait { color: var(--muted); font-style: italic; }
.ai-err { background: var(--red-50); color: var(--red); border-color: #f2b8b4; }
.ai-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line-2); }
.ai-form textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; }
.ai-form textarea:focus { outline: none; border-color: var(--blue); }
@media (max-width: 860px) { .ai-chat { inset: 0; width: auto; height: auto; border-radius: 0; padding-top: env(safe-area-inset-top); } }

/* ---------- E-Mail mit KI ---------- */
.mail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mail-ai { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--blue-50, #eef4ff); display: flex; flex-direction: column; gap: 8px; min-height: 200px; }
.mail-ai.off { background: var(--bg); }
.mail-sugg { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; color: var(--text); max-height: 360px; overflow: auto; }
.mail-sugg-subj { font-weight: 700; margin-bottom: 6px; }
.mail-sugg-text, .mail-sig { white-space: pre-wrap; }
.mail-sig { color: var(--muted); border-left: 3px solid var(--line); padding-left: 8px; margin-top: 4px; }
.mail-check { background: #fff7e6; border: 1px solid #f5d38a; border-radius: 8px; padding: 8px 10px; color: #7a5200; margin-top: 8px; }
.mail-check ul, .mail-ai details ul { margin: 4px 0 0; padding-left: 18px; }
@media (max-width: 860px) { .mail-grid { grid-template-columns: 1fr; } }
