/* ============ Дизайн-система CRM ============ */
:root {
  --accent: #2E5BFF;
  --accent-dark: #1e42c8;
  --accent-light: #eaefff;
  --bg: #f2f4f8;
  --panel: #ffffff;
  --text: #1c2333;
  --text-soft: #6b7a90;
  --border: #e3e8f0;
  --green: #27ae60;
  --red: #e74c3c;
  --orange: #f39c12;
  --sidebar: #171e2e;
  --sidebar-active: #232d45;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 30, 60, .08), 0 4px 16px rgba(20, 30, 60, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }

/* ============ Каркас ============ */
#app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 216px; min-width: 216px; background: var(--sidebar); color: #aeb9d0;
  display: flex; flex-direction: column; padding: 14px 10px; gap: 2px;
}
.sidebar .logo {
  color: #fff; font-weight: 800; font-size: 17px; padding: 8px 12px 18px; letter-spacing: .3px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar .logo .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
  color: #aeb9d0; font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--sidebar-active); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .ico { width: 20px; text-align: center; font-size: 16px; }
.sidebar .spacer { flex: 1; }
.sidebar .whoami { padding: 10px 12px; font-size: 12px; color: #7d8aa5; border-top: 1px solid #232d45; }
.sidebar .whoami b { color: #dfe6f3; display: block; font-size: 13px; }
.sidebar .logout-btn { background: none; border: none; color: #7d8aa5; font-size: 12px; padding: 4px 0; text-align: left; }
.sidebar .logout-btn:hover { color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 58px; min-height: 58px; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
}
.topbar h1 { font-size: 17px; font-weight: 700; }
.topbar .grow { flex: 1; }
.content { flex: 1; overflow: auto; padding: 20px; }

/* ============ Элементы ============ */
.btn {
  background: var(--accent); color: #fff; border: none; border-radius: 9px; padding: 9px 16px;
  font-weight: 600; font-size: 13.5px; transition: background .15s; white-space: nowrap;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: var(--accent-light); color: var(--accent); }
.btn.secondary:hover { background: #dbe4ff; }
.btn.ghost { background: transparent; color: var(--text-soft); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: #fdeceb; color: var(--red); }
.btn.danger:hover { background: #fadbd8; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: default; }

input.inp, select.inp, textarea.inp {
  width: 100%; border: 1.5px solid var(--border); border-radius: 9px; padding: 8px 11px;
  background: #fff; color: var(--text); outline: none; transition: border-color .15s;
}
input.inp:focus, select.inp:focus, textarea.inp:focus { border-color: var(--accent); }
textarea.inp { resize: vertical; min-height: 64px; }
label.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin: 10px 0 4px; }
label.lbl .req { color: var(--red); }

.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.muted { color: var(--text-soft); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge.hot { background: #fdeceb; color: #d64533; }
.badge.warm { background: #fef5e7; color: #b9770e; }
.badge.cold { background: #eaf2f8; color: #2874a6; }
.badge.gray { background: #eef1f6; color: var(--text-soft); }
.badge.green { background: #e9f7ef; color: var(--green); }
.badge.red { background: #fdeceb; color: var(--red); }
.badge.blue { background: var(--accent-light); color: var(--accent); }

/* ============ Логин ============ */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #171e2e 0%, #223056 100%); }
.login-box { background: #fff; border-radius: 18px; padding: 38px 36px; width: 380px; box-shadow: 0 24px 80px rgba(0,0,0,.4); }
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-box .sub { color: var(--text-soft); font-size: 13px; margin-bottom: 20px; }
.login-box .btn { width: 100%; margin-top: 18px; padding: 12px; font-size: 15px; }
.login-err { color: var(--red); font-size: 13px; margin-top: 10px; text-align: center; min-height: 18px; }

/* ============ Канбан ============ */
.board-wrap { flex: 1; overflow-x: auto; overflow-y: hidden; padding: 16px 20px; display: flex; gap: 12px; align-items: stretch; height: 100%; }
.col {
  min-width: 265px; width: 265px; display: flex; flex-direction: column; background: #e9edf4;
  border-radius: var(--radius); max-height: 100%;
}
.col-head {
  padding: 10px 12px; border-radius: var(--radius) var(--radius) 0 0; color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.col-head .cnt { background: rgba(255,255,255,.25); padding: 1px 8px; border-radius: 12px; font-size: 12px; }
.col-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.col-body.dragover { background: #dfe7f5; border-radius: 0 0 var(--radius) var(--radius); outline: 2px dashed var(--accent); outline-offset: -4px; }
.lead-card {
  background: #fff; border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(20,30,60,.1);
  cursor: grab; border-left: 3px solid transparent; transition: box-shadow .15s;
}
.lead-card:hover { box-shadow: 0 3px 10px rgba(20,30,60,.15); }
.lead-card.dragging { opacity: .4; }
.lead-card.selected { border: 2px solid var(--accent); border-left-width: 3px; box-shadow: 0 0 0 3px var(--accent-light); }
.lead-card.selected::after { content: '✓'; position: absolute; top: 6px; right: 8px; width: 18px; height: 18px; background: var(--accent); color: #fff; border-radius: 50%; font-size: 12px; line-height: 18px; text-align: center; font-weight: 700; }
.lead-card { position: relative; }

/* Плашка массовых действий */
.bulk-bar {
  position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--sidebar); color: #fff; border-radius: 12px; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.35);
  animation: slideup .2s;
}
.bulk-bar[hidden] { display: none; }
.bulk-bar b { font-size: 13.5px; white-space: nowrap; }
.bulk-bar .inp { padding: 6px 10px; border: none; font-size: 13px; }
.bulk-bar .btn.small { padding: 6px 12px; }

/* Рамка выделения */
.marquee { position: fixed; z-index: 55; background: rgba(46,91,255,.12); border: 1.5px solid var(--accent); border-radius: 4px; pointer-events: none; }
.lead-card .nm { font-weight: 600; font-size: 13.5px; margin-bottom: 3px; }
.lead-card .ph { color: var(--text-soft); font-size: 12px; }
.lead-card .desc {
  color: var(--text-soft); font-size: 12px; margin-top: 4px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  border-top: 1px dashed var(--border); padding-top: 4px;
}
.lead-card .meta { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; align-items: center; }
.lead-card .mgr { font-size: 11px; color: var(--text-soft); margin-top: 5px; }
.lead-card .mgr.unassigned { color: var(--orange); font-weight: 600; }

/* ============ Модальные окна ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 22, 40, .55); display: flex;
  align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal { background: #fff; border-radius: 16px; width: 560px; max-width: 96vw; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.modal.wide { width: 1060px; }
.modal-head { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-head h2 { font-size: 16.5px; flex: 1; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text-soft); line-height: 1; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ============ Карточка лида ============ */
.lead-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 18px; }
@media (max-width: 900px) { .lead-grid { grid-template-columns: 1fr; } }
.section-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .7px; color: var(--text-soft); margin: 18px 0 6px; }
.section-title:first-child { margin-top: 0; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-item { background: #f7f9fc; border-radius: 10px; padding: 10px 13px; border-left: 3px solid var(--border); }
.tl-item.call-connected { border-left-color: var(--green); }
.tl-item.call-no_answer { border-left-color: var(--red); }
.tl-item.recording { border-left-color: var(--accent); }
.tl-item.stage { border-left-color: var(--orange); background: #fffaf2; }
.tl-item .tl-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-soft); margin-bottom: 3px; gap: 8px; }
.tl-item .tl-body { font-size: 13.5px; white-space: pre-wrap; }
.tl-item audio { width: 100%; margin-top: 8px; height: 36px; }
.tl-actions { display: flex; gap: 6px; margin-top: 6px; }

/* ============ Таблицы ============ */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.tbl th { background: #f7f9fc; text-align: left; padding: 10px 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-soft); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid #eef1f6; font-size: 13.5px; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: #fafbfe; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============ Прогресс и виджеты ============ */
.progress { height: 10px; background: #e9edf4; border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), #6a8bff); border-radius: 6px; transition: width .4s; }
.progress.green > div { background: linear-gradient(90deg, #27ae60, #58d68d); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.kpi .kpi-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); font-weight: 700; }
.kpi .kpi-value { font-size: 24px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }

/* Воронка конверсий */
.funnel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.funnel-row .fr-name { width: 190px; font-size: 13px; font-weight: 600; text-align: right; }
.funnel-row .fr-bar-wrap { flex: 1; background: #eef1f6; border-radius: 7px; height: 30px; position: relative; }
.funnel-row .fr-bar { height: 100%; border-radius: 7px; display: flex; align-items: center; padding: 0 10px; color: #fff; font-weight: 700; font-size: 12.5px; min-width: 36px; transition: width .4s; }
.funnel-row .fr-conv { width: 90px; font-size: 12.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; }

/* AI-аналитик */
.score-ring { font-size: 30px; font-weight: 800; }
.grade-Отлично { color: var(--green); }
.grade-Хорошо { color: #2874a6; }
.grade-Требует { color: var(--orange); }
.grade-Критично { color: var(--red); }
.analyst-list { margin: 6px 0 0 0; padding-left: 18px; font-size: 13.5px; }
.analyst-list li { margin-bottom: 4px; }
.analyst-list.good li::marker { color: var(--green); }
.analyst-list.bad li::marker { color: var(--red); }
.analyst-list.rec li::marker { color: var(--accent); }

/* Задачи */
.task-row { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 10px; padding: 11px 14px; box-shadow: var(--shadow); margin-bottom: 8px; }
.task-row.done { opacity: .55; }
.task-row.missed { border-left: 3px solid var(--red); }
.task-row .t-title { flex: 1; font-weight: 600; font-size: 13.5px; }
.task-row .t-sub { font-size: 12px; color: var(--text-soft); }

/* Уведомления */
#toast-root { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1c2333; color: #fff; border-radius: 10px; padding: 12px 18px; font-size: 13.5px; box-shadow: 0 8px 30px rgba(0,0,0,.3); animation: slideup .25s; max-width: 420px; }
.toast.error { background: #c0392b; }
.toast.success { background: #1e8449; }
@keyframes slideup { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Помощь / markdown */
.md h1 { font-size: 22px; margin: 18px 0 10px; }
.md h2 { font-size: 17px; margin: 18px 0 8px; }
.md h3 { font-size: 14.5px; margin: 14px 0 6px; }
.md p, .md li { font-size: 13.5px; line-height: 1.65; }
.md ul, .md ol { padding-left: 22px; margin: 6px 0; }
.md code { background: #eef1f6; padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
.md table { border-collapse: collapse; margin: 10px 0; }
.md table td, .md table th { border: 1px solid var(--border); padding: 6px 10px; font-size: 13px; }
.md blockquote { border-left: 3px solid var(--accent); padding: 4px 12px; color: var(--text-soft); margin: 8px 0; background: var(--accent-light); border-radius: 0 8px 8px 0; }

/* Поле ввода с нумерацией строк (импорт) */
.lined-input { display: flex; border: 1.5px solid var(--border); border-radius: 9px; overflow: hidden; background: #fff; height: 230px; resize: vertical; }
.lined-input:focus-within { border-color: var(--accent); }
.line-gutter { width: 38px; flex: none; height: 100%; background: #f4f6fa; border-right: 1px solid var(--border); overflow: hidden; }
.line-gutter-inner { padding: 8px 0; }
.line-gutter-inner div { height: 20px; padding: 0 8px; font: 12.5px/20px ui-monospace, Menlo, monospace; color: var(--text-soft); text-align: right; white-space: nowrap; }
.lined-input textarea { flex: 1; height: 100%; border: none; outline: none; resize: none; padding: 8px 11px; font: 12.5px/20px ui-monospace, Menlo, monospace; white-space: pre; overflow: auto; }

/* Калькулятор заработка */
.calc { background: #f7f9fc; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-top: 6px; }
.calc-rows { display: flex; flex-direction: column; gap: 6px; }
.calc-row { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 9px; padding: 7px 11px; }
.calc-name { flex: 1; font-size: 13px; font-weight: 600; }
.calc-rate { font-size: 12.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; min-width: 96px; text-align: right; }
.calc-rate.preview { color: var(--green); font-weight: 700; }
.calc-stepper { display: flex; align-items: center; gap: 4px; }
.calc-stepper button { width: 28px; height: 28px; border: 1.5px solid var(--border); background: #fff; border-radius: 7px; font-size: 16px; font-weight: 700; color: var(--accent); line-height: 1; }
.calc-stepper button:hover { border-color: var(--accent); background: var(--accent-light); }
.calc-stepper input { width: 50px; text-align: center; border: 1.5px solid var(--border); border-radius: 7px; padding: 5px; font-variant-numeric: tabular-nums; }
.calc-tiers { margin: 12px 0 8px; display: flex; flex-direction: column; gap: 6px; }
.calc-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.calc-chip { border: 1.5px solid var(--border); background: #fff; border-radius: 20px; padding: 5px 12px; font-size: 12.5px; font-weight: 700; color: var(--text); transition: all .12s; }
.calc-chip:hover { border-color: var(--green); background: #e9f7ef; color: var(--green); }
.calc-chip.active { border-color: var(--green); background: var(--green); color: #fff; box-shadow: 0 2px 8px rgba(39, 174, 96, .35); }
.calc-chip.active .muted { color: #d9f5e3; }
.calc-out { border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 8px; }
.calc-out-main { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-end; }
.calc-people { font-size: 18px; font-weight: 800; }
.calc-bonus { font-size: 18px; font-weight: 800; color: var(--accent); }
.calc-total { font-size: 24px; font-weight: 800; color: var(--green); }
.calc-goal { font-size: 13px; margin-top: 10px; }
.calc-hint { font-size: 13px; margin-top: 8px; min-height: 20px; color: var(--text); }

/* Загрузка менеджеров */
.cap-bar { display: flex; height: 22px; background: #eef1f6; border-radius: 7px; overflow: hidden; }
.cap-bar > div { height: 100%; transition: width .4s; }
.cap-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 3px; vertical-align: middle; }
.cap-mini { background: #f7f9fc; border-radius: 10px; padding: 8px 14px; flex: 1; min-width: 140px; }
.cap-mini-v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cap-mini-l { font-size: 11.5px; color: var(--text-soft); }

/* Единая панель сохранения на вкладках настроек */
.savebar {
  position: sticky; bottom: 0; margin-top: 18px; padding: 12px 16px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 -4px 20px rgba(20, 30, 60, .08);
  display: flex; align-items: center; gap: 14px; z-index: 5;
}
.savebar .btn { padding: 11px 22px; font-size: 14px; }

/* Настройки */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 9px 16px; font-weight: 600; font-size: 13.5px; color: var(--text-soft); border: none; background: none; border-bottom: 2.5px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.stage-row { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 10px; padding: 9px 13px; box-shadow: var(--shadow); margin-bottom: 7px; cursor: grab; }
.stage-row .drag-handle { color: var(--text-soft); cursor: grab; font-size: 15px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
.pill-select { display: flex; gap: 6px; }
.pill-select button { border: 1.5px solid var(--border); background: #fff; border-radius: 20px; padding: 4px 13px; font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.pill-select button.on { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.hint { font-size: 12px; color: var(--text-soft); margin-top: 4px; line-height: 1.5; }

/* ============ Гамбургер (скрыт на десктопе) ============ */
.hamburger { display: none; }
.nav-scrim { display: none; }

/* ============ Мобильная адаптация ============ */
@media (max-width: 820px) {
  #app { display: block; height: auto; min-height: 100vh; overflow: visible; }

  /* Боковое меню — выдвижная панель */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 244px; max-width: 84vw;
    transform: translateX(-100%); transition: transform .25s ease; z-index: 300; overflow-y: auto;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 50px rgba(0,0,0,.55); }
  .nav-scrim { position: fixed; inset: 0; background: rgba(10,15,30,.5); z-index: 250; }
  body.nav-open .nav-scrim { display: block; }
  .nav-item { padding: 13px 14px; font-size: 15px; }

  /* Кнопка-гамбургер */
  .hamburger {
    display: flex; align-items: center; justify-content: center;
    position: fixed; top: 9px; left: 10px; z-index: 120;
    width: 42px; height: 42px; border-radius: 10px; border: none;
    background: var(--sidebar); color: #fff; font-size: 20px; box-shadow: var(--shadow);
  }

  /* Основная область на всю ширину, высота = экран (чтобы доска и списки скроллились внутри) */
  .main { width: 100%; height: 100vh; height: 100dvh; }
  .topbar { height: auto; min-height: 54px; padding: 8px 12px 8px 62px; flex-wrap: wrap; gap: 8px; }
  .topbar h1 { font-size: 16px; flex-basis: 100%; }
  .topbar .grow { display: none; }
  .topbar .inp, .topbar select.inp, .topbar input.inp { width: auto !important; flex: 1 1 130px; min-width: 0; }
  .content { padding: 12px; }

  /* Формы и сетки — в один столбец */
  .grid2, .lead-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  textarea.inp { min-height: 72px; }

  /* Воронка — колонки на всю ширину, листаются свайпом */
  .board-wrap { padding: 10px; gap: 10px; }
  .col, .col:first-child { width: 84vw; min-width: 84vw; }

  /* Карточка лида */
  .section-title { margin-top: 14px; }

  /* Модалки почти на весь экран */
  .modal, .modal.wide { width: 96vw; max-width: 96vw; max-height: 90vh; }
  .modal-body { padding: 14px; }
  .modal-foot { flex-wrap: wrap; }

  /* Плашка массовых действий */
  .bulk-bar { top: 58px; left: 8px; right: 8px; transform: none; max-width: none; flex-wrap: wrap; }

  /* Воронка конверсий и калькулятор — компактнее */
  .funnel-row .fr-name { width: 100px; font-size: 11.5px; }
  .fr-conv { width: 64px; }
  .calc-out-main { gap: 12px; }

  /* Единая панель сохранения */
  .savebar { flex-wrap: wrap; gap: 8px; }

  /* Плашка авторизации */
  .login-box { width: 92vw; padding: 28px 22px; }
}

/* Очень узкие экраны */
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .col, .col:first-child { width: 88vw; min-width: 88vw; }
}
