/* Спектр CRM — верхняя панель. Все значения из tokens.css. */
.sp-nav, .sp-nav * { box-sizing: border-box; }
.sp-nav {
  container-type: inline-size; container-name: spnav;
  font-family: var(--font-sans); color: var(--ink);
  background: var(--bg-surface); border-bottom: 1px solid var(--line);
  -webkit-font-smoothing: antialiased;
}
.sp-nav-row {
  height: var(--nav-height); padding: 0 var(--space-6);
  display: flex; align-items: center; gap: var(--space-4);
}
.sp-zone { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.sp-zone-end { margin-left: auto; gap: var(--space-2); flex: none; }
.sp-icon { width: var(--icon-size); height: var(--icon-size); flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sp-focus:focus-visible, .sp-nav button:focus-visible, .sp-nav a:focus-visible, .sp-nav input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Бренд */
.sp-brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--ink); border-radius: var(--radius-sm); flex: none; }
.sp-brand img { height: var(--logo-height); width: auto; display: block; }
.sp-brand-mark { height: var(--logo-height); padding: 0 var(--space-2); border-radius: var(--radius-sm); background: var(--logo-plate); display: flex; align-items: center; }
.sp-brand-sep { width: 1px; height: 20px; background: var(--line); }
.sp-brand-product { font-size: 15px; line-height: 20px; font-weight: 600; letter-spacing: -0.01em; }

/* Поиск */
.sp-search {
  position: relative; display: flex; align-items: center; gap: var(--space-2);
  height: var(--control-height); width: 100%; max-width: 380px; min-width: 240px; flex: 0 1 380px;
  padding: 0 6px 0 var(--space-3);
  background: var(--bg-sunken); border: 1px solid transparent; border-radius: var(--radius-md);
  color: var(--ink-subtle); transition: background .12s, border-color .12s, box-shadow .12s;
}
.sp-search:hover { border-color: var(--line-strong); }
.sp-search:focus-within { background: var(--bg-surface); border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); color: var(--ink-muted); }
.sp-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font: 400 14px/20px var(--font-sans); color: var(--ink); padding: 0; }
.sp-search input::placeholder { color: var(--ink-subtle); opacity: 1; }
.sp-search input:focus-visible { outline: none; }
.sp-kbd { flex: none; display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: var(--radius-sm); background: var(--bg-surface); font: 500 11px/16px var(--font-mono); color: var(--ink-muted); }
.sp-ghost.sp-search-icononly { display: none; }

/* Сегменты навигации */
.sp-tabs { display: flex; align-items: center; gap: 2px; padding: 2px; background: var(--bg-sunken); border-radius: var(--radius-md); flex: none; }
.sp-tab {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-2);
  height: var(--item-height); padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer;
  font: 500 14px/20px var(--font-sans); color: var(--ink-muted); white-space: nowrap; text-decoration: none;
  transition: background .12s, color .12s;
}
.sp-tab:hover { color: var(--ink); background: var(--bg-hover); }
.sp-tab[aria-current="page"] { color: var(--ink); background: var(--bg-surface); box-shadow: var(--shadow-item); font-weight: 600; }
.sp-tab-label { display: inline-grid; }
.sp-tab-label::after { content: attr(data-text); font-weight: 600; visibility: hidden; height: 0; overflow: hidden; } /* резерв ширины под жирный */
.sp-tab-ai { color: var(--brand-ink); }
.sp-tab-ai:hover { color: var(--brand-ink); background: var(--brand-soft); }
.sp-tab-ai[aria-current="page"] { color: var(--brand-ink); }

/* Счётчик */
.sp-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); font: 700 11px/16px var(--font-sans); font-variant-numeric: tabular-nums; background: var(--bg-hover); color: var(--ink-muted); }
.sp-count-brand { background: var(--brand); color: var(--on-brand); }

/* Кнопка-призрак */
.sp-ghost { display: inline-flex; align-items: center; gap: var(--space-2); height: var(--control-height); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink-muted); font: 500 14px/20px var(--font-sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
.sp-ghost:hover { background: var(--bg-hover); color: var(--ink); }
.sp-vsep { width: 1px; height: 20px; background: var(--line); margin: 0 var(--space-1); }

/* Пользователь */
.sp-user { position: relative; flex: none; }
.sp-user-btn { display: inline-flex; align-items: center; gap: var(--space-2); height: var(--control-height); padding: 0 var(--space-2) 0 4px; border: 0; border-radius: var(--radius-pill); background: transparent; cursor: pointer; color: var(--ink); font-family: var(--font-sans); text-align: left; }
.sp-user-btn:hover, .sp-user-btn[aria-expanded="true"] { background: var(--bg-hover); }
.sp-avatar { width: var(--avatar-size); height: var(--avatar-size); border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font: 700 11px/1 var(--font-sans); letter-spacing: .02em; flex: none; }
.sp-user-text { display: flex; flex-direction: column; }
.sp-user-name { font: 600 13px/16px var(--font-sans); white-space: nowrap; }
.sp-user-role { font: 500 12px/16px var(--font-sans); color: var(--ink-subtle); white-space: nowrap; }
.sp-chev { color: var(--ink-subtle); }

.sp-menu { position: absolute; right: 0; top: calc(100% + 6px); width: 280px; padding: 6px; background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); z-index: 20; font-family: var(--font-sans); }
.sp-menu-head { display: flex; align-items: center; gap: var(--space-3); padding: 8px 10px 10px; }
.sp-menu-label { padding: 8px 10px 4px; font: 500 12px/16px var(--font-sans); color: var(--ink-subtle); }
.sp-menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.sp-menu-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); font: 500 14px/20px var(--font-sans); text-align: left; cursor: pointer; text-decoration: none; }
.sp-menu-item:hover { background: var(--bg-hover); }
.sp-menu-item .sp-icon { color: var(--ink-subtle); }
.sp-menu-item[aria-checked="true"] { font-weight: 600; }
.sp-menu-check { margin-left: auto; color: var(--brand-ink) !important; }
.sp-menu-item-danger, .sp-menu-item-danger .sp-icon { color: var(--danger) !important; }

/* Адаптив: панель сжимается по ширине контейнера, а не окна */
@container spnav (max-width: 1240px) {
  .sp-brand-sep, .sp-brand-product { display: none; }
  .sp-ghost-label { display: none; }
}
@container spnav (max-width: 1080px) {
  .sp-user-text { display: none; }
  .sp-kbd { display: none; }
}
@container spnav (max-width: 900px) {
  .sp-search { display: none; }
  .sp-ghost.sp-search-icononly { display: inline-flex; padding: 0 10px; }
  .sp-tab-label { display: none; }
  .sp-tab { padding: 0 10px; }
}

/* ===== Рабочее место ТП ===== */
.sp-ws, .sp-ws * { box-sizing: border-box; }
.sp-ws { container-type: inline-size; container-name: spws; font-family: var(--font-sans); color: var(--ink); background: var(--bg-page); padding: var(--space-6); -webkit-font-smoothing: antialiased; }
.sp-ws-inner { max-width: 1440px; margin: 0 auto; display: grid; gap: var(--space-4); }
.sp-ws-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.sp-ws-title { margin: 0; font-size: 22px; line-height: 28px; font-weight: 650; letter-spacing: -0.015em; }
.sp-ws-sub { margin-top: 2px; font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.sp-ws-sync { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-ws-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-4); }
.sp-span-3 { grid-column: span 3; } .sp-span-4 { grid-column: span 4; } .sp-span-5 { grid-column: span 5; } .sp-span-7 { grid-column: span 7; } .sp-span-12 { grid-column: span 12; }
.sp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
@container spws (max-width: 1100px) { .sp-span-3, .sp-span-4, .sp-span-5, .sp-span-7 { grid-column: span 6; } .sp-span-7 { grid-column: span 12; } }
@container spws (max-width: 720px) { .sp-ws-grid > * { grid-column: span 12 !important; } .sp-stats { grid-template-columns: 1fr; } }

/* Карточка */
.sp-card { background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; font-family: var(--font-sans); color: var(--ink); }
.sp-card-head { display: flex; align-items: center; gap: var(--space-2); min-height: 28px; }
.sp-card-ico { display: inline-flex; color: var(--ink-subtle); }
.sp-card-title { margin: 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.sp-card-aside { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }

/* Кнопки, ссылки, пилюли */
.sp-btn { display: inline-flex; align-items: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-md); font: 600 14px/20px var(--font-sans); cursor: pointer; white-space: nowrap; }
.sp-btn-primary { background: var(--brand); color: var(--on-brand); }
.sp-btn-primary:hover { filter: brightness(1.12); }
.sp-btn-hint { font-weight: 500; opacity: .75; }
.sp-btn:focus-visible, .sp-link:focus-visible, .sp-iconbtn:focus-visible, .sp-cal-day:focus-visible, .sp-close-row:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sp-link { border: 0; background: none; padding: 0; font: 600 13px/18px var(--font-sans); color: var(--brand-ink); cursor: pointer; text-decoration: none; }
.sp-link:hover { text-decoration: underline; }
.sp-iconbtn { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-muted); cursor: pointer; }
.sp-iconbtn:hover { background: var(--bg-hover); color: var(--ink); }
.sp-pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--radius-pill); font: 600 12px/16px var(--font-sans); white-space: nowrap; background: var(--bg-sunken); color: var(--ink-muted); }
.sp-dot { width: 6px; height: 6px; border-radius: var(--radius-pill); background: currentColor; flex: none; }
.sp-pill-ok { background: var(--success-soft); color: var(--success); }
.sp-pill-warn { background: var(--warning-soft); color: var(--warning); }
.sp-pill-bad { background: var(--danger-soft); color: var(--danger); }

/* Баннер */
.sp-alert { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-5); border-radius: var(--radius-xl); border: 1px solid var(--line); background: var(--bg-surface); font-family: var(--font-sans); }
.sp-alert-danger { background: var(--danger-soft); border-color: var(--danger-line); }
.sp-alert-warning { background: var(--warning-soft); border-color: transparent; }
.sp-alert-ico { width: 36px; height: 36px; flex: none; border-radius: var(--radius-pill); display: inline-flex; align-items: center; justify-content: center; background: var(--bg-surface); color: var(--ink-muted); }
.sp-alert-danger .sp-alert-ico { color: var(--danger); }
.sp-alert-warning .sp-alert-ico { color: var(--warning); }
.sp-alert-body { flex: 1; min-width: 0; }
.sp-alert-title { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--ink); }
.sp-alert-badge { font: 600 12px/16px var(--font-sans); color: var(--danger); background: var(--bg-surface); border-radius: var(--radius-pill); padding: 2px 8px; }
.sp-alert-text { margin-top: 2px; font-size: 14px; line-height: 20px; color: var(--ink-muted); }
@container spws (max-width: 720px) { .sp-alert { flex-wrap: wrap; } .sp-alert .sp-btn { width: 100%; justify-content: center; } }

/* Плитка пульса */
.sp-stat { background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: 6px; min-width: 0; font-family: var(--font-sans); }
.sp-stat-label { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-muted); }
.sp-stat-label .sp-icon { color: var(--ink-subtle); }
.sp-stat-value { font-size: 24px; line-height: 28px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--ink); }
.sp-stat-unit { margin-left: 6px; font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--ink-muted); }
.sp-stat-foot { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.sp-stat-hint { font-size: 12px; line-height: 16px; color: var(--ink-subtle); }

/* Норма */
.sp-goal-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.sp-metric-xl { font-size: 32px; line-height: 36px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.sp-goal-of { font-size: 14px; line-height: 20px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.sp-progress { position: relative; height: 10px; border-radius: var(--radius-pill); background: var(--bg-sunken); }
.sp-progress-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--radius-pill); background: var(--brand); }
.sp-progress-pace { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.sp-goal-legend { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-goal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sp-key { display: inline-block; flex: none; }
.sp-key-fill { width: 10px; height: 10px; border-radius: 3px; background: var(--brand); }
.sp-key-pace { width: 2px; height: 12px; background: var(--ink); }
.sp-goal-gap { margin-left: auto; font-weight: 600; color: var(--warning); }

/* Рейтинг */
.sp-rank-of { font-size: 16px; font-weight: 500; letter-spacing: 0; color: var(--ink-muted); }
.sp-rank-gap { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-rank-gap b { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--success); font-variant-numeric: tabular-nums; }
.sp-rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sp-rank-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; height: 34px; padding: 0 10px; border-radius: var(--radius-sm); font-size: 14px; line-height: 20px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.sp-rank-n { color: var(--ink-subtle); }
.sp-rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-rank-row.is-me { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.sp-rank-row.is-me .sp-rank-n { color: var(--brand-ink); }

/* Ближе к закрытию */
.sp-close-list { list-style: none; margin: calc(var(--space-2) * -1) 0 0; padding: 0; }
.sp-close-list li + li { border-top: 1px solid var(--line); }
.sp-close-row { display: flex; align-items: center; gap: var(--space-3); padding: 10px 8px; margin: 0 -8px; border-radius: var(--radius-sm); text-decoration: none; color: inherit; }
.sp-close-row:hover { background: var(--bg-hover); }
.sp-close-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-close-client { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-close-cat { font-size: 13px; line-height: 18px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-close-left { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; line-height: 20px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.sp-close-left small { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-subtle); }

/* Календарь */
.sp-cal-nav { display: flex; align-items: center; gap: 2px; }
.sp-cal-month { min-width: 116px; text-align: center; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink); }
.sp-cal-sum { margin-top: calc(var(--space-3) * -1); display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-cal-sum > span { display: inline-flex; align-items: center; gap: 5px; }
.sp-cal-sum .sp-icon { width: 14px; height: 14px; }
.sp-cal-sum-f { color: var(--field-ink); font-weight: 600; }
.sp-cal-sum-o { color: var(--office-ink); font-weight: 600; }
.sp-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 2px; column-gap: 2px; }
.sp-cal-wd { text-align: center; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-subtle); padding-bottom: 6px; }
.sp-cal-day { height: 52px; border: 0; border-radius: var(--radius-md); background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; padding: 6px 0 0; font: 500 14px/20px var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink); transition: background .12s; }
.sp-cal-day:hover { background: var(--bg-hover); }
.sp-cal-day.is-we .sp-cal-num, .sp-cal-day.is-past .sp-cal-num { color: var(--ink-subtle); }
.sp-cal-num { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 22px; border-radius: var(--radius-pill); }
.sp-cal-day.is-today .sp-cal-num { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.sp-cal-day.is-field { background: var(--field-soft); }
.sp-cal-day.is-field .sp-cal-num { color: var(--field-ink); font-weight: 600; }
.sp-cal-day.is-office { background: var(--office-soft); }
.sp-cal-day.is-office .sp-cal-num { color: var(--office-ink); }
.sp-cal-day.is-field:hover, .sp-cal-day.is-office:hover { filter: brightness(.97); }
.sp-cal-day.is-past:not(.is-today) .sp-cal-num { opacity: .6; }
.sp-cal-day.is-today .sp-cal-num { color: var(--on-brand); }
.sp-cal-day.is-sel { box-shadow: inset 0 0 0 2px var(--brand); }
.sp-cal-day.is-today.is-sel { box-shadow: none; } /* сегодня уже выделено кружком — без второй рамки */
.sp-cal-mark { height: 18px; display: flex; align-items: center; }
.sp-cal-chip { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 20px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); font: 700 11px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.sp-cal-chip .sp-icon { width: 10px; height: 10px; stroke-width: 3; }
.sp-cal-chip.is-planned { background: var(--bg-surface); color: var(--field-ink); }
.sp-cal-chip.is-overdue { background: var(--danger); color: var(--bg-surface); }
.sp-cal-chip.is-done { background: var(--success-soft); color: var(--success); }
.sp-cal-legend { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; padding-top: var(--space-3); border-top: 1px solid var(--line); font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sp-lg { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.sp-cal-legend-sep { width: 1px; height: 14px; background: var(--line); }
.sp-cal-legend .sp-cal-chip.is-planned { box-shadow: inset 0 0 0 1px var(--line-strong); }
.sp-lg-field { background: var(--field-soft); box-shadow: inset 0 0 0 1px var(--field-ink); }
.sp-lg-office { background: var(--office-soft); box-shadow: inset 0 0 0 1px var(--office-ink); }
.sp-cal-detail { display: flex; align-items: center; gap: var(--space-3); padding: 10px 10px 10px 10px; border-radius: var(--radius-md); background: var(--bg-sunken); }
.sp-cal-detail-ico { flex: none; width: 32px; height: 32px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; background: var(--bg-surface); }
.sp-cal-detail.is-field { background: var(--field-soft); } .sp-cal-detail.is-field .sp-cal-detail-ico { color: var(--field-ink); }
.sp-cal-detail.is-office { background: var(--office-soft); } .sp-cal-detail.is-office .sp-cal-detail-ico { color: var(--office-ink); }
.sp-cal-detail.is-overdue { background: var(--danger-soft); }
.sp-cal-detail-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-cal-detail-txt b { font-size: 14px; line-height: 20px; color: var(--ink); font-weight: 600; }
.sp-cal-detail.is-overdue .sp-cal-detail-txt span { color: var(--danger); }
.sp-btn-sm { height: 32px; padding: 0 var(--space-3); font-size: 13px; }
.sp-ws-grid > div > .sp-card { height: 100%; }
.sp-stat-foot { margin-top: auto; padding-top: 6px; }

/* ===== Карточка задачи ===== */
.sp-tasks, .sp-tasks *, .sp-task, .sp-task * { box-sizing: border-box; }
.sp-tasks { container-type: inline-size; container-name: sptasks; display: grid; gap: var(--space-3); font-family: var(--font-sans); }
.sp-tasks-note { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-task { display: grid; grid-template-columns: minmax(0, 1fr) 312px; background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); font-family: var(--font-sans); color: var(--ink); overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.sp-task:not(.is-open) { grid-template-columns: minmax(0, 1fr); }
.sp-task:hover { border-color: var(--line-strong); }
.sp-task-main { min-width: 0; padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.sp-task-head { display: flex; align-items: flex-start; gap: var(--space-3); }
.sp-task-titlerow { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-2); }
.sp-tag { flex: none; display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; background: var(--brand-soft); color: var(--brand-ink); font: 700 11px/1 var(--font-sans); letter-spacing: .04em; text-transform: uppercase; }
.sp-task-title { margin: 0; font-size: 16px; line-height: 22px; font-weight: 650; letter-spacing: -0.005em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-task-title a { color: var(--ink); text-decoration: none; border-radius: 4px; }
.sp-task-title a:hover { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
.sp-task-title a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sp-task-headside { flex: none; display: flex; align-items: center; gap: var(--space-2); margin-top: -3px; }
.sp-task-1c { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--bg-sunken); font: 600 12px/16px var(--font-sans); color: var(--ink-muted); white-space: nowrap; }
.sp-task-1c .sp-icon { width: 12px; height: 12px; color: var(--ink-subtle); }

.sp-task-meta { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; font-size: 13px; line-height: 18px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.sp-task-meta b { color: var(--ink); font-weight: 600; }
.sp-task-prog { display: flex; align-items: center; gap: var(--space-2); }
.sp-task-bar { position: relative; width: 120px; height: 6px; border-radius: var(--radius-pill); background: var(--bg-sunken); overflow: hidden; }
.sp-task-bar i { position: absolute; inset: 0 auto 0 0; border-radius: var(--radius-pill); background: var(--success); }
.sp-task-left b { font-size: 14px; }
.sp-task-touch { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-subtle); }
.sp-task-touch .sp-icon { width: 14px; height: 14px; }

.sp-task-body { display: flex; flex-direction: column; gap: var(--space-3); }
.sp-task-goal { margin: 0; max-width: 72ch; font-size: 14px; line-height: 21px; color: var(--ink); }
.sp-task-ai { display: flex; align-items: center; gap: var(--space-3); max-width: 720px; padding: 8px 10px 8px 8px; border-radius: var(--radius-md); background: var(--brand-soft); color: var(--ink); text-decoration: none; font-size: 13px; line-height: 18px; }
.sp-task-ai:hover { filter: brightness(.98); }
.sp-task-ai:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sp-task-ai-ico { flex: none; width: 26px; height: 26px; border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; }
.sp-task-ai-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-muted); }
.sp-task-ai-txt b { color: var(--brand-ink); font-weight: 600; }
.sp-task-ai-more { flex: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--brand-ink); }

.sp-task-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.sp-btn-quiet { background: var(--bg-sunken); color: var(--ink); font-weight: 500; }
.sp-btn-quiet:hover { background: var(--bg-hover); }
.sp-btn-quiet .sp-icon { color: var(--ink-subtle); }
.sp-btn-dark { background: var(--ink); color: var(--bg-surface); justify-content: center; }
.sp-btn-dark:hover { filter: brightness(1.2); }

.sp-task-hist { padding-top: var(--space-3); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.sp-task-hist-head { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); }
.sp-task-hist-head span { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--bg-sunken); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
/* Колонки истории общие для всех строк: статус шириной по самому длинному (раньше 76px — длинный статус наезжал на текст) */
.sp-task-hist ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 64px max-content minmax(0, 1fr); align-items: baseline; gap: 6px var(--space-2); width: 100%; font-size: 13px; line-height: 18px; }
.sp-task-hist li { display: contents; }
.sp-task-hist time { color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-task-hist-st { justify-self: start; max-width: 190px; overflow: hidden; text-overflow: ellipsis; padding: 1px 6px; border-radius: 4px; background: var(--bg-sunken); font-size: 11px; line-height: 16px; font-weight: 600; color: var(--ink-muted); white-space: nowrap; }
@container sptasks (max-width: 560px) {
  /* узко: статус над текстом, чтобы текст не сжимался */
  .sp-task-hist ol { grid-template-columns: 64px minmax(0, 1fr); }
  .sp-task-hist-txt { grid-column: 2; }
}
.sp-task-hist-txt { min-width: 0; color: var(--ink); }
.sp-task-hist-txt .sp-icon { width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; color: var(--ink-subtle); }
.sp-task-hist-by { color: var(--ink-subtle); }

/* Отметка ТП */
.sp-task-mark { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); background: var(--bg-sunken); border-left: 1px solid var(--line); }
.sp-task-mark-head { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); }
.sp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sp-select { position: relative; display: block; }
.sp-select select { appearance: none; width: 100%; height: 36px; padding: 0 32px 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); font: 600 14px/20px var(--font-sans); color: var(--ink); cursor: pointer; }
.sp-select .sp-icon { position: absolute; right: 10px; top: 10px; pointer-events: none; color: var(--ink-subtle); }
.sp-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--bg-hover); }
.sp-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; border: 0; border-radius: var(--radius-sm); background: transparent; font: 500 13px/18px var(--font-sans); color: var(--ink-muted); cursor: pointer; }
.sp-seg button[aria-checked="true"] { background: var(--bg-surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-item); }
.sp-task-dt { display: grid; grid-template-columns: minmax(0, 1fr) 108px; gap: var(--space-2); }

/* Выпадающий список (Dropdown) — меню дизайн-системы вместо системного <select> */
.sp-dd { position: relative; display: block; }
.sp-dd-btn { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); font: 600 14px/20px var(--font-sans); color: var(--ink); text-align: left; cursor: pointer; }
.sp-dd-btn:hover { border-color: var(--ink-subtle); }
.sp-dd-btn:focus-visible, .sp-dd.is-open .sp-dd-btn { outline: 2px solid var(--focus); outline-offset: 1px; }
.sp-dd-btn .sp-icon { flex: none; width: 16px; height: 16px; color: var(--ink-subtle); }
.sp-dd-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-dd-chev { transition: transform .12s; }
.sp-dd.is-open .sp-dd-chev { transform: rotate(180deg); }
.sp-dd-menu { left: 0; right: 0; width: auto; z-index: 30; }
.sp-dd-menu .sp-menu-item[aria-selected="true"] { background: var(--brand-soft); color: var(--brand-ink); }
.sp-dd-list { max-height: 280px; overflow-y: auto; }
.sp-dd-opt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-dd-search { margin: 0 0 6px; }
/* CRM: вложения задачи (КП) — список и раскрываемый снимок */
.sp-task-files { padding-top: var(--space-3); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--space-2); }
.sp-task-files ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sp-task-files li { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-surface); }
.sp-task-files li.is-open { border-color: var(--brand-line); }
.sp-task-file { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--ink); text-align: left; cursor: pointer; font: inherit; border-radius: var(--radius-md); }
.sp-task-file:hover { background: var(--bg-hover); }
.sp-task-file:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.sp-task-file > .sp-icon { flex: none; width: 16px; height: 16px; color: var(--ink-subtle); }
.sp-task-file > .sp-icon:first-child { color: var(--brand-ink); }
.sp-task-file-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-task-file-txt b { font-size: 13px; line-height: 18px; font-weight: 600; }
.sp-task-file-txt small { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-task-file-body { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.sp-task-file-h { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); }
.sp-task-file-t { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 18px; }
.sp-task-file-t td { padding: 4px 0; border-top: 1px solid var(--line); vertical-align: top; }
.sp-task-file-t td.c-n { white-space: nowrap; text-align: right; padding-left: 12px; font-variant-numeric: tabular-nums; color: var(--ink-muted); }
.sp-task-file-t tr.is-total td { font-weight: 650; color: var(--ink); }
.sp-task-file-text { margin: 0; font-size: 13px; line-height: 19px; color: var(--ink); white-space: pre-line; }
/* «Продать» с выбором прайса */
.sp-sell { display: inline-block; }
.sp-sell .sp-btn .sp-dd-chev { width: 14px; height: 14px; margin-left: -2px; }
.sp-sell.is-open .sp-btn { outline: 2px solid var(--focus); outline-offset: 1px; }
.sp-sell-menu { left: 0; right: auto; width: 280px; z-index: 30; }
.sp-sell-menu.is-up { top: auto; bottom: calc(100% + 6px); }
/* Карточка задачи режет углы (overflow: hidden) — пока открыт список или календарь, выпускаем его наружу */
.sp-task:has(.sp-dd.is-open) { overflow: visible; position: relative; z-index: 5; }

/* Выбор даты (DatePicker) — всплывающий FieldCalendar */
.sp-date-kind { flex: none; height: 20px; padding: 0 7px; border-radius: var(--radius-pill); font: 600 11px/20px var(--font-sans); }
.sp-date-kind.is-field { background: var(--field-soft); color: var(--field-ink); }
.sp-date-kind.is-office { background: var(--office-soft); color: var(--office-ink); }
.sp-date-pop { position: absolute; right: 0; top: calc(100% + 6px); width: 360px; max-width: calc(100vw - 32px); z-index: 30; }
.sp-date-pop.is-left { right: auto; left: 0; }
/* В итоге звонка (TodayTasks) выбор даты — кнопкой фиксированной ширины рядом с ползунком */
.sp-tt-mark-row > .sp-date { flex: 0 0 auto; min-width: 150px; }
/* CRM: статус в итоге звонка — тот же список, что в карточке задачи */
.sp-tt-status { flex: 0 1 280px; min-width: 200px; }
.sp-tt-mark-hint.is-bad { color: var(--danger); }
.sp-date-pop.is-up, .sp-dd-menu.is-up { top: auto; bottom: calc(100% + 6px); }
/* Всплывающий календарь выбора даты (DatePicker → FieldCalendar picker): тень, клетки чуть ниже */
.sp-fc-card.is-pop { box-shadow: var(--shadow-pop); padding: var(--space-4); gap: var(--space-3); }
.sp-fc-card.is-pop .sp-fc-c { height: 38px; }
/* Неактивный прошедший день: без заливки, приглушён, не кликается */
.sp-fc-c.is-off { cursor: default; background: transparent !important; filter: none !important; opacity: .35; }
.sp-cal-nav .sp-iconbtn:disabled { opacity: .35; cursor: default; }

/* Время ползунком (TimeSlider) */
.sp-time { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); }
.sp-time-head { display: flex; align-items: center; gap: 6px; font: 500 13px/18px var(--font-sans); color: var(--ink-muted); }
.sp-time-head .sp-icon { width: 16px; height: 16px; color: var(--ink-subtle); }
.sp-time-val { margin-left: auto; font: 600 14px/20px var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink); }
.sp-time-clear { font-size: 12px; }
.sp-task-mark .sp-range, .sp-range { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; padding: 0; margin: 0; border: 0; background: transparent; cursor: pointer; }
.sp-range::-webkit-slider-runnable-track { height: 6px; border-radius: var(--radius-pill); background: linear-gradient(to right, var(--brand) var(--sp-range-fill, 0%), var(--bg-hover) var(--sp-range-fill, 0%)); }
.sp-range::-moz-range-track { height: 6px; border-radius: var(--radius-pill); background: var(--bg-hover); }
.sp-range::-moz-range-progress { height: 6px; border-radius: var(--radius-pill); background: var(--brand); }
.sp-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: var(--bg-surface); border: 2px solid var(--brand); box-shadow: var(--shadow-item); }
.sp-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--bg-surface); border: 2px solid var(--brand); box-shadow: var(--shadow-item); }
.sp-range:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.sp-time-marks { display: flex; justify-content: space-between; font: 500 11px/14px var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink-subtle); }
.sp-task-mark input, .sp-task-mark textarea { width: 100%; min-width: 0; height: 36px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); font: 400 14px/20px var(--font-sans); color: var(--ink); }
[data-theme="dark"] .sp-task-mark input { color-scheme: dark; }
.sp-task-mark textarea { height: auto; min-height: 64px; padding: 8px 10px; resize: vertical; }
.sp-task-mark textarea::placeholder { color: var(--ink-subtle); }
.sp-task-mark select:focus-visible, .sp-task-mark input:focus-visible, .sp-task-mark textarea:focus-visible, .sp-seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
@container sptasks (max-width: 860px) {
  .sp-task { grid-template-columns: minmax(0, 1fr); }
  .sp-task-mark { border-left: 0; border-top: 1px solid var(--line); }
}

/* ===== ИИ-задачи ===== */
.sp-ai, .sp-ai * { box-sizing: border-box; }
.sp-ai { container-type: inline-size; container-name: spai; background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); font-family: var(--font-sans); color: var(--ink); overflow: hidden; }
.sp-ai-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.sp-ai-titlebox { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.sp-ai-logo { flex: none; width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--brand-soft); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; }
.sp-ai-logo .sp-icon { width: 18px; height: 18px; }
.sp-ai-title { margin: 0; font-size: 16px; line-height: 22px; font-weight: 650; }
.sp-ai-sub { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-ai-filters { display: flex; gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--bg-sunken); flex-wrap: wrap; }
.sp-ai-filter { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; font: 500 13px/18px var(--font-sans); color: var(--ink-muted); cursor: pointer; white-space: nowrap; }
.sp-ai-filter:hover:not(:disabled) { background: var(--bg-hover); color: var(--ink); }
.sp-ai-filter[aria-selected="true"] { background: var(--bg-surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-item); }
.sp-ai-filter:disabled { opacity: .5; cursor: default; }
.sp-ai-filter-n { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-subtle); }
.sp-ai-filter[aria-selected="true"] .sp-ai-filter-n { color: var(--brand-ink); }
.sp-ai-filter:focus-visible, .sp-ai-btn:focus-visible, .sp-ai-name:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sp-ai-list { list-style: none; margin: 0; padding: 0; }
.sp-ai-row { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--space-4); padding: 14px var(--space-5); border-top: 1px solid var(--line); transition: background .12s; }
.sp-ai-row:first-child { border-top: 0; }
.sp-ai-row:hover { background: var(--bg-page); }
.sp-ai-client { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.sp-ai-dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: var(--radius-pill); background: transparent; }
.sp-ai-row.is-unread .sp-ai-dot { background: var(--brand); }
.sp-ai-client-txt { min-width: 0; display: flex; flex-direction: column; }
.sp-ai-name { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px; }
.sp-ai-row.is-unread .sp-ai-name { font-weight: 650; }
.sp-ai-name:hover { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
.sp-ai-cat { font-size: 13px; line-height: 18px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sp-ai-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.sp-ai-line { display: grid; grid-template-columns: 92px 40px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); min-height: 28px; }
.sp-ai-kind { justify-self: start; display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--radius-pill); font: 600 12px/16px var(--font-sans); white-space: nowrap; }
.sp-ai-kind .sp-icon { width: 12px; height: 12px; }
.sp-ai-kind.is-advice { background: var(--brand-soft); color: var(--brand-ink); }
.sp-ai-kind.is-price, .sp-ai-kind.is-kp { background: var(--field-soft); color: var(--field-ink); }
.sp-ai-kind.is-pending { background: var(--bg-sunken); color: var(--ink-muted); }
.sp-spin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: sp-spin 1s linear infinite; }
@keyframes sp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sp-spin { animation: none; } }
.sp-ai-date { font-size: 12px; line-height: 16px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-ai-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.sp-ai-row.is-unread .sp-ai-text { color: var(--ink); }
.sp-ai-act { display: flex; align-items: center; gap: 6px; }
.sp-ai-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; font: 600 13px/18px var(--font-sans); color: var(--ink-muted); text-decoration: none; cursor: pointer; white-space: nowrap; }
.sp-ai-btn .sp-icon { width: 14px; height: 14px; }
.sp-ai-btn:hover { background: var(--bg-hover); color: var(--ink); }
.sp-ai-btn.is-main { background: var(--bg-sunken); color: var(--ink); }
.sp-ai-btn.is-main:hover { background: var(--bg-hover); }
.sp-ai-btn .sp-count { height: 18px; min-width: 18px; padding: 0 5px; }

.sp-ai-points { margin: 6px 0 4px 156px; padding: 10px 14px; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; border-radius: var(--radius-md); background: var(--bg-sunken); font-size: 13px; line-height: 19px; }
.sp-ai-points dt { font-weight: 600; color: var(--ink); }
.sp-ai-points dd { margin: 0; color: var(--ink-muted); }
.sp-ai-empty { padding: var(--space-6); text-align: center; font-size: 14px; color: var(--ink-subtle); }

@container spai (max-width: 900px) {
  .sp-ai-row { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .sp-ai-items { padding-left: 18px; }
  .sp-ai-line { grid-template-columns: auto auto minmax(0, 1fr); }
  .sp-ai-act { grid-column: 1 / -1; }
  .sp-ai-points { margin-left: 0; grid-template-columns: minmax(0, 1fr); }
}

/* ===== Обратная связь агентов ===== */
.sp-ag, .sp-ag * { box-sizing: border-box; }
.sp-ag { container-type: inline-size; container-name: spag; display: flex; flex-direction: column; gap: var(--space-3); font-family: var(--font-sans); color: var(--ink); }
.sp-ag-note { display: flex; align-items: center; gap: var(--space-2); padding: 8px 12px; border-radius: var(--radius-md); background: var(--bg-sunken); font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-ag-note .sp-icon { width: 14px; height: 14px; color: var(--ink-subtle); flex: none; }
.sp-ag-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-2); }
.sp-ag-title { margin: 0; display: flex; align-items: center; gap: var(--space-2); font-size: 20px; line-height: 26px; font-weight: 650; letter-spacing: -0.01em; }
.sp-ag-count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--danger); color: var(--bg-surface); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sp-ag-sub { margin-top: 2px; display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-ag-legend { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--ink-subtle); }
.sp-ag-legend > .sp-ag-item { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; }
.sp-ag-rule { display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px; border-radius: var(--radius-md); background: var(--warning-soft); font-size: 13px; line-height: 18px; color: var(--ink); }
.sp-ag-rule-ico { flex: none; width: 26px; height: 26px; border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--warning); display: inline-flex; align-items: center; justify-content: center; }
.sp-ag-rule-txt { flex: 1; min-width: 0; }
.sp-ag-rule-n { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: var(--radius-pill); background: var(--bg-surface); font-weight: 650; color: var(--danger); }
.sp-ag-rule-n .sp-icon { width: 13px; height: 13px; }

.sp-ag-list { display: flex; flex-direction: column; gap: var(--space-3); }
.sp-ag-tp { background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); overflow: hidden; }
.sp-ag-tp.is-escalated { border-color: var(--danger-line); }
.sp-ag-tp-head { display: flex; align-items: center; gap: var(--space-3); padding: 12px var(--space-4) 10px; }
.sp-ag-av { width: 32px; height: 32px; font-size: 12px; }
.sp-ag-av.is-high { background: var(--danger-soft); color: var(--danger); }
.sp-ag-av.is-mid { background: var(--warning-soft); color: var(--warning); }
.sp-ag-tp-name { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
.sp-ag-tp-name a { font-size: 15px; line-height: 20px; font-weight: 650; color: var(--ink); text-decoration: none; white-space: nowrap; border-radius: 4px; }
.sp-ag-tp-name a:hover { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
.sp-ag-tp-meta { font-size: 13px; color: var(--ink-subtle); white-space: nowrap; }
.sp-ag-esc { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--danger-soft); color: var(--danger); font: 600 12px/16px var(--font-sans); white-space: nowrap; }
.sp-ag-esc .sp-icon { width: 12px; height: 12px; }
.sp-ag-tp-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.sp-btn-soft { background: var(--brand-soft); color: var(--brand-ink); }
.sp-btn-soft:hover { filter: brightness(.96); }
.sp-btn-soft:disabled { opacity: .5; cursor: default; }
.sp-btn-soft .sp-icon { width: 15px; height: 15px; }

.sp-ag-items { list-style: none; margin: 0; padding: 0 var(--space-4) 6px; }
.sp-ag-item { display: grid; grid-template-columns: 18px 112px minmax(0, 1fr) auto; align-items: start; gap: var(--space-3); padding: 9px 0; border-top: 1px solid var(--line); }
.sp-ag-item input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); cursor: pointer; }
.sp-ag-item input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sp-ag-agent { display: inline-flex; align-items: center; gap: 6px; height: 20px; font-size: 13px; font-weight: 500; color: var(--ink-muted); white-space: nowrap; }
.sp-ag-agent .sp-icon { width: 14px; height: 14px; color: var(--ink-subtle); }
.sp-ag-sev { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--ink-subtle); }
.sp-ag-item.is-high .sp-ag-sev { background: var(--danger); border-radius: 50%; }
.sp-ag-item.is-mid .sp-ag-sev { background: var(--warning); transform: rotate(45deg); }
.sp-ag-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.sp-ag-main { font-size: 14px; line-height: 20px; color: var(--ink); }
.sp-ag-item.is-low .sp-ag-main { color: var(--ink-muted); }
.sp-ag-detail { font-size: 13px; line-height: 18px; color: var(--ink-subtle); }
.sp-ag-side { display: flex; align-items: center; gap: 6px; min-height: 20px; }
.sp-ag-since { height: 20px; padding: 0 7px; display: inline-flex; align-items: center; border-radius: var(--radius-pill); background: var(--danger-soft); color: var(--danger); font: 600 12px/16px var(--font-sans); white-space: nowrap; }
.sp-ag-ai { width: 26px; height: 26px; margin-top: -3px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--brand-ink); background: var(--brand-soft); }
.sp-ag-ai:hover { filter: brightness(.95); }
.sp-ag-ai .sp-icon { width: 14px; height: 14px; }
.sp-ag-ai:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@container spag (max-width: 760px) {
  .sp-ag-tp-head { flex-wrap: wrap; }
  .sp-ag-tp-actions { width: 100%; margin-left: 44px; }
  .sp-ag-item { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .sp-ag-agent { grid-column: 2; }
  .sp-ag-text { grid-column: 2 / -1; }
}

/* ===== Иконки: плашка и метка ===== */
.sp-tile { flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--bg-sunken); color: var(--ink-muted); }
.sp-tile.is-sm { width: 24px; height: 24px; border-radius: var(--radius-sm); } .sp-tile.is-sm .sp-icon { width: 14px; height: 14px; }
.sp-tile.is-md { width: 32px; height: 32px; } .sp-tile.is-md .sp-icon { width: 17px; height: 17px; }
.sp-tile.is-lg { width: 40px; height: 40px; border-radius: var(--radius-lg); } .sp-tile.is-lg .sp-icon { width: 20px; height: 20px; }
.sp-tile.is-field   { background: var(--field-soft);   color: var(--field-ink); }
.sp-tile.is-office  { background: var(--office-soft);  color: var(--office-ink); box-shadow: inset 0 0 0 1px var(--line); }
.sp-tile.is-brand   { background: var(--brand-soft);   color: var(--brand-ink); }
.sp-tile.is-danger  { background: var(--danger-soft);  color: var(--danger); }
.sp-tile.is-warning { background: var(--warning-soft); color: var(--warning); }
.sp-tile.is-success { background: var(--success-soft); color: var(--success); }
.sp-tagx { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--radius-pill); font: 600 12px/16px var(--font-sans); white-space: nowrap; background: var(--bg-sunken); color: var(--ink-muted); }
.sp-tagx .sp-icon { width: 13px; height: 13px; }
.sp-tagx.is-field   { background: var(--field-soft);   color: var(--field-ink); }
.sp-tagx.is-office  { background: var(--office-soft);  color: var(--office-ink); }
.sp-tagx.is-brand   { background: var(--brand-soft);   color: var(--brand-ink); }
.sp-tagx.is-danger  { background: var(--danger-soft);  color: var(--danger); }
.sp-tagx.is-warning { background: var(--warning-soft); color: var(--warning); }
.sp-tagx.is-success { background: var(--success-soft); color: var(--success); }
.sp-card-head .sp-tile + .sp-card-title { font-size: 14px; line-height: 20px; color: var(--ink); }

/* ===== Рейтинг: медали ТОП-5 ===== */
.sp-medal { flex: none; display: block; overflow: visible; }
.sp-medal-ribbon { stroke: none; stroke-linejoin: round; }
.sp-medal-ribbon.is-r { opacity: .78; }
.sp-medal-inner { fill: none; stroke-width: .9; opacity: .55; }
.sp-medal-disc { stroke-width: 1.75; }
.sp-medal-num { font: 750 10.5px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.sp-medal-spark { stroke: none; }
.sp-medal.is-gold   .sp-medal-ribbon { fill: var(--medal-gold-ring); } .sp-medal.is-gold .sp-medal-inner { stroke: var(--medal-gold-ring); }   .sp-medal.is-gold   .sp-medal-disc { fill: var(--medal-gold-soft);   stroke: var(--medal-gold-ring); }   .sp-medal.is-gold   .sp-medal-num { fill: var(--medal-gold-ink); }
.sp-medal.is-silver .sp-medal-ribbon { fill: var(--medal-silver-ring); } .sp-medal.is-silver .sp-medal-inner { stroke: var(--medal-silver-ring); } .sp-medal.is-silver .sp-medal-disc { fill: var(--medal-silver-soft); stroke: var(--medal-silver-ring); } .sp-medal.is-silver .sp-medal-num { fill: var(--medal-silver-ink); }
.sp-medal.is-bronze .sp-medal-ribbon { fill: var(--medal-bronze-ring); } .sp-medal.is-bronze .sp-medal-inner { stroke: var(--medal-bronze-ring); } .sp-medal.is-bronze .sp-medal-disc { fill: var(--medal-bronze-soft); stroke: var(--medal-bronze-ring); } .sp-medal.is-bronze .sp-medal-num { fill: var(--medal-bronze-ink); }
.sp-rank-chip { flex: none; display: inline-flex; align-items: center; justify-content: center; margin: 2px; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1.5px var(--brand-line); font: 700 11px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.sp-rank-plain { display: inline-flex; justify-content: center; width: 28px; font: 500 13px/20px var(--font-sans); color: var(--ink-subtle); font-variant-numeric: tabular-nums; }

.sp-lead, .sp-lead * { box-sizing: border-box; }
.sp-lead { gap: var(--space-3); }
.sp-lead-hd { min-width: 0; }
.sp-lead .sp-card-head .sp-tile + .sp-lead-hd .sp-card-title { font-size: 14px; line-height: 20px; color: var(--ink); }
.sp-lead-sub { font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-lead-t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; }
.sp-lead-t th { padding: 0 10px 8px; text-align: left; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-subtle); border-bottom: 1px solid var(--line); }
.sp-lead-t td { height: 44px; padding: 0 10px; border-bottom: 1px solid var(--line); color: var(--ink); }
.sp-lead-t tr:last-child td { border-bottom: 0; }
.sp-lead-t .c-n { width: 48px; padding-right: 0; }
.sp-lead-t .c-n > * { vertical-align: middle; }
.sp-lead-t .c-r { text-align: right; white-space: nowrap; }
.sp-lead-t tr.is-top .c-name { font-weight: 600; }
.sp-lead-t tr:not(.is-top) td { color: var(--ink-muted); }
.sp-lead-t tr.is-medal .c-money { font-weight: 650; }
.sp-lead-t tr.is-cut td { border-bottom: 1.5px dashed var(--line-strong); }
.sp-lead-t .c-done { color: var(--ink-muted); }
.sp-lead-t .c-done b { color: var(--ink); font-weight: 600; }
.sp-lead-t .c-done small { display: inline-block; min-width: 34px; margin-left: 8px; font-size: 12px; color: var(--ink-subtle); }
.sp-lead-t tr.is-me td { background: var(--brand-soft); }
.sp-lead-t tr.is-me td:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.sp-lead-t tr.is-me td:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.sp-lead-me { margin-left: 8px; padding: 1px 6px; border-radius: var(--radius-pill); background: var(--brand); color: var(--on-brand); font-size: 11px; font-weight: 700; }

/* ===== Фильтры прайса ===== */
.sp-facets, .sp-facets *, .sp-facets-m, .sp-facets-m * { box-sizing: border-box; }
.sp-facets { width: 100%; max-width: 320px; display: flex; flex-direction: column; font-family: var(--font-sans); color: var(--ink); }
.sp-facets-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 8px; }
.sp-facets-title { font-size: 15px; line-height: 20px; font-weight: 650; color: var(--ink); }
.sp-facet-reset { border: 0; background: none; padding: 2px 4px; font: 600 13px/18px var(--font-sans); color: var(--brand-ink); cursor: pointer; border-radius: 4px; }
.sp-facet-reset:hover { text-decoration: underline; }

.sp-facet { border-top: 1px solid var(--line); }
.sp-facet-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 8px; margin: 0 -8px; width: calc(100% + 16px); border: 0; border-radius: var(--radius-md); background: transparent; font-family: var(--font-sans); color: var(--ink); cursor: pointer; text-align: left; }
.sp-facet-toggle:hover { background: var(--bg-hover); }
.sp-facet-title { font-size: 14px; line-height: 20px; font-weight: 650; }
.sp-facet-sel { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--brand); color: var(--on-brand); display: inline-flex; align-items: center; justify-content: center; font: 700 11px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.sp-facet-hint { margin-left: auto; font-size: 12px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-facet-chev { width: 18px; height: 18px; color: var(--ink-muted); transition: transform .18s; flex: none; }
.sp-facet.is-open .sp-facet-chev { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .sp-facet-chev { transition: none; } }
.sp-facet-picked { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 12px; }
.sp-facets-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 26px; padding: 0 6px 0 10px; border: 0; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand-ink); font: 600 12px/16px var(--font-sans); cursor: pointer; }
.sp-facets-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-facets-chip .sp-icon { width: 13px; height: 13px; flex: none; }
.sp-facets-chip:hover { filter: brightness(.96); }
.sp-facet-body { display: flex; flex-direction: column; gap: 6px; padding: 0 0 14px; }
.sp-facet-search { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: var(--radius-md); background: var(--bg-sunken); color: var(--ink-subtle); border: 1px solid transparent; }
.sp-facet-search:focus-within { background: var(--bg-surface); border-color: var(--brand); }
.sp-facet-search .sp-icon { width: 14px; height: 14px; flex: none; }
.sp-facet-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font: 400 14px/20px var(--font-sans); color: var(--ink); }
.sp-facet-search input::placeholder { color: var(--ink-subtle); }
.sp-facet-list { list-style: none; margin: 0; padding: 0; }
.sp-facet-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: var(--radius-sm); cursor: pointer; }
.sp-facet-row:hover { background: var(--bg-hover); }
.sp-facet-row input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand); cursor: pointer; }
.sp-facet-label { font-size: 14px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; }
.sp-facet-row.is-on .sp-facet-label { font-weight: 600; }
.sp-facet-n { font-size: 12px; line-height: 20px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-facet-row.is-on .sp-facet-n { color: var(--brand-ink); font-weight: 600; }
.sp-facet-nonelist { padding-top: 6px; border-top: 1px dashed var(--line); }
.sp-facet-row.is-none .sp-facet-label { color: var(--ink-muted); }
.sp-facet-more { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px; margin-left: 20px; border: 0; border-radius: var(--radius-sm); background: transparent; font: 600 13px/18px var(--font-sans); color: var(--brand-ink); cursor: pointer; }
.sp-facet-more .sp-icon { width: 15px; height: 15px; }
.sp-facet-more:hover { background: var(--brand-soft); }
.sp-facet-empty { padding: 6px 0 2px 28px; font-size: 13px; color: var(--ink-subtle); }
.sp-facet-toggle:focus-visible, .sp-facet-reset:focus-visible, .sp-facet-more:focus-visible, .sp-facets-chip:focus-visible, .sp-facet-row input:focus-visible, .sp-facets-mbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* мобильная: кнопка + шторка снизу */
.sp-facets-m { position: relative; height: 100%; font-family: var(--font-sans); color: var(--ink); }
.sp-facets-mbar { display: flex; gap: 8px; padding: 10px 12px; background: var(--bg-surface); border-bottom: 1px solid var(--line); }
.sp-facets-mbtn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--bg-surface); font: 600 14px/20px var(--font-sans); color: var(--ink); cursor: pointer; }
.sp-facets-mbtn.is-quiet { font-weight: 500; color: var(--ink-muted); }
.sp-facets-mbtn .sp-icon { width: 16px; height: 16px; }
.sp-sheet-wrap { position: absolute; inset: 0; z-index: 30; }
.sp-sheet-scrim { position: absolute; inset: 0; background: rgba(15,17,21,.42); }
.sp-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%; display: flex; flex-direction: column; background: var(--bg-surface); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-pop); }
.sp-sheet-grab { width: 40px; height: 4px; margin: 8px auto 2px; border-radius: var(--radius-pill); background: var(--line-strong); }
.sp-sheet-head { display: flex; align-items: center; gap: 8px; padding: 6px 16px 8px; }
.sp-sheet-head .sp-facets-title { flex: 1; font-size: 17px; }
.sp-sheet-body { flex: 1; overflow-y: auto; padding: 0 16px; }
.sp-sheet-body .sp-facet:first-child { border-top: 0; }
.sp-sheet-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--bg-surface); }
.sp-sheet-apply { width: 100%; height: 48px; justify-content: center; font-size: 15px; border-radius: var(--radius-lg); }

/* ===== Прайс: страница ===== */
.sp-price, .sp-price * { box-sizing: border-box; }
.sp-price { display: grid; grid-template-columns: 328px minmax(0, 1fr); gap: var(--space-5); align-items: start; padding: var(--space-5); background: var(--bg-page); font-family: var(--font-sans); color: var(--ink); }
.sp-price-side { position: sticky; top: var(--space-5); max-height: calc(100vh - 2 * var(--space-5)); overflow-y: auto; background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: var(--space-4); }
.sp-price-main { min-width: 0; max-width: 1240px; }

/* навигация по группам: один уровень за раз */
.sp-cat { display: flex; flex-direction: column; gap: var(--space-3); font-family: var(--font-sans); color: var(--ink); }
.sp-cat, .sp-cat * { box-sizing: border-box; }
.sp-cat-level { display: flex; flex-direction: column; gap: 4px; }
.sp-cat-cap { padding: 2px 2px 4px; font-size: 12px; color: var(--ink-subtle); }
.sp-cat-crumbs { list-style: none; margin: 0; padding: 0 2px; display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-cat-crumbs li + li::before { content: '›'; margin-right: 6px; color: var(--ink-subtle); }
.sp-cat-crumbs button { border: 0; background: none; padding: 0; font: inherit; color: var(--brand-ink); cursor: pointer; }
.sp-cat-crumbs button:hover { text-decoration: underline; }
.sp-cat-crumbs [aria-current] { color: var(--ink-muted); font-weight: 600; }
.sp-cat-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 6px; margin: 2px 0 4px -6px; border: 0; border-radius: var(--radius-sm); background: transparent; font: 600 13px/18px var(--font-sans); color: var(--ink-muted); cursor: pointer; }
.sp-cat-back .sp-icon { width: 16px; height: 16px; }
.sp-cat-back:hover { background: var(--bg-hover); color: var(--ink); }
.sp-cat-list { list-style: none; margin: 0; padding: 0; }
.sp-cat-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 16px; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 7px 8px 7px 10px; border: 0; border-radius: var(--radius-md); background: transparent; text-align: left; font-family: var(--font-sans); color: var(--ink); cursor: pointer; }
.sp-cat-row:hover { background: var(--bg-hover); }
.sp-cat-row.is-active { background: var(--brand-soft); }
.sp-cat-row.is-active .sp-cat-name { color: var(--brand-ink); font-weight: 650; }
.sp-cat-all { margin-bottom: 4px; }
.sp-cat-main { min-width: 0; display: flex; flex-direction: column; }
.sp-cat-trail { font-size: 11px; line-height: 14px; color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-cat-name { font-size: 14px; line-height: 19px; overflow-wrap: anywhere; }
.sp-cat-n { font-size: 12px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-cat-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.sp-cat-chev { width: 16px; height: 16px; color: var(--ink-subtle); }
.sp-cat-extra { padding-top: var(--space-3); border-top: 1px solid var(--line); }
.sp-cat-row:focus-visible, .sp-cat-back:focus-visible, .sp-cat-crumbs button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* таблица товаров */
.sp-pt { background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); overflow: hidden; font-family: var(--font-sans); }
.sp-pt-bar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: 12px var(--space-4); border-bottom: 1px solid var(--line); }
.sp-pt-title { display: flex; align-items: baseline; gap: 8px; margin-right: var(--space-2); }
.sp-pt-title b { font-size: 16px; line-height: 22px; font-weight: 650; }
.sp-pt-title span { font-size: 13px; color: var(--ink-subtle); }
.sp-pt-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-pt-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--bg-surface); font: 500 13px/18px var(--font-sans); color: var(--ink-muted); cursor: pointer; }
.sp-pt-chip span { font-size: 12px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-pt-chip.is-on { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); font-weight: 600; }
.sp-pt-chip.is-on span { color: var(--brand-ink); }
.sp-pt-selbar { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ink-muted); }
.sp-pt-t { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; }
.sp-pt-t thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-surface); height: 36px; padding: 0 10px; text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-subtle); border-bottom: 1px solid var(--line); white-space: nowrap; }
.sp-pt-t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink); }
.sp-pt-t tbody tr:last-child td { border-bottom: 0; }
.sp-pt-t tbody tr:hover td { background: var(--bg-page); }
.sp-pt-t tbody tr.is-sel td { background: color-mix(in srgb, var(--brand-soft) 55%, var(--bg-surface)); }
.sp-pt-t .c-chk { width: 40px; padding-left: var(--space-4); padding-right: 0; }
.sp-pt-t input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); cursor: pointer; display: block; }
.sp-pt-t .c-img { width: 64px; padding-right: 4px; }
.sp-pt-t .c-img img, .sp-pt-noimg { width: 52px; height: 52px; border-radius: var(--radius-md); object-fit: cover; display: flex; align-items: center; justify-content: center; background: var(--bg-sunken); color: var(--ink-subtle); border: 1px solid var(--line); }
.sp-pt-t .c-img img { transition: transform .15s; }
.sp-pt-t .c-img img:hover { transform: scale(2.4); position: relative; z-index: 5; box-shadow: var(--shadow-pop); }
.sp-pt-noimg .sp-icon { width: 20px; height: 20px; }
.sp-pt-t .c-name { min-width: 280px; }
.sp-pt-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); text-decoration: none; font-weight: 500; }
.sp-pt-name:hover { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
.sp-pt-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-pt-code { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-muted); }
.sp-pt-abc { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 5px; font-weight: 700; font-size: 11px; background: var(--bg-sunken); color: var(--ink-muted); }
.sp-pt-abc.is-a { background: var(--brand-soft); color: var(--brand-ink); }
.sp-pt-meta .sp-tagx { height: 20px; font-size: 11.5px; }
.sp-pt-t .c-num { width: 1%; text-align: right; white-space: nowrap; padding-left: 14px; padding-right: 14px; }
.sp-pt-t th.c-num { text-align: right; }
.sp-pt-t .c-mult { color: var(--ink-muted); }
.sp-pt-t .c-price b { display: block; font-size: 15px; font-weight: 650; }
.sp-pt-t .c-price small { font-size: 11.5px; color: var(--success); font-weight: 600; }
.sp-pt-t .c-qty { width: 1%; padding-right: var(--space-4); }
.sp-step { display: inline-flex; align-items: center; height: 32px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); overflow: hidden; }
.sp-step.is-on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.sp-step button { width: 30px; height: 100%; border: 0; background: transparent; color: var(--ink-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.sp-step button .sp-icon { width: 14px; height: 14px; }
.sp-step button:hover:not(:disabled) { background: var(--bg-hover); color: var(--ink); }
.sp-step button:disabled { opacity: .35; cursor: default; }
.sp-step input { width: 40px; height: 100%; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); background: transparent; text-align: center; font: 600 14px/20px var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink); outline: none; }
.sp-step input::placeholder { color: var(--ink-subtle); font-weight: 400; }
.sp-step button:focus-visible, .sp-step input:focus-visible, .sp-pt-chip:focus-visible, .sp-pt-name:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (max-width: 960px) {
  .sp-price { grid-template-columns: minmax(0, 1fr); }
  .sp-price-side { position: static; max-height: none; }
}

/* CategoryNav: шапка уровня и добавление в прайс */
.sp-cat-up { align-self: flex-start; max-width: 100%; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 4px; margin-left: -4px; border: 0; border-radius: var(--radius-sm); background: transparent; font: 500 13px/18px var(--font-sans); color: var(--ink-muted); cursor: pointer; }
.sp-cat-up span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-cat-up .sp-icon { width: 15px; height: 15px; flex: none; }
.sp-cat-up:hover { background: var(--bg-hover); color: var(--ink); }
.sp-cat-here { display: flex; align-items: baseline; gap: 8px; padding: 2px 0 2px 2px; }
.sp-cat-here-name { flex: 1; min-width: 0; padding: 0; border: 0; background: none; text-align: left; font: 650 17px/22px var(--font-sans); letter-spacing: -0.01em; color: var(--ink); cursor: pointer; overflow-wrap: anywhere; border-radius: 4px; }
.sp-cat-here-name:hover:not(.is-static) { color: var(--brand-ink); }
.sp-cat-here-name.is-static { cursor: default; }
.sp-cat-here .sp-cat-n { font-size: 13px; }
.sp-cat-hereact { padding: 4px 0 2px; }
.sp-cat-colcap { display: flex; justify-content: space-between; margin-top: 8px; padding: 0 2px 4px; border-bottom: 1px solid var(--line); font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-subtle); }
.sp-cat.is-pickable .sp-cat-list { padding-top: 4px; }
.sp-cat-li { display: flex; align-items: center; gap: 8px; }
.sp-cat-li > .sp-cat-row { flex: 1; min-width: 0; }
.sp-pick { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 30px; height: 30px; padding: 0; border: 1.5px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--ink-muted); cursor: pointer; font: 600 13px/18px var(--font-sans); }
.sp-pick .sp-icon { width: 15px; height: 15px; stroke-width: 2.2; }
.sp-pick:hover { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); }
.sp-pick.is-on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.sp-pick.is-on:hover { filter: brightness(1.1); background: var(--brand); color: var(--on-brand); }
.sp-pick.is-big { width: auto; height: 34px; padding: 0 12px 0 10px; }
.sp-pick:focus-visible, .sp-cat-up:focus-visible, .sp-cat-here-name:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ===== GroupPicker: выбор групп галочками ===== */
.sp-gp, .sp-gp * { box-sizing: border-box; }
.sp-gp { display: flex; flex-direction: column; gap: 10px; font-family: var(--font-sans); color: var(--ink); }
.sp-gp-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 0 2px; font-size: 11.5px; line-height: 16px; color: var(--ink-subtle); }
.sp-gp-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sp-gp-sum { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--brand-soft); }
.sp-gp-sumline { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-gp-sumline b { color: var(--brand-ink); font-weight: 650; }
.sp-gp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-gp-chips .sp-facets-chip { background: var(--bg-surface); }
.sp-gp-more { align-self: center; font-size: 12px; color: var(--ink-subtle); }
.sp-gp-list { list-style: none; margin: 0; padding: 0; }
.sp-gp-tree > li + li { border-top: 1px solid var(--line); }
.sp-gp-row { display: flex; align-items: flex-start; gap: 2px; border-radius: var(--radius-md); }
.sp-gp-row:hover { background: var(--bg-hover); }
.sp-gp-exp { flex: none; width: 28px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-muted); cursor: pointer; }
.sp-gp-exp .sp-icon { width: 16px; height: 16px; }
.sp-gp-exp:hover { color: var(--ink); background: var(--bg-sunken); }
.sp-gp-exp.is-leaf { cursor: default; }
.sp-gp-label { flex: 1; min-width: 0; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto auto; align-items: start; gap: 10px; padding: 8px 8px 8px 2px; cursor: pointer; }
.sp-gp-cb { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand); cursor: pointer; }
.sp-gp-name { font-size: 14px; line-height: 20px; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.sp-gp-row.is-top .sp-gp-name { font-weight: 500; }
.sp-gp-row.is-all .sp-gp-name, .sp-gp-row.is-some .sp-gp-name { font-weight: 600; }
.sp-gp-row.is-all .sp-gp-name { color: var(--brand-ink); }
.sp-gp-label .sp-cat-dot { margin-top: 7px; }
.sp-gp-n { font-size: 12px; line-height: 20px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-gp-row.is-all .sp-gp-n { color: var(--brand-ink); font-weight: 600; }
.sp-gp-list .sp-gp-list { position: relative; }
.sp-gp-exp:focus-visible, .sp-gp-cb:focus-visible, .sp-gp-mopen:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* мобильная шторка групп */
.sp-gp-mtitle { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-gp-mup { font-size: 12px; line-height: 16px; color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-gp-mtitle .sp-facets-title { font-size: 17px; line-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-gp-mback { margin-left: -6px; width: 36px; height: 36px; }
.sp-gp-msearch { position: sticky; top: 0; z-index: 1; padding: 0 0 8px; background: var(--bg-surface); }
.sp-gp-mrow { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.sp-gp-whole { background: var(--bg-page); border-radius: var(--radius-md); border-bottom: 0; margin-bottom: 4px; }
.sp-gp-mlabel { flex: 1; min-width: 0; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 52px; padding: 8px 10px 8px 6px; cursor: pointer; }
.sp-gp-mlabel .sp-gp-cb { width: 22px; height: 22px; margin: 0; }
.sp-gp-mtext { min-width: 0; display: flex; flex-direction: column; }
.sp-gp-mlabel .sp-gp-name { font-size: 15px; line-height: 20px; }
.sp-gp-mrow.is-all .sp-gp-name, .sp-gp-mrow.is-some .sp-gp-name { font-weight: 600; }
.sp-gp-part { font-size: 12px; line-height: 16px; color: var(--brand-ink); }
.sp-gp-mopen { flex: none; width: 52px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--ink-muted); cursor: pointer; }
.sp-gp-mopen .sp-icon { width: 20px; height: 20px; }
.sp-gp-mopen:active { background: var(--bg-hover); }

/* ===== Скидка клиента по группе ===== */
.sp-disc { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; font: 700 11.5px/1 var(--font-sans); font-variant-numeric: tabular-nums; white-space: nowrap; align-self: center; }
.sp-disc.is-client    { background: var(--success-soft); color: var(--success); }
.sp-disc.is-own       { background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--brand-line); }
.sp-disc.is-inherited { background: transparent; color: var(--success); box-shadow: inset 0 0 0 1px var(--success-soft); font-weight: 600; }
.sp-gp-label { grid-template-columns: 18px minmax(0, 1fr) auto auto auto; }
.sp-gp-label .sp-disc { margin-top: 1px; align-self: start; }
.sp-gp-legend .sp-disc { height: 16px; font-size: 10.5px; padding: 0 4px; }

.sp-dbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; order: 10; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-dbar-cap { font-weight: 600; color: var(--ink); }
.sp-dbar-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--bg-sunken); }
.sp-dbar-seg button { height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; font: 500 13px/18px var(--font-sans); color: var(--ink-muted); cursor: pointer; }
.sp-dbar-seg button[aria-checked="true"] { background: var(--bg-surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-item); }
.sp-dbar-seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.sp-dbar .sp-disc { height: 26px; padding: 0 10px; font-size: 14px; border-radius: var(--radius-sm); }
.sp-dbar-step { height: 30px; }
.sp-dbar-step input { width: 46px; }
.sp-dbar-pct { font-weight: 600; color: var(--ink); }
.sp-dbar-note { font-size: 12px; color: var(--ink-subtle); }

.sp-pt-was { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin: 2px 0 1px; font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-pt-was s { text-decoration-thickness: 1px; }
.sp-pt-was .sp-disc { height: 16px; font-size: 10.5px; padding: 0 4px; }
.sp-pt-t .c-price small { display: block; }

.sp-cat-dot.is-off { background: transparent; }
.sp-gp-label { grid-template-columns: 18px minmax(0, 1fr) 7px auto auto; gap: 8px; }
.sp-gp-mlabel { grid-template-columns: 22px minmax(0, 1fr) 7px auto auto; }
.sp-gp-label .sp-gp-n, .sp-gp-mlabel .sp-gp-n { min-width: 26px; text-align: right; }

/* ===== Переключатели «да/нет» в отборе ===== */
.sp-switch { flex: none; position: relative; width: 40px; height: 24px; padding: 0; border: 0; border-radius: var(--radius-pill); background: var(--line-strong); cursor: pointer; transition: background .15s; }
.sp-switch i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg-surface); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.sp-switch.is-on { background: var(--brand); }
.sp-switch.is-on i { transform: translateX(16px); }
.sp-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .sp-switch, .sp-switch i { transition: none; } }
.sp-ftg { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 12px; }
.sp-ftg-row { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-surface); cursor: pointer; transition: border-color .12s, background .12s; }
.sp-ftg-row:hover { border-color: var(--line-strong); }
.sp-ftg-row.is-on { border-color: var(--brand-line); background: var(--brand-soft); }
.sp-ftg-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-ftg-label { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink); }
.sp-ftg-row.is-on .sp-ftg-label { color: var(--brand-ink); }
.sp-ftg-hint { font-size: 12px; line-height: 16px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-sheet-body .sp-ftg { padding-top: 4px; }
.sp-facets-mbtn.is-chip { font-weight: 500; }
.sp-facets-mbtn.is-chip.is-on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); font-weight: 600; }
.sp-facets-mbar { overflow-x: auto; }
.sp-facets-mbtn { flex: none; }
.sp-pt-active { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-pt-fchip { height: 28px; }
.sp-pt-fchip .sp-icon:first-child { width: 13px; height: 13px; }
/* левая колонка прайса из двух карточек: группы (своя прокрутка) + отбор (всегда виден) */
.sp-price-stack { position: sticky; top: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); max-height: calc(100dvh - var(--nav-height) - 2 * var(--space-5)); } /* не выше экрана под шапкой — без двойной прокрутки */
.sp-price-card { background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: var(--space-4); }
.sp-price-card.is-groups { flex: 1 1 auto; min-height: 220px; overflow-y: auto; }
.sp-price-card.is-filters { flex: none; }
@media (max-width: 960px) { .sp-price-stack { position: static; max-height: none; } .sp-price-card.is-groups { max-height: none; } }

/* ===== Верхняя панель: меню «Задачи», режим СВ, обновление ===== */
.sp-tabmenu { position: relative; }
.sp-tab .sp-tab-chev { width: 14px; height: 14px; margin-left: -2px; color: var(--ink-subtle); }
.sp-tab.is-current { color: var(--ink); background: var(--bg-surface); box-shadow: var(--shadow-item); font-weight: 600; }
.sp-tabmenu-pop { left: 0; right: auto; width: 240px; }
.sp-tabmenu-label { flex: 1; min-width: 0; text-align: left; }
.sp-menu-item.is-ai .sp-icon:first-child { color: var(--brand-ink); }
.sp-menu-item .sp-count { margin-left: auto; }
.sp-menu-item .sp-count + .sp-menu-check { margin-left: 6px; }

.sp-sv { position: relative; flex: none; }
.sp-sv-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); font: 500 14px/20px var(--font-sans); color: var(--ink); cursor: pointer; white-space: nowrap; }
.sp-sv-btn:hover, .sp-sv-btn[aria-expanded="true"] { background: var(--bg-hover); }
.sp-sv-role { display: inline-flex; align-items: center; justify-content: center; height: 26px; padding: 0 7px; border-radius: 6px; background: var(--warning-soft); color: var(--warning); font: 700 12px/1 var(--font-sans); letter-spacing: .03em; }
.sp-sv-txt { display: inline-flex; align-items: center; gap: 6px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.sp-sv-txt .sp-icon { width: 15px; height: 15px; color: var(--warning); }
.sp-sv-btn.is-other { border-color: var(--warning); background: var(--warning-soft); }
.sp-sv-btn.is-other .sp-sv-role { background: var(--bg-surface); }
.sp-sv-pop { left: 0; right: auto; width: 300px; }
.sp-sv-wp { font-weight: 600; }
.sp-sv-hint { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--ink-subtle); }
.sp-sv-search { margin: 2px 4px 4px; height: 32px; }
.sp-sv-list { max-height: 260px; overflow-y: auto; }
.sp-sv-me { color: var(--ink-subtle); font-weight: 400; }
.sp-sv-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sp-sync { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: var(--radius-pill); font: 500 12px/16px var(--font-sans); color: var(--ink-subtle); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-sync .sp-icon { width: 14px; height: 14px; }
.sp-sync.is-stale { background: var(--warning-soft); color: var(--warning); }

.sp-viewas { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 var(--space-6); background: var(--warning-soft); border-top: 1px solid var(--line); font: 400 13px/18px var(--font-sans); color: var(--ink); }
.sp-viewas .sp-icon { width: 16px; height: 16px; color: var(--warning); }
.sp-viewas b { font-weight: 650; }
.sp-viewas-back { margin-left: auto; height: 26px; padding: 0 10px; border: 1px solid var(--warning); border-radius: var(--radius-sm); background: var(--bg-surface); font: 600 12px/16px var(--font-sans); color: var(--warning); cursor: pointer; }
.sp-viewas-back:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@container spnav (max-width: 1240px) { .sp-sync-t { display: none; } }
@container spnav (max-width: 1080px) { .sp-sv-txt { display: none; } }

.sp-menu-item.has-hint { height: auto; min-height: 44px; padding-top: 6px; padding-bottom: 6px; }
.sp-menu-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-menu-hint { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-menu-warn { flex: none; height: 20px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--warning-soft); color: var(--warning); font: 600 11px/20px var(--font-sans); }

/* ===== Информационная полоса «настройте почту» ===== */
.sp-notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px var(--space-6); background: var(--brand-soft); border-top: 1px solid var(--line); font-family: var(--font-sans); color: var(--ink); }
.sp-notice-txt { display: flex; flex-direction: column; min-width: 220px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-notice-txt b { font-size: 14px; line-height: 20px; font-weight: 650; color: var(--ink); }
.sp-notice-form { position: relative; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.sp-notice-field input { width: 260px; height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); font: 400 14px/20px var(--font-sans); color: var(--ink); }
.sp-notice-field input::placeholder { color: var(--ink-subtle); }
.sp-notice-field input:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--bg-surface); }
.sp-notice-field.is-err input { border-color: var(--danger); }
.sp-notice-err { position: absolute; left: 0; top: calc(100% + 2px); font-size: 12px; line-height: 16px; color: var(--danger); white-space: nowrap; }
.sp-notice-later { border: 0; background: none; padding: 4px 6px; font: 500 13px/18px var(--font-sans); color: var(--ink-muted); cursor: pointer; border-radius: 4px; }
.sp-notice-later:hover { color: var(--ink); text-decoration: underline; }
.sp-notice-later:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sp-notice.is-done { background: var(--success-soft); font-size: 13px; line-height: 18px; color: var(--ink); }
.sp-notice.is-done > .sp-icon { width: 16px; height: 16px; color: var(--success); }
.sp-notice-x { margin-left: auto; }
.sp-avatar-wrap { position: relative; display: inline-flex; }
.sp-avatar-dot { position: absolute; top: -1px; right: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 2px var(--bg-surface); }
@container spnav (max-width: 1080px) { .sp-notice-field input { width: 200px; } }
.sp-notice .sp-tile { background: var(--bg-surface); width: 32px; height: 32px; } .sp-notice .sp-tile .sp-icon { width: 17px; height: 17px; }

/* ===== Рабочее место СВ ===== */
.sp-sv-page, .sp-sv-page * { box-sizing: border-box; }
.sp-sv-page { padding: var(--space-5) var(--space-6); background: var(--bg-page); font-family: var(--font-sans); color: var(--ink); display: grid; gap: var(--space-4); }
.sp-sv-head { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.sp-sv-head h1 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 650; letter-spacing: -0.015em; }
.sp-sv-head .sp-sv-sub { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-sv-month { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.sp-sv-month b { min-width: 128px; text-align: center; font-size: 15px; font-weight: 650; }
.sp-sv-row2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: var(--space-4); align-items: start; }
@media (max-width: 1100px) { .sp-sv-row2 { grid-template-columns: minmax(0, 1fr); } }

/* KPI-полоса */
.sp-tk { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); overflow: hidden; }
.sp-tk-item { padding: 14px var(--space-5) 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sp-tk-item + .sp-tk-item { border-left: 1px solid var(--line); }
.sp-tk-label { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-tk-label .sp-icon { width: 15px; height: 15px; color: var(--ink-subtle); }
.sp-tk-val { font-size: 14px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-tk-val b { font-size: 26px; line-height: 30px; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
.sp-tk-item.is-bad .sp-tk-val b { color: var(--danger); }
.sp-tk-item.is-warn .sp-tk-val b { color: var(--warning); }
.sp-tk-item.is-ok .sp-tk-val b { color: var(--success); }
.sp-tk-bar { height: 4px; border-radius: var(--radius-pill); background: var(--bg-sunken); overflow: hidden; }
.sp-tk-bar.is-empty { background: transparent; }
.sp-tk-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ink-subtle); }
.sp-tk-item.is-bad .sp-tk-bar i { background: var(--danger); }
.sp-tk-item.is-warn .sp-tk-bar i { background: var(--warning); }
.sp-tk-item.is-ok .sp-tk-bar i { background: var(--success); }
.sp-tk-hint { font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
@media (max-width: 1100px) { .sp-tk { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sp-tk-item + .sp-tk-item { border-left: 0; } .sp-tk-item { border-top: 1px solid var(--line); } }

/* Дисциплина */
.sp-dc { gap: 10px; }
.sp-dc .sp-card-head .sp-tile + .sp-card-title, .sp-ag2 .sp-card-head .sp-tile + .sp-card-title, .sp-tc .sp-card-head .sp-tile + .sp-card-title { font-size: 14px; line-height: 20px; color: var(--ink); }
.sp-dc-norms { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-dc-norms b { color: var(--ink-muted); font-weight: 600; }
.sp-dc-t { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; }
.sp-dc-t th { padding: 0 8px 6px; text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-subtle); border-bottom: 1px solid var(--line); white-space: nowrap; }
.sp-dc-t td { height: 40px; padding: 0 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sp-dc-t tr:last-child td { border-bottom: 0; }
.sp-dc-t .c-name a { color: var(--ink); font-weight: 600; text-decoration: none; }
.sp-dc-t .c-name a:hover { color: var(--brand-ink); text-decoration: underline; }
.sp-dc-t .c-n { width: 32px; text-align: right; }
.sp-dc-t .sp-tagx { height: 20px; font-size: 11.5px; }
.sp-dc-bad { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 6px; background: var(--danger-soft); color: var(--danger); font-size: 13px; font-weight: 600; }
.sp-dc-bad .sp-icon { width: 13px; height: 13px; }
.sp-dc-ok { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-muted); }
.sp-dc-ok .sp-icon { width: 15px; height: 15px; color: var(--success); }
.sp-dc-txt { color: var(--ink-muted); }
.sp-dc-none { color: var(--ink-subtle); }
.sp-dc-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: var(--radius-pill); background: var(--danger); color: var(--bg-surface); font-size: 11px; font-weight: 700; }
.sp-dc-allok { width: 16px; height: 16px; color: var(--success); }

/* Встречи */
.sp-ag2 { gap: 12px; }
.sp-ag2-day { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sp-ag2-day > b { font-size: 15px; line-height: 20px; font-weight: 650; }
.sp-ag2-empty { font-size: 13px; color: var(--ink-subtle); }
.sp-ag2-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.sp-ag2-list li { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; }
.sp-ag2-list time { color: var(--brand-ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.sp-ag2-tp { font-size: 12px; color: var(--ink-subtle); }
.sp-ag2-mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.sp-ag2-wd { text-align: center; font-size: 11px; font-weight: 600; color: var(--ink-subtle); padding-bottom: 2px; }
.sp-ag2-d { position: relative; height: 30px; border: 0; border-radius: var(--radius-sm); background: transparent; font: 500 13px/1 var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink); cursor: pointer; }
.sp-ag2-d:hover { background: var(--bg-hover); }
.sp-ag2-d.is-we, .sp-ag2-d.is-past { color: var(--ink-subtle); }
.sp-ag2-d.is-sel { background: var(--bg-sunken); box-shadow: inset 0 0 0 1.5px var(--ink); }
.sp-ag2-d.is-today { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.sp-ag2-d i { position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--brand); }
.sp-ag2-d:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Календарь команды */
.sp-tc { gap: 10px; padding-bottom: var(--space-4); }
.sp-tc-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-tc-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.sp-tc-norm { color: var(--ink-subtle); }
.sp-tc-sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.sp-tc-scroll { overflow-x: auto; margin: 0 calc(var(--space-5) * -1); padding: 0 var(--space-5); }
.sp-tc-grid { display: grid; min-width: 1120px; column-gap: 3px; row-gap: 0; font-variant-numeric: tabular-nums; }
.sp-tc-h { position: sticky; top: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 40px; padding-bottom: 6px; font-size: 11px; line-height: 13px; color: var(--ink-subtle); border-bottom: 1px solid var(--line); background: var(--bg-surface); }
.sp-tc-h b { font-size: 13px; line-height: 16px; color: var(--ink); font-weight: 600; }
.sp-tc-h.is-we { background: var(--bg-sunken); border-bottom-color: transparent; }
.sp-tc-h.is-today b { min-width: 24px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-pill); background: var(--brand); color: var(--on-brand); }
.sp-tc-corner { position: sticky; left: 0; z-index: 2; align-items: flex-start; font-size: 12px; font-weight: 600; color: var(--ink-subtle); }
.sp-tc-tp { position: sticky; left: 0; z-index: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 60px; padding: 8px 10px 8px 0; background: var(--bg-surface); border-bottom: 1px solid var(--line); }
.sp-tc-tpname { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sp-tc-rank { flex: none; width: 20px; height: 20px; border-radius: 6px; background: var(--bg-sunken); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--ink-muted); }
.sp-tc-tpname a { font-size: 14px; line-height: 18px; font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-tc-tpname a:hover { color: var(--brand-ink); text-decoration: underline; }
.sp-tc-sum { display: flex; gap: 8px; padding-left: 28px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-tc-sumi { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.sp-tc-sumi .sp-icon { width: 12px; height: 12px; color: var(--ink-subtle); }
.sp-tc-sumi.is-bad { color: var(--danger); font-weight: 650; } .sp-tc-sumi.is-warn { color: var(--warning); font-weight: 650; } .sp-tc-sumi.is-ok { color: var(--success); font-weight: 650; }
.sp-tc-c { position: relative; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); padding: 6px 0; }
.sp-tc-c.is-we { background: var(--bg-sunken); border-bottom-color: transparent; }
.sp-tc-c.is-today:not(.sp-tc-btn)::before, .sp-tc-h.is-today::before { content: ''; position: absolute; inset: 0 -2px; background: var(--brand-soft); opacity: .55; z-index: 0; pointer-events: none; }
.sp-tc-empty { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); position: relative; z-index: 1; }
.sp-tc-btn { position: relative; z-index: 1; width: 100%; height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 0; border-radius: 8px; padding: 0; font-family: var(--font-sans); cursor: pointer; border-bottom: 0; }
.sp-tc-c.sp-tc-btn { margin: 7px 0; }
.sp-tc-btn b { font-size: 14px; line-height: 16px; font-weight: 700; }
.sp-tc-s { font-size: 10.5px; line-height: 12px; font-weight: 600; }
.sp-tc-btn .sp-icon { width: 15px; height: 15px; }
.sp-tc-btn:hover { filter: brightness(.96); }
.sp-tc-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.is-ok.sp-tc-btn, .sp-tc-sw.is-ok { background: var(--success-soft); color: var(--success); }
.is-low.sp-tc-btn, .sp-tc-sw.is-low { background: var(--danger-soft); color: var(--danger); }
.is-field.sp-tc-btn, .sp-tc-sw.is-field { background: var(--field-ink); color: var(--bg-surface); }
.is-fplan.sp-tc-btn, .sp-tc-sw.is-fplan { background: var(--field-soft); color: var(--field-ink); box-shadow: inset 0 0 0 1px var(--field-ink); }
.sp-tc-sw.is-fplan { box-shadow: inset 0 0 0 1px var(--field-ink); }
.is-plan.sp-tc-btn, .is-off.sp-tc-btn, .sp-tc-sw.is-plan { background: var(--bg-sunken); color: var(--ink-muted); }
.is-live.sp-tc-btn { background: var(--bg-surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--brand-line); }
.is-live.sp-tc-btn .sp-tc-s { color: var(--brand-ink); }
.sp-tc-btn.is-today:not(.is-live) { box-shadow: 0 0 0 2px var(--brand); }
.sp-tc-meet { position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.sp-tc-btn.is-changed::after { content: ''; position: absolute; left: 3px; top: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.sp-tc-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-tc-hint .sp-icon { width: 13px; height: 13px; }

.sp-tc-h > * { position: relative; z-index: 1; }
.sp-tc-sw { box-shadow: inset 0 0 0 1px var(--line-strong); }
.sp-tc-sw.is-ok { box-shadow: inset 0 0 0 1px var(--success); } .sp-tc-sw.is-low { box-shadow: inset 0 0 0 1px var(--danger); }
.sp-dc-q { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: var(--radius-pill); background: var(--warning-soft); color: var(--warning); font-size: 12px; font-weight: 700; }
.sp-dc-nodata { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 6px; background: var(--warning-soft); color: var(--warning); font-size: 13px; font-weight: 600; }
.sp-dc-nodata .sp-icon { width: 13px; height: 13px; }

/* ===== Специализация клиентов: список ===== */
.sp-spl, .sp-spl * { box-sizing: border-box; }
.sp-spl { display: grid; gap: var(--space-3); padding: var(--space-5) var(--space-6); background: var(--bg-page); font-family: var(--font-sans); color: var(--ink); }
.sp-spl-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.sp-spl-head h1 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 650; letter-spacing: -0.015em; }
.sp-spl-progress { width: 280px; display: flex; flex-direction: column; gap: 6px; }
.sp-spl-ptxt { font-size: 13px; color: var(--ink-muted); text-align: right; } .sp-spl-ptxt b { color: var(--ink); }
.sp-spl-bar { display: flex; height: 6px; border-radius: var(--radius-pill); background: var(--bg-sunken); overflow: hidden; }
.sp-spl-bar i.is-confirmed { background: var(--success); } .sp-spl-bar i.is-filled { background: var(--brand); }
.sp-spl-bar2 { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: 10px 12px; background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); }
.sp-spl-seg button { display: inline-flex; align-items: center; gap: 6px; }
.sp-spl-n { font-size: 12px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-spl-seg button[aria-checked="true"] .sp-spl-n { color: var(--brand-ink); }
.sp-spl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.sp-spl-dot.is-filled { background: var(--brand); } .sp-spl-dot.is-confirmed { background: var(--success); }
.sp-spl-search { flex: 1; min-width: 220px; height: 34px; }
.sp-spl-t td { padding-top: 8px; padding-bottom: 8px; }
.sp-spl-row { cursor: pointer; }
.sp-spl-t .c-name { padding-left: var(--space-4); min-width: 260px; }
.sp-spl-t .c-name .sp-pt-name { font-weight: 600; }
.sp-spl-t th:first-child { padding-left: var(--space-4); }
.sp-spl-t .c-num b { font-weight: 650; }
.sp-spl-cat { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 22px; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--bg-sunken); color: var(--ink-muted); }
.sp-spl-cat.is-ap { background: var(--brand); color: var(--on-brand); } .sp-spl-cat.is-a { background: var(--brand-soft); color: var(--brand-ink); }
.sp-spl-type { color: var(--ink-muted); }
.sp-spl-when { white-space: nowrap; } .sp-spl-when span { display: block; font-size: 13px; } .sp-spl-when small { font-size: 12px; color: var(--ink-subtle); }
.sp-spl-t .c-act { width: 1%; text-align: right; padding-right: var(--space-4); white-space: nowrap; }

/* выбор ТП с группами по СВ */
.sp-tpp { position: relative; flex: none; }
.sp-tpp-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 4px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); font: 500 14px/20px var(--font-sans); color: var(--ink); cursor: pointer; }
.sp-tpp-btn:hover { background: var(--bg-hover); }
.sp-tpp-cap { height: 24px; padding: 0 7px; display: inline-flex; align-items: center; border-radius: 6px; background: var(--bg-sunken); font-size: 11px; font-weight: 700; color: var(--ink-muted); }
.sp-tpp-val { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-tpp-pop { left: 0; right: auto; width: 300px; }
.sp-tpp-list { max-height: 360px; overflow-y: auto; }
.sp-tpp-group { position: sticky; top: 0; display: flex; justify-content: space-between; padding: 10px 10px 4px; background: var(--bg-surface); font-size: 12px; font-weight: 650; color: var(--ink-muted); }
.sp-tpp-item { padding-left: 22px; height: 32px; }
.sp-tpp-n { margin-left: auto; font-size: 12px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-tpp-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ===== Специализация: карточка (панель справа) ===== */
.sp-spc, .sp-spc * { box-sizing: border-box; }
.sp-spc { width: 100%; max-width: 760px; height: 100%; display: flex; flex-direction: column; background: var(--bg-surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop); font-family: var(--font-sans); color: var(--ink); }
.sp-spc-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 24px 14px; border-bottom: 1px solid var(--line); }
.sp-spc-title { flex: 1; min-width: 0; }
.sp-spc-kicker { font-size: 12px; font-weight: 600; color: var(--ink-subtle); text-transform: uppercase; letter-spacing: .04em; }
.sp-spc-title h2 { margin: 2px 0 6px; font-size: 20px; line-height: 26px; font-weight: 650; }
.sp-spc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-muted); }
.sp-spc-body { flex: 1; overflow-y: auto; padding: 16px 24px 8px; display: flex; flex-direction: column; gap: 18px; }
.sp-spc-step { display: flex; flex-direction: column; gap: 10px; }
.sp-spc-steph { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 650; }
.sp-spc-num { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-sunken); color: var(--ink-muted); font-size: 12px; font-weight: 700; }
.sp-spc-num.is-done { background: var(--success); color: var(--bg-surface); } .sp-spc-num .sp-icon { width: 13px; height: 13px; stroke-width: 2.5; }
.sp-spc-cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sp-spc-cat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); text-align: left; cursor: pointer; font-family: var(--font-sans); color: var(--ink); }
.sp-spc-cat b { font-size: 16px; line-height: 20px; } .sp-spc-cat span { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-spc-cat:hover { border-color: var(--brand); }
.sp-spc-cat.is-on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); } .sp-spc-cat.is-on b { color: var(--brand-ink); }
.sp-spc-types { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-spc-type { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--bg-surface); font: 500 13px/18px var(--font-sans); color: var(--ink); cursor: pointer; }
.sp-spc-type:hover { border-color: var(--brand); }
.sp-spc-type.is-on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; }
.sp-spc-type .sp-icon { width: 14px; height: 14px; stroke-width: 2.4; }
.sp-spc-cnt { font-size: 12px; font-weight: 500; color: var(--ink-subtle); }
.sp-spc-rest { margin-left: auto; font-size: 12px; }
.sp-spc-colh { position: sticky; top: -16px; z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr) 110px 172px; align-items: end; gap: 8px; padding: 8px 8px 6px 36px; background: var(--bg-surface); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 600; color: var(--ink-subtle); text-transform: uppercase; letter-spacing: .03em; }
.sp-spc-colh > span:nth-child(2) { text-align: right; }
.sp-spc-period { display: block; font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--ink-subtle); white-space: nowrap; } /* CRM: период продаж под заголовком колонки */
.sp-spc-legend { display: grid; grid-template-columns: repeat(4, 40px); gap: 4px; text-transform: none; letter-spacing: 0; }
.sp-spc-legend > span { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 9.5px; line-height: 11px; font-weight: 500; text-align: center; color: var(--ink-subtle); }
.sp-spc-legend b { font-size: 12px; color: var(--ink); }
.sp-spc-list { display: flex; flex-direction: column; }
.sp-spc-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 110px 172px; align-items: center; gap: 8px; min-height: 42px; padding-right: 8px; border-bottom: 1px solid var(--line); }
.sp-spc-row:hover { background: var(--bg-page); }
.sp-spc-row.is-top .sp-spc-name { font-weight: 650; }
.sp-spc-row.is-empty .sp-spc-name::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border-radius: 50%; background: var(--warning); vertical-align: middle; }
.sp-spc-name { font-size: 14px; line-height: 19px; min-width: 0; }
.sp-spc-inh { margin-left: 8px; font-size: 11px; font-weight: 500; color: var(--ink-subtle); }
.sp-spc-sales { text-align: right; font-size: 12px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-spc-sales.has { color: var(--ink); font-weight: 600; }
.sp-abc { display: grid; grid-template-columns: repeat(4, 40px); gap: 4px; }
.sp-abc-b { height: 30px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-surface); font: 700 13px/1 var(--font-sans); color: var(--ink-subtle); cursor: pointer; }
.sp-abc-b:hover { border-color: var(--ink-muted); color: var(--ink); }
.sp-abc-b.is-a.is-on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.sp-abc-b.is-b.is-on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.sp-abc-b.is-c.is-on { background: var(--field-soft); border-color: var(--field-ink); color: var(--field-ink); }
.sp-abc-b.is-z.is-on { background: var(--bg-hover); border-color: var(--ink-muted); color: var(--ink); }
.sp-abc-b.is-ghost { border-style: dashed; color: var(--ink-muted); }
.sp-abc-b.is-a.is-ghost, .sp-abc-b.is-b.is-ghost { border-color: var(--brand); color: var(--brand-ink); }
.sp-abc-b.is-c.is-ghost { border-color: var(--field-ink); color: var(--field-ink); }
.sp-abc-b:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.sp-spc-foot { display: flex; flex-direction: column; gap: 10px; padding: 12px 24px 16px; border-top: 1px solid var(--line); background: var(--bg-surface); }
.sp-spc-foot > .sp-link { align-self: flex-start; }
.sp-spc-note { width: 100%; min-height: 56px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); font: 400 14px/20px var(--font-sans); color: var(--ink); resize: vertical; }
.sp-spc-actions { display: flex; align-items: center; gap: 12px; }
.sp-spc-hint { flex: 1; font-size: 12px; color: var(--ink-subtle); }
.sp-spc-actions .sp-btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.sp-spc-cat:focus-visible, .sp-spc-type:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 640px) { .sp-spc-cats { grid-template-columns: repeat(2, 1fr); } .sp-spc-row, .sp-spc-colh { grid-template-columns: 28px minmax(0, 1fr) 172px; } .sp-spc-sales, .sp-spc-colh > span:nth-child(2) { display: none; } }

.sp-spl .sp-sv-sub { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-spc-key { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-spc-key > span { display: inline-flex; align-items: center; gap: 6px; }
.sp-spc-key .sp-abc-b { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 20px; font-size: 11px; cursor: default; }
.sp-spc-letters > span { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-muted); }
.sp-spc-colh { align-items: center; }

/* ===== Планирование клиента ===== */
.sp-pl, .sp-pl *, .sp-plm, .sp-plm *, .sp-qt, .sp-qt * { box-sizing: border-box; }
.sp-pl, .sp-plm { display: flex; flex-direction: column; gap: 10px; font-family: var(--font-sans); color: var(--ink); }
.sp-pl-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-xl); overflow: hidden; }
.sp-pl-sum > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; background: var(--bg-surface); }
.sp-pl-sum span { font-size: 12px; color: var(--ink-muted); }
.sp-pl-sum b { font-size: 20px; line-height: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.sp-pl-sum small { font-size: 12px; color: var(--ink-subtle); }
.sp-pl-sum .is-low b, .sp-pl-sum .is-low small { color: var(--danger); }
.sp-pl-sum .is-brand b { color: var(--brand-ink); }
.sp-pl-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sp-pl-lv { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-size: 12px; color: var(--ink-subtle); }
.sp-pl-lv span { margin-right: 4px; }
.sp-qt-chip { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 30px; height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--bg-surface); font: 500 13px/18px var(--font-sans); color: var(--ink); cursor: pointer; white-space: nowrap; }
.sp-qt-chip:hover { border-color: var(--brand); }
.sp-qt-chip.is-on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; }
.sp-qt-chip.is-why.is-on { background: var(--brand-soft); color: var(--brand-ink); }
.sp-qt-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sp-pl-wrap { overflow: visible; }
.sp-pl-t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
.sp-pl-t thead th { position: sticky; top: 0; z-index: 3; background: var(--bg-surface); padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--ink-subtle); text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sp-pl-t thead tr:first-child th { padding-top: 10px; }
.sp-pl-t thead th.c-name { text-align: left; }
.sp-pl-t th.c-yh { text-align: center; border-bottom: 2px solid var(--line-strong); color: var(--ink-muted); }
.sp-pl-t th.c-yh.y26 { color: var(--ink); border-bottom-color: var(--brand); }
.sp-pl-t th small { font-weight: 400; }
.sp-pl-t td { padding: 0 8px; height: 36px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; color: var(--ink); }
.sp-pl-t .c-chk { width: 36px; padding-left: 14px; padding-right: 0; text-align: left; }
.sp-pl-t .c-chk input { width: 16px; height: 16px; margin: 0; display: block; accent-color: var(--brand); cursor: pointer; }
.sp-pl-t .c-name { text-align: left; min-width: 300px; white-space: normal; }
.sp-pl-name { display: flex; align-items: center; gap: 2px; }
.sp-pl-name .sp-gp-exp { height: 28px; width: 26px; }
.sp-pl-label { padding: 6px 0; }
.sp-pl-t .c-plan { font-weight: 650; color: var(--brand-ink); }
.sp-pl-t .c-w { color: var(--ink-muted); border-right: 1px solid var(--line); }
.sp-pl-t td.c-m.y25 { color: var(--ink-subtle); }
.sp-pl-t td.c-m.y25:last-of-type, .sp-pl-t th.c-m.y25:last-of-type { border-right: 1px solid var(--line); }
.sp-pl-t td.c-m.y26 { font-weight: 500; }
.sp-pl-t td.c-m.is-low { color: var(--danger); font-weight: 600; }
.sp-pl-t td.c-m.is-low::before { content: '↓ '; font-size: 10px; }
.sp-pl-t td.c-m.is-partial { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--bg-sunken) 6px 7px); }
.sp-pl-t .c-fc { font-weight: 650; border-left: 1px solid var(--line); }
.sp-pl-t .c-task { position: relative; width: 120px; text-align: left; padding-right: 14px; }
.sp-pl-r.l1 td { background: var(--bg-surface); }
.sp-pl-r.l1 .sp-pl-label { font-weight: 650; }
.sp-pl-r.l2 .sp-pl-label { font-weight: 500; }
.sp-pl-r.l3 td, .sp-pl-r.l4 td { height: 32px; font-size: 12.5px; }
.sp-pl-r.l4 .sp-pl-label { color: var(--ink-muted); }
.sp-pl-r:hover td { background: var(--bg-page); }
.sp-pl-r.is-sel td { background: color-mix(in srgb, var(--brand-soft) 60%, var(--bg-surface)); }
.sp-pl-r.is-qt td { background: var(--brand-soft); }
.sp-pl-r.is-dim td { color: var(--ink-subtle); }
.sp-pl-total td { height: 40px; background: var(--bg-sunken); font-weight: 700; border-bottom: 1px solid var(--line-strong); }
.sp-pl-total td.c-m.y25 { color: var(--ink-muted); }
.sp-pl-add { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px 0 6px; border: 1px dashed var(--line-strong); border-radius: var(--radius-pill); background: transparent; font: 600 12px/16px var(--font-sans); color: var(--ink-muted); cursor: pointer; opacity: .55; transition: opacity .12s; }
.sp-pl-add .sp-icon { width: 14px; height: 14px; stroke-width: 2.2; }
.sp-pl-r:hover .sp-pl-add, .sp-pl-add:focus-visible, .sp-pl-r.is-qt .sp-pl-add { opacity: 1; border-style: solid; border-color: var(--brand); color: var(--brand-ink); background: var(--bg-surface); }
.sp-pl-add:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sp-pl-task { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--success-soft); color: var(--success); font-size: 12px; font-weight: 650; }
.sp-pl-task .sp-icon { width: 13px; height: 13px; stroke-width: 2.4; }
.sp-pl-task small { font-weight: 500; opacity: .85; }
.sp-pl-task.is-new { box-shadow: 0 0 0 2px var(--success-soft), 0 0 0 3px var(--success); }
.sp-pl-bulk { position: sticky; bottom: 12px; z-index: 5; align-self: center; display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 16px; border-radius: var(--radius-pill); background: var(--ink); color: var(--bg-surface); font-size: 13px; box-shadow: var(--shadow-pop); }
.sp-pl-bulk b { font-weight: 650; }
.sp-pl-bulk .sp-facet-reset { color: var(--bg-sunken); }
.sp-pl-bulk .sp-btn-primary { background: var(--bg-surface); color: var(--ink); border-radius: var(--radius-pill); }

/* быстрая задача */
.sp-qt { display: flex; flex-direction: column; gap: 10px; font-family: var(--font-sans); color: var(--ink); text-align: left; white-space: normal; }
.sp-qt.is-pop { position: absolute; z-index: 20; right: 8px; top: calc(100% - 4px); width: 400px; padding: 14px; background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.sp-qt.is-sheet { padding: 4px 16px 16px; max-height: none; }
.sp-qt-head { display: flex; align-items: flex-start; gap: 8px; }
.sp-qt-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-qt-kicker { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-subtle); }
.sp-qt-head b { font-size: 15px; line-height: 20px; font-weight: 650; }
.sp-qt-path { font-size: 12px; color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-qt-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp-qt-sum { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--ink-subtle); }
.sp-qt-sumf { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 10px; border: 1px solid var(--brand); border-radius: var(--radius-md); font: 650 16px/20px var(--font-sans); color: var(--ink); }
.sp-qt-sumf input { width: 84px; border: 0; outline: none; background: transparent; font: inherit; color: inherit; text-align: right; font-variant-numeric: tabular-nums; }
.sp-qt-quick, .sp-qt-due, .sp-qt-why { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-qt-quick { align-self: flex-end; }
.sp-qt-hint { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--radius-md); background: var(--brand-soft); font-size: 12px; color: var(--brand-ink); }
.sp-qt-hint .sp-icon { width: 13px; height: 13px; }
/* CRM: правила постановки (допланирование) — минимальная сумма, ошибка сервера, запрет на строке */
.sp-qt-min { font-size: 12px; color: var(--ink-muted); }
.sp-qt-min.is-low { color: var(--danger); font-weight: 600; }
.sp-qt-err { padding: 6px 10px; border-radius: var(--radius-md); background: var(--danger-soft); color: var(--danger); font-size: 12.5px; }
.sp-qt-chip:disabled { opacity: .45; cursor: not-allowed; border-color: var(--line-strong); }
.sp-qt-go:disabled { opacity: .55; cursor: not-allowed; }
.sp-pl-deny { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--bg-sunken); font-size: 11.5px; color: var(--ink-muted); cursor: help; }
.sp-qt .sp-dbar-seg button { display: inline-flex; align-items: center; gap: 5px; }
.sp-qt .sp-dbar-seg .sp-icon { width: 14px; height: 14px; }
.sp-qt-foot { display: flex; }
.sp-qt-go { flex: 1; justify-content: center; height: 40px; }
.sp-qt.is-sheet .sp-qt-go { height: 48px; font-size: 15px; border-radius: var(--radius-lg); }
.sp-qt.is-sheet .sp-qt-chip { height: 34px; }

/* мобильная версия */
.sp-plm .sp-pl-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sp-plm .sp-pl-sum b { font-size: 17px; line-height: 22px; }
.sp-plm .sp-pl-bar { justify-content: space-between; }
.sp-plm .sp-pl-bar .sp-dbar-seg { overflow-x: auto; max-width: 100%; }
.sp-plm-list { list-style: none; margin: 0; padding: 0; background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-xl); overflow: hidden; }
.sp-plm-r { display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px; border-bottom: 1px solid var(--line); min-height: 56px; }
.sp-plm-r.is-sel { background: var(--brand-soft); }
.sp-plm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border: 0; background: none; text-align: left; font-family: var(--font-sans); color: var(--ink); cursor: pointer; }
.sp-plm-name { display: flex; align-items: center; gap: 4px; font-size: 15px; line-height: 20px; }
.sp-plm-name .sp-icon { width: 16px; height: 16px; flex: none; color: var(--ink-subtle); }
.sp-plm-r.l1 .sp-plm-name { font-weight: 650; }
.sp-plm-r.l3 .sp-plm-name, .sp-plm-r.l4 .sp-plm-name { font-size: 14px; }
.sp-plm-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; padding-left: 20px; font-size: 12px; line-height: 16px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.sp-plm-meta b { color: var(--ink); font-weight: 600; }
.sp-plm-meta .is-low { color: var(--danger); font-weight: 600; } .sp-plm-meta .is-up { color: var(--success); font-weight: 600; }
.sp-plm .sp-pl-add { opacity: 1; width: 44px; height: 44px; padding: 0; justify-content: center; border-style: solid; border-color: var(--brand-line); border-radius: var(--radius-md); color: var(--brand-ink); background: var(--brand-soft); }
.sp-plm .sp-pl-add .sp-icon { width: 20px; height: 20px; }
.sp-plm .sp-pl-task { flex: none; }
.sp-plm .sp-pl-bulk { position: sticky; bottom: 8px; align-self: stretch; border-radius: var(--radius-lg); flex-wrap: wrap; justify-content: space-between; }
.sp-plm .sp-pl-bulk .sp-btn { width: 100%; justify-content: center; height: 44px; }

/* вкладки клиента */
.sp-ctabs { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-md); background: var(--bg-sunken); align-self: flex-start; }
.sp-ctabs button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border: 0; border-radius: var(--radius-sm); background: transparent; font: 500 14px/20px var(--font-sans); color: var(--ink-muted); cursor: pointer; }
.sp-ctabs button[aria-selected="true"] { background: var(--bg-surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-item); }
.sp-ctabs .sp-spl-n { font-size: 12px; }
.sp-pl-sum .is-up b { color: var(--success); }
.sp-plm .sp-pl-bar .sp-dbar-seg { display: flex; flex-wrap: nowrap; overflow-x: auto; flex: 1; min-width: 0; }
.sp-plm .sp-dbar-seg button { white-space: nowrap; flex: none; }
.sp-plm .sp-pl-bar { flex-wrap: nowrap; }
.sp-plm .sp-pl-bulk > span { flex: 1; min-width: 0; }

.sp-pl-t .c-name { padding-left: 14px; }
.sp-pl-t thead th.c-name { padding-left: 14px; }
.sp-pl-subtasks { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--bg-sunken); font-size: 11.5px; font-weight: 600; color: var(--ink-muted); }
.sp-plm-cbsp { width: 22px; flex: none; }

/* мобильный: иерархия разделов и подгрупп */
.sp-plm-list { background: var(--bg-surface); }
.sp-plm-r { padding: 0 10px 0 0; gap: 6px; }
.sp-plm-main { padding-left: 12px; }
.sp-plm-r.l1 { background: var(--bg-surface); }
.sp-plm-r.l1 + .sp-plm-r.l1 { border-top: 0; }
.sp-plm-r.l1 .sp-plm-name { font-size: 15px; font-weight: 650; }
.sp-plm-r.l1.is-open { background: var(--bg-sunken); border-bottom-color: var(--line-strong); } /* серым — только раскрытый раздел */
.sp-plm-r.l2 .sp-plm-main { padding-left: 32px; }
.sp-plm-r.l3 .sp-plm-main { padding-left: 50px; }
.sp-plm-r.l4 .sp-plm-main { padding-left: 68px; }
.sp-plm-r.l2, .sp-plm-r.l3, .sp-plm-r.l4 { position: relative; }
.sp-plm-r.l2::before, .sp-plm-r.l3::before, .sp-plm-r.l4::before { content: ''; position: absolute; top: 0; bottom: 0; left: 20px; width: 2px; background: var(--brand-line); }
.sp-plm-r.l3::after, .sp-plm-r.l4::after { content: ''; position: absolute; top: 0; bottom: 0; left: 38px; width: 2px; background: var(--brand-line); opacity: .6; }
.sp-plm-r.l2 .sp-plm-name, .sp-plm-r.l3 .sp-plm-name, .sp-plm-r.l4 .sp-plm-name { font-size: 14px; font-weight: 500; }
.sp-plm-r.l3 .sp-plm-name, .sp-plm-r.l4 .sp-plm-name { color: var(--ink-muted); }
.sp-plm-name { align-items: flex-start; }
.sp-plm-name .sp-icon { margin-top: 2px; }
.sp-plm-dot { flex: none; width: 6px; height: 6px; margin: 7px 5px 0 2px; border-radius: 50%; background: var(--brand-line); }
.sp-plm-r.l2 .sp-plm-meta, .sp-plm-r.l3 .sp-plm-meta, .sp-plm-r.l4 .sp-plm-meta { padding-left: 13px; }
.sp-plm-r.l1 .sp-plm-meta { padding-left: 20px; }
.sp-plm-pick { flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); cursor: pointer; }
.sp-plm-pick:hover { background: var(--bg-hover); }
.sp-plm-r.is-sel { background: var(--brand-soft); }

/* ===== Правки после проверки локальной CRM (28.10) ===== */
/* карточка задачи: одна главная кнопка — «Сохранить отметку»; «Продать» — мягкая фирменная */
.sp-task-save { justify-content: center; }
.sp-task-empty { margin: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); font-size: 13px; line-height: 18px; color: var(--ink-subtle); }
.sp-task-empty .sp-icon { width: 15px; height: 15px; flex: none; }
.sp-task-mark textarea { min-height: 52px; }
/* мобильная строка плана: тренд не разрывается */
.sp-plm-trend { white-space: nowrap; }
/* нижняя панель разделов — только на телефоне */
.sp-nav-bottom { display: none; }
@media (max-width: 640px) {
  .sp-nav-row { padding: 0 12px; gap: 8px; }
  .sp-nav-row > .sp-tabs, .sp-nav .sp-sync, .sp-nav .sp-vsep { display: none; }
  .sp-nav .sp-sv-txt { display: none; }
  .sp-nav .sp-tabs.sp-nav-bottom {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 0; border-radius: 0;
    background: var(--bg-surface); border-top: 1px solid var(--line);
  }
  .sp-nav-bottom > .sp-tab, .sp-nav-bottom > .sp-tabmenu { flex: 1 1 0; min-width: 0; }
  .sp-nav-bottom .sp-tab { width: 100%; height: 52px; flex-direction: column; justify-content: center; gap: 2px; padding: 0 2px; font-size: 11px; line-height: 14px; font-weight: 500; }
  .sp-nav-bottom .sp-tab .sp-icon { width: 22px; height: 22px; }
  .sp-nav-bottom .sp-tab-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .sp-nav-bottom .sp-tab-label::after { display: none; }
  .sp-nav-bottom .sp-tab-chev { display: none; }
  .sp-nav-bottom .sp-count { position: absolute; top: 3px; left: calc(50% + 5px); min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
  .sp-nav-bottom .sp-tab[aria-current="page"], .sp-nav-bottom .sp-tab.is-current { background: var(--brand-soft); color: var(--brand-ink); box-shadow: none; font-weight: 600; }
  .sp-nav-bottom .sp-tabmenu-pop { top: auto; bottom: calc(100% + 8px); left: 4px; }
  body:has(.sp-nav-bottom) { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* ===== Календарь на главной (v2): итоги-легенда, плотная сетка, неделя на телефоне ===== */
.sp-fc, .sp-fc * { box-sizing: border-box; }
.sp-fc { container: spfc / inline-size; display: flex; flex-direction: column; gap: 12px; }
.sp-fc-card .sp-card-head { min-height: 28px; }
.sp-fc-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.sp-fc-k { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "m n" "l l"; align-items: center; column-gap: 6px; padding: 8px 10px; background: var(--bg-surface); border: 0; font-family: var(--font-sans); text-align: left; color: var(--ink); min-width: 0; }
.sp-fc-k > i, .sp-fc-k > .sp-icon { grid-area: m; }
.sp-fc-k > i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.sp-fc-k > .sp-icon { width: 14px; height: 14px; color: var(--ink-subtle); }
.sp-fc-k b { grid-area: n; font-size: 18px; line-height: 22px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.sp-fc-k span { grid-area: l; font-size: 12px; line-height: 16px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-fc-k.is-field > i { background: var(--field-soft); box-shadow: inset 0 0 0 1px var(--field-ink); }
.sp-fc-k.is-field b { color: var(--field-ink); }
.sp-fc-k.is-office > i { background: var(--office-soft); box-shadow: inset 0 0 0 1px var(--office-ink); }
.sp-fc-k.is-office b { color: var(--office-ink); }
.sp-fc-k.is-bad { background: var(--danger-soft); cursor: pointer; }
.sp-fc-k.is-bad b, .sp-fc-k.is-bad .sp-icon, .sp-fc-k.is-bad span { color: var(--danger); }
.sp-fc-k.is-bad span { font-weight: 600; }
.sp-fc-k.is-bad:hover { filter: brightness(.97); }
.sp-fc-k.is-ok .sp-icon, .sp-fc-k.is-ok b { color: var(--success); }

.sp-fc-grid { display: flex; flex-direction: column; gap: 3px; }
.sp-fc-week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .62fr)); gap: 3px; }
.sp-fc-wd { text-align: center; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-subtle); padding-bottom: 2px; }
.sp-fc-c { position: relative; height: 44px; min-width: 0; border: 0; border-radius: var(--radius-md); background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; font: 600 14px/18px var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink); transition: background .12s, filter .12s; }
.sp-fc-c:hover { background: var(--bg-hover); }
.sp-fc-c.is-field { background: var(--field-soft); color: var(--field-ink); }
.sp-fc-c.is-office { background: var(--office-soft); color: var(--office-ink); font-weight: 500; }
.sp-fc-c.is-field:hover, .sp-fc-c.is-office:hover { filter: brightness(.97); }
.sp-fc-c.is-we { color: var(--ink-subtle); font-weight: 500; }
/* CRM (аудит 30.10, WCAG 1.4.1/1.4.11): тип дня не только оттенком фона — поле рамкой, офис точкой;
   прошедшие дни приглушены цветом текста, а не полупрозрачностью (opacity .5 давала ~3,6:1) */
.sp-fc-c.is-field { box-shadow: inset 0 0 0 1px var(--field-ink); }
.sp-fc-c.is-office::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--office-ink); }
.sp-fc-c.is-past:not(.st-overdue):not(.is-sel) { color: var(--ink-subtle); }
.sp-fc-c.is-past.is-field:not(.st-overdue):not(.is-sel) { box-shadow: inset 0 0 0 1px var(--line-strong); }
.sp-fc-n { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 20px; border-radius: var(--radius-pill); }
.sp-fc-c.is-today .sp-fc-n { background: var(--brand); color: var(--on-brand); font-weight: 700; }
.sp-fc-v { display: inline-flex; align-items: center; justify-content: center; gap: 1px; min-width: 16px; height: 14px; padding: 0 4px; border-radius: var(--radius-pill); font: 700 11px/14px var(--font-sans); }
.sp-fc-v .sp-icon { width: 12px; height: 12px; stroke-width: 3; }
.sp-fc-c.st-done .sp-fc-v { color: var(--success); }
.sp-fc-c.st-overdue { box-shadow: inset 0 0 0 2px var(--danger); }
.sp-fc-c.st-overdue .sp-fc-v { background: var(--danger); color: var(--bg-surface); }
.sp-fc-c.is-sel { box-shadow: inset 0 0 0 2px var(--brand); }
.sp-fc-c.is-today.is-sel { box-shadow: none; }
.sp-fc-c:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sp-fc-more { display: none; align-items: center; justify-content: center; gap: 4px; height: 32px; margin-top: -4px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--brand-ink); font: 600 13px/18px var(--font-sans); cursor: pointer; }
.sp-fc-more:hover { background: var(--brand-soft); }
.sp-fc-more .sp-icon { width: 14px; height: 14px; }

.sp-fc-day { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 8px 8px 10px; border-radius: var(--radius-md); background: var(--bg-sunken); }
.sp-fc-day.is-field { background: var(--field-soft); }
.sp-fc-day.is-office { background: var(--office-soft); }
.sp-fc-day.is-overdue { background: var(--danger-soft); }
.sp-fc-day-ico { flex: none; width: 28px; height: 28px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; background: var(--bg-surface); color: var(--ink-muted); }
.sp-fc-day.is-field .sp-fc-day-ico { color: var(--field-ink); }
.sp-fc-day.is-office .sp-fc-day-ico { color: var(--office-ink); }
.sp-fc-day.is-overdue .sp-fc-day-ico { color: var(--danger); }
.sp-fc-day-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-fc-day-txt b { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink); }
.sp-fc-day-txt span { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-fc-day.is-overdue .sp-fc-day-txt span { color: var(--danger); font-weight: 500; }
.sp-fc-next { flex: none; display: flex; flex-direction: column; align-items: flex-end; padding: 4px 10px; border: 0; border-radius: var(--radius-sm); background: var(--bg-surface); font-family: var(--font-sans); cursor: pointer; text-align: right; }
.sp-fc-next small { font-size: 11px; line-height: 14px; color: var(--ink-subtle); }
.sp-fc-next span { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--field-ink); white-space: nowrap; }
.sp-fc-next:hover { box-shadow: inset 0 0 0 1px var(--field-ink); }
.sp-fc-next:focus-visible, .sp-fc-more:focus-visible, .sp-fc-k.is-bad:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* узко (телефон, узкая колонка): показываем текущую неделю, месяц — по кнопке */
@container spfc (max-width: 400px) {
  .sp-fc:not(.is-all) .sp-fc-week:not(.is-cur):not(.sp-fc-wds) { display: none; }
  .sp-fc-more { display: flex; }
  .sp-fc-c { height: 48px; }
  .sp-fc-k { padding: 8px 8px; column-gap: 5px; }
  .sp-fc-k b { font-size: 17px; }
  .sp-fc-k span { font-size: 11px; }
}

/* ===== Задачи на сегодня (главная ТП) ===== */
.sp-tt, .sp-tt * { box-sizing: border-box; }
.sp-tt-card { gap: 12px; }
.sp-tt { container: sptt / inline-size; display: flex; flex-direction: column; gap: 12px; }
.sp-tt-total { font-size: 13px; line-height: 18px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.sp-tt-total b { color: var(--ink); font-weight: 650; }
.sp-tt-donen { color: var(--success); font-weight: 600; }

/* «Сейчас» — ближайший звонок ко времени */
.sp-tt-now { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; border-radius: var(--radius-lg); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-line); }
.sp-tt-now.is-late { background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger-line); }
.sp-tt-now-k { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand-ink); }
.sp-tt-now-k .sp-icon { width: 14px; height: 14px; }
.sp-tt-now.is-late .sp-tt-now-k { color: var(--danger); }
.sp-tt-now-body { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.sp-tt-now-time { font-size: 30px; line-height: 34px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.sp-tt-now.is-late .sp-tt-now-time { color: var(--danger); }
.sp-tt-now-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; text-decoration: none; color: inherit; }
.sp-tt-now-client { display: flex; align-items: center; gap: 8px; font-size: 17px; line-height: 22px; font-weight: 650; color: var(--ink); }
.sp-tt-now-main:hover .sp-tt-now-client { color: var(--brand-ink); }
.sp-tt-now-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp-tt-callbig { text-decoration: none; }
.sp-tt-next { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px; border-radius: var(--radius-md); background: var(--bg-sunken); font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-tt-next .sp-icon { width: 14px; height: 14px; }
.sp-tt-next b { color: var(--ink); font-weight: 600; }

/* список */
.sp-tt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.sp-tt-sec { display: flex; align-items: baseline; gap: 6px; padding: 10px 4px 6px; font-size: 11px; line-height: 16px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-subtle); }
.sp-tt-sec:first-child { padding-top: 0; }
.sp-tt-sec b { font-weight: 700; color: var(--ink-muted); }
.sp-tt-sec small { margin-left: auto; font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.sp-tt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: 14px; padding: 10px 8px 10px 10px; border-top: 1px solid var(--line); border-radius: 0; }
.sp-tt-sec + .sp-tt-row { border-top-color: transparent; }
.sp-tt-row:hover { background: var(--bg-hover); border-radius: var(--radius-md); }
.sp-tt-row:hover + .sp-tt-row { border-top-color: transparent; }
.sp-tt-row.is-deal { box-shadow: inset 3px 0 0 var(--success); }
.sp-tt-row.is-open { background: var(--bg-sunken); border-radius: var(--radius-md); }
.sp-tt-time { display: flex; flex-direction: column; align-items: flex-start; color: var(--ink-subtle); }
.sp-tt-time b { font-size: 16px; line-height: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.sp-tt-time small { font-size: 11px; line-height: 14px; color: var(--ink-subtle); white-space: nowrap; }
.sp-tt-row.is-late .sp-tt-time b, .sp-tt-row.is-late .sp-tt-time small { color: var(--danger); }
.sp-tt-time .sp-icon { width: 16px; height: 16px; margin-left: 2px; }
.sp-tt-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
.sp-tt-client { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sp-tt-cn { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-tt-main:hover .sp-tt-cn { color: var(--brand-ink); }
.sp-tt-cat { flex: none; display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; background: var(--bg-sunken); font: 700 11px/1 var(--font-sans); color: var(--ink-muted); }
.sp-tt-sub { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.sp-tt-groups { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-tt-note { font-size: 12px; line-height: 16px; color: var(--ink-subtle); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-tt-st { flex: none; display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px; border-radius: var(--radius-pill); font: 600 12px/1 var(--font-sans); white-space: nowrap; }
.sp-tt-st .sp-icon { width: 12px; height: 12px; stroke-width: 2.5; }
.sp-tt-st.is-ok { background: var(--success-soft); color: var(--success); }
.sp-tt-st.is-brand { background: var(--brand-soft); color: var(--brand-ink); }
.sp-tt-st.is-neutral { background: var(--bg-sunken); color: var(--ink-muted); }
.sp-tt-st.is-bad { background: var(--danger-soft); color: var(--danger); }
.sp-tt-now .sp-tt-st.is-neutral, .sp-tt-row.is-open .sp-tt-st.is-neutral { background: var(--bg-surface); }
.sp-tt-sum { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.sp-tt-sum b { font-size: 15px; line-height: 20px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.sp-tt-sum small { font-size: 11px; line-height: 14px; color: var(--ink-subtle); white-space: nowrap; }
.sp-tt-sum.is-big b { font-size: 20px; line-height: 24px; }
.sp-tt-act { display: flex; align-items: center; gap: 6px; }
.sp-tt-call { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; }
.sp-tt-call:hover { background: var(--brand); color: var(--on-brand); }
.sp-tt-call .sp-icon { width: 17px; height: 17px; }
.sp-tt-markbtn { height: 36px; }
.sp-tt-call:focus-visible, .sp-tt-main:focus-visible, .sp-tt-now-main:focus-visible, .sp-tt-markbtn:focus-visible, .sp-tt-callbig:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sp-tt-empty { display: flex; align-items: center; gap: 8px; padding: 16px; border-radius: var(--radius-md); background: var(--success-soft); color: var(--success); font-size: 14px; font-weight: 600; }

/* отметка в строке */
.sp-tt-mark { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 12px; border-radius: var(--radius-md); background: var(--bg-surface); border: 1px solid var(--line); }
.sp-tt-now .sp-tt-mark { margin-top: 0; }
.sp-tt-mark-row { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.sp-tt-mark-cap { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); margin-right: 2px; }
.sp-tt-mark .sp-dbar-seg button.is-deal[aria-checked="true"] { color: var(--success); }
.sp-tt-mark .sp-dbar-seg button.is-fail[aria-checked="true"] { color: var(--danger); }
.sp-tt-mark-in { flex: 1 1 200px; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); font: 400 14px/20px var(--font-sans); color: var(--ink); }
.sp-tt-mark-in:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.sp-tt-mark-in::placeholder { color: var(--ink-subtle); }

/* узко: телефон и узкая колонка */
@container sptt (max-width: 560px) {
  .sp-tt-row { grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-areas: "t m s" "t m a"; row-gap: 6px; column-gap: 10px; padding: 10px 6px 10px 8px; }
  .sp-tt-time { grid-area: t; align-self: start; padding-top: 1px; }
  .sp-tt-time b { font-size: 15px; }
  .sp-tt-time small { white-space: normal; }
  .sp-tt-cn { white-space: normal; }
  .sp-tt-main { grid-area: m; align-self: start; }
  .sp-tt-sum { grid-area: s; }
  .sp-tt-act { grid-area: a; justify-content: flex-end; }
  .sp-tt-sub { flex-wrap: wrap; row-gap: 2px; }
  .sp-tt-groups { white-space: normal; }
  .sp-tt-now-body { grid-template-columns: auto minmax(0, 1fr); row-gap: 8px; }
  .sp-tt-now-body .sp-tt-sum { grid-column: 2; align-items: flex-start; text-align: left; }
  .sp-tt-now-time { font-size: 26px; line-height: 30px; }
}

/* раскладка главной: задачи 8/12, справа календарь */
.sp-span-8 { grid-column: span 8; }
.sp-ws-aside { display: flex; flex-direction: column; gap: var(--space-4); }
@container spws (max-width: 1100px) { .sp-span-8, .sp-ws-aside.sp-span-4 { grid-column: span 12; } }
@container spws (max-width: 720px) { }

/* плитки показателей на главной: 2×2 компактно, по высоте = карточка прироста */
.sp-stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sp-stats-4 .sp-stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l l" "v f"; align-items: end; row-gap: 4px; column-gap: 8px; padding: 12px 16px; }
.sp-stats-4 .sp-stat-label { grid-area: l; }
.sp-stats-4 .sp-stat-value { grid-area: v; }
.sp-stats-4 .sp-stat-foot { grid-area: f; margin: 0; padding: 0 0 3px; flex-direction: column; align-items: flex-end; gap: 2px; }
.sp-ws-aside > .sp-card, .sp-ws-grid > .sp-ws-aside > .sp-card { height: auto; }
.sp-ws-aside { align-self: start; }
@container spws (max-width: 720px) {
  .sp-stats-4 .sp-stat { grid-template-columns: minmax(0, 1fr); grid-template-areas: "l" "v" "f"; align-items: start; padding: 12px 14px; }
  .sp-stats-4 .sp-stat-foot { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 0; }
  .sp-stats-4 .sp-stat-value { font-size: 22px; line-height: 26px; }
  .sp-ws-grid > .sp-ws-tasks { order: -1; } /* на телефоне задачи — сразу под баннером */
}

/* ТП звонит со своего телефона: номер текстом, главное действие — записать итог */
.sp-tt-phone { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-tt-phone .sp-icon { width: 12px; height: 12px; color: var(--ink-subtle); }
.sp-tt-num { user-select: all; -webkit-user-select: all; }
.sp-tt-phone.is-big { height: 36px; padding: 0 12px; border-radius: var(--radius-md); background: var(--bg-surface); font-size: 16px; line-height: 20px; font-weight: 650; color: var(--ink); }
.sp-tt-phone.is-big .sp-icon { width: 16px; height: 16px; color: var(--brand-ink); }
.sp-tt-now-tip { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-tt-mark-cap small { font-weight: 500; color: var(--ink-subtle); }
textarea.sp-tt-mark-in { flex: none; width: 100%; height: auto; min-height: 56px; padding: 8px 10px; resize: vertical; }
.sp-tt-mark.is-inline { margin-top: 0; border-color: var(--brand-line); }
.sp-tt-mark-row.is-foot { padding-top: 2px; }
.sp-tt-mark-hint { font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-tt-mark .sp-btn:disabled { opacity: .45; cursor: not-allowed; }
.sp-tt-markbtn { white-space: nowrap; }
@container sptt (max-width: 560px) {
  .sp-tt-client { flex-wrap: wrap; row-gap: 0; }
  .sp-tt-phone { flex-basis: 100%; }
  .sp-tt-phone.is-big { flex-basis: auto; }
  .sp-tt-now-tip { flex-basis: 100%; }
  .sp-tt-markbtn { padding: 0 10px; }
}
@container sptt (max-width: 560px) {
  .sp-tt-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "m s" "a a"; padding: 10px 6px 10px 8px; }
  .sp-tt-act { justify-content: flex-start; }
  .sp-tt-mark-row.is-quick { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 0 12px 2px; scrollbar-width: none; }
  .sp-tt-mark-row.is-quick .sp-qt-chip { flex: none; }
}

/* верхние показатели — строго одной строкой: прирост + 3 плитки (заменяет 2×2) */
.sp-stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sp-stats-row .sp-stat { padding: var(--space-4) var(--space-5); }
.sp-stats-row .sp-stat-value { font-size: 30px; line-height: 36px; letter-spacing: -0.02em; }
@container spws (max-width: 1100px) { .sp-ws-goal.sp-span-5 { grid-column: span 12; } }
@container spws (max-width: 720px) {
  .sp-stats.sp-stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .sp-stats-row .sp-stat { padding: 10px 10px 12px; gap: 4px; border-radius: var(--radius-lg); }
  .sp-stats-row .sp-stat-label { font-size: 12px; line-height: 16px; align-items: flex-start; }
  .sp-stats-row .sp-stat-label .sp-icon { width: 14px; height: 14px; margin-top: 1px; }
  .sp-stats-row .sp-stat-value { font-size: 22px; line-height: 26px; }
  .sp-stats-row .sp-stat-unit { display: block; margin: 0; font-size: 12px; line-height: 16px; }
  .sp-stats-row .sp-stat-foot { flex-direction: column; align-items: flex-start; gap: 2px; }
  .sp-stats-row .sp-stat-hint { display: none; }
}

/* верхний ряд главной: прирост + 3 плитки строго в одну строку */
.sp-stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sp-stats-row .sp-stat { justify-content: space-between; padding: 16px 18px; }
.sp-stats-row .sp-stat-value { font-size: 28px; line-height: 32px; }
.sp-stats-row .sp-stat-foot { margin-top: 0; padding-top: 0; }
@container spws (max-width: 1100px) { .sp-ws-grid > .sp-span-4:has(> .sp-goal), .sp-ws-grid > .sp-span-4:first-child { grid-column: span 12; } .sp-stats-row.sp-span-8 { grid-column: span 12; } }
@container spws (max-width: 720px) {
  .sp-stats.sp-stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .sp-stats-row .sp-stat { padding: 10px 10px; gap: 4px; border-radius: var(--radius-lg); }
  .sp-stats-row .sp-stat-label { font-size: 11px; line-height: 14px; align-items: flex-start; }
  .sp-stats-row .sp-stat-label .sp-icon { display: none; }
  .sp-stats-row .sp-stat-value { font-size: 20px; line-height: 24px; }
  .sp-stats-row .sp-stat-unit { display: block; margin: 0; font-size: 11px; line-height: 14px; }
  .sp-stats-row .sp-stat-hint { display: none; }
  .sp-stats-row .sp-pill { font-size: 11px; }
}

/* время звонка — в строке клиента (левой колонки нет) */
.sp-tt-client { flex-wrap: wrap; row-gap: 2px; }
.sp-tt-at { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--bg-sunken); font-size: 12px; line-height: 16px; color: var(--ink-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sp-tt-at b { font-size: 13px; font-weight: 700; color: var(--ink); }
.sp-tt-at .sp-icon { width: 13px; height: 13px; }
.sp-tt-at.is-soon { background: var(--brand-soft); color: var(--brand-ink); }
.sp-tt-at.is-soon b { color: var(--brand-ink); }
.sp-tt-at.is-late { background: var(--danger-soft); color: var(--danger); }
.sp-tt-at.is-late b { color: var(--danger); }
.sp-tt-row { padding-left: 12px; }

/* итог звонка: дата + ползунок времени */
.sp-tt-date { height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); font: 500 14px/20px var(--font-sans); color: var(--ink); }
[data-theme="dark"] .sp-tt-date { color-scheme: dark; }
.sp-tt-date:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.sp-tt-slider { flex: 1 1 260px; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.sp-tt-slider-top { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--ink-subtle); }
.sp-tt-slider-top .sp-icon { width: 13px; height: 13px; align-self: center; color: var(--brand-ink); }
.sp-tt-slider-top b { font-size: 15px; line-height: 20px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.sp-tt-slider input[type="range"] { width: 100%; margin: 2px 0; accent-color: var(--brand); cursor: pointer; }
.sp-tt-slider input[type="range"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sp-tt-ticks { display: flex; justify-content: space-between; font-size: 11px; line-height: 14px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }

/* ===== Задачи на сегодня: история и прайс прямо в строке ===== */
.sp-tt-row { grid-template-columns: minmax(0, 1fr) 176px 88px auto; cursor: pointer; }
.sp-tt-row .sp-tt-cn { text-decoration: none; color: var(--ink); }
.sp-tt-row .sp-tt-cn:hover, .sp-tt-now-client a:hover { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 2px; }
.sp-tt-now-client a { color: inherit; text-decoration: none; }
.sp-tt-trail { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sp-tt-tp { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; height: 20px; padding: 0 7px; border-radius: var(--radius-pill); font: 600 12px/1 var(--font-sans); white-space: nowrap; }
.sp-tt-tp .sp-icon { width: 12px; height: 12px; stroke-width: 2.2; }
.sp-tt-tp.is-sent { background: var(--success-soft); color: var(--success); }
.sp-tt-tp.is-none { background: var(--warning-soft); color: var(--warning); }
.sp-tt-tl { font-size: 12px; line-height: 16px; color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-tt-act { gap: 6px; }
.sp-tt-detbtn { position: relative; height: 36px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--ink-muted); font: 500 13px/18px var(--font-sans); cursor: pointer; white-space: nowrap; }
.sp-tt-detbtn:hover { border-color: var(--ink-subtle); color: var(--ink); }
.sp-tt-detbtn.is-on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }
.sp-tt-detbtn .sp-icon { width: 15px; height: 15px; }
.sp-tt-detbtn.has-label { padding: 0 10px; }
.sp-tt-detn { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--bg-sunken); font: 700 11px/18px var(--font-sans); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.sp-tt-detbtn.is-on .sp-tt-detn { background: var(--bg-surface); color: var(--brand-ink); }
.sp-tt-detbtn:focus-visible, .sp-tt-psend:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sp-tt-now-act { gap: 10px 14px; }
.sp-tt-now-act .sp-tt-trail { flex-direction: row; align-items: center; gap: 10px; }
.sp-tt-now-act .sp-tt-detbtn { margin-left: auto; }

.sp-tt-drawer { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 10px; margin-top: 10px; cursor: default; }
.sp-tt-dh, .sp-tt-dp { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-surface); }
.sp-tt-dhead { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 650; color: var(--ink); }
.sp-tt-dhead .sp-icon { width: 15px; height: 15px; color: var(--ink-subtle); }
.sp-tt-dempty { margin: 0; font-size: 13px; color: var(--ink-subtle); }
.sp-tt-hist { list-style: none; margin: 0; padding: 0; }
.sp-tt-hist li { display: grid; grid-template-columns: 52px 76px minmax(0, 1fr); gap: 8px; align-items: start; padding: 7px 0; border-top: 1px solid var(--line); }
.sp-tt-hist li:first-child { border-top: 0; padding-top: 2px; }
.sp-tt-hist time { display: flex; flex-direction: column; font-size: 12px; line-height: 16px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.sp-tt-hist time small { font-weight: 500; color: var(--ink-subtle); }
.sp-tt-hk { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-tt-hk .sp-icon { width: 13px; height: 13px; flex: none; }
.sp-tt-hist li.is-price .sp-tt-hk { color: var(--success); font-weight: 600; }
.sp-tt-ht { min-width: 0; font-size: 13px; line-height: 18px; color: var(--ink); }
.sp-tt-ht small { display: block; font-size: 11px; line-height: 14px; color: var(--ink-subtle); }
.sp-tt-pstate { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: var(--radius-md); }
.sp-tt-pstate .sp-icon { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.sp-tt-pstate div { min-width: 0; display: flex; flex-direction: column; }
.sp-tt-pstate b { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink); }
.sp-tt-pstate small { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sp-tt-pstate.is-sent { background: var(--success-soft); } .sp-tt-pstate.is-sent .sp-icon { color: var(--success); }
.sp-tt-pstate.is-none { background: var(--warning-soft); } .sp-tt-pstate.is-none .sp-icon { color: var(--warning); }
.sp-tt-pstate.is-new { box-shadow: inset 0 0 0 1.5px var(--success); }
.sp-tt-psend { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius-md); background: var(--brand); color: var(--on-brand); font-family: var(--font-sans); text-align: left; cursor: pointer; }
.sp-tt-psend:hover { filter: brightness(1.12); }
.sp-tt-psend .sp-icon { width: 17px; height: 17px; flex: none; }
.sp-tt-psend span { min-width: 0; display: flex; flex-direction: column; }
.sp-tt-psend b { font-size: 14px; line-height: 20px; font-weight: 600; }
.sp-tt-psend small { font-size: 12px; line-height: 16px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-tt-pmore { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-tt-pmore .sp-btn { text-decoration: none; }

@container sptt (max-width: 720px) {
  .sp-tt-row { grid-template-columns: minmax(0, 1fr) 150px auto; grid-template-areas: "m tr s" "a a a"; row-gap: 8px; }
  .sp-tt-main { grid-area: m; } .sp-tt-trail { grid-area: tr; } .sp-tt-sum { grid-area: s; } .sp-tt-act { grid-area: a; justify-content: flex-end; }
  .sp-tt-drawer { grid-template-columns: minmax(0, 1fr); }
}
@container sptt (max-width: 560px) {
  .sp-tt-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "m s" "tr tr" "a a"; }
  .sp-tt-trail { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .sp-tt-act { justify-content: flex-start; }
  .sp-tt-hist li { grid-template-columns: 46px minmax(0, 1fr); }
  .sp-tt-hk { grid-column: 2; grid-row: 1; }
  .sp-tt-ht { grid-column: 2; }
  .sp-tt-now-act .sp-tt-trail { flex-basis: 100%; }
  .sp-tt-now-act .sp-tt-detbtn { margin-left: 0; }
}

.sp-tt-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; min-width: 0; }
.sp-tt-meta:empty { display: none; }
.sp-tt-act .sp-tt-detbtn:not(.has-label) { width: 58px; }
.sp-tt-now-act .sp-tt-trail { flex: 1 1 260px; min-width: 0; }
.sp-tt-now-act .sp-tt-tl { min-width: 0; }
.sp-tt-detl { display: none; }
@container sptt (max-width: 560px) { .sp-tt-detl { display: inline; } .sp-tt-act .sp-tt-detbtn:not(.has-label) { width: auto; padding: 0 10px; } }

/* ===== ИИ-помощник (дизайн-система 31.10) ===== */

/* ===== ИИ-помощник: кнопка + боковая панель ===== */
.sp-llm, .sp-llm *, .sp-llm-fab { box-sizing: border-box; }
.sp-llm-fab { position: fixed; right: 24px; bottom: 24px; z-index: 34; display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 16px; border: 0; border-radius: var(--radius-pill); background: var(--brand); color: var(--on-brand); font: 600 14px/20px var(--font-sans); box-shadow: 0 8px 24px rgba(47, 36, 130, .28), 0 2px 6px rgba(20, 22, 28, .12); cursor: pointer; }
.sp-llm-fab:hover { filter: brightness(1.12); }
.sp-llm-fab .sp-icon { width: 19px; height: 19px; }
.sp-llm-fab.is-contained { position: absolute; }
.sp-llm-fab-n { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--spectrum-red); color: #fff; font: 700 11px/20px var(--font-sans); font-style: normal; box-shadow: 0 0 0 2px var(--bg-surface); }
.sp-llm-fab:focus-visible, .sp-llm-starter:focus-visible, .sp-llm-send:focus-visible, .sp-llm-mic:focus-visible, .sp-llm-chip button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sp-llm { position: fixed; top: var(--nav-height); right: 0; bottom: 0; z-index: 35; width: 400px; max-width: 100%; display: flex; flex-direction: column; background: var(--bg-surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop); font-family: var(--font-sans); color: var(--ink); }
.sp-llm.is-contained { position: absolute; top: 0; }
.sp-llm-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.sp-llm-ht { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-llm-ht b { font-size: 15px; line-height: 20px; font-weight: 650; }
.sp-llm-ht small { font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-llm-head .sp-iconbtn { width: 32px; height: 32px; }
.sp-llm-ctx { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--bg-page); }
.sp-llm-ctx-l { font-size: 11px; line-height: 16px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-subtle); }
.sp-llm-chip { min-width: 0; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px; border: 1px solid var(--brand-line); border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand-ink); font: 500 13px/18px var(--font-sans); }
.sp-llm-chip > .sp-icon { width: 14px; height: 14px; flex: none; }
.sp-llm-chip b { font-weight: 650; white-space: nowrap; }
.sp-llm-chip small { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-llm-chip button { flex: none; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.sp-llm-chip button:hover { background: var(--bg-surface); }
.sp-llm-chip button .sp-icon { width: 13px; height: 13px; }
.sp-llm-chip.is-add { padding: 0 10px; border-style: dashed; background: transparent; cursor: pointer; }

.sp-llm-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.sp-llm-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 8px; }
.sp-llm-empty-ico { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-lg); background: var(--brand-soft); color: var(--brand-ink); }
.sp-llm-empty-ico .sp-icon { width: 22px; height: 22px; }
.sp-llm-empty h3 { margin: 4px 0 0; font-size: 18px; line-height: 24px; font-weight: 650; }
.sp-llm-empty p { margin: 0; font-size: 13px; line-height: 19px; color: var(--ink-muted); }
.sp-llm-starters { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.sp-llm-starter { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-surface); font-family: var(--font-sans); text-align: left; cursor: pointer; transition: border-color .12s, background .12s; }
.sp-llm-starter:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.sp-llm-starter span { min-width: 0; display: flex; flex-direction: column; }
.sp-llm-starter b { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink); }
.sp-llm-starter small { font-size: 12px; line-height: 16px; color: var(--ink-subtle); }

.sp-llm-msg { display: flex; gap: 10px; min-width: 0; }
.sp-llm-msg.is-user { justify-content: flex-end; }
.sp-llm-bubble { max-width: 85%; padding: 8px 12px; border-radius: 14px 14px 4px 14px; background: var(--brand); color: var(--on-brand); font-size: 14px; line-height: 20px; white-space: pre-wrap; }
.sp-llm-bubble .sp-icon { width: 13px; height: 13px; margin-right: 6px; vertical-align: -1px; opacity: .8; }
.sp-llm-ava { flex: none; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); }
.sp-llm-ava .sp-icon { width: 15px; height: 15px; }
.sp-llm-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.sp-llm-text { margin: 4px 0 0; font-size: 14px; line-height: 21px; color: var(--ink); white-space: pre-wrap; }
.sp-llm-b { border-radius: var(--radius-md); }
.sp-llm-bt { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-subtle); margin-bottom: 6px; }
.sp-llm-points ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sp-llm-points li { display: flex; gap: 10px; align-items: flex-start; }
.sp-llm-pn { flex: none; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--brand); color: var(--on-brand); font: 700 12px/1 var(--font-sans); margin-top: 1px; }
.sp-llm-points li div { min-width: 0; display: flex; flex-direction: column; font-size: 14px; line-height: 20px; }
.sp-llm-points li small { font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-llm-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-llm-fact { display: inline-flex; flex-direction: column; padding: 6px 10px; border-radius: var(--radius-md); background: var(--bg-sunken); }
.sp-llm-fact small { font-size: 11px; line-height: 14px; color: var(--ink-subtle); }
.sp-llm-fact b { font-size: 14px; line-height: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.sp-llm-fact.is-bad { background: var(--danger-soft); } .sp-llm-fact.is-bad b { color: var(--danger); }
.sp-llm-fact.is-ok { background: var(--success-soft); } .sp-llm-fact.is-ok b { color: var(--success); }
.sp-llm-table { border: 1px solid var(--line); padding: 10px 12px; }
.sp-llm-table table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
.sp-llm-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--ink-subtle); padding: 0 0 6px; }
.sp-llm-table td { padding: 6px 0; border-top: 1px solid var(--line); }
.sp-llm-table .is-num { text-align: right; padding-left: 10px; white-space: nowrap; }
.sp-llm-table td.is-bad { color: var(--danger); font-weight: 600; }
.sp-llm-table a { color: var(--brand-ink); text-decoration: none; font-weight: 500; }
.sp-llm-table a:hover { text-decoration: underline; }
.sp-llm-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); }
.sp-llm-file-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-llm-file-t b { font-size: 13px; line-height: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-llm-file-t small { font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-llm-file .sp-btn { text-decoration: none; }
.sp-llm-act { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--brand-line); background: var(--bg-surface); box-shadow: inset 3px 0 0 var(--brand); }
.sp-llm-act.is-done { border-color: var(--success-soft); box-shadow: inset 3px 0 0 var(--success); }
.sp-llm-act.is-cancel { opacity: .55; box-shadow: none; border-color: var(--line); }
.sp-llm-act-h { display: flex; align-items: center; gap: 8px; }
.sp-llm-act-h b { flex: 1; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 650; }
.sp-llm-act-k { font-size: 11px; line-height: 16px; font-weight: 600; color: var(--brand-ink); white-space: nowrap; }
.sp-llm-act.is-done .sp-llm-act-k { color: var(--success); }
.sp-llm-act.is-cancel .sp-llm-act-k { color: var(--ink-subtle); }
.sp-llm-act dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: 13px; line-height: 18px; }
.sp-llm-act dt { color: var(--ink-subtle); }
.sp-llm-act dd { margin: 0; color: var(--ink); font-weight: 500; }
.sp-llm-act-f { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.sp-llm-act-done { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--success); }
.sp-llm-act-done .sp-icon { width: 15px; height: 15px; }
.sp-llm-src { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.sp-llm-src .sp-icon { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.sp-llm-tools { display: flex; gap: 2px; margin: -4px 0 0 -6px; }
.sp-llm-tools .sp-iconbtn { width: 28px; height: 28px; color: var(--ink-subtle); }
.sp-llm-tools .sp-iconbtn .sp-icon { width: 15px; height: 15px; }
.sp-llm-tools .is-down .sp-icon { transform: scaleY(-1); }
.sp-llm-tools .sp-iconbtn.is-on { color: var(--brand-ink); background: var(--brand-soft); }
.sp-llm-typing { display: inline-flex; align-items: center; gap: 4px; padding: 8px 0; }
.sp-llm-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-ink); opacity: .35; animation: sp-llm-dot 1s infinite; }
.sp-llm-typing i:nth-child(2) { animation-delay: .15s; } .sp-llm-typing i:nth-child(3) { animation-delay: .3s; }
.sp-llm-typing span { margin-left: 6px; font-size: 13px; color: var(--ink-subtle); }
@keyframes sp-llm-dot { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.sp-llm-foot { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--bg-surface); }
.sp-llm-follow { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.sp-llm-follow .sp-qt-chip { flex: none; }
.sp-llm-box { display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--bg-surface); transition: border-color .12s, box-shadow .12s; }
.sp-llm-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sp-llm-box textarea { min-height: 44px; max-height: 160px; padding: 10px 12px 2px; border: 0; background: transparent; resize: none; outline: none; font: 400 14px/20px var(--font-sans); color: var(--ink); }
.sp-llm-box textarea::placeholder { color: var(--ink-subtle); }
.sp-llm-box-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px 6px; }
.sp-llm-mic, .sp-llm-send { flex: none; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-md); cursor: pointer; }
.sp-llm-mic { background: transparent; color: var(--ink-muted); }
.sp-llm-mic:hover { background: var(--bg-hover); color: var(--ink); }
.sp-llm-send { background: var(--brand); color: var(--on-brand); }
.sp-llm-send:disabled { background: var(--bg-sunken); color: var(--ink-subtle); cursor: default; }
.sp-llm-mic .sp-icon, .sp-llm-send .sp-icon { width: 18px; height: 18px; }
.sp-llm-hint { flex: 1; min-width: 0; font-size: 11px; line-height: 14px; color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-llm-rec { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px 6px 14px; border: 1px solid var(--danger-line); border-radius: var(--radius-lg); background: var(--danger-soft); }
.sp-llm-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: sp-llm-dot 1.2s infinite; flex: none; }
.sp-llm-wave { display: flex; align-items: center; gap: 3px; height: 24px; }
.sp-llm-wave i { width: 3px; border-radius: 2px; background: var(--danger); opacity: .7; height: 8px; animation: sp-llm-wave 0.9s infinite ease-in-out; }
.sp-llm-wave i:nth-child(3n) { animation-delay: .2s; } .sp-llm-wave i:nth-child(3n+1) { animation-delay: .4s; } .sp-llm-wave i:nth-child(4n) { animation-delay: .1s; }
@keyframes sp-llm-wave { 0%, 100% { height: 6px; } 50% { height: 22px; } }
.sp-llm-rec-t { flex: 1; min-width: 0; font-size: 13px; line-height: 18px; color: var(--danger); font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .sp-llm-typing i, .sp-llm-rec-dot, .sp-llm-wave i { animation: none; opacity: .8; } }

/* телефон: панель на весь экран, кнопка над нижней панелью разделов */
@media (max-width: 640px) {
  .sp-llm { top: 0; width: 100%; z-index: 45; border-left: 0; }
  .sp-llm-fab { right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); width: 52px; height: 52px; padding: 0; justify-content: center; }
  .sp-llm-fab > span { display: none; }
  .sp-llm-fab .sp-icon { width: 22px; height: 22px; }
}
