/* Спектр CRM — стили каркаса приложения поверх дизайн-системы. Только токены из tokens.css. */
html, body { margin: 0; background: var(--bg-page); color: var(--ink); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
*, *::before, *::after { box-sizing: border-box; }
a { color: var(--brand-ink); }
/* Ссылка в виде кнопки дизайн-системы — без подчёркивания ссылки */
a.sp-btn, a.sp-btn:hover { text-decoration: none; }
.crm-boot, .crm-loading { display: flex; align-items: center; justify-content: center; gap: var(--space-3); min-height: 50vh; color: var(--ink-subtle); font-size: var(--text-body); }

.crm-kicker { font-size: var(--text-caption); font-weight: 600; color: var(--ink-subtle); letter-spacing: .04em; text-transform: uppercase; }
.crm-head-aside { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.crm-muted { color: var(--ink-muted); font-size: var(--text-compact); }
.crm-strong { font-weight: 600; color: var(--ink); text-decoration: none; }
.crm-strong:hover { color: var(--brand-ink); }
.crm-mono { font-family: var(--font-mono); font-size: var(--text-compact); }
.crm-nowrap { white-space: nowrap; }
.crm-click { cursor: pointer; }
.crm-click:hover td { background: var(--bg-hover); }

.crm-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; justify-content: space-between; }
.crm-stack { display: grid; gap: var(--space-4); }
.crm-toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; justify-content: space-between; }
.crm-tabs { margin-bottom: var(--space-1); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.crm-tabs::-webkit-scrollbar { display: none; }
.crm-tabs button { flex: none; white-space: nowrap; }
/* Элемент сетки страницы не растягивает её шире экрана: широкое содержимое листается внутри себя */
.sp-ws-inner > *, .sp-sv-page > * { min-width: 0; }

/* Верхняя панель (CRM): пункты меню ТП и СВ не помещаются рядом с полем поиска уже на ~1180 px —
   поле сворачивается в кнопку поиска раньше, чем в дизайн-системе (900 px), и профиль не уходит за край */
@container spnav (max-width: 1180px) {
  .sp-search { display: none; }
  .sp-ghost.sp-search-icononly { display: inline-flex; padding: 0 10px; }
}
/* …и по месту: ядро (fitNav в core/app.js) меряет панель — пунктов у СВ / РОП больше, и порога ширины не хватает */
.crm-nav-tight .sp-search { display: none; }
.crm-nav-tight .sp-ghost.sp-search-icononly { display: inline-flex; padding: 0 10px; }
.crm-nav-tighter .sp-user-text, .crm-nav-tighter .sp-ghost-label, .crm-nav-tighter .sp-brand-sep, .crm-nav-tighter .sp-brand-product { display: none; }
.crm-nav-tighter .sp-sync { padding: 0 4px; }
.crm-nav-tightest .sp-nav-row .sp-tab:not([aria-current]) .sp-tab-label { display: none; }
.crm-nav-tightest .sp-nav-row .sp-tab:not([aria-current]) { padding-left: 10px; padding-right: 10px; }

/* Таблица «Дисциплина» (DisciplineCard) на узком экране листается внутри карточки */
@media (max-width: 720px) { .sp-dc-t { display: block; overflow-x: auto; } }
.crm-grid2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-4); align-items: start; }
.crm-split { display: grid; grid-template-columns: minmax(320px, 5fr) minmax(0, 7fr); gap: var(--space-4); align-items: start; }
@media (max-width: 960px) { .crm-grid2, .crm-split { grid-template-columns: 1fr; } }

.crm-search { max-width: 420px; flex: 1 1 260px; }
.crm-input { height: var(--control-height); padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--ink); font: 400 var(--text-body)/20px var(--font-sans); min-width: 0; width: 100%; }
textarea.crm-input { height: auto; padding: var(--space-2) var(--space-3); resize: vertical; }
.crm-input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.crm-form { display: grid; gap: var(--space-3); padding: var(--space-3); background: var(--bg-sunken); border-radius: var(--radius-lg); }
.crm-form-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.crm-form-row > .crm-row { grid-column: 1 / -1; justify-content: flex-start; }
.crm-field { display: grid; gap: 4px; font-size: var(--text-caption); font-weight: 600; color: var(--ink-muted); }
.crm-row .crm-input { flex: 1 1 220px; width: auto; }
/* Поле внутри подписи (столбец «подпись над полем») не тянется: иначе 220 px основы становятся высотой */
.crm-row label > .crm-input { flex: none; width: 100%; }

.crm-empty { display: grid; justify-items: center; gap: var(--space-2); padding: 48px var(--space-4); text-align: center; background: var(--bg-surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-xl); color: var(--ink-muted); font-size: var(--text-body); }
.crm-empty b { color: var(--ink); font-size: var(--text-section); }

.crm-table { width: 100%; border-collapse: collapse; font-size: var(--text-body); }
.crm-table td, .crm-table th { padding: var(--space-2) var(--space-3); border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
.crm-table tr:first-child td { border-top: 0; }
.crm-dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); margin: 0; font-size: var(--text-body); }
.crm-dl dt { color: var(--ink-subtle); }
.crm-dl dd { margin: 0; }
.crm-list { list-style: none; margin: 0; padding: 0; display: grid; }
.crm-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.crm-list li:first-child { border-top: 0; }
.crm-list li > div { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-2); }
.crm-list small { flex-basis: 100%; color: var(--ink-subtle); font-size: var(--text-caption); }

/* Визиты */
.crm-visits { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.crm-visit { display: grid; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.crm-visit.is-done { background: var(--bg-sunken); border-color: transparent; }
.crm-visit-main { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-3); align-items: center; }
.crm-visit-main small { display: block; color: var(--ink-subtle); font-size: var(--text-caption); margin-top: 2px; }
.crm-visit-rep { display: grid; justify-items: end; gap: 2px; }
.crm-visit-rep small { color: var(--ink-subtle); font-size: var(--text-caption); }

/* Чат ИИ */
.crm-chat { display: grid; gap: var(--space-4); background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: var(--space-5); }
.crm-chat ol { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.crm-chat li { display: flex; gap: var(--space-2); align-items: flex-start; max-width: 85%; }
.crm-chat li > div { background: var(--brand-soft); border-radius: var(--radius-lg); padding: var(--space-2) var(--space-3); }
.crm-chat li.is-me { margin-left: auto; }
.crm-chat li.is-me > div { background: var(--bg-sunken); }
.crm-chat p { margin: 0; font-size: var(--text-body); line-height: 20px; }
.crm-chat time { display: block; margin-top: 4px; font-size: var(--text-caption); color: var(--ink-subtle); }
.crm-chat form { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2); align-items: end; }

.crm-bullets { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: var(--text-compact); color: var(--ink-muted); }
.crm-check { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-body); }
.crm-price { padding: var(--space-6); }
.crm-price.is-embedded { padding: 0; background: none; }
@media (max-width: 900px) { .crm-price { grid-template-columns: 1fr; padding: var(--space-4); } }
.crm-price-client { padding: var(--space-3); }
.crm-vplan td, .crm-vplan th { white-space: nowrap; }

/* Модальное окно, шторка, уведомление */
.crm-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(20, 22, 28, .36); display: flex; align-items: center; justify-content: center; padding: var(--space-4); }
.crm-overlay.is-drawer { justify-content: flex-end; padding: 0; }
.crm-drawer { height: 100%; width: min(760px, 100%); display: flex; }
.crm-modal { width: min(520px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: var(--bg-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-pop); }
.crm-modal.is-wide { width: min(760px, 100%); }
.crm-modal header, .crm-modal footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); }
.crm-modal header { border-bottom: 1px solid var(--line); }
.crm-modal footer { border-top: 1px solid var(--line); justify-content: flex-end; }
.crm-modal h2 { margin: 0; font-size: var(--text-section); font-weight: var(--weight-semibold); }
.crm-modal-body { padding: var(--space-4) var(--space-5); overflow: auto; display: grid; gap: var(--space-3); }
/* Открытый список или календарь не должен обрезаться прокруткой окна */
.crm-modal-body:has(.sp-dd.is-open) { overflow: visible; }
.crm-grow { flex: 1; min-width: 0; }
.crm-toast { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: var(--space-2); padding: 10px var(--space-4); border-radius: var(--radius-pill); background: var(--ink); color: var(--bg-surface); font-size: var(--text-body); box-shadow: var(--shadow-pop); }
.crm-toast.is-bad { background: var(--danger); color: #fff; }
.crm-toast .sp-icon { width: 16px; height: 16px; }

/* Вход и экран «Нет данных из 1С» — brand/brand.css (.spk-login) */

/* Главная ТП — раскладка из дизайн-системы (sp-ws-goal, sp-stats-row, sp-ws-tasks, sp-ws-aside) */
/* Плитка-ссылка (место в филиале → рейтинг) */
.crm-tile-link { display: block; min-width: 0; color: inherit; text-decoration: none; border-radius: var(--radius-xl); }
.crm-tile-link > .sp-stat { height: 100%; transition: border-color .12s, box-shadow .12s; }
.crm-tile-link:hover > .sp-stat { border-color: var(--line-strong); box-shadow: var(--shadow-item); }
.crm-tile-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Задачи выбранного в календаре дня (не сегодня): без своей прокрутки, как «Задачи на сегодня» */
.crm-daytasks .sp-close-row { margin: 0; }
.crm-error { font-size: var(--text-compact); line-height: 18px; color: var(--danger); }

/* Главная ТП: строка-сводка показателей над работой дня; «Подробнее» раскрывает плитки */
.crm-sum { display: flex; flex-direction: column; gap: var(--space-3); }
.crm-sum-row { display: flex; align-items: center; gap: 8px 22px; flex-wrap: wrap; min-height: 48px; padding: 6px 8px 6px 16px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--bg-surface); font-family: var(--font-sans); }
.crm-sum-i { display: inline-flex; align-items: baseline; gap: 6px; font-size: var(--text-compact); line-height: 18px; color: var(--ink-muted); white-space: nowrap; }
.crm-sum-i b { font-size: var(--text-section); font-weight: var(--weight-semibold); color: var(--ink); font-variant-numeric: tabular-nums; }
.crm-sum-i small { font-size: var(--text-caption); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.crm-sum-i.is-warn b { color: var(--warning); }
/* пункт сводки — ссылка (вход в журнал звонков у ТП): как текст, подчёркивание числа при наведении */
a.crm-sum-i.is-link { text-decoration: none; border-radius: var(--radius-sm); }
a.crm-sum-i.is-link:hover b { color: var(--brand-ink); text-decoration: underline; }
a.crm-sum-i.is-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.crm-sum-bar { align-self: center; width: 72px; height: 6px; border-radius: var(--radius-pill); background: var(--bg-sunken); overflow: hidden; }
.crm-sum-bar i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.crm-sum-more { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--brand-ink); font: 600 var(--text-compact)/18px var(--font-sans); cursor: pointer; }
.crm-sum-more:hover { background: var(--brand-soft); }
.crm-sum-more:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.crm-sum-more .sp-icon { width: 14px; height: 14px; }
@container spws (max-width: 720px) {
  .crm-sum-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; padding: 10px 12px; }
  .crm-sum-i { flex-wrap: wrap; white-space: normal; }
  .crm-sum-more { grid-column: 1 / -1; justify-content: center; min-height: 44px; margin: 0; }
}

/* «План» — календарь задач (макет «Календарь задач ТП», 31.10): панель, слева мини-месяц/подсказки/«Штурман», справа сетка */
.crm-cal { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.crm-cal-sp { flex: 1; } /* распорка в строках управления (модуль calls) */
.crm-cal-hint { font-size: var(--text-caption); color: var(--ink-subtle); }
.crm-seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--bg-sunken); border-radius: var(--radius-md); }
.crm-seg > button { height: 32px; min-width: 64px; padding: 0 14px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-muted); font: 500 var(--text-compact)/18px var(--font-sans); cursor: pointer; }
.crm-seg > button:hover { color: var(--ink); }
.crm-seg > button.is-on { background: var(--bg-surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-item); }
.crm-seg > button.is-on.is-deal { color: var(--success); }
.crm-seg > button.is-on.is-fail { color: var(--danger); }
.crm-seg > button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.crm-cal-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-4); }
.crm-cal-aside { flex: 0 0 260px; display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.crm-cal-aside > .sp-card { height: auto; padding: var(--space-3) var(--space-4); gap: var(--space-2); }
.crm-cal-main { flex: 999 1 560px; min-width: 0; }

/* мини-месяц (будни) */
.crm-mini-h { display: flex; align-items: center; justify-content: space-between; }
.crm-mini-h h2, .crm-hints-h h2 { margin: 0; font-size: var(--text-body); line-height: 20px; font-weight: 600; color: var(--ink); }
.crm-mini-h .sp-iconbtn { width: 28px; height: 28px; }
.crm-mini-g { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.crm-mini-dow { font-size: var(--text-caption); line-height: 18px; font-weight: 600; text-align: center; color: var(--ink-subtle); }
.crm-mini-d { height: 40px; padding: 3px 0 0; border: 0; border-radius: var(--radius-sm); background: transparent; display: flex; flex-direction: column; align-items: center; gap: 1px; font: inherit; color: var(--ink); cursor: pointer; }
.crm-mini-d.is-field { background: var(--field-soft); }
.crm-mini-d.is-field .crm-mini-n { font-weight: 700; }
.crm-mini-d.is-office { background: var(--office-soft); }
.crm-mini-d.is-out { opacity: .45; }
.crm-mini-d.is-past { opacity: .62; }
.crm-mini-d.is-late { box-shadow: inset 0 0 0 1.5px var(--danger); }
.crm-mini-d.is-sel { box-shadow: inset 0 0 0 2px var(--brand); opacity: 1; }
.crm-mini-d:hover { filter: brightness(.97); }
.crm-mini-d:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.crm-mini-n { width: 20px; height: 20px; border-radius: var(--radius-pill); display: flex; align-items: center; justify-content: center; font-size: var(--text-caption); line-height: 16px; font-variant-numeric: tabular-nums; }
.crm-mini-n.is-today { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.crm-mini-d small { min-width: 14px; padding: 0 3px; border-radius: var(--radius-pill); font-size: var(--text-caption); line-height: 13px; font-weight: 700; color: var(--field-ink); }
.crm-mini-d small.is-ok { color: var(--success); }
.crm-mini-d small.is-call { color: var(--brand-ink); }
.crm-mini-d.is-late small { background: var(--danger); color: #fff; }
.crm-mini-day { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); font-size: var(--text-compact); line-height: 18px; }
.crm-mini-day b { font-weight: 600; }
.crm-mini-day > div > span { color: var(--ink-muted); }
.crm-mini-btn { align-self: flex-start; min-height: 28px; padding: 4px 10px; border: 0; border-radius: var(--radius-sm); background: var(--field-soft); color: var(--field-ink); font: 600 var(--text-compact)/18px var(--font-sans); text-align: left; cursor: pointer; }
.crm-mini-btn.is-late { background: var(--danger); color: #fff; }
.crm-mini-btn.is-brand { background: var(--brand-soft); color: var(--brand-ink); font-size: var(--text-caption); line-height: 16px; }
.crm-mini-btn:hover { filter: brightness(.96); }
.crm-mini-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* подсказки ИИ */
.crm-hints-h { display: flex; align-items: center; gap: 8px; }
.crm-hints-h h2 { color: var(--brand-ink); font-size: var(--text-compact); }
.crm-hint { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); margin: 0; }
.crm-hint p { margin: 0; font-size: var(--text-compact); line-height: 18px; color: var(--ink); }
.crm-hint b { font-weight: 600; }
.crm-hint b.is-late { color: var(--danger); }
.crm-hint b.is-warn { color: var(--warning); }
.crm-hint b.is-ok { color: var(--success); }
/* чек-лист «Готовы к полю?» */
.crm-prep { display: flex; flex-direction: column; margin-bottom: var(--space-4); }
.crm-prep-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.crm-prep-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: var(--text-body); line-height: 20px; }
.crm-prep-row > div a { color: var(--ink); text-decoration: none; }
.crm-prep-row > div a:hover { text-decoration: underline; }
.crm-prep-row small { font-size: var(--text-caption); line-height: 16px; }
.crm-prep-sum { margin-right: auto; font-size: var(--text-compact); color: var(--ink-muted); }
.crm-prep-sum.is-ok { color: var(--success); font-weight: 600; }
/* «Штурман» в левой колонке — компактно; в узкой колонке бейдж карточки — строкой под заголовком, не за край */
.crm-cal-aside .sp-card-head { flex-wrap: wrap; row-gap: 6px; min-width: 0; }
.crm-cal-aside .sp-card-title { flex: 1 1 0; min-width: 0; }
.crm-cal-aside .sp-card-aside { flex: 1 1 100%; min-width: 0; margin-left: 0; display: flex; }
.crm-cal-aside .sp-card-aside .sp-tagx { max-width: 100%; white-space: normal; }
.crm-cal-aside .cb .cb-xp { max-width: none; }
.crm-cal-aside .cb .cb-tip { font-size: var(--text-caption); line-height: 17px; padding: 6px 10px; }
.crm-cal-aside .cb .cb-quests li { flex-wrap: wrap; row-gap: 4px; padding: 8px 0; }
.crm-cal-aside .cb .cb-quests li > span:first-child { flex-basis: 100%; }
.crm-cal-aside .cb .cb-quests .cb-gain { min-width: 0; text-align: left; }
.crm-cal-aside .cb .cb-quests .sp-btn { margin-left: auto; }

/* сетка по времени и месяц */
.crm-cal-grid { background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); overflow-x: auto; }
.crm-cal-in { min-width: 720px; }
.crm-cal-row { display: grid; }
.crm-cal-heads, .crm-cal-all { border-bottom: 1px solid var(--line); }
.crm-cal-head { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; padding: 6px 8px; border-left: 1px solid var(--line); }
.crm-cal-head.is-left { justify-content: flex-start; }
.crm-cal-dn { flex: none; display: flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 2px; border: 0; background: transparent; border-radius: var(--radius-pill); font: inherit; cursor: pointer; }
.crm-cal-dn:hover { background: var(--bg-hover); }
.crm-cal-num { width: 26px; height: 26px; border: 0; padding: 0; border-radius: var(--radius-pill); background: transparent; display: flex; align-items: center; justify-content: center; font: 650 var(--text-body)/1 var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink); cursor: pointer; }
.crm-cal-num.is-past { color: var(--ink-subtle); }
.crm-cal-num.is-today { background: var(--brand); color: var(--on-brand); }
.crm-cal-dow { font-size: var(--text-caption); line-height: 16px; font-weight: 600; color: var(--ink-subtle); }
.crm-cal-dow.is-today { color: var(--brand-ink); }
.crm-cal-tag { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; border-radius: var(--radius-pill); font-size: var(--text-caption); line-height: 18px; font-weight: 600; color: var(--ink-subtle); }
.crm-cal-tag.is-field { background: var(--field-soft); color: var(--field-ink); }
.crm-cal-tag.is-office { background: var(--office-soft); color: var(--office-ink); }
.crm-cal-tag.is-late { background: var(--danger-soft); color: var(--danger); }
/* тип дня можно сменить — значок-кнопка; ✎ — день переведён ТП с комментарием */
.crm-cal-tag.is-btn { border: 0; font-family: var(--font-sans); cursor: pointer; }
.crm-cal-tag.is-btn:hover { box-shadow: inset 0 0 0 1px currentColor; }
.crm-cal-tag.is-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.crm-cal-band .crm-cal-tag { margin-left: auto; background: transparent; padding: 0 4px; }
.crm-cal-band .crm-cal-tag.is-btn:hover { background: var(--bg-surface); box-shadow: none; }
.crm-cal-allh { padding: 6px 8px 0 0; font-size: var(--text-caption); line-height: 14px; color: var(--ink-subtle); text-align: right; }
.crm-cal-allc { min-height: 40px; padding: 4px; display: flex; flex-direction: column; gap: 3px; border-left: 1px solid var(--line); min-width: 0; }
.crm-cal-allc.is-over, .crm-cal-mcell.is-over { background: var(--brand-soft); }
.crm-cal-hours { position: relative; }
.crm-cal-hours span { position: absolute; right: 8px; font-size: var(--text-caption); line-height: 14px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.crm-cal-col { position: relative; border-left: 1px solid var(--line); min-width: 0; }
/* слот — 10 минут (10 px); линии: час — сплошная, полчаса — пунктир; время подсказкой у слота под курсором */
.crm-cal-slot { position: relative; height: 12px; border-top: 1px solid transparent; }
.crm-cal-slot.is-half { border-top: 1px dashed var(--line); }
.crm-cal-slot-t { position: absolute; left: 4px; top: -9px; z-index: 3; padding: 0 5px; border-radius: var(--radius-sm); background: var(--brand); color: var(--on-brand); font: 600 var(--text-caption)/16px var(--font-sans); font-variant-numeric: tabular-nums; pointer-events: none; }
.crm-cal-slot.is-hour { border-top-color: var(--line); }
.crm-cal-slot.is-over { background: var(--brand-soft); }
.crm-cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); pointer-events: none; z-index: 2; }
.crm-cal-now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.crm-cal-mrow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.crm-cal-mrow:last-child { border-bottom: 0; }
.crm-cal-mhead > div { padding: 8px 10px; font-size: var(--text-caption); line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-subtle); }
.crm-cal-mrow > div + div { border-left: 1px solid var(--line); }
.crm-cal-mcell { height: 124px; padding: 4px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; min-width: 0; }
.crm-cal-mcell.is-out { background: var(--bg-page); opacity: .75; }
.crm-cal-band { display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 2px; border-radius: var(--radius-sm); font-size: var(--text-caption); line-height: 16px; font-weight: 600; }
.crm-cal-band > span { margin-left: auto; }
.crm-cal-band.is-field { background: var(--field-soft); color: var(--field-ink); }
.crm-cal-band.is-office { background: var(--office-soft); color: var(--office-ink); }
.crm-cal-band.is-late { background: var(--danger-soft); color: var(--danger); }
.crm-cal-band .crm-cal-num { width: 24px; height: 24px; font-size: var(--text-compact); font-weight: 600; }
.crm-cal-more { flex: none; align-self: flex-start; height: 20px; padding: 0 6px; border: 0; background: transparent; border-radius: var(--radius-sm); font: 600 var(--text-caption)/16px var(--font-sans); color: var(--ink-muted); cursor: pointer; }

/* фишка задачи */
.crm-ev { flex: none; display: flex; flex-direction: column; justify-content: center; gap: 1px; width: 100%; min-width: 0; min-height: 24px; padding: 3px 6px; border: 1px solid var(--brand-line); border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-ink); font: 650 var(--text-caption)/15px var(--font-sans); text-align: left; cursor: pointer; overflow: hidden; }
.crm-ev.is-block { position: absolute; justify-content: flex-start; padding: 2px 6px; z-index: 1; }
.crm-ev.is-m { padding: 2px 6px; }
.crm-ev-l { display: flex; align-items: center; gap: 4px; min-width: 0; width: 100%; }
.crm-ev .sp-icon { flex: none; width: 12px; height: 12px; }
.crm-ev-t { flex: none; font-weight: 500; font-variant-numeric: tabular-nums; }
.crm-ev-c { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* сумма задач клиента — справа в первой строке; вторая строка — группа и время/статус */
.crm-ev-sum { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.crm-ev.is-done .crm-ev-sum { opacity: .8; }
.crm-ev-2 { display: flex; align-items: center; gap: 6px; min-width: 0; width: 100%; font: 500 var(--text-caption)/16px var(--font-sans); }
.crm-ev-g { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-ev-meta { flex: none; opacity: .8; font-variant-numeric: tabular-nums; }
.crm-ev-s { font: 400 var(--text-caption)/16px var(--font-sans); opacity: .85; }
.crm-ev-s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.crm-ev.is-visit { background: var(--field-soft); color: var(--field-ink); border-color: transparent; }
.crm-ev.is-deal { background: var(--success-soft); color: var(--success); border-color: transparent; }
.crm-ev.is-late { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.crm-ev.is-done, .crm-ev.is-fail { background: var(--bg-sunken); color: var(--ink-subtle); border-color: transparent; }
.crm-ev.is-fail .crm-ev-c { text-decoration: line-through; }
.crm-ev[draggable="true"] { cursor: grab; }
.crm-ev:hover { filter: brightness(.97); }
.crm-ev:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.crm-ev.is-drag { opacity: .45; }
.crm-ev.is-grab { cursor: grab; touch-action: auto; }
/* Плавный перенос в «День» / «Неделя»: призрак едет за указателем с шагом 5 минут */
.crm-ev.is-ghost { z-index: 4; pointer-events: none; box-shadow: var(--shadow-pop); outline: 2px solid var(--brand); outline-offset: -1px; transition: top .12s cubic-bezier(.2, .8, .2, 1), height .12s ease-out; }
.crm-cal-ghost-t { transition: top .12s cubic-bezier(.2, .8, .2, 1); }
body.crm-grabbing, body.crm-grabbing * { cursor: grabbing !important; user-select: none; }
/* Ручки растягивания фишки: верхний край — начало, нижний — конец; полоска видна при наведении */
.crm-ev-rz { position: absolute; left: 0; right: 0; height: 7px; z-index: 2; cursor: ns-resize; }
.crm-ev-rz.is-top { top: -1px; }
.crm-ev-rz.is-bot { bottom: -1px; }
.crm-ev-rz::after { content: ''; position: absolute; left: 50%; width: 24px; height: 3px; margin-left: -12px; border-radius: var(--radius-pill); background: currentColor; opacity: 0; transition: opacity .12s; }
.crm-ev-rz.is-top::after { top: 2px; }
.crm-ev-rz.is-bot::after { bottom: 2px; }
.crm-ev.is-block:hover .crm-ev-rz::after { opacity: .45; }
.crm-ev-rz:hover::after { opacity: .9 !important; }
@media (prefers-reduced-motion: reduce) { .crm-ev.is-ghost, .crm-cal-ghost-t { transition: none; } }
.crm-ev.is-passive { pointer-events: none; }

/* окно задачи */
.crm-td { display: flex; flex-direction: column; gap: var(--space-4); }
.crm-td-meta { display: flex; align-items: flex-start; gap: 12px; }
.crm-td-meta > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--text-compact); line-height: 18px; }
/* статус — сразу за датой, а не у правого края рядом с «Карточкой клиента» */
.crm-td-meta .crm-row { justify-content: flex-start; gap: 8px; }
.crm-td-meta > .sp-btn { flex: none; }
.crm-td-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
/* «С кем говорим» — во всю ширину над «Когда» и «Осталось»: лица клиента кнопками, под ними телефон выбранного */
.crm-td-who { grid-column: 1 / -1; gap: 8px; }
.crm-td-people { display: flex; flex-wrap: wrap; gap: 6px; }
.crm-td-person { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: 120px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.crm-td-person b { font-size: var(--text-compact); line-height: 18px; font-weight: 600; }
.crm-td-person small { font-size: var(--text-caption); line-height: 16px; color: var(--ink-subtle); }
.crm-td-person:hover { border-color: var(--brand); }
.crm-td-person.is-on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.crm-td-person:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.crm-td-lpr { position: absolute; top: 4px; right: 6px; padding: 0 4px; border-radius: var(--radius-sm); background: var(--bg-sunken); color: var(--ink-muted); font-size: var(--text-caption); line-height: 14px; font-weight: 700; }
.crm-td-person:has(.crm-td-lpr) { padding-right: 38px; }
.crm-td-people.is-all { max-height: 232px; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.crm-td-more { justify-content: center; border-style: dashed; color: var(--brand-ink); }
.crm-td-more small { color: var(--ink-subtle); }
.crm-td-find { height: 36px; }
.crm-td-when { gap: 12px; color: var(--ink); }
.crm-td-when .crm-td-move { margin: 0; padding: 0; }
.crm-td-hsum { font-weight: 500; color: var(--ink-subtle); }
.crm-td-dial { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-width: 0; }
.crm-td-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); font-size: var(--text-compact); line-height: 18px; min-width: 0; }
.crm-td-tile small { font-size: var(--text-caption); line-height: 16px; font-weight: 500; color: var(--ink-subtle); }
.crm-td-tile b { font-size: var(--text-section); line-height: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.crm-td-tile .crm-td-big { font-size: var(--text-title); line-height: 26px; font-weight: var(--weight-semibold); }
.crm-td-phone { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: var(--text-section); line-height: 22px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--brand-ink); text-decoration: none; user-select: all; }
.crm-td-phone .sp-icon { width: 14px; height: 14px; }
.crm-td-phone:hover { text-decoration: underline; }
/* результат визита — кнопки в ряд, переносятся на узком экране */
.crm-td-res { flex-wrap: wrap; align-self: flex-start; max-width: 100%; }
.crm-td-res > button { min-width: 0; }
.crm-ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-td-move { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding-top: 6px; }
.crm-td-move .sp-icon { width: 14px; height: 14px; }
.crm-td-tile .crm-sum-bar { width: 100%; margin: 6px 0 2px; }
.crm-td-mv { display: flex; flex-direction: column; gap: 12px; padding: 12px; border-radius: var(--radius-lg); background: var(--brand-soft); }
.crm-td-mv > .crm-row { justify-content: flex-end; }
.crm-td-h { margin: 0 0 8px; font-size: var(--text-compact); line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.crm-td-g { display: grid; grid-template-columns: minmax(0, 1fr) 120px 170px; align-items: center; gap: 12px; font-size: var(--text-compact); line-height: 18px; padding: 3px 0; }
.crm-td-g .crm-sum-bar { width: 100%; }
.crm-td-gv { text-align: right; font-variant-numeric: tabular-nums; }
.crm-td-gv b { font-weight: 600; }
.crm-td-note { padding: 10px 12px; border-radius: var(--radius-md); background: var(--bg-page); font-size: var(--text-compact); line-height: 18px; font-style: italic; }
.crm-td-two { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.crm-td-hist { flex: 3 1 320px; min-width: 0; }
.crm-td-hist ol { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.crm-td-hist li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; font-size: var(--text-compact); line-height: 18px; }
.crm-td-hist li > span { font-size: var(--text-caption); font-variant-numeric: tabular-nums; }
.crm-td-hist p { margin: 0; font-size: var(--text-compact); }
.crm-td-k { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: var(--radius-sm); background: var(--bg-sunken); color: var(--ink-muted); font-size: var(--text-caption); line-height: 18px; font-weight: 600; }
.crm-td-k.is-call { background: var(--brand-soft); color: var(--brand-ink); }
.crm-td-k.is-visit { background: var(--field-soft); color: var(--field-ink); }
.crm-td-k.is-deal { background: var(--success-soft); color: var(--success); }
.crm-td-price { flex: 2 1 220px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); display: flex; flex-direction: column; gap: 8px; font-size: var(--text-caption); line-height: 16px; }
.crm-td-price .crm-td-h { margin: 0; }
.crm-td-price .crm-row .sp-btn { flex: 1; }
.crm-td-form { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius-lg); background: var(--bg-sunken); }
.crm-td-form h3 { margin: 0; font-size: var(--text-body); line-height: 20px; font-weight: 600; }
.crm-td-c, .crm-td-sum { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-caption); line-height: 16px; font-weight: 500; color: var(--ink-muted); }
.crm-td-c textarea { width: 100%; resize: vertical; font-size: var(--text-body); line-height: 20px; }
.crm-td-fr { flex-wrap: wrap; align-items: flex-end; justify-content: flex-start; gap: 12px; }
.crm-td-fr .crm-td-sum { flex: 0 1 220px; min-width: 160px; }
.crm-td-foot { flex-wrap: wrap; gap: 8px; }
.crm-td-foot > .crm-muted { flex: 1; min-width: 200px; font-size: var(--text-caption); line-height: 16px; }
.crm-td-ok { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--radius-lg); background: var(--success-soft); color: var(--success); font-size: var(--text-compact); font-weight: 600; }

/* отмена переноса */
/* вопрос «Позвонить клиенту?» при переносе визита в другой день */
.crm-ask { margin: 0 0 8px; font-size: var(--text-body); line-height: 20px; color: var(--ink); }
.crm-ask b { font-weight: 600; }
.crm-ask-f { justify-content: flex-end; gap: 8px; }
.crm-modal-body > .sp-alert { margin-bottom: 12px; }
.crm-undo { position: fixed; left: 24px; bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: var(--ink); color: var(--bg-surface); border-radius: var(--radius-md); font-size: var(--text-body); line-height: 20px; box-shadow: var(--shadow-pop); }
.crm-undo button { padding: 0; border: 0; background: transparent; font: 600 var(--text-body)/20px var(--font-sans); color: var(--brand-line); cursor: pointer; }

@media (max-width: 720px) {
  .crm-cal-aside { flex-basis: 100%; }
  .crm-cal-hint { display: none; }
  /* окно задачи на телефоне: почти во весь экран, кнопка «Карточка клиента» — строкой под шапкой,
     плитки «Когда» и «Осталось» — в два столбца, кнопки сохранения — во всю ширину */
  .crm-overlay:has(.crm-td) { padding: 8px; }
  .crm-modal:has(.crm-td) { max-height: calc(100dvh - 16px); }
  .crm-td-meta { flex-wrap: wrap; }
  .crm-td-meta > .sp-btn { order: 3; flex: 1 1 100%; justify-content: center; }
  .crm-td-tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .crm-td-tiles > .crm-td-tile:first-child { grid-column: 1 / -1; }
  .crm-td-tile .crm-td-big { font-size: var(--text-heading); line-height: 24px; }
  .crm-td-foot > .crm-muted { flex-basis: 100%; }
  .crm-td-foot > .sp-btn { flex: 1 1 0; justify-content: center; }
  .crm-td-g { grid-template-columns: minmax(0, 1fr) 80px; }
  .crm-td-g .crm-td-gv { grid-column: 1 / -1; text-align: left; }
}

/* Главная ТП на телефоне (аудит 30.10): плитки — строками «подпись — число» в одной карточке, текст ≥12 px,
   зоны нажатия ≥44 px (WCAG 2.5.5 / HIG) */
@container spws (max-width: 720px) {
  .sp-ws .sp-stats.sp-stats-row { grid-template-columns: minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--bg-surface); overflow: hidden; }
  .sp-ws .sp-stats-row .sp-stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l v" "f v"; align-items: center; column-gap: 12px; row-gap: 4px; padding: 12px 16px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
  .sp-ws .sp-stats-row > .sp-stat:first-child, .sp-ws .sp-stats-row > .crm-tile-link:first-child .sp-stat { border-top: 0; }
  .sp-ws .sp-stats-row .sp-stat-label { grid-area: l; font-size: var(--text-body); line-height: 20px; }
  .sp-ws .sp-stats-row .sp-stat-label .sp-icon { display: inline-block; }
  .sp-ws .sp-stats-row .sp-stat-value { grid-area: v; font-size: var(--text-title); line-height: 24px; white-space: nowrap; }
  .sp-ws .sp-stats-row .sp-stat-unit { display: inline; margin-left: 4px; font-size: var(--text-compact); }
  .sp-ws .sp-stats-row .sp-stat-foot { grid-area: f; flex-direction: row; align-items: center; gap: 6px; }
  .sp-ws .sp-stats-row .sp-stat-hint { display: inline; font-size: var(--text-caption); }
  .sp-ws .sp-stats-row .sp-pill { font-size: var(--text-caption); }
  .crm-tile-link:hover > .sp-stat { box-shadow: none; }
  .sp-ws .sp-btn-sm, .sp-ws .sp-tt-detbtn, .sp-ws .sp-fc-more { min-height: 44px; }
  .sp-ws .sp-fc-wd, .sp-ws .sp-tt-sec, .sp-ws .sp-tt-sec small, .sp-ws .sp-tt-sum small, .sp-ws .sp-tt-cat { font-size: var(--text-caption); }
}

@media (max-width: 720px) { .sp-ws { padding: var(--space-4); } .crm-chat li { max-width: 100%; } }

/* ===== Бренд СПЕКТР 1.0 (docs/brand/) поверх дизайн-системы ===== */
h1, h2, h3, .sp-ws-title { color: var(--brand-ink); }
.sp-ws-title { font-weight: 700; letter-spacing: -0.01em; }
a { color: var(--link); }
a:hover { color: var(--brand-ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
table, .crm-table, .sp-stat, .sp-count { font-variant-numeric: tabular-nums; }

/* Шапка 64 px: логотип 40 px (< 768 px — компактный 32 px), тень бренда и фирменная полоса */
.sp-nav { position: relative; border-bottom: 0; box-shadow: var(--spk-shadow); }
.sp-nav::after { content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, var(--spk-yellow) 0 25%, var(--spk-red) 25% 50%, var(--spk-cyan) 50% 75%, var(--spk-indigo) 75% 100%);
  transform-origin: left; animation: spk-stripe-in .9s cubic-bezier(.2,.8,.2,1) both; }
.sp-nav + * { margin-top: 4px; }
.sp-brand-mark { padding: 0; background: none; }
.sp-brand { padding: 7px 0; transition: opacity .15s; }
.sp-brand:hover { opacity: .85; }
.sp-brand picture { display: block; }
/* Активный пункт меню — мягкий индиго, как в эталоне docs/brand/demo.html */
.sp-nav-row > .sp-tabs { background: none; }
.sp-tab[aria-current="page"], .sp-tab.is-current { background: var(--brand-soft); color: var(--brand-ink); box-shadow: none; }
.sp-tab[aria-current="page"] .sp-icon, .sp-tab.is-current .sp-icon { color: var(--brand); }
.sp-count-brand { background: var(--brand); }

/* Кнопки: основная — индиго, наведение — --spk-primary-hover (без «осветления» фильтром) */
.sp-btn { transition: background-color .15s, color .15s, box-shadow .15s, transform .1s; }
.sp-btn:active:not([disabled]) { transform: translateY(1px); }
.sp-btn-primary:hover { filter: none; background: var(--brand-hover); }

/* Лоадер: системный спиннер заменён фирменной эмблемой (brand/spektr-loader.svg) — во всех модулях сразу */
.sp-spin { display: inline-block; vertical-align: -4px; width: 18px; height: 18px; border: 0; border-radius: 0;
  background: url('../brand/spektr-loader.svg') center / contain no-repeat; animation: none; }
.crm-loading .spk-loader { width: 48px; height: 48px; }
.crm-boot, .crm-loading { flex-direction: column; gap: var(--space-3); }
/* Короткие загрузки (< 300 мс) не мигают: лоадер проявляется с задержкой */
.crm-loading { animation: spk-delay-show .2s ease .3s both; }

/* Появление страницы при смене раздела */
.sp-ws-inner { animation: spk-rise .35s cubic-bezier(.2,.9,.3,1) both; }

@media (prefers-reduced-motion: reduce) {
  .sp-nav::after, .crm-loading, .sp-ws-inner { animation: none; }
  .sp-btn { transition: none; }
}

/* Подсказки имени на экране входа */
.crm-suggest { position: relative; }
.crm-suggest__list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; max-height: 280px; overflow-y: auto; background: #fff; color: #1b2140; border: 1px solid #d9dcea; border-radius: 12px; box-shadow: 0 12px 32px rgba(20, 24, 60, .18); }
.crm-suggest__item { display: grid; gap: 1px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.crm-suggest__item b { font-size: var(--text-body); font-weight: 600; }
.crm-suggest__item small { font-size: var(--text-caption); color: #6b7390; }
.crm-suggest__item.is-active { background: #eef0fb; }

.spk-login__card { position: relative; z-index: 2; }
.crm-suggest__list { max-height: 224px; }
/* Аналитика клиентов из поиска верхней панели. */
.crm-ci { display: grid; gap: var(--space-3); min-width: 0; }
.crm-ci-search { width: 100%; }
.crm-ci-search input { min-width: 0; width: 100%; }
.crm-ci-settings { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); }
.crm-ci-settings > span { flex-basis: 100%; }
.crm-ci-settings label { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; font-size: var(--text-compact); color: var(--ink-muted); }
.crm-ci-settings input { width: 82px; min-height: 40px; padding: var(--space-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--ink); font: inherit; }
.crm-ci-signals { grid-column: 1 / -1; font-size: var(--text-caption); color: var(--ink-muted); }
.crm-ci-help summary { cursor: pointer; }
.crm-ci-help p { margin: var(--space-2) 0 0; }
.crm-ci-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.crm-ci-toolbar .sp-btn { height: auto; min-height: 40px; white-space: normal; text-align: left; }
.crm-ci-toolbar [aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }
.crm-ci-help, .crm-ci-meta { font-size: var(--text-caption); color: var(--ink-muted); line-height: 1.5; margin: 0; }
.crm-ci-list { display: grid; gap: var(--space-2); }
.crm-ci-row { display: grid; grid-template-columns: minmax(170px, 1.5fr) repeat(2, minmax(130px, 1fr)); gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--ink); text-decoration: none; background: var(--bg-surface); }
.crm-ci-row:hover, .crm-ci-row:focus-visible { border-color: var(--brand); background: var(--bg-sunken); }
.crm-ci-row > div { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; overflow-wrap: anywhere; }
.crm-ci-row small { color: var(--ink-muted); font-size: var(--text-caption); }
.crm-ci-row .crm-ci-negative { color: var(--danger); }
.crm-ci-row strong { font-size: var(--text-body); }
@media (max-width: 640px) { .crm-ci-row { grid-template-columns: repeat(2,minmax(0,1fr)); padding: var(--space-3); } .crm-ci-name { grid-column: 1 / -1; } .crm-ci-toolbar .sp-btn { min-height: 44px; } }

/* «Все задачи»: список по клиентам (modules/tasks → ClientTaskList, 11.11.2026): строка клиента — задачи, прирост, ближайший контакт */
.crm-tc-head { display: grid; grid-template-columns: 18px minmax(0, 1fr) 72px 120px 104px; align-items: center; gap: var(--space-3); width: 100%; padding: 10px 14px; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; border-radius: inherit; }
.crm-tc-head:hover { background: var(--bg-sunken); }
.crm-tc-head:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.crm-tc-head .sp-icon { width: 16px; height: 16px; color: var(--ink-muted); }
.crm-tc-n, .crm-tc-sum, .crm-tc-next { display: flex; flex-direction: column; align-items: flex-end; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.crm-tc-n small, .crm-tc-sum small, .crm-tc-next small { font-size: var(--text-caption); color: var(--ink-muted); font-weight: 400; }
.crm-tc-next.is-late, .crm-tc-next.is-late small { color: var(--bad); }
.crm-tc.is-done .crm-plantool-name b { color: var(--ok); }
.crm-tc-body { padding: 0 var(--space-3) var(--space-3); min-width: 0; }
/* выполненная задача — до конца месяца внизу списка клиента, зелёным */
.crm-task-done .sp-task { border-left: 4px solid var(--ok); background: color-mix(in srgb, var(--ok) 7%, var(--bg-surface)); }
.crm-task-done .sp-task-title, .crm-task-done .sp-task-title button { color: var(--ok); }
.sp-task-titlebtn { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.sp-task-titlebtn:hover { text-decoration: underline; }
.sp-task-titlebtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sp-task-sales { margin-top: var(--space-3); min-width: 0; overflow-x: auto; }
@media (max-width: 720px) {
  .crm-tc-head { grid-template-columns: 16px minmax(0, 1fr) auto; gap: var(--space-2); padding: 10px; row-gap: 6px; }
  .crm-tc-n { display: none; }
  .crm-tc-next { grid-column: 2 / -1; flex-direction: row; gap: 6px; align-items: baseline; justify-content: flex-start; }
  .crm-tc-body { padding: 0 var(--space-2) var(--space-2); }
}

/* «Все задачи»: переключатель «Список задач | Допланирование» и допланирование (modules/tasks → PlanTool) */
.crm-tasks-views { width: fit-content; max-width: 100%; margin-bottom: var(--space-3); }
.crm-plantool-rules { max-width: 900px; margin: 0; font-size: var(--text-compact); line-height: 1.45; }
.crm-plantool-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.crm-plantool-unit { border: 1px solid var(--line); border-radius: var(--radius-lg, 12px); background: var(--bg-surface); min-width: 0; }
.crm-plantool-unit.is-open { border-color: var(--brand); }
.crm-plantool-head { display: grid; grid-template-columns: 18px 28px minmax(0, 1fr) auto 110px; align-items: center; gap: var(--space-3); width: 100%; padding: 10px 14px; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; border-radius: inherit; }
.crm-plantool-head:hover { background: var(--bg-sunken); }
.crm-plantool-head:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.crm-plantool-head .sp-icon { width: 16px; height: 16px; color: var(--ink-muted); }
.crm-plantool-rank { font-size: var(--text-caption); color: var(--ink-muted); text-align: right; font-variant-numeric: tabular-nums; }
.crm-plantool-name { display: flex; flex-direction: column; min-width: 0; }
.crm-plantool-name b { font-weight: 600; overflow-wrap: anywhere; }
.crm-plantool-name small, .crm-plantool-sales small { font-size: var(--text-caption); color: var(--ink-muted); font-weight: 400; }
.crm-plantool-sales { display: flex; flex-direction: column; align-items: flex-end; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.crm-plantool-tasks { font-size: var(--text-caption); color: var(--brand-ink); text-align: right; white-space: nowrap; }
.crm-plantool-table { padding: 0 var(--space-3) var(--space-3); min-width: 0; overflow-x: auto; }
@media (max-width: 720px) {
  .crm-plantool-head { grid-template-columns: 16px minmax(0, 1fr) auto; gap: var(--space-2); padding: 10px; }
  .crm-plantool-rank { display: none; }
  .crm-plantool-tasks { grid-column: 2 / -1; text-align: left; }
  .crm-plantool-tasks:empty { display: none; }
  .crm-plantool-table { padding: 0 var(--space-2) var(--space-2); }
}
