/* v24 — дизайн-система «Precision CRM» (Google Stitch, 29.07.2026) */
:root {
  --brand: #1A3B5D;
  --brand-dark: #0F2B49;
  --brand-light: #EFF4FF;
  --accent: #FDF3D8;
  --bg: #F6F8FB;
  --card: #ffffff;
  --line: #E2E8F0;
  --text: #0B1C30;
  --muted: #5D6B7A;
  --danger: #DC2626;
  --ok: #15803D;
  --warn: #F59E0B;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(11, 28, 48, .06);
  --focus-ring: 0 0 0 3px rgba(26, 59, 93, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { letter-spacing: -.01em; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: var(--focus-ring);
}
.hidden { display: none !important; }

/* ---------- login ---------- */
.login {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--brand) 0%, #0B2038 100%);
}
.login form {
  background: var(--card); padding: 32px; border-radius: var(--radius);
  width: min(320px, 90vw); display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow);
}
.login h1 { margin: 0 0 8px; color: var(--brand); font-size: 22px; text-align: center; }
.login input {
  padding: 12px; border: 1px solid #E2E8F0; border-radius: 8px; font-size: 16px;
}
.login button {
  padding: 12px; border: 0; border-radius: 8px; background: var(--brand);
  color: #fff; font-size: 16px; cursor: pointer;
}
.err { color: var(--danger); font-size: 13px; min-height: 16px; margin: 0; text-align: center; }

/* ---------- header (глибокий navy, як сайдбар у Stitch) ---------- */
header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--brand-dark); color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
header h1 { font-size: 17px; margin: 0; white-space: nowrap; font-weight: 700; letter-spacing: -.01em; }
header input[type="search"] {
  flex: 1; min-width: 60px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px; font-size: 15px; background: rgba(255,255,255,.10); color: #fff;
  font-family: inherit;
}
header input[type="search"]::placeholder { color: rgba(255,255,255,.55); }
header input[type="search"]:focus {
  background: #fff; color: var(--text); border-color: transparent; box-shadow: var(--focus-ring);
}
header button {
  border: 0; border-radius: 6px; padding: 8px 14px; font-size: 15px;
  background: rgba(255,255,255,.12); color: #fff; cursor: pointer; font-family: inherit;
}
header button:hover { background: rgba(255,255,255,.2); }
header button.primary { background: #fff; color: var(--brand-dark); font-weight: 600; }
header button.primary:hover { background: var(--brand-light); }

/* ---------- board ---------- */
#app:not(.hidden) { display: flex; flex-direction: column; height: 100vh; }
main {
  display: flex; gap: 12px; padding: 12px;
  overflow-x: auto; flex: 1; min-height: 0;
  align-items: flex-start;
  scroll-snap-type: x proximity;
}
/* перемикач воронок (мультиворонка) */
.pipe-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--brand-light);
  border-bottom: 1px solid #E2E8F0;
}
.pipe-tabs.hidden { display: none; }
.pipe-tabs button {
  border: 1px solid #E2E8F0; background: #fff; color: var(--brand);
  border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: bold; cursor: pointer;
}
.pipe-tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pipe-tabs button .count {
  font-weight: normal; opacity: .8; font-size: 12px; margin-left: 2px;
}
.pipe-tabs.stats-pipe { background: transparent; border: 0; padding: 0 0 10px; }
.col {
  background: #EDF2F9; border-radius: var(--radius);
  border: 1px solid var(--line);
  min-width: 280px; width: 280px; flex-shrink: 0;
  max-height: 100%; display: flex; flex-direction: column;
  scroll-snap-align: start;
}
.col-head {
  padding: 10px 14px; font-weight: 600; font-size: 13px;
  letter-spacing: .02em; text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 3px solid var(--stage-color, var(--brand));
  border-radius: var(--radius) var(--radius) 0 0;
}
.col-head .count {
  color: var(--brand); font-weight: 600; font-size: 12px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 0 8px; line-height: 18px;
}
.col-head .sum { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: none; }
.col-body { padding: 8px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.col.drag-over { outline: 2px dashed var(--brand); outline-offset: -4px; }

.card {
  background: var(--card); border-radius: 8px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 10px 12px; cursor: grab; user-select: none;
  border-left: 4px solid transparent;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.card:hover { border-color: #C9D6E6; box-shadow: 0 3px 10px rgba(11,28,48,.10); }
.card.stalled { border-left-color: var(--warn); background: #FFFBEF; }
.card.dragging { opacity: .5; }
.card .when { font-size: 11px; color: var(--muted); }
.card .name { font-weight: 600; font-size: 15px; margin: 2px 0; }
.card .meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .contacts { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.card .contact { font-size: 12px; color: var(--brand); text-decoration: none; white-space: nowrap; }
.card .contact:hover { text-decoration: underline; }
.card span.contact { color: var(--muted); }
.card .tag {
  display: inline-block; font-size: 11px; font-weight: 500; background: var(--brand-light);
  color: var(--brand); border-radius: 999px; padding: 1px 8px; margin-top: 4px;
}
.card .amount { float: right; font-size: 12px; font-weight: bold; color: var(--ok); }
.card .move-btn {
  float: right; border: 0; background: none; font-size: 16px; color: var(--muted);
  cursor: pointer; padding: 0 2px; display: none;
}

/* ---------- modal → повноекранні view (full-screen) ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(12, 30, 50, .55); z-index: 50;
  display: flex; align-items: stretch; justify-content: center;
}
/* Sheet = повноцінне вікно на весь екран (не плаваюча картка) */
.sheet {
  background: var(--card);
  width: 100%; height: 100%;
  max-height: none; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0;
  padding: 0 18px calc(24px + env(safe-area-inset-bottom));
}
/* верхня липка шапка: заголовок + × (Назад/Закрити) завжди під рукою */
.sheet-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 6;
  background: var(--card);
  margin: 0 -18px 14px; padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: 18px; color: var(--text); font-weight: 700; }
.close { min-width: 44px; min-height: 44px; }
.close { border: 0; background: none; font-size: 28px; color: var(--muted); cursor: pointer; }

/* pick-sheet / na-sheet — швидкий вибір, лишаються нижнім листом (bottom sheet) */
.overlay.pick-sheet { align-items: flex-end; }
.overlay.pick-sheet .sheet {
  width: min(460px, 100vw); height: auto; max-height: 88vh;
  border-radius: 16px 16px 0 0;
  padding: 16px 18px calc(24px + env(safe-area-inset-bottom));
}
.overlay.pick-sheet .sheet-head {
  margin: -16px -18px 4px; padding: 16px 18px 4px;
  border-bottom: 0;
}
.sheet form { display: flex; flex-direction: column; gap: 10px; }
.sheet label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.sheet input, .sheet select, .sheet textarea {
  padding: 10px; border: 1px solid #E2E8F0; border-radius: 8px; font-size: 15px;
  font-family: inherit; width: 100%;
}
.sheet .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet .check { flex-direction: row; align-items: center; font-size: 14px; color: var(--text); }
.sheet .check input { width: auto; }
.sheet button.primary {
  padding: 12px; border: 0; border-radius: 8px; background: var(--brand);
  color: #fff; font-size: 16px; cursor: pointer; font-weight: 600; font-family: inherit;
}
.sheet button.danger {
  padding: 10px; border: 1px solid var(--danger); border-radius: 8px;
  background: none; color: var(--danger); font-size: 14px; cursor: pointer;
}
#historyBlock h3, #filesBlock h3 { font-size: 14px; color: var(--brand); margin: 18px 0 8px; }

/* ---------- файли угоди ---------- */
#fileList { list-style: none; margin: 0 0 10px; padding: 0; }
#fileList li {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid #E9EEF5; font-size: 14px;
}
#fileList a {
  color: var(--brand); text-decoration: none; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0;
}
#fileList a:hover { text-decoration: underline; }
#fileList .fmeta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.file-del, .file-send { border: 0; background: none; font-size: 15px; cursor: pointer; padding: 0 2px; }
/* ціль ≥44pt: на телефоні в цей рядок треба влучити пальцем, а не курсором */
.file-send { min-width: 44px; min-height: 44px; }
.file-del { min-width: 44px; min-height: 44px; }
.file-add {
  display: block; text-align: center; padding: 10px;
  border: 1px dashed var(--brand); border-radius: 8px;
  color: var(--brand); font-size: 14px; cursor: pointer;
  background: var(--brand-light);
}
.tag.files-tag { background: var(--accent); color: #7a6210; margin-left: 4px; }
.note-add { display: flex; gap: 8px; margin-bottom: 10px; }
.note-add input { flex: 1; padding: 10px; border: 1px solid #E2E8F0; border-radius: 8px; font-size: 15px; }
.note-add button {
  border: 0; border-radius: 8px; background: var(--brand); color: #fff;
  width: 42px; font-size: 18px; cursor: pointer;
}
#historyList { list-style: none; margin: 0; padding: 0; }
#historyList li { padding: 8px 0; border-bottom: 1px solid #E9EEF5; font-size: 13px; }
#historyList li .ts { color: var(--muted); font-size: 11px; display: block; }

/* ---------- планер ---------- */
.planner-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.planner-tabs button {
  border: 1px solid #E2E8F0; background: #fff; color: var(--brand);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.planner-tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pl-group {
  font-size: 13px; color: var(--brand); margin: 14px 0 4px;
  display: flex; align-items: center; gap: 6px;
}
.pl-group small { color: var(--muted); font-weight: normal; }
.pl-group.pl-overdue { color: var(--danger); }
.pl-group.pl-done { color: var(--muted); }
.pl-list { list-style: none; margin: 0; padding: 0; }
.pl-list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid #E9EEF5; font-size: 14px;
}
.pl-list input[type=checkbox], #leadTaskList input[type=checkbox] { width: auto; flex-shrink: 0; }
.pl-list li.done { text-decoration: line-through; color: var(--muted); }
.pl-list .pl-title { flex: 1; min-width: 0; }
.pl-list .pl-lead {
  color: var(--brand); font-size: 12px; cursor: pointer; white-space: nowrap;
}
.pl-list .pl-lead:hover { text-decoration: underline; }
.pl-list .due { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pl-list .due.overdue { color: var(--danger); font-weight: bold; }
.pl-defer {
  border: 1px solid #E2E8F0; background: #fff; color: var(--brand);
  border-radius: 6px; padding: 3px 8px; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.pl-defer:hover { background: var(--brand-light); }

/* ---------- календар ---------- */
.planner-view { display: flex; gap: 6px; margin-bottom: 8px; }
.planner-view button {
  border: 1px solid #E2E8F0; background: #F8FAFC; color: var(--brand);
  border-radius: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.planner-view button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.cal-head { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; flex-wrap: wrap; }
.cal-head > button {
  border: 1px solid #E2E8F0; background: #fff; color: var(--brand);
  border-radius: 6px; width: 30px; height: 30px; font-size: 16px; cursor: pointer; line-height: 1;
}
.cal-title { font-weight: bold; font-size: 15px; color: var(--brand); min-width: 130px; text-align: center; }
.cal-modes { margin-left: auto; display: flex; gap: 4px; }
.cal-modes button {
  border: 1px solid #E2E8F0; background: #F8FAFC; color: var(--brand);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.cal-modes button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 3px; }
.cal-dow span { text-align: center; font-size: 11px; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-cell {
  min-height: 58px; background: #F8FAFC; border-radius: 6px; padding: 3px 4px;
  cursor: pointer; overflow: hidden; border: 1px solid transparent;
}
.cal-cell:hover { border-color: #E2E8F0; }
.cal-cell.other { opacity: .38; }
.cal-cell.today { background: var(--accent); }
.cal-cell.selected { border-color: var(--brand); background: var(--brand-light); }
.cal-num { font-size: 11px; color: var(--muted); display: block; }
.cal-cell.today .cal-num { font-weight: bold; color: #7a6210; }
.cal-chip {
  display: block; font-size: 10px; background: var(--brand); color: #fff;
  border-radius: 3px; padding: 1px 3px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-chip.overdue { background: var(--danger); }
.cal-more { font-size: 10px; color: var(--muted); }
.cal-dot {
  display: none; background: var(--brand); color: #fff; border-radius: 8px;
  font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; text-align: center; padding: 0 3px;
}
.cal-dot.overdue { background: var(--danger); }
.cal-dot.done { background: #9fb8a6; }
.cal-week { display: flex; flex-direction: column; gap: 4px; }
.cal-wday { border: 1px solid #E9EEF5; border-radius: 8px; padding: 6px 10px; }
.cal-wday.today { background: #fffdf4; border-color: var(--accent); }
.cal-whead { font-size: 13px; color: var(--brand); cursor: pointer; }
.cal-free { margin: 4px 0; color: var(--muted); font-size: 12px; }
.cal-year { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ym { cursor: pointer; border: 1px solid #E9EEF5; border-radius: 8px; padding: 6px; }
.ym:hover { border-color: var(--brand); }
.ym-title { font-size: 12px; color: var(--brand); font-weight: bold; text-align: center; margin-bottom: 4px; }
.ym-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.ym-d {
  font-size: 8px; text-align: center; color: var(--muted);
  border-radius: 2px; min-height: 11px; line-height: 11px;
}
.ym-d.busy { background: var(--brand); color: #fff; }
.ym-d.busy-overdue { background: var(--danger); color: #fff; }
.ym-d.busy-done { background: #cfe6d4; }
.ym-d.today { outline: 1px solid var(--warn); }
.cal-day-panel { margin-top: 12px; border-top: 1px solid #E9EEF5; padding-top: 4px; }
.cal-add-day {
  margin-top: 8px; border: 1px dashed var(--brand); background: var(--brand-light);
  color: var(--brand); border-radius: 8px; padding: 8px 14px; font-size: 13px; cursor: pointer; width: 100%;
}
@media (max-width: 640px) {
  .cal-year { grid-template-columns: repeat(2, 1fr); }
  .cal-cell { min-height: 46px; }
  .cal-chip, .cal-more { display: none; }   /* на мобільному — бейдж-крапка замість чипів */
  .cal-dot { display: inline-block; }
  .cal-cell .cal-num { margin-bottom: 2px; }
}

/* ---------- контакти ---------- */
.card .contact-chip {
  display: inline-block; font-size: 11px; font-weight: 500; margin-top: 4px;
  background: #EFF4FF; color: var(--brand); border-radius: 999px;
  padding: 1px 8px; border: 1px solid #DCE6F2;
}
.lead-contact {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--brand-light); border-radius: 8px; padding: 8px 10px;
  font-size: 13px;
}
.lead-contact .lc-label { color: var(--muted); font-size: 12px; }
.lead-contact .lc-name {
  font-weight: bold; color: var(--brand); cursor: pointer; text-decoration: none;
}
.lead-contact .lc-name:hover { text-decoration: underline; }
.lead-contact .lc-none { color: var(--muted); }
.lead-contact button {
  margin-left: auto; border: 1px solid var(--brand); background: #fff;
  color: var(--brand); border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.pick-hint {
  margin: 0 0 8px; padding: 8px 10px; background: var(--accent);
  border-radius: 8px; font-size: 13px; color: #7a6210;
}
#contactSearch {
  width: 100%; padding: 10px; border: 1px solid #E2E8F0; border-radius: 8px;
  font-size: 15px; margin-bottom: 10px;
}
.contacts-list { list-style: none; margin: 0; padding: 0; }
.contacts-list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  border-bottom: 1px solid #E9EEF5; cursor: pointer;
}
.contacts-list li:hover { background: #F8FAFC; }
.contacts-list .cl-main { flex: 1; min-width: 0; }
.contacts-list .cl-name { font-weight: bold; font-size: 14px; }
.contacts-list .cl-sub { font-size: 12px; color: var(--muted); }
.contacts-list .cl-stat { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.contacts-list .cl-deals { font-weight: bold; color: var(--brand); font-size: 15px; }

/* ---------- клієнти: широка таблиця (amo-style) ---------- */
.sheet.wide { width: 100%; }
.ct-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.ct-toolbar #contactSearch { flex: 1; min-width: 180px; padding: 10px; border: 1px solid #E2E8F0; border-radius: 8px; font-size: 15px; font-family: inherit; }
.ct-toolbar #contactSort { padding: 9px 10px; border: 1px solid #E2E8F0; border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; }
.ct-summary { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ct-dup {
  border: 1px solid #E2E8F0; background: #fff; color: var(--brand);
  border-radius: 8px; padding: 9px 12px; font-size: 13px; font-weight: bold;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
.ct-dup:hover { background: var(--brand-light); }
/* чекбокс вибору контакту (граблі: .sheet input {width:100%}) */
.ct-check { width: 34px; text-align: center; cursor: default; }
.ct-check input.ct-sel { width: auto; flex-shrink: 0; margin: 0; transform: scale(1.15); cursor: pointer; }
/* панель об'єднання під таблицею */
.merge-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding: 10px 14px; background: var(--brand-light);
  border: 1px solid #E2E8F0; border-radius: 10px; flex-wrap: wrap;
}
.merge-bar b { color: var(--brand); }
.merge-bar-actions { display: flex; gap: 8px; }
.merge-bar button { border: 1px solid #E2E8F0; background: #fff; color: var(--brand);
  border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; font-family: inherit; }
.merge-bar button.primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: bold; }
/* модалка вибору головного контакту */
.mg-hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; line-height: 1.4; }
.mg-opt {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 1px solid #E2E8F0; border-radius: 10px; margin-bottom: 8px; cursor: pointer;
}
.mg-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }
.mg-opt input[type="radio"] { width: auto; flex-shrink: 0; margin-top: 3px; transform: scale(1.2); }
.mg-info { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.mg-sub { font-size: 12px; color: var(--muted); }
/* об'єднання дублів угод */
#mergeLeadBtn {
  border: 1px solid #E2E8F0; background: #fff; color: var(--brand);
  border-radius: 8px; padding: 10px; font-size: 14px; cursor: pointer; font-family: inherit;
}
#mergeLeadBtn:hover { background: var(--brand-light); }
#lmSearch { width: 100%; padding: 10px; border: 1px solid #E2E8F0; border-radius: 8px; font-size: 15px; font-family: inherit; margin-bottom: 10px; }
.lm-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 46vh; overflow-y: auto; }
.lm-list li {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px;
  border: 1px solid #E2E8F0; border-radius: 9px; margin-bottom: 6px; cursor: pointer;
}
.lm-list li:hover { background: #F8FAFC; }
.lm-sel { width: auto; flex-shrink: 0; margin-top: 3px; transform: scale(1.15); }
.lm-info { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.lm-sub { font-size: 12px; color: var(--muted); }
.lm-flag { font-size: 11px; background: #fde7cf; color: #b25a12; border-radius: 4px; padding: 1px 6px; margin-left: 4px; }
/* підказка дубля в інбоксі */
.ib-dup { margin-top: 6px; font-size: 12px; color: #b25a12; }
.ib-merge {
  border: 1px solid var(--warn); background: #fff; color: #b25a12;
  border-radius: 6px; padding: 3px 8px; font-size: 12px; cursor: pointer; margin-left: 4px; font-family: inherit;
}
.ib-merge:hover { background: #fde7cf; }
.ct-wrap { overflow-x: auto; border: 1px solid #E2E8F0; border-radius: 12px; }
.ct-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ct-table thead th {
  position: sticky; top: 0; background: var(--brand-light); color: var(--brand);
  text-align: left; font-weight: bold; padding: 9px 12px; white-space: nowrap;
  cursor: pointer; user-select: none;
}
.ct-table thead th.num { text-align: right; }
.ct-table thead th .arr { font-size: 11px; margin-left: 3px; }
.ct-table tbody td { padding: 10px 12px; border-top: 1px solid #E9EEF5; vertical-align: middle; }
.ct-table tbody tr { cursor: pointer; }
.ct-table tbody tr:hover { background: #F8FAFC; }
.ct-cli { display: flex; align-items: center; gap: 9px; }
.ct-ava {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-light);
  color: var(--brand); display: inline-flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 12px; flex-shrink: 0;
}
.ct-name { font-weight: bold; }
.ct-sub { color: var(--muted); }
.ct-phone { color: var(--brand); text-decoration: none; white-space: nowrap; }
.ct-num { text-align: right; white-space: nowrap; }
.ct-num .ct-deals { font-weight: bold; color: var(--brand); }
.ct-num .ct-total { font-weight: bold; }
.ct-when { color: var(--muted); white-space: nowrap; }
.ct-empty { color: var(--muted); font-size: 13px; padding: 18px 6px; text-align: center; }
.ct-label { display: none; }

@media (max-width: 720px) {
  .ct-wrap { overflow-x: visible; border: 0; }
  .ct-table thead { display: none; }
  .ct-table, .ct-table tbody, .ct-table tr, .ct-table td { display: block; }
  .ct-table tr { border: 1px solid #E2E8F0; border-radius: 12px; margin-bottom: 10px; padding: 6px 2px; }
  .ct-table tbody td { border: 0; padding: 5px 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .ct-table td.ct-cli-cell { justify-content: flex-start; padding-top: 9px; padding-bottom: 9px; }
  .ct-label { display: inline; color: var(--muted); font-size: 12px; }
  .ct-num { text-align: right; }
}
.cc-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px;
}
.cc-stat {
  background: var(--brand-light); border-radius: 8px; padding: 10px; text-align: center;
}
.cc-stat b { display: block; font-size: 18px; color: var(--brand); }
.cc-stat span { font-size: 11px; color: var(--muted); }
.cc-info { font-size: 13px; color: var(--text); margin-bottom: 12px; }
.cc-info a { color: var(--brand); text-decoration: none; }
.cc-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.cc-actions button {
  border: 1px solid var(--brand); background: #fff; color: var(--brand);
  border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.cc-deals { list-style: none; margin: 0; padding: 0; }
.cc-deals li {
  display: flex; align-items: center; gap: 8px; padding: 9px 4px;
  border-bottom: 1px solid #E9EEF5; cursor: pointer; font-size: 13px;
}
.cc-deals li:hover { background: #F8FAFC; }
.cc-deals .d-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cc-deals .d-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-deals .d-amount { font-weight: bold; color: var(--ok); white-space: nowrap; }
.cc-deals .d-when { color: var(--muted); font-size: 11px; white-space: nowrap; }
.cc-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* ---------- заплановані дії ---------- */
.card .due-badge {
  display: inline-block; font-size: 11px; font-weight: 500; margin-top: 4px; margin-right: 4px;
  background: #E8F7EC; color: #15803D; border: 1px solid #C9EAD2;
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.card .due-badge.overdue { background: #fdecea; color: var(--danger); border-color: #f3c6c1; font-weight: bold; }
#leadTaskList { list-style: none; margin: 0 0 10px; padding: 0; }
#leadTaskList li {
  display: flex; align-items: center; gap: 8px; padding: 8px 0;
  border-bottom: 1px solid #E9EEF5; font-size: 14px;
}
#leadTaskList li.done { text-decoration: line-through; color: var(--muted); }
#leadTaskList .lt-title { flex: 1; min-width: 0; }
#leadTaskList .lt-due { font-size: 12px; color: var(--muted); white-space: nowrap; }
#leadTaskList .lt-due.overdue { color: var(--danger); font-weight: bold; }
.action-add { display: flex; flex-direction: column; gap: 8px; }
.action-add > input {
  padding: 10px; border: 1px solid #E2E8F0; border-radius: 8px; font-size: 15px;
  font-family: inherit; width: 100%;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  border: 1px solid #E2E8F0; background: #fff; color: var(--brand);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.chips button:hover { background: var(--brand-light); }
#actionAdd { margin-top: 2px; }

/* ---------- шлюз «наступна дія» ---------- */
.na-sheet .na-hint { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.na-sheet .chips { margin-bottom: 8px; }
.na-sheet .chips button.on { border-color: var(--brand); background: var(--brand-light); font-weight: 600; }
.na-sheet input { width: 100%; margin-bottom: 10px; }
.na-sheet .na-save { width: 100%; }
.na-sheet .na-skip {
  width: 100%; margin-top: 8px; background: none; border: 0;
  color: var(--muted); font-size: 13px; cursor: pointer; padding: 8px;
}
.na-sheet .na-skip:hover { color: var(--text); text-decoration: underline; }
#noactBtn { position: relative; }
#noactBtn.has-noact { background: var(--danger); color: #fff; }

/* ---------- вхідні (триаж) ---------- */
#inboxBtn { position: relative; }
#inboxBtn.has-inbox { background: var(--warn); color: #0B1C30; }
.badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: bold;
  min-width: 18px; height: 18px; line-height: 18px; text-align: center;
  border-radius: 9px; padding: 0 4px;
}
.inbox-list { list-style: none; margin: 0; padding: 0; }
.inbox-list li {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 4px;
  border-bottom: 1px solid #E9EEF5;
}
.inbox-list .ib-main { flex: 1; min-width: 0; }
.inbox-list .ib-name { font-weight: bold; font-size: 14px; }
.inbox-list .ib-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.inbox-list .ib-msg {
  font-size: 13px; color: var(--text); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.inbox-list .ib-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.ib-accept {
  border: 0; border-radius: 6px; background: var(--ok); color: #fff;
  padding: 7px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.ib-reject {
  border: 1px solid #E2E8F0; border-radius: 6px; background: #fff; color: var(--danger);
  padding: 7px 10px; font-size: 13px; cursor: pointer;
}

/* ---------- теги / сегменти / ціль ---------- */
.tag.tag-click { cursor: pointer; background: #EFF4FF; border: 1px solid #DCE6F2; }
.tag.tag-click:hover { background: var(--brand); color: #fff; }
.seg {
  display: inline-block; font-size: 11px; border-radius: 999px; padding: 1px 8px;
  vertical-align: 1px; font-weight: 500;
}
.seg.vip { background: var(--accent); color: #7a6210; border: 1px solid #eadfa8; }
.seg.rep { background: #eaf4ec; color: #15803D; border: 1px solid #cfe6d4; }
.goal-box {
  background: var(--brand-light); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
}
.goal-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--brand); font-weight: bold; }
.goal-head button {
  border: 0; background: none; color: var(--brand); font-size: 15px; cursor: pointer; padding: 0 4px;
}
.goal-bar {
  background: #fff; border-radius: 6px; height: 14px; overflow: hidden; margin: 8px 0 6px;
  border: 1px solid #DCE6F2;
}
.goal-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 6px; min-width: 2px; transition: width .3s; }
.goal-bar > span.hit { background: var(--ok); }
.goal-nums { font-size: 13px; color: var(--text); }

/* ---------- аналітика ---------- */
.stats-h { font-size: 14px; color: var(--brand); margin: 18px 0 10px; }
.funnel { display: flex; flex-direction: column; gap: 7px; }
.fn-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.fn-name { width: 100px; flex-shrink: 0; color: var(--text); }
.fn-bar { flex: 1; background: #E9EEF5; border-radius: 5px; height: 18px; overflow: hidden; }
.fn-bar > span { display: block; height: 100%; border-radius: 5px; min-width: 2px; }
.fn-num { width: 120px; flex-shrink: 0; text-align: right; color: var(--muted); font-size: 12px; white-space: nowrap; }
.reasons { list-style: none; margin: 0; padding: 0; }
.reasons li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 4px; border-bottom: 1px solid #E9EEF5; font-size: 13px;
}
.reasons .rs-name { color: var(--text); }
.reasons .rs-num { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  header h1 { display: none; }
  /* шапка не розпирає сторінку: пошук на весь рядок, кнопки переносяться нижче */
  header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
    padding-top: calc(8px + env(safe-area-inset-top));
  }
  header input[type="search"] { flex: 1 1 100%; min-width: 0; }
  /* цілі дотику ≥44pt (Apple HIG / закон Фіттса) */
  header button { flex: 0 0 auto; min-height: 44px; padding: 8px 13px; font-size: 14px; }
  main { scroll-snap-type: x mandatory; padding-bottom: 78px; }
  .col { min-width: 86vw; width: 86vw; }
  .card { cursor: default; }
  .card .move-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; font-size: 20px; margin: -6px -6px 0 0;
  }
  .pl-list input[type=checkbox], #leadTaskList input[type=checkbox] {
    width: 26px; height: 26px;
  }
  .pl-list label, #leadTaskList label { min-height: 44px; align-items: center; }
  .overlay.pick-sheet { align-items: flex-end; }
  /* шапка на мобільному = пошук + 📥 (решта переїхала в нижній таб-бар і «Ще») */
  header #addBtn, header #contactAddBtn, header #contactsBtn, header #statsBtn,
  header #tasksBtn, header #fieldsBtn, header #contactFieldsBtn, header #pipesBtn { display: none; }
  header input[type="search"] { flex: 1 1 auto; }
  header #inboxBtn { min-width: 44px; }
}
@media (min-width: 641px) {
  /* десктоп: повноцінне вікно на всю висоту, ширину обмежуємо для читабельності форм */
  .sheet {
    width: min(920px, 100vw);
    box-shadow: -24px 0 48px -24px rgba(12,30,50,.35), 24px 0 48px -24px rgba(12,30,50,.35);
  }
  .sheet.wide { width: min(1200px, 100vw); }
  .overlay.pick-sheet { align-items: center; }
  .overlay.pick-sheet .sheet {
    width: min(460px, 100vw); height: auto; border-radius: 16px;
  }
  .overlay.pick-sheet .sheet-head { margin: -16px -18px 4px; }
}

/* ---------- нижній таб-бар (мобільний) ---------- */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--card); border-top: 1px solid #E2E8F0;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 56px; padding: 7px 2px 6px; color: var(--muted); font-size: 11px;
}
.tabbar button.active { color: var(--brand); }
.tabbar .tb-ic { font-size: 21px; line-height: 1; }
.tabbar .tb-lb { font-size: 11px; }
.tabbar .tb-add .tb-ic {
  background: var(--brand); color: #fff; width: 34px; height: 34px; border-radius: 10px;
  font-size: 19px; display: flex; align-items: center; justify-content: center;
}

/* ---------- pick-sheet (вибір стадії / меню «Ще») ---------- */
.pick-sheet-body { width: min(460px, 100vw); }
.pick-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.pick-opt {
  border: 1px solid #E2E8F0; background: var(--card); border-radius: 10px;
  padding: 14px 16px; font-size: 16px; text-align: left; cursor: pointer;
  min-height: 48px; color: var(--fg, #0B1C30);
}
.pick-opt.current { border-color: var(--brand); background: var(--brand-light); font-weight: 600; }
.pick-opt:active { background: var(--brand-light); }

/* ---------- ask-sheet: ввід одного рядка замість prompt() ---------- */
.ask-body { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.ask-inp {
  width: 100%; border: 1px solid #E2E8F0; border-radius: 10px;
  padding: 13px 14px; font-size: 16px;   /* 16px — інакше iOS зумить сторінку */
  min-height: 48px; box-sizing: border-box;
}
.ask-inp:focus { border-color: var(--brand); outline: none; }
.ask-chips button { min-height: 40px; }
.ask-ok { min-height: 48px; }

/* таб-бар показуємо лише на мобільному (правило після базового display:none) */
@media (max-width: 640px) {
  .tabbar { display: flex; }
}

/* ---------- панель виду дошки (канбан↔список + фільтри-черги) ---------- */
.board-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px 0;
}
.board-bar button {
  border: 1px solid #E2E8F0; background: var(--card); border-radius: 999px;
  padding: 7px 13px; font-size: 13px; color: var(--muted); cursor: pointer; min-height: 34px; font-family: inherit; font-weight: 500;
}
.board-bar button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.bb-sep { width: 1px; align-self: stretch; margin: 4px 4px; background: #E2E8F0; }
@media (max-width: 640px) {
  .board-bar { padding: 8px 10px 0; }
  .board-bar button { min-height: 40px; }
}

/* ---------- режим «Список» (таблиця угод) ---------- */
.list-wrap { width: 100%; overflow: auto; background: var(--card); border-radius: 12px; align-self: flex-start; }
.lead-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lead-table th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-size: 12px;
  border-bottom: 2px solid #E2E8F0; cursor: pointer; user-select: none; white-space: nowrap;
  position: sticky; top: 0; background: var(--card);
}
.lead-table td { padding: 10px 12px; border-bottom: 1px solid #E9EEF5; }
.lead-table tbody tr { cursor: pointer; }
.lead-table tbody tr:hover { background: var(--brand-light); }
.lt-sub { font-size: 12px; color: var(--muted); }
.lt-stage {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  background: color-mix(in srgb, var(--stage-color) 14%, #fff); color: var(--stage-color);
  border: 1px solid color-mix(in srgb, var(--stage-color) 35%, #fff);
}
.lt-amt { white-space: nowrap; font-weight: 600; }
.lt-overdue { color: #DC2626; font-weight: 600; }
.lt-noact { color: #DC2626; }
.empty-hint { padding: 24px; text-align: center; color: var(--muted); }

/* мобільний плаский список (пошук/список) */
.search-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.sr-item .sr-stage { font-size: 12px; font-weight: 600; color: var(--stage-color); margin: 2px 0 4px; }

/* лічильник «без дії» в шапці колонки */
.noact-cnt { font-size: 11px; color: #DC2626; font-weight: 600; }

/* ---------- форма угоди: акордеон + липке «Зберегти» ---------- */
.more-fields { border: 1px solid #E2E8F0; border-radius: 10px; }
.more-fields summary {
  cursor: pointer; padding: 12px; font-size: 14px; color: var(--brand);
  list-style-position: inside; user-select: none; min-height: 44px; box-sizing: border-box;
}
.more-fields .mf-body { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }
.sticky-save { position: sticky; bottom: -24px; z-index: 5; box-shadow: 0 -8px 16px -8px rgba(12,30,50,.25); }
.danger-zone {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px;
  padding-top: 14px; border-top: 1px dashed #E2E8F0;
}
.danger-zone button { padding: 10px 14px; border-radius: 8px; border: 1px solid #E2E8F0; background: var(--card); cursor: pointer; }
.danger-zone .danger { color: #DC2626; border-color: #e6b0aa; }

/* месенджер-кнопки біля телефону */
.contact.msgr { text-decoration: none; padding: 0 3px; }

/* ---------- тост ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(16px);
  background: #0B1C30; color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 15px; z-index: 200; opacity: 0; transition: all .3s ease;
  box-shadow: 0 8px 24px rgba(12,30,50,.35); max-width: 92vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.win { background: #1e7d43; font-weight: 600; }

/* ---------- конструктор полів (v19) ---------- */
.cf-box {
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px 12px; background: var(--brand-light);
  border: 1px solid #E2E8F0; border-radius: 8px;
}
.cf-box label.cf { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.cf-box select, .cf-box input {
  padding: 10px; border: 1px solid #E2E8F0; border-radius: 8px; font-size: 15px; background: #fff;
}
.cf-sub { font-size: 10px; color: var(--muted); border: 1px solid #E2E8F0; border-radius: 4px; padding: 0 4px; }
.cf-req { color: var(--danger); font-size: 11px; }
.cf-miss select, .cf-miss input { border-color: var(--danger); background: #fff5f5; }
.tag.cf-tag { background: var(--accent); color: #7a5c00; }
.due-badge.noact { background: #fdecea; color: var(--danger); }

/* адмінка полів */
.fl-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fl-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--bg); border-radius: 8px;
}
.fl-list li.fl-builtin { opacity: .75; }
.fl-move { display: flex; flex-direction: column; gap: 2px; }
.fl-move button { border: 0; background: none; cursor: pointer; font-size: 11px; color: var(--muted); padding: 0 4px; }
.fl-move button:disabled { opacity: .3; cursor: default; }
.fl-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fl-info b { font-size: 14px; color: var(--text); }
.fl-type { font-size: 11px; color: var(--muted); }
.fl-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.fl-list li > button { border: 0; background: none; cursor: pointer; font-size: 15px; }
.fl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.fl-actions button {
  padding: 10px 12px; border: 1px solid #E2E8F0; border-radius: 8px;
  background: #fff; color: var(--brand); cursor: pointer; font-size: 14px;
}
.fl-actions button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
#fieldEditForm {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; background: var(--brand-light); border-radius: 8px; margin-bottom: 8px;
}
#fieldEditForm h3 { margin: 0; font-size: 14px; color: var(--brand); }
.fe-sub { font-size: 12px; color: var(--muted); }
.fe-checks { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; }
.fe-check {
  display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px !important;
  font-size: 13px !important; color: var(--text) !important;
}
.fe-check input { width: auto !important; flex-shrink: 0; }

/* ---- кастомні поля контакту в картці ---- */
.cc-cf { margin: 8px 0; border-top: 1px solid var(--line, #e2e8f0); padding-top: 8px; }
.cc-cf-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 13px; }
.cc-cf-label { color: var(--muted); }
.cc-cf-val { color: var(--text, #1a2733); font-weight: 600; text-align: right; }

/* ---- редактор воронок ---- */
.pipe-card { border: 1px solid var(--line, #e2e8f0); border-radius: 10px; padding: 12px; margin-bottom: 12px; background: var(--card); }
.pipe-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pipe-title { flex: 1; font-weight: 700; font-size: 15px !important; color: var(--brand) !important; }
.pipe-total { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pipe-head button[data-act="delpipe"] { font-size: 12px; white-space: nowrap; }
.pipe-head button[disabled] { opacity: .4; cursor: not-allowed; }
.pipe-stages { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.pipe-stage { display: flex; align-items: center; gap: 6px; }
.pipe-stage input[type="text"] { flex: 1; }
.ps-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ps-count { font-size: 11px; background: var(--brand-light); color: var(--brand); border-radius: 8px; padding: 1px 7px; white-space: nowrap; }
.pipe-stage button, .pipe-head button, .pipe-addstage { padding: 4px 8px; }
.pipe-addstage { font-size: 13px; margin-bottom: 8px; }
.pipe-terminal label { font-size: 12px; color: var(--muted); }

/* ---------- лівий сайдбар (десктоп ≥900px, макет Stitch «Precision CRM») ---------- */
#sidebar { display: none; }
@media (min-width: 900px) {
  #sidebar {
    display: flex; flex-direction: column; gap: 14px;
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 40;
    width: 240px; padding: 18px 14px;
    background: linear-gradient(180deg, var(--brand-dark) 0%, #0B2038 100%);
    color: #fff;
  }
  #app { padding-left: 240px; }
  /* шапка стає тонкою: лише пошук, решта дій — у сайдбарі */
  header h1, header button { display: none; }
  header { background: var(--card); border-bottom: 1px solid var(--line); }
  header input[type="search"] {
    background: var(--bg); color: var(--text);
    border: 1px solid var(--line); max-width: 440px;
  }
  header input[type="search"]::placeholder { color: var(--muted); }
}
.sb-logo { padding: 4px 10px 8px; font-size: 16px; letter-spacing: -.01em; }
.sb-new {
  border: 1px solid rgba(255,255,255,.22); border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff;
  padding: 10px 12px; font-size: 14px; font-weight: 600; font-family: inherit;
}
.sb-new:hover { background: rgba(255,255,255,.2); }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-nav button {
  display: flex; align-items: center; gap: 10px;
  border: 0; border-radius: 6px; cursor: pointer; text-align: left;
  background: none; color: rgba(255,255,255,.65);
  padding: 9px 10px; font-size: 14px; font-weight: 500; font-family: inherit;
}
.sb-nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.sb-nav button.active { background: rgba(255,255,255,.14); color: #fff; }
.sb-ic { width: 22px; text-align: center; font-size: 16px; flex-shrink: 0; }
.sb-badge {
  margin-left: auto; min-width: 20px; text-align: center;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 600; padding: 2px 6px;
}
.sb-badge.warn { background: var(--warn); color: #3B2A00; }
.sb-bottom { margin-top: auto; }
.sb-sec {
  padding: 0 10px 6px; font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.4);
}

/* ---------- Витратники / графік ТО (сервісний движок) ---------- */
#consumablesBlock { margin-top: 18px; }
#consumablesBlock h3 { margin-bottom: 8px; }
.cons-emails { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.cons-emails input { width: 100%; margin-top: 4px; }
.cons-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); }
.cons-table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 13px; }
.cons-table th, .cons-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.cons-table thead th { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
.cons-table td input { width: 100%; min-width: 70px; border: 1px solid transparent; background: transparent; padding: 4px 5px; border-radius: 5px; font-size: 13px; }
.cons-table td input:hover { border-color: var(--line); }
.cons-table td input:focus { border-color: var(--brand); background: #fff; box-shadow: var(--focus-ring); }
.cons-table td input.cons-num { min-width: 60px; text-align: right; }
.cons-table td input.cons-unit { min-width: 48px; }
.cons-table td input.cons-int { min-width: 52px; text-align: center; }
.cons-table td.cons-next { white-space: nowrap; font-weight: 600; color: var(--brand-dark); }
.cons-del { border: 0; background: none; cursor: pointer; font-size: 15px; padding: 2px 4px; opacity: .6; }
.cons-del:hover { opacity: 1; }
.cons-total { margin: 10px 0; font-size: 14px; }
.cons-total b { color: var(--brand-dark); font-size: 16px; }
.cons-add { display: flex; flex-direction: column; gap: 8px; background: var(--brand-light); padding: 12px; border-radius: var(--radius); }
.cons-add input { width: 100%; }
.cons-add-row { display: flex; gap: 8px; }
.cons-add-row input { flex: 1; min-width: 0; }
.cons-add button { align-self: flex-start; }
@media (max-width: 560px) { .cons-add-row { flex-wrap: wrap; } }
