/* Оформление дашборда ОП: тёмная тема, акцент — корпоративный цвет Affix.
   Дизайн: docs/superpowers/specs/2026-10-08-visual-design.md. В разметке нет атрибутов стиля (CSP style-src 'self'). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  /* поверхности */
  --page: #17181b;
  --surface: #222327;
  --raised: #2b2c31;
  --line: rgba(255, 255, 255, 0.08);
  --grid: rgba(255, 255, 255, 0.06);
  --axis: rgba(255, 255, 255, 0.16);
  /* текст; контраст на --surface: 15,70 / 8,76 / 5,44 */
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #9a9891;
  /* акцент — корпоративный цвет Affix; мелким текстом не используется (4,28:1) */
  --accent: #fa3750;
  --accent-ink: #17181b;
  --context: #6b6e75;
  /* палитра графиков: порядок фиксирован, проверен валидатором dataviz на --surface */
  --series-1: #fa3750;
  --series-2: #3987e5;
  --series-3: #c98500;
  --series-4: #199e70;
  /* состояния: всегда со значком и словом */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --radius-card: 16px;
  --radius-control: 10px;
  --rail: 72px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--ink); font: 400 15px/1.5 var(--font); }
a { color: inherit; }
h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 18px; line-height: 1.3; }
p { margin: 0 0 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }

/* Каркас: меню слева, верхняя строка, содержимое */
body.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-rows: auto 1fr;
  grid-template-areas: "rail top" "rail main"; }
.rail { grid-area: rail; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  align-items: center; gap: 8px; padding: 16px 0; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 12px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font-size: 18px; font-weight: 700; text-decoration: none; }
.rail-items { display: flex; flex-direction: column; gap: 4px; width: 100%; margin: 0; padding: 0; list-style: none; }
.rail-bottom { margin-top: auto; }
.rail form { margin: 0; }
.rail-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%;
  padding: 8px 4px; border: 0; background: none; color: var(--muted); font: 500 11px/1.2 var(--font);
  text-decoration: none; cursor: pointer; }
.rail-item:hover { color: var(--ink); }
.rail-item.is-active { background: var(--raised); color: var(--ink); }
.rail-item.is-active::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: 0; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent); }
.topbar { grid-area: top; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 20px 24px 8px; }
.topbar h1 { margin-right: auto; }
.fresh { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 13px; text-decoration: none; }
.fresh .icon { width: 16px; height: 16px; }
.topbar-user { color: var(--muted); font-size: 13px; }
.content { min-width: 0; padding: 16px 24px 32px; }
body.app .content { grid-area: main; }

/* Страница без каркаса: вход */
body.bare { display: grid; place-items: center; padding: 16px; }
body.bare .content { width: 100%; max-width: 400px; padding: 0; }
.login { display: grid; gap: 16px; }
.login-head { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.login-head .brand { margin: 0; }
.login .badge { white-space: normal; }

/* Сетка карточек: 12 колонок */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: 1 / -1; }

/* Карточка */
.card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-card);
  background: var(--surface); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin-right: auto; }
.card-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.lead { max-width: 760px; color: var(--ink-2); }

/* Кнопки и поля */
button { font: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius-control); font: 600 14px/1 var(--font);
  text-decoration: none; cursor: pointer; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { border-color: var(--line); background: var(--raised); color: var(--ink); }
.btn-secondary:hover { border-color: var(--axis); }
.btn-quiet { background: none; color: var(--ink-2); }
.btn-quiet:hover { color: var(--ink); }
.field { display: grid; gap: 6px; color: var(--ink-2); font-size: 14px; }
input, select { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-control);
  background: var(--raised); color: var(--ink); font: inherit; }
input[type="checkbox"] { width: 18px; height: 18px; padding: 0; accent-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }

/* Метки состояния: значок и слово, не только цвет */
.badge { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ink-2); font-size: 13px;
  white-space: nowrap; }
.badge .icon { width: 16px; height: 16px; }
.badge-ok .icon { color: var(--good); }
.badge-stale .icon { color: var(--warning); }
.badge-error .icon { color: var(--critical); }
.badge-never .icon { color: var(--muted); }
.tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-2); font-size: 12px; vertical-align: 1px; }

/* Таблицы */
.table-wrap { overflow-x: auto; }
.table-scroll { max-height: 70vh; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { position: sticky; top: 0; z-index: 1; padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left;
  white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: var(--raised); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { min-width: 220px; }

/* Плитка показателя */
.kpi { display: grid; align-content: start; gap: 8px; }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.kpi-label .icon { margin-left: auto; color: var(--muted); }
.kpi-value { font-size: 36px; font-weight: 700; line-height: 1.1; }
.kpi-unit { margin-left: 6px; color: var(--muted); font-size: 15px; font-weight: 400; }
.kpi-sub { color: var(--muted); font-size: 13px; }
.kpi-empty .kpi-value { color: var(--muted); }

/* Графики */
.chart { width: 100%; height: 320px; }
.chart-tall { height: 400px; }
.chart-table { margin-top: 12px; }
.chart-table summary { color: var(--ink-2); font-size: 13px; cursor: pointer; }
.chart-tip-title { margin-bottom: 4px; font-weight: 600; }
.chart-tip-row { display: flex; align-items: center; gap: 8px; }
.chart-tip-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--context); }
.chart-tip-dot.s1 { background: var(--series-1); }
.chart-tip-dot.s2 { background: var(--series-2); }
.chart-tip-dot.s3 { background: var(--series-3); }
.chart-tip-dot.s4 { background: var(--series-4); }
.chart-tip-value { margin-left: auto; padding-left: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Планшет: плитки по две в ряд, крупные карточки во всю ширину */
@media (max-width: 1279px) {
  .span-3 { grid-column: span 6; }
  .span-4, .span-6, .span-8 { grid-column: 1 / -1; }
}

/* Телефон: меню внизу, без горизонтальной прокрутки страницы */
@media (max-width: 767px) {
  body.app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; padding-bottom: 76px; }
  .rail { position: fixed; top: auto; right: 0; bottom: 0; left: 0; z-index: 10; height: auto; flex-direction: row;
    justify-content: center; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--line); border-right: 0; }
  .rail .brand { display: none; }
  .rail-items { flex-direction: row; width: auto; }
  .rail-bottom { margin-top: 0; }
  .rail-item { min-width: 72px; }
  .rail-item.is-active::before { top: 0; right: 16px; bottom: auto; left: 16px; width: auto; height: 3px;
    border-radius: 0 0 3px 3px; }
  .topbar { padding: 16px 16px 4px; }
  .content { padding: 12px 16px 24px; }
  h1 { font-size: 22px; }
  .btn { height: 44px; }
  .kpi-value { font-size: 30px; }
}

/* Экран КС: фильтр периода, плитки с изменением и мини-графиком, кольцо, шкала дня */
.span-2 { grid-column: span 2; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.segmented { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-control);
  background: var(--surface); }
.seg-btn { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink-2);
  font: 500 14px/1 var(--font); cursor: pointer; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active { background: var(--accent); color: var(--accent-ink); }
.field-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; }
.freshness-line { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 16px; }
.kpi-delta { color: var(--ink-2); font-size: 13px; }
.chart-spark { height: 48px; }
.kpi-ring-body { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chart-ring { width: 72px; height: 72px; flex: none; }
.chart-tip-dot.ctx { background: var(--context); }
.day-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.table-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
@media (max-width: 1279px) {
  .span-2 { grid-column: span 4; }
}

/* Экран КС, раскладка 09.10.2026: таблица сотрудников с полосами, списки «Требует внимания», свёрнутые подробности */
.table-compact th, .table-compact td { padding: 6px 10px; }
.cell-bar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.cell-bar span { flex: none; min-width: 32px; text-align: right; font-variant-numeric: tabular-nums; }
meter.bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0;
  border-radius: 4px; background: var(--context); }
meter.bar::-webkit-meter-bar { height: 8px; border: 0; border-radius: 4px; background: var(--context); }
meter.bar::-webkit-meter-optimum-value, meter.bar::-webkit-meter-suboptimum-value,
meter.bar::-webkit-meter-even-less-good-value { border-radius: 4px; background: var(--accent); }
meter.bar::-moz-meter-bar { border-radius: 4px; background: var(--accent); }
meter.bar-quiet, meter.bar-quiet::-webkit-meter-bar { background: var(--raised); }
.bar-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.bar-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; }
.bar-list li meter { grid-column: 1 / -1; }
.bar-list-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-list-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-list { max-height: 264px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.item-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.item-list li:first-child { padding-top: 0; }
.item-list li:last-child { border-bottom: 0; }
.item-meta { color: var(--muted); font-size: 13px; }
.item-quote { margin-top: 2px; color: var(--ink-2); font-size: 13px; }
.late { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.card-head .muted { font-size: 13px; }
.fold { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.card > .fold:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.fold > summary { color: var(--ink-2); font-weight: 600; cursor: pointer; }
.fold[open] > summary { margin-bottom: 8px; }

/* Экраны отчётов КС и ОП по разметке заказчика (09.10.2026; референс — тёмный финансовый дашборд): основная часть
   и правая панель, всё главное — на одном экране */
.board { display: grid; grid-template-columns: minmax(0, 7fr) minmax(300px, 3fr); gap: 16px; align-items: start;
  margin-bottom: 16px; }
.board-main, .board-aside { display: grid; gap: 16px; min-width: 0; }
.board-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); gap: 16px; }
/* Верхний ряд ровный (правка 27 от 11.10.2026): столбцы одной высоты, две карточки в столбце делят её поровну;
   карточки-счётчики без заголовка — с содержимым по центру, чтобы не было пустоты снизу */
.board-stack { display: grid; grid-auto-rows: 1fr; gap: 16px; min-width: 0; }
.board-stack > .card:not(:has(.card-head)) { display: flex; flex-direction: column; justify-content: center; }
.board .card { padding: 16px; }
.board .card-head { margin-bottom: 12px; }
.board h2 { font-size: 16px; }
.stat { display: flex; align-items: center; gap: 12px; }
.stat + .stat { margin-top: 16px; }
.stat-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat-pair .stat + .stat { margin-top: 0; }
.stuck { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.stuck-title { color: var(--muted); }
.stuck-row { margin-top: 2px; color: var(--ink-2); }
.stat-icon { display: grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--raised); color: var(--accent); }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-value small { margin-left: 4px; color: var(--muted); font-size: 14px; font-weight: 400; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-note { margin-top: 8px; color: var(--ink-2); font-size: 13px; }
.board meter.bar { margin-top: 10px; }
.chart-donut { height: 168px; }
.board-aside .chart-donut { height: 140px; }
.board-aside .people { max-height: 300px; overflow-y: auto; }  /* длинный список не вытягивает правую панель */
.amount { color: var(--good); font-variant-numeric: tabular-nums; }  /* сумма сделки — зелёным (правка 23) */
.amount-refusal { color: var(--critical); }  /* сумма отказа — красным (правка 28) */
.chart-week { height: 150px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 0; padding: 0; color: var(--ink-2);
  font-size: 13px; list-style: none; }
.legend-dot { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px;
  background: var(--context); }
.legend-dot.s1 { background: var(--series-1); }
.legend-dot.s2 { background: var(--series-2); }
.legend-dot.s3 { background: var(--series-3); }
.legend-dot.s4 { background: var(--series-4); }
/* Вкладки без скриптов: скрытые радиокнопки, подписи и панели — соседи в одном блоке */
.tabs { position: relative; display: flex; flex-wrap: wrap; gap: 4px; }
.tabs > input { position: absolute; opacity: 0; pointer-events: none; }
.tabs > label { padding: 4px 10px; border-radius: 8px; color: var(--ink-2); font-size: 13px; font-weight: 500;
  cursor: pointer; }
.tabs > label:hover { color: var(--ink); }
.tabs > input:checked + label { background: var(--raised); color: var(--ink); }
.tabs > input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.tab-count { margin-left: 6px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tab-panel { display: none; flex-basis: 100%; max-height: 380px; margin-top: 8px; overflow: auto; }
.tab-panel .item-list { max-height: none; }
.item-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-list a { white-space: nowrap; }
/* N-я радиокнопка открывает N-ю панель: до шести вкладок, без id в стилях */
.tabs > input:nth-of-type(1):checked ~ div.tab-panel:nth-of-type(1),
.tabs > input:nth-of-type(2):checked ~ div.tab-panel:nth-of-type(2),
.tabs > input:nth-of-type(3):checked ~ div.tab-panel:nth-of-type(3),
.tabs > input:nth-of-type(4):checked ~ div.tab-panel:nth-of-type(4),
.tabs > input:nth-of-type(5):checked ~ div.tab-panel:nth-of-type(5),
.tabs > input:nth-of-type(6):checked ~ div.tab-panel:nth-of-type(6),
.tabs > input:nth-of-type(7):checked ~ div.tab-panel:nth-of-type(7) { display: block; }
.tab-subhead { margin: 16px 0 4px; font-size: 14px; font-weight: 600; }
.tag-late { border-color: var(--series-3); color: var(--series-3); }  /* янтарный, как «Короткие» на кольце звонков (правка 15.10.2026) */
.profile-name { font-size: 22px; font-weight: 700; line-height: 1.2; }
.profile-dept { margin-top: 2px; color: var(--muted); font-size: 14px; }
.people { margin: 12px 0 0; padding: 0; list-style: none; }
.people li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 8px 0;
  border-top: 1px solid var(--line); font-size: 14px; }
.people a { overflow: hidden; color: var(--ink); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.people a:hover { text-decoration: underline; }
.people li > span:nth-child(2) { font-weight: 600; font-variant-numeric: tabular-nums; }
.people .item-meta { grid-column: 1 / -1; }
/* Менеджеры ОП справа (правка 16.10.2026): каждый - своя плитка на приподнятом фоне, без цветов; имя и «сделок N» ярче,
   показатели светлее серого, портфель отделён чертой и приглушён */
.people.people-cards { display: grid; gap: 8px; }
.people.people-cards li { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--raised); }
.people-cards a { font-size: 15px; font-weight: 600; }
.person-deals { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.person-deals-label { margin-right: 2px; color: var(--muted); font-size: 13px; font-weight: 400; }
.people-cards .item-meta { color: var(--ink-2); }
.people-cards .portfolio-meta { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); color: var(--muted); }
/* Портфель клиентов МОП в правой панели экрана ОП (15.10.2026): на сегодня, от периода не зависит */
.portfolio-note { margin-top: 6px; color: var(--ink-2); font-size: 13px; }
.portfolio-meta { color: var(--muted); }
/* «[Клиентов 1 718] / [Активные 492] / …» (15.10.2026): часть не разрывается, «/» стоит в конце части — не в начале строки */
.portfolio-part { white-space: nowrap; }
.portfolio-part:not(:last-child)::after { content: " /"; color: var(--muted); }
.portfolio-list .portfolio-total { font-weight: 600; }
.portfolio-title { margin: 16px 0 0; font-size: 14px; font-weight: 600; }
.portfolio-list { margin: 8px 0 0; padding: 0; list-style: none; }
.portfolio-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0;
  border-top: 1px solid var(--line); font-size: 14px; }
.portfolio-list li > span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.pay-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; color: var(--ink-2); }
.pay-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 1279px) {
  .board { grid-template-columns: minmax(0, 1fr); }
}
/* Экран ОП (правка 40 от 13.10.2026): графики недели и доли вклада — рядом под верхним рядом, на всю ширину основной
   части; справа только список менеджеров во всю высоту (длинный — прокручивается внутри); внизу «Детализации» — суммы */
.board-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.board-pair .chart-week, .board-pair .chart-donut { height: 180px; }
.deal-sums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--line); }
.deal-sum { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-control); background: var(--raised); }
.deal-sum-label { color: var(--muted); font-size: 13px; }
.deal-sum-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.deal-sum-note { color: var(--ink-2); font-size: 12px; }
@media (min-width: 1280px) {
  .board-op { align-items: stretch; }
  .board-aside-fill { position: relative; }
  .board-aside-fill > .card { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; }
  .board-aside-fill .people { flex: 1; min-height: 0; max-height: none; overflow-y: auto; }
}
@media (max-width: 767px) {
  .board-pair, .deal-sums { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .board-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .span-2 { grid-column: span 6; }
  .filters .segmented { width: 100%; flex-wrap: wrap; }
  .seg-btn { flex: 1 1 auto; padding: 0 8px; }
}

/* Юки: кнопка в левом меню над «Сотрудниками» и окно диалога поверх экрана. Аватар — картинка заказчика static/yuki.png
   (из yuki-earcups-larger-512.png, лицо крупнее) в круге с красной обводкой. Пока окно закрыто, вокруг аватара мягко «дышит»
   свечение — намёк, что на него можно нажать (при prefers-reduced-motion анимация выключается общим правилом выше).
   Сама картинка не масштабируется: transform: scale() растягивает уже отрисованный растр, и аватар мылится */
.assistant-avatar { display: block; width: 40px; height: 40px; flex: none; overflow: hidden; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 2px var(--accent); }
.assistant-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.assistant-toggle:hover { color: var(--ink); }
.assistant-toggle[aria-expanded="false"] .assistant-avatar { animation: assistant-breath 3.6s ease-in-out infinite; }
.assistant-toggle:hover .assistant-avatar, .assistant-toggle:focus-visible .assistant-avatar { animation: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px rgba(250, 55, 80, 0.28); }
.assistant-toggle[aria-expanded="true"] { background: var(--raised); color: var(--ink); }
@keyframes assistant-breath {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 2px rgba(250, 55, 80, 0); }
  50% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 9px rgba(250, 55, 80, 0.25); }
}
.assistant { position: fixed; left: calc(var(--rail) + 12px); bottom: 16px; z-index: 40; display: flex; flex-direction: column;
  width: 420px; height: min(640px, calc(100vh - 32px)); border: 1px solid var(--line); border-radius: var(--radius-card);
  background: var(--surface); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); overflow: hidden; }
.assistant[hidden] { display: none; }
.assistant-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 8px; }
.assistant-head h2 { margin-right: auto; }
.assistant-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--radius-control);
  background: transparent; color: var(--muted); cursor: pointer; }
.assistant-icon:hover { background: var(--raised); color: var(--ink); }
.assistant-tools { padding: 0 16px 8px; font-size: 13px; }
.assistant-link { padding: 0; border: 0; background: none; color: var(--ink-2); font: inherit; text-decoration: underline; cursor: pointer; text-align: left; }
.assistant-link:hover { color: var(--ink); }
.assistant-recent { margin-top: 8px; color: var(--muted); }
.assistant-recent ul { max-height: 220px; margin: 6px 0 0; padding: 0 4px 0 0; overflow-y: auto; list-style: none; display: grid; gap: 4px; }
.assistant-recent-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.assistant-delete { width: 24px; height: 24px; }
.assistant-delete .icon { width: 14px; height: 14px; }
.assistant-thread { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px 16px; }
.assistant-empty { margin: 0; color: var(--muted); font-size: 14px; }
.assistant-msg.assistant-greeting { max-width: 100%; }
.assistant-msg { max-width: 92%; padding: 10px 12px; border-radius: 12px; font-size: 14px; overflow-wrap: anywhere; }
.assistant-msg-user { align-self: flex-end; background: var(--raised); white-space: pre-wrap; }
.assistant-msg-answer, .assistant-msg-pending, .assistant-msg-error { align-self: flex-start; border: 1px solid var(--line); }
.assistant-msg-pending { color: var(--muted); }
.assistant-msg-error { color: var(--serious); }
.assistant-msg p { margin: 0 0 8px; }
.assistant-msg p:last-child, .assistant-msg ul:last-child, .assistant-msg ol:last-child { margin-bottom: 0; }
.assistant-msg ul, .assistant-msg ol { margin: 0 0 8px; padding-left: 20px; }
.assistant-msg table { margin: 4px 0 8px; border-collapse: collapse; font-size: 13px; }
.assistant-msg th, .assistant-msg td { padding: 4px 8px; border: 1px solid var(--line); text-align: left; }
.assistant-msg code { padding: 1px 4px; border-radius: 4px; background: var(--raised); }
.assistant-notice { margin: 0; padding: 0 16px 8px; color: var(--warning); font-size: 13px; }
.assistant-form { display: grid; gap: 8px; padding: 8px 16px 16px; border-top: 1px solid var(--line); }
.assistant-form textarea { width: 100%; resize: vertical; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-control);
  background: var(--page); color: var(--ink); font: inherit; font-size: 14px; }
.assistant-send { justify-self: end; padding: 8px 16px; border: 0; border-radius: var(--radius-control); background: var(--accent);
  color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; }
@media (max-width: 640px) { .assistant { left: 8px; right: 8px; bottom: 8px; width: auto; height: calc(100vh - 16px); } }
