/* CRM 2: общая визуальная система поверх компонентов. Эталон плотности — прайс.
   Onest остаётся локальным фирменным шрифтом; акценты и статусы — из токенов.
   Селекторы body сохраняют приоритет при ленивом подключении стилей модулей. */
:root {
  --text-caption: 12px;
  --text-compact: 13px;
  --text-body: 14px;
  --text-section: 16px;
  --text-title: 22px;
  /* Шкала кеглей CRM 2 (единственная): 12 подпись · 13 плотный · 14 основной · 16 раздел · 18 заголовок · 22 страница · 28 крупная цифра.
     Мельче 12 px не используется — читаемость на телефоне. Новые стили берут только эти токены. */
  --text-heading: 18px;
  --text-display: 28px;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
}
:root, [data-theme="light"] {
  --bg-page: #f5f5f7;
  --bg-surface: #fff;
  --bg-sunken: #f0f0f3;
  --bg-hover: #eaeaf0;
  --line: #e2e2e7;
  --line-strong: #c9c9d1;
  --ink: #1d1d1f;
  --ink-muted: #616168;
  --ink-subtle: #6e6e73;
  --shadow-item: 0 1px 3px rgb(0 0 0 / 5%);
  --shadow-pop: 0 16px 48px rgb(0 0 0 / 14%), 0 2px 8px rgb(0 0 0 / 5%);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #141416;
  --bg-surface: #1c1c1e;
  --bg-sunken: #262629;
  --bg-hover: #303034;
  --line: #36363b;
  --line-strong: #54545b;
  --ink: #f5f5f7;
  --ink-muted: #b2b2ba;
  --ink-subtle: #a1a1aa;
  --brand-soft: #302940;
  --brand-line: #55476f;
  --shadow-item: 0 1px 3px rgb(0 0 0 / 18%);
  --shadow-pop: 0 16px 48px rgb(0 0 0 / 40%), 0 0 0 1px var(--line);
}
[data-theme="light"] { color-scheme: light; }
body {
  font: 400 var(--text-body)/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
body :where(button, input, textarea, select) { font-family: var(--font-sans); }
body :where(b, strong) { font-weight: var(--weight-semibold); }
body :where(h1, h2, h3, h4) { color: var(--ink); font-weight: var(--weight-semibold); }
body .sp-ws-title {
  font-size: var(--text-title); line-height: 1.3;
  font-weight: var(--weight-semibold); letter-spacing: -.025em;
  color: var(--ink);
}
body .sp-ws-sub { margin-top: 6px; font-size: var(--text-compact); line-height: 1.5; }
body .sp-ws-head { align-items: center; gap: var(--space-4); }
/* «План»: приветствие, дата/тип дня, ближайшее поле и время обновления
   дублируют сведения календаря. Скрываем только его вводный блок. */
body .sp-ws-inner:has(> .crm-cal) > .sp-ws-head:has(.sp-ws-sync) { display: none; }
body .sp-ws-inner { gap: var(--space-5); animation: none; }
/* Главная: компактное расстояние от навигации до показателей и календаря. */
body .sp-ws:has(> .sp-ws-inner > .crm-sum) { padding-top: var(--space-2); }
body .sp-ws-inner:has(> .crm-sum) { gap: var(--space-2); }
body .sp-ws-inner > *, body .sp-pl, body .sp-plm { min-width: 0; }
body .crm-stack { grid-template-columns: minmax(0, 1fr); }
body .crm-stack > * { min-width: 0; }
body .crm-kicker { font-weight: var(--weight-medium); text-transform: none; letter-spacing: 0; }

/* Навигация: одна линия вместо цветной полосы и тени. */
body .sp-nav { border-bottom: 1px solid var(--line); box-shadow: none; }
body .sp-nav::after { content: none; }
body .sp-nav + * { margin-top: 0; }
/* 12.11.2026 — компактная шапка: 52 px вместо 64 (от неё считаются панель помощника и липкие колонки).
   Логотип со слоганом 36 px = 162 px шириной (брендбук: не уже 160), охранное поле 8 px (нужно ≥ 1/6 высоты). */
:root { --nav-height: 52px; }
@media (min-width: 768px) { :root { --logo-height: 36px; } }
body .sp-brand { padding: 0; }
body .sp-tab { font-size: var(--text-compact); font-weight: var(--weight-medium); }
body .sp-tab[aria-current="page"], body .sp-tab.is-current { font-weight: var(--weight-semibold); }
body .sp-user-name { font-weight: var(--weight-semibold); }

/* Общие карточки, формы, таблицы и вторичный текст. */
body .sp-card { gap: var(--space-4); box-shadow: none; }
body .sp-card-title { font-size: var(--text-compact); line-height: 1.45; font-weight: var(--weight-semibold); }
body .sp-btn { font-size: var(--text-compact); font-weight: var(--weight-medium); }
body .crm-field { font-size: var(--text-caption); line-height: 1.5; font-weight: var(--weight-medium); }
body .crm-input { font-size: var(--text-body); line-height: 1.5; }
body .crm-table { font-size: var(--text-compact); line-height: 1.5; }
body .crm-table th { font-size: var(--text-caption); font-weight: var(--weight-medium); color: var(--ink-muted); }
body .crm-table td, body .crm-table th { padding-top: 10px; padding-bottom: 10px; }
body .crm-empty { border-style: solid; padding: 40px var(--space-5); line-height: 1.5; }
body .crm-empty b { font-size: var(--text-body); font-weight: var(--weight-semibold); }
body .crm-modal h2 { font-size: var(--text-section); line-height: 1.4; font-weight: var(--weight-semibold); }
body .crm-modal header, body .crm-modal footer { padding: var(--space-4) var(--space-5); }
body .crm-modal-body { line-height: 1.5; }

/* Главная, календарь, задачи, карточки клиентов и кабинет СВ. */
/* 12.11.2026 — отдельной панели календаря больше нет (управление — в верхней строке сетки, modules/workspace/workspace.css) */
body .crm-cal { gap: var(--space-2); }
body .crm-sum-i b, body .crm-ev-sum { font-weight: var(--weight-semibold); }
/* 12.11.2026 — сводка показателей в одну плотную строку: 40 px вместо 62 */
body .crm-sum-row { gap: 6px 22px; min-height: 40px; padding: 3px 6px 3px 16px; }
body .crm-sum-more { height: 32px; }
/* 12.11.2026 — раскрытая сводка («Подробнее»): плитки 166 → ~84 px. Число и пояснение в одну строку,
   цифры 22 px вместо 28–32, поля 10×14. Только внутри .crm-sum-tiles — плитки других разделов не меняются. */
body .crm-sum-tiles, body .crm-sum-tiles .sp-stats-row { gap: var(--space-2); }
body .crm-sum-tiles .sp-goal { padding: 10px 14px; gap: 6px; }
body .crm-sum-tiles .sp-goal .sp-card-head { min-height: 20px; }
body .crm-sum-tiles .sp-metric-xl { font-size: var(--text-title); line-height: 26px; font-weight: var(--weight-semibold); }
body .crm-sum-tiles .sp-goal-of { font-size: var(--text-compact); line-height: 18px; }
body .crm-sum-tiles .sp-progress { height: 6px; }
body .crm-sum-tiles .sp-stat { display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: start; align-items: center; gap: 4px 10px; padding: 10px 12px; }
body .crm-sum-tiles .sp-stat-label { grid-column: 1 / -1; }
body .crm-sum-tiles .sp-stat-value { font-size: var(--text-title); line-height: 26px; white-space: nowrap; }
body .crm-sum-tiles .sp-stat-unit { font-size: var(--text-compact); }
/* подвал плитки: метка-пилюля встаёт рядом с числом, пояснение — одной строкой под ними */
body .crm-sum-tiles .sp-stat-foot { display: contents; }
body .crm-sum-tiles .sp-stat-foot > .sp-pill { justify-self: start; }
body .crm-sum-tiles .sp-stat-hint { grid-column: 1 / -1; min-width: 0; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { body .crm-sum-tiles .sp-stat-hint { white-space: normal; } }
body .crm-mini-title { font-weight: var(--weight-semibold); }
body .crm-ev { box-shadow: none; }
body .sp-task-title { font-size: var(--text-section); line-height: 1.45; font-weight: var(--weight-semibold); }
body .sp-task-goal { font-size: var(--text-compact); line-height: 1.55; }
body .sp-task-meta { font-size: var(--text-caption); line-height: 1.5; }
body .sp-stat-value, body .sp-tk-val b { font-weight: var(--weight-semibold); letter-spacing: -.025em; }
body .sp-stat-hint, body .sp-stat-foot { line-height: 1.5; }
body .cl-client-name { font-size: var(--text-section); line-height: 1.45; font-weight: var(--weight-semibold); }
body .cl-summary strong { font-size: var(--text-display); line-height: 1.2; font-weight: var(--weight-semibold); letter-spacing: -.025em; }
body .cl-metrics b { font-size: var(--text-section); font-weight: var(--weight-semibold); }
body .cl-result { padding: var(--space-5); }
body .cl-signals { gap: 6px; }
body .cl-result-foot { line-height: 1.5; }
body .cs-day { text-transform: none; letter-spacing: 0; }
body .cs-time { font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
body .cs-box h3 { font-size: var(--text-body); line-height: 1.5; }
body .crm-chat p, body .sp-llm-msg { font-size: var(--text-compact); line-height: 1.55; }
body .sp-stats.cs-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body .sp-llm-fab { box-shadow: var(--shadow-item); font-size: var(--text-compact); font-weight: var(--weight-medium); }
body .sp-llm-ctx-l { font-size: var(--text-caption); font-weight: var(--weight-medium); text-transform: none; letter-spacing: 0; }
body .sp-llm-hint { font-size: var(--text-caption); line-height: 1.4; white-space: normal; }

@media (max-width: 1100px) {
  body .sp-stats.cs-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  body .sp-ws-title { font-size: var(--text-title); }
  body .sp-ws-inner { gap: var(--space-4); }
  body .cl-result { padding: var(--space-4); }
  body .cl-summary strong { font-size: var(--text-title); }
  body .cl-panel > .cl-controls:not(.cl-options) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body .cl-panel > .cl-controls:not(.cl-options) > button { min-height: 40px; height: auto; padding: 8px 10px; font-size: var(--text-caption); line-height: 1.4; white-space: normal; text-align: left; }
  body .crm-sum-row { gap: 10px 12px; padding: 12px; }
  body .crm-modal header, body .crm-modal footer, body .crm-modal-body { padding: var(--space-4); }
  body .sp-card > .crm-table { display: block; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
  body .sp-plm .sp-pl-bar { flex-wrap: wrap; }
  body .sp-pl-bar > .sp-dbar-seg { max-width: 100%; overflow-x: auto; }
  body .sp-pl-bar > .sp-dbar-seg > button { flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  body .sp-btn, body .sp-tab, body .sp-card { transition: none; }
}
