/* ИИ-сеттер SorokinFit · портал.
   Стиль по мотивам Mochi: светлый воздух, белые карточки с тонкой рамкой, чёрные «таблетки»,
   синий для воронки и наших сообщений, фиолетовый для всего, что делает ИИ.
   Все цвета — переменные ниже; тёмная тема переопределяет их целиком.

   ЕДИНЫЙ СТИЛЬ (13.10, модуль 1 «основа»; было: ритм волны 5). Разделы берут размеры только из переменных ниже,
   свои числа не заводят. Тест tests/test_ui_style_1310.py держит шкалу.
   - Кегль, 6 ступеней: --fs-small 12 (подписи, время, бейджи, счётчики, КАПС), --fs-base 13.5 (интерфейс, сообщения,
     поля, кнопки), --fs-sub 15 (заголовок карточки), --fs-head 17 (заголовок блока и окна), --fs-page 22 (заголовок
     страницы, 20 на телефоне), --fs-figure 26 (большие цифры, 22 на телефоне). Старые имена остаются псевдонимами:
     --fs-3xs, --fs-2xs, --fs-xs, --fs-sm = 12; --fs-md, --fs-lg = 13.5; --fs-h3 15; --fs-h2 17; --fs-h1 22; --fs-num 26.
     Числом мимо шкалы только крошечные метки (буквы канала 7.5–8.5, цифра в значке 10, буква в аватарке 8–9,
     подпись под иконкой левой колонки на телефоне 9.5–10.5), значок-эмодзи 20 и em у кода в тексте; список в тесте.
   - Жирность 4: --fw-regular 400, --fw-medium 500, --fw-semibold 600, --fw-bold 700. Выбранное не меняет жирность,
     только цвет и подложку (иначе кнопка шире и соседи сдвигаются).
   - Разрядка 3: --ls-tight -.01em (крупные заголовки), --ls-normal 0, --ls-caps .05em (КАПС, буквы канала).
     Подпись КАПСОМ одна: .label-caps (12, 700, --ls-caps), свои КАПС-подписи берут те же переменные.
   - Межстрочный 3: --lh-tight 1.3, --lh-ui 1.45, --lh-text 1.55.
   - Отступы и зазоры: 4 8 12 16 20 24 32 (--s-1 … --s-8). Внутри контрола между иконкой и текстом
     --s-mini 2 и --s-inner 6.
   - Высоты: метка 18, бейдж и чип в строке 22, чип 24, маленькая кнопка / таб / таблетка 30, кнопка / поле / поиск /
     выпадающий список 36, кнопка левой колонки 40. Что стоит в одном ряду, одной высоты.
   - Радиусы 4: --r-small 6 (метка, бейдж, чекбокс, чип), --r-medium 10 (кнопка, поле, плашка, строка-карточка),
     --r-large 14 (карточка, окно, пузырь), --r-pill. Старые: --r-2xs, --r-xs = 6; --r-sm, --r-md = 10; --r, --r-lg = 14.
   - Окна 5 ширин: --modal-sm 400, --modal-md 480 (по умолчанию), --modal-lg 560, --modal-xl 720, --modal-2xl 960;
     классы .modal-sm … .modal-2xl.
   - Цифры, которые меняются на глазах (суммы, счётчики): класс .num, цифры одной ширины. Шрифт Inter грузится
     здесь же (@font-face ниже), моноширинный --mono только для кодов и ключей.
   - Иконки: 10 в метке, 12 в чипе, 14 в маленькой кнопке и в строке текста, 16 в кнопке, меню
     и плашке, 18 в кнопке-иконке, 20 в левой колонке. SF.icon сам округляет до этой шкалы.
   - Цвет смысла: фиолетовый только то, что делает ИИ (черновик, кнопки ИИ, ИИ в диалоге).
     Настройки, фильтры и выбор в формах чёрные (--ink). Автопилот --auto, оплата и «готово» зелёные.
     Текст на заливке зелёным, красным, жёлтым только парой --green-fill/--on-green, --red-fill/--on-red,
     --amber-fill/--on-amber: 4,5:1 в обеих темах. Метки (этапы, теги, календарь, события) 8 цветами --lbl-1…8
     с парами -bg/-fg; цвет, выбранный в настройках, рисуется как выбран, текст на нём SF.ui.onColor().
     Каналы только --ch-vk, --ch-ig (градиент; --ch-ig-solid для значка одним цветом), --ch-tg, --ch-mx.
   - Выравнивание: контрол справа в строке (тумблер, кнопка, счётчик) по центру строки.
     Иконка слева у многострочного текста на первой строке. */

/* 13.10 (единый стиль): Inter грузится в портал, раньше его видел только тот, у кого он стоит в системе.
   Файлы те же, что у страницы записи (book.css), сервер отдаёт их без входа (auth.PUBLIC_STATIC). */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/inter-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-cyrillic-600-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/inter-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/inter-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/inter-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* отступы; --s-mini и --s-inner только внутри контрола (между иконкой и текстом, в бейдже) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --s-mini: 2px; --s-inner: 6px;
  /* поля страницы раздела: на планшете 24, на телефоне 16 (см. медиа ниже) */
  --page-x: 32px; --page-y: 24px;
  /* высоты контролов */
  --h-mini: 18px; --h-chip-sm: 22px; --h-xs: 24px; --h-sm: 30px; --h-md: 36px; --h-lg: 40px;
  /* 13.10 (единый стиль): кегль 6 ступеней вместо 10. Старые имена псевдонимы, слиты в ближайшую ступень */
  --fs-small: 12px; --fs-base: 13.5px; --fs-sub: 15px; --fs-head: 17px; --fs-page: 22px; --fs-figure: 26px;
  --fs-3xs: var(--fs-small); --fs-2xs: var(--fs-small); --fs-xs: var(--fs-small); --fs-sm: var(--fs-small);
  --fs-md: var(--fs-base); --fs-lg: var(--fs-base);
  --fs-h3: var(--fs-sub); --fs-h2: var(--fs-head); --fs-h1: var(--fs-page); --fs-num: var(--fs-figure);
  /* жирность 4, разрядка 3, межстрочный 3 */
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;
  --ls-tight: -.01em; --ls-normal: 0; --ls-caps: .05em;
  --lh-tight: 1.3; --lh-ui: 1.45; --lh-text: 1.55;
  /* ширины окон: 5 */
  --modal-sm: 400px; --modal-md: 480px; --modal-lg: 560px; --modal-xl: 720px; --modal-2xl: 960px;

  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --surface-3: #f3f3f5;
  --hover: #efeff1;
  --line: #ececec;
  --line-2: #e0e0e4;
  /* 05.10: цвета каналов для значка на аватарке в ленте «Все» (inbox-extra.css, .ibx-chb): одни в светлой и тёмной теме.
     13.10 (единый стиль): все метки каналов берут цвет только отсюда (было 5 оттенков TG, 4 IG, 2 MAX).
     --ch-ig градиент для заливки; --ch-ig-solid для значка одним цветом; --ch-sb Salebot */
  --ch-vk: #0077ff; --ch-tg: #229ed9; --ch-mx: #7b3ff2; --ch-on: #fff;
  --ch-ig: linear-gradient(45deg, #f9a03f 0%, #e1306c 55%, #833ab4 100%);
  --ch-ig-solid: #c13584; --ch-sb: #5b4bd5;
  --text: #17171b;
  --text-2: #55555f;
  --text-3: #6b6b76;   /* 05.10: было #8b8b96, 3,4:1 на белом; сейчас 5,3:1 на белом и 4,6:1 на плашке */
  --ink: #111113;
  --on-ink: #ffffff;

  --blue: #2b7ff7;
  --blue-hover: #1f70e6;
  --blue-soft: #eaf2fe;
  --on-blue: #ffffff;

  --ai: #7c3aed;
  --ai-hover: #6d28d9;
  --violet-text: #6d28d9;
  --violet-soft: #f4effe;
  --violet-soft-2: #efe7fd;
  --violet-line: #c9b3fb;

  --red: #e5484d;
  --red-text: #c92a30;
  --red-soft: #fdeeee;
  --red-line: #f5c2c3;
  --amber-text: #8a4b08;
  --amber-soft: #fff6db;
  --amber-line: #f2d98b;
  --green: #16a34a;
  --green-text: #15803d;
  --green-soft: #e8f7ee;
  /* 13.10 (единый стиль): заливка с текстом на ней. Текст на --green и --red был 3,3:1 и 3,9:1 (на тёмной 2,3 и 3,5),
     поэтому кнопка, бейдж, точка «готово» с текстом берут пару заливка/текст, 4,5:1 и выше в обеих темах */
  --green-fill: #15803d; --on-green: #ffffff;     /* 5,0:1 */
  --red-fill: #c92a30; --on-red: #ffffff;         /* 5,4:1 */
  --amber-fill: #f59e0b; --on-amber: #2b1d00;     /* 7,7:1 */
  --blue-fill: #1d64d8;                           /* белый на нём 5,4:1 (счётчик непрочитанных) */
  /* зелёная кнопка («Оплата пришла»): белый на #15803d 5:1, на --green было 3,3 */
  --ok-bg: var(--green-fill);
  --ok-ink: var(--on-green);
  /* значки во всплывающем уведомлении: тост тёмный в светлой теме и светлый в тёмной */
  --toast-ok: #4ade80; --toast-ai: #b9a1fb;

  --bubble-in: #f1f1f4;
  /* 13.10 (единый стиль): почти одинаковые серые смотрят на основные (разница была меньше 1%) */
  --chip-bg: var(--hover);          /* было #eeeef1 */
  --veil: rgba(255, 255, 255, .82);
  --overlay: rgba(24, 24, 32, .26);
  --skeleton: var(--line);          /* было #ececef */
  --skeleton-hi: var(--bg);         /* было #f7f7f9 */

  --shadow-sm: 0 1px 2px rgba(17, 17, 26, .04), 0 1px 3px rgba(17, 17, 26, .05);
  --shadow-md: 0 6px 18px rgba(17, 17, 26, .07), 0 1px 3px rgba(17, 17, 26, .05);
  --shadow-lg: 0 20px 50px rgba(17, 17, 26, .16), 0 2px 8px rgba(17, 17, 26, .06);
  --focus-ring: #2b7ff7;
  --focus-soft: rgba(43, 127, 247, .16);   /* мягкое кольцо фокуса у полей */
  --ai-ring: rgba(124, 58, 237, .16);      /* то же для полей, где пишешь запрос ИИ */
  --blue-text: #1d64d8;                    /* синий текст на --blue-soft */

  /* автопилот: бот отправляет сам. Один раз здесь, чтобы все разделы красили его одинаково */
  --auto: var(--green);
  --auto-text: var(--green-text);
  --auto-soft: var(--green-soft);
  --auto-line: color-mix(in srgb, var(--green) 40%, transparent);

  /* 13.10 (единый стиль): радиусы 4 вида вместо 7. Старые имена псевдонимы */
  --r-small: 6px; --r-medium: 10px; --r-large: 14px;
  --r-pill: 999px;
  --r-2xs: var(--r-small);
  --r-xs: var(--r-small);
  --r-sm: var(--r-medium);
  --r-md: var(--r-medium);
  --r: var(--r-large);
  --r-lg: var(--r-large);

  --av0-bg: #ede9fe; --av0-fg: #6d28d9;
  --av1-bg: #fef3c7; --av1-fg: #a16207;
  --av2-bg: #dbeafe; --av2-fg: #1d4ed8;
  --av3-bg: #fce7f3; --av3-fg: #be185d;
  --av4-bg: #dcfce7; --av4-fg: #15803d;
  --av5-bg: #e0f2fe; --av5-fg: #0369a1;
  --av6-bg: #ffedd5; --av6-fg: #c2410c;
  --av7-bg: #eef1f5; --av7-fg: #475569;

  /* 13.10 (единый стиль): 8 цветов меток (этапы, теги, календарь, события в ленте): красный, оранжевый, жёлтый, зелёный,
     бирюзовый, синий, фиолетовый, розовый. --lbl-N заливка точки и полосы, -bg подложка, -fg текст на подложке
     и на карточке: 4,5:1 и выше в обеих темах */
  --lbl-1: #ef4444; --lbl-1-bg: #fee2e2; --lbl-1-fg: #b91c1c;
  --lbl-2: #f97316; --lbl-2-bg: #ffedd5; --lbl-2-fg: #9a3412;
  --lbl-3: #f59e0b; --lbl-3-bg: #fef3c7; --lbl-3-fg: #92400e;
  --lbl-4: #16a34a; --lbl-4-bg: #dcfce7; --lbl-4-fg: #166534;
  --lbl-5: #14b8a6; --lbl-5-bg: #ccfbf1; --lbl-5-fg: #0f766e;
  --lbl-6: #3b82f6; --lbl-6-bg: #dbeafe; --lbl-6-fg: #1d4ed8;
  --lbl-7: #8b5cf6; --lbl-7-bg: #ede9fe; --lbl-7-fg: #6d28d9;
  --lbl-8: #ec4899; --lbl-8-bg: #fce7f3; --lbl-8-fg: #be185d;

  /* 13.10: имена, которые разделы уже писали, но нигде не было определения (бралось случайное запасное) */
  --border: var(--line);
  --accent: var(--blue);
  --accent-soft: var(--blue-soft);
  --focus: var(--focus-ring);
  --line-strong: var(--line-2);
  --bg-soft: var(--surface-2);
  --bg-2: var(--surface-3);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e10;
    --surface: #161619;
    --surface-2: #1a1a1e;
    --surface-3: #212126;
    --hover: #303037;   /* 13.10: было #25252b, сливалось с рамкой --line #26262c (1,0:1), сейчас 1,15:1 */
    --line: #26262c;
    --line-2: #34343c;
    --text: #ececf1;
    --text-2: #a8a8b3;
    --text-3: #9494a0;   /* 05.10: было #777782, 4,0:1 на тёмной поверхности; сейчас 5,6:1 */
    --ink: #f2f2f4;
    --on-ink: #111113;
    --blue: #3683f7;
    --blue-hover: #5596f9;
    --blue-soft: #15233a;
    --on-blue: #ffffff;
    --ai: #7c3aed;
    --ai-hover: #8b5cf6;
    --violet-text: #b9a1fb;
    --violet-soft: #211a34;
    --violet-soft-2: #281f40;
    --violet-line: #5b4799;
    --red: #ef5358;
    --red-text: #ff8d91;
    --red-soft: #331a1c;
    --red-line: #6a2a2e;
    --amber-text: #f3c75a;
    --amber-soft: #2c2413;
    --amber-line: #5a4a1d;
    --green: #22c55e;
    --green-text: #4ade80;
    --green-soft: #13281b;
    --green-fill: #22c55e; --on-green: #0b1a10;   /* 7,9:1 */
    --red-fill: #d4363c; --on-red: #ffffff;     /* 4,8:1 */
    --amber-fill: #f59e0b; --on-amber: #2b1d00;
    --blue-fill: #1d64d8;
    --toast-ok: #166534; --toast-ai: #6d28d9;   /* тост в тёмной теме светлый: светло-зелёный и сиреневый на нём были 1,6:1 и 2:1 */
    --bubble-in: #232329;
    --chip-bg: #24242a;
    --veil: rgba(22, 22, 25, .84);
    --overlay: rgba(0, 0, 0, .55);
    --skeleton: var(--surface-3);
    --skeleton-hi: #2a2a31;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, .45);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
    --focus-ring: #5596f9;
    --focus-soft: rgba(85, 150, 249, .24);
    --ai-ring: rgba(139, 92, 246, .26);
    --blue-text: #8ab8ff;
    --av0-bg: #2a2140; --av0-fg: #c4b5fd;
    --av1-bg: #332a14; --av1-fg: #fcd34d;
    --av2-bg: #172a47; --av2-fg: #93c5fd;
    --av3-bg: #3a1a2c; --av3-fg: #f9a8d4;
    --av4-bg: #15301f; --av4-fg: #86efac;
    --av5-bg: #132b3a; --av5-fg: #7dd3fc;
    --av6-bg: #3a2415; --av6-fg: #fdba74;
    --av7-bg: #24272d; --av7-fg: #cbd5e1;
    --lbl-1: #ef4444; --lbl-1-bg: #3b1517; --lbl-1-fg: #fca5a5;
    --lbl-2: #f97316; --lbl-2-bg: #3a2415; --lbl-2-fg: #fdba74;
    --lbl-3: #f59e0b; --lbl-3-bg: #332a14; --lbl-3-fg: #fcd34d;
    --lbl-4: #22c55e; --lbl-4-bg: #15301f; --lbl-4-fg: #86efac;
    --lbl-5: #14b8a6; --lbl-5-bg: #102e2b; --lbl-5-fg: #5eead4;
    --lbl-6: #3b82f6; --lbl-6-bg: #172a47; --lbl-6-fg: #93c5fd;
    --lbl-7: #8b5cf6; --lbl-7-bg: #2a2140; --lbl-7-fg: #c4b5fd;
    --lbl-8: #ec4899; --lbl-8-bg: #3a1a2c; --lbl-8-fg: #f9a8d4;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0e10;
  --surface: #161619;
  --surface-2: #1a1a1e;
  --surface-3: #212126;
  --hover: #303037;   /* 13.10: было #25252b, сливалось с рамкой --line #26262c (1,0:1), сейчас 1,15:1 */
  --line: #26262c;
  --line-2: #34343c;
  --text: #ececf1;
  --text-2: #a8a8b3;
  --text-3: #9494a0;   /* 05.10: было #777782, 4,0:1 на тёмной поверхности; сейчас 5,6:1 */
  --ink: #f2f2f4;
  --on-ink: #111113;
  --blue: #3683f7;
  --blue-hover: #5596f9;
  --blue-soft: #15233a;
  --on-blue: #ffffff;
  --ai: #7c3aed;
  --ai-hover: #8b5cf6;
  --violet-text: #b9a1fb;
  --violet-soft: #211a34;
  --violet-soft-2: #281f40;
  --violet-line: #5b4799;
  --red: #ef5358;
  --red-text: #ff8d91;
  --red-soft: #331a1c;
  --red-line: #6a2a2e;
  --amber-text: #f3c75a;
  --amber-soft: #2c2413;
  --amber-line: #5a4a1d;
  --green: #22c55e;
  --green-text: #4ade80;
  --green-soft: #13281b;
  --green-fill: #22c55e; --on-green: #0b1a10;   /* 7,9:1 */
  --red-fill: #d4363c; --on-red: #ffffff;     /* 4,8:1 */
  --amber-fill: #f59e0b; --on-amber: #2b1d00;
  --blue-fill: #1d64d8;
  --toast-ok: #166534; --toast-ai: #6d28d9;   /* тост в тёмной теме светлый: светло-зелёный и сиреневый на нём были 1,6:1 и 2:1 */
  --bubble-in: #232329;
  --chip-bg: #24242a;
  --veil: rgba(22, 22, 25, .84);
  --overlay: rgba(0, 0, 0, .55);
  --skeleton: var(--surface-3);
  --skeleton-hi: #2a2a31;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
  --focus-ring: #5596f9;
  --focus-soft: rgba(85, 150, 249, .24);
  --ai-ring: rgba(139, 92, 246, .26);
  --blue-text: #8ab8ff;
  --av0-bg: #2a2140; --av0-fg: #c4b5fd;
  --av1-bg: #332a14; --av1-fg: #fcd34d;
  --av2-bg: #172a47; --av2-fg: #93c5fd;
  --av3-bg: #3a1a2c; --av3-fg: #f9a8d4;
  --av4-bg: #15301f; --av4-fg: #86efac;
  --av5-bg: #132b3a; --av5-fg: #7dd3fc;
  --av6-bg: #3a2415; --av6-fg: #fdba74;
  --av7-bg: #24272d; --av7-fg: #cbd5e1;
  --lbl-1: #ef4444; --lbl-1-bg: #3b1517; --lbl-1-fg: #fca5a5;
  --lbl-2: #f97316; --lbl-2-bg: #3a2415; --lbl-2-fg: #fdba74;
  --lbl-3: #f59e0b; --lbl-3-bg: #332a14; --lbl-3-fg: #fcd34d;
  --lbl-4: #22c55e; --lbl-4-bg: #15301f; --lbl-4-fg: #86efac;
  --lbl-5: #14b8a6; --lbl-5-bg: #102e2b; --lbl-5-fg: #5eead4;
  --lbl-6: #3b82f6; --lbl-6-bg: #172a47; --lbl-6-fg: #93c5fd;
  --lbl-7: #8b5cf6; --lbl-7-bg: #2a2140; --lbl-7-fg: #c4b5fd;
  --lbl-8: #ec4899; --lbl-8-bg: #3a1a2c; --lbl-8-fg: #f9a8d4;
  color-scheme: dark;
}

/* поля страницы и крупный кегль сжимаются на узком экране: разделы на переменных получают это сами */
@media (max-width: 1023px) {
  :root { --page-x: 24px; }
}
@media (max-width: 767px) {
  :root { --page-x: 16px; --page-y: 16px; --fs-page: 20px; --fs-head: 16px; --fs-figure: 22px; }
}

/* ───────────── основа ───────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-lg)/var(--lh-ui) var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
::selection { background: rgba(43, 127, 247, .22); }
.ic { display: block; flex: none; }
.grow { flex: 1 1 auto; min-width: 0; }
/* тонкие полосы прокрутки во внутренних областях, как в Mochi */
.list-body, .msgs, .panel-scroll, .popover, .modal-body, .variants {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-3) 45%, transparent) transparent;
}
.mono { font-family: var(--mono); font-size: .95em; }
/* 13.10 (единый стиль): цифры одной ширины у сумм и счётчиков, которые меняются на глазах: не «дрожат» и не рвутся */
.num { font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.muted-note { font-size: var(--fs-sm); color: var(--text-3); }
.noscript { padding: 40px; text-align: center; color: var(--text-2); }


/* ───────────── каркас: левая колонка иконок ───────────── */

.app {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);       /* 11.10: сверху полоса вкладок раздела (.gtabs), под ней экран */
  height: 100vh;
  height: 100dvh;
}
.rail {
  grid-row: 1 / span 2; grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--s-3) 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
  z-index: 30;
  min-height: 0;
}
.rail-logo {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--ink); color: var(--on-ink);
  font-weight: var(--fw-bold); font-size: var(--fs-sm); letter-spacing: var(--ls-tight);
  margin-bottom: var(--s-5);
  box-shadow: var(--shadow-sm);
}
.rail-nav { display: flex; flex-direction: column; gap: var(--s-2); }
.rail-btn {
  position: relative;
  width: var(--h-lg); height: var(--h-lg);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--text-3);
  border: 1px solid transparent;
  background: transparent;
  padding: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.rail-btn:hover { background: var(--hover); color: var(--text); }
.rail-btn.is-active { background: var(--surface); color: var(--text); border-color: var(--line); box-shadow: var(--shadow-sm); }
.rail-label { display: none; }
.rail-badge {
  position: absolute; top: 2px; right: 1px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--red-fill); color: var(--on-red);                 /* 05.10: белое на --red было 3,9:1; 13.10: пара заливка/текст из токенов */
  font-size: 10px; font-weight: var(--fw-bold); line-height: 16px; text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--bg);
}
.rail-btn[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 10px); top: 50%;
  transform: translateY(-50%);
  background: var(--ink); color: var(--on-ink);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); white-space: nowrap;
  padding: var(--s-1) var(--s-2); border-radius: var(--r-xs);
  pointer-events: none; box-shadow: var(--shadow-md);
  z-index: 40;
}
.rail-more { display: none; }
.rail-more-d[hidden] { display: none; }
.rail-bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: var(--s-2); }
.rail-me {
  width: var(--h-sm); height: var(--h-sm); border-radius: 50%;
  display: grid; place-items: center;
  background: var(--av0-bg); color: var(--av0-fg);
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
}
.env-badge {
  font-size: 9.5px; font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); text-transform: uppercase;
  color: var(--amber-text); background: var(--amber-soft); border: 1px solid var(--amber-line);
  border-radius: var(--r-2xs); padding: 2px 5px; cursor: help;
}
.env-badge.is-off { color: var(--red-text); background: var(--red-soft); border-color: var(--red-line); }

/* 05.10 (руководство: «скачет форматирование, если переключаешь раздел»): место под полосу прокрутки занято всегда, иначе у вкладок разной высоты она то есть, то нет, и вся страница сдвигается на её ширину */
.main { grid-row: 2; grid-column: 2; position: relative; min-width: 0; min-height: 0; overflow: auto; scrollbar-gutter: stable; }

/* 11.10 (руководство: «слишком много разделов»): пять разделов в колонке, внутри раздела вкладки с прежними адресами.
   13.10 (единый стиль): высота полосы постоянная (--gtabs-h), и она занимает место с первой отрисовки, пока роль ещё
   неизвестна (пустая), поэтому страница не съезжает вниз на 44px, когда приходят вкладки (app.js, gtabsGuess) */
.gtabs {
  --gtabs-h: 44px;
  grid-row: 1; grid-column: 2;
  display: flex; align-items: flex-end; gap: 2px;
  height: var(--gtabs-h);
  min-width: 0; padding: 8px var(--s-4) 0;
  border-bottom: 1px solid var(--line); background: var(--bg);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.gtabs::-webkit-scrollbar { display: none; }
.gtabs[hidden] { display: none; }
.gtab {
  position: relative; flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px 9px;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  text-decoration: none;
}
.gtab:hover { color: var(--text); }
.gtab.is-active { color: var(--text); border-bottom-color: var(--ink); }
.gtab .gtab-badge { position: static; box-shadow: none; }
/* 12.10: внутри «Настроек» вместо вкладок «← Настройки» и название открытой настройки */
.gtab-back { color: var(--text-3); gap: 2px; padding-left: 4px; }
.gtab-here { cursor: default; }

/* 12.10 (руководство: «в настройках скорее как на фото», экран «Инструменты и связь» кабинета): список по разделам, у пункта подсказка и стрелка */
.set-hub { max-width: 760px; }
.set-sec { margin-top: var(--s-5); }
.set-sec-title {
  margin: 0 0 var(--s-2); padding-left: 2px;
  font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--blue-text);
}
.set-list { display: flex; flex-direction: column; gap: var(--s-2); }
.set-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none;
  transition: border-color .15s, background .15s;
}
.set-item:hover { border-color: var(--blue); }
.set-item:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.set-item-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.set-item-title { font-weight: var(--fw-semibold); }
.set-item-sub { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* 12.10 (руководство: «выровняй, чтобы не было переноса»): подсказка всегда одной строкой */
.set-item-arrow { flex: none; color: var(--text-3); }
.set-item:hover .set-item-arrow { color: var(--text); }
.gtab .gtab-badge[hidden] { display: none; }
.main-inbox, .main-sales-chats { overflow: hidden; overflow: clip; }          /* 12.10: «Отдел продаж» (#/sales-chats) тот же раздел «Входящих» */

/* ───────────── кнопки ───────────── */

/* размеры: .btn 36 (md), .btn-sm 30, .btn-xs 24. Иконка 16 / 14 / 12 (SF.ui.button ставит сама) */
.btn {
  --spin: var(--text-2);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--h-md); padding: 0 var(--s-4);
  border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: var(--fs-md); font-weight: var(--fw-semibold); white-space: nowrap;
  user-select: none;
  transition: background .15s, border-color .15s, color .15s, opacity .15s, box-shadow .15s;
}
.btn-sm { height: var(--h-sm); padding: 0 var(--s-3); font-size: var(--fs-sm); border-radius: var(--r-sm); gap: 6px; }
.btn-xs { height: var(--h-xs); padding: 0 var(--s-2); font-size: var(--fs-xs); border-radius: var(--r-xs); gap: var(--s-1); }
.btn-primary { --spin: var(--on-ink); background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { opacity: .88; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-ai { --spin: #fff; background: var(--ai); color: #fff; box-shadow: 0 1px 2px rgba(124, 58, 237, .25); }
.btn-ai:hover { background: var(--ai-hover); }
/* мягкая кнопка ИИ: «Предложить ответ», «Переписать» рядом с обычными кнопками */
.btn-ai-soft { --spin: var(--violet-text); background: var(--violet-soft); color: var(--violet-text); border-color: var(--violet-line); }
.btn-ai-soft:hover { background: var(--violet-soft-2); }
.btn-danger { --spin: var(--on-red); background: var(--red-fill); color: var(--on-red); }   /* 13.10: белый на --red 3,9:1, на тёмной 3,5:1 */
.btn-danger:hover { opacity: .9; }
/* кнопка «пришла оплата», «готово»: зелёная, как этап «Оплачено» */
.btn-ok { --spin: var(--ok-ink); background: var(--ok-bg); color: var(--ok-ink); }
.btn-ok:hover { opacity: .9; }
.btn:disabled { opacity: .5; }
.btn.is-busy { opacity: 1; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid transparent; border-top-color: var(--spin); border-right-color: var(--spin);
  animation: spin .7s linear infinite;
}
.btn-block { width: 100%; }
/* 13.10 (единый стиль): кнопка-выпадашка «Все продажники ˅»: подпись режется многоточием, стрелка своя. SF.ui.button(label, { dd: true }) */
.btn.is-dd { gap: var(--s-inner); padding-right: var(--s-3); max-width: 100%; }
.btn.is-dd > .btn-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.btn.is-dd:not(.is-busy)::after {
  content: ""; flex: none; width: 6px; height: 6px; margin: 0 2px 3px 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); opacity: .6;
}
/* кнопка-иконка: 36, .sm 30. Иконка 18 / 16 */
.icon-btn {
  position: relative;
  width: var(--h-md); height: var(--h-md);
  display: inline-grid; place-items: center; flex: none;
  border-radius: var(--r-sm); border: 0; padding: 0;
  background: transparent; color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: var(--h-sm); height: var(--h-sm); border-radius: var(--r-xs); }
/* 13.10 (единый стиль): кнопка-иконка 24 / 30 / 36 (.xs / .sm / обычная), .is-round круглая */
.icon-btn.xs { width: var(--h-xs); height: var(--h-xs); border-radius: var(--r-small); }
.icon-btn.is-round { border-radius: 50%; }
.icon-btn.is-on { background: var(--surface-3); color: var(--text); }
/* белая с тонкой рамкой: «Обновить» в шапке раздела и другие одиночные кнопки на фоне страницы */
.icon-btn.is-outline { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.icon-btn.is-outline:hover { background: var(--surface-3); border-color: var(--line-2); }
.icon-btn.is-busy .ic, .icon-btn.is-spin .ic { animation: spin .8s linear infinite; }
.icon-btn.is-danger:hover { color: var(--red-text); background: var(--red-soft); }
.link-btn {
  border: 0; background: none; padding: 2px var(--s-1);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-2);
  text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--text); }

/* ───────────── чипы и бейджи ───────────── */

/* чип 24; в строках списков и на карточках доски 22 (.chip-sm) */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: var(--h-xs); padding: 0 var(--s-2) 0 var(--s-1);
  max-width: 100%; min-width: 0;
  border-radius: var(--r-xs); border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); line-height: 1; white-space: nowrap;
}
.chip-sm { height: var(--h-chip-sm); gap: var(--s-1); font-size: var(--fs-2xs); background: var(--chip-bg); border-color: transparent; }
.chip-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chip-tag { padding-left: 6px; }
.chip-caret { color: var(--text-3); margin-left: -1px; }
button.chip { cursor: pointer; transition: background .15s, border-color .15s; }
button.chip:hover { background: var(--surface-3); border-color: var(--line-2); }
/* 13.10 (единый стиль): чип-фильтр и переключатель один на все разделы. Высоты 22 / 24 / 30 (.chip-sm / .chip / .chip-lg).
   Выбранный всегда почти чёрный (.is-on), у ИИ фиолетовый (.is-ai.is-on), «добавить» пунктиром (.is-dashed).
   Жирность у выбранного та же, меняется только цвет */
.chip.is-on, .chip.is-on:hover { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip.is-on .chip-caret, .chip.is-on .chip-x { color: inherit; }
.chip.is-ai:not(.is-on) { color: var(--violet-text); }
.chip.is-ai.is-on, .chip.is-ai.is-on:hover { background: var(--ai); border-color: var(--ai); color: #fff; }
.chip.is-dashed { background: transparent; border-style: dashed; border-color: var(--line-2); color: var(--text-2); }
.chip.is-dashed:hover { color: var(--text); border-color: var(--text-3); }
button.chip:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.chip-lg { height: var(--h-sm); padding: 0 var(--s-3) 0 var(--s-2); font-size: var(--fs-md); font-weight: var(--fw-semibold); border-radius: var(--r-sm); box-shadow: var(--shadow-sm); }
.chip-more { padding: 0 var(--s-2); color: var(--text-2); }
.chip-soft { background: var(--violet-soft); border-color: transparent; color: var(--violet-text); padding-left: var(--s-2); font-weight: var(--fw-semibold); }
.chip-x {
  display: inline-grid; place-items: center; flex: none;
  width: 16px; height: 16px; margin-right: -3px;
  border: 0; border-radius: 5px; padding: 0;
  background: transparent; color: var(--text-3);
}
.chip-x:hover { background: var(--hover); color: var(--text); }
.chip-x:disabled { opacity: .4; }
.stage-ic {
  display: inline-grid; place-items: center; flex: none;
  width: 16px; height: 16px; border-radius: 5px;
  color: #fff;
}
.stage-ic .ic { stroke-width: 2.6; }
.stage-ic.is-none { background: var(--line-2) !important; color: var(--text-2); }
.stage-ic.is-auto { width: 16px; height: 16px; background: var(--ai); }
.tag-ic { display: inline-flex; flex: none; }
/* метка 18 рядом с именем: «ИИ», «тест», «автопилот», «быстрый тест», «изменено», «сейчас» */
.mini-badge {
  display: inline-flex; align-items: center; gap: 3px; flex: none;
  height: var(--h-mini); padding: 0 6px; border-radius: var(--r-2xs);
  font-size: var(--fs-3xs); font-weight: var(--fw-bold); line-height: 1; white-space: nowrap;
  color: var(--text-2); background: var(--surface-3);
}
/* 13.10 (единый стиль): у меток и бейджей один набор смыслов .is-ok / .is-warn / .is-danger / .is-info / .is-ai / .is-muted;
   прежние имена (.ai, .test, .auto, .blue, .ok, .warn, .danger) остаются псевдонимами */
.mini-badge.ai, .mini-badge.is-ai, .badge.is-ai { color: var(--violet-text); background: var(--violet-soft); }
.mini-badge.test { color: var(--amber-text); background: var(--amber-soft); }
.mini-badge.autopilot, .mini-badge.auto { color: var(--auto-text); background: var(--auto-soft); }
.mini-badge.fast, .mini-badge.blue, .mini-badge.is-info, .badge.is-info { color: var(--blue-text); background: var(--blue-soft); }
.mini-badge.ok, .mini-badge.is-ok, .badge.is-ok { color: var(--green-text); background: var(--green-soft); }
.mini-badge.warn, .mini-badge.is-warn, .badge.is-warn { color: var(--amber-text); background: var(--amber-soft); }
.mini-badge.danger, .mini-badge.is-danger, .badge.is-danger { color: var(--red-text); background: var(--red-soft); }
.mini-badge.is-muted, .badge.is-muted { color: var(--text-2); background: var(--surface-3); }
/* бейдж 22: «нужен сеттер», «черновик» */
.badge {
  display: inline-flex; align-items: center; gap: var(--s-1); flex: none;
  height: var(--h-chip-sm); padding: 0 var(--s-2); border-radius: var(--r-xs);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); line-height: 1; white-space: nowrap;
}
.badge-you { background: var(--red-fill); color: var(--on-red); }
.badge-draft { background: var(--violet-soft); color: var(--violet-text); border: 1px dashed var(--violet-line); }
/* счётчик 18 у заголовка колонки, списка, вкладки: «12» */
.count {
  display: inline-block; flex: none;
  min-width: var(--h-mini); height: var(--h-mini); padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--chip-bg); color: var(--text-2);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); line-height: var(--h-mini); text-align: center;
  font-variant-numeric: tabular-nums;
}
.count.is-hot { background: var(--red-text); color: var(--on-ink); }
.count.is-ai { background: var(--violet-soft); color: var(--violet-text); }

/* ───────────── тумблер ───────────── */

/* Цвет включённого тумблера по смыслу: обычный (--ink) для настроек, фильтров и каналов,
   .toggle-ai только «ИИ в этом диалоге», .toggle-ap автопилот. SF.ui.toggle({ variant: 'ai' | 'auto' }). */
.toggle {
  --toggle-on: var(--ink);
  --toggle-thumb-on: var(--on-ink);
  position: relative;
  display: inline-flex; align-items: center; gap: var(--s-2);
  cursor: pointer; user-select: none;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2);
}
.toggle-ai { --toggle-on: var(--ai); --toggle-thumb-on: #fff; }
.toggle-ap { --toggle-on: var(--auto); --toggle-thumb-on: #fff; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; margin: 0; }
.toggle-track {
  position: relative; flex: none;
  width: 34px; height: 20px; border-radius: var(--r-pill);
  background: var(--line-2);
  transition: background .18s;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .22);
  transition: transform .18s, background .18s;
}
.toggle input:checked + .toggle-track { background: var(--toggle-on); }
/* в тёмной теме --ink светлый: белый бегунок на нём пропадал, поэтому бегунок берёт цвет «на чернилах» */
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(14px); background: var(--toggle-thumb-on); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.toggle input:disabled + .toggle-track { opacity: .5; }
.toggle:has(input:disabled) { cursor: default; }
.toggle-label { white-space: nowrap; }

/* ───────────── загрузка, скелетоны, пустые состояния, ошибки ───────────── */

.spinner {
  display: inline-block; flex: none;
  border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--text-2);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* .loader.is-inline (13.10): «крутилка с текстом» в строке, без полей блока */
.loader { display: flex; align-items: center; justify-content: center; gap: var(--s-2); padding: var(--s-6) var(--s-4); color: var(--text-3); font-size: var(--fs-sm); text-align: center; }
.loader.is-inline { display: inline-flex; justify-content: flex-start; padding: 0; text-align: left; }

.sk {
  background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-hi) 37%, var(--skeleton) 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease infinite;
  border-radius: var(--r-xs);
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-row { display: flex; gap: var(--s-3); padding: var(--s-3); }
.sk-av { width: 38px; height: 38px; border-radius: 50%; flex: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: var(--s-2); padding-top: 3px; }
.sk-line { height: 10px; }
.sk-chipline { width: 38%; height: 16px; border-radius: var(--r-2xs); }
.sk-lines .sk-line { width: 70%; }
.sk-wrap.sk-lines { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-1) 0; }
.sk-msg { display: flex; margin: var(--s-2) 0; }
.sk-msg.out { justify-content: flex-end; }
.sk-bubble { height: 38px; border-radius: var(--r-lg); }

/* пустое состояние с картинкой: весь раздел или колонка пусты. Всегда по центру блока */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px;
  padding: var(--s-8) var(--s-5); margin: auto;
  color: var(--text-2);
}
.empty.is-compact { padding: var(--s-6) var(--s-4); }
.empty-art { margin-bottom: var(--s-3); }
.empty.is-compact .empty-art svg { width: 132px; height: 96px; }
.empty-title { font-weight: var(--fw-bold); font-size: var(--fs-h3); line-height: var(--lh-tight); color: var(--text); }
.empty-text { font-size: var(--fs-sm); line-height: var(--lh-ui); color: var(--text-3); max-width: 320px; }
.empty .btn { margin-top: var(--s-3); }
/* пусто внутри карточки или колонки: пунктирная рамка, без картинки. SF.ui.emptyBox() */
.empty-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 96px; padding: var(--s-4);
  border: 1.5px dashed var(--line-2); border-radius: var(--r-md);
  color: var(--text-3); font-size: var(--fs-sm); line-height: var(--lh-ui); text-align: center;
}
.empty-box > .ic { opacity: .7; }
.empty-box-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text-2); }
.empty-box .btn { margin-top: 6px; }
.ill-dash { stroke: var(--line-2); }
.ill-card { fill: var(--surface); stroke: var(--line-2); }
.ill-shadow { filter: drop-shadow(0 4px 10px rgba(17, 17, 26, .07)); }
.ill-l1 { fill: var(--line-2); }
.ill-l2 { fill: var(--line); }
.ill-stroke { stroke: var(--line-2); }
.ill-ai { fill: var(--violet-soft-2); stroke: var(--violet-line); }

.error-box {
  display: flex; gap: var(--s-3); align-items: flex-start;
  margin: var(--s-4); padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md); border: 1px solid var(--red-line);
  background: var(--red-soft); color: var(--text);
  font-size: var(--fs-md); line-height: var(--lh-ui);
}
.error-box > .ic { color: var(--red-text); margin-top: 1px; }
.error-main { flex: 1; min-width: 0; }
.error-title { font-weight: var(--fw-bold); }
.error-text { color: var(--text-2); margin-top: 2px; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.error-box .btn { flex: none; align-self: center; }

/* ───────────── тосты ───────────── */

.toasts {
  position: fixed; z-index: 300;
  top: var(--s-4); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--s-2);
  max-width: min(440px, calc(100vw - 32px));
  min-height: var(--h-lg);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  border-radius: var(--r-md);
  background: var(--ink); color: var(--on-ink);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-md); font-weight: var(--fw-medium); line-height: var(--lh-ui);
  opacity: 0; transform: translateY(-8px);
  transition: opacity .2s, transform .2s;
}
.toast.in { opacity: 1; transform: none; }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* 13.10: цвет значка из темы. В тёмной теме тост светлый, светло-зелёный и сиреневый на нём не читались */
.toast-ok .toast-ic { color: var(--toast-ok); }
.toast-ai .toast-ic { color: var(--toast-ai); }
.toast-info .toast-ic { opacity: .7; }
.toast-error { background: var(--red-fill); color: var(--on-red); }
.toast-action { flex: none; height: var(--h-xs); border: 0; background: color-mix(in srgb, currentColor 16%, transparent); color: inherit; font-size: var(--fs-sm); font-weight: var(--fw-bold); padding: 0 var(--s-2); border-radius: var(--r-xs); }
.toast-x { display: grid; place-items: center; flex: none; width: var(--h-xs); height: var(--h-xs); border: 0; border-radius: var(--r-xs); background: transparent; color: inherit; opacity: .65; padding: 0; }
.toast-x:hover { opacity: 1; background: rgba(127, 127, 127, .18); }

/* ───────────── модалки ───────────── */

.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: var(--s-5);
  background: var(--overlay);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .18s;
}
.modal-overlay.open { opacity: 1; }
.modal {
  position: relative;
  width: min(var(--modal-md), 100%);
  max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(.985);
  transition: transform .2s;
  overflow: hidden;
}
.modal-overlay.open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 56px; padding: var(--s-3) var(--s-3) var(--s-2) var(--s-5); }
.modal-title { font-weight: var(--fw-bold); font-size: var(--fs-h3); line-height: var(--lh-tight); }
.modal-body { padding: var(--s-1) var(--s-5) var(--s-5); overflow-y: auto; min-height: 0; }
.modal-foot { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
/* 13.10 (единый стиль): 5 ширин окна вместо 15. По умолчанию --modal-md 480 */
.modal-sm { width: min(var(--modal-sm), 100%); }
.modal-md { width: min(var(--modal-md), 100%); }
.modal-lg { width: min(var(--modal-lg), 100%); }
.modal-xl { width: min(var(--modal-xl), 100%); }
.modal-2xl { width: min(var(--modal-2xl), 100%); }
.confirm-text { margin: 0; color: var(--text-2); font-size: var(--fs-md); line-height: var(--lh-text); }
.modal-float-x { position: absolute; top: var(--s-2); right: var(--s-2); z-index: 2; }
.modal-float-x .icon-btn { background: var(--veil); }
.modal-image { width: auto; max-width: min(920px, 100%); }
.modal-image .modal-body { padding: var(--s-4); display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.modal-image img { display: block; max-width: 100%; max-height: 74vh; border-radius: var(--r-md); }
.lightbox-link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2); }
.lightbox-link:hover { color: var(--blue); }

/* фильтры, как модалка Filters в Mochi */
.modal-filters { width: min(500px, 100%); }
.fsec + .fsec { margin-top: var(--s-5); }
.fsec-title { font-size: var(--fs-sm); font-weight: var(--fw-bold); margin-bottom: var(--s-2); color: var(--text); }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.cpill {
  position: relative;
  display: flex; align-items: center; gap: var(--s-2);
  height: var(--h-md); padding: 0 var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface);
  font-size: var(--fs-md); font-weight: var(--fw-medium);
  cursor: pointer; min-width: 0;
  transition: background .15s, border-color .15s;
}
.cpill:hover { background: var(--surface-2); border-color: var(--line-2); }
.cpill input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.cbox {
  display: grid; place-items: center; flex: none;
  width: 16px; height: 16px; border-radius: 5px;
  border: 1.5px solid var(--line-2);
  color: transparent;
  transition: background .12s, border-color .12s;
}
.cpill input:checked ~ .cbox { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.cpill input:focus-visible ~ .cbox { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.cpill:has(input:checked) { border-color: var(--line-2); background: var(--surface-2); }
.cpill.is-radio .cbox { border-radius: 50%; }
.cpill-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ───────────── поповеры и меню ───────────── */

.popover {
  position: fixed; z-index: 250;
  min-width: 200px;
  max-height: min(440px, calc(100vh - 16px)); max-height: min(440px, calc(100dvh - 16px));
  overflow-y: auto;
  padding: var(--s-1);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  animation: pop .12s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.menu { display: flex; flex-direction: column; }
.menu-item {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; min-height: var(--h-md); padding: 6px var(--s-3);
  border: 0; border-radius: var(--r-xs);
  background: none; color: var(--text);
  text-align: left; font-size: var(--fs-md); font-weight: var(--fw-medium); line-height: var(--lh-tight);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item.is-danger { color: var(--red-text); }
.menu-item:disabled { opacity: .5; }
.menu-ic { color: var(--text-2); }
.menu-item.is-danger .menu-ic { color: var(--red-text); }
.menu-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.menu-hint { font-size: var(--fs-2xs); font-weight: var(--fw-regular); color: var(--text-3); }
.menu-check { color: var(--text); }
.menu-sep { height: 1px; margin: var(--s-1) 6px; background: var(--line); }
.menu-head { padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--fs-3xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--text-3); }
.menu-empty { padding: var(--s-3); font-size: var(--fs-sm); color: var(--text-3); }
.tag-search { padding: var(--s-1) var(--s-1) 6px; }

/* ───────────── поля ввода ───────────── */

/* поле в одну строку 36 (.input-sm 30), радиус 10. Многострочное (textarea с классом input) радиус 12.
   Фокус синий, как у поиска. Поле, где пишешь запрос ИИ («переписать», «свой запрос»), .is-ai: фиолетовый фокус */
.input {
  /* flex: 1 1 auto, а не «1»: у «1» основа нулевая, и в колонке (окно, форма, поповер) поле схлопывалось до 18 px по высоте (замечание руководства 03.10) */
  height: var(--h-md); min-width: 0; flex: 1 1 auto;
  padding: 0 var(--s-3);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-md);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--focus-ring); box-shadow: 0 0 0 3px var(--focus-soft); outline: none; }
.input.is-ai:focus { border-color: var(--violet-line); box-shadow: 0 0 0 3px var(--ai-ring); }
.input.is-error, .input[aria-invalid="true"] { border-color: var(--red); }
.input.is-error:focus, .input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }
.input:disabled { opacity: .6; cursor: default; }
.input-sm { height: var(--h-sm); width: 100%; font-size: var(--fs-sm); }
/* :where, чтобы свой класс раздела (min-height, отступы) перекрывал это без !important */
.input:where(textarea) {
  display: block; width: 100%; height: auto; min-height: 76px;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  font-size: var(--fs-lg); line-height: var(--lh-ui);
  resize: vertical;
}
/* выпадающий список: своя стрелка, одинаковая в обеих темах */
select.input {
  -webkit-appearance: none; appearance: none;
  padding-right: 30px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select.input option { color: var(--text); background: var(--surface); }
/* поле формы: подпись, поле, подсказка, ошибка. Зазор 6 между ними */
.field-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); }
.field-hint { margin: 0; font-size: var(--fs-sm); line-height: var(--lh-ui); color: var(--text-3); }
.field-err { margin: 0; font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: var(--lh-ui); color: var(--red-text); }
.field-count { flex: none; font-size: var(--fs-2xs); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ───────────── страница раздела ───────────── */

.page { padding: var(--page-y) var(--page-x) var(--s-8); max-width: 1280px; margin: 0 auto; }
/* шапка раздела: заголовок и подзаголовок слева, счётчик или кнопки справа по нижнему краю.
   SF.ui.pageHead({ title, count, sub, side }) */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: var(--s-3) var(--s-4); margin-bottom: var(--s-5); min-width: 0; }
.page-head-main { flex: 1 1 320px; min-width: 0; }
.page-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3); margin: 0; font-size: var(--fs-h1); font-weight: var(--fw-bold); line-height: 1.25; letter-spacing: var(--ls-tight); }
.page-sub { margin: var(--s-1) 0 0; max-width: 640px; font-size: var(--fs-md); line-height: var(--lh-ui); color: var(--text-2); }
.page-head-side { display: flex; align-items: center; gap: var(--s-2); flex: none; min-width: 0; max-width: 100%; }
/* таблетка в шапке: «12 тегов», «Сверено 28.09», «обновлено 2 мин назад» */
.head-pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: var(--h-sm); padding: 0 var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text-2);
  box-shadow: var(--shadow-sm);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); letter-spacing: var(--ls-normal); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* мелкая подпись справа в шапке: «обновлено 12:40» */
.head-meta { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.head-meta.is-error { color: var(--red-text); }

/* ───────────── карточки, плашки, плитки иконок ───────────── */

/* карточка раздела: белая, рамка, тень, радиус 14, поля 20 (на телефоне 16) */
.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: var(--s-5);
}
.card.is-flat { box-shadow: none; }
/* 13.10 (единый стиль): малая карточка: поля 16, радиус 10 */
.card.is-sm { padding: var(--s-4); border-radius: var(--r-medium); }
/* блок внутри карточки: серая подложка, радиус 12, поля 16 */
.card-inset { min-width: 0; padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.card-head { display: flex; align-items: center; gap: var(--s-3); min-width: 0; margin-bottom: var(--s-4); }
.card-head.is-top { align-items: flex-start; }
.card-titles { flex: 1; min-width: 0; }
.card-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); margin: 0; font-size: var(--fs-h3); font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
.card-hint { margin: 2px 0 0; font-size: var(--fs-sm); line-height: var(--lh-ui); color: var(--text-3); }
.block-title { margin: 0; font-size: var(--fs-h2); font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
/* подпись капсом над группой: «ЧТО НАПИСАЛ КЛИЕНТ», «ОТПРАВЛЕНО» */
.label-caps { font-size: var(--fs-3xs); font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--text-3); }

/* 13.10 (единый стиль): общая таблица (из .db-table дашборда). Шапка мелким серым, числа вправо (.is-num), подсветка строки.
   .is-caps-head шапка КАПСОМ, .is-compact поля 8 × 12. Обёртка с прокруткой: .table-wrap */
.table-wrap { max-width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
.table th, .table td { padding: var(--s-3); border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table thead th { background: var(--surface); font-size: var(--fs-small); font-weight: var(--fw-medium); color: var(--text-3); white-space: nowrap; vertical-align: bottom; }
.table tbody th { font-weight: var(--fw-semibold); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table .is-num { text-align: right; white-space: nowrap; }
.table tbody tr:hover > * { background: var(--surface-2); }
.table.is-caps-head thead th { font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: var(--ls-caps); text-transform: uppercase; }
.table.is-compact th, .table.is-compact td { padding: var(--s-2) var(--s-3); }

/* строка-карточка с контролом справа: тумблер, кнопка. Контрол по центру строки */
.set-row {
  display: flex; align-items: center; gap: var(--s-3); min-width: 0;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
}
.set-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.set-row-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: var(--lh-tight); color: var(--text); }
.set-row-text { font-size: var(--fs-sm); line-height: var(--lh-ui); color: var(--text-2); }
.set-row > .toggle, .set-row > .btn, .set-row > .icon-btn { flex: none; }
/* та же строка без рамки, когда она одна внутри блока настройки */
.set-row.is-bare { padding: 0; border: 0; background: none; }
.set-row.is-locked .toggle { cursor: default; }

/* выбор одного из вариантов карточками: выбранный с чёрной рамкой и чёрной точкой справа.
   Разметка: label.opt > input[type=radio] + (иконка) + .opt-main + .opt-dot */
.opt {
  position: relative;
  display: flex; align-items: center; gap: var(--s-3); min-width: 0;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.opt.is-compact { padding: var(--s-3); gap: var(--s-3); }
.opt:hover { border-color: var(--line-2); }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; margin: 0; }
.opt:has(input:checked), .opt.is-on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.opt:has(input:focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.opt:has(input:disabled) { opacity: .6; cursor: default; }
.opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.opt-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: var(--lh-tight); color: var(--text); }
.opt-hint { font-size: var(--fs-sm); line-height: var(--lh-ui); color: var(--text-2); }
.opt-dot {
  flex: none; width: 18px; height: 18px;
  border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.opt:has(input:checked) .opt-dot, .opt.is-on .opt-dot { border-color: var(--ink); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 9px var(--ink); }
.opts { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
.opts.is-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 479px) { .opts.is-2 { grid-template-columns: minmax(0, 1fr); } }

/* сегменты в таблетке: «Обзор / Команда», «Свежие / Дольше ждут», категории. Внутри .tab 30, снаружи 36 */
.seg {
  display: inline-flex; align-items: center; gap: 2px; flex: none;
  max-width: 100%; padding: 2px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); box-shadow: var(--shadow-sm);
  overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg > .tab { flex: none; }
/* 13.10 (единый стиль): SF.ui.seg({ items, value, onChange, size: 'sm' }) собирает сегменты одной функцией; .is-sm вкладки 24 */
.seg.is-sm > .tab { height: var(--h-xs); padding: 0 var(--s-2); font-size: var(--fs-small); }

/* плашка-пояснение. Цвет по смыслу: обычная серая, .is-ai фиолетовая (про ИИ), .is-info синяя,
   .is-warn жёлтая, .is-danger красная, .is-ok зелёная, .is-auto автопилот. SF.ui.note(text, { icon, kind }) */
.note {
  display: flex; align-items: flex-start; gap: var(--s-2); min-width: 0;
  padding: var(--s-3);
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--surface-3); color: var(--text-2);
  font-size: var(--fs-sm); line-height: var(--lh-ui);
}
.note > .ic { flex: none; margin-top: 1px; color: var(--text-3); }
.note-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.note-text b, .note-text strong { color: var(--text); font-weight: var(--fw-semibold); }
.note > .btn, .note > .link-btn { flex: none; align-self: center; }
.note.is-lg { padding: var(--s-3) var(--s-4); font-size: var(--fs-md); line-height: var(--lh-text); }
.note.is-lg > .ic { margin-top: 2px; }
.note.is-ai { background: var(--violet-soft); border-color: var(--violet-line); color: var(--violet-text); }
.note.is-ai > .ic { color: var(--ai); }
.note.is-info { background: var(--blue-soft); color: var(--text); }
.note.is-info > .ic { color: var(--blue-text); }
.note.is-warn { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber-text); }
.note.is-warn > .ic { color: var(--amber-text); }
.note.is-danger { background: var(--red-soft); border-color: var(--red-line); color: var(--red-text); }
.note.is-danger > .ic { color: var(--red-text); }
.note.is-ok { background: var(--green-soft); color: var(--green-text); }
.note.is-ok > .ic { color: var(--green-text); }
.note.is-auto { background: var(--auto-soft); border-color: var(--auto-line); color: var(--auto-text); }
.note.is-auto > .ic { color: var(--auto-text); }
.note.is-dashed { background: transparent; border: 1px dashed var(--line-2); }

/* иконка в квадрате: 24 / 28 / 32 (.sm / по умолчанию / .lg), иконка 14 / 16 / 18. SF.ui.icTile() */
.ic-tile {
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: var(--r-xs);
  background: var(--surface-3); color: var(--text-2);
}
.ic-tile.sm { width: 24px; height: 24px; border-radius: var(--r-2xs); }
.ic-tile.lg { width: 32px; height: 32px; border-radius: var(--r-sm); }
.ic-tile.is-round { border-radius: 50%; }
.ic-tile.is-ai { background: var(--violet-soft); color: var(--violet-text); }
.ic-tile.is-auto { background: var(--auto-soft); color: var(--auto-text); }
.ic-tile.is-blue { background: var(--blue-soft); color: var(--blue-text); }
.ic-tile.is-warn { background: var(--amber-soft); color: var(--amber-text); }
.ic-tile.is-danger { background: var(--red-soft); color: var(--red-text); }
.ic-tile.is-ok { background: var(--green-soft); color: var(--green-text); }
.ic-tile.is-surface { background: var(--surface); border: 1px solid var(--line); }

/* полоса расхода и прогресса: 6 высотой, заливка по смыслу */
.meter { position: relative; height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--blue); transition: width .4s ease; }
.meter.is-ai > span { background: var(--ai); }
.meter.is-warn > span { background: var(--amber-text); }
.meter.is-over > span { background: var(--red); }
.meter.is-ok > span { background: var(--green); }

/* панель «есть несохранённые правки» внизу страницы */
.save-bar {
  position: sticky; bottom: var(--s-4); z-index: 10;
  display: flex; align-items: center; gap: var(--s-2);
  margin-top: var(--s-4); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-md); font-weight: var(--fw-semibold);
  animation: save-bar-up .18s ease;
}
@keyframes save-bar-up { from { opacity: 0; transform: translateY(8px); } }
.save-bar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber-text); flex: none; }
.save-bar.has-errors .save-bar-dot { background: var(--red); }
.save-bar-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* раскрывашка: заголовок-строка со стрелкой, тело с отступом 16 */
.disclosure { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.disclosure > summary {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
  min-height: 44px; padding: var(--s-2) var(--s-4);
  border-radius: var(--r-md);
  cursor: pointer; list-style: none; user-select: none;
  font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::marker { content: ""; }
.disclosure > summary:hover { background: var(--hover); }
.disclosure > summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.disclosure-chev { flex: none; color: var(--text-3); transition: transform .15s; }
.disclosure[open] > summary .disclosure-chev { transform: rotate(90deg); }
.disclosure[open] > summary { border-radius: var(--r-md) var(--r-md) 0 0; }
.disclosure-body { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-1) var(--s-4) var(--s-4); }
.disclosure-t { flex: 1; min-width: 0; }   /* ПВ 16.10: SF.ui.fold */
.disclosure-n { flex: none; font-size: var(--fs-small); font-weight: var(--fw-medium); color: var(--text-3); }
.disclosure-body.is-flush { padding: 0; gap: 0; border-top: 1px solid var(--line); }

/* ───────────── заглушки разделов ───────────── */

.soon { max-width: 560px; margin: 0 auto; padding: 9vh var(--s-4) var(--s-8); }
.soon-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--s-8) var(--s-8) var(--s-6);
  text-align: center;
}
.soon-ic { width: 48px; height: 48px; margin: 0 auto var(--s-4); border-radius: var(--r); display: grid; place-items: center; background: var(--surface-3); color: var(--text); }
.soon-badge {
  position: absolute; top: var(--s-4); right: var(--s-4);
  font-size: var(--fs-3xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-caps);
  color: var(--violet-text); background: var(--violet-soft);
  padding: 3px var(--s-2); border-radius: var(--r-pill);
}
.soon-title { font-size: var(--fs-h1); margin: 0 0 6px; letter-spacing: var(--ls-tight); }
.soon-text { color: var(--text-2); margin: 0 auto var(--s-5); max-width: 420px; }
.soon-list { list-style: none; margin: 0 auto var(--s-6); padding: 0; max-width: 420px; text-align: left; display: flex; flex-direction: column; gap: var(--s-2); }
.soon-list li { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--fs-md); color: var(--text); }
.soon-list .ic { color: var(--green); margin-top: 3px; }

/* ═════════════ ВХОДЯЩИЕ ═════════════ */

.inbox {
  position: relative;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr) 336px;
  height: 100%; min-height: 0;
  overflow: hidden;
  overflow: clip; /* не даёт браузеру сдвинуть колонки вбок при фокусе: закрытая карточка лежит за правым краем */
}
.inbox[data-has-peer="0"] { grid-template-columns: 360px minmax(0, 1fr); }
.inbox[data-has-peer="0"] .col-panel { display: none; }
.panel-backdrop { display: none; }

/* список */
.col-list {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
}
.list-head { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3); }
.search {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  height: var(--h-md); padding: 0 var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-3);
  box-shadow: var(--shadow-sm);
  cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--focus-ring); box-shadow: 0 0 0 3px var(--focus-soft); }
.search-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: var(--fs-md); }
.search-input::placeholder { color: var(--text-3); }
.search-input:focus-visible { outline: none; }
.filter-btn { width: var(--h-md); height: var(--h-md); border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.filter-btn.is-on { color: var(--text); border-color: var(--line-2); }
.count-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: var(--h-mini); height: var(--h-mini); padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--ink); color: var(--on-ink);
  font-size: var(--fs-3xs); font-weight: var(--fw-bold); line-height: var(--h-mini); text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--bg);
}
.tabs { display: flex; flex-wrap: wrap; gap: var(--s-1) 2px; padding: 0 var(--s-3) var(--s-2); flex: none; }
.tab {
  flex: none;
  display: inline-flex; align-items: center; gap: 3px;
  height: var(--h-sm); padding: 0 var(--s-3);
  border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--text-2);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--hover); color: var(--text); }
.tab.is-active { background: var(--ink); color: var(--on-ink); }
.tab-count { font-size: var(--fs-2xs); font-weight: var(--fw-semibold); opacity: .5; font-variant-numeric: tabular-nums; }
.tab.is-active .tab-count { opacity: .62; }
/* счётчик «горит» (просрочено, ждёт внимания): красная таблетка одной высоты везде. Раньше фон получала голая цифра без полей и
   скругления, и в «Продлениях» получался красный прямоугольник вплотную к цифре (замечание руководства 03.10) */
.tab.is-hot .tab-count, .tab.is-active.is-hot .tab-count {
  display: inline-grid; place-items: center; min-width: var(--h-mini); height: var(--h-mini); padding: 0 5px;
  border-radius: var(--r-pill); background: var(--red-text); color: var(--on-ink); opacity: 1; font-weight: var(--fw-bold);          /* контраст 5,4 в обеих темах: белое на красном давало 3,9 и 3,5 (проверка 03.10) */
}
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 var(--s-3) var(--s-2); }
.fchip {
  display: inline-flex; align-items: center; gap: var(--s-1);
  height: var(--h-xs); padding: 0 6px 0 var(--s-2); max-width: 100%;
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
}
.fchip .stage-ic { width: 14px; height: 14px; border-radius: 4px; }
.fchip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip-ai { color: var(--violet-text); }
.list-note {
  display: flex; align-items: center; gap: var(--s-2);
  margin: 0 var(--s-3) var(--s-2); padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm); background: var(--amber-soft); color: var(--amber-text);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); line-height: var(--lh-ui);
}
/* строки стоят по тем же краям, что поиск и чипы: 12 от края колонки, аватар под лупой */
.list-body { flex: 1; min-height: 0; overflow-y: auto; padding: 2px var(--s-3) var(--s-4); overscroll-behavior: contain; }

/* строка диалога */
.row {
  position: relative;
  display: flex; gap: var(--s-3);
  padding: 10px var(--s-3);
  border: 1px solid transparent; border-radius: var(--r-md);
  transition: background .12s;
}
.row + .row { margin-top: 2px; }
.row:hover { background: var(--hover); }
.row.is-active { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-sm); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-top { display: flex; align-items: center; gap: 6px; min-width: 0; height: 19px; }
.row-name { font-weight: var(--fw-semibold); font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex: none; margin-right: 2px; }
.unread-count {
  flex: none;
  min-width: var(--h-mini); height: var(--h-mini); padding: 0 5px;
  border-radius: var(--r-pill); background: var(--blue-fill); color: var(--on-blue);       /* 05.10: белое на --blue было 3,8:1, здесь 5,4:1 */
  font-size: var(--fs-3xs); font-weight: var(--fw-bold); line-height: var(--h-mini); text-align: center; font-variant-numeric: tabular-nums;
}
.row-mid { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row-preview { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-3); font-size: var(--fs-sm); }
.row.is-waiting .row-preview { color: var(--text); font-weight: var(--fw-semibold); }
.row-you { color: var(--text-3); font-weight: var(--fw-medium); }
.row-time { flex: none; color: var(--text-3); font-size: var(--fs-2xs); font-variant-numeric: tabular-nums; }
/* чипы в одну строку: что не влезло целиком, уходит на скрытую вторую строку, а не режется на «Холодн…» */
.row-chips { display: flex; flex-wrap: wrap; gap: var(--s-1); height: var(--h-chip-sm); margin-top: 6px; overflow: hidden; min-width: 0; }
.row-chips > * { flex-shrink: 0; max-width: 100%; }
.row .chip { height: var(--h-chip-sm); font-size: var(--fs-2xs); background: var(--chip-bg); border-color: transparent; }
.row.is-active .chip { background: var(--surface-3); }
.row .badge { height: var(--h-chip-sm); }

/* аватар */
.avatar {
  --av-bg: var(--av0-bg); --av-fg: var(--av0-fg);
  position: relative; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%; overflow: hidden;
  background: var(--av-bg); color: var(--av-fg);
  font-weight: var(--fw-semibold); line-height: 1;
  user-select: none;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av-c0 { --av-bg: var(--av0-bg); --av-fg: var(--av0-fg); }
.av-c1 { --av-bg: var(--av1-bg); --av-fg: var(--av1-fg); }
.av-c2 { --av-bg: var(--av2-bg); --av-fg: var(--av2-fg); }
.av-c3 { --av-bg: var(--av3-bg); --av-fg: var(--av3-fg); }
.av-c4 { --av-bg: var(--av4-bg); --av-fg: var(--av4-fg); }
.av-c5 { --av-bg: var(--av5-bg); --av-fg: var(--av5-fg); }
.av-c6 { --av-bg: var(--av6-bg); --av-fg: var(--av6-fg); }
.av-c7 { --av-bg: var(--av7-bg); --av-fg: var(--av7-fg); }

/* ───────────── чат ───────────── */

.col-chat {
  position: relative;
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background: var(--surface);
  container-type: inline-size;
  container-name: chat;
}
.col-chat > .empty { flex: 1; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  flex: none;
  display: flex; align-items: center; gap: var(--s-3);
  height: 64px; padding: 0 var(--s-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  min-width: 0;
}
.back-btn { display: none; }
.chat-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: var(--fw-semibold); font-size: var(--fs-h3); line-height: var(--lh-tight); }
.chat-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-sub { display: inline-flex; align-items: center; gap: var(--s-1); width: fit-content; max-width: 100%; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; }
.chat-sub-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lbl-short { display: none; }
a.chat-sub:hover { color: var(--blue); }
.vk-mark {
  display: inline-grid; place-items: center;
  height: 14px; padding: 0 3px;
  border-radius: 4px; background: var(--ch-vk); color: var(--ch-on);
  font-size: 8.5px; font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); line-height: 1;
}
/* всё в шапке чата одной высоты 30 и по центру (кнопки-иконки 30×30 задаёт css/inbox-extra.css, волна 10б) */
.chat-actions { display: flex; align-items: center; gap: var(--s-2); flex: none; }
.chat-actions > .btn, .chat-actions > .chip { height: var(--h-sm); }
.stale-bar {
  flex: none;
  display: flex; align-items: center; gap: var(--s-2);
  padding: 6px var(--s-4);
  background: var(--amber-soft); color: var(--amber-text);
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  border-bottom: 1px solid var(--amber-line);
}
.chat-body { position: relative; flex: 1; min-height: 0; display: flex; }
.msgs { flex: 1; min-width: 0; overflow-y: auto; padding: var(--s-4) var(--s-5); overscroll-behavior: contain; }
.drop-hint {
  position: absolute; inset: 10px; z-index: 30;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed var(--blue); border-radius: var(--r);
  background: var(--veil); color: var(--blue);
  font-weight: var(--fw-bold); font-size: var(--fs-lg);
  pointer-events: none;
}
.col-chat.is-drop .drop-hint { display: flex; }

/* сообщения */
.day-sep { display: flex; justify-content: center; margin: var(--s-4) 0 var(--s-2); }
.day-sep span {
  display: inline-flex; align-items: center; height: var(--h-xs);
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--text-3);
  background: var(--surface); padding: 0 var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-pill);
}
.fresh-sep { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-4) 0 var(--s-2); color: var(--violet-text); font-size: var(--fs-xs); font-weight: var(--fw-bold); }
.fresh-sep::before, .fresh-sep::after { content: ""; flex: 1; border-top: 1.5px dashed var(--violet-line); }
.fresh-sep span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: min(74%, 580px); margin-top: 3px; }
.msg.group-start { margin-top: var(--s-3); }
.msg-out { margin-left: auto; align-items: flex-end; }
.msg.before-fresh { opacity: .62; }
.bubble {
  max-width: 100%;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-lg);
  background: var(--bubble-in); color: var(--text);
  font-size: var(--fs-lg); line-height: var(--lh-ui);
  overflow-wrap: anywhere; word-break: break-word;
}
.msg-out .bubble { background: var(--blue); color: var(--on-blue); }
.msg-in.group-end .bubble { border-bottom-left-radius: 6px; }
.msg-out.group-end .bubble { border-bottom-right-radius: 6px; }
.txt { white-space: pre-wrap; }
.txt-muted { opacity: .6; font-style: italic; }
.bubble a { text-decoration: underline; text-underline-offset: 2px; }
.msg-in .bubble a { color: var(--blue); }
.msg-out .bubble a { color: inherit; }
.bubble.is-clamped .txt { display: -webkit-box; -webkit-line-clamp: 14; -webkit-box-orient: vertical; overflow: hidden; }
.more-btn { display: block; border: 0; background: none; padding: 6px 0 0; color: inherit; font-size: var(--fs-sm); font-weight: var(--fw-bold); opacity: .85; text-decoration: underline; text-underline-offset: 2px; }
.bubble > .voice + .txt, .bubble > .att + .txt, .bubble > .txt + .att, .bubble > .att + .att, .bubble > .voice + .att, .bubble > .att + .voice { margin-top: 6px; }
.media { display: grid; gap: 4px; margin: -4px -8px 7px; }
.media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bubble.only-media { padding: 4px; }
.bubble.only-media .media { margin: 0; }
.media-item { display: block; padding: 0; border: 0; background: none; border-radius: var(--r); overflow: hidden; max-width: 280px; cursor: zoom-in; }
.media-item img { display: block; width: 100%; max-height: 320px; object-fit: cover; }
.media-missing { display: inline-flex; align-items: center; gap: 6px; padding: var(--s-1) 2px; font-size: var(--fs-sm); opacity: .8; }
.voice { display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.voice-row { display: flex; align-items: center; gap: var(--s-2); }
.voice-play {
  display: grid; place-items: center; flex: none;
  width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
}
.msg-out .voice-play { background: rgba(255, 255, 255, .22); color: #fff; box-shadow: none; }
.voice-play.is-playing { background: var(--blue); color: #fff; }
.voice-label { display: inline-flex; align-items: center; gap: var(--s-1); font-weight: var(--fw-semibold); font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.voice-tr { font-style: italic; }
.voice-tr.is-none { font-style: normal; opacity: .6; font-size: var(--fs-sm); }
.att { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-md); font-weight: var(--fw-semibold); opacity: .9; }
.msg-meta { display: flex; align-items: center; gap: 6px; margin: var(--s-1) 6px 0; font-size: var(--fs-3xs); color: var(--text-3); }
.auto-tag { display: inline-flex; align-items: center; gap: 3px; }
.msg.is-echo .bubble { opacity: .94; }

/* плавающие кнопки */
.jumps { position: absolute; right: var(--s-5); bottom: var(--s-3); display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-2); pointer-events: none; z-index: 5; }
.jump-btn {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 6px;
  height: var(--h-sm); padding: 0 var(--s-3);
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
}
.jump-ai { color: var(--violet-text); border-color: var(--violet-line); }

/* ───────────── черновики ИИ ───────────── */

.draft-zone { display: flex; flex-direction: column; gap: var(--s-4); margin-top: var(--s-4); }
.draft-zone:empty { display: none; }
.draft { margin-left: auto; width: min(560px, 88%); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.draft-card {
  position: relative;
  width: 100%;
  padding: var(--s-3) var(--s-4);
  border: 1.5px dashed var(--violet-line); border-radius: var(--r);
  background: var(--surface);
}
/* 13.10 (единый стиль): одна вспышка «только что изменилось» на весь портал. Цвет --flash (по умолчанию синий), класс .is-flash */
@keyframes flash {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--flash, var(--blue)) 45%, transparent); border-color: var(--flash, var(--blue)); }
  100% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--flash, var(--blue)) 0%, transparent); }
}
.is-flash { animation: flash 1.4s ease; }
@media (prefers-reduced-motion: reduce) { .is-flash { animation: none; } }
.draft.flash .draft-card { --flash: var(--ai); animation: flash 1.8s ease; }
.draft-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); min-width: 0; }
.draft-kind { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--violet-text); font-weight: var(--fw-bold); font-size: var(--fs-sm); }
.draft-sub { margin: calc(-1 * var(--s-1)) 0 var(--s-2); font-size: var(--fs-2xs); color: var(--text-3); overflow-wrap: anywhere; }
.draft-skip { flex: none; margin: -3px -6px -3px 0; color: var(--text-3); }
.draft-skip:hover { color: var(--text); }
.draft-batch { margin-bottom: var(--s-3); padding: 2px 0 2px var(--s-3); border-left: 2px solid var(--line-2); }
.draft-label { font-size: var(--fs-3xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--text-3); margin-bottom: var(--s-1); }
.batch-line { font-size: var(--fs-sm); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.batch-line::before { content: "› "; color: var(--text-3); }
.draft-body { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.draft-bubble {
  max-width: 100%;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-lg);
  background: var(--violet-soft); color: var(--text);
  font-size: var(--fs-lg); line-height: var(--lh-ui);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.draft-bubble:last-child { border-bottom-right-radius: 6px; }
.draft-bubble a { color: var(--violet-text); text-decoration: underline; text-underline-offset: 2px; }
.draft-bubble.is-empty { color: var(--text-3); font-style: italic; }
.draft-attach {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--h-xs); margin-top: var(--s-2); padding: var(--s-1) var(--s-2);
  border-radius: var(--r-xs); background: var(--violet-soft); color: var(--violet-text);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
}
.draft-card > .draft-attach { float: right; }
.flags { clear: both; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: var(--s-2); }
.flag {
  display: inline-flex; align-items: center; gap: var(--s-1);
  min-height: var(--h-xs); padding: 3px var(--s-2); border-radius: var(--r-xs);
  border: 1px solid var(--amber-line); background: var(--amber-soft); color: var(--amber-text);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: var(--lh-tight);
}
.draft-more { clear: both; display: flex; flex-direction: column; gap: var(--s-1); margin-top: var(--s-2); }
.det summary {
  display: inline-flex; align-items: center; gap: var(--s-1);
  list-style: none; cursor: pointer;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2);
  padding: 2px 0;
}
.det summary::-webkit-details-marker { display: none; }
.det summary:hover { color: var(--text); }
.det-chev { transition: transform .15s; color: var(--text-3); }
.det[open] .det-chev { transform: rotate(90deg); }
.det-body { margin: var(--s-1) 0 2px; padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.draft-actions { clear: both; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1); margin-top: var(--s-3); }
.draft-actions .btn-ghost { padding: 0 var(--s-2); }
.draft-foot { display: flex; align-items: flex-start; justify-content: flex-end; gap: var(--s-1); max-width: 100%; margin-right: var(--s-1); font-size: var(--fs-2xs); color: var(--text-3); text-align: right; }
.draft-foot .ic { color: var(--ai); margin-top: 2px; }
.draft-edit { display: flex; flex-direction: column; gap: var(--s-1); }
.draft-ta {
  width: 100%; min-height: 96px; resize: vertical;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--violet-line); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  line-height: var(--lh-ui); font-size: var(--fs-lg);
}
.draft-ta:focus { box-shadow: 0 0 0 3px var(--ai-ring); outline: none; }
.draft-hint { font-size: var(--fs-2xs); color: var(--text-3); }
.rewrite-box { clear: both; display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px dashed var(--line-2); }
.rewrite-box .input { flex: none; width: 100%; }
.rewrite-box .input:focus, .custom-ask .input:focus { border-color: var(--violet-line); box-shadow: 0 0 0 3px var(--ai-ring); }
.rewrite-box .draft-actions { margin-top: 2px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button {
  height: var(--h-xs); padding: 0 var(--s-3);
  border: 1px solid var(--violet-line); border-radius: var(--r-pill);
  background: transparent; color: var(--violet-text);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
}
.quick button:hover { background: var(--violet-soft); }
.draft-gone { display: flex; gap: var(--s-2); align-items: flex-start; padding: var(--s-3); border-radius: var(--r-md); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-ui); }
.draft-gone > .ic { flex: none; margin-top: 1px; }
.draft-veil {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  border-radius: calc(var(--r) - 1px);
  background: var(--veil); color: var(--violet-text);
  font-size: var(--fs-md); font-weight: var(--fw-semibold);
}
.draft-pending {
  margin: var(--s-4) 0 0 auto; width: fit-content; max-width: 100%;
  display: flex; align-items: center; gap: var(--s-2);
  min-height: var(--h-md); padding: var(--s-2) var(--s-4);
  border: 1.5px dashed var(--violet-line); border-radius: var(--r-pill);
  color: var(--violet-text); font-size: var(--fs-sm); font-weight: var(--fw-semibold);
}
.dots { display: inline-flex; gap: 4px; flex: none; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ai); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: none; } }

/* плашка «нужен сеттер» */
.needs-you {
  flex: none;
  display: flex; align-items: center; gap: var(--s-3);
  margin: 0 var(--s-4) var(--s-2); padding: var(--s-3);
  border: 1px solid var(--red-line); border-radius: var(--r-md);
  background: var(--red-soft);
}
/* слева плитка-иконка 32 (SF.ui.icTile(…, { size: 'lg', kind: 'danger' })); старый смайлик тоже по центру */
.needs-ic { display: grid; place-items: center; flex: none; width: 32px; height: 32px; font-size: 20px; line-height: 1; }
.needs-you > .ic-tile { align-self: center; }
.needs-text { flex: 1; min-width: 0; font-size: var(--fs-md); line-height: var(--lh-ui); }
.needs-title { font-weight: var(--fw-bold); color: var(--red-text); }
.needs-reason { margin-top: 2px; color: var(--text-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* ───────────── поле ввода ───────────── */

.composer { flex: none; position: relative; padding: 0 var(--s-4) var(--s-4); }
.composer-box {
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: var(--s-2);
  transition: box-shadow .15s, border-color .15s;
}
.composer-box:focus-within { box-shadow: var(--shadow-md); }
.ai-chips {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 var(--s-6) var(--s-2) 0;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
}
.ai-chips::-webkit-scrollbar { display: none; }
.ai-chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: var(--h-sm); padding: 0 var(--s-3);
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text-2);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  transition: background .15s, border-color .15s, color .15s;
}
.ai-chip .ic { color: var(--ai); }
.ai-chip:hover { border-color: var(--violet-line); background: var(--violet-soft); color: var(--violet-text); }
.ai-chip.is-main { border-color: var(--violet-line); background: var(--violet-soft); color: var(--violet-text); }
.ai-chip:disabled { opacity: .5; pointer-events: none; }
.custom-ask { display: flex; align-items: center; gap: var(--s-2); padding: 0 0 var(--s-2); }
.custom-ic { color: var(--ai); }
.attach-prev { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding: 2px var(--s-1) var(--s-2); }
.thumb { position: relative; width: 56px; height: 56px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .62); color: #fff; }
.composer-input {
  display: block; width: 100%;
  min-height: var(--h-lg); max-height: 220px;
  padding: 6px var(--s-2);
  border: 0; outline: 0; resize: none;
  background: transparent; color: var(--text);
  font-size: var(--fs-lg); line-height: var(--lh-ui);
}
.composer-input::placeholder { color: var(--text-3); }
.composer-input:focus-visible { outline: none; }
.composer-foot { display: flex; align-items: center; gap: var(--s-1); margin-top: var(--s-1); min-width: 0; }
.scale-wrap {
  display: inline-flex; align-items: center; gap: var(--s-1); flex: none;
  height: var(--h-md); padding: 0 2px 0 var(--s-2);
  border-radius: var(--r-sm); color: var(--text-2);
  cursor: pointer;
}
.scale-wrap:hover { background: var(--hover); }
.scale-wrap.is-on { color: var(--violet-text); background: var(--violet-soft); }
.scale-select {
  max-width: 150px;
  border: 0; outline: 0; background: transparent;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: inherit;
  cursor: pointer; padding: var(--s-1) 2px;
}
.scale-select option { color: var(--text); background: var(--surface); }
.composer-hint { font-size: var(--fs-2xs); color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; margin-left: var(--s-1); }
.send-btn { height: var(--h-md); flex: none; }

/* варианты от ИИ */
.variants {
  margin-bottom: var(--s-2); padding: var(--s-3);
  max-height: 46vh; overflow-y: auto;
  border: 1.5px dashed var(--violet-line); border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.variants-head { display: flex; align-items: center; gap: var(--s-2); min-width: 0; margin-bottom: var(--s-2); color: var(--violet-text); font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.variants-q { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-weight: var(--fw-medium); }
.thinking { display: flex; align-items: center; gap: var(--s-2); padding: 6px 2px var(--s-1); color: var(--text-3); font-size: var(--fs-sm); }
.variants-err { display: flex; align-items: flex-start; gap: var(--s-2); padding: 6px 2px; color: var(--red-text); font-size: var(--fs-sm); }
.variant-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s-2); }
.variant { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.variant-top { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.variant-mode { font-size: var(--fs-3xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--violet-text); }
.variant-stage { font-size: var(--fs-3xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.variant-text { flex: 1; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-md); line-height: var(--lh-ui); }
.variant .flags { justify-content: flex-start; margin-top: 0; }
.variant .draft-attach { margin-top: 0; width: fit-content; }
.variant .draft-more { margin-top: 0; }
.variant-fixed { font-size: var(--fs-2xs); color: var(--text-3); }
.variant-actions { display: flex; justify-content: flex-end; }

/* ───────────── правая панель: карточка человека ───────────── */

.col-panel {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
.panel-mhead { display: none; }
.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.panel-top { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); }
.pt-who { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.pt-names { min-width: 0; }
.pt-name { font-weight: var(--fw-bold); font-size: var(--fs-h3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-sub { font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-stage { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.stage-mode { font-size: var(--fs-2xs); color: var(--text-3); }
.pt-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.add-tag {
  display: grid; place-items: center; flex: none;
  width: var(--h-xs); height: var(--h-xs); padding: 0;
  border: 1px dashed var(--line-2); border-radius: var(--r-xs);
  background: var(--surface); color: var(--text-2);
}
.add-tag:hover { border-style: solid; color: var(--text); background: var(--surface-3); }
.pt-hint { font-size: var(--fs-xs); color: var(--text-3); }
.pt-boxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.pt-box {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  min-width: 0; padding: var(--s-2) var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
}
.pt-box-main { min-width: 0; }
.pt-box-label { font-size: var(--fs-3xs); color: var(--text-3); }
.pt-box-value { font-size: var(--fs-sm); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-box-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); flex: none; }
.pt-box-ic.is-test { background: var(--amber-soft); color: var(--amber-text); }
.ptabs {
  position: sticky; top: 0; z-index: 3;
  display: flex; gap: var(--s-4);
  padding: 0 var(--s-4);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto; scrollbar-width: none;
}
.ptabs::-webkit-scrollbar { display: none; }
.ptab {
  position: relative; flex: none;
  height: var(--h-lg); padding: 0;
  border: 0; background: none;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-3);
}
.ptab:hover { color: var(--text); }
.ptab.is-active { color: var(--text); }
.ptab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--ink); }
.ptab-body { padding: var(--s-4) var(--s-4) var(--s-6); }

/* сводка */
.sum-lead { margin-bottom: var(--s-3); padding: var(--s-3); border-radius: var(--r-md); background: var(--violet-soft); font-size: var(--fs-md); line-height: var(--lh-ui); }
.sum-label { display: flex; align-items: center; gap: var(--s-1); margin-bottom: var(--s-1); font-size: var(--fs-3xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--violet-text); }
.fields { display: flex; flex-direction: column; }
.field {
  display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-md); line-height: var(--lh-ui);
}
.field:last-child { border-bottom: 0; }
.field-k { display: flex; align-items: flex-start; gap: var(--s-1); color: var(--text-3); font-size: var(--fs-sm); }
.field-v { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.field-v.is-empty { color: var(--text-3); }
.field.is-danger { margin: 6px 0; padding: var(--s-2) var(--s-3); border: 1px solid var(--red-line); border-radius: var(--r-md); background: var(--red-soft); }
.field.is-danger .field-k { color: var(--red-text); font-weight: var(--fw-bold); }
.field.is-next .field-v { color: var(--violet-text); font-weight: var(--fw-semibold); }
.vlist { margin: 0; padding-left: var(--s-4); white-space: normal; }
.vlist li + li { margin-top: 2px; }
.sec-title { margin: var(--s-5) 0 var(--s-2); font-size: var(--fs-3xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--text-3); }
.sent-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.sent-item { display: flex; align-items: center; gap: var(--s-2); min-width: 0; font-size: var(--fs-sm); color: var(--text-3); }
.sent-item.is-on { color: var(--text); }
.sent-ic { display: grid; place-items: center; flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); color: #fff; }
.sent-item.is-on .sent-ic { background: var(--green-fill); border-color: var(--green-fill); color: var(--on-green); }
.upd { display: flex; align-items: center; gap: var(--s-1); margin-top: var(--s-4); font-size: var(--fs-2xs); color: var(--text-3); }

/* хронология, как Timeline в Mochi */
.tl-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s-3); }
.pill {
  display: inline-flex; align-items: center; gap: var(--s-1);
  height: var(--h-sm); padding: 0 var(--s-3);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-2);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
}
.pill:hover { color: var(--text); }
.pill.is-active { border-color: var(--line-2); color: var(--text); box-shadow: var(--shadow-sm); }
.tl { display: flex; flex-direction: column; }
.tl-item { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--s-3); padding: var(--s-2) 0; }
.tl-item::before { content: ""; position: absolute; left: 13px; top: 40px; bottom: -4px; width: 2px; border-radius: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-xs); color: #fff; }
.tl-main { min-width: 0; padding-top: 1px; }
.tl-title { font-weight: var(--fw-semibold); font-size: var(--fs-md); line-height: var(--lh-tight); }
.tl-text {
  margin-top: 2px;
  font-size: var(--fs-sm); line-height: var(--lh-ui); color: var(--text-2);
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  cursor: pointer;
}
.tl-text.is-open { display: block; -webkit-line-clamp: unset; }
.tl-time { font-size: var(--fs-2xs); color: var(--text-3); white-space: nowrap; padding-top: 2px; }

/* передача */
.warn-box {
  display: flex; align-items: flex-start; gap: var(--s-2);
  padding: var(--s-3);
  border: 1px solid var(--amber-line); border-radius: var(--r-md);
  background: var(--amber-soft); color: var(--amber-text);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: var(--lh-ui);
}
.warn-box .ic { flex: none; margin-top: 1px; }
.ho-meta { display: flex; align-items: center; gap: var(--s-1); margin: var(--s-3) 0 0; font-size: var(--fs-xs); color: var(--text-3); }
.handoff-text {
  margin: var(--s-2) 0 var(--s-3); padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-3); color: var(--text);
  font-family: var(--mono); font-size: var(--fs-sm); line-height: var(--lh-text);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.ho-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ho-busy { padding: var(--s-2) 0; }
.ho-note { text-align: center; font-size: var(--fs-sm); color: var(--text-3); max-width: 280px; margin: 0 auto; }

/* профиль */
.kv-inline { display: inline-flex; align-items: center; gap: var(--s-1); }
.ext-link { display: inline-flex; align-items: center; gap: var(--s-1); color: var(--blue); font-weight: var(--fw-semibold); }
.ext-link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ───────────── анимация «пусто, нечего отправлять» ───────────── */

.shake { animation: shake .4s ease; }
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.only-sm { display: none !important; }

/* колонка чата подстраивается под свою ширину, а не под ширину окна */
@container chat (max-width: 640px) {
  .draft { width: 100%; }
  .draft-actions .btn-ghost .ic { display: none; }
  .draft-actions .btn-ghost { padding: 0 var(--s-2); }
  .chat-head .lbl-long { display: none; }
  .chat-head .lbl-short { display: inline; }
  .test-btn { width: var(--h-sm); padding: 0; }
  .composer-hint { display: none; }
  .chat-actions { gap: 6px; }
}
@container chat (max-width: 440px) {
  .send-btn .lbl-send { display: none; }
  .send-btn { width: var(--h-md); padding: 0; }
  .scale-select { max-width: 108px; }
}

/* ═════════════ адаптив ═════════════ */

/* до 1199: карточка человека выезжает справа поверх чата */
@media (max-width: 1199px) {
  .inbox, .inbox[data-has-peer="0"] { grid-template-columns: 320px minmax(0, 1fr); }
  .col-panel {
    position: absolute; top: 0; right: 0; bottom: 0; z-index: 20;
    width: min(380px, 100%);
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    transform: translateX(104%);
    visibility: hidden;
    transition: transform .22s ease, visibility .22s;
  }
  .inbox[data-info="1"] .col-panel { transform: none; visibility: visible; }
  .panel-backdrop {
    display: block;
    position: absolute; inset: 0; z-index: 15;
    background: var(--overlay);
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
  }
  .inbox[data-info="1"] .panel-backdrop { opacity: 1; pointer-events: auto; }
  .panel-mhead {
    flex: none;
    display: flex; align-items: center; gap: var(--s-2);
    height: 56px; padding: 0 var(--s-2);
    border-bottom: 1px solid var(--line);
  }
  .panel-mtitle { font-weight: var(--fw-bold); font-size: var(--fs-h3); }
  .msg { max-width: min(80%, 560px); }
}
/* список 320px: табы плотнее (шесть штук листаются вбок), левый край тот же, что у поиска */
@media (min-width: 768px) and (max-width: 1199px) {
  .col-list .tab { padding: 0 var(--s-2); gap: 2px; font-size: var(--fs-xs); }
  .col-list .tab-count { font-size: var(--fs-3xs); }
}
@media (min-width: 1200px) {
  .info-btn { display: none; }
}

/* телефон: список → чат → карточка отдельными экранами, снизу панель разделов */
@media (max-width: 767px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .gtabs { --gtabs-h: 41px; grid-row: 1; grid-column: 1; padding: 4px var(--s-3) 0; }
  .gtab { padding: 8px 10px 9px; }
  body.in-thread .gtabs { display: none; }       /* открытый диалог на телефоне занимает экран целиком, как и без колонки снизу */
  .main { grid-row: 2; grid-column: 1; }
  .rail {
    grid-row: 3; grid-column: 1;
    flex-direction: row; align-items: stretch;
    padding: var(--s-1) 6px calc(var(--s-1) + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .rail-logo, .rail-bottom { display: none; }
  /* инструкция и доступы на телефоне живут в меню «Ещё»: семь кнопок внизу и так на пределе */
  .rail-nav .rail-btn[data-key="help"], .rail-nav .rail-btn[data-key="admin"] { display: none; }
  .rail-nav .rail-more { display: flex; }
  .rail-nav .rail-more-d { display: none; }          /* 04.10: на телефоне разделы из «Ещё» в меню кнопки «Ещё» внизу */
  .rail-nav { flex-direction: row; justify-content: space-around; width: 100%; gap: 0; }
  .rail-btn {
    flex: 1; width: auto; height: auto;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 5px 0 3px;
    border: 0 !important; background: none !important; box-shadow: none !important;
  }
  .rail-btn.is-active { color: var(--text); }
  .rail-btn[data-tip]:hover::after { display: none; }
  .rail-label { display: block; font-size: 10.5px; font-weight: var(--fw-semibold); }
  /* семь разделов на 375 px: подписи в одну строку, лишнее уходит в многоточие */
  .rail-btn { flex: 1 1 auto; min-width: 0; }
  /* волна 10б (F2, вместе с пунктом «Теги» в меню «Ещё» в app.js): шесть равных ячеек по ~60 px, подписи целиком */
  .rail-btn { flex: 1 1 0; }
  .rail-nav .rail-btn[data-key="tags"] { display: none; }
  .rail-label { font-size: 9.5px; letter-spacing: var(--ls-tight); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .rail-badge { top: 0; right: calc(50% - 22px); }
  body.in-thread .rail { display: none; }

  .toasts { left: var(--s-3); right: var(--s-3); top: calc(var(--s-3) + env(safe-area-inset-top)); width: auto; transform: none; align-items: stretch; }
  .toast { max-width: none; }

  .modal-overlay { place-items: end center; padding: 0; }
  .modal {
    width: 100% !important; max-width: 100% !important;
    max-height: 92vh; max-height: 92dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
    transform: translateY(30px);
  }
  .modal-head { padding-left: var(--s-4); }
  .modal-body { padding-left: var(--s-4); padding-right: var(--s-4); }
  .modal-foot { padding-bottom: calc(var(--s-3) + env(safe-area-inset-bottom)); }
  .modal-image { border-radius: var(--r-lg) var(--r-lg) 0 0; }
  /* поля страницы на телефоне дают переменные --page-x и --page-y (16) */
  .card { padding: var(--s-4); }
  .page-head { flex-direction: column; align-items: stretch; gap: var(--s-3); margin-bottom: var(--s-4); }
  .page-head-main { flex: none; }
  .page-head-side { flex-wrap: wrap; }
  .set-row, .opt { padding: var(--s-3); gap: var(--s-3); }
  .save-bar { bottom: var(--s-2); padding: 6px 6px 6px var(--s-3); gap: var(--s-1); }
  .save-bar-text { font-size: var(--fs-sm); white-space: normal; line-height: var(--lh-tight); }

  .inbox, .inbox[data-has-peer="0"] { grid-template-columns: minmax(0, 1fr); }
  .col-list, .col-chat, .col-panel { display: none; }
  .inbox[data-screen="list"] .col-list { display: flex; border-right: 0; }
  .inbox[data-screen="chat"] .col-chat { display: flex; }
  .inbox[data-screen="panel"] .col-panel {
    display: flex; position: static;
    width: auto; transform: none; visibility: visible;
    box-shadow: none; border-left: 0;
  }
  .panel-backdrop { display: none !important; }

  .chat-head { height: 58px; padding: 0 var(--s-2) 0 var(--s-1); gap: var(--s-2); }
  .back-btn { display: inline-grid; }
  .chat-head .avatar { width: 34px !important; height: 34px !important; }
  .chat-actions { gap: 6px; }
  .chat-name { font-size: var(--fs-lg); }
  .msgs { padding: var(--s-3); }
  .msg { max-width: 86%; }
  .draft { width: 100%; }
  .draft-card { padding: var(--s-3); }
  .jumps { right: var(--s-3); }
  .needs-you { margin: 0 var(--s-2) var(--s-2); padding: var(--s-3); gap: var(--s-2); }
  .composer { padding: 0 var(--s-2) calc(var(--s-2) + env(safe-area-inset-bottom)); }
  .composer-hint { display: none; }
  .scale-select { max-width: 112px; }
  .variant-list { grid-template-columns: minmax(0, 1fr); }
  .variants { max-height: 42vh; }
  .hide-sm { display: none !important; }
  .only-sm { display: inline !important; }
  svg.only-sm { display: block !important; }
  .field { grid-template-columns: 104px minmax(0, 1fr); }
}
@media (max-width: 479px) {
  /* «не сохранено» на телефоне: текст своей строкой, под ним две кнопки поровну.
     В один ряд с двумя кнопками текст ломался в 3–4 строки по слову */
  .save-bar { flex-wrap: wrap; row-gap: var(--s-2); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3); }
  .save-bar-text { flex: 1 1 calc(100% - var(--s-4)); }
  .save-bar > .btn { flex: 1 1 0; justify-content: center; }
}
@media (max-width: 400px) {
  .fgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cpill { padding: 0 var(--s-2); gap: 6px; font-size: var(--fs-sm); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* плашка тестового портала (порт 8766): выдуманные данные, не путать с боевым */
.test-strip {
  position: fixed; bottom: 8px; left: 50%; transform: translateX(-50%); z-index: 90; pointer-events: auto;
  display: inline-flex; align-items: center; gap: var(--s-2); max-width: calc(100vw - 24px);
  padding: 0 var(--s-3); height: 26px; border-radius: var(--r-pill);
  background: var(--amber-soft); color: var(--amber-text); border: 1px solid var(--amber-text);
  font-size: var(--fs-xs); white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.test-strip a { color: inherit; font-weight: var(--fw-semibold); text-decoration: underline; }
@media (max-width: 479px) { .test-strip span { display: none; } }
@media (max-width: 767px) { .test-strip { bottom: 64px; } }
body:has(.test-strip)::after { content: ''; position: fixed; inset: 0; border: 2px solid var(--amber-text); pointer-events: none; z-index: 89; }

/* 02.10 (этап 1А): красная кнопка «Стоп отправкам» и кнопка «Баг» тестового портала. Над плашкой, не мешают контенту */
.stage-tools { position: fixed; right: 12px; bottom: 44px; z-index: 91; display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - 24px); }
/* 03.10: на компьютере кнопка внизу слева у меню, а не справа над полем ввода, где она закрывала «Отправить» */
@media (min-width: 768px) { .stage-tools { right: auto; left: 76px; bottom: 12px; justify-content: flex-start; } }
.stage-btn { height: 28px; padding: 0 var(--s-3); border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font-size: var(--fs-xs); font-weight: var(--fw-semibold); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.stage-btn:hover { background: var(--hover); color: var(--text); }
.stage-stop { border-color: var(--red-line); color: var(--red-text); background: var(--red-soft); }
.stage-stop.is-on { background: var(--red-fill); color: var(--on-red); border-color: var(--red-fill); }
@media (max-width: 767px) { .stage-tools { bottom: 100px; } }

/* 08.10: «Черновики в Телеграм» в меню профиля */
.tgc { display: flex; flex-direction: column; gap: 10px; }
.tgc-row { padding: 2px 0; }

/* 09.10: свой вид экранов (portal/js/layout.js): «Настроить», скрыть и вернуть блок и человека, порядок блоков */
.lay-blk { position: relative; outline: 1px dashed var(--line-2); outline-offset: 2px; }
.lay-tools { position: absolute; top: 6px; right: 6px; z-index: 5; display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-small);
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.lay-tools .lay-up .ic { transform: rotate(180deg); }
.lay-off { opacity: .45; }
.lay-hide { display: none !important; }
/* плитка-ссылка или плитка-кнопка в режиме настройки не уводит по клику, работают только кнопки настройки */
.lay-blk:is(a, button) { pointer-events: none; }
.lay-blk:is(a, button) > .lay-tools { pointer-events: auto; }
.lay-person-btn { margin-left: 4px; vertical-align: middle; }
.lay-panel { display: grid; gap: var(--s-2); margin-top: var(--s-4); padding: var(--s-3); border: 1px dashed var(--line-2); border-radius: var(--r-medium); font-size: var(--fs-sm); }
.lay-panel-head { display: flex; flex-wrap: wrap; gap: 4px var(--s-3); align-items: baseline; }
.lay-panel-hint { color: var(--text-2); font-size: var(--fs-xs); }
.lay-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lay-row-k { color: var(--text-2); }
.lay-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 10px; border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-xs); cursor: pointer; }
.lay-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lay-hint { display: flex; align-items: center; gap: 6px; border-style: dotted; color: var(--text-2); font-size: var(--fs-xs); padding: 6px var(--s-3); }
.crm-strip > .lay-panel, .crm-rks > .lay-panel { flex: 1 1 100%; grid-column: 1 / -1; }
/* 09.10: диалог, где ИИ запрещён (личная переписка): полосы подсказок ИИ нет */
.ai-chips.is-ai-block { display: none !important; }

/* ПВ: правила портала ведения поверх снимка CRM от 15.10 (старые правила сетки .app/.main убраны: сетка теперь из CRM) */
   РИТМ (волна 5). Разделы берут размеры только из переменных ниже, свои числа не заводят.
   - Отступы и зазоры между блоками: 4 8 12 16 20 24 32 (--s-1 … --s-8). Внутри контрола между
     иконкой и текстом можно 2 и 6.
   - Высоты: метка 18, чип в строке списка 22, чип 24, маленькая кнопка / таб / таблетка 30,
     кнопка / поле / поиск / выпадающий список 36, кнопка левой колонки 40. Что стоит в одном ряду,
     одной высоты.
   - Радиусы: метка 6, чип и кнопка xs 8, кнопка и поле в одну строку 10, плашка, строка-карточка
     и многострочное поле 12, карточка раздела 14, модалка и пузырь 18, таблетка 999.
   - Кегль: 11 капс и метки, 11.5 время и счётчики, 12 чипы, 12.5 вторичный текст и подсказки,
     13.5 интерфейс, 14 сообщения и текст для чтения, 15 заголовок карточки, 17 заголовок блока,
     22 заголовок страницы (20 на телефоне). 13 и 14.5 не используем.
  /* отступы */
  /* кегль и межстрочный */
  --fs-3xs: 11px; --fs-2xs: 11.5px; --fs-xs: 12px; --fs-sm: 12.5px; --fs-md: 13.5px; --fs-lg: 14px;
  --fs-h3: 15px; --fs-h2: 17px; --fs-h1: 22px; --fs-num: 26px;
  --text-3: #8b8b96;
  --ok-bg: #15803d;
  --ok-ink: #ffffff;
  --chip-bg: #eeeef1;
  --skeleton: #ececef;
  --skeleton-hi: #f7f7f9;
  --r-2xs: 6px;
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 12px;
  --r: 14px;
  --r-lg: 18px;
    --hover: #25252b;
    --text-3: #777782;
    --ok-bg: #22c55e;
    --ok-ink: #0b1a10;
    --skeleton: #212126;
  --hover: #25252b;
  --text-3: #777782;
  --ok-bg: #22c55e;
  --ok-ink: #0b1a10;
  --skeleton: #212126;
  :root { --page-x: 16px; --page-y: 16px; --fs-h1: 20px; --fs-h2: 16px; --fs-num: 22px; }
  font-weight: 800; font-size: var(--fs-sm); letter-spacing: -.02em;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
  font-size: var(--fs-xs); font-weight: 700;
  font-size: 9.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  font-size: var(--fs-md); font-weight: 600; white-space: nowrap;
.btn-danger { --spin: #fff; background: var(--red); color: #fff; }
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 500; line-height: 1; white-space: nowrap;
.chip-lg { height: var(--h-sm); padding: 0 var(--s-3) 0 var(--s-2); font-size: var(--fs-md); font-weight: 600; border-radius: var(--r-sm); box-shadow: var(--shadow-sm); }
.chip-soft { background: var(--violet-soft); border-color: transparent; color: var(--violet-text); padding-left: var(--s-2); font-weight: 600; }
  font-size: var(--fs-3xs); font-weight: 700; line-height: 1; white-space: nowrap;
.mini-badge.ai { color: var(--violet-text); background: var(--violet-soft); }
.mini-badge.fast, .mini-badge.blue { color: var(--blue-text); background: var(--blue-soft); }
.mini-badge.ok { color: var(--green-text); background: var(--green-soft); }
.mini-badge.warn { color: var(--amber-text); background: var(--amber-soft); }
.mini-badge.danger { color: var(--red-text); background: var(--red-soft); }
  font-size: var(--fs-2xs); font-weight: 700; line-height: 1; white-space: nowrap;
.badge-you { background: var(--red); color: #fff; }
  font-size: var(--fs-2xs); font-weight: 700; line-height: var(--h-mini); text-align: center;
.count.is-hot { background: var(--red); color: #fff; }
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-2);
.empty-title { font-weight: 700; font-size: var(--fs-h3); line-height: var(--lh-tight); color: var(--text); }
.empty-box-title { font-size: var(--fs-md); font-weight: 600; color: var(--text-2); }
.error-title { font-weight: 700; }
  font-size: var(--fs-md); font-weight: 500; line-height: var(--lh-ui);
.toast-ok .toast-ic { color: #4ade80; }
.toast-ai .toast-ic { color: #b9a1fb; }
.toast-error { background: var(--red); color: #fff; }
.toast-action { flex: none; height: var(--h-xs); border: 0; background: rgba(255, 255, 255, .16); color: inherit; font-size: var(--fs-sm); font-weight: 700; padding: 0 var(--s-2); border-radius: var(--r-xs); }
  width: min(480px, 100%);
.modal-title { font-weight: 700; font-size: var(--fs-h3); line-height: var(--lh-tight); }
.modal-sm { width: min(400px, 100%); }
.lightbox-link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.fsec-title { font-size: var(--fs-sm); font-weight: 700; margin-bottom: var(--s-2); color: var(--text); }
  font-size: var(--fs-md); font-weight: 500;
  text-align: left; font-size: var(--fs-md); font-weight: 500; line-height: var(--lh-tight);
.menu-hint { font-size: var(--fs-2xs); font-weight: 400; color: var(--text-3); }
.menu-head { padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--fs-3xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
  height: var(--h-md); min-width: 0; flex: 1;
.field-label { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-sm); font-weight: 650; color: var(--text); }
.field-err { margin: 0; font-size: var(--fs-xs); font-weight: 600; line-height: var(--lh-ui); color: var(--red-text); }
.page-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3); margin: 0; font-size: var(--fs-h1); font-weight: 700; line-height: 1.25; letter-spacing: -.015em; }
  font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0; white-space: nowrap;
.card-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); margin: 0; font-size: var(--fs-h3); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -.005em; }
.block-title { margin: 0; font-size: var(--fs-h2); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -.01em; }
.label-caps { font-size: var(--fs-3xs); font-weight: 700; line-height: var(--lh-tight); letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.set-row-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-md); font-weight: 650; line-height: var(--lh-tight); color: var(--text); }
.opt-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-md); font-weight: 650; line-height: var(--lh-tight); color: var(--text); }
.note-text b, .note-text strong { color: var(--text); font-weight: 650; }
  font-size: var(--fs-md); font-weight: 600;
  font-size: var(--fs-md); font-weight: 650; color: var(--text);
  font-size: var(--fs-3xs); font-weight: 700; letter-spacing: .03em;
.soon-title { font-size: var(--fs-h1); margin: 0 0 6px; letter-spacing: -.01em; }
  font-size: var(--fs-3xs); font-weight: 700; line-height: var(--h-mini); text-align: center;
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
.tab-count { font-size: var(--fs-2xs); font-weight: 600; opacity: .5; font-variant-numeric: tabular-nums; }
  font-size: var(--fs-xs); font-weight: 500;
  font-size: var(--fs-xs); font-weight: 500; line-height: var(--lh-ui);
.row-name { font-weight: 600; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
  border-radius: var(--r-pill); background: var(--blue); color: #fff;
  font-size: var(--fs-3xs); font-weight: 700; line-height: var(--h-mini); text-align: center;
.row.is-waiting .row-preview { color: var(--text); font-weight: 600; }
.row-you { color: var(--text-3); font-weight: 500; }
  font-weight: 650; line-height: 1;
.chat-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 650; font-size: var(--fs-h3); line-height: var(--lh-tight); }
  border-radius: 4px; background: #0077ff; color: #fff;
  font-size: 8.5px; font-weight: 800; letter-spacing: .02em; line-height: 1;
  font-size: var(--fs-xs); font-weight: 500;
  font-weight: 700; font-size: var(--fs-lg);
  font-size: var(--fs-2xs); font-weight: 600; color: var(--text-3);
.fresh-sep { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-4) 0 var(--s-2); color: var(--violet-text); font-size: var(--fs-xs); font-weight: 700; }
.more-btn { display: block; border: 0; background: none; padding: 6px 0 0; color: inherit; font-size: var(--fs-sm); font-weight: 700; opacity: .85; text-decoration: underline; text-underline-offset: 2px; }
.voice-label { display: inline-flex; align-items: center; gap: var(--s-1); font-weight: 650; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.att { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-md); font-weight: 600; opacity: .9; }
  font-size: var(--fs-sm); font-weight: 600;
.draft.flash .draft-card { animation: flash 1.8s ease; }
  0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, .5); }
  100% { box-shadow: 0 0 0 16px rgba(124, 58, 237, 0); }
.draft-kind { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--violet-text); font-weight: 700; font-size: var(--fs-sm); }
.draft-label { font-size: var(--fs-3xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); margin-bottom: var(--s-1); }
  font-size: var(--fs-xs); font-weight: 600;
  font-size: var(--fs-xs); font-weight: 600; line-height: var(--lh-tight);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 600;
  font-size: var(--fs-md); font-weight: 600;
  color: var(--violet-text); font-size: var(--fs-sm); font-weight: 600;
.needs-title { font-weight: 700; color: var(--red-text); }
  font-size: var(--fs-sm); font-weight: 600;
  font-size: var(--fs-sm); font-weight: 600; color: inherit;
.variants-head { display: flex; align-items: center; gap: var(--s-2); min-width: 0; margin-bottom: var(--s-2); color: var(--violet-text); font-size: var(--fs-sm); font-weight: 700; }
.variants-q { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-weight: 500; }
.variant-mode { font-size: var(--fs-3xs); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--violet-text); }
.pt-name { font-weight: 700; font-size: var(--fs-h3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-box-value { font-size: var(--fs-sm); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-3);
.sum-label { display: flex; align-items: center; gap: var(--s-1); margin-bottom: var(--s-1); font-size: var(--fs-3xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--violet-text); }
.field.is-danger .field-k { color: var(--red-text); font-weight: 700; }
.field.is-next .field-v { color: var(--violet-text); font-weight: 600; }
.sec-title { margin: var(--s-5) 0 var(--s-2); font-size: var(--fs-3xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.sent-item.is-on { color: var(--text); font-weight: 600; }
.sent-item.is-on .sent-ic { background: var(--green); border-color: var(--green); }
  font-size: var(--fs-sm); font-weight: 600;
.tl-title { font-weight: 650; font-size: var(--fs-md); line-height: var(--lh-tight); }
  font-size: var(--fs-sm); font-weight: 600; line-height: var(--lh-ui);
.ext-link { display: inline-flex; align-items: center; gap: var(--s-1); color: var(--blue); font-weight: 600; }
  .panel-mtitle { font-weight: 700; font-size: var(--fs-h3); }
  .rail-label { display: block; font-size: 10.5px; font-weight: 600; }
  /* ПВ 12.10: «Табло» и «ОКК» владельца на телефоне в меню «Ещё», внизу остаётся не больше семи кнопок */
  .rail-label { font-size: 9.5px; letter-spacing: -.01em; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.test-strip a { color: inherit; font-weight: 600; text-decoration: underline; }
.stage-btn { height: 28px; padding: 0 var(--s-3); border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.stage-stop.is-on { background: var(--red); color: #fff; border-color: var(--red); }

