/* CRM v2: нова таблиця лідів (текстові клітинки + один редактор), меню, картки на телефоні */

/* текстова клітинка виглядає як поле, але легша для браузера */
table.grid.leads .cv{display:block;height:33px;line-height:33px;padding:0 8px;font-size:13px;color:var(--ink);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:text;outline:none}
table.grid.leads .cv:hover{background:#F1F5F8}
table.grid.leads .cv:focus{outline:2px solid var(--accent);outline-offset:-2px}
table.grid.leads .cv.ph{color:#A7B0BB}
table.grid.leads td.c-first .cv{padding-right:22px}
table.grid.leads td.c-phone .cv{padding-right:76px}
table.grid.leads td.c-phone .ph-na{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:inline-flex;gap:3px}
table.grid.leads td.c-phone .ph-na .ph-btns{position:static;transform:none}
table.grid.leads td.c-phone .na-quick{width:28px;height:26px;padding:0;font-size:13px;display:inline-grid;place-items:center}
table.grid.leads .rm-wrap .cv{flex:1;min-width:0}
.st-pill .na-n{font-weight:700;margin-left:2px}
table.grid.leads tbody.ord.alt .cv:hover{background:#EEF2F5}

/* етап — кольорова плашка з меню */
.st-pill{display:flex;align-items:center;justify-content:space-between;gap:6px;width:calc(100% - 8px);margin:3px 4px;height:27px;
  border:0;border-radius:6px;padding:0 8px;font:inherit;font-size:12.5px;font-weight:600;cursor:pointer;text-align:left}
.st-pill .caret,.wa-pick .caret{font-size:10px;opacity:.6}
.st-pill.st-idle{background:var(--idle-soft);color:#5F6977}
.st-pill.st-warn{background:var(--warn-soft);color:var(--warn)}
.st-pill.st-info{background:var(--info-soft);color:var(--info)}
.st-pill.st-ok{background:var(--ok-soft);color:var(--ok)}
.st-pill.st-bad{background:var(--bad-soft);color:var(--bad)}
.st-pill:hover{filter:brightness(.97)}

/* WhatsApp — кнопка з меню шаблонів */
.wa-pick{display:flex;align-items:center;justify-content:space-between;width:100%;height:33px;border:0;background:transparent;
  padding:0 8px;font:inherit;font-size:13px;font-weight:500;color:#128C7E;cursor:pointer}
.wa-pick:hover{background:#EEF7F1}
.wa-pick:disabled{color:#b5bec6;cursor:default;background:transparent}

/* спливаюче меню */
.pop-menu{position:absolute;z-index:90;background:#fff;border:1px solid #d8dee4;border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.16);
  padding:4px;display:flex;flex-direction:column;min-width:190px;max-height:60vh;overflow:auto}
.pop-menu button{display:flex;align-items:center;gap:8px;border:0;background:none;text-align:left;font:inherit;font-size:13.5px;
  padding:8px 10px;border-radius:7px;cursor:pointer;color:var(--ink);white-space:nowrap}
.pop-menu button:hover{background:#F1F5F8}
.pop-menu button.on{font-weight:700;background:#EEF4F7}
.pop-menu .dot{width:9px;height:9px;border-radius:50%;flex:none;background:#C7CED7}
.pop-menu .dot.st-warn{background:#E0A43A}.pop-menu .dot.st-info{background:#5B7FD0}.pop-menu .dot.st-ok{background:#3C9A62}.pop-menu .dot.st-bad{background:#C25450}

/* ── телефон: картки ── */
.lcards{display:flex;flex-direction:column;gap:8px;padding:8px}
.lc{background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px 12px;display:flex;flex-direction:column;gap:8px}
.lc.due{border-left:4px solid #e0a526}
.lc-top{display:flex;align-items:center;gap:8px;min-width:0}
.lc-name{font-weight:700;font-size:15px;color:var(--ink);text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lc-cty{color:var(--muted);font-size:12.5px;margin-left:auto;white-space:nowrap}
.lc-acts{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.lc-btn{display:inline-flex;align-items:center;gap:6px;height:38px;padding:0 12px;border-radius:9px;border:1px solid var(--line);
  background:#fff;font:inherit;font-size:14px;color:var(--ink);text-decoration:none;cursor:pointer}
.lc-btn.call{background:#E5EBF8;border-color:#C9D5F0;color:#3456A3;font-weight:600}
.lc-btn.wa{background:#E7F7EE;border-color:#BFE8CF;color:#128C7E;font-weight:600}
.lc-btn.greet{background:#25D366;border-color:#25D366;color:#fff;font-weight:700}
.lc .na-btn{height:38px;padding:0 10px;font-size:14px}
.lc-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.lc-row .st-pill{width:auto;margin:0;height:32px;min-width:150px}
.card-stage .st-pill{width:100%;margin:4px 0 0;height:38px;padding:0 12px;font-size:14px}
.lc-rm{font-size:13px;color:var(--ink-2)}
.lc-rm.today,.lc-rm.over{color:#9C6210;font-weight:700}
.lc-todo{display:flex;align-items:center;gap:8px;font-size:13.5px;background:#FBF6EA;border-radius:8px;padding:6px 8px}
.lc-todo span{flex:1}
.lc-note{border:0;background:#F6F8FA;border-radius:8px;padding:8px;text-align:left;font:inherit;font-size:13px;color:var(--ink-2);cursor:pointer;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lc-more{text-align:center;color:var(--muted);padding:16px}
@media (max-width: 760px){
  #leads.sheet{max-height:none;overflow:visible;border:0;background:transparent}
  .stage-bar{flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:4px}
  .stage-bar .stage-chip{flex:none}
  .stage-bar .stage-arrow{display:none}
  .table-head{flex-wrap:wrap}
  .table-head [data-act="gcontacts"],.table-head [data-act="sheet-sync"]{display:none}
}

/* іконки одним елементом (замість SVG у кожному рядку — таблиця легша в рази) */
.ico{display:inline-block;width:14px;height:14px;vertical-align:middle;background:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 width=%2214%22 height=%2214%22%3E%3Cpath fill=%22black%22 d=%22M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2c.3-.3.7-.4 1-.2 1.1.4 2.3.6 3.6.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1A17 17 0 0 1 3 4c0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.3.2 2.5.6 3.6.1.3 0 .7-.2 1z%22/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 width=%2214%22 height=%2214%22%3E%3Cpath fill=%22black%22 d=%22M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2c.3-.3.7-.4 1-.2 1.1.4 2.3.6 3.6.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1A17 17 0 0 1 3 4c0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.3.2 2.5.6 3.6.1.3 0 .7-.2 1z%22/%3E%3C/svg%3E") center/contain no-repeat}
.ico.ico-wa{width:15px;height:15px;-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 width=%2215%22 height=%2215%22%3E%3Cpath fill=%22black%22 d=%22M12 3a9 9 0 0 0-7.8 13.5L3 21l4.6-1.2A9 9 0 1 0 12 3zm0 2a7 7 0 1 1-3.6 13l-.3-.2-2.4.6.6-2.3-.2-.3A7 7 0 0 1 12 5zm-2.9 3.6c-.2 0-.5 0-.7.3-.2.3-.9.9-.9 2.2s.9 2.5 1 2.7c.1.2 1.8 2.8 4.4 3.8 2.2.8 2.6.7 3.1.6.5-.1 1.5-.6 1.7-1.2.2-.6.2-1.1.2-1.2-.1-.1-.2-.2-.5-.3l-1.7-.8c-.2-.1-.4-.1-.6.1l-.8 1c-.1.2-.3.2-.5.1-.3-.1-1.1-.4-2-1.2-.8-.7-1.3-1.5-1.4-1.8-.2-.3 0-.4.1-.5l.4-.5.3-.5v-.5l-.8-1.9c-.2-.4-.4-.4-.5-.4h-.5z%22/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 width=%2215%22 height=%2215%22%3E%3Cpath fill=%22black%22 d=%22M12 3a9 9 0 0 0-7.8 13.5L3 21l4.6-1.2A9 9 0 1 0 12 3zm0 2a7 7 0 1 1-3.6 13l-.3-.2-2.4.6.6-2.3-.2-.3A7 7 0 0 1 12 5zm-2.9 3.6c-.2 0-.5 0-.7.3-.2.3-.9.9-.9 2.2s.9 2.5 1 2.7c.1.2 1.8 2.8 4.4 3.8 2.2.8 2.6.7 3.1.6.5-.1 1.5-.6 1.7-1.2.2-.6.2-1.1.2-1.2-.1-.1-.2-.2-.5-.3l-1.7-.8c-.2-.1-.4-.1-.6.1l-.8 1c-.1.2-.3.2-.5.1-.3-.1-1.1-.4-2-1.2-.8-.7-1.3-1.5-1.4-1.8-.2-.3 0-.4.1-.5l.4-.5.3-.5v-.5l-.8-1.9c-.2-.4-.4-.4-.5-.4h-.5z%22/%3E%3C/svg%3E")}
.flag{display:inline-block;width:18px;height:12px;vertical-align:middle;background:center/contain no-repeat}
.flag.fl-ru-txt{width:auto;height:auto;font-style:normal;font-size:10.5px;font-weight:700;line-height:1;letter-spacing:.02em;color:var(--ink-2);border:1px solid var(--line);border-radius:3px;padding:1px 3px;background:none}
.flag.fl-uk{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 18 12%22 width=%2218%22 height=%2212%22%3E%3Crect width=%2218%22 height=%226%22 fill=%22%230057B7%22/%3E%3Crect y=%226%22 width=%2218%22 height=%226%22 fill=%22%23FFD700%22/%3E%3C/svg%3E")}
.flag.fl-ru{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 18 12%22 width=%2218%22 height=%2212%22%3E%3Crect width=%2218%22 height=%224%22 fill=%22%23fff%22/%3E%3Crect y=%224%22 width=%2218%22 height=%224%22 fill=%22%230039A6%22/%3E%3Crect y=%228%22 width=%2218%22 height=%224%22 fill=%22%23D52B1E%22/%3E%3C/svg%3E")}
table.grid.leads .cv[data-type="date"]{padding:0 4px;font-variant-numeric:tabular-nums}

.sent-mark{color:var(--ok);font-weight:600}
/* закріплені колонки: відступ рівно за шириною № та Ім’я (інакше Прізвище налазить на Країну) */
table.grid.leads .sticky-1{left:var(--s1,56px)} table.grid.leads .sticky-2{left:var(--s2,180px)}
/* «На сьогодні», «Завислі», «Видалені» — у рядку із заголовком CRM */
.stage-extra{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.stage-extra .stage-chip{white-space:nowrap}
/* Позначка «в черзі»: місце в черзі і приблизний час */
.q-mark{color:#a15c00;font-weight:600;white-space:nowrap}
/* Воронка від холодного до гарячого: синій → бірюзовий → зелений → жовтий → помаранчевий → червоний */
.heat-cold{--h:#3B7DD8;--hb:#E4EEFB;--hd:#1F4F96}
.heat-no_answer{--h:#3E9BC9;--hb:#E2F2F9;--hd:#1D6488}
.heat-callback{--h:#2FA59A;--hb:#E0F4F1;--hd:#1A6C64}
.heat-info_sent{--h:#7DB33A;--hb:#EEF6E2;--hd:#4C7420}
.heat-thinking{--h:#F0922B;--hb:#FDEEDD;--hd:#9A5410}
.heat-invoice{--h:#D93A30;--hb:#FADFDC;--hd:#8F1F18}
.heat-in_group{--h:#C0262E;--hb:#F8DCDD;--hd:#86161C}
.heat-final_pay{--h:#B8233A;--hb:#F7DBE0;--hd:#801424}
.heat-translation{--h:#B0213F;--hb:#F6DCE2;--hd:#7A1129}
.heat-not_relevant{--h:#9AA4AF;--hb:#EEF0F2;--hd:#5F6977}
.heat-done{--h:#2E8B57;--hb:#E2F3EA;--hd:#1B5E3A}
.heat-mailing{--h:#C2459B;--hb:#F9E6F3;--hd:#842866}
.heat-deleted{--h:#9AA4AF;--hb:#EEF0F2;--hd:#5F6977}
.st-pill[class*="heat-"]{background:var(--hb);color:var(--hd);box-shadow:inset 4px 0 0 var(--h);font-weight:600}
.stage-chip[class*="heat-"]{border-left:4px solid var(--h);background:var(--hb);color:var(--hd)}
.stage-chip[class*="heat-"] b{color:var(--hd)}
.stage-chip[class*="heat-"].on{background:var(--h);border-color:var(--h);color:#fff}
.stage-chip[class*="heat-"].on b{color:#fff}
.wa-pick.wa-no{color:var(--muted)}
/* етапи воронки — однакового розміру */
.stage-bar .stage-chip{flex:1 1 0;min-width:0;justify-content:center;white-space:nowrap}
#crm-add-group{display:block;margin:0 0 8px auto}
#crm-add-group[hidden]{display:none}
.stage-bar .stage-chip.heat-cold{flex-grow:1.8}
@media (min-width:761px){
  .table-head{flex-wrap:nowrap}
  .table-head .stage-extra{flex:1;min-width:0;flex-wrap:nowrap;overflow-x:auto}
  .table-head > .btn,.table-head .stage-extra .stage-chip{flex-shrink:0}
}
@media (max-width:760px){.stage-bar .stage-chip{flex:none;min-width:120px}}
/* «Недозвон 74  1×30 2×25 3×19» — скільки лідів на 1-му, 2-му, 3-му недозвоні */
.stage-bar .stage-chip.heat-no_answer{flex-grow:1.45}   /* на 15% коротша (09.10.2026) */
.stage-bar .stage-chip.cb-chip{flex-grow:1.6}             /* «Передзвонити» з двома цифрами — не налазить на сусідню */
.stage-bar .stage-chip.heat-info_sent,.stage-bar .stage-chip.heat-thinking{flex-grow:1.25}
.na-split{margin-left:6px;padding:1px 7px;border-radius:9px;background:rgba(255,255,255,.7);font-size:12px;font-weight:700;font-variant-numeric:tabular-nums}
.na-split i{font-style:normal;font-weight:500;opacity:.7;margin-right:1px}
.stage-chip.on .na-split{background:rgba(255,255,255,.22)}
@media (min-width:761px) and (max-width:1400px){.stage-bar .stage-arrow{display:none}}   /* вузький екран: місце під назви етапів */
/* таблиця лідів без рядка «Дані / Нагадування / Воронка» — заголовки колонок одразу зверху */
table.grid.leads thead tr.h2 th{top:0}
/* країна — прапорець; телефон — коротко + одна широка кнопка дзвінка */
table.grid.leads td.c-country{text-align:center}
.cflag{display:inline-block;vertical-align:middle;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.12)}
.call-btn.call-wide{width:44px}

/* ═══════════════ телефон (iPhone 17 / 17 Pro Max): нижнє меню, пошук у шапці, великі кнопки ═══════════════
   На комп’ютері нічого з цього не видно: усе нижче — лише для ширини до 760px. */
.tabbar,.m-search-btn{display:none}
.mi{display:inline-block;width:20px;height:20px;background:currentColor;vertical-align:middle;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E") center/contain no-repeat}
.lc-id{color:var(--muted);font-size:12px;font-variant-numeric:tabular-nums;min-width:22px}
.lc-cty{display:inline-flex;align-items:center;gap:5px}
.lc-btn.wa.off{background:#F3F4F6;border-color:var(--line);color:var(--muted);font-weight:500}
.lc-btn .sent-mark{color:inherit}

@media (max-width: 760px){
  html{-webkit-text-size-adjust:100%}
  body{padding-bottom:calc(64px + env(safe-area-inset-bottom))}
  /* шапка: логотип · пошук · користувач; вкладки — у нижньому меню */
  .top{height:calc(52px + env(safe-area-inset-top));padding:env(safe-area-inset-top) max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left));gap:10px}
  .top .nav{display:none}
  .brand span.t{display:inline;font-size:15px}
  .m-search-btn{display:grid;place-items:center;width:40px;height:40px;margin-left:auto;border:0;border-radius:10px;background:#222d41;color:#dce3ec}
  .top-right{margin-left:0}
  .user-btn{width:40px;height:40px}
  .top.searching .brand,.top.searching .top-right{display:none}
  .top.searching .gsearch{display:block;flex:1;margin:0}
  .top.searching .gsearch input{width:100%;height:40px;font-size:16px;border-radius:10px}
  .top.searching .m-search-btn{margin-left:0}
  .top.searching .m-search-btn .mi{-webkit-mask:none;mask:none;background:none;width:auto;height:auto}
  .top.searching .m-search-btn .mi::before{content:"✕";font-style:normal;font-size:16px}
  .gs-res{position:fixed;top:calc(56px + env(safe-area-inset-top));left:8px;right:8px;width:auto;max-height:70vh;overflow-y:auto}
  .gs-res a{padding:12px 14px}
  /* нижнє меню з безпечною зоною під жестову смугу iPhone */
  .tabbar{display:grid;grid-template-columns:repeat(3,1fr);position:fixed;left:0;right:0;bottom:0;z-index:40;
    background:rgba(255,255,255,.94);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);
    border-top:1px solid var(--line);padding:4px max(6px,env(safe-area-inset-left)) env(safe-area-inset-bottom)}
  .tabbar a,.tabbar button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;height:54px;border:0;background:none;
    font:inherit;font-size:11px;font-weight:600;color:#7a8594;text-decoration:none;-webkit-tap-highlight-color:transparent}
  .tabbar .ti{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
  .tabbar .on{color:var(--accent)}
  .m-sheet-back{position:fixed;inset:0;z-index:70;background:rgba(23,33,49,.4);display:flex;align-items:flex-end}
  .m-sheet{width:100%;background:#fff;border-radius:16px 16px 0 0;padding:8px 10px calc(10px + env(safe-area-inset-bottom));display:flex;flex-direction:column}
  .m-sheet a,.m-sheet button{display:block;text-align:left;padding:14px 12px;border:0;background:none;font:inherit;font-size:16px;color:var(--ink);text-decoration:none;border-radius:10px}
  .m-sheet a:active,.m-sheet button:active{background:var(--surface-2)}
  .m-sheet hr{border:0;border-top:1px solid var(--line-2);margin:4px 0}
  .m-sheet .m-sheet-x{text-align:center;color:var(--accent);font-weight:600;margin-top:4px;background:var(--surface-2)}
  #toasts{left:12px;right:12px;bottom:calc(72px + env(safe-area-inset-bottom));align-items:stretch}
  .toast{max-width:none}
  /* сторінка */
  .page{padding:12px max(12px,env(safe-area-inset-left)) 16px max(12px,env(safe-area-inset-right))}
  input,select,textarea{font-size:16px !important}     /* iPhone не збільшує сторінку, коли ставиш курсор у поле */
  .btn{min-height:40px}
  /* CRM: фільтри одним рядком, що гортається; «Новий лід» — кругла кнопка «+» */
  .table-head{flex-wrap:nowrap;gap:8px;margin:0 -12px 8px;padding:0 12px}
  .stage-extra{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;flex:1;min-width:0;-webkit-overflow-scrolling:touch}
  .stage-extra::-webkit-scrollbar,.stage-bar::-webkit-scrollbar{display:none}
  .table-head [data-act="gsync"]{display:none}
  .table-head [data-act="new-lead"]{position:fixed;right:max(16px,env(safe-area-inset-right));bottom:calc(76px + env(safe-area-inset-bottom));z-index:39;
    width:56px;height:56px;border-radius:50%;padding:0;font-size:0;box-shadow:0 6px 20px rgba(14,106,135,.35)}
  .table-head [data-act="new-lead"]::before{content:"+";font-size:30px;line-height:1;font-weight:400}
  .stage-bar{margin:0 -12px 8px;padding:0 12px 4px;scrollbar-width:none}
  .stage-chip{padding:8px 12px;font-size:13.5px}
  #leads .lcards{padding:0}
  .lc{padding:12px;gap:10px;border-radius:14px}
  .lc-name{font-size:16px}
  .lc-acts{display:grid;grid-template-columns:1fr 1fr auto;gap:8px}
  .lc-acts .lc-btn{height:44px;justify-content:center;min-width:0;overflow:hidden}
  .lc-acts .lc-btn span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .lc-acts .lc-btn.call{grid-column:1 / -1}
  .lc-acts .na-btn{height:44px;width:48px;padding:0}
  .page-head{flex-wrap:wrap;gap:8px}
  .page-head h1{flex:1 1 100%;margin-right:0}
  .table-head h1{flex:none}
  .lc-row .st-pill{height:40px;flex:1}
  .lc-note{padding:10px;font-size:14px}
  .remind-done{width:36px;height:36px}
  /* меню вибору (етап, шаблони WhatsApp/Telegram) — знизу на всю ширину */
  .pop-menu.sheet{position:fixed !important;left:0 !important;right:0;top:auto !important;bottom:0;max-height:75vh;overflow-y:auto;z-index:80;
    border-radius:16px 16px 0 0;padding:8px 8px calc(8px + env(safe-area-inset-bottom));box-shadow:0 0 0 100vmax rgba(23,33,49,.4)}
  .pop-back{position:fixed;inset:0;z-index:79;-webkit-tap-highlight-color:transparent}   /* ловить дотик поза меню (crm.js popMenu) */
  .pop-menu.sheet button{min-height:48px;font-size:16px;padding:12px 14px}
  .pop-menu.sheet .pm-x{justify-content:center;color:var(--accent);font-weight:600;background:var(--surface-2);margin-top:6px}
  /* вікна — аркушем знизу, на всю ширину */
  .modal-back{padding:0;place-items:end stretch}
  .modal{max-width:none !important;width:100%;border-radius:16px 16px 0 0;max-height:92dvh;overflow-y:auto;padding-bottom:env(safe-area-inset-bottom)}
  .modal-head{padding:16px 16px 0}
  .modal-body{padding:14px 16px}
  .modal-foot{padding:0 16px 16px;flex-wrap:wrap}
  .modal-foot .btn{flex:1 1 auto;justify-content:center;min-height:46px}
  .wa-ask{left:8px;right:8px;transform:none;bottom:calc(72px + env(safe-area-inset-bottom));max-width:none}
  .wa-ask .btn{flex:1 1 auto;min-height:42px;justify-content:center}
}
/* вкладка «Історія» */
.his-bar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:0 0 12px}
.his-bar input[type=search]{width:240px;height:34px}
.his-list{padding:4px 0}
.his-day{padding:12px 16px 6px;font-weight:700;color:var(--ink-2);font-size:13px;border-top:1px solid var(--line-2)}
.his-day:first-child{border-top:0}
.his-row{display:grid;grid-template-columns:52px minmax(180px,260px) 1fr 120px 250px;gap:12px;align-items:center;padding:7px 16px;border-top:1px solid var(--line-2)}
.his-row:hover{background:#FFFBEA}
.his-time{color:var(--muted);font-variant-numeric:tabular-nums}
.his-lead a{color:var(--ink);font-weight:600;text-decoration:none}
.his-lead a:hover{text-decoration:underline}
.his-what{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
.his-arr{color:var(--muted)}
.st-pill.mini{display:inline-flex;width:auto;height:24px;margin:0;padding:0 10px;font-size:12.5px;border:0;cursor:default}
.his-who{font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media (max-width:760px){
  .his-row{grid-template-columns:44px 1fr;gap:4px 10px;padding:10px 12px}
  .his-what,.his-who,.his-undo{grid-column:2}
  .his-bar input[type=search]{width:100%}
}
.wc-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px}
.his-undo{justify-self:end}
.wc-pick { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line, #ddd); border-radius: 8px; margin: 8px 0; cursor: pointer; }
.wc-pick.off { opacity: .55; cursor: not-allowed; }
.wc-pick input { margin-top: 3px; }
.wc-body { display: block; margin-top: 4px; white-space: pre-wrap; font-size: 13px; }
/* ── більше повітря між лідами і чітке чергування білий / сірий (04.10) ── */
table.grid.leads tbody.ord td{height:46px;border-bottom-color:#E3E8EE}
table.grid.leads tbody.ord tr:first-child td{border-top-color:#E3E8EE}
table.grid.leads tbody.ord.alt td{background:#F1F4F8}
table.grid.leads tbody.ord.alt .cv:hover{background:#E4EAF1}
/* значок сортування: чорний трикутник праворуч від назви, у всіх колонках однаковий */
table.grid.leads thead th .nw{white-space:nowrap}
table.grid.leads thead th .sort-ar{font-size:9px;opacity:.75;margin-left:4px;color:var(--ink);vertical-align:1px}
table.grid.leads thead th.sorted .sort-ar{opacity:1;color:#0E6A87}

.stage-chip.search-on{background:#FFF7E0;border-color:#F0C36D;color:#7A5300}
/* правила першого повідомлення — усередині вікна з текстом (pace.js firstGate) */
.pg-box{background:#FFF7E0;border:1px solid #F0C36D;border-radius:10px;padding:10px 12px;margin:0 0 12px}
.pg-box p{margin:6px 0}
.pg-btns{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}

/* ── Приглушена палітра для всієї CRM (06.10.2026): менше яскравого білого й насичених кольорів — спокійніше для очей.
   Лише кольори: розміри й розташування не змінюються. ── */
:root{--bg:#E7EAEC;--surface:#FAFAF8;--surface-2:#F1F3F3;--ink:#27313C;--ink-2:#4B5562;--muted:#7C8590;--line:#D9DEE1;--line-2:#E5E9EB;
  --accent:#2F6B7D;--accent-hover:#265967;--accent-soft:#E3ECEE;--ok:#3B6E50;--ok-soft:#E3EEE7;--warn:#87602A;--warn-soft:#F4EDDF;
  --info:#4A5E90;--info-soft:#E7EBF3;--bad:#9A4C46;--bad-soft:#F3E7E5;--idle:#8C949E;--idle-soft:#ECEEF0}
table.grid td,.stage-chip,.seg button,.toggle-btn,.lang,.pay,.calc-pill,.na-btn,.note-btn.big,.lc,.lc-btn,.pop-menu,.gs-res,.funnel2,.m-sheet,.wa-ask,.remind-done{background-color:var(--surface)}
.stage-chip.on,.nc{background:var(--accent);border-color:var(--accent)}
table.grid.leads tbody.ord.alt td,table.grid.exams tbody.ord.alt td:not(.ck.on):not(.c-paid.on){background:#EFF1F2}
.heat-cold{--h:#698DBF;--hb:#E9EFF6;--hd:#315284}
.heat-no_answer{--h:#679BB4;--hb:#E7F0F4;--hd:#2D5F78}
.heat-callback{--h:#4D9B94;--hb:#E5F0EE;--hd:#26605A}
.heat-info_sent{--h:#85A75A;--hb:#EDF2E6;--hd:#4B672D}
.heat-thinking{--h:#CD9A62;--hb:#F6EEE4;--hd:#855425}
.heat-invoice{--h:#BD6660;--hb:#F3E4E3;--hd:#7D2F2A}
.heat-in_group{--h:#AF4B50;--hb:#F2E2E3;--hd:#75272B}
.heat-final_pay{--h:#A94653;--hb:#F1E2E4;--hd:#70232E}
.heat-translation{--h:#A24457;--hb:#F0E2E5;--hd:#6A2132}
.heat-done{--h:#5C9C78;--hb:#E6F1EA;--hd:#2F5F43}
.heat-mailing{--h:#B06B9B;--hb:#F5EAF1;--hd:#763661}
.heat-not_relevant,.heat-deleted{--h:#9CA3AA;--hb:#EEF0F1;--hd:#5F6873}
.stage-chip .ico-wa{color:#2E9E5B;margin-right:2px}.stage-chip.on .ico-wa{color:#fff}

.ad-src{padding:7px 0;font-weight:600;overflow-wrap:anywhere}

/* «Відповіли в WhatsApp»: клієнт написав, ми ще не відповіли (08.10.2026) */
.stage-chip.wa-hot{background:#E3F4EA;border-color:#9FD3B2;color:#1E6B3D}
.stage-chip[data-stage="replied"] .ico-wa{color:#2E9E5B}
.wa-new{display:inline-flex;align-items:center;gap:4px;margin:0 6px 0 0;padding:1px 7px;border:1px solid #9FD3B2;border-radius:10px;
  background:#E3F4EA;color:#1E6B3D;font-size:12px;line-height:18px;cursor:pointer;white-space:nowrap}
.wa-new b{font-weight:600}
.wa-new:hover{background:#CDEBD9}
.c-wa.has-new{white-space:nowrap}
.lc-acts .wa-new{margin:0}

/* підрозділ «📵 передзвонити» в кнопці позитивного етапу (09.10.2026) */
.stage-chip .nr-sub{display:inline-block;margin-left:4px;padding:0 6px;border-radius:9px;background:rgba(0,0,0,.07);font-size:12px;line-height:18px;cursor:pointer}
.stage-chip .nr-sub:hover{background:rgba(0,0,0,.14)}
.stage-chip .nr-sub.on{background:#C9472F;color:#fff}

/* 📵 біля дзвінка в таблиці і «🔁 повторна заявка» (09.10.2026) */
.reapp{display:inline-block;margin-right:4px;font-size:13px;cursor:help}
table.grid.leads td.c-lastcall.na{background-color:#FBE6E1 !important}
td.c-lastcall.na .cv{color:#9E3B22}
td.c-lastcall .lc-na{margin-right:4px;font-size:12px;font-weight:600;color:#9E3B22;white-space:nowrap}
td.c-lastcall .lc-row{display:flex;align-items:center;gap:4px;white-space:nowrap}
td.c-lastcall .lc-row .cv{flex:1;min-width:0}
td.c-lastcall .lc-row .na-btn{height:24px;padding:0 5px;font-size:12px;white-space:nowrap;flex:none}
.stage-chip.cb-chip .cb-part{display:inline-block;min-width:22px;padding:0 6px;border-radius:9px;background:rgba(255,255,255,.7);text-align:center;cursor:pointer}
.stage-chip.cb-chip .cb-part.on{background:#fff;color:var(--hd);box-shadow:0 0 0 2px var(--hd)}
.stage-chip.cb-chip .cb-sep{margin:0 3px;opacity:.6}
.stage-chip.cb-chip.on .cb-part:not(.on){background:rgba(255,255,255,.25)}
table.grid.leads td.c-wa.has-new{background-color:#E3F4E9 !important}
td.c-wa.has-new .wa-new{padding:1px 6px;margin-right:4px}
.ex-view{display:flex;align-items:center;gap:8px;margin:0 0 8px;padding:6px 10px;border-radius:8px;background:#EEF4FB;color:#1F4F96;font-size:14px}
.ex-view b{font-weight:700}
.ex-view button{margin-left:auto}
td.c-wa{white-space:nowrap}
td.c-wa .wa-pick{white-space:nowrap}
table.grid.leads td.c-wa.has-new .wa-pick{background:transparent}
.ws-tot{display:flex;flex-wrap:wrap;gap:8px 18px;margin:4px 0 10px;font-size:14px}
.ws-tot b{font-size:16px}
.ws-table tr.ws-row{cursor:pointer}
.ws-table tr.ws-row:hover td,.ws-table tr.ws-row.on td{background:#EEF4FB}
.ws-table tr.ws-detail>td{background:#F8FAFC;padding:8px 10px 12px}
.ws-vis td.ws-com{max-width:260px;white-space:pre-wrap;word-break:break-word}
.ws-acts{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:6px}
.ws-set{margin-top:14px}
.ws-set .ws-token{max-width:520px}
.ws-auto{margin-top:8px}

/* Передоплата в CRM: спільні елементи з «Іспитами», етап завжди останній. */
#leads table.grid.leads thead tr.h1 th{top:0;height:28px;background:#E7ECF1}
#leads table.grid.leads thead tr.h2 th{top:28px}
#leads table.grid.leads td.c-crmpre{padding:0 4px}
#leads table.grid.leads td.c-crmvat{padding:0}
#leads table.grid.leads td.c-paid{text-align:center}
#leads table.grid.leads tbody.ord td.c-paid.on{background:var(--ok-soft)!important}
.crm-pay-order{width:100%;border:0;background:transparent;font:inherit;font-size:11px;color:var(--muted);height:22px}

/* Платіжні колонки тільки у розділі «Передоплата». */
#leads table.grid.leads:not(.has-prepayment) thead tr.h2 th{top:0}
#leads .wa-standard{width:calc(100% - 8px);margin:3px 4px;border-radius:6px;background:#E7F7EE;color:#128C7E;gap:5px;font-weight:600}
#leads .wa-standard:hover{background:#D7F1E2}
#leads .wa-standard .caret{margin-left:auto}
#leads .wa-standard:disabled{background:#F1F4F7;color:#9CA7B2}
#leads .wa-standard.wa-no{background:#F1F4F7;color:#7B8794}

/* Коментарі: шаблони WhatsApp, ручні записи та важливі записи. */
.notes-list .note-item { padding:10px 12px; margin:8px 0; border-radius:6px; }
.notes-list .note-whatsapp_sent { background:#e5f5e7; }
.notes-list .note-manual { background:#fff7d6; }
.notes-list .note-manual.note-important { background:#ffe3e3; }
.notes-list .note-important-btn { margin-left:8px; }
.notes-list .note-important-btn[aria-pressed="true"] { color:#9e3030; font-weight:600; }

.stage-lost-icon{width:21px;height:21px;display:inline-block;vertical-align:middle;color:#b47832;flex-shrink:0}
#leads .c-group-paid .group-paid-amount{display:block;padding:4px 8px;font-weight:600;color:var(--text)}
#leads .ck .tick{display:inline-flex;align-items:center;justify-content:center;min-height:28px}

#leads table.grid.leads .callback-month-row td{text-align:center!important;height:22px;padding:2px 10px;background:#e8edf2!important;border-top:1px solid #cbd5df;border-bottom:1px solid #d6dee6;color:#546674;font-size:11px;font-weight:600;text-transform:capitalize}
.callback-month-card{text-align:center;padding:3px 8px;margin:8px 0 4px;background:#e8edf2;border-top:1px solid #cbd5df;border-radius:3px;color:#546674;font-size:11px;font-weight:600;text-transform:capitalize}

#leads .crm-date-row td,.crm-empty-group{background:#dfe8ef!important;border-top:1px solid #bdcdd9;border-bottom:1px solid #cbd7e0;padding:7px 10px;color:#334b5d;font-weight:600}
.crm-empty-group{margin-top:8px;border-radius:5px}.crm-empty-group small{display:block;font-weight:400;color:#657786;margin-top:4px}

#leads .c-final-total,#leads .c-final-due{padding:5px 8px}#leads .c-final-due small{display:block;font-size:10px;color:var(--muted);margin-top:3px}

/* нові заявки (холодний лід): завжди нагорі, горизонтальна смуга і повністю блакитна заливка (13.10.2026) */
#leads table.grid.leads .new-leads-row td{text-align:center!important;height:24px;padding:3px 10px;background:#5B9BD5!important;border-top:1px solid #3F82BF;border-bottom:1px solid #3F82BF;color:#fff;font-size:12px;font-weight:700;letter-spacing:.3px}
table.grid.leads tbody.ord.is-new td:not(.has-new){background:#DCEBFA!important}
table.grid.leads tbody.ord.is-new .cv:hover{background:#C9DFF5}
.new-leads-card{text-align:center;padding:4px 8px;margin:8px 0 4px;background:#5B9BD5;border-radius:3px;color:#fff;font-size:12px;font-weight:700}
.lc.is-new{background:#DCEBFA}
