/* ---------- Токени ---------- */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 18px; --radius-sm: 12px;
  --bg: #eef2f0;
  --blob-1: rgba(46, 170, 112, .35); --blob-2: rgba(80, 140, 255, .28); --blob-3: rgba(255, 186, 90, .22);
  --glass: rgba(255, 255, 255, .62); --glass-strong: rgba(255, 255, 255, .82); --glass-hover: rgba(255, 255, 255, .78);
  --glass-border: rgba(255, 255, 255, .75); --hairline: rgba(20, 40, 30, .08);
  --text: #12201a; --text-2: #3c4a44; --muted: #6c7a73;
  --accent: #14915a; --accent-2: #0f7a4b; --accent-ink: #ffffff; --accent-soft: rgba(20, 145, 90, .12);
  --series-1: #14915a; --series-2: #9fb3aa;
  --danger: #c2372c;
  --shadow: 0 10px 40px rgba(20, 50, 35, .10), 0 1px 0 rgba(255, 255, 255, .6) inset;
  --shadow-lg: 0 24px 70px rgba(20, 50, 35, .18);
  --st-new: rgba(108, 122, 115, .14); --st-new-ink: #3c4a44;
  --st-contacted: rgba(232, 160, 20, .18); --st-contacted-ink: #8a5a00;
  --st-replied: rgba(60, 120, 240, .16); --st-replied-ink: #1d4fb8;
  --st-customer: rgba(20, 145, 90, .2); --st-customer-ink: #0b6a40;
  --st-skip: rgba(108, 122, 115, .08); --st-skip-ink: #8a958f;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070b0a;
    --blob-1: rgba(30, 190, 120, .28); --blob-2: rgba(70, 110, 255, .22); --blob-3: rgba(190, 90, 255, .14);
    --glass: rgba(22, 30, 27, .55); --glass-strong: rgba(24, 32, 29, .82); --glass-hover: rgba(34, 44, 40, .7);
    --glass-border: rgba(255, 255, 255, .08); --hairline: rgba(255, 255, 255, .07);
    --text: #eaf2ee; --text-2: #bccac3; --muted: #84948c;
    --accent: #3ddc93; --accent-2: #2bbf7c; --accent-ink: #04140c; --accent-soft: rgba(61, 220, 147, .12);
    --series-1: #3ddc93; --series-2: #4b5b54;
    --danger: #ff7b6e;
    --shadow: 0 10px 40px rgba(0, 0, 0, .35), 0 1px 0 rgba(255, 255, 255, .05) inset;
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, .6);
    --st-new: rgba(255, 255, 255, .08); --st-new-ink: #bccac3;
    --st-contacted: rgba(255, 190, 70, .14); --st-contacted-ink: #ffd27a;
    --st-replied: rgba(110, 160, 255, .16); --st-replied-ink: #a9c6ff;
    --st-customer: rgba(61, 220, 147, .18); --st-customer-ink: #7cf0b9;
    --st-skip: rgba(255, 255, 255, .04); --st-skip-ink: #6c7a73;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070b0a;
  --blob-1: rgba(30, 190, 120, .28); --blob-2: rgba(70, 110, 255, .22); --blob-3: rgba(190, 90, 255, .14);
  --glass: rgba(22, 30, 27, .55); --glass-strong: rgba(24, 32, 29, .82); --glass-hover: rgba(34, 44, 40, .7);
  --glass-border: rgba(255, 255, 255, .08); --hairline: rgba(255, 255, 255, .07);
  --text: #eaf2ee; --text-2: #bccac3; --muted: #84948c;
  --accent: #3ddc93; --accent-2: #2bbf7c; --accent-ink: #04140c; --accent-soft: rgba(61, 220, 147, .12);
  --series-1: #3ddc93; --series-2: #4b5b54;
  --danger: #ff7b6e;
  --shadow: 0 10px 40px rgba(0, 0, 0, .35), 0 1px 0 rgba(255, 255, 255, .05) inset;
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .6);
  --st-new: rgba(255, 255, 255, .08); --st-new-ink: #bccac3;
  --st-contacted: rgba(255, 190, 70, .14); --st-contacted-ink: #ffd27a;
  --st-replied: rgba(110, 160, 255, .16); --st-replied-ink: #a9c6ff;
  --st-customer: rgba(61, 220, 147, .18); --st-customer-ink: #7cf0b9;
  --st-skip: rgba(255, 255, 255, .04); --st-skip-ink: #6c7a73;
  color-scheme: dark;
}

/* ---------- Основа ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
/* Мек цветен фон зад стъклото. Неподвижен: анимиран фон кара всеки стъклен панел
   да се размазва наново на всеки кадър и скролването започва да насича. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vmax 60vmax at 10% 10%, var(--blob-1), transparent 60%),
    radial-gradient(55vmax 55vmax at 95% 5%, var(--blob-2), transparent 60%),
    radial-gradient(65vmax 65vmax at 75% 110%, var(--blob-3), transparent 60%);
}

[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 14px; font-weight: 600; margin: 0 0 14px; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--danger); min-height: 1em; }

.glass {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(16px) saturate(150%); -webkit-backdrop-filter: blur(16px) saturate(150%);
}

input, select, textarea, .btn {
  font: inherit; color: inherit; border-radius: 11px; padding: 8px 12px;
  background: var(--glass-strong); border: 1px solid var(--hairline);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { width: 100%; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.btn:focus-visible, a:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-weight: 500; }
.btn:hover { background: var(--glass-hover); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 6px 18px var(--accent-soft); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 9px; }
.btn.icon { padding: 7px; width: 36px; justify-content: center; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.seg-ctl { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--glass); border: 1px solid var(--glass-border); backdrop-filter: blur(14px); }
.seg-ctl button { font: inherit; font-size: 12.5px; font-weight: 500; border: 0; background: transparent; color: var(--text-2); padding: 6px 12px; border-radius: 9px; cursor: pointer; }
.seg-ctl button.on { background: var(--glass-strong); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* ---------- Вход ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(400px, 100%); padding: 32px; display: grid; gap: 16px; }
.login-card h1 { font-size: 22px; }
.login-card p { margin: 4px 0 0; }

/* ---------- Рамка ---------- */
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.logo {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #22c37f, #0f7a4b); box-shadow: 0 6px 16px rgba(20, 145, 90, .35);
}
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; gap: 0; }
.sidebar {
  margin: 14px 0 14px 14px; padding: 20px 14px; display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 14px; height: calc(100vh - 28px);
}
.sidebar .brand { padding: 0 6px; }
nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--text-2); text-decoration: none; font-weight: 500; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--glass-hover); text-decoration: none; }
.nav-item.active { background: var(--glass-strong); color: var(--text); box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.nav-item svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav-item.active svg { color: var(--accent); }
.nav-item .badge { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding: 0 6px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  margin: 14px 14px 0; padding: 10px 12px; border-radius: var(--radius);
}
.search-box { position: relative; flex: 1; max-width: 560px; }
.search-box input { width: 100%; padding-left: 38px; background: var(--glass-strong); }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-box kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
kbd { font: 11px var(--font); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--hairline); color: var(--muted); background: var(--glass); }
.topbar .spacer { flex: 1; }
.view { padding: 22px 28px 56px; max-width: 1560px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.head-controls { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 12; height: auto; margin: 0; border-radius: 0; border-width: 0 0 1px;
    flex-direction: row; align-items: center; padding: 10px 14px; gap: 10px; overflow-x: auto;
  }
  .sidebar .brand span:last-child, .nav-item span, .nav-item .badge, #classifier { display: none; }
  nav { flex-direction: row; }
  .nav-item { padding: 9px; }
  .sidebar-foot { margin: 0 0 0 auto; display: flex; padding: 0; }
  .topbar { position: static; margin: 12px 16px 0; }
  .topbar .spacer { display: none; }
  .search-box { max-width: none; }
  .search-box kbd { display: none; }
  .view { padding: 16px; }
}

/* ---------- Карти, KPI ---------- */
.card { padding: 20px; }
.grid { display: grid; gap: 16px; }
/* Всички KPI в един ред на широк екран; иначе по 3, а на телефон по 2 */
.kpis { grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); margin-bottom: 16px; }
/* По-тесен екран: мрежа от 6 колони — 3 карти на ред, а при 5 карти долните две стават по-широки, за да няма дупка */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpis > .kpi { grid-column: span 2; }
  .kpis.n5 > .kpi:nth-child(n+4) { grid-column: span 3; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis > .kpi, .kpis.n5 > .kpi:nth-child(n+4) { grid-column: span 1; }
  .kpis.n5 > .kpi:last-child { grid-column: span 2; }
  .kpi .value { font-size: 24px; } .kpi { padding: 14px; }
}
.kpi { padding: 18px 18px 16px; display: grid; gap: 2px; cursor: pointer; transition: transform .15s, background .15s; }
.kpi:hover { transform: translateY(-2px); background: var(--glass-hover); }
.kpi .top { display: flex; justify-content: space-between; align-items: center; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi .ico svg { width: 17px; height: 17px; }
.kpi .value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: 12px; }
.dash { grid-template-columns: repeat(12, 1fr); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; }
@media (max-width: 1200px) { .span-8, .span-4 { grid-column: span 12; } }
@media (max-width: 900px) { .span-6 { grid-column: span 12; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Графики ---------- */
.cols { display: flex; align-items: flex-end; gap: var(--gap, 6px); height: 200px; padding-top: 22px; border-bottom: 1px solid var(--hairline); }
/* Графиката запълва картата, когато съседната карта в реда е по-висока */
.card.fill { display: flex; flex-direction: column; }
.card.fill .chart { flex: 1; display: flex; flex-direction: column; }
.card.fill .cols { flex: 1; height: auto; min-height: 200px; }
.col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.col .v { font-size: 11px; color: var(--text-2); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.col .stack { width: 100%; max-width: 38px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.col .seg { width: 100%; border-radius: 3px; min-height: 2px; transition: filter .15s; }
.col .seg:first-child { border-radius: 6px 6px 3px 3px; }
.col .seg.s1 { background: linear-gradient(180deg, var(--series-1), color-mix(in srgb, var(--series-1) 70%, #000)); }
.col .seg.s2 { background: var(--series-2); }
.col:hover .seg { filter: brightness(1.15); }
.col-labels { display: flex; gap: var(--gap, 6px); margin-top: 8px; }
.col-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); min-width: 0; overflow: visible; white-space: nowrap; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(100px, 160px) 1fr 44px; align-items: center; gap: 12px; border-radius: 8px; }
.hbar.clickable { cursor: pointer; }
.hbar .name { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 10px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--series-1) 75%, transparent), var(--series-1)); min-width: 4px; }
.hbar:hover .fill { filter: brightness(1.15); }
.hbar .num { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; }
.funnel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.funnel .stage { border-radius: 14px; padding: 14px; cursor: pointer; transition: transform .15s; }
.funnel .stage:hover { transform: translateY(-2px); }
.funnel b { display: block; font-size: 24px; letter-spacing: -0.02em; }
.funnel span { font-size: 12.5px; }
@media (max-width: 700px) { .funnel { grid-template-columns: repeat(2, 1fr); } }
.tooltip { position: fixed; z-index: 80; pointer-events: none; background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-border); padding: 7px 10px; border-radius: 10px; font-size: 12px; max-width: 280px; box-shadow: var(--shadow-lg); backdrop-filter: blur(16px); }
.recent { display: grid; gap: 4px; }
.recent-item { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; cursor: pointer; }
.recent-item:hover { background: var(--glass-hover); }
.recent-item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Елементи ---------- */
.avatar {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
  color: var(--accent); background: var(--accent-soft); flex: none;
}
.avatar.other { color: var(--text-2); background: var(--hairline); }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--accent-soft); color: var(--accent); }
.pill.status { font-weight: 600; }
.pill.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-new { background: var(--st-new); color: var(--st-new-ink); }
.st-contacted { background: var(--st-contacted); color: var(--st-contacted-ink); }
.st-replied { background: var(--st-replied); color: var(--st-replied-ink); }
.st-customer { background: var(--st-customer); color: var(--st-customer-ink); }
.st-skip { background: var(--st-skip); color: var(--st-skip-ink); }
.tag { font-size: 11.5px; color: var(--muted); }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.contact-icons { display: inline-flex; gap: 6px; color: var(--muted); }
.contact-icons svg { width: 15px; height: 15px; }
.contact-icons .on { color: var(--accent); }

/* ---------- Таблица ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 14px; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 220px; }
.toolbar .grow input { width: 100%; }
.bulk { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 12px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: var(--glass-hover); }
td.subject { max-width: 360px; color: var(--muted); font-size: 12px; line-height: 1.4; }
td.subject .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
td.nowrap { white-space: nowrap; }
.firm { display: flex; gap: 12px; align-items: center; min-width: 220px; }
.firm .t { font-weight: 600; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 16px; }

/* ---------- Етапи ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(230px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.lane { padding: 12px; min-height: 240px; }
.lane h3 { font-size: 13px; margin: 2px 4px 12px; display: flex; justify-content: space-between; align-items: center; }
.lane-cards { display: grid; gap: 10px; }
.lead-card { background: var(--glass-strong); border: 1px solid var(--hairline); border-radius: 14px; padding: 12px; cursor: pointer; display: grid; gap: 6px; transition: transform .15s, border-color .15s; }
.lead-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.lead-card .t { font-weight: 600; }
.lead-card .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.lead-card .move { display: flex; gap: 4px; }

/* ---------- Чекмедже ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(5, 15, 10, .35); backdrop-filter: blur(4px); z-index: 30; animation: fade .2s; }
.drawer {
  position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(600px, calc(100% - 24px)); z-index: 31; overflow-y: auto;
  padding: 26px; display: grid; gap: 18px; align-content: start; background: var(--glass-strong); box-shadow: var(--shadow-lg);
  animation: slide .25s cubic-bezier(.2, .8, .2, 1);
}
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; gap: 14px; align-items: start; }
.drawer-head .who { display: flex; gap: 14px; align-items: center; }
.drawer-head .avatar { width: 48px; height: 48px; border-radius: 14px; font-size: 15px; }
.drawer-head h2 { font-size: 19px; margin: 0 0 2px; }
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 9px 14px; font-size: 13px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.section { border-top: 1px solid var(--hairline); padding-top: 16px; display: grid; gap: 12px; }
.section h2 { margin: 0; }
.timeline { display: grid; gap: 10px; font-size: 13px; position: relative; }
.timeline .ev { display: grid; grid-template-columns: 14px 1fr; gap: 10px; }
.timeline .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; box-shadow: 0 0 0 4px var(--accent-soft); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 90; padding: 11px 16px; font-weight: 500; background: var(--glass-strong); }
.prose { max-width: 820px; }
.prose li { margin-bottom: 6px; }
.prose .card + .card { margin-top: 16px; }
code, pre { background: var(--hairline); border-radius: 7px; padding: 1px 6px; font-size: 12.5px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
pre { padding: 12px 14px; overflow: auto; white-space: pre; }
details summary { cursor: pointer; font-weight: 600; }

/* ---------- Меню: групи и запазени изгледи ---------- */
.sidebar nav { overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.nav-item .badge.warn { background: var(--st-contacted); color: var(--st-contacted-ink); }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 12px 4px; font-weight: 600; }
.saved-views { display: grid; gap: 1px; }
.saved-view { display: flex; align-items: center; gap: 2px; }
.saved-view a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 7px 12px; border-radius: 10px; color: var(--text-2); font-size: 13px; }
.saved-view a span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-view a svg { width: 14px; height: 14px; color: var(--muted); }
.saved-view a:hover { background: var(--glass-hover); text-decoration: none; }
.saved-view .btn { opacity: 0; width: 28px; padding: 4px; }
.saved-view:hover .btn, .saved-view .btn:focus-visible { opacity: 1; }
@media (max-width: 900px) { .saved-views { display: none; } }

/* ---------- Оценка ---------- */
.score {
  display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 7px; border-radius: 8px;
  font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; background: var(--hairline); color: var(--text-2);
}
.score.hi { background: var(--st-customer); color: var(--st-customer-ink); }
.score.mid { background: var(--st-contacted); color: var(--st-contacted-ink); }
.recent-item:has(> .score) { grid-template-columns: 40px 1fr auto; }
.score-parts { display: grid; grid-template-columns: minmax(150px, 1.4fr) 1fr 46px; gap: 8px 12px; align-items: center; font-size: 12.5px; }
.score-parts .track { height: 8px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.score-parts .fill { height: 100%; border-radius: 999px; background: var(--series-1); }
.score-parts .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.pill.partner { background: var(--st-replied); color: var(--st-replied-ink); }
.avatar.partner { color: var(--st-replied-ink); background: var(--st-replied); }
.clickable { cursor: pointer; }

/* ---------- Преглед ---------- */
.review-list { display: grid; gap: 12px; }
.review-item { display: grid; gap: 10px; }
.review-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; flex-wrap: wrap; }
.subject-full { color: var(--text-2); line-height: 1.45; max-height: 7.3em; overflow: auto; }
.review-item .actions { align-items: center; }
.sep { width: 1px; align-self: stretch; background: var(--hairline); margin: 0 4px; }

/* ---------- Изпращане ---------- */
.notice { margin-bottom: 16px; border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.notice ol { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; }
.seq-list { display: grid; gap: 14px; }
.seq { display: grid; gap: 12px; }
.steps { display: grid; gap: 10px; }
.step { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: var(--glass); }
.step-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
label.inline { flex-direction: row; align-items: center; gap: 6px; color: var(--text-2); }
.preview { white-space: pre-wrap; max-height: 420px; }
.enroll-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }

.dialog {
  border: 1px solid var(--glass-border); padding: 24px; width: min(480px, calc(100% - 32px)); color: var(--text);
  background: var(--glass-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); backdrop-filter: blur(20px);
}
.dialog::backdrop { background: rgba(5, 15, 10, .4); backdrop-filter: blur(4px); }
.dialog form { display: grid; gap: 14px; }
.dialog h2 { font-size: 17px; margin: 0; }

/* ---------- Карта ---------- */
.map { height: 620px; overflow: hidden; padding: 0; }
.map-list { padding: 8px; max-height: 620px; overflow: auto; }
.map-list td, .map-list th { padding: 9px 10px; }
.leaflet-container { font: inherit; background: var(--glass); }
.map.dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.6); }
.leaflet-tooltip { background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-border); border-radius: 10px; box-shadow: var(--shadow-lg); }
@media (max-width: 1200px) { .map { height: 440px; } .map-list { max-height: none; } }
