/* ============================================================
   CONSIGLIERE · «Самарканд»
   Язык вида утверждён 9 октября 2026, сменил «Опал». Синяя колонка
   разделов слева, белые листы на светлом поле, число — ссылка на
   документ с латунным пунктиром.

   Правила, из которых выведено остальное:
     · цвет задаётся только переменной: одно имя — два значения,
       для светлой темы и для тёмной;
     · золото (--brass) — только знак и пунктир суммы-ссылки;
       фиолетовый (--ai) — только догадка помощника;
     · красный и зелёный — только деньги «хуже / лучше»;
     · без свечения, градиентов и стекла: серьёзность несут
       типографика и источник;
     · радиус 6px у листов и кнопок, 4px у плашек.
   ============================================================ */

/* ---------- Слой значений ---------- */

:root,
[data-theme="light"] {
  --ground:      #F4F6F9;
  --surface:     #FFFFFF;
  --sunken:      #ECF0F5;
  --line:        #D8DFE8;
  --line-soft:   #E7EBF1;

  --text:        #13213A;
  --text-2:      #3A4760;
  --text-3:      #5D6A80;

  --accent:      #1F5FA6;
  --accent-ink:  #174A83;
  --accent-soft: #E6EEF8;
  --accent-line: #B5CBE6;
  --on-accent:   #FFFFFF;

  --loss:        #B42318;
  --loss-soft:   #FDECEA;
  --loss-bar:    #D14A3C;
  --gain:        #23764F;
  --gain-soft:   #E4F1EA;
  --gain-bar:    #3E9467;
  --warn:        #8A5300;
  --warn-soft:   #FFF3D6;
  --warn-line:   #EED39A;

  --bar:         #1C3F75;
  --bar-2:       #9EC7E0;
  --ser-3:       #2A9BC4;
  --ser-4:       #C58A2B;
  --grid:        #EBEFF4;

  --rail:        #1C3F75;
  --rail-2:      #234C89;
  --rail-line:   #2E5C9E;
  --rail-text:   #EEF3FA;
  --rail-muted:  #A9BCD8;
  --rail-active: #2A5797;

  --brass:       #E3B860;
  --ai:          #7A4FE0;
  --ai-soft:     #F1ECFD;
  --ai-line:     #CFC0F5;

  --shadow:      0 1px 2px rgba(19, 33, 58, .06);
  --scrim:       rgba(11, 11, 14, .55);
  --mark-ink:    rgba(19, 33, 58, .11);

  color-scheme: light;
}

[data-theme="dark"] {
  --ground:      #0C1424;
  --surface:     #121C30;
  --sunken:      #09101D;
  --line:        #22304A;
  --line-soft:   #1A2539;

  --text:        #E8EDF5;
  --text-2:      #B4BFD1;
  --text-3:      #8794AB;

  --accent:      #7DB8F0;
  --accent-ink:  #A9D0F7;
  --accent-soft: #16243D;
  --accent-line: #2E4D7A;
  --on-accent:   #0C1424;

  --loss:        #F0907E;
  --loss-soft:   #2C1820;
  --loss-bar:    #C4554A;
  --gain:        #86CFA5;
  --gain-soft:   #12271F;
  --gain-bar:    #3F9467;
  --warn:        #E8BE6A;
  --warn-soft:   #2A2212;
  --warn-line:   #5A4719;

  --bar:         #7DB8F0;
  --bar-2:       #2E4D7A;
  --ser-3:       #3FB0C9;
  --ser-4:       #E3B860;
  --grid:        #1A2539;

  --rail:        #08101E;
  --rail-2:      #111B2E;
  --rail-line:   #1D2A42;
  --rail-text:   #E2E8F2;
  --rail-muted:  #8794AB;
  --rail-active: #17233A;

  --brass:       #E3B860;
  --ai:          #A98BFF;
  --ai-soft:     #1B1733;
  --ai-line:     #3D3370;

  --shadow:      0 1px 2px rgba(0, 0, 0, .45);
  --scrim:       rgba(0, 0, 0, .6);
  --mark-ink:    rgba(255, 255, 255, .12);

  color-scheme: dark;
}

:root {
  /* Golos Text — интерфейс и цифры; Lora — только заголовок экрана и
     имя продукта; JetBrains Mono — коды документов, SQL, номера. */
  --sans: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Lora", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Имя --serif осталось от прежней разметки и ведёт на гротеск:
     засечки положены только заголовку экрана, это --display. */
  --serif: var(--sans);

  /* Имена прежнего языка — алиасы на новые значения. Разметка их ещё
     зовёт; вычищаются по мере правок экранов. */
  --surface-solid: var(--surface);
  --raised:      var(--surface);
  --hair:        var(--line-soft);
  --text-4:      var(--text-3);
  --accent-dim:  var(--accent-line);
  --fig-total:   var(--bar);
  --bar-now:     var(--accent);
  --specular:    transparent;
  --shadow-hi:   var(--shadow);
  --material:    none;

  /* Серии графиков по порядку; пятая — нейтральная, больше пяти
     набор не держит. */
  --ser-1: var(--bar);
  --ser-2: var(--bar-2);
  --ser-5: var(--text-3);

  /* Шкала кегля макета: 13 · 14 · 15 · 16 · 18 · 20 · 34. */
  --t-xs: 12px;
  --t-sm: 13px;
  --t-md: 15px;
  --t-lg: 16px;
  --t-xl: 20px;
  --t-2xl: 24px;
  --t-3xl: 34px;

  --s-1: 8px;
  --s-2: 16px;
  --s-3: 24px;
  --s-4: 32px;

  /* Один радиус на листы и кнопки, второй — на плашки. */
  --radius:    6px;
  --radius-sm: 6px;
  --radius-lg: 6px;
  --radius-pill: 4px;
  --rail-w: 248px;

  --spring: cubic-bezier(.32, .72, 0, 1);
}

/* ---------- Основа ---------- */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--t-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "tnum" 1, "kern" 1;
  position: relative;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }

/* Сумма — ссылка на документ: пунктир латуни под числом, по клику
   дорога к первичке. Класс .fig и чип документа рисуются одинаково. */
.fig, .doc-chip {
  color: inherit;
  cursor: pointer;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--brass);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  font-variant-numeric: tabular-nums;
}
.fig:hover, .doc-chip:hover { color: var(--brass); }
.doc-chip.disabled { cursor: default; text-decoration-color: var(--line); }
.doc-chip.disabled:hover { color: inherit; }

/* Догадка помощника: пунктирная фиолетовая рамка и подпись «Версия
   помощника — не расчёт». Факт и догадка различаются видом. */
.guess {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px dashed var(--ai-line);
  background: var(--ai-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.guess-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ai);
}
.guess-label svg { flex: none; }
.guess-label .stamp-mark { display: inline-flex; }

/* Печати происхождения под числами: латунь — сверено с 1С, серый штрих —
   не проверялось, фиолетовые точки — догадка помощника. Форма кольца
   различает их и без цвета; подпись обязательна. */
.stamp {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; line-height: 1.35; font-weight: 400;
  color: var(--text-2);
}
.stamp-mark { flex: none; display: inline-flex; }
.stamp.verified .stamp-mark { color: var(--brass); }
.stamp.unchecked { color: var(--text-3); }
.stamp.guess { color: var(--ai); }
.fd-check .stamp, .src-row .stamp { font-size: 13px; }
.guess p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--text-2); }

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection { background: var(--accent-soft); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; border: 3px solid var(--ground); }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

.num, .ts { font-variant-numeric: tabular-nums; }
.small { font-size: var(--t-sm); color: var(--text-3); }
.meta { font-size: var(--t-xs); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.sep { color: var(--text-4); }

/* Надзаголовок раздела: единственный капслок в продукте */
.eyebrow,
.report-eyebrow,
.drawer-eyebrow {
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Оболочка ---------- */

/* Оболочка: борт появляется не на всех экранах, поэтому колонку под него
   резервируем только когда он действительно есть. */
.app {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;   /* иначе площадь не дотягивается до низа окна */
  min-height: 100vh;
}
.app.has-sidebar { grid-template-columns: var(--rail-w) 1fr; }

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Обёртки экранов между площадью и содержимым: без них строка вопроса
   зависает посреди пустоты — площадь кончается там, где кончился текст. */
.chat-screen, .report-screen, .accounting-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.app-loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; color: var(--text-3); font-size: var(--t-md);
}

.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Колонка разделов: тёмно-синяя в светлой теме, почти чёрная в тёмной.
   Знак и имя продукта, выбор компании, разделы, свежесть данных внизу. */
.sidebar {
  background: var(--rail);
  color: var(--rail-text);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 14px;
  min-height: 100vh;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 30;
  overflow-y: auto;
}
[data-theme="light"] .sidebar { border-right: 1px solid var(--rail-line); }

.rail-head { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand {
  flex: 1;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  color: #FFFFFF;
}
.rail-close {
  display: none;
  flex: none; width: 44px; height: 44px; border-radius: var(--radius);
  align-items: center; justify-content: center; color: var(--rail-text);
}
.rail-close:hover { background: var(--rail-2); }

/* Компания: кнопка открывает выбор компании и даты выпуска. */
.rail-company {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 48px; padding: 10px 12px;
  text-align: left;
  background: var(--rail-2);
  border: 1px solid var(--rail-line);
  border-radius: var(--radius);
  color: #FFFFFF;
}
.rail-company:hover { border-color: var(--rail-muted); }
.rail-company-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.rail-company-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-company-sub { font-size: 12px; color: var(--rail-muted); }
.rail-company svg { flex: none; }

.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.nav {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 44px; padding: 0 12px;
  border-radius: var(--radius);
  font-size: 15px; font-weight: 500; text-align: left;
  color: var(--rail-text);
}
.nav svg { flex: none; }
/* Подсветка наведения тише выбранного и только там, где наведение есть:
   на касании :hover залипает за последним нажатым пунктом, и в колонке
   горели два раздела сразу (ступень 5, «Вопросы» и «Память»). */
@media (hover: hover) {
  .nav:not(.active):hover { background: rgba(255, 255, 255, .06); }
}
.nav.active { background: var(--rail-active); color: #FFFFFF; font-weight: 600; }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-pill); background: var(--brass); color: #13213A; font-size: 12px; font-weight: 700; }
.nav-company { margin-top: 12px; border-top: 1px solid var(--rail-line); border-radius: 0 0 var(--radius) var(--radius); padding-top: 2px; }
.nav-company.active { border-radius: var(--radius); }
.nav:focus-visible, .rail-btn:focus-visible, .rail-company:focus-visible { outline-color: var(--brass); }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 8px; }
.rail-fresh { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.45; color: var(--rail-muted); }
.rail-dot { flex: none; width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--gain-bar); }
.rail-dot.idle { background: var(--rail-muted); }
.rail-dot.stale { background: var(--loss-bar); }
.rail-actions { display: flex; gap: 8px; }
.rail-btn {
  min-height: 36px; padding: 0 12px;
  font-size: 13px;
  border: 1px solid var(--rail-line);
  border-radius: var(--radius);
  color: var(--rail-text);
}
.rail-btn.grow { flex: 1; }
.rail-btn:hover { background: var(--rail-2); }

.rail-scrim { display: none; }

/* Шапка экрана: где я — крошками слева, действия экрана справа. */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 12px var(--s-4);
  border-bottom: 1px solid var(--line);
  background: var(--ground);
}
.topbar-brand { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--text-3); }
.topbar-crumb-sep { color: var(--text-3); }
.topbar-brand-name { color: var(--text); font-weight: 500; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.topbar-burger {
  display: none;
  flex: none; width: 44px; height: 44px; border-radius: var(--radius);
  align-items: center; justify-content: center; color: var(--text);
}

/* Переключатель вида: два сегмента на утопленной подложке. */
.view-toggle { display: flex; gap: 2px; background: var(--sunken); border-radius: var(--radius); padding: 3px; }
.view-toggle button {
  min-height: 34px; padding: 0 12px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  color: var(--text-2);
}
.view-toggle button:hover { color: var(--text); }
.view-toggle button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- Выпуск ---------- */

/* Рабочая площадь экрана: поля одинаковые у всех, и площадь занимает всё
   свободное место — иначе строка вопроса зависает посреди пустоты. */
.report-body, .welcome, .welcome-stub, .accounting-screen, .bc-screen, .report-classic {
  padding: var(--s-3) var(--s-4) var(--s-4);
  min-width: 0;
  flex: 1 1 auto;
}

/* Выпуск — одна колонка шириной 1040: сверху вывод, потом решения,
   показатели, разбор и таблицы, источник внизу. */
.report-narrative, .report-wait {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 36px var(--s-4) 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}
.report-header { display: flex; flex-direction: column; gap: 16px; }
.report-eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3);
}
.report-title {
  font-family: var(--display);
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 500;
  max-width: 860px;
  text-wrap: balance;
}
.report-summary { font-size: 16px; line-height: 1.55; color: var(--text-2); max-width: 860px; }
.report-docs { font-size: 13px; color: var(--text-3); }

/* Что решать сегодня: карточки решений в сетке. */
.decisions { display: flex; flex-direction: column; gap: 14px; }
.decisions-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.decisions-head h2 { font-size: 20px; font-weight: 600; }
.decisions-head span { font-size: 14px; color: var(--text-3); }
.decision-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.decision {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.decision-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.decision-sum { font-size: 22px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
button.decision-sum { padding: 0; }
.decision-what { display: flex; flex-direction: column; gap: 6px; }
.decision-what h3 { font-size: 18px; font-weight: 600; line-height: 1.3; }
.decision-what p { font-size: 15px; line-height: 1.5; color: var(--text-2); }
.decision-note { font-size: 13px; color: var(--text-3); }
.decision-act { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.pill {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 600;
  border-radius: var(--radius-pill); padding: 3px 10px;
}
.pill.loss { color: var(--loss); background: var(--loss-soft); }
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.calm { color: var(--text-2); background: var(--sunken); }

/* Кнопки: главная залита акцентом, второстепенная — контур акцента. */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border-radius: var(--radius);
  font-size: 14px; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-secondary { color: var(--accent); border: 1px solid var(--accent-line); font-weight: 500; }
.btn-secondary:hover { background: var(--accent-soft); }

/* Показатели выпуска: плитки в ряд. */
.kpi-wrap, .pnl-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.kpi-head, .pnl-card, .fixed-kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; text-align: left; min-width: 0;
}
.kpi-title, .pnl-label, .fixed-kpi-title { font-size: 14px; color: var(--text-3); }
.kpi-value, .pnl-value, .fixed-kpi-value {
  font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.kpi-toggle { font-size: 14px; color: var(--text-3); text-align: left; }
.kpi-toggle.positive, .ok { color: var(--gain); }
.kpi-toggle.alarming, .kpi-toggle.concerning, .err { color: var(--loss); }
.kpi-note {
  margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line-soft);
  font-size: 13px; line-height: 1.45; color: var(--text-2);
}
.kpi-delta { font-size: 14px; font-weight: 600; }
.kpi-delta.up { color: var(--gain); }
.kpi-delta.down { color: var(--loss); }
.kpi-delta.flat { color: var(--text-2); }

/* Разбор и таблицы — лентой листов. */
.report-flow { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.section, .chart-section, .table-section, .fixed-chart, .fixed-table {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.section.narrative { background: transparent; border: 0; padding: 0 2px; }
.section.narrative p { font-size: 16px; line-height: 1.6; color: var(--text-2); max-width: 760px; }
.section.block-section { background: transparent; border: 0; padding: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); margin-bottom: 12px; }
.section-head-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.section-num { display: none; }
.section-title, .classic-title, .fixed-title, .chat-table-title { font-size: 16px; font-weight: 600; color: var(--text); }
.section-subtitle, .classic-subtitle, .fixed-subtitle { font-size: 13px; color: var(--text-3); }
.section-narrative, .narrative, .drawer-narrative {
  font-size: 15px; line-height: 1.6; color: var(--text-2); max-width: 760px;
}
.section-narrative { margin-top: 12px; }
.table-section .table-container { margin: 0 -22px; }
.table-section .data-table th:first-child, .table-section .data-table td:first-child { padding-left: 22px; }
.table-section .data-table th:last-child, .table-section .data-table td:last-child { padding-right: 22px; }

/* Вид «Таблицы»: та же сетка листов, без разбора. */
.classic-header { padding: 36px 0 var(--s-3); min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.classic-title { font-family: var(--display); font-size: 34px; font-weight: 500; }
.classic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.classic-cell { min-width: 0; cursor: pointer; }
.classic-cell.span-full, .classic-cell.span-eight { grid-column: 1 / -1; }
.fixed-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.fixed-narrative-stub { font-size: 15px; color: var(--text-2); }

/* Чего я не знаю */
.gap-note {
  margin-top: var(--s-2);
  padding: 14px 18px;
  background: var(--sunken);
  border-radius: var(--radius);
  font-size: var(--t-sm);
  line-height: 1.6;
  color: var(--text-2);
}
.gap-note b { display: block; font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 6px; }

/* Выпуск собирается: шаги, счётчик, заготовка решений. */
.report-wait-head { display: flex; flex-direction: column; gap: 16px; }
.report-wait-title { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; }
.report-wait-clock { font-size: 15px; color: var(--text-3); }
.report-wait-clock b { font-family: var(--mono); font-size: 22px; font-weight: 500; color: var(--text); }
.report-wait-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.report-steps { list-style: none; padding: 8px 0; }
.report-steps li { display: flex; align-items: center; gap: 14px; padding: 12px 22px; font-size: 16px; }
.report-steps li.wait { color: var(--text-3); }
.report-steps li.run { font-weight: 600; }
.step-meta { font-weight: 400; color: var(--text-3); }
.step-mark { flex: none; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.report-steps li.done .step-mark { border-radius: 50%; background: var(--gain-soft); color: var(--gain); }
.spin {
  display: block; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--accent-line); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.ring { display: block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); }
@keyframes spin { to { transform: rotate(360deg); } }
.report-wait-link { align-self: flex-start; min-height: 44px; font-size: 15px; font-weight: 500; color: var(--accent); }
.report-wait-link:hover { color: var(--accent-ink); }
.report-wait-ghost { display: flex; flex-direction: column; gap: 10px; }
.report-wait-ghost h2 { font-size: 20px; font-weight: 600; color: var(--text-3); }
.report-wait-ghost > span { font-size: 13px; color: var(--text-3); }
.ghost-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.ghost-grid span { display: block; height: 180px; border-radius: var(--radius); border: 1px dashed var(--line); background: var(--sunken); }

/* Бегущая полоса ожидания: длительность неизвестна, процента нет. */
.chat-wait-bar { height: 3px; background: var(--accent-soft); overflow: hidden; }
.chat-wait-bar span { display: block; width: 40%; height: 100%; background: var(--accent); animation: runbar 1.6s ease-in-out infinite; }
@keyframes runbar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---------- Таблицы ---------- */

.table-container, .chat-table-scroll, .chat-table-wrap { overflow-x: auto; }

.data-table, .fixed-table, .chat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.data-table th, .fixed-table th, .chat-table th {
  font-size: var(--t-sm);
  color: var(--text-3);
  font-weight: 400;
  text-align: right;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table th:first-child, .fixed-table th:first-child, .chat-table th:first-child { text-align: left; }
.data-table td, .fixed-table td, .chat-table td {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  color: var(--text-2);
}
.data-table td:first-child, .fixed-table td:first-child, .chat-table td:first-child {
  text-align: left; color: var(--text);
}
.data-table tbody tr:hover td, .chat-table tbody tr:hover td { background: var(--accent-soft); }
.data-table td + td, .chat-table td + td, .fixed-table td + td { padding-left: var(--s-3); white-space: nowrap; }
.data-table th + th, .chat-table th + th, .fixed-table th + th { padding-left: var(--s-3); }
.data-table td:first-child, .chat-table td:first-child, .fixed-table td:first-child { padding-right: var(--s-2); }

/* Живая таблица: шапка липнет, числа считаются числами, строки ищутся. */
.dt { margin: var(--s-2) 0; }
.dt-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
.dt-title { font-size: var(--t-sm); color: var(--text-2); }
.dt-search {
  flex: 0 1 240px; min-width: 0;
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 10px; font-size: var(--t-sm); color: var(--text); outline: none;
}
.dt-search:focus { border-color: var(--accent-line); }
.dt-scroll { overflow: auto; max-height: 60vh; margin-top: var(--s-1); }
/* В артефакте панель прокручивается сама — второй скролл внутри лишний. */
.chat-artifact-panel-body .dt-scroll { max-height: none; overflow-x: auto; overflow-y: visible; }
.dt-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--t-sm); font-variant-numeric: tabular-nums;
}
.dt-th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-solid);
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  text-align: left; font-weight: 400; white-space: nowrap;
}
.dt-th.num { text-align: right; }
/* Зазор между колонками задаётся один раз слева — иначе соседние ячейки
   слипаются: «СУММА ДОЛГАПОСЛЕДНЯЯ ОТГРУЗКА». */
.dt-table th + th, .dt-table td + td { padding-left: var(--s-3); }
.dt-sort { font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.dt-sort:hover { color: var(--text); }
.dt-mark { color: var(--accent); }
.dt-table td {
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-2);
  vertical-align: baseline;
}
.dt-table td.num { text-align: right; white-space: nowrap; }
.dt-table td:first-child { color: var(--text); }
.dt-table tbody tr:hover td { background: var(--accent-soft); }
.dt-foot {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2);
  padding-top: 10px;
}
.dt-count { font-size: var(--t-xs); color: var(--text-4); }
.dt-actions { display: inline-flex; align-items: baseline; gap: var(--s-2); }
.dt-toggle, .dt-csv { font-size: var(--t-sm); color: var(--text-3); }
.dt-toggle:hover, .dt-csv:hover { color: var(--accent); }


.bar-label { font-family: var(--sans); font-size: 12.5px; font-weight: 600; fill: var(--text); font-variant-numeric: tabular-nums; }
.category-label { font-family: var(--sans); font-size: 12.5px; fill: var(--text-2); }
.axis-label { font-family: var(--sans); font-size: 12px; fill: var(--text-3); }
.category-label { font-size: 12px; fill: var(--text-2); }

/* ---------- Графики ---------- */

.chart, .chart-container, .fixed-chart-body { width: 100%; }
.chart svg, .fixed-chart-body svg { display: block; width: 100%; height: auto; overflow: visible; }
.gridline { stroke: var(--grid); stroke-width: 1; }

/* Полотно графика: шкала слева, область с фигурами, подписи под ней.
   Подписи — HTML: на телефоне переносятся, а не сжимаются с рисунком. */
.plot {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: 220px auto;
  column-gap: 8px;
  margin-top: 22px;
}
.plot-y { position: relative; }
.plot-y span {
  position: absolute; right: 0; transform: translateY(50%);
  font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.plot-area { position: relative; min-width: 0; }
.plot-grid span { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--grid); }
.plot-grid span:first-child { border-top-color: var(--line); }
.plot-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.plot-svg polyline { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.plot-svg rect { shape-rendering: crispEdges; }
.fig-connector-line { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.plot-dot {
  position: absolute; width: 9px; height: 9px; margin: 0 0 -4.5px -4.5px; border-radius: 50%;
  border: 2px solid var(--surface); box-sizing: content-box; transform: translate(-1px, 1px);
}
.plot-dot.ser-1 { background: var(--ser-1); }
.plot-dot.ser-pos { background: var(--gain-bar); }
.plot-dot.ser-neg { background: var(--loss-bar); }
.plot-dot.ser-warn { background: var(--ser-4); }
.plot-val {
  position: absolute; transform: translate(-50%, -6px);
  font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap;
}
.plot-val.minus { color: var(--loss); }
.plot-val.plus { color: var(--gain); }
.plot-x {
  grid-column: 2; display: grid; column-gap: 4px; padding-top: 8px;
}
.plot-x span {
  font-size: 12px; line-height: 1.3; color: var(--text-3); text-align: center;
  /* Переносить только по пробелу: «авг 2025» — две строки, а не «202 / 5». */
  overflow-wrap: normal; word-break: normal; hyphens: none;
  /* Ширина — ровно своя колонка: процент в max-width внутри сетки не
     держит подпись, а запас на соседей при подписи у каждого столбца
     даёт строку внахлёст. Редкие подписи и так занимают несколько колонок. */
  justify-self: stretch; min-width: 0;
}

/* Горизонтальные столбцы — списком: имя целиком, полоса и сумма. */
.hbar-list { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: flex; flex-direction: column; gap: 5px; }
.hbar-name { font-size: 14px; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.hbar-line { display: flex; align-items: center; gap: 10px; }
.hbar-track { flex: 1; height: 12px; border-radius: 4px; background: var(--grid); overflow: hidden; display: block; }
.hbar-track span { display: block; height: 100%; border-radius: 4px; }
.hbar-val { min-width: 64px; text-align: right; font-size: 14px; font-weight: 600; }
/* После .hbar-list: иначе его display: flex показывает список на широком экране. */
.bars-narrow { display: none; }
@media (max-width: 600px) {
  .bars-wide { display: none; }
  .bars-narrow { display: flex; margin-top: 16px; }
}

/* Круг и кольцо: фигура и легенда-таблица с суммой и долей. */
.pie { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.pie-svg { flex: none; }
.pie-slice { stroke: var(--surface); stroke-width: 2; }
.pie-total { font-size: 20px; font-weight: 700; fill: var(--text); font-family: var(--sans); }
.pie-legend { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.pie-row {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 56px; gap: 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.pie-sw { width: 12px; height: 12px; border-radius: 3px; display: block; }
.pie-name { overflow-wrap: anywhere; }
.pie-pct { text-align: right; color: var(--text-3); }
.ser-1-bg { background: var(--ser-1); }
.ser-2-bg { background: var(--ser-2); }
.ser-3-bg { background: var(--ser-3); }
.ser-4-bg { background: var(--ser-4); }
.ser-5-bg { background: var(--ser-5); }

/* Отклонения: подпись, шкала с осью посередине, число. */
.var-list { display: flex; flex-direction: column; }
.var-row {
  display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr) 96px; gap: 16px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.var-name { font-size: 14px; line-height: 1.35; }
.var-track { position: relative; display: block; height: 22px; }
.var-track::before { content: ""; position: absolute; left: 50%; top: -9px; bottom: -9px; width: 1px; background: var(--text-3); }
.var-bar { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.var-bar.minus { background: var(--loss-bar); }
.var-bar.plus { background: var(--gain-bar); }
.var-val { text-align: right; font-size: 14px; font-weight: 600; }
.var-val.minus { color: var(--loss); }
.var-val.plus { color: var(--gain); }
.var-axis { border-bottom: 0; padding-top: 4px; }
.var-base { text-align: center; font-size: 12px; color: var(--text-3); }

/* Заголовок графика идёт как надзаголовок раздела */
.chart-title {
  font-size: var(--t-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
  margin-bottom: var(--s-2);
  display: block;
}
.chart-subtitle { font-size: var(--t-sm); color: var(--text-3); margin: -10px 0 var(--s-2); }

/* Кольцо и легенда: подписи в столбик, значение под именем */
.chart-pie-body {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: var(--s-3);
  align-items: center;
}
.chart-pie-svg { width: 100%; height: auto; max-width: 220px; }
.chart-pie-hole { fill: var(--ground); }
.chart-legend { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.chart-legend-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  font-size: var(--t-sm);
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-soft);
}
.chart-legend-row:last-child { border-bottom: 0; padding-bottom: 0; }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 2px; display: block; }
.chart-legend-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-legend-value { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 700px) {
  .chart-pie-body { grid-template-columns: 1fr; }
}

/* ---------- Ссылки на первичку ---------- */

.refs, .source-docs { margin-top: var(--s-2); }
.refs-label, .source-docs-label {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 8px;
}
.ref-tag, .source-tag {
  display: inline-block;
  font-size: var(--t-sm);
  color: var(--text-2);
  border-bottom: 1px dotted var(--brass);
  margin: 0 var(--s-2) 6px 0;
}
.ref-tag:hover, .source-tag:hover { color: var(--brass); }
.source-doc-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap;
  padding: 10px 0; border-top: 1px solid var(--line-soft);
  font-size: 14px;
}
.source-doc-label { color: var(--text-2); }

/* ---------- Чат ---------- */

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Экран вопросов: колонка разговоров слева, лента справа, артефакт —
   третьей колонкой, когда открыт. */
.chat-screen {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}
.chat-screen.with-artifact { grid-template-columns: 260px minmax(0, 1fr) minmax(380px, 44%); }

.chat-threads {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0;
}
.chat-threads-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.chat-threads-head h2 { font-size: 16px; font-weight: 600; }
.chat-threads-close { display: none; width: 44px; height: 44px; border-radius: var(--radius); align-items: center; justify-content: center; color: var(--text-2); }
.thread-new {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font-size: 14px; font-weight: 600;
}
.thread-new:hover { background: var(--accent-ink); }
.thread-search {
  display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--ground); color: var(--text-3);
}
.thread-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font-size: 14px; }
.thread-search input::placeholder { color: var(--text-3); }
.thread-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.thread-chip {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%; min-height: 44px; padding: 9px 10px;
  border-radius: var(--radius); text-align: left;
}
.thread-chip:hover { background: var(--sunken); }
.thread-chip.on { background: var(--accent-soft); }
.thread-chip { align-items: stretch; }
.thread-title {
  font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.thread-chip.on .thread-title { font-weight: 600; color: var(--accent-ink); }
.thread-when { font-size: 12px; color: var(--text-3); }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px var(--s-4); border-bottom: 1px solid var(--line);
}
.chat-head-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.chat-head-title { flex: 1 1 200px; min-width: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-threads-toggle { display: none; width: 44px; height: 44px; border-radius: var(--radius); align-items: center; justify-content: center; color: var(--text); }
.chat-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chat-toolbar-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500;
}
.chat-toolbar-btn:hover { background: var(--sunken); }
.chat-toolbar-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.chat-toolbar-btn.quiet { border-color: transparent; background: transparent; color: var(--text-3); }
.chat-toolbar-btn.quiet:hover { color: var(--loss); }
.chat-download { position: relative; }
.chat-download-menu {
  position: absolute; right: 0; top: 46px; z-index: 6; width: 250px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column;
}
.chat-download-menu button {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  min-height: 44px; padding: 9px 10px; border-radius: var(--radius); text-align: left;
}
.chat-download-menu button:hover { background: var(--sunken); }
.chat-download-menu b { font-size: 14px; font-weight: 600; }
.chat-download-menu span { font-size: 12px; color: var(--text-3); }

.chat-mode-switch { display: flex; gap: 2px; align-self: flex-start; background: var(--sunken); border-radius: var(--radius); padding: 3px; }
.chat-mode-btn { min-height: 36px; padding: 0 14px; border-radius: var(--radius); font-size: 14px; font-weight: 500; color: var(--text-2); }
.chat-mode-btn:hover { color: var(--text); }
.chat-mode-btn.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* Лента: колонка 900 px по центру. */
.chat-messages {
  flex: 1;
  width: 100%; max-width: 900px; margin: 0 auto;
  padding: 32px var(--s-4) 40px;
  display: flex; flex-direction: column; gap: 28px;
}
.chat-msg { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.chat-msg-label { font-size: 13px; color: var(--text-3); }
.chat-msg.assistant .chat-msg-label { color: var(--text-3); }
.chat-msg.assistant .chat-msg-label::first-line { color: var(--text-2); font-weight: 600; }
.chat-msg-col { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.chat-msg-body { font-size: 16px; line-height: 1.6; color: var(--text-2); max-width: 760px; }
/* Реплика человека — пузырь справа, подпись под ним. */
.chat-msg.user { align-self: flex-end; align-items: flex-end; max-width: 72%; gap: 6px; }
.chat-msg.user .chat-msg-label { order: 2; font-size: 12px; }
.chat-msg.user .chat-msg-col { order: 1; align-items: flex-end; }
.chat-msg.user .chat-msg-body {
  background: var(--sunken); border: 1px solid var(--line);
  border-radius: 12px 12px 4px 12px;
  padding: 12px 16px; color: var(--text); line-height: 1.5;
}
.chat-msg.error .chat-msg-label { color: var(--loss); }
.chat-msg.error .chat-msg-body {
  background: var(--loss-soft); color: var(--loss);
  border-radius: var(--radius); padding: 12px 14px; font-size: 14px;
}
.chat-msg-meta { font-size: 12px; color: var(--text-3); }

/* Пустой разговор: вопрос и примеры карточками. */
.chat-empty { display: flex; flex-direction: column; gap: 10px; padding: 32px 0 0; }
.chat-empty-title { font-family: var(--display); font-size: 34px; font-weight: 500; line-height: 1.2; }
.chat-empty-hint { font-size: 17px; line-height: 1.5; color: var(--text-2); max-width: 620px; }
.chat-quick-chips {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px;
  margin-top: 18px;
}
.chat-quick-chip {
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  min-height: 112px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-align: left; color: var(--text); font-size: 15px; font-weight: 500; line-height: 1.45;
}
.chat-quick-chip svg { align-self: flex-end; color: var(--text-3); }
.chat-quick-chip:hover { border-color: var(--accent-line); }
.chat-quick-chip:hover svg { color: var(--accent); }

/* Ответ готовится. */
.chat-wait { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chat-wait-body { padding: 20px 22px; display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.chat-wait-clock { display: flex; flex-direction: column; gap: 2px; min-width: 88px; }
.chat-wait-clock .num { font-family: var(--mono); font-size: 32px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.chat-wait-clock span:last-child { font-size: 12px; color: var(--text-3); }
.chat-wait-text { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.chat-wait-text b { font-size: 16px; font-weight: 600; }
.chat-wait-text p { font-size: 15px; line-height: 1.5; color: var(--text-2); }

.chat-thinking, .pending, .loading { font-size: 14px; color: var(--text-3); }
.chat-md { font-size: 16px; line-height: 1.6; color: var(--text-2); max-width: 760px; }
.chat-md p + p { margin-top: 11px; }
.chat-md ul, .bullets { margin: 10px 0 10px 18px; color: var(--text-2); }
.chat-md li, .bullets li { margin-bottom: 5px; }
.chat-md code, .sql {
  font-family: var(--mono); font-size: 13px;
  background: var(--sunken); border: 1px solid var(--line-soft);
  border-radius: 4px; padding: 1px 5px; color: var(--text-2);
}

/* Запросы к данным и ход работы — свёрнутые листы под ответом. */
.chat-sql-details, .steps-box {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.chat-sql-details summary, .steps-box summary {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 18px;
  font-size: 15px; font-weight: 600; color: var(--text);
  cursor: pointer; list-style: none;
}
.chat-sql-details summary::-webkit-details-marker, .steps-box summary::-webkit-details-marker { display: none; }
.chat-sql-details summary::before, .steps-box summary::before {
  content: ""; width: 7px; height: 7px; margin: 0 4px 0 2px;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  transform: rotate(-45deg); transition: transform .15s;
}
.chat-sql-details[open] summary::before, .steps-box[open] summary::before { transform: rotate(45deg); }
.chat-sql-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 18px 18px; border-top: 1px solid var(--line-soft); }
.chat-sql-query {
  display: block; margin: 12px 0 0;
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
  background: var(--sunken); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 12px 14px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-sql-idx { display: block; color: var(--text-3); font-size: 12px; margin-bottom: 4px; }
.steps-list { display: flex; flex-direction: column; gap: 0; padding: 4px 18px 14px; border-top: 1px solid var(--line-soft); }
.step-row {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: baseline;
  font-size: 14px; color: var(--text-2); padding: 10px 0; border-top: 1px solid var(--line-soft);
}
.step-row:first-child { border-top: 0; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); align-self: center; }
.step-dot[data-kind="metric"] { background: var(--gain-bar); }
.step-dot[data-kind="render"] { background: var(--text-3); }
.step-row.failed .step-dot { background: var(--loss-bar); }
.step-row.failed .step-label { color: var(--loss); }
.step-ms { font-family: var(--mono); font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.step-detail {
  grid-column: 2 / -1; margin: 6px 0 0;
  font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--text-2);
  background: var(--sunken); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere;
}

/* Строка вопроса: лист с вложениями, скрепкой, полем и кнопкой. */
.chat-composer-wrap {
  position: sticky; bottom: 0; z-index: 5;
  padding: 12px var(--s-4) 16px;
  background: var(--ground); border-top: 1px solid var(--line);
}
.chat-composer {
  max-width: 836px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px; box-shadow: var(--shadow);
}
.chat-composer:focus-within { border-color: var(--accent-line); }
.chat-composer .att-chips, .chat-composer .att-status { margin: 0 2px; }
.chat-input-row { display: flex; gap: 6px; align-items: flex-end; }
.chat-textarea {
  flex: 1; min-width: 0; min-height: 44px; max-height: 160px;
  border: 0; outline: none; resize: none; background: transparent;
  color: var(--text); font-size: 16px; line-height: 1.5; padding: 10px 4px;
}
.chat-textarea::placeholder, .chat-input::placeholder { color: var(--text-3); }
.chat-attach-btn {
  flex: none; width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; color: var(--text-2);
}
.chat-attach-btn:hover:not(:disabled) { background: var(--sunken); color: var(--text); }
.chat-attach-btn:disabled { opacity: .5; cursor: default; }
.chat-send-btn, .chat-send, .drawer-chat-send {
  flex: none; width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent);
}
.chat-send-btn:hover:not(:disabled), .chat-send:hover:not(:disabled), .drawer-chat-send:hover:not(:disabled) { background: var(--accent-ink); }
.chat-send-btn:disabled, .chat-send:disabled, .drawer-chat-send:disabled { background: var(--sunken); color: var(--text-3); cursor: default; }
.chat-composer-hint {
  max-width: 836px; margin: 8px auto 0;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-3);
}

/* Строка вопроса на прочих экранах. */
.chat-dock-wrap { display: block; margin-top: auto; position: sticky; bottom: 0; z-index: 5; }
.chat-dock { padding: 12px var(--s-4) 20px; background: var(--ground); border-top: 1px solid var(--line); }
.chat-dock-form {
  max-width: 976px; margin: 0 auto;
  display: flex; gap: 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 6px 6px 16px; box-shadow: var(--shadow);
}
.chat-dock-form:focus-within { border-color: var(--accent-line); }
.chat-input { flex: 1; min-width: 0; height: 40px; border: 0; outline: none; background: transparent; color: var(--text); font-size: 16px; }
.chat-dock-wrap .chat-thinking { max-width: 976px; margin: 0 auto; padding: 8px var(--s-4); }
.chat-answer {
  max-width: 976px; margin: 0 auto 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.chat-answer.error { border-color: var(--loss-soft); }
.chat-answer-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  padding: 10px 16px; border-bottom: 1px solid var(--line-soft);
}
.chat-answer-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.chat-answer-body { padding: 14px 16px; font-size: 15px; line-height: 1.55; color: var(--text-2); max-height: 40vh; overflow-y: auto; }
.chat-answer-close, .chat-artifact-close {
  width: 36px; height: 36px; border-radius: var(--radius);
  font-size: 18px; color: var(--text-3);
}
.chat-answer-close:hover, .chat-artifact-close:hover { color: var(--text); background: var(--sunken); }

/* Артефакт: длинный ответ открывается третьей колонкой. */
.chat-artifact-panel {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; height: 100vh;
}
.chat-artifact-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px; }
.chat-artifact-panel-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-artifact-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
}
.chat-artifact-panel-title { font-size: 16px; font-weight: 600; }
.chat-artifact-card {
  display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; background: var(--surface);
}
.chat-artifact-card:hover { border-color: var(--accent-line); }
.chat-artifact-card.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.chat-artifact-head { display: flex; align-items: center; gap: 8px; }
.chat-artifact-icon { display: inline-flex; color: var(--accent); }
.chat-artifact-kind { flex: 1; font-size: 13px; font-weight: 600; color: var(--text-2); }
.chat-artifact-open { display: inline-flex; color: var(--text-3); }
.chat-artifact-preview {
  font-size: 15px; line-height: 1.55; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.chat-table-toggle { font-size: 14px; color: var(--accent); }

/* ---------- Панель пункта ---------- */

.drawer-backdrop {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(11, 11, 14, .4);
  opacity: 0; pointer-events: none;
  transition: opacity 160ms ease;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -16px 0 48px rgba(0, 0, 0, .18);
  transform: translateX(101%);
  transition: transform 200ms var(--spring);
  z-index: 40;
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px 24px 20px; border-bottom: 1px solid var(--line);
}
.drawer-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.drawer-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.drawer-title { font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.drawer-close {
  flex: none; width: 40px; height: 40px; border-radius: var(--radius);
  border: 1px solid var(--line); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
}
.drawer-close:hover { background: var(--sunken); color: var(--text); }
.drawer-amount { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.drawer-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 24px;
}
.drawer-narrative { font-size: 16px; line-height: 1.55; color: var(--text); }
.drawer-sources { display: flex; flex-direction: column; gap: 24px; }
.drawer-section { display: flex; flex-direction: column; gap: 10px; }
.drawer-section h3 { font-size: 16px; font-weight: 600; }
.drawer-sources-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.drawer-doc-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
}
.drawer-doc-row:last-child { border-bottom: 0; }
.drawer-doc-label { display: flex; flex-direction: column; gap: 2px; flex: 1 1 180px; min-width: 0; }
.drawer-doc-label b { font-size: 15px; font-weight: 500; line-height: 1.35; }
.drawer-doc-label span { font-size: 13px; color: var(--text-3); }
.drawer-doc-amount { font-size: 15px; font-weight: 600; }
.drawer-doc-open {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  min-height: 40px; padding: 0 12px;
  border: 1px solid var(--accent-line); border-radius: var(--radius);
  font-size: 13px; font-weight: 500; color: var(--accent);
}
.drawer-doc-open:hover { background: var(--accent-soft); }
.drawer-names { display: flex; flex-direction: column; gap: 8px; }
.drawer-name {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 15px; font-weight: 500;
}
.drawer-ini {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--sunken); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.drawer-chat {
  padding: 16px 24px 22px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px; background: var(--surface);
}
.drawer-chat-bubble {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--sunken); border-radius: var(--radius); padding: 12px 14px;
  font-size: 15px; line-height: 1.55; color: var(--text-2);
  max-height: 32vh; overflow-y: auto;
}
.drawer-chat-bubble.error { background: var(--loss-soft); color: var(--loss); }
.drawer-chat-bubble-clear { align-self: flex-start; font-size: 13px; color: var(--accent); }
.drawer-chat-thinking { font-size: 14px; color: var(--text-3); }
.drawer-chat-input-row {
  display: flex; gap: 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 6px 6px 16px; box-shadow: var(--shadow);
}
.drawer-chat-input-row:focus-within { border-color: var(--accent-line); }
.drawer-chat-input { flex: 1; min-width: 0; height: 40px; background: transparent; border: 0; outline: none; color: var(--text); font-size: 16px; }

/* ---------- Настройки, клиент, тема ---------- */

.settings-backdrop {
  position: fixed; inset: 0; background: var(--scrim); z-index: 70;
}
.settings-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(520px, 92vw); background: var(--surface-solid);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s-3); z-index: 71;
  color: var(--text);
}
.settings-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--s-3); }
.settings-title { font-family: var(--serif); font-size: var(--t-xl); }
.settings-body { display: flex; flex-direction: column; gap: var(--s-3); }
.settings-field { display: flex; flex-direction: column; gap: 8px; }
.settings-hint { font-size: var(--t-sm); color: var(--text-3); }
.settings-date-input, .bc-input, .bc-select, .bc-textarea, .login-input {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  font-size: var(--t-md);
  width: 100%;
}
.settings-date-input:focus, .bc-input:focus, .login-input:focus { border-color: var(--accent-line); outline: none; }
.settings-footer { display: flex; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-3); }

.client-options { display: flex; flex-direction: column; }
.client-option {
  display: flex; align-items: baseline; gap: 10px; padding: 11px 0;
  border-top: 1px solid var(--line-soft); text-align: left; width: 100%; color: var(--text-2);
}
.client-option:hover { color: var(--text); }
.client-option-dot { display: none; }
.client-option-name { flex: 1; }
.client-option-badge { font-size: var(--t-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-4); }
.client-empty { padding: var(--s-2) 0; color: var(--text-3); font-size: var(--t-sm); }

/* ---------- Приветствие без данных ---------- */

.welcome-stub {
  width: 100%; max-width: 760px; margin: 0 auto;
  padding-top: 72px;
  display: flex; flex-direction: column; gap: 48px;
}
.welcome-stub-card { display: flex; flex-direction: column; gap: 14px; }
.welcome-stub-title, .greeting {
  font-family: var(--display); font-size: 52px; font-weight: 500;
  letter-spacing: -0.01em; line-height: 1.1; text-wrap: balance;
}
.welcome-stub-sub { font-size: 16px; line-height: 1.5; color: var(--text-2); }
.welcome-stub-actions { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.welcome-stub-btn {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 20px; align-items: center;
  width: 100%; text-align: left;
  padding: 28px 4px; border-bottom: 1px solid var(--line);
  color: var(--text);
}
.welcome-stub-btn:hover { background: var(--sunken); }
.welcome-stub-n { font-family: var(--mono); font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.welcome-stub-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.welcome-stub-btn-title { font-size: 22px; font-weight: 600; line-height: 1.25; }
.welcome-stub-btn-sub { font-size: 15px; line-height: 1.45; color: var(--text-3); }
.welcome-stub-go {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px;
  border-radius: var(--radius); border: 1px solid var(--accent-line);
  font-size: 15px; font-weight: 500; white-space: nowrap; color: var(--text);
}
.welcome-stub-go.primary-go { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
@media (max-width: 640px) {
  .welcome-stub { padding-top: 24px; gap: 32px; }
  .welcome-stub-title, .greeting { font-size: 34px; }
  .welcome-stub-btn { grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 20px 4px; }
  .welcome-stub-go { grid-column: 2; justify-self: start; }
  .welcome-stub-btn-title { font-size: 18px; }
}

.cta { margin-top: var(--s-3); }
.cta-text { font-size: var(--t-md); color: var(--text-2); }
.primary {
  padding: 9px 18px; border: 1px solid var(--accent-line); border-radius: var(--radius);
  color: var(--accent); font-size: var(--t-md);
}
.primary:hover { background: var(--accent); color: var(--on-accent); }

/* ---------- Состояния ---------- */

.error, .error-card {
  border: 1px solid var(--line);
  border-left: 2px solid var(--loss);
  border-radius: var(--radius);
  background: var(--surface-solid);
  padding: var(--s-2) var(--s-3);
  color: var(--text-2);
  max-width: 62ch;
}
.error-card-head, .error-card-title { color: var(--text); font-size: var(--t-lg); }
.error-card-icon { display: none; }
.error-card-message { margin-top: 8px; font-size: var(--t-md); color: var(--text-2); }
.error-card-retry { margin-top: var(--s-2); }

.dev-banner {
  padding: 8px var(--s-4); background: var(--warn-soft);
  border-bottom: 1px solid var(--warn-line);
  font-size: var(--t-sm); color: var(--warn);
}
.dev-banner b { font-weight: 600; }


/* Карточка под ответом в чате: отчёт сохранён, вход во вкладку. */
.saved-report-card {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-top: 8px;
}
.saved-report-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.saved-report-card-kicker {
  font-size: var(--t-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 600;
}
.saved-report-card-title { font-size: var(--t-md); color: var(--text); font-weight: 500; }
.saved-report-card-meta { font-size: var(--t-xs); color: var(--text-3); }
.saved-report-card-open {
  background: var(--accent-soft); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px 12px; font-size: var(--t-sm); cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
.saved-report-card-open:hover { background: var(--accent); color: var(--on-accent); }

@media (max-width: 900px) {
  .saved-report-card { flex-direction: column; align-items: stretch; }
}

/* ---------- Вложения ---------- */
/* Файл при вопросе или отчёте. Плашка несёт вид, имя и размер: по ним
   человек узнаёт, что именно ушло модели или получателю. */

.att-input { display: none; }

.chat-attach-btn {
  flex: 0 0 auto; align-self: flex-end;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--line); color: var(--text-2);
  font-size: 18px; line-height: 1; cursor: pointer; font-family: inherit;
}
.chat-attach-btn:hover:not(:disabled) { background: var(--sunken); color: var(--text); }
.chat-attach-btn:disabled { opacity: 0.5; cursor: default; }

.att-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.att-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 4px 6px 4px 10px; font-size: var(--t-sm); color: var(--text-2);
}
.att-chip-kind {
  font-size: var(--t-xs); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; flex-shrink: 0;
}
.att-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: var(--text); }
.att-chip-size { font-size: var(--t-xs); color: var(--text-3); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.att-chip-x {
  background: transparent; border: none; color: var(--text-3); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 4px; font-family: inherit;
}
.att-chip-x:hover { color: var(--loss); }

.att-status { font-size: var(--t-sm); color: var(--text-3); margin: 4px 0; }
.att-status.error { color: var(--loss); }

.att-gallery { margin-top: var(--s-2); }
.att-gallery-title {
  font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3); font-weight: 600; margin-bottom: var(--s-1);
}
/* Карточки не тянутся по соседу: плашка файла рядом с картинкой иначе
   становится пустым прямоугольником высотой в картинку. */
.att-gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-2); align-items: start;
}
.att-item {
  margin: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
}
.att-img { display: block; width: 100%; max-height: 360px; object-fit: contain; background: var(--sunken); }
.att-img-missing {
  display: grid; place-items: center; height: 120px; background: var(--sunken);
  color: var(--text-3); font-size: var(--t-sm);
}
/* Имя — своей строкой над видом и кнопками: в одной строке с ними оно
   сжималось до «скр…», и файл нельзя было узнать. */
.att-caption { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 10px 12px; min-width: 0; }
.att-caption-name {
  order: -1; flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--t-sm); color: var(--text);
}
.att-caption .att-chip-size { margin-right: auto; }
.att-download {
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text-2); padding: 4px 10px; font-size: var(--t-xs); cursor: pointer; font-family: inherit;
}
.att-download:hover { color: var(--text); background: var(--sunken); }

/* ---------- Узкий экран ---------- */

@media (max-width: 900px) {
  :root { --s-4: 16px; }
  .app, .app.has-sidebar { grid-template-columns: 1fr; }
  /* Колонка разделов выезжает слева поверх экрана, под ней затемнение. */
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
    width: min(300px, 86vw); height: auto; min-height: 0;
    padding: 12px 12px 20px; gap: 16px;
    transform: translateX(-100%); transition: transform 200ms var(--spring);
    box-shadow: 16px 0 48px rgba(0, 0, 0, .3);
    visibility: hidden;
  }
  .sidebar.open { transform: none; visibility: visible; }
  .rail-head { padding: 0 0 0 8px; }
  .rail-close { display: flex; }
  .rail-company { min-height: 52px; }
  .rail-company-name { font-size: 15px; }
  .nav { min-height: 48px; font-size: 16px; }
  .rail-fresh { font-size: 13px; }
  .rail-btn { min-height: 44px; font-size: 14px; }
  .rail-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: var(--scrim); }
  /* Шапка в телефоне: меню слева, название экрана по центру. */
  .topbar {
    position: sticky; top: 0; z-index: 20;
    min-height: 56px; padding: 6px 8px; gap: 8px;
    background: var(--surface);
  }
  .topbar-burger { display: flex; }
  .topbar-brand { flex: 1 1 0; justify-content: center; font-size: 16px; padding-right: 44px; }
  .topbar-crumb, .topbar-crumb-sep { display: none; }
  .topbar-brand-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions:not(:empty) { flex: 1 1 100%; justify-content: center; padding-bottom: 4px; }
  .report-narrative, .report-wait { padding: 20px 16px 32px; gap: 24px; }
  .report-title { font-size: 26px; }
  .decision-grid, .ghost-grid { grid-template-columns: 1fr; }
  .decision { padding: 16px; }
  .kpi-wrap, .pnl-cards { grid-template-columns: 1fr; gap: 12px; }
  .kpi-value { font-size: 26px; }
  .section, .chart-section, .table-section, .fixed-chart, .fixed-table { padding: 16px; }
  .table-section .table-container { margin: 0 -16px; }
  .table-section .data-table th:first-child, .table-section .data-table td:first-child { padding-left: 16px; }
  .table-section .data-table th:last-child, .table-section .data-table td:last-child { padding-right: 16px; }
  .plot { grid-template-rows: 180px auto; grid-template-columns: 40px minmax(0, 1fr); }
  .plot-y span, .plot-x span, .plot-val { font-size: 11px; }
  .var-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 72px; gap: 10px; }
  .var-name { font-size: 13px; }
  /* Вопросы в телефоне: список разговоров выезжает поверх ленты. */
  .chat-screen, .chat-screen.with-artifact { grid-template-columns: minmax(0, 1fr); }
  .chat-threads {
    position: fixed; inset: 0; z-index: 50;
    transform: translateX(-100%); visibility: hidden;
    transition: transform 200ms var(--spring);
  }
  .chat-screen.threads-open .chat-threads { transform: none; visibility: visible; }
  .chat-threads-close, .chat-threads-toggle { display: flex; }
  .chat-head { padding: 8px 12px 10px; gap: 8px; }
  .chat-head-row { gap: 8px; }
  .chat-head-title { font-size: 16px; }
  /* Три действия в одну строку: в три ряда они съедали треть экрана. */
  .chat-toolbar { flex: 1 1 100%; flex-wrap: nowrap; gap: 6px; }
  .chat-toolbar-btn { min-height: 36px; padding: 0 10px; font-size: 13px; white-space: nowrap; }
  .chat-quick-chips { gap: 8px; }
  .chat-quick-chip { min-height: 0; flex-direction: row; align-items: center; padding: 14px 16px; }
  .chat-quick-chip svg { align-self: center; flex: none; }
  /* Сочетания клавиш на телефоне ни к чему. */
  .chat-composer-hint { display: none; }
  .chat-mode-switch { align-self: stretch; }
  .chat-mode-btn { flex: 1; padding: 0 8px; }
  .chat-messages { padding: 16px 14px 20px; gap: 18px; }
  .chat-msg.user { max-width: 86%; }
  .chat-empty-title { font-size: 28px; }
  .chat-composer-wrap { padding: 8px 10px 12px; }
  .chat-artifact-panel { position: fixed; inset: 0; z-index: 50; height: auto; }
  .chat-dock { padding: 8px 10px 12px; }
  .drawer-head { padding: 16px; }
  .drawer-body { padding: 16px; }
  .drawer-chat { padding: 12px 16px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════
   Блоки единого контракта представления · язык «Опал».

   Один вид на все каналы: утренний отчёт, чат, рассылка. Модель
   выбирает блок и данные — оформление живёт здесь и больше нигде.

   Карточка блока несёт четыре приёма разом: материал (blur+saturate),
   кант по верхнему ребру, концентричный радиус и пружину на переходах.
   ══════════════════════════════════════════════════════════════════════ */

.blockpage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Общая поверхность блока: белый лист с тонкой рамкой, без тени и
   стекла. Серьёзность несут типографика и источник. */
.blk-verdict,
.blk-fig,
.blk-kpi,
.blk-table {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}

/* Вывод — первое, что читает владелец: одна фраза с числом. */
.blk-verdict { display: flex; flex-direction: column; gap: 12px; }
.blk-verdict-label {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--sunken);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
}
.blk-verdict p {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 650;
  max-width: 40ch;
}
.blk-verdict .blk-refs { margin-top: 0; }

/* Фигура: заголовок, полотно, подпись. */
.blk-fig { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.blk-head { display: flex; flex-direction: column; gap: 2px; }
.blk-title { font-size: 16px; font-weight: 600; }
.blk-subtitle { font-size: 13px; color: var(--text-3); }
.blk-fig figcaption {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
  max-width: 760px;
}

.blk-svg { overflow-x: auto; }
.blk-svg svg { display: block; width: 100%; height: auto; }
.blk-empty { font-size: 14px; color: var(--text-3); padding: 12px 0; }

/* Текст ответа: 16 px, строка 1,6, мера не шире 760 px. */
.blk-prose {
  margin: 0;
  max-width: 760px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-2);
  padding: 0 2px;
}

/* Показатель: подпись, число, изменение, с чем сравниваем, комментарий. */
.blk-kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.blk-kpi-t { font-size: 14px; color: var(--text-3); }
.blk-kpi-v {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.blk-kpi-delta { font-size: 14px; color: var(--text-3); }
.blk-kpi-d { font-weight: 600; font-variant-numeric: tabular-nums; }
.blk-kpi-d.up { color: var(--gain); }
.blk-kpi-d.down { color: var(--loss); }
.blk-kpi-d.flat { color: var(--text-2); }
.blk-kpi-n {
  margin-top: 6px; padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px; line-height: 1.45; color: var(--text-2);
}

/* Источник — всегда последний: откуда числа, на какой день, сверка. */
.blk-source-wrap { display: flex; flex-direction: column; gap: 12px; }
.blk-source {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 22px;
  font-size: 14px;
  color: var(--text-2);
}
.blk-source-head { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); }

/* Плашки состояний: значок, что случилось, подробность. */
.note {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px; line-height: 1.45;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
}
.note svg { flex: none; margin-top: 1px; }
.note-body { display: flex; flex-direction: column; gap: 2px; }
.note-body b { font-weight: 600; }
.note.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.note.loss { background: var(--loss-soft); border-color: var(--loss-soft); color: var(--loss); }
.note.calm svg { color: var(--gain); }
.note.calm b { color: var(--text); }

.blk-refs { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.blk-refs .doc-chip { font-size: 14px; color: var(--text-2); }
.blk-ref-name {
  font-size: 12px;
  color: var(--text-2);
  background: var(--sunken);
  border-radius: var(--radius-pill);
  padding: 2px 9px;
}

/* Таблица в блоке: шапка на утопленной подложке, текст слева, числа
   справа табличными цифрами. */
.blk-fig .table-container { overflow-x: auto; margin: 0 -22px; }
.blk-fig .data-table { border-collapse: collapse; width: 100%; font-size: 15px; }
.blk-fig .data-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--sunken);
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.blk-fig .data-table th:first-child, .blk-fig .data-table td:first-child { padding-left: 22px; }
.blk-fig .data-table th:last-child, .blk-fig .data-table td:last-child { padding-right: 22px; }
.blk-fig .data-table td {
  padding: 11px 14px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.blk-fig .data-table td + td { color: var(--text-2); }
.blk-fig .data-table tbody tr:hover td { background: var(--sunken); }

/* ── Общий язык SVG-фигур ─────────────────────────────────────────── */

.fig-grid line { stroke: var(--grid); stroke-width: 1; }
.fig-base { stroke: var(--line-soft); stroke-width: 1; }
.fig-axis { stroke: var(--text-4); stroke-width: 1; }
.fig-connector line {
  stroke: var(--text-4);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.fig-ax { font-family: var(--sans); font-size: 12px; fill: var(--text-3); }
.fig-lbl { font-family: var(--sans); font-size: 13px; fill: var(--text-2); }
.fig-val {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  fill: var(--text);
  font-variant-numeric: tabular-nums;
}
.fig-val.minus { fill: var(--loss); }
.fig-val.plus { fill: var(--gain); }

/* Цвет столбца несёт знак операции. Категорию несёт позиция — поэтому
   в каскаде нет ни легенды, ни набора цветов по статьям. */
.fig-bar { transition: opacity .2s var(--spring); }
.fig-bar:hover { opacity: .78; }
/* Итог — приглушённый тон, не акцент: акцент принадлежит действиям,
   а не данным. Знак операции несут пастельные минус и плюс. */
.fig-bar.total { fill: var(--fig-total); }
.fig-bar.minus { fill: var(--loss-bar); }
.fig-bar.plus { fill: var(--gain-bar); }

/* ── Появление ────────────────────────────────────────────────────── */

/* Блоки поднимаются по очереди, полосы вырастают из нуля. Пружина без
   отскока: движение читается как отклик вещества, а не мультипликация. */
@keyframes blk-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.blockpage > * { animation: blk-rise .5s var(--spring) both; }
.blockpage > *:nth-child(1) { animation-delay: .02s; }
.blockpage > *:nth-child(2) { animation-delay: .07s; }
.blockpage > *:nth-child(3) { animation-delay: .12s; }
.blockpage > *:nth-child(4) { animation-delay: .17s; }
.blockpage > *:nth-child(5) { animation-delay: .22s; }
.blockpage > *:nth-child(6) { animation-delay: .27s; }
.blockpage > *:nth-child(n+7) { animation-delay: .32s; }

@media (max-width: 640px) {
  .blk-verdict p { font-size: 20px; }
  .blk-kpi-v { font-size: 26px; }
  .fig-lbl { font-size: 10px; }
  .blk-verdict, .blk-fig, .blk-kpi, .blk-table { padding: 16px; }
  .blk-fig .table-container { margin: 0 -16px; }
  .blk-fig .data-table th:first-child, .blk-fig .data-table td:first-child { padding-left: 16px; }
  .blk-source { padding: 12px 16px; gap: 6px 14px; }
}

/* Витрина блоков (?blocks=1) — внутренний экран, не часть продукта. */
.showcase {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}
.showcase-head { margin-bottom: 28px; }
.showcase-eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.showcase-guess { margin-top: 14px; }
.showcase-head h1 {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.showcase-head p {
  color: var(--text-2);
  margin: 0;
  max-width: 62ch;
}

/* Плитка показателя не должна растягиваться на всю страницу. */
.blockpage > .blk-kpi { max-width: 260px; }


/* ── Серии графиков отчёта ────────────────────────────────────────────
   Цвет серий живёт здесь, а не в константах Rust: только так он
   переключается вместе с темой. Пятёрка — та же, что у chart_svg,
   проверенная валидатором в обеих темах. */

.ser-1 { fill: var(--ser-1); }
.ser-2 { fill: var(--ser-2); }
.ser-3 { fill: var(--ser-3); }
.ser-4 { fill: var(--ser-4); }
.ser-5 { fill: var(--ser-5); }
.ser-pos  { fill: var(--gain-bar); }
.ser-neg  { fill: var(--loss-bar); }
.ser-warn { fill: var(--ser-3); }

/* Линия: заливка снята явно — класс сильнее presentation-атрибута. */
.ser-line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ser-1-s    { stroke: var(--ser-1); }
.ser-pos-s  { stroke: var(--gain-bar); }
.ser-neg-s  { stroke: var(--loss-bar); }
.ser-warn-s { stroke: var(--ser-3); }

/* Водяной знак: диагональная сетка поверх полотна, не мешающая чтению.
   Он не защищает от снимка экрана — он делает снимок именным. */
.artifact { position: relative; }
.artifact-mark {
  /* Знак фиксирован поверх всего полотна: карточки блоков создают
     собственный контекст наложения (материал и тень), и знак внутри потока
     оказывался под ними — виден только на полях. */
  position: fixed;
  inset: -20%;
  z-index: 40;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 90px;
  transform: rotate(-24deg);
  overflow: hidden;
}
.artifact-mark span {
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 13px;
  /* Цвет задаём прозрачностью самого текста, а не всего слоя: под общим
     opacity знак пропадал на белой карточке и был виден только на фоне. */
  color: var(--mark-ink);
  letter-spacing: .04em;
}
/* Запрет копирования — знак вежливости, а не преграда: он говорит получателю,
   что документ дан для чтения. Обходится за минуту и не претендует на большее. */
.artifact.no-copy { user-select: none; -webkit-user-select: none; }
@media print {
  .artifact.no-copy { display: none; }
  .artifact.no-copy::after {
    content: "Печать этого документа не разрешена отправителем";
    display: block;
    font-size: 16px;
  }
}
.blk-recon { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.blk-recon.bad {
  color: var(--warn); background: var(--warn-soft);
  border: 1px solid var(--warn-line); border-radius: var(--radius-pill); padding: 2px 10px;
}
/* Вторая колонка сообщения: одно место для шагов, ответа, графиков и мет. */
.chat-msg-col { min-width: 0; display: flex; flex-direction: column; }

/* ══════════════════════════════════════════════════════════════════════
   Ступень 3 «Самарканда»: находки, отчёты, деньги, рассылки, вход,
   публикация, документ по ссылке. Цвета — только токены слоя значений.
   ══════════════════════════════════════════════════════════════════════ */

/* ── Общее ─────────────────────────────────────────────────────────── */

.screen-scroll { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.screen-page {
  width: 100%; max-width: 1040px; margin: 0 auto;
  padding: 36px var(--s-4) 40px;
  display: flex; flex-direction: column; gap: 28px; min-width: 0;
}
.screen-page.wide { max-width: 1160px; }
.screen-head { display: flex; flex-direction: column; gap: 12px; }

.ico { display: inline-flex; flex: none; }
.ico svg { display: block; }

/* Сегменты: варианты одного выбора на утопленной подложке. */
.seg {
  display: inline-flex; flex-wrap: wrap; gap: 2px;
  background: var(--sunken); border-radius: var(--radius); padding: 3px;
}
.seg button {
  min-height: 36px; padding: 0 14px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
[data-theme="dark"] .seg button.on { background: var(--accent-soft); }

/* Кнопки сверх главной и второстепенной. */
.btn-primary:disabled, .btn-secondary:disabled, .btn-quiet:disabled, .btn-dark:disabled {
  opacity: .5; cursor: default;
}
.btn-primary .ico, .btn-secondary .ico { margin-left: 2px; }
.btn-quiet, .btn-dark, .btn-danger {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.btn-quiet { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn-quiet:hover { border-color: var(--text-3); }
.btn-dark { background: var(--text); color: var(--surface); font-weight: 600; }
.btn-dark:hover { opacity: .9; }
.btn-danger { background: var(--loss); color: var(--surface); font-weight: 600; }
.btn-link {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 2px;
  font-size: 14px; font-weight: 500; color: var(--accent);
}
.btn-link:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.btn-link.danger { color: var(--loss); }

.pill.gain { color: var(--gain); background: var(--gain-soft); }

/* Переключатель: дорожка и бегунок. */
.switch {
  position: relative; flex: none;
  width: 46px; height: 28px; border-radius: 14px;
  background: var(--line); transition: background .15s;
}
.switch span {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: transform .15s var(--spring);
}
.switch.on { background: var(--accent); }
.switch.on span { transform: translateX(18px); }
[data-theme="dark"] .switch.on span { background: var(--on-accent); }

/* Строка источника внизу экрана: откуда числа и чем сверены. */
.src-line {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; display: flex; flex-direction: column; gap: 6px;
}
.src-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; font-size: 13px; color: var(--text-3); }
.src-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); }
.src-warn { color: var(--warn); }

/* Знак-мухр в колонке: кольцо латунью, буква цветом колонки. */
.rail-mark { flex: none; display: inline-flex; color: var(--rail-text); }
.rail-mark svg { display: block; }

/* ── Находки ───────────────────────────────────────────────────────── */

.fd-summary {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.fd-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.fd-tile {
  display: flex; flex-direction: column; gap: 2px; padding: 16px 18px;
  border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  margin-right: -1px; margin-bottom: -1px;
}
.fd-tile-n { font-size: 26px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--text); }
.fd-tile-n.loss { color: var(--loss); }
.fd-tile-n.gain { color: var(--gain); }
.fd-tile-n.warn { color: var(--warn); }
.fd-tile-l { font-size: 13px; color: var(--text-3); }
.fd-strip {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 16px 18px; background: var(--sunken); border-top: 1px solid var(--line);
}
.fd-strip-total { font-size: 16px; font-weight: 600; }
.fd-loss { color: var(--loss); font-variant-numeric: tabular-nums; }
.fd-strip-of { font-size: 14px; font-weight: 400; color: var(--text-3); }
.fd-strip-run { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.fd-strip-when { font-size: 13px; color: var(--text-3); }

.fd-list-wrap { display: flex; flex-direction: column; gap: 12px; }
.fd-list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.fd-list-head h2 { font-size: 20px; font-weight: 600; }
.fd-list-head span { font-size: 14px; color: var(--text-3); }
.fd-list { display: flex; flex-direction: column; gap: 12px; }

.fd-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.fd-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.fd-who { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.fd-who h3 { font-size: 17px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.fd-age {
  font-size: 12px; font-weight: 600; border-radius: var(--radius-pill); padding: 2px 8px;
  border: 1px solid transparent;
}
.fd-age.warn { color: var(--warn); background: var(--warn-soft); }
.fd-age.loss { color: var(--loss); background: var(--loss-soft); border-color: var(--loss); }
.fd-age.hot { color: var(--surface); background: var(--loss); }
.fd-sum { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; text-align: right; }
.fd-sum-l { font-size: 12px; color: var(--text-3); }
.fd-sum-v {
  font-size: 22px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums;
  text-decoration: underline dotted var(--brass) 1.5px; text-underline-offset: 5px;
}
.fd-state {
  align-self: flex-start; font-size: 13px; color: var(--text-2);
  background: var(--sunken); border-radius: var(--radius-pill); padding: 4px 10px;
}
.fd-docs { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.fd-docs-l { font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 6px; }
.fd-docs ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.fd-doc { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-size: 14px; color: var(--text-2); }
.fd-doc-title { min-width: 0; }
.fd-doc-sum { flex: none; font-size: 14px; font-weight: 600; color: var(--text); padding: 0; }
.fd-doc-sum.off { cursor: default; text-decoration: none; }
.fd-doc-sum.off:hover { color: var(--text); }
.fd-doc-more { font-size: 14px; color: var(--text-3); }
.fd-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.fd-check {
  display: inline-flex; align-items: flex-start; gap: 8px;
  font-size: 14px; line-height: 1.4; border-radius: var(--radius); padding: 7px 12px;
  border: 1px solid transparent;
}
.fd-check .ico { margin-top: 1px; }
.fd-check.ok, .fd-check.none { padding: 7px 0; border: 0; }
.fd-check.warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.fd-check b { font-weight: 600; }
.fd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

.fd-why {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.fd-why-h { font-size: 15px; font-weight: 600; }
.fd-reasons { display: flex; flex-wrap: wrap; gap: 8px; }
.fd-reason {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
}
.fd-reason.on { font-weight: 600; background: var(--accent-soft); border-color: var(--accent); }
.fd-dot {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: var(--surface); border: 1.5px solid var(--text-3);
}
.fd-reason.on .fd-dot { border: 5px solid var(--accent); }
.fd-note { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-3); }
.fd-note b { color: var(--text-2); font-weight: 600; }
.fd-note textarea, .dg-field textarea {
  width: 100%; min-height: 64px; resize: vertical;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 10px 12px; font-size: 15px; line-height: 1.45; color: var(--text);
}
.fd-note textarea:focus, .dg-field textarea:focus, .dg-field input:focus,
.rp-date input:focus, .mn-date:focus { outline: none; border-color: var(--accent); }
.fd-why-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.fd-why-hint { font-size: 13px; color: var(--text-3); }
.fd-more { align-self: center; }
.fd-empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 20px; font-size: 15px; color: var(--text-2);
}

/* ── Отчёты ────────────────────────────────────────────────────────── */

.rp-layout {
  width: 100%; max-width: 1320px; margin: 0 auto;
  padding: 28px var(--s-4) 40px;
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; align-items: start;
}
.rp-side { display: flex; flex-direction: column; gap: 14px; }
.rp-side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 2px; }
.rp-side-head h2 { font-size: 17px; font-weight: 600; }
.rp-side-head span { font-size: 13px; color: var(--text-3); }
.rp-list {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.rp-item {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; text-align: left;
  border-top: 1px solid var(--line-soft);
}
.rp-item:first-child { border-top: 0; }
.rp-item:hover { background: var(--sunken); }
.rp-item.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.rp-item-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.35; }
.rp-item-meta { font-size: 13px; color: var(--text-3); }
.rp-empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; font-size: 14px; color: var(--text-2); }
.rp-how {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px;
}
.rp-how-title { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--accent); }
.rp-how p { font-size: 13px; line-height: 1.5; color: var(--text-3); }

.rp-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.rp-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
.rp-head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rp-head-meta { font-size: 14px; color: var(--text-3); }
.rp-head-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rp-delete-confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }

.rp-period {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.rp-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.rp-date { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-3); }
.rp-date input, .mn-date {
  height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums;
}
.rp-period-note { flex: 1 1 260px; font-size: 13px; line-height: 1.45; color: var(--text-3); }

.rp-page { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rp-failed {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--loss-soft); border: 1px solid var(--loss); border-radius: var(--radius);
  padding: 12px 16px; font-size: 14px; line-height: 1.45; color: var(--loss);
}
.rp-failed .ico { margin-top: 2px; }
.rp-spec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rp-spec-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 14px 18px; text-align: left; font-size: 15px;
}
.rp-spec-head span { font-size: 13px; color: var(--text-3); }
.rp-chev { flex: none; color: var(--text-3); transition: transform .15s; }
.rp-chev.open { transform: rotate(90deg); }
.rp-spec-row { padding: 14px 18px; border-top: 1px solid var(--line-soft); }
.rp-spec-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rp-spec-row-head b { font-size: 15px; font-weight: 600; }
.rp-spec-view { flex: 1; font-size: 13px; color: var(--text-3); }
.rp-sql {
  margin-top: 8px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--sunken); color: var(--text-2);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  white-space: pre-wrap; overflow-x: auto;
}

/* ── Деньги ────────────────────────────────────────────────────────── */

.mn-note {
  display: flex; align-items: center; gap: 10px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 16px; font-size: 14px; color: var(--text-2);
}
.mn-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.mn-period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mn-dash { color: var(--text-3); }
.mn-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.mn-kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.mn-kpi.lead { border-top: 3px solid var(--bar); padding-top: 16px; }
.mn-kpi-l { font-size: 15px; color: var(--text-3); }
.mn-kpi-v { align-self: flex-start; font-size: 32px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }

.mn-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.mn-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px; }
.mn-card-head h2 { font-size: 17px; font-weight: 600; }
.mn-card-head span { font-size: 13px; color: var(--text-3); }
.mn-card-head h2 .mn-count { font-size: 17px; font-weight: 400; color: var(--text-3); }
.mn-scroll { overflow-x: auto; }
.mn-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.mn-table th {
  font-size: 13px; font-weight: 600; color: var(--text-3); text-align: left;
  background: var(--sunken); padding: 10px 22px; border-top: 1px solid var(--line); white-space: nowrap;
}
.mn-table td { padding: 11px 22px; border-top: 1px solid var(--line-soft); vertical-align: baseline; }
.mn-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mn-code { font-family: var(--mono); font-size: 13px; color: var(--text-3); width: 1%; white-space: nowrap; }
.mn-share { font-size: 13px; color: var(--text-3); }
.mn-group td {
  padding-top: 16px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-2);
}
.mn-total td { background: var(--sunken); font-weight: 600; }
.mn-net td { font-size: 18px; font-weight: 700; border-top: 2px solid var(--text); }
.mn-net .mn-share { font-size: 13px; font-weight: 600; }
.mn-table .fig.gain { color: var(--gain); }
.mn-table .fig.loss { color: var(--loss); }
.mn-osv th, .mn-osv td { padding-left: 14px; padding-right: 14px; }
.mn-osv th:first-child, .mn-osv td:first-child { padding-left: 22px; }
.mn-osv th:last-child, .mn-osv td:last-child { padding-right: 22px; }
.mn-osv .mn-band { text-align: center; border-left: 1px solid var(--line); }
.mn-osv .mn-band-l, .mn-osv td:nth-child(3), .mn-osv td:nth-child(5), .mn-osv td:nth-child(7) { border-left: 1px solid var(--line-soft); }
.mn-osv tr:nth-child(2) th { border-top: 1px solid var(--line-soft); }
.mn-more { padding: 12px 22px; border-top: 1px solid var(--line-soft); }

/* ── Рассылки ──────────────────────────────────────────────────────── */

.dg-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.dg-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dg-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dg-card-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.dg-card h2, .dg-side-head h2 { font-size: 17px; font-weight: 600; }
.dg-card-head span, .dg-side-head span { font-size: 13px; color: var(--text-3); }
.dg-rows { display: flex; flex-direction: column; }
.dg-row {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 8px 20px; align-items: start;
  padding: 18px 20px; border-top: 1px solid var(--line-soft);
}
.dg-row:first-child { border-top: 0; }
.dg-row.off { background: var(--sunken); }
.dg-when { display: flex; flex-direction: column; gap: 2px; }
.dg-time { font-size: 22px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.dg-days { font-size: 13px; color: var(--text-3); }
.dg-body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.dg-mode { font-size: 12px; font-weight: 600; border-radius: var(--radius-pill); padding: 2px 8px; }
.dg-mode.gen { color: var(--accent); background: var(--accent-soft); }
.dg-mode.fin { color: var(--gain); background: var(--gain-soft); }
.dg-mode.ops { color: var(--warn); background: var(--warn-soft); }
.dg-row.off .dg-mode { opacity: .65; }
.dg-q { font-size: 15px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.dg-row.off .dg-q { color: var(--text-2); }
.dg-off { font-size: 13px; font-style: italic; color: var(--text-3); }
.dg-ctl { display: flex; align-items: center; gap: 14px; }
.dg-del { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); color: var(--text-3); }
.dg-del:hover { color: var(--loss); background: var(--loss-soft); }
.dg-empty { padding: 20px; font-size: 15px; color: var(--text-2); }
.dg-empty.error { color: var(--loss); }

.dg-savebar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.dg-savebar.dirty { background: var(--warn-soft); border-color: var(--warn-line); }
.dg-status { font-size: 14px; color: var(--text-2); }
.dg-status.ok { color: var(--gain); }
.dg-status.err { color: var(--loss); }

.dg-form { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.dg-field { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.dg-field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.dg-field textarea { min-height: 84px; }
.dg-field small { font-size: 13px; color: var(--text-3); }
.dg-time-field input {
  height: 44px; width: 140px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums;
}
.dg-form-act { display: flex; gap: 8px; }

.dg-side { display: flex; flex-direction: column; gap: 12px; }
.dg-side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dg-tg {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: end; gap: 10px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 16px;
}
.dg-tg-msg {
  grid-column: 2; grid-row: 1;
  background: var(--surface); border-radius: 12px 12px 12px 4px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow);
}
.dg-tg-avatar {
  grid-column: 1; grid-row: 1;
  width: 34px; height: 34px; border-radius: 50%; background: var(--rail); color: var(--rail-text);
  display: grid; place-items: center;
}
.dg-tg-avatar svg { width: 24px; height: 24px; }
.dg-tg-from { font-family: var(--display); font-size: 15px; font-weight: 600; color: var(--accent); }
.dg-tg-q { font-size: 15px; font-weight: 600; line-height: 1.45; }
.dg-tg-a { font-size: 14px; line-height: 1.45; color: var(--text-2); }
.dg-tg-time { align-self: flex-end; font-size: 12px; color: var(--text-3); }
.dg-tg-empty { grid-column: 1 / -1; font-size: 14px; color: var(--text-2); }
.dg-side-note { font-size: 13px; line-height: 1.5; color: var(--text-3); }

/* ── Вход ──────────────────────────────────────────────────────────── */

.lg-screen { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--ground); }
.lg-main { display: flex; flex-direction: column; padding: 32px 24px; background: var(--surface); min-width: 0; }
.lg-brand { display: flex; align-items: center; gap: 10px; }
.lg-mark { display: inline-flex; color: var(--text); }
.lg-brand-name { font-family: var(--display); font-size: 16px; font-weight: 600; }
.lg-center { flex: 1; display: grid; place-items: center; padding: 40px 0; }
.lg-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 24px; }
.lg-title h1 { font-family: var(--display); font-size: 34px; font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; }
.lg-title p { margin-top: 8px; font-size: 16px; line-height: 1.5; color: var(--text-2); }
.lg-field { display: flex; flex-direction: column; gap: 8px; }
.lg-field label { font-size: 14px; font-weight: 600; }
.lg-input {
  display: flex; align-items: center; padding: 0 4px 0 14px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
}
.lg-input:focus-within { border-color: var(--accent); }
.lg-input.bad { border-color: var(--loss); }
.lg-input input {
  flex: 1; min-width: 0; height: 46px; border: 0; outline: none; background: transparent;
  font-family: var(--mono); font-size: 15px; color: var(--text);
}
.lg-eye { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); border-radius: var(--radius); }
.lg-eye:hover, .lg-eye[aria-pressed="true"] { color: var(--text); }
.lg-err { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 1.45; color: var(--loss); }
.lg-err svg { flex: none; margin-top: 2px; }
.lg-hint { font-size: 14px; color: var(--text-3); }
.lg-btn {
  min-height: 50px; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent); font-size: 16px; font-weight: 600;
}
.lg-btn:hover { background: var(--accent-ink); }
.lg-btn:disabled { opacity: .5; cursor: default; }
.lg-foot { font-size: 13px; color: var(--text-3); }
.lg-aside {
  display: grid; place-items: center; padding: 48px 32px;
  background: var(--sunken); border-left: 1px solid var(--line);
}
.lg-sample { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 20px; }
.lg-sample-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.lg-sample-head { padding: 22px 24px 16px; font-size: 24px; font-weight: 700; line-height: 1.3; }
.lg-sample-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 24px 22px; }
.lg-sample-tiles div { display: flex; flex-direction: column; gap: 2px; background: var(--sunken); border-radius: var(--radius); padding: 12px 14px; }
.lg-sample-tiles span { font-size: 13px; color: var(--text-3); }
.lg-sample-tiles b { font-size: 20px; font-weight: 700; }
.lg-sample-tiles b.loss { color: var(--loss); }
.lg-sample-src { padding: 12px 24px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.lg-sample-note { display: flex; gap: 12px; color: var(--accent); }
.lg-sample-note svg { flex: none; margin-top: 2px; }
.lg-sample-note b { display: block; font-size: 17px; font-weight: 600; color: var(--text); }
.lg-sample-note p { margin-top: 4px; font-size: 15px; line-height: 1.5; color: var(--text-2); }

/* ── Публикация ────────────────────────────────────────────────────── */

.pb-scrim {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center; padding: 16px; background: var(--scrim);
}
.pb-card {
  width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .28);
}
.pb-body { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.pb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pb-head h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.pb-head p { margin-top: 4px; font-size: 14px; line-height: 1.45; color: var(--text-2); }
.pb-x { flex: none; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); color: var(--text-3); }
.pb-x:hover { color: var(--text); background: var(--sunken); }
.pb-group { display: flex; flex-direction: column; gap: 8px; }
.pb-label { font-size: 14px; font-weight: 600; }
.pb-opts { display: flex; flex-direction: column; gap: 8px; }
.pb-opt {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.pb-opt:hover { border-color: var(--text-3); }
.pb-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.pb-radio { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text-3); background: var(--surface); }
.pb-opt.on .pb-radio { border: 6px solid var(--accent); }
.pb-opt-text { display: flex; flex-direction: column; gap: 2px; }
.pb-opt-text b { font-size: 15px; font-weight: 600; }
.pb-opt-text span { font-size: 14px; color: var(--text-2); }
.seg.pb-life { display: flex; }
.seg.pb-life button { flex: 1; }
.pb-mark {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
}
.pb-mark b { display: block; font-size: 15px; font-weight: 600; }
.pb-mark span { display: block; margin-top: 2px; font-size: 14px; line-height: 1.45; color: var(--text-2); }
.pb-mark .switch span { display: block; margin: 0; }
.pb-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); }
.pb-link {
  font-family: var(--mono); font-size: 13px; word-break: break-all;
  background: var(--sunken); border-radius: var(--radius); padding: 10px 12px;
}
.pb-code {
  font-family: var(--mono); font-size: 22px; letter-spacing: .3em; text-align: center;
  padding: 10px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent);
}
.pb-warn { font-size: 13px; line-height: 1.45; color: var(--text-3); }

/* ── Документ по ссылке ────────────────────────────────────────────── */

.doc-page { min-height: 100vh; background: var(--ground); }
.doc-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.doc-bar-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.doc-bar-mark { display: inline-flex; color: var(--text); }
.doc-bar-snap { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.doc-bar-snap-short { display: none; }
.doc-main { max-width: 1000px; margin: 0 auto; padding: 32px 24px 64px; }
.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.doc-head-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.doc-head h1 {
  font-family: var(--display); font-size: 34px; line-height: 1.2; font-weight: 500;
  letter-spacing: -0.01em; text-wrap: balance;
}
.doc-q { font-size: 16px; line-height: 1.5; color: var(--text-2); max-width: 62ch; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--text-3); }
.doc-meta b { color: var(--text); font-weight: 600; }
/* Печать: полный мухр, повёрнутый как оттиск. Без событий — это знак. */
.doc-seal {
  flex: none; width: 128px; height: 128px; margin-top: -4px;
  transform: rotate(-10deg); opacity: .92; pointer-events: none;
}
.doc-seal svg { display: block; width: 100%; height: 100%; }
.doc-foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--text-3); }
.doc-foot-open { margin-top: 14px; text-align: center; font-size: 12px; }

.doc-state-wrap { display: grid; place-items: center; padding: 10vh 16px 48px; }
.doc-loading { font-size: 15px; color: var(--text-3); }
.doc-state {
  width: min(420px, 100%); display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px;
}
.doc-state-ico { display: inline-flex; margin-bottom: 8px; }
.doc-state-ico.lock { color: var(--accent); }
.doc-state-ico.warn { color: var(--warn); }
.doc-state-ico.gone { color: var(--text-2); }
.doc-state h1 { font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.doc-state p { font-size: 15px; line-height: 1.5; color: var(--text-2); }
.doc-state .doc-state-title { font-size: 14px; font-weight: 600; color: var(--text); }
.doc-code { display: flex; gap: 8px; width: 100%; margin-top: 4px; }
.doc-code-box {
  flex: 1; min-width: 0; height: 54px; text-align: center;
  font-size: 22px; font-variant-numeric: tabular-nums; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.doc-code-box:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.doc-state-btn {
  width: 100%; min-height: 48px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius); background: var(--accent); color: var(--on-accent);
  font-size: 16px; font-weight: 600; margin-top: 8px;
}
.doc-state-btn:hover { background: var(--accent-ink); color: var(--on-accent); }
.doc-state-btn:disabled { opacity: .5; cursor: default; }
.doc-state-btn.ghost { background: var(--surface); color: var(--accent); border: 1px solid var(--accent-line); }
.doc-state-btn.ghost:hover { background: var(--accent-soft); color: var(--accent); }
.doc-state .doc-state-note { font-size: 13px; color: var(--text-3); }
.doc-state .doc-state-note.ruled { width: 100%; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line-soft); }

/* ── Ступень 3 на узком экране ─────────────────────────────────────── */

@media (max-width: 900px) {
  .screen-page { padding: 20px 16px 32px; gap: 20px; }
  .rp-layout { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 32px; gap: 20px; }
  .rp-how { display: none; }
  .dg-layout { grid-template-columns: minmax(0, 1fr); }
  .dg-row { grid-template-columns: minmax(0, 1fr) auto; padding: 16px; }
  .dg-when { grid-column: 1; grid-row: 1; }
  .dg-ctl { grid-column: 2; grid-row: 1; gap: 8px; }
  .dg-body { grid-column: 1 / -1; }
  .fd-card { padding: 16px; }
  .fd-card-head { flex-direction: column; gap: 10px; }
  .fd-sum { align-items: flex-start; text-align: left; }
  .fd-actions { margin-left: 0; width: 100%; }
  .fd-actions > button { flex: 1 1 auto; justify-content: center; }
  .fd-tile { padding: 12px 14px; }
  .fd-tile-n { font-size: 22px; }
  .mn-head { flex-direction: column; align-items: flex-start; }
  .mn-kpi-v { font-size: 28px; }
  .mn-card-head { padding: 16px; }
  .mn-table th, .mn-table td { padding-left: 16px; padding-right: 16px; }
  .lg-screen { grid-template-columns: 1fr; }
  .lg-aside { display: none; }
  .lg-title h1 { font-size: 30px; }
  .doc-bar { padding: 10px 14px; }
  .doc-bar-snap-long { display: none; }
  .doc-bar-snap-short { display: inline; }
  .doc-main { padding: 20px 16px 48px; }
  .doc-head { gap: 12px; }
  .doc-head h1 { font-size: 26px; }
  .doc-seal { width: 84px; height: 84px; }
  .doc-state { padding: 24px; }
}

/* ══════════════════════════════════════════════════════════════════════
   Ступень 5: «Память» — экран и блок памяти под ответом чата.
   ══════════════════════════════════════════════════════════════════════ */

.mem-top {
  display: flex; flex-wrap: wrap; gap: 24px 40px;
  align-items: flex-end; justify-content: space-between;
}
.mem-head { flex: 1 1 420px; min-width: 0; gap: 10px; }
.mem-head .report-title { font-size: 40px; line-height: 1.15; }
.mem-head .report-summary { max-width: 560px; }
.mem-tools { flex: 0 1 320px; min-width: 260px; display: flex; flex-direction: column; gap: 10px; }
.mem-search { position: relative; }
.mem-search .ico { position: absolute; left: 12px; top: 13px; z-index: 1; color: var(--text-3); pointer-events: none; }
.mem-search input {
  width: 100%; box-sizing: border-box; height: 42px; padding: 0 12px 0 36px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}
.mem-remember {
  display: flex; align-items: center; gap: 12px; min-height: 44px;
  padding: 4px 0; text-align: left; color: var(--text);
}
.mem-remember .switch { width: 42px; height: 24px; }
.mem-remember .switch span { width: 18px; height: 18px; }
.mem-remember-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mem-remember-title { font-size: 14px; font-weight: 600; }
.mem-remember-hint { font-size: 12px; line-height: 1.4; color: var(--text-3); }

.mem-tabs { align-self: flex-start; max-width: 100%; }
.mem-tabs button { display: inline-flex; align-items: center; gap: 6px; }
.mem-tab-count { font-size: 12px; font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }

.mem-layout { display: flex; flex-wrap: wrap; gap: 32px 48px; align-items: flex-start; }
.mem-list { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }

.mem-group {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 30px 4px 10px; border-bottom: 1px solid var(--line);
}
.mem-group.first { padding-top: 0; }
.mem-group h2, .mem-aside h2 {
  margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
}
.mem-group span { font-size: 13px; color: var(--text-3); }

.mem-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 24px;
  align-items: center; padding: 15px 4px; border-bottom: 1px solid var(--line-soft);
  scroll-margin-top: 80px;
}
.mem-row.lit { background: var(--accent-soft); border-radius: var(--radius); }
.mem-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mem-text { font-size: 17px; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.mem-deal { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mem-date { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.mem-meta {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
  font-size: 13px; line-height: 1.4; color: var(--text-3);
}
.mem-src-link { color: var(--text-2); }
.mem-badge, .mem-vis {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 500;
  border-radius: 999px; padding: 1px 8px; line-height: 1.5;
  color: var(--text-2); border: 1px solid var(--line);
}
.mem-vis.team { color: var(--accent-ink); border-color: var(--accent-line); }
.mem-badge.warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.mem-actions { display: flex; gap: 4px; align-items: center; }
.mem-actions .btn-link, .mem-gone .btn-link { min-height: 40px; padding: 0 10px; }
.btn-link.quiet { color: var(--text-2); }

.mem-edit { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mem-edit input[type="text"] {
  flex: 1 1 100%; min-width: 0; box-sizing: border-box; height: 42px; padding: 0 12px;
  border: 1px solid var(--accent-line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
}
.mem-edit-due, .mem-edit-team {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2);
}
.mem-edit-due input {
  height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}

.mem-gone {
  display: flex; gap: 10px; align-items: center; padding: 6px 4px;
  border-bottom: 1px solid var(--line-soft); font-size: 14px; color: var(--text-3);
}
.mem-gone-label { font-weight: 600; color: var(--text-2); }
.mem-gone-text { flex: 1; min-width: 0; text-decoration: line-through; overflow-wrap: anywhere; }

.mem-never-add {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 16px 4px; border-bottom: 1px solid var(--line-soft);
}
.mem-never-add input {
  flex: 1 1 320px; min-width: 0; box-sizing: border-box; height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 15px;
}

.mem-aside {
  flex: 1 1 260px; max-width: 320px; min-width: 240px;
  display: flex; flex-direction: column; gap: 14px; padding-top: 6px;
}
.mem-aside h2 { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.mem-aside p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.mem-aside-count {
  display: flex; flex-direction: column; gap: 4px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--text-3);
}
.mem-aside-count .num { font-size: 14px; font-weight: 600; color: var(--text); }
.mem-aside-clear {
  display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line);
}
.mem-aside-clear .btn-link { align-self: flex-start; padding: 0; }
.mem-clear-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-quiet.mem-danger { color: var(--loss); border-color: var(--loss); font-weight: 600; }

/* Под ответом чата. */
.mem-used { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.mem-used-label { font-size: 13px; font-weight: 600; color: var(--text-2); margin-right: 2px; }
.mem-chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--text-2); font-size: 13px; line-height: 1.35; text-align: left;
}
.mem-chip:hover { border-color: var(--accent-line); color: var(--text); }
.mem-chip .ico { color: var(--text-3); }

.mem-offer {
  margin-top: 16px; background: var(--surface); border: 1px solid var(--accent-line);
  border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px;
}
.mem-offer-kicker {
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
}
.mem-offer-q { margin: 0; font-size: 17px; font-weight: 500; line-height: 1.45; }
.mem-offer-why { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-3); }
.mem-offer-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mem-offer-done {
  margin: 0; font-size: 16px; line-height: 1.5;
  display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline;
}
.mem-offer-strong { font-weight: 600; }
.mem-offer-note { font-size: 14px; color: var(--text-3); }
.mem-offer .btn-link { align-self: flex-start; padding: 0; }
.mem-offer-err { margin: 0; font-size: 14px; color: var(--loss); }

@media (max-width: 700px) {
  .mem-head .report-title { font-size: 30px; }
  .mem-tools { flex-basis: 100%; min-width: 0; }
  .mem-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .mem-actions { margin-left: -10px; }
  .mem-aside { max-width: none; min-width: 0; }
}

/* ── Компания и доступ ─────────────────────────────────────────────── */

.co-page { max-width: 1080px; gap: 52px; }
.co-head { display: flex; flex-direction: column; gap: 10px; }
.co-head .report-title { font-size: 40px; line-height: 1.15; margin: 0; }
.co-head .report-summary { margin: 0; max-width: 640px; }
.co-section { display: flex; flex-direction: column; }
.co-section-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.co-section-title { display: flex; flex-direction: column; gap: 4px; }
.co-section-title h2 { margin: 0; font-size: 22px; font-weight: 600; }
.co-section-title h3, .co-sec-block > h3 { margin: 0; font-size: 15px; font-weight: 600; }
.co-sub { font-size: 13px; line-height: 1.4; color: var(--text-3); overflow-wrap: anywhere; }
.co-person { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.co-name { font-size: 16px; font-weight: 600; }
.co-note { font-size: 13px; color: var(--text-3); }
.co-caps { letter-spacing: .04em; text-transform: uppercase; }

.co-invite {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 18px 4px; border-bottom: 1px solid var(--line);
}
.co-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 180px; min-width: 0; }
.co-field.grow { flex: 2 1 220px; }
.co-field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.co-field input, .co-field select, .co-link-row input {
  box-sizing: border-box; font: inherit; font-size: 15px; height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text);
  color-scheme: light;
}
[data-theme="dark"] .co-field input, [data-theme="dark"] .co-field select,
[data-theme="dark"] .co-link-row input, [data-theme="dark"] .co-role-select { color-scheme: dark; }

.co-link {
  display: flex; flex-direction: column; gap: 8px; margin: 16px 0 4px; padding: 16px 18px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius);
}
.co-link-title { font-size: 15px; font-weight: 600; }
.co-link-row { display: flex; gap: 8px; flex-wrap: wrap; }
.co-link-row input { flex: 1 1 320px; min-width: 0; font-family: var(--mono); font-size: 13px; }
.co-link .btn-link { align-self: flex-start; padding: 0; }

.co-team-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.35fr) minmax(0, 1.9fr) minmax(0, .7fr) minmax(0, 1.1fr);
  gap: 16px; padding: 16px 4px; border-bottom: 1px solid var(--line-soft); align-items: start;
}
.co-team-row.head, .co-matrix-row.head {
  padding: 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-3); line-height: 1.3;
}
.co-team-row.head { letter-spacing: .04em; text-transform: uppercase; }
.co-role { display: flex; flex-direction: column; gap: 2px; font-size: 15px; line-height: 1.4; }
.co-pending { font-size: 13px; color: var(--warn); }
.co-role-select {
  font: inherit; font-size: 15px; color: var(--text); background: transparent; border: 1px solid transparent;
  border-radius: var(--radius); min-height: 36px; padding: 0 6px; margin-left: -7px; max-width: 100%;
}
.co-role-select:hover, .co-role-select:focus-visible { border-color: var(--line); }
.co-access { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.co-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.co-chip {
  display: inline-flex; align-items: center; font-size: 13px; line-height: 1.4; padding: 2px 9px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--text-2);
}
.co-chip.off { color: var(--text-3); border-style: dashed; }
.co-login { font-size: 14px; color: var(--text-2); line-height: 1.4; }
.co-last { display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--text-2); line-height: 1.4; align-items: flex-start; }
.co-last .btn-link { padding: 0; min-height: 36px; }
.co-confirm { display: inline-flex; gap: 12px; }

.co-matrix-row {
  display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(6, minmax(0, 1fr));
  gap: 4px; padding: 4px; border-bottom: 1px solid var(--line-soft); align-items: center;
}
.co-matrix-row.head { align-items: end; }
.co-matrix-row.head span:not(:first-child) { text-align: center; }
.co-matrix-row .co-person { padding: 8px 0; }
.co-cell {
  font: inherit; width: 100%; min-height: 44px; border: 0; border-radius: var(--radius); background: transparent;
  display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 16px; cursor: pointer;
}
.co-cell.on { color: var(--text); }
.co-cell:not(:disabled):hover { background: var(--sunken); }
.co-cell:disabled { cursor: default; opacity: 1; }
.co-foot { margin: 14px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-3); max-width: 760px; }

.co-src-row {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.6fr); gap: 8px 24px;
  padding: 16px 4px; border-bottom: 1px solid var(--line-soft); align-items: center;
}
.co-status { font-size: 15px; font-weight: 500; line-height: 1.4; color: var(--text); }
.co-status.off { color: var(--text-3); }
.co-status.gain { color: var(--gain); font-size: 14px; }

.co-sec-block {
  display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 8px 32px;
  padding: 20px 4px; border-bottom: 1px solid var(--line-soft);
}
.co-sec-list { display: flex; flex-direction: column; min-width: 0; }
.co-sec-item {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; padding: 0 0 12px;
}
.co-sec-item + .co-sec-item { padding: 12px 0 0; border-top: 1px solid var(--line-soft); }
.co-sec-list > .btn-link { align-self: flex-start; padding: 0; min-height: 40px; }
.co-filter { margin-bottom: 8px; align-self: flex-start; max-width: 100%; }
.co-log-row {
  display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; line-height: 1.45;
}
.co-log-what { min-width: 0; color: var(--text-2); overflow-wrap: anywhere; }
.co-log-what b { font-weight: 600; color: var(--text); }
.co-log-when { flex: none; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.co-lead { margin: 0 0 6px; font-size: 17px; line-height: 1.5; font-weight: 500; max-width: 620px; }
.co-export { align-self: flex-start; margin-top: 14px; }

.co-plan {
  display: flex; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; align-items: center;
  padding: 20px 4px; border-bottom: 1px solid var(--line-soft);
}
.co-plan-name { font-size: 18px; font-weight: 600; }
.co-plan-line { font-size: 15px; color: var(--text-2); }
.co-plan-actions { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; }
.co-plan-actions a { text-decoration: none; }

.mem-locked { font-size: 13px; color: var(--text-3); padding: 0 10px; }

@media (max-width: 900px) {
  .co-page { gap: 40px; }
  .co-head .report-title { font-size: 30px; }
  .co-team-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 16px; }
  .co-team-row.head { display: none; }
  .co-access { grid-column: 1 / -1; }
  .co-matrix { overflow-x: auto; }
  .co-matrix-row { min-width: 560px; }
  .co-sec-block { grid-template-columns: minmax(0, 1fr); }
  .co-src-row { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Знакомство (ступень 7) ----------
   Одна мысль на экран: заголовок Lora 48, текст 18, одна главная кнопка
   внизу. Переходы спокойные — подъём на 14px и проявление; при «меньше
   движения» всё стоит сразу. Цифры знакомства — не ссылки на документ,
   поэтому без латунного пунктира .fig: жирные табличные цифры. */

@keyframes obStep { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes obIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes obWord { 0% { opacity: 0; transform: translateY(12px); } 20%, 78% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes obPhrase { 0% { opacity: 0; transform: translateY(12px); } 15%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes obDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes obFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes obFill { from { width: 0; } to { width: 100%; } }
@keyframes obRun { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

.ob { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: var(--ground); color: var(--text);
  font-family: var(--sans); display: flex; flex-direction: column; }
.ob h1 { font-family: var(--display); font-weight: 500; letter-spacing: -0.01em; margin: 0; }
.ob h2 { margin: 0; }
.ob button { font: inherit; }
.ob .ob-in { animation: obIn .7s cubic-bezier(.2,.7,.2,1) both; }
.ob .ob-fade { animation: obFade .5s ease-out both; }
.ob .ob-draw { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: obDraw 1s cubic-bezier(.4,0,.2,1) both; }
.ob-num { font-weight: 600; font-variant-numeric: tabular-nums; }
.ob-muted { color: var(--text-3); margin: 0; }
.ob-muted.small, .ob .small { font-size: 13px; }
.ob .center { text-align: center; }
.ob-label { font-size: 14px; font-weight: 500; color: var(--text-2); }
.ob-error { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: 560px; padding: 10px 16px;
  background: var(--loss-soft); color: var(--loss); border-radius: 6px; font-size: 14px; z-index: 60; }

/* Шапка шагов 2–9 */
.ob-bar { position: sticky; top: 0; z-index: 2; height: 72px; flex: none; display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; padding: 0 32px; background: var(--ground); }
.ob-bar-end { display: flex; justify-content: flex-end; }
.ob-dashes { display: flex; gap: 6px; }
.ob-dash { display: block; width: 32px; height: 3px; border-radius: 2px; background: var(--line); }
.ob-dash.done { background: var(--text-3); }
.ob-dash.now { background: var(--accent); }
.ob-ghost { color: var(--text-2); background: transparent; border: 0; border-radius: 6px; min-height: 44px; padding: 0 12px;
  font-size: 15px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.ob-ghost:hover { background: var(--sunken); }
.ob-back { padding-left: 6px; }
.ob-back span { display: inline-flex; }

/* Шаг */
.ob-step { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 0 32px 48px;
  animation: obStep .6s cubic-bezier(.2,.7,.2,1) both; }
.ob-col { flex: 1; width: 100%; max-width: 660px; display: flex; flex-direction: column; justify-content: center; gap: 32px; padding: 16px 0 36px; }
.ob-col.wide { max-width: 1040px; }
.ob-head { display: flex; flex-direction: column; gap: 12px; text-align: center; align-items: center; }
.ob-head.narrow { max-width: 680px; margin: 0 auto; }
.ob-head h1 { font-size: 48px; line-height: 1.1; }
.ob-head p { margin: 0; font-size: 18px; line-height: 1.5; color: var(--text-2); }
.ob-primary { width: 320px; max-width: 100%; min-height: 48px; border: 0; border-radius: 6px; background: var(--accent);
  color: var(--on-accent); font-size: 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ob-primary:hover { background: var(--accent-ink); }
.ob-primary[aria-disabled="true"], .ob-primary:disabled { background: var(--sunken); color: var(--text-3); border: 1px solid var(--line); cursor: not-allowed; }
.ob-primary.wide { width: 100%; }
.ob-outline { min-height: 44px; padding: 0 18px; border: 1px solid var(--accent-line); border-radius: 6px; background: transparent;
  color: var(--accent); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ob-outline.strong { font-size: 15px; font-weight: 600; min-height: 48px; padding: 0 22px; }
.ob-outline:hover { background: var(--accent-soft); }
.ob-outline:disabled { opacity: .5; cursor: not-allowed; }
.ob-link { background: transparent; border: 0; color: var(--accent); font-size: 14px; font-weight: 500; min-height: 40px; padding: 0 10px; cursor: pointer; border-radius: 6px; }
.ob-link:hover { background: var(--sunken); }
.ob-small-primary { min-height: 40px; padding: 0 14px; border: 0; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 600; cursor: pointer; }
.ob-lock { margin: 0; display: flex; gap: 10px; align-items: flex-start; justify-content: center; font-size: 14px; line-height: 1.5; color: var(--text-3); }
.ob-lock > span:first-child { flex: none; margin-top: 2px; display: inline-flex; }
.ob-note { margin: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 16px; line-height: 1.5; color: var(--text-2); }
.ob-under { margin: 12px 0 0; }
.ob-row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ob-field { display: flex; flex-direction: column; gap: 8px; }
.ob-field label { font-size: 14px; font-weight: 500; color: var(--text-2); }
.ob-field input, .ob-team-row input, .ob-team-row select, .ob-mem input {
  font: inherit; font-size: 17px; min-height: 52px; box-sizing: border-box; padding: 0 16px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); color: var(--text); }
.ob-field input:focus-visible, .ob-team-row input:focus-visible, .ob-mem input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[data-theme="dark"] .ob input, [data-theme="dark"] .ob select { color-scheme: dark; }

/* Список «Что внутри» и подобные */
.ob-inside, .ob-sources { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ob-inside li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; align-items: baseline; padding: 20px 4px; border-bottom: 1px solid var(--line); }
.ob-n { font-family: var(--mono); font-size: 13px; color: var(--brass); }
.ob-li { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ob-li-t { font-size: 19px; font-weight: 600; line-height: 1.3; }
.ob-li-d { font-size: 15px; line-height: 1.45; color: var(--text-3); }

/* Выбор */
.ob-choice { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; min-height: 52px; padding: 10px 16px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; width: 100%; }
.ob-choice.on { border-color: var(--accent); background: var(--accent-soft); }
.ob-choice.off { opacity: .5; cursor: not-allowed; }
.ob-choice.static { cursor: default; }
.ob-choice-t { font-size: 16px; font-weight: 600; }
.ob-choice-d { font-size: 14px; color: var(--text-3); }
.ob-box { flex: none; width: 20px; height: 20px; box-sizing: border-box; border: 1.5px solid var(--text-3); border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--on-accent); }
.on > .ob-box { background: var(--accent); border-color: var(--accent); }
.ob-radio { flex: none; width: 18px; height: 18px; box-sizing: border-box; border: 1.5px solid var(--text-3); border-radius: 50%; }
.on > .ob-radio { border: 5px solid var(--accent); }
.ob-segs { display: flex; gap: 2px; padding: 3px; background: var(--sunken); border-radius: 8px; width: 320px; max-width: 100%; }
.ob-segs.full { width: 100%; }
.ob-seg { flex: 1; min-height: 40px; border: 0; border-radius: 6px; padding: 0 14px; background: transparent; color: var(--text-2);
  font-size: 15px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ob-seg.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* Что для вас важно */
.ob-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 56px; align-items: start; }
.ob-stack { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.ob-group { display: flex; flex-direction: column; gap: 8px; }
.ob-topic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ob-topic-grid .ob-choice { min-height: 56px; }
.ob-hint { min-height: 20px; }
.ob-example { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ob-example h2 { font-size: 14px; }
.ob-ex-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); }
.ob-ex-q { margin: 0; align-self: flex-end; max-width: 85%; background: var(--sunken); border-radius: 12px; padding: 10px 14px; font-size: 15px; line-height: 1.4; }
.ob-ex-a { display: flex; flex-direction: column; gap: 12px; }
.ob-ex-brand { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--accent); }
.ob-ex-text { margin: 0; font-size: 17px; line-height: 1.5; }
.ob-ex-rows { display: flex; flex-direction: column; border-top: 1px solid var(--line-soft); }
.ob-ex-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
.ob-ex-row span { color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-ex-src { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.ob-ex-src b { font-weight: 600; color: var(--text-2); }

/* Источники */
.ob-sources li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 18px 4px; border-bottom: 1px solid var(--line); }
.ob-src-st { font-size: 14px; color: var(--text-2); text-align: right; max-width: 300px; }
.ob-src-st b { font-weight: 600; color: var(--text); }
.ob-src-st.muted { color: var(--text-3); }

/* Знакомлюсь */
.ob-learn { display: flex; flex-direction: column; gap: 20px; }
.ob-track { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; position: relative; }
.ob-bar-fill { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 2px; animation: obFill 6s cubic-bezier(.3,.1,.3,1) both; }
.ob-bar-run { display: block; height: 100%; width: 40%; background: var(--accent); border-radius: 2px; animation: obRun 1.4s ease-in-out infinite; }
.ob-phrases { position: relative; height: 72px; text-align: center; }
.ob-phrase, .ob-phrase-final { position: absolute; left: 0; right: 0; top: 0; font-size: 26px; font-weight: 500; line-height: 1.35; }
.ob-phrase { opacity: 0; animation: obPhrase 2s ease-in-out both; }
.ob-phrase-static { margin: 0; text-align: center; font-size: 26px; font-weight: 500; }
.ob-facts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ob-facts li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; align-items: baseline; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); }
.ob-fact-n { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.ob-fact-t { font-size: 16px; line-height: 1.45; color: var(--text-2); min-width: 0; }

/* Первые находки */
.ob-finds { border-top: 1px solid var(--line); }
.ob-find { display: grid; grid-template-columns: 210px minmax(0, 1fr) auto; gap: 28px; align-items: center; padding: 24px 4px; border-bottom: 1px solid var(--line); transition: opacity .2s; }
.ob-find.dim > :not(.ob-find-btns) { opacity: .55; }
.ob-find-fig { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.ob-find-text { font-size: 15px; line-height: 1.5; color: var(--text-2); }
.ob-find-btns { display: flex; gap: 8px; }
.ob-pick { min-height: 40px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ob-pick.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.ob-pick.on-muted { border-color: var(--text-3); background: var(--sunken); color: var(--text); font-weight: 600; }

/* Что я запомнил */
.ob-mem { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ob-mem li { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 8px 4px; min-height: 56px; box-sizing: border-box; border-bottom: 1px solid var(--line-soft); }
.ob-mem li.ob-mem-empty { display: block; padding: 18px 4px; }
.ob-mem-l { display: flex; flex-direction: column; gap: 1px; }
.ob-mem-l b { font-size: 13px; font-weight: 600; color: var(--text-2); }
.ob-mem-l span { font-size: 12px; color: var(--text-3); }
.ob-mem-v { font-size: 16px; line-height: 1.4; min-width: 0; }
.ob-mem input { font-size: 16px; min-height: 40px; padding: 0 12px; border-color: var(--accent); width: 100%; }
.ob-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: 100%; padding: 0; border: 0;
  background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.ob-switch-row .ob-li-t { font-size: 16px; }
.ob-switch-row .ob-li-d { font-size: 14px; }
.ob-switch { flex: none; position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line); transition: background .2s; }
.ob-switch > span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .2s; }
.ob-switch.on { background: var(--accent); }
.ob-switch.on > span { left: 21px; }
.ob-switch-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }

/* Ритуал и команда */
.ob-ritual { display: flex; flex-wrap: wrap; gap: 20px 28px; align-items: flex-end; }
.ob-time { width: 132px; font-variant-numeric: tabular-nums; min-height: 44px !important; }
.ob-days { display: flex; gap: 4px; }
.ob-day { width: 44px; min-height: 44px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer; }
.ob-day.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.ob-ritual-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ob-status { margin: 0; font-size: 15px; line-height: 1.5; color: var(--text-2); }
.ob-team { display: flex; flex-direction: column; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.ob-team h2 { font-size: 18px; font-weight: 600; }
.ob-team-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ob-team-row input { flex: 1 1 220px; min-width: 0; font-size: 15px; min-height: 44px; }
.ob-team-row select { font-size: 15px; min-height: 44px; padding: 0 10px; }
.ob-issued { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--text-2); }
.ob-issued input { font-family: var(--mono); font-size: 13px !important; }

/* Готово */
.ob-final { position: relative; justify-content: center; padding-bottom: 72px; }
.ob-final-top { position: absolute; top: 14px; left: 32px; }
.ob-final-body { width: 100%; max-width: 880px; display: flex; flex-direction: column; align-items: center; gap: 48px; margin: auto 0; padding-top: 64px; }
.ob-final .ob-head h1 { font-size: 52px; margin-top: 8px; }
.ob-final .ob-head p { font-size: 20px; }
.ob-final-mark { display: inline-flex; }
.ob-starts-wrap { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.ob-kicker { margin: 0; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.ob-kicker.left { text-align: left; }
.ob-starts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ob-starts li { display: flex; flex-direction: column; gap: 8px; padding: 22px 24px; min-width: 0; }
.ob-starts li + li { border-left: 1px solid var(--line); }
.ob-starts .ob-li-t { font-size: 17px; line-height: 1.35; }
.ob-starts .ob-li-d { font-size: 14px; }
.ob-final-foot { position: absolute; bottom: 24px; left: 16px; right: 16px; margin: 0; text-align: center; font-size: 13px; color: var(--text-3); }

/* Приветствие на лазури с гирихом */
.ob.ob-on-rail { background: var(--rail) url(/girih-light.svg) center / 96px 96px; color: var(--rail-text); }
[data-theme="dark"] .ob.ob-on-rail { background: var(--rail) url(/girih-dark.svg) center / 96px 96px; }
.ob-hello { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 48px 80px; position: relative; }
.ob-hello-mark { display: inline-flex; }
.ob-hello-words, .ob-mwords { position: relative; width: 100%; max-width: 1200px; height: 92px; margin-top: 44px; }
.ob-word, .ob-hello-words h1, .ob-mwords > span { position: absolute; left: 0; right: 0; top: 0; text-align: center; font-family: var(--display);
  font-weight: 500; font-size: 64px; line-height: 1.3; color: var(--rail-text); white-space: nowrap; }
.ob-word { opacity: 0; animation: obWord 1.2s ease-in-out both; }
.ob-hello-sub { margin: 20px 0 0; font-size: 20px; line-height: 1.5; color: var(--rail-muted); text-align: center; }
.ob-brass { margin-top: 48px; width: 320px; min-height: 48px; border: 0; border-radius: 6px; background: var(--brass); color: var(--rail);
  font-size: 16px; font-weight: 600; cursor: pointer; }
.ob-brass:hover { background: var(--rail-text); }
.ob-brass.wide { width: 100%; margin-top: 0; }
.ob-rail-ghost { margin-top: 14px; background: transparent; border: 0; color: var(--rail-muted); font-size: 14px; min-height: 40px; padding: 0 12px; cursor: pointer; border-radius: 6px; }
.ob-rail-ghost:hover { color: var(--rail-text); }
.ob-hello-foot { position: absolute; bottom: 32px; left: 0; right: 0; margin: 0; text-align: center; font-size: 13px; color: var(--rail-muted); }

/* Короткий путь в Telegram */
.ob-mini .ob-mbar { flex: none; padding: 12px 20px 0; display: flex; flex-direction: column; gap: 6px; }
.ob-mdashes { display: flex; gap: 4px; }
.ob-mdashes span { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.ob-mdashes span.on { background: var(--accent); }
.ob-mhello { flex: 1; display: flex; flex-direction: column; padding: 16px 24px 24px; }
.ob-mtop { font-size: 13px; color: var(--rail-muted); text-align: center; }
.ob-mmain { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ob-mwords { height: 52px; margin-top: 32px; }
.ob-mwords > span { font-size: 36px; }
.ob-mini .ob-hello-sub { font-size: 17px; }
.ob-mfoot { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; color: var(--rail-muted); }
.ob-mstep { flex: 1; display: flex; flex-direction: column; gap: 24px; padding: 16px 20px 20px; animation: obStep .5s cubic-bezier(.2,.7,.2,1) both; }
.ob-mhead { display: flex; flex-direction: column; gap: 10px; }
.ob-mhead h1 { font-size: 30px; line-height: 1.15; }
.ob-mhead p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--text-2); }
.ob-mtopic { width: 100%; display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 2px; background: transparent; border: 0;
  border-top: 1px solid var(--line-soft); color: var(--text); font-size: 16px; text-align: left; cursor: pointer; flex-wrap: wrap; }
.ob-mtopic.off { color: var(--text-3); cursor: default; }
.ob-mtopic .ob-choice-t { font-size: 16px; font-weight: 500; }
.ob-mtopic .ob-choice-d { font-size: 13px; }
.ob-mgroup { display: flex; flex-direction: column; gap: 10px; }
.ob-mcta { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.ob-mfacts > div { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.ob-mtag { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.ob-mfact { font-size: 16px; line-height: 1.45; }
.ob-mfind { display: flex; flex-direction: column; gap: 6px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.ob-mfind-t { font-size: 15px; font-weight: 600; min-width: 0; }

/* Письмо и карточка в «Компании» */
.co-kit { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.co-kit-row { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .ob-split { grid-template-columns: 1fr; gap: 32px; }
  .ob-find { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .ob-starts { grid-template-columns: 1fr; }
  .ob-starts li + li { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .ob-bar { padding: 0 12px; }
  .ob-dash { width: 18px; }
  .ob-step { padding: 0 20px 28px; }
  .ob-head h1, .ob-final .ob-head h1 { font-size: 32px; }
  .ob-head p { font-size: 16px; }
  .ob-word, .ob-hello-words h1 { font-size: 36px; white-space: normal; }
  .ob-hello-words { height: 104px; }
  .ob-topic-grid { grid-template-columns: 1fr; }
  .ob-facts li { grid-template-columns: 1fr; gap: 2px; }
  .ob-mem li { grid-template-columns: 1fr auto; }
  .ob-mem-l { grid-column: 1 / -1; }
  .ob-sources li { grid-template-columns: 1fr; gap: 6px; }
  .ob-src-st { text-align: left; }
  .ob-primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ob-step, .ob-mstep, .ob .ob-in, .ob .ob-fade, .ob-bar-fill { animation: none !important; opacity: 1 !important; transform: none !important; }
  .ob .ob-draw { animation: none !important; stroke-dashoffset: 0 !important; }
  .ob-word, .ob-phrase { display: none !important; }
}
.ob-choice-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ob-topic-grid .ob-choice { flex-wrap: nowrap; }
/* Заголовок шира колонки: «Когда присылать утренний выпуск?» в одну строку. */
.ob-col > .ob-head:not(.narrow) { margin-inline: calc((100% - min(900px, 100vw - 64px)) / 2); }
@media (max-width: 640px) {
  .ob-final { padding-bottom: 28px; }
  .ob-final-foot { position: static; margin: 28px 0 0; }
  .ob-final-body { gap: 32px; }
}

/* ── Сотрудники-агенты (ступень 8) ─────────────────────────────────── */

.ag-page { gap: 32px; }
.ag-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; }
.ag-head-text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ag-head-text .report-title { font-size: 40px; line-height: 1.15; margin: 0; }
.ag-head-text .report-summary { margin: 0; }
.ag-head-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.ag-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; align-items: start; }
.ag-main { display: flex; flex-direction: column; gap: 36px; min-width: 0; }
.ag-aside { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.ag-sec { display: flex; flex-direction: column; min-width: 0; }
.ag-sec-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.ag-sec-head .btn-link { min-height: 28px; font-size: 13px; }
.ag-caps { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.ag-sec-note { font-size: 13px; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.ag-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brass); flex: none; margin-right: 6px; vertical-align: middle; }
.ag-sec-note .ag-dot { margin-right: 0; }
.ag-p { margin: 10px 0 0; font-size: 15px; line-height: 1.55; color: var(--text-2); }
.ag-k { font-size: 13px; color: var(--text-3); }
.ag-fine { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.ag-fine.center { text-align: center; }
.ag-fine .ico { display: inline-flex; vertical-align: -3px; }
.ag-h2 { margin: 0; font-size: 22px; font-weight: 600; }
.ag-h3 { margin: 0; font-size: 17px; font-weight: 600; }
.ag-empty {
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 24px; margin-top: 16px;
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface);
}
.ag-empty p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-2); max-width: 640px; }

/* Монограмма агента: круг с буквой, латунная точка — работает сейчас. */
.ag-mono {
  position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%; box-sizing: border-box;
  border: 1.5px solid var(--text); color: var(--text); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 21px; font-weight: 500;
}
.ag-mono.sm { width: 38px; height: 38px; font-size: 16px; }
.ag-mono.xs { width: 30px; height: 30px; font-size: 13px; border-width: 1px; }
.ag-mono.lg { width: 72px; height: 72px; font-size: 32px; }
.ag-mono.person { font-family: var(--sans); font-weight: 600; font-size: 11px; }
.ag-mono.tpl { font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--text-2); border-color: var(--line); }
.ag-busy {
  position: absolute; right: 0; bottom: 2px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--brass); box-shadow: 0 0 0 2px var(--surface);
}
.ag-mono.lg .ag-busy { width: 12px; height: 12px; right: 3px; bottom: 4px; }
.ag-tag {
  display: inline-flex; align-items: center; padding: 1px 7px; border: 1px solid var(--accent-line); border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
}

/* Строка сотрудника */
.ag-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 20px; padding: 22px 4px; border-bottom: 1px solid var(--line-soft); }
.ag-row-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ag-row-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.ag-row-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ag-row-name { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.ag-name { font-size: 20px; font-weight: 600; color: var(--text); padding: 0; }
.ag-name:hover { color: var(--accent); }
.ag-role { font-size: 15px; color: var(--text-2); }
.ag-now { font-size: 14px; line-height: 1.45; color: var(--text-2); }
.ag-now b { font-weight: 600; color: var(--text); }
.ag-now-k { color: var(--text-3); }
.ag-case { flex: none; gap: 6px; }
.ag-dl { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.ag-dl > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ag-dl dt { font-size: 13px; color: var(--text-3); }
.ag-dl dd { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.ag-dd-main { font-size: 15px; font-weight: 500; color: var(--text); }
.ag-dd-sub { font-size: 13px; line-height: 1.4; color: var(--text-3); }
.ag-trial-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.ag-trial-bar { display: inline-block; width: 56px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; flex: none; }
.ag-trial-bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.ag-trial-bar.wide { width: 100%; max-width: 300px; margin-top: 10px; }

/* Оргсхема */
.ag-org { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 22px 0 4px; }
.ag-org-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; width: 100%; padding-top: 22px; border-top: 1px solid var(--line); }
.ag-org-col { display: flex; flex-direction: column; gap: 10px; min-width: 170px; max-width: 220px; }
.ag-org-kids { display: flex; flex-direction: column; gap: 8px; padding-left: 14px; border-left: 1px solid var(--line); }
.ag-org-node {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); text-align: left;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); min-width: 0;
}
.ag-org-node.top { min-width: 220px; }
.ag-org-node.agent { border-style: dashed; border-color: var(--accent-line); cursor: pointer; }
.ag-org-node.agent:hover { background: var(--accent-soft); }
.ag-org-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ag-org-t b { font-size: 14px; font-weight: 600; }
.ag-org-t span { font-size: 12px; color: var(--text-3); }
.ag-org-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); align-self: flex-start; }
.ag-org-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.ag-leg { display: inline-block; width: 18px; height: 11px; border-radius: 3px; border: 1px solid var(--line); background: var(--surface); }
.ag-leg.agent { border-style: dashed; border-color: var(--accent-line); }

/* Предложения и правило платформы */
.ag-sug { display: flex; flex-direction: column; gap: 10px; padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.ag-sug-about { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.ag-sug-text { margin: 0; font-size: 16px; line-height: 1.5; }
.ag-sug-ev { font-size: 13px; line-height: 1.45; color: var(--text-3); }
.ag-sug-ev b { font-weight: 700; color: var(--text); }
.ag-sug-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ag-sug-done { font-size: 14px; color: var(--text-2); }
.ag-sug-empty { margin: 14px 0 0; font-size: 14px; line-height: 1.5; color: var(--text-3); }
.ag-rule { display: flex; gap: 10px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.ag-rule .ico { margin-top: 2px; color: var(--text-3); }
.ag-rule b { color: var(--text); }

/* Телефон: список вместо строк с таблицей */
.ag-mobile { display: none; }

/* Личное дело */
.ag-crumbs { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: -12px; }
.ag-crumbs .btn-link .ico { margin-right: 2px; }
.ag-prof-head { display: flex; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap; align-items: flex-start; }
.ag-prof-who { display: flex; gap: 22px; align-items: center; min-width: 0; }
.ag-prof-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ag-prof-text .report-title { font-size: 36px; margin: 0; }
.ag-prof-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 14px; color: var(--text-2); }
.ag-prof-meta > span:not(.ag-tag) + span::before { content: "·"; margin-right: 12px; color: var(--text-3); }
.ag-prof-now { font-size: 14px; color: var(--text-2); }
.ag-src { display: flex; flex-direction: column; gap: 4px; max-width: 300px; }
.ag-src-k { font-size: 13px; color: var(--text-3); }
.ag-src-doc { display: inline-flex; gap: 6px; align-items: flex-start; font-size: 14px; font-weight: 500; color: var(--accent); }
.ag-src-doc .ico { margin-top: 2px; }
.ag-src-meta { font-size: 13px; color: var(--text-3); }
.ag-tabs { align-self: flex-start; max-width: 100%; }
.ag-tab-n { margin-left: 6px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ag-pause { color: var(--loss); border-color: var(--loss); }
.ag-mandate { margin: 0; display: flex; flex-direction: column; }
.ag-mandate > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.ag-mandate dt { font-size: 14px; color: var(--text-3); }
.ag-mandate dd { margin: 0; font-size: 16px; line-height: 1.5; }
.ag-trial { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; padding-top: 16px; }
.ag-trial-day { font-size: 20px; font-weight: 700; }
.ag-trust-bar { display: block; height: 6px; border-radius: 3px; background: var(--line); margin: 10px 0 0; }
.ag-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.ag-tile { display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 18px 0; }
.ag-tile + .ag-tile { padding-left: 16px; border-left: 1px solid var(--line-soft); }
.ag-tile b { font-size: 28px; font-weight: 700; line-height: 1.15; }
.ag-tile-sub { font-size: 13px; line-height: 1.4; color: var(--text-3); }
.ag-side-block { display: flex; flex-direction: column; gap: 10px; }
.ag-side-block > .btn-secondary { align-self: flex-start; }
.ag-card-dl { margin: 0; display: flex; flex-direction: column; }
.ag-card-dl > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.ag-card-dl dt { font-size: 12px; color: var(--text-3); }
.ag-card-dl dd { margin: 0; font-size: 15px; line-height: 1.45; }

/* Журнал */
.ag-journal { display: flex; flex-direction: column; }
.ag-j-row {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto auto; gap: 6px 18px; align-items: start;
  padding: 14px 0; border-bottom: 1px solid var(--line-soft);
}
.ag-j-when { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text-3); }
.ag-j-when .num { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.ag-j-what { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.ag-j-title { font-size: 15px; font-weight: 600; line-height: 1.4; }
.ag-badge { font-size: 12px; padding: 1px 8px; border-radius: var(--radius-pill); border: 1px solid var(--line); color: var(--text-2); }
.ag-badge.obs { border-color: var(--warn-line); color: var(--warn); background: var(--warn-soft); }
.ag-badge.hire { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.ag-j-sum { font-size: 15px; font-weight: 700; white-space: nowrap; padding-top: 1px; }
.ag-j-why { min-height: 24px; font-size: 14px; }
.ag-j-more { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.ag-j-more p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.ag-j-docs { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; font-size: 13px; }
.ag-j-docs .doc-chip { font-size: 13px; color: var(--accent); padding: 0; }
.ag-clause { color: var(--text-2); }

/* Память агента */
.ag-mem { display: flex; flex-direction: column; }
.ag-mem-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.ag-mem-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ag-mem-text { font-size: 15px; font-weight: 500; line-height: 1.45; }
.ag-mem-src { font-size: 13px; color: var(--text-3); }
.ag-scope { flex: none; font-size: 12px; padding: 1px 8px; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--text-2); background: var(--surface); }

/* Матрица полномочий */
.ag-mx-head { display: flex; justify-content: space-between; gap: 12px 24px; align-items: flex-start; flex-wrap: wrap; }
.ag-mx-head .ag-p { margin-top: 6px; max-width: 620px; }
.ag-note {
  display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); font-size: 14px; line-height: 1.5; color: var(--text-2);
}
.ag-note .ico { margin-top: 2px; color: var(--text-3); }
.ag-note b { color: var(--text); }
.ag-mx { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
.ag-mx-row {
  display: grid; grid-template-columns: minmax(180px, 1.7fr) 64px minmax(110px, .95fr) 64px minmax(150px, 1.2fr) 112px;
  gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line-soft); align-items: center; min-width: 760px;
}
.ag-mx-row.head { border-top: 0; background: var(--sunken); font-size: 12px; font-weight: 600; color: var(--text-3); line-height: 1.3; align-items: end; }
.ag-mx-row.head span:nth-child(2), .ag-mx-row.head span:nth-child(4) { text-align: center; }
.ag-mx-gh { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--sunken); min-width: 760px; box-sizing: border-box; }
.ag-mx-act { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; min-width: 0; }
.ag-mx-name { font-size: 15px; font-weight: 600; line-height: 1.35; }
.ag-mx-note { font-size: 12px; color: var(--text-3); }
.ag-changed { font-size: 11px; font-weight: 600; padding: 0 6px; border: 1px solid var(--warn-line); border-radius: var(--radius-pill); color: var(--warn); background: var(--warn-soft); }
.ag-mx-c { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.ag-mx-c.sign { justify-content: flex-start; padding-left: 4px; }
.ag-radio {
  flex: none; width: 22px; height: 22px; border-radius: 50%; box-sizing: border-box; padding: 0;
  border: 1.5px solid var(--text-3); background: var(--surface); cursor: pointer;
}
.ag-radio.on { border: 7px solid var(--bar); }
.ag-radio:disabled { cursor: default; opacity: .45; }
.ag-radio.on:disabled { opacity: 1; }
.ag-lock { display: inline-flex; color: var(--text-3); }
.ag-signer { font: inherit; font-size: 13px; min-width: 0; max-width: 140px; height: 30px; padding: 0 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); color-scheme: light; }
[data-theme="dark"] .ag-signer, [data-theme="dark"] .ag-limit, [data-theme="dark"] .ag-select,
[data-theme="dark"] .ag-lim-in input, [data-theme="dark"] .ag-goal-add input, [data-theme="dark"] .ag-lvl-sel,
[data-theme="dark"] .ag-hours input { color-scheme: dark; }
.ag-signer-t { font-size: 13px; color: var(--text-2); }
.ag-limit { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; line-height: 1.4; resize: none; padding: 4px 8px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text-2); }
.ag-limit:hover, .ag-limit:focus { border-color: var(--line); background: var(--surface); }
.ag-limit-t { font-size: 13px; line-height: 1.4; color: var(--text-2); }
.ag-src-ref { font-size: 13px; color: var(--text-3); display: inline-flex; gap: 4px; align-items: center; line-height: 1.3; }
.ag-src-ref.clause { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; cursor: help; }
.ag-savebar {
  position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  font-size: 14px; color: var(--text-2);
}
.ag-savebar b { color: var(--text); }
.ag-savebar-btns { display: flex; gap: 8px; }
.ag-check { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.ag-check p { margin: 0; font-size: 14px; line-height: 1.5; }
.ag-check .btn-secondary { align-self: flex-start; min-height: 34px; }
.ag-check-k { font-size: 12px; font-weight: 600; color: var(--text-2); }
.ag-check-k.loss { color: var(--loss); }
.ag-check-k.warn { color: var(--warn); }
.ag-sum { display: flex; flex-direction: column; gap: 8px; }
.ag-sum-t { font-size: 16px; font-weight: 700; }
.ag-sum-bar { display: flex; gap: 2px; height: 6px; }
.ag-sum-bar span { display: block; height: 100%; border-radius: 2px; }
.ag-sum-bar .own, .ag-sum-legend i.own { background: var(--bar); }
.ag-sum-bar .sign, .ag-sum-legend i.sign { background: var(--bar-2); }
.ag-sum-bar .never, .ag-sum-legend i.never { background: var(--line); }
.ag-sum-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.ag-sum-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ag-sum-legend i { display: inline-block; width: 10px; height: 4px; border-radius: 2px; }

/* Цели и автопилот */
.ag-lvls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding-top: 16px; }
.ag-lvl { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-height: 190px; box-sizing: border-box; }
.ag-lvl.on { border-color: var(--accent); background: var(--accent-soft); }
.ag-lvl.off { border-style: dashed; background: transparent; }
.ag-lvl-bars { display: inline-flex; gap: 3px; align-items: flex-end; height: 18px; }
.ag-lvl-bars i { display: block; width: 6px; background: var(--line); border-radius: 1px; }
.ag-lvl-bars i:nth-child(1) { height: 6px; } .ag-lvl-bars i:nth-child(2) { height: 10px; }
.ag-lvl-bars i:nth-child(3) { height: 14px; } .ag-lvl-bars i:nth-child(4) { height: 18px; }
.ag-lvl-bars i.f { background: var(--accent); }
.ag-lvl.off .ag-lvl-bars i.f { background: var(--text-3); }
.ag-lvl-t { font-size: 15px; }
.ag-lvl-t .num { color: var(--text-3); font-size: 13px; }
.ag-lvl-d { font-size: 13px; line-height: 1.45; color: var(--text-2); }
.ag-lvl-f { margin-top: auto; font-size: 12px; line-height: 1.4; color: var(--text-3); display: flex; gap: 5px; }
.ag-lvl.on .ag-lvl-f { color: var(--accent); font-weight: 600; }
.ag-goal { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.ag-goal-t { font-size: 16px; font-weight: 600; flex: 1; min-width: 0; }
.ag-goal-add { display: flex; gap: 8px; padding-top: 14px; flex-wrap: wrap; }
.ag-goal-add input { flex: 1 1 260px; min-width: 0; font: inherit; font-size: 15px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.ag-trg { display: flex; flex-direction: column; }
.ag-trg-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 110px 56px; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.ag-trg-row.head { padding: 10px 0; font-size: 12px; font-weight: 600; color: var(--text-3); }
.ag-trg-when { font-size: 15px; font-weight: 600; }
.ag-trg-what { font-size: 14px; line-height: 1.45; color: var(--text-2); }
.ag-lvl-chip { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--text-2); background: var(--surface); }
.ag-lim { display: flex; justify-content: space-between; align-items: center; gap: 10px 20px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.ag-lim-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ag-lim-t b { font-size: 15px; font-weight: 600; }
.ag-lim-t span { font-size: 13px; color: var(--text-3); }
.ag-lim-in { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--text-2); }
.ag-lim-in input { font: inherit; font-size: 15px; width: 84px; height: 38px; padding: 0 10px; box-sizing: border-box; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); color-scheme: light; }
.ag-lim-in input[type="time"] { width: 110px; }
.ag-platform { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 14px; color: var(--text-2); }
.ag-platform > span:not(.ag-caps) { display: flex; gap: 8px; align-items: flex-start; }
.ag-platform .ico { margin-top: 3px; color: var(--text-3); }
.ag-how { list-style: none; margin: 0; padding: 0; counter-reset: how; display: flex; flex-direction: column; }
.ag-how li { counter-increment: how; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 2px 8px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); color: var(--text-3); }
.ag-how li::before { content: counter(how); grid-row: span 2; font-size: 13px; color: var(--text-3); }
.ag-how li b { font-size: 15px; color: var(--text-2); }
.ag-how li span { font-size: 13px; line-height: 1.4; }
.ag-how li.on b { color: var(--text); }
.ag-how li.on span { color: var(--text-2); }

/* Найм: полный экран поверх приложения */
.ag-hire { display: flex; flex-direction: column; }
.ag-hire-bar {
  position: sticky; top: 0; z-index: 3; flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 64px; padding: 0 32px; background: var(--ground); border-bottom: 1px solid var(--line);
}
.ag-hire-bar > .ob-ghost { justify-self: end; }
.ag-hire-brand { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-hire-brand > span:last-child { color: var(--text-3); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.ag-hire-ring { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--brass); box-sizing: border-box; flex: none; }
.ag-hire-body { flex: 1; display: flex; flex-direction: column; padding: 40px 32px 32px; }
.ag-hire-foot {
  position: sticky; bottom: 0; z-index: 3; flex: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 32px; background: var(--ground); border-top: 1px solid var(--line);
}
.ag-hire-foot-l, .ag-hire-foot-r { display: flex; align-items: center; gap: 16px; min-width: 0; }
.ag-hire-stepname { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.ag-hire-hint { font-size: 14px; color: var(--text-2); text-align: right; }
.ag-hire-foot .ob-primary { width: 240px; }
.ag-step { width: 100%; max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.ag-step h1 { font-size: 44px; line-height: 1.1; }
.ag-lead { margin: 0; font-size: 17px; line-height: 1.55; color: var(--text-2); max-width: 760px; }

.ag-pick { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 72px; align-items: center; max-width: 1120px; flex: 1; }
.ag-pick-l { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ag-tpl-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); margin-top: 16px; }
.ag-tpl {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) 18px; gap: 16px; align-items: center; text-align: left;
  padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--text); width: 100%;
}
.ag-tpl:hover:not(:disabled) { background: var(--surface); }
.ag-tpl.on { background: var(--accent-soft); }
.ag-tpl.off { opacity: .6; cursor: not-allowed; }
.ag-tpl-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ag-tpl-t b { font-size: 17px; font-weight: 600; }
.ag-tpl-t span { font-size: 14px; color: var(--text-3); line-height: 1.4; }
.ag-tpl.on .ob-radio { border: 5px solid var(--accent); }
.ag-pick-r { display: flex; flex-direction: column; gap: 14px; }
.ag-drop {
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 40px 36px;
  border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--surface);
}
.ag-drop-ico { display: inline-flex; color: var(--text-2); }
.ag-drop-t { font-size: 18px; font-weight: 600; line-height: 1.4; max-width: 340px; }
.ag-drop-d { font-size: 14px; color: var(--text-3); }
.ag-drop-btn { cursor: pointer; }

.ag-read-head { display: flex; flex-direction: column; gap: 8px; }
.ag-read-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; margin-top: 12px; }
.ag-paper {
  display: flex; flex-direction: column; gap: 6px; padding: 32px 36px; max-height: 64vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.ag-paper-head { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: var(--text-2); }
.ag-paper-head span:first-child { align-self: flex-start; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-bottom: -16px; }
.ag-paper-title { margin: 18px 0 8px; text-align: center; font-family: var(--display); font-size: 21px; font-weight: 500; line-height: 1.3; }
.ag-paper-sec { margin: 14px 0 4px; font-size: 14px; font-weight: 700; }
.ag-paper-cl { margin: 0; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 8px 10px; border-radius: var(--radius); font-size: 14px; line-height: 1.55; color: var(--text-2); }
.ag-paper-cl.hl { background: var(--accent-soft); color: var(--text); }
.ag-paper-cl .num { color: var(--text-3); font-size: 13px; }
.ag-read-rules { display: flex; flex-direction: column; min-width: 0; }
.ag-rr { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 12px 6px; border-bottom: 1px solid var(--line-soft); }
.ag-rr-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ag-rr-t b { font-size: 15px; font-weight: 600; line-height: 1.4; }
.ag-rr-t > span { font-size: 13px; color: var(--text-3); }
.ag-rr-cl { color: var(--accent); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.ag-lvl-sel { flex: none; font: inherit; font-size: 14px; font-weight: 600; width: 128px; height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color-scheme: light; }
.ag-lvl-sel.own, .ag-order-rules b.own { color: var(--gain); }
.ag-lvl-sel.sign, .ag-order-rules b.sign { color: var(--accent); }
.ag-lvl-sel.never, .ag-order-rules b.never, .ag-lvl-chip.never { color: var(--loss); }
.ag-dropped { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; padding: 12px 14px; border: 1px solid var(--warn-line); border-radius: var(--radius); background: var(--warn-soft); font-size: 13px; line-height: 1.45; color: var(--text-2); }
.ag-dropped .ag-caps { color: var(--warn); font-size: 12px; }

.ag-rules-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 32px; align-items: start; margin-top: 12px; }
.ag-rules-side { display: flex; flex-direction: column; gap: 22px; }
.ag-signers { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--text-2); }

.ag-meet { max-width: 1040px; flex: 1; justify-content: center; }
.ag-meet-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 56px; margin-top: 24px; }
.ag-meet-l, .ag-meet-r { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ag-meet-who { display: flex; gap: 16px; align-items: center; }
.ag-meet-name { display: flex; flex-direction: column; gap: 3px; }
.ag-meet-name b { font-family: var(--display); font-size: 24px; font-weight: 500; }
.ag-meet-name span { font-size: 14px; color: var(--text-3); }
.ag-sig { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.ag-sig p { margin: 0; font-size: 14px; line-height: 1.55; }
.ag-sig b { font-weight: 500; }
.ag-sig p span { font-size: 13px; color: var(--text-3); }
.ag-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ag-two .ob-field > span { font-size: 14px; font-weight: 500; color: var(--text-2); }
.ag-select { font: inherit; font-size: 16px; min-height: 52px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); color-scheme: light; }
.ag-chans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ag-chans .ob-choice { flex-wrap: nowrap; }
.ag-chan-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ag-chan-t b { font-size: 15px; font-weight: 600; }
.ag-chan-t span { font-size: 12px; color: var(--text-3); }
.ag-sched { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.ag-days { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.ag-day { width: 44px; height: 44px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; color: var(--text-2); }
.ag-day.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.ag-hours { display: inline-flex; gap: 8px; align-items: center; color: var(--text-3); }
.ag-hours input { font: inherit; font-size: 15px; height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); color-scheme: light; }

.ag-trialstep { max-width: 780px; flex: 1; justify-content: center; }
.ag-trial-pick { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.ag-timeline { position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr; margin-top: 18px; padding-top: 22px; }
.ag-tl-line { position: absolute; left: 6px; right: 6px; top: 6px; height: 0; border-top: 2px dashed var(--line); }
.ag-tl-line::before { content: ""; position: absolute; left: 0; top: -2px; width: 50%; border-top: 2px solid var(--accent); }
.ag-tl-pt { position: relative; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-3); }
.ag-tl-pt b { font-size: 14px; color: var(--text); }
.ag-tl-pt::before { content: ""; position: absolute; top: -22px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.ag-tl-pt.mid { align-items: center; text-align: center; }
.ag-tl-pt.mid::before { left: calc(50% - 7px); background: var(--surface); border: 2px solid var(--brass); }
.ag-tl-pt.end { align-items: flex-end; text-align: right; }
.ag-tl-pt.end::before { left: auto; right: 0; background: var(--surface); border: 1.5px solid var(--text-3); }
.ag-first { display: flex; justify-content: space-between; gap: 16px 24px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ag-first-t { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 360px; }
.ag-first-t b { font-size: 17px; font-weight: 600; line-height: 1.4; }
.ag-first-t > span:last-child { font-size: 14px; color: var(--text-2); }
.ag-first-btns { display: flex; gap: 8px; align-items: center; }

.ag-accept { max-width: 760px; flex: 1; justify-content: center; }
.ag-order { display: flex; flex-direction: column; gap: 18px; padding: 32px 40px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.ag-order-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ag-order-top .ag-caps { font-size: 12px; }
.ag-order-who { display: flex; gap: 18px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.ag-order-who h1 { font-size: 30px; line-height: 1.2; }
.ag-order-who > span:last-child { display: flex; flex-direction: column; gap: 4px; }
.ag-order-dl { margin: 0; display: flex; flex-direction: column; }
.ag-order-dl > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.ag-order-dl > div:last-child { border-bottom: 0; }
.ag-order-dl dt { font-size: 14px; color: var(--text-3); }
.ag-order-dl dd { margin: 0; font-size: 15px; line-height: 1.5; }
.ag-order-rules { display: flex; flex-direction: column; gap: 6px; }

/* Доверие, журнал ступени 9 */
.ag-trust-bar { display: flex; overflow: hidden; }
.ag-trust-bar > span { display: block; height: 100%; }
.ag-trust-bar .ok { background: var(--gain-bar); }
.ag-trust-bar .edit { background: var(--warn-line); }
.ag-trust-bar .rej { background: var(--loss-bar); }
.ag-badge.ok { border-color: var(--gain-bar); color: var(--gain); }
.ag-badge.warn { border-color: var(--warn-line); color: var(--warn); background: var(--warn-soft); }
.ag-badge.rej { border-color: var(--loss-bar); color: var(--loss); }
button.ag-lvl { font: inherit; text-align: left; color: var(--text); cursor: pointer; }
button.ag-lvl:disabled { cursor: default; }
button.ag-lvl:not(.on):not(.off):hover { border-color: var(--accent-line); }
.ag-days { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.ag-day { font: inherit; font-size: 13px; min-width: 36px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text-2); cursor: pointer; }
.ag-day.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ag-day:disabled { cursor: default; }
.ag-input { font: inherit; font-size: 15px; width: 100%; box-sizing: border-box; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); color-scheme: light; }
.ag-input:disabled { background: transparent; border-color: var(--line-soft); color: var(--text); }
[data-theme="dark"] .ag-input, [data-theme="dark"] .ap-body-edit, [data-theme="dark"] .ap-note { color-scheme: dark; }
.ag-err { color: var(--loss); font-size: 14px; }

/* Остановить всех */
.ag-stop-btn { color: var(--loss); }
.ag-stopped { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--warn-line); border-radius: var(--radius); background: var(--warn-soft); }
.ag-stopped > .ico { color: var(--warn); flex: none; }
.ag-stopped-t { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; font-size: 14px; line-height: 1.45; color: var(--text-2); }
.ag-stopped-t b { font-size: 15px; color: var(--text); }
.ag-stop { max-width: 560px; }
.ag-stop-fx { margin: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line-soft); }
.ag-stop-fx > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.ag-stop-fx dt { color: var(--text-2); }
.ag-stop-fx dd { margin: 0; font-weight: 600; white-space: nowrap; }
.ag-stop-spans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ag-stop-span { font: inherit; display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; }
.ag-stop-span span { font-size: 12px; color: var(--text-3); }
.ag-stop-span.on { border-color: var(--accent); background: var(--accent-soft); }
.ag-stop-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* На подпись */
.ap-page { gap: 20px; }
.ap-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; }
.ap-rule { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-3); }
.ap { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 28px; align-items: start; }
.ap-list { display: flex; flex-direction: column; min-width: 0; position: sticky; top: 0; }
.ap-segs { align-self: flex-start; max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
.ap-segs button { padding-left: 10px; padding-right: 10px; white-space: nowrap; }
.ap-more { align-self: flex-start; margin-top: 8px; font-size: 14px; }
.ap-caps { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 0 8px; border-bottom: 1px solid var(--line); }
.ap-row { font: inherit; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; padding: 16px 12px; text-align: left; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; color: var(--text); cursor: pointer; }
.ap-row:hover { background: var(--sunken); }
.ap-row.on { background: var(--accent-soft); }
.ap-row.done { opacity: .72; }
.ap-row-b { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ap-row-who { font-size: 13px; color: var(--text-3); }
.ap-row-what { font-size: 15px; font-weight: 600; }
.ap-row-cp { font-size: 14px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-row-meta { display: flex; gap: 10px; align-items: center; margin-top: 2px; font-size: 14px; }
.ap-due { font-size: 12px; font-weight: 500; border-radius: var(--radius-pill); padding: 1px 8px; color: var(--text-2); border: 1px solid var(--line); }
.ap-st { font-size: 13px; font-weight: 500; color: var(--text-3); margin: 0; }
.ap-st.ok { color: var(--gain); }
.ap-st.warn { color: var(--warn); }
.ap-st.rej { color: var(--loss); }
.ap-empty { display: flex; flex-direction: column; gap: 6px; padding: 24px 4px; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.ap-empty b { font-size: 16px; color: var(--text); }
.ap-empty p { margin: 0; }
.ap-empty.big { padding: 48px 24px; border: 1px dashed var(--line); border-radius: var(--radius); align-items: center; text-align: center; }
.ap-detail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ap-card { display: flex; flex-direction: column; gap: 16px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.ap-back { display: none; align-self: flex-start; }
.ap-card-h { display: flex; gap: 14px; align-items: center; }
.ap-card-h > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ap-card-who { font-size: 15px; color: var(--text-2); }
.ap-card-who b { color: var(--text); }
.ap-card-why { font-size: 13px; color: var(--text-3); }
.ap-card-t { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.ap-card-cp { margin: -8px 0 0; font-size: 16px; color: var(--text-2); }
.ap-reason { margin: 0; font-size: 14px; color: var(--text-2); }
.ap-mail { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ground); }
.ap-mail-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.ap-mail-row > span:first-child { color: var(--text-3); }
.ap-mail-note { font-size: 12px; color: var(--text-3); }
.ap-uz { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; color: var(--text-2); }
.ap-uz > span:first-child { flex: 1; }
.ap-body { padding: 16px 18px; font-size: 15px; line-height: 1.6; }
.ap-body p { margin: 0 0 12px; white-space: pre-wrap; }
.ap-body p:last-child { margin-bottom: 0; }
.ap-edit { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.ap-body-edit, .ap-note { font: inherit; font-size: 15px; line-height: 1.55; width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--accent-line); border-radius: var(--radius); background: var(--surface); color: var(--text); resize: vertical; color-scheme: light; }
.ap-sec { display: flex; flex-direction: column; gap: 8px; }
.ap-sec .ag-p { margin: 0; }
.ap-facts { display: flex; flex-direction: column; border-top: 1px solid var(--line-soft); }
.ap-fact { display: grid; grid-template-columns: 110px 150px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.ap-fact-k { color: var(--text-3); }
.ap-fact-n { color: var(--text-2); }
.ap-fact .doc-chip { font-size: 13px; color: var(--accent); }
.ap-guess { padding: 14px 16px; border: 1px solid var(--ai-line, var(--line)); border-radius: var(--radius); }
.ap-guess > span { font-size: 13px; font-weight: 600; }
.ap-guess p { margin: 6px 0 0; font-size: 15px; }
.ap-panel { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ground); }
.ap-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-top: 4px; border-top: 1px solid var(--line-soft); }
.ap-actions .btn-primary { min-height: 40px; }
.ap-rej { color: var(--loss); margin-left: auto; }
.ap-eml { align-self: flex-start; }
.ap-trust { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.ap-trust .ag-trust-bar { margin: 0; max-width: 320px; }
.ap-trust-lock { display: flex; gap: 6px; font-size: 13px; color: var(--text-3); line-height: 1.45; }
/* Предложение заказа: строки таблицей, числа по правому краю. */
.ap-order { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ground); padding-bottom: 10px; }
.ap-order > .ag-fine { padding: 0 14px; }
.ap-order-t { display: flex; flex-direction: column; overflow-x: auto; }
.ap-order-r { display: grid; grid-template-columns: minmax(150px, 1fr) repeat(6, minmax(52px, auto)); gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; min-width: 600px; }
.ap-order-sup { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px 0; font-size: 14px; }
.ap-order-sup > span { color: var(--text-3); }
.ap-order-r > :not(:first-child) { text-align: right; }
.ap-order-r.head { font-size: 12px; color: var(--text-3); }
/* Что агент вспомнил под действие. */
.ap-mem { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-left: 2px solid var(--ai-line, var(--line)); }
.ap-mem ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--text-2); line-height: 1.5; }
/* Нить агента в личном деле. */
.ag-thread { display: flex; flex-direction: column; gap: 18px; }
.ag-thread-e { display: flex; flex-direction: column; gap: 4px; }
.ag-thread-e .ag-mandate > div { padding: 10px 0; }
.ag-mem-st { margin: 0 0 8px; }

@media (max-width: 1100px) {
  .ag-grid { grid-template-columns: minmax(0, 1fr); }
  .ag-dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ag-lvls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ag-rules-grid, .ag-read-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .ag-page { gap: 24px; }
  .ag-thread-e .ag-mandate > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ap { grid-template-columns: minmax(0, 1fr); }
  .ap.has-sel .ap-list { display: none; }
  .ap:not(.has-sel) .ap-detail { display: none; }
  .ap-back { display: inline-flex; }
  .ap-card { padding: 16px; border-left: 0; border-right: 0; border-radius: 0; box-shadow: none; margin: 0 -16px; }
  .ap-card-t { font-size: 20px; }
  .ap-fact { grid-template-columns: minmax(0, 1fr) auto; }
  .ap-fact-n { grid-column: 1 / -1; }
  .ap-mail-row { grid-template-columns: 48px minmax(0, 1fr); }
  .ap-mail-note { grid-column: 2; }
  .ap-actions { position: sticky; bottom: 0; background: var(--surface); padding: 10px 0; }
  .ap-actions .btn-primary { flex: 1 1 100%; justify-content: center; min-height: 48px; }
  .ap-rej { margin-left: 0; }
  .ap-head .ap-rule { display: none; }
  .ag-stopped { flex-wrap: wrap; }
  .ag-stop-spans { grid-template-columns: minmax(0, 1fr); }
  .ag-m-cta .ag-stop-btn { width: 100%; justify-content: center; min-height: 44px; }
  .ag-head-text .report-title { font-size: 32px; }
  .ag-team .ag-head-acts, .ag-team .ag-grid { display: none; }
  .ag-team .ag-mobile { display: flex; flex-direction: column; gap: 0; }
  .ag-m-sign { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 14px 0 16px; margin-bottom: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text); }
  .ag-m-sign-t { font-size: 17px; font-weight: 700; }
  .ag-m-sign-d { font-size: 14px; color: var(--text-2); }
  .ag-m-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); text-align: left; color: var(--text); }
  .ag-m-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .ag-m-top b { font-size: 17px; font-weight: 600; }
  .ag-m-tag { font-size: 14px; color: var(--text-3); }
  .ag-m-role { font-size: 14px; color: var(--text-3); }
  .ag-m-now { font-size: 15px; line-height: 1.4; }
  .ag-m-trial { font-size: 13px; color: var(--text-3); }
  .ag-m-cta { position: sticky; bottom: 0; padding: 12px 0 16px; background: var(--ground); }
  .ag-m-cta .btn-primary { width: 100%; justify-content: center; min-height: 48px; font-size: 16px; }
  /* Личное дело, матрица и автопилот на телефоне — колонкой. */
  .ag-grid { gap: 28px; }
  .ag-crumbs { margin-bottom: 0; flex-wrap: wrap; }
  .ag-prof-who { gap: 14px; align-items: flex-start; }
  .ag-prof-text .report-title { font-size: 26px; }
  .ag-mono.lg { width: 56px; height: 56px; font-size: 24px; }
  .ag-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .ag-mandate > div, .ag-order-dl > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ag-trial, .ag-tiles { grid-template-columns: minmax(0, 1fr); }
  .ag-tile + .ag-tile { padding-left: 0; border-left: 0; border-top: 1px solid var(--line-soft); }
  .ag-j-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ag-j-when { grid-column: 1 / -1; flex-direction: row; gap: 8px; }
  .ag-j-more { grid-column: 1 / -1; }
  .ag-lvls { grid-template-columns: minmax(0, 1fr); }
  .ag-lvl { min-height: 0; }
  .ag-trg-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ag-trg-row.head { display: none; }
  .ag-trg-what { grid-column: 1 / -1; grid-row: 2; }
  .ag-hire-bar { grid-template-columns: 1fr auto; padding: 0 12px; height: 56px; }
  .ag-hire-bar .ob-dashes { display: none; }
  .ag-hire-body { padding: 24px 16px 24px; }
  .ag-hire-foot { padding: 10px 12px; flex-wrap: wrap; }
  .ag-hire-foot-r { flex: 1 1 100%; }
  .ag-hire-hint { display: none; }
  .ag-hire-foot .ob-primary { width: 100%; }
  .ag-step h1 { font-size: 32px; }
  .ag-pick, .ag-meet-grid, .ag-two { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .ag-chans { grid-template-columns: minmax(0, 1fr); }
  .ag-paper { padding: 20px; max-height: none; }
  .ag-order { padding: 20px; }
  .ag-order-who h1 { font-size: 24px; }
  .ag-timeline { font-size: 12px; }
}

/* ── Ступень 10: миссии, утро, разногласия, цели ─────────────────────── */
.ag-badge.warn { border-color: var(--warn-line); color: var(--warn); background: var(--warn-soft); }
.ag-dot.off { background: var(--line); }
.ag-m-sign.night { border-top: 1px solid var(--line); }

/* Разногласие: две позиции рядом, варианты решения под ними. */
.dsp { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; border: 1px solid var(--warn-line); border-radius: var(--radius, 10px); background: var(--surface); }
.dsp + .dsp { margin-top: 14px; }
.dsp-t { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.45; }
.dsp-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line-soft); }
.dsp-col { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px 4px 0; }
.dsp-col + .dsp-col { padding-left: 18px; border-left: 1px solid var(--line-soft); }
.dsp-who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); flex-wrap: wrap; }
.dsp-who b { color: var(--text); font-size: 14px; }
.dsp-stance { font-size: 15px; line-height: 1.4; }
.dsp-opts { display: flex; gap: 18px; flex-wrap: wrap; }
.dsp-opt { display: flex; flex-direction: column; gap: 6px; flex: 1 1 220px; max-width: 340px; }
.dsp-opt .btn-primary { align-self: flex-start; }
.dsp-done { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-left: 3px solid var(--gain-bar); background: var(--gain-soft); font-size: 14px; line-height: 1.5; }
.dsp-done b { color: var(--gain); }

/* Предложение расширить полномочия. */
.ag-prop { padding: 18px 20px; border: 1px solid var(--accent-line); border-radius: var(--radius, 10px); background: var(--accent-soft); }
.ag-prop-t { margin: 0; font-size: 15px; line-height: 1.5; }

/* Миссии: строки в личном деле. */
.msn-list { display: flex; flex-direction: column; }
.msn-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 18px; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-soft); text-align: left; color: var(--text); }
.msn-row.done { color: var(--text-3); }
.msn-row-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.msn-row-t span { font-size: 13px; color: var(--text-3); }
.msn-row .ico { color: var(--text-3); }

/* Миссия: шапка, план и ход. */
.msn-head, .on-head { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; }
.msn-head .report-summary .btn-link { font-size: inherit; padding: 0; min-height: 0; }
.msn-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.msn-step { position: relative; display: grid; grid-template-columns: 28px 96px minmax(0, 1fr); gap: 0 12px; padding: 0 0 18px; }
.msn-step::before { content: ""; position: absolute; left: 13px; top: 18px; bottom: 0; border-left: 2px dashed var(--line); }
.msn-step.done::before { border-left: 2px solid var(--accent); }
.msn-step:last-child::before { display: none; }
.msn-dot { width: 14px; height: 14px; margin: 3px 0 0 7px; border-radius: 50%; border: 2px dashed var(--text-3); background: var(--ground); box-sizing: border-box; }
.msn-step.done .msn-dot { background: var(--accent); border: 2px solid var(--accent); }
.msn-step.now .msn-dot { width: 18px; height: 18px; margin: 1px 0 0 5px; border: 4px solid var(--accent); }
.msn-step.fork .msn-dot { border-radius: 2px; transform: rotate(45deg); }
.msn-date { font-size: 14px; font-weight: 600; padding-top: 1px; white-space: nowrap; }
.msn-step.next .msn-date, .msn-step.fork .msn-date { color: var(--text-2); font-weight: 500; }
.msn-card { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.msn-step.now .msn-card { padding: 10px 12px; border: 1px solid var(--accent-line); border-radius: var(--radius, 10px); background: var(--surface); margin-top: -4px; }
.msn-who { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--text-3); }
.msn-who b { color: var(--text); }
.msn-what { font-size: 15px; line-height: 1.45; font-weight: 500; }
.msn-st { font-size: 12px; padding: 1px 8px; border-radius: var(--radius-pill); border: 1px solid var(--line); color: var(--text-2); margin-left: auto; white-space: nowrap; }
.msn-st.gain { color: var(--gain); border-color: var(--gain-bar); }
.msn-st.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.msn-st.plan { color: var(--text-3); border-style: dashed; }
.msn-st.sign { color: var(--accent-ink, var(--accent)); border-color: var(--accent-line); }
.msn-st.loss { color: var(--loss); border-color: var(--loss-bar); }
.msn-branches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-left: 40px; }
.msn-branch { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-top: 3px solid var(--line); border-radius: var(--radius, 10px); background: var(--surface); }
.msn-branch.gain { border-top-color: var(--gain-bar); }
.msn-branch.loss { border-top-color: var(--loss-bar); }
.msn-steps.sub .msn-step { grid-template-columns: 86px minmax(0, 1fr); padding-bottom: 12px; }
.msn-steps.sub .msn-step::before, .msn-steps.sub .msn-dot { display: none; }
.msn-end { font-size: 13px; font-weight: 600; color: var(--text-2); }
.msn-sum { font-size: 30px; font-weight: 700; line-height: 1.1; }
.msn-docs { display: flex; flex-wrap: wrap; gap: 6px; }

/* Цели с прогнозом. */
.gl-list { display: flex; flex-direction: column; }
.gl { display: flex; flex-direction: column; gap: 6px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.gl-owner { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.gl-t { font-size: 16px; line-height: 1.4; }
.gl-bar { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.gl-bar span { display: block; height: 100%; background: var(--accent); }
.gl.risk .gl-bar span { background: var(--warn-line); }
.gl-nums { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }
.gl-nums b { font-size: 18px; color: var(--text); }
.gl-d.gain { color: var(--gain); }
.gl-d.loss { color: var(--loss); }
.gl-d.flat { color: var(--text-3); }
.gl-step { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-left: 3px solid var(--warn-line); background: var(--warn-soft); font-size: 14px; line-height: 1.5; }
.gl-step.on { border-left-color: var(--gain-bar); background: var(--gain-soft); }
.ag-goal-add select, .ag-goal-add .gl-in { flex: 0 1 180px; }

/* Пока вы спали. */
.on-head { display: flex; flex-direction: column; gap: 6px; }
.on-when { font-size: 13px; color: var(--text-3); }
.on-decide { padding: 0; }
.on-agent { display: flex; flex-direction: column; padding: 14px 0 6px; border-bottom: 1px solid var(--line-soft); }
.on-agent-h { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; }
.on-agent-t { display: flex; flex-direction: column; font-size: 14px; color: var(--text-2); }
.on-agent-t b { color: var(--text); font-size: 15px; }
.on-agent-n { font-size: 18px; font-weight: 700; }
.on-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; gap: 4px 14px; align-items: start; padding: 10px 0 10px 50px; }
.on-row-b { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.on-row-t { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; line-height: 1.4; }
.on-fig { font-weight: 700; white-space: nowrap; }
.on-hands { display: flex; flex-direction: column; }
.on-hand { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; line-height: 1.45; }
.on-hand-b { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.on-sign { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.on-sign-b { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.on-sign-b span { color: var(--text-3); font-size: 13px; }
.on-live { margin: 0; }
.on-lim { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; font-size: 14px; line-height: 1.4; }
.on-data { margin-top: 8px; }

/* Отказ: охват урока и позиции. */
.ap-scope { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ap-excl { display: flex; gap: 8px; align-items: center; font-size: 14px; padding: 4px 0; }
.ap-applied { border-left-color: var(--warn-line); }

@media (max-width: 700px) {
  .dsp { padding: 14px; }
  .dsp-cols { grid-template-columns: minmax(0, 1fr); }
  .dsp-col + .dsp-col { padding-left: 0; border-left: 0; border-top: 1px solid var(--line-soft); }
  .dsp-opt { max-width: none; flex-basis: 100%; }
  .dsp-opt .btn-primary { align-self: stretch; justify-content: center; min-height: 44px; }
  .msn-step { grid-template-columns: 28px minmax(0, 1fr); }
  .msn-date { grid-column: 2; }
  .msn-card { grid-column: 2; }
  .msn-branches { grid-template-columns: minmax(0, 1fr); margin-left: 0; }
  .msn-st { margin-left: 0; }
  .on-agent-h { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .on-agent-h .btn-link { grid-column: 2 / -1; justify-self: start; }
  .on-row { grid-template-columns: minmax(0, 1fr) auto; padding-left: 0; }
  .on-row > .ag-k { grid-column: 1 / -1; }
  .on-hand { grid-template-columns: minmax(0, 1fr) auto; }
  .on-hand > .ag-k { grid-column: 1 / -1; }
  .ap-scope { grid-template-columns: minmax(0, 1fr); }
  .on-page .ag-crumbs .ap-rule { display: none; }
}
.ag-goal.slim { padding-top: 4px; }
.ag-goal.slim .ag-goal-t { font-size: 13px; font-weight: 500; color: var(--text-3); }
.on-more { align-self: flex-start; font-size: 14px; }
.on-asks { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.on-tail { display: contents; }
.btn-link.on-more { display: none; }
.on-hand .btn-link.on-more { display: inline-flex; }
@media (max-width: 700px) {
  .on-tail { display: none; }
  .on-tail.open { display: contents; }
  .btn-link.on-more { display: inline-flex; }
}
@media (max-width: 700px) {
  /* Решённое разногласие на телефоне — вопрос и решение, без позиций. */
  .dsp.done .dsp-cols { display: none; }
}

/* Сбой модели: одна плашка на «Сегодня», «Сотрудниках» и в личном деле. */
.mdl-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border: 1px solid var(--loss-bar); border-left-width: 4px; border-radius: var(--radius, 10px); background: var(--loss-soft); color: var(--text); font-size: 14px; line-height: 1.5; }
.mdl-banner > div { display: flex; flex-direction: column; gap: 2px; }
.mdl-banner b { color: var(--loss); }
.mdl-banner .ico { color: var(--loss); margin-top: 2px; }
.mdl-top:empty { display: none; }
.mdl-top { padding: 12px 24px 0; }
