/* Ночная тема платформы (v1.10.0) — общая таблица цветов. Подключается общим тегом `<head>` каждой страницы
   (`branding.head_tags` → `theme.theme_head_tags`), раньше стилей самой страницы.

   Три слоя переменных:

   1. `--theme-*` — живые токены: светлые значения на `:root`, тёмные — на `html[data-theme="dark"]`. Для нового кода
      и общей шапки: `background: var(--theme-surface); color: var(--theme-text)` — без запасного значения.
   2. `--night-*` — есть только ночью. Старые правила страниц завёрнуты в них скриптом `scripts/theme_colors.py`:
      `background: var(--night-surface, #fff)` — днём переменной нет, и действует свой литерал (светлая тема та же,
      что до v1.10.0), ночью — токен.
   3. `--day-*` — есть только днём. Для страниц, тёмных от рождения (Корпоративный AI): `var(--day-surface, #131722)`
      — днём страница светлая, ночью — свои прежние тёмные цвета.

   Палитра ночи: фон #0f141b, панели #161c25 → #1c2430 → #263142, линии #2c3747/#415064, текст #e4eaf2/#c3cdd9,
   приглушённый #9ba8b9, бледный #8794a6. Цветные семьи (danger, warn, success, info, violet, pink): текст
   `<семья>`, подложки `-soft` (бледная) и `-soft-2` (насыщеннее), рамка `-line`, сплошной `-solid` (значки и полосы
   с белым текстом). Контраст проверен на всех страницах стенда: текст к фону не ниже 3:1, сплошной цвет на своей
   подложке — не ниже 3.5:1.

   Акцент — два токена на две работы (v1.10.0, пятый круг, находки G1-6, G1-5): `--theme-accent` — заливка (кнопка,
   выбранная плашка, отметка) с белым текстом `--theme-on-accent`; `--theme-link` — текст ссылки и всего, на что можно
   нажать. Днём заливка тёмно-синяя, а ссылка синяя; ночью заливка #3d6aa8 (белый текст 5.5:1, край к карточке 3.1:1),
   а ссылка #8ab4f8 (8:1 к карточке). Прежний ночной #4a7cc0 служил обоим и не дотягивал до 4.5:1 ни текстом (4.02:1),
   ни под белой надписью (4.25:1). `--theme-accent-text` — тёмно-синий текст заголовков и подписей, на который нажать
   нельзя (днём #19324d): ночью он бледно-голубой, а не ссылочный, — иначе даты и заголовки выглядят ссылками.
   `--theme-focus` — кольцо фокуса с клавиатуры, `--theme-input-line` — рамка поля ввода (ночью не ниже 3:1 к
   карточке: прежняя #415064 давала 2:1, и пустое поле «Пароль» на входе пропадало). `--theme-danger-fill` — заливка
   опасной кнопки под белой надписью: ночной `--theme-danger-solid` #e05a55 (значки и полосы) давал белому тексту
   3.6:1, заливка #c4433b — 5:1, под мышью темнее (#b0362f, 5.9:1), а не светлее. */

:root {
  --theme-bg: #f4f7fb;
  --theme-surface: #ffffff;
  --theme-surface-2: #f6f8fb;
  --theme-surface-3: #e9eef5;
  --theme-line: #d6deea;
  --theme-line-strong: #b4c2d6;
  --theme-text: #18212f;
  --theme-text-2: #334155;
  --theme-muted: #64748b;
  --theme-faint: #94a3b8;
  --theme-strong: #19324d;
  --theme-accent: #19324d;
  --theme-accent-hover: #0f243a;
  --theme-accent-text: #19324d;
  --theme-on-accent: #ffffff;
  --theme-link: #2358c9;
  --theme-focus: #2358c9;
  --theme-hover: rgba(15, 23, 42, 0.04);
  --theme-none: transparent;
  --theme-th-bg: #f6f8fb;
  --theme-sticky-bg: #ffffff;
  --theme-input-bg: #ffffff;
  --theme-input-line: #c7d3e3;
  --theme-shadow: 0 12px 32px rgba(14, 24, 38, 0.16);
  --theme-shadow-soft: rgba(15, 23, 42, 0.14);
  --theme-danger: #b42318; --theme-danger-soft: #fdecec; --theme-danger-soft-2: #f9d5d2; --theme-danger-line: #f3c0bc; --theme-danger-solid: #b42318;
  --theme-danger-fill: #b42318; --theme-danger-fill-hover: #9a1e14;
  --theme-warn: #8a5a00; --theme-warn-soft: #fff5d6; --theme-warn-soft-2: #fbe6a8; --theme-warn-line: #f0d48a; --theme-warn-solid: #b26a00;
  --theme-success: #0f7a4d; --theme-success-soft: #e8f7ef; --theme-success-soft-2: #c9ead8; --theme-success-line: #b7e2cb; --theme-success-solid: #2a7f62;
  --theme-info: #2358c9; --theme-info-soft: #e8f0ff; --theme-info-soft-2: #d2e1ff; --theme-info-line: #bcd0f5; --theme-info-solid: #2358c9;
  --theme-violet: #6d28d9; --theme-violet-soft: #f1ebff; --theme-violet-soft-2: #e2d5fa; --theme-violet-line: #d6c6f5; --theme-violet-solid: #6d28d9;
  --theme-pink: #be185d; --theme-pink-soft: #fdecf3; --theme-pink-soft-2: #f8d3e3; --theme-pink-line: #f0bcd2; --theme-pink-solid: #be185d;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --theme-bg: #0f141b;
  --theme-surface: #161c25;
  --theme-surface-2: #1c2430;
  --theme-surface-3: #263142;
  --theme-line: #2c3747;
  --theme-line-strong: #415064;
  --theme-text: #e4eaf2;
  --theme-text-2: #c3cdd9;
  --theme-muted: #9ba8b9;
  --theme-faint: #8794a6;
  --theme-strong: #2e4d75;
  --theme-accent: #3d6aa8;
  --theme-accent-hover: #4874b2;
  --theme-accent-text: #b4c8e6;
  --theme-on-accent: #ffffff;
  --theme-link: #8ab4f8;
  --theme-focus: #8ab4f8;
  --theme-hover: rgba(255, 255, 255, 0.06);
  --theme-none: transparent;
  --theme-th-bg: #1c2430;
  --theme-sticky-bg: #161c25;
  --theme-input-bg: #11171f;
  --theme-input-line: #5a6b82;
  --theme-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --theme-shadow-soft: rgba(0, 0, 0, 0.45);
  --theme-danger: #ff8e86; --theme-danger-soft: #33171a; --theme-danger-soft-2: #5a2427; --theme-danger-line: #6b2c2e; --theme-danger-solid: #e05a55;
  --theme-danger-fill: #c4433b; --theme-danger-fill-hover: #b0362f;
  --theme-warn: #f0b955; --theme-warn-soft: #2b220c; --theme-warn-soft-2: #4d3b12; --theme-warn-line: #6b5216; --theme-warn-solid: #b57d12;
  --theme-success: #5fd39b; --theme-success-soft: #10281a; --theme-success-soft-2: #1c4a30; --theme-success-line: #22573a; --theme-success-solid: #33a06f;
  --theme-info: #8ab4f8; --theme-info-soft: #14253d; --theme-info-soft-2: #20406b; --theme-info-line: #2d4d7a; --theme-info-solid: #4a7cc0;
  --theme-violet: #c5a8ff; --theme-violet-soft: #2a2045; --theme-violet-soft-2: #3b2d63; --theme-violet-line: #4b3a7a; --theme-violet-solid: #8a6be0;
  --theme-pink: #f59ac0; --theme-pink-soft: #3d1a2b; --theme-pink-soft-2: #5c2741; --theme-pink-line: #6e3050; --theme-pink-solid: #c75a8a;

  /* Ночные пары старых правил (`scripts/theme_colors.py`): есть только здесь. */
  --night-bg: var(--theme-bg);
  --night-surface: var(--theme-surface);
  --night-surface-2: var(--theme-surface-2);
  --night-surface-3: var(--theme-surface-3);
  --night-line: var(--theme-line);
  --night-line-strong: var(--theme-line-strong);
  --night-text: var(--theme-text);
  --night-text-2: var(--theme-text-2);
  --night-muted: var(--theme-muted);
  --night-faint: var(--theme-faint);
  --night-strong: var(--theme-strong);
  --night-accent: var(--theme-accent);
  --night-accent-hover: var(--theme-accent-hover);
  --night-accent-text: var(--theme-accent-text);
  --night-link: var(--theme-link);
  --night-hover: var(--theme-hover);
  --night-none: var(--theme-none);
  --night-danger: var(--theme-danger); --night-danger-soft: var(--theme-danger-soft); --night-danger-soft-2: var(--theme-danger-soft-2); --night-danger-line: var(--theme-danger-line); --night-danger-solid: var(--theme-danger-solid);
  --night-warn: var(--theme-warn); --night-warn-soft: var(--theme-warn-soft); --night-warn-soft-2: var(--theme-warn-soft-2); --night-warn-line: var(--theme-warn-line); --night-warn-solid: var(--theme-warn-solid);
  --night-success: var(--theme-success); --night-success-soft: var(--theme-success-soft); --night-success-soft-2: var(--theme-success-soft-2); --night-success-line: var(--theme-success-line); --night-success-solid: var(--theme-success-solid);
  --night-info: var(--theme-info); --night-info-soft: var(--theme-info-soft); --night-info-soft-2: var(--theme-info-soft-2); --night-info-line: var(--theme-info-line); --night-info-solid: var(--theme-info-solid);
  --night-violet: var(--theme-violet); --night-violet-soft: var(--theme-violet-soft); --night-violet-soft-2: var(--theme-violet-soft-2); --night-violet-line: var(--theme-violet-line); --night-violet-solid: var(--theme-violet-solid);
  --night-pink: var(--theme-pink); --night-pink-soft: var(--theme-pink-soft); --night-pink-soft-2: var(--theme-pink-soft-2); --night-pink-line: var(--theme-pink-line); --night-pink-solid: var(--theme-pink-solid);
}

/* Дневные пары страниц, тёмных от рождения (Корпоративный AI): есть только днём. */
html:not([data-theme="dark"]) {
  --day-bg: var(--theme-bg);
  --day-surface: var(--theme-surface);
  --day-surface-2: var(--theme-surface-3);
  --day-surface-3: var(--theme-line);
  --day-line: var(--theme-line);
  --day-line-strong: var(--theme-line-strong);
  --day-text: var(--theme-text);
  --day-text-2: var(--theme-text-2);
  --day-muted: var(--theme-muted);
  --day-faint: var(--theme-faint);
  --day-link: var(--theme-link);
  --day-hover: rgba(15, 23, 42, 0.06);
  --day-shadow-soft: var(--theme-shadow-soft);
  --day-danger: var(--theme-danger); --day-danger-soft: var(--theme-danger-soft); --day-danger-line: var(--theme-danger-line);
  --day-warn: var(--theme-warn); --day-warn-soft: var(--theme-warn-soft); --day-warn-line: var(--theme-warn-line);
  --day-success: var(--theme-success); --day-success-soft: var(--theme-success-soft); --day-success-line: var(--theme-success-line);
  --day-info: var(--theme-info); --day-info-soft: var(--theme-info-soft); --day-info-line: var(--theme-info-line);
  --day-violet: var(--theme-violet); --day-violet-soft: var(--theme-violet-soft); --day-violet-line: var(--theme-violet-line);
  --day-pink: var(--theme-pink); --day-pink-soft: var(--theme-pink-soft); --day-pink-line: var(--theme-pink-line);
}

/* Ночью: картинки товаров и логотипы — как есть. Поля ввода без своего фона — фон полей темы, а не серый
   системный (`color-scheme: dark` у Chrome красит `<select>` и `<textarea>` в #3b3b3b). Нулевой вес (`:where`):
   поле со своим цветом в стилях страницы остаётся своим. */
html[data-theme="dark"] ::placeholder { color: var(--theme-faint); opacity: 1; }
:where(html[data-theme="dark"]) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="image"]), select, textarea) {
  background-color: var(--theme-input-bg); color: var(--theme-text); border-color: var(--theme-input-line);
}
/* Окна (`<dialog>`) без своего фона: у браузера ночью — почти чёрный фон и белая рамка; линия `<hr>` — белая. */
:where(html[data-theme="dark"]) :where(dialog) {
  background-color: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-line);
}
:where(html[data-theme="dark"]) :where(hr) { border-color: var(--theme-line); }
/* Кнопки без своего фона (системные): у Safari ночью — светло-серые с белой подписью. */
:where(html[data-theme="dark"]) :where(button, input[type="submit"], input[type="button"], input[type="reset"]) {
  background-color: var(--theme-surface-3); color: var(--theme-text); border-color: var(--theme-line-strong);
}

/* ---------------------------------------------------------------------------------------------------------------
   Общие элементы платформы (v1.10.0, пятый круг проверки 24.10.2026, находки G1-1…G1-4, G6-15, G6-26, G7-7).

   Перфекционист нашёл главную кнопку нарисованной тремя способами («Войти» — тёмно-синяя, жирность 800, 41 px;
   «Добавить событие» и «Сохранить профиль» — почти чёрные, обычным шрифтом, 34 px; «Прочитать все» — ярко-синяя,
   13 px, 29 px), вторичную — серой заливкой, как выключенную, у каждого модуля свою шапку и свою ссылку «назад».
   Здесь — один образец на всю платформу. Имена зафиксированы: модули переходят на них в своих правках.

   Вес правил. Файл стоит в `<head>` раньше стилей страницы. Размеры кнопок, шапки страницы и ссылок — невесомые
   (`:where`): страница со своим `button { font-size: 13px }` остаётся своей (иначе у неё одни кнопки стали бы 15 px,
   а соседние — 13). Цвета кнопок — весом класса: `.btn-primary` перебивает `button { background: … }` страницы, ради
   этого класс и ставят. */

/* Кольцо фокуса с клавиатуры — одно на всё, что нажимается или принимает ввод: цвет фокуса, толщина 2,5 px, отступ
   2 px. Не 2 px: на компьютере страница уменьшена до 90 % (`branding.ui_scale_style`), а браузер рисует рамку целыми
   точками экрана — 2 px × 0,9 = 1,8 округлялось до одной точки (у шапки перфекционист намерил 1,1 px), 2,5 × 0,9 —
   две. У поля ввода отступ 1 px: кольцо прилегает к рамке. Мышью кольца нет. */
:where(button, [role="button"], input[type="submit"], input[type="button"], input[type="reset"], summary,
  .btn-primary, .btn-secondary, .btn-danger, .secondary-btn, .back-link):focus-visible {
  outline: 2.5px solid var(--theme-focus); outline-offset: 2px;
}
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="image"]), select, textarea):focus-visible {
  outline: 2.5px solid var(--theme-focus); outline-offset: 1px;
}
:where(input[type="checkbox"], input[type="radio"]):focus-visible { outline: 2.5px solid var(--theme-focus); outline-offset: 2px; }
/* Флажки и переключатели — цветом платформы, а не браузерным ярко-голубым (#0075ff). */
:where(input[type="checkbox"], input[type="radio"], input[type="range"], progress) { accent-color: var(--theme-accent); }

/* Кнопки. Главная — заливка акцентом и белый текст, вторичная — поверхность с рамкой и текстом темы (без серой
   заливки: серая — только у выключенной), опасная — красная заливка с белым текстом. Шрифт 15 px, жирность 600,
   скругление 8, высота 36 px, на телефоне 44 px. Под мышью главная темнеет (ночью светлеет), вторичная берёт подложку
   наведения, опасная темнеет в обеих темах; нажатие — сдвиг на пиксель вниз. Выключенная — серая без сдвига; кнопка с
   крутилкой «отправляется» (`.is-submitting`) остаётся своего цвета: на сером белой крутилки не видно.

   Наведение — весом одного класса (`:where(.btn-…):hover`, 0,1,0) и без цвета текста. У модулей бывает свой вид того
   же класса: в фотосессии `.btn-danger` — белая кнопка с красной надписью. Правило наведения весом 0,2,0 с белым
   текстом перебивало его, и надпись «Удалить» под мышью пропадала (белое на белом). Теперь свой класс страницы стоит
   позже и весит столько же — под мышью остаётся её вид. Цвет текста держит основное правило класса; у ссылки-кнопки
   (`<a class="btn-…">`) обычное `a:hover` страницы (0,1,1) перекрасило бы надпись в цвет ссылки и подчеркнуло —
   для `<a>` цвет под мышью закреплён отдельно. */
:where(.btn-primary, .btn-secondary, .btn-danger) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box;
  min-height: 36px; padding: 7px 14px; border: 1px solid transparent; border-radius: 8px;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none;
  white-space: nowrap; cursor: pointer;
}
.btn-primary { background: var(--theme-accent); border-color: var(--theme-accent); color: var(--theme-on-accent); }
:where(.btn-primary):hover { background: var(--theme-accent-hover); border-color: var(--theme-accent-hover); }
.btn-secondary { background: var(--theme-surface); border-color: var(--theme-input-line); color: var(--theme-text); }
:where(.btn-secondary):hover { background: var(--theme-surface-2); border-color: var(--theme-line-strong); }
.btn-danger { background: var(--theme-danger-fill); border-color: var(--theme-danger-fill); color: #ffffff; }
:where(.btn-danger):hover { background: var(--theme-danger-fill-hover); border-color: var(--theme-danger-fill-hover); }
a.btn-primary:hover { color: var(--theme-on-accent); text-decoration: none; }
a.btn-secondary:hover { color: var(--theme-text); text-decoration: none; }
a.btn-danger:hover { color: #ffffff; text-decoration: none; }
:where(.btn-primary, .btn-secondary, .btn-danger):active:not(:disabled) { transform: translateY(1px); }
:is(.btn-primary, .btn-secondary, .btn-danger):is(:disabled, [aria-disabled="true"]):not(.is-submitting) {
  background: var(--theme-surface-3); border-color: var(--theme-line); color: var(--theme-muted); filter: none; cursor: not-allowed;
}
@media (max-width: 899px), (pointer: coarse) and (max-height: 500px) {
  :where(.btn-primary, .btn-secondary, .btn-danger) { min-height: 44px; }
}

/* Выпадающий список — как поле ввода (3-mobile#1, G1-3): своя стрелка вместо системного вида. На телефоне системный
   список рисовался серой плашкой рядом с белыми полями. Фон, рамка и скругление — невесомые (у страницы свои), а
   стрелка, отключённый системный вид и место под стрелку — весом выше обычного правила страницы: иначе её
   `background: #fff` стёр бы стрелку, и список остался бы без стрелки вовсе. Списки на несколько строк (`multiple`,
   `size`) не трогаются. */
:where(select) {
  background-color: var(--theme-input-bg); color: var(--theme-text);
  border: 1px solid var(--theme-input-line); border-radius: 8px;
}
select:not([multiple]):not([size]) {
  -webkit-appearance: none; appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%2336506f' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right 10px center !important; background-size: 12px 8px !important;
}
html[data-theme="dark"] select:not([multiple]):not([size]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%23c3cdd9' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}
select:not([multiple]):not([size]):disabled { opacity: 0.6; }
/* Без системного вида Safari на iPhone снимает и свою высоту списка (47 px): список становится по своему тексту и
   отступам — 37–40 px, ниже пальца (ревью пятого круга). На телефоне и сенсорном экране — не ниже 44 px, как кнопки и
   поля входа. Невесомо: страница со своей высотой списка (`min-height`) остаётся своей. */
@media (max-width: 899px), (pointer: coarse) and (max-height: 500px) {
  :where(select:not([multiple]):not([size])) { min-height: 44px; }
}

/* Шапка страницы модуля (G6-15): заголовок 24 px, подзаголовок 14 px приглушённым, действие справа; под ней —
   вкладки раздела 15 px с одним отступом, у активной — черта акцентом. Левый край контента — по названию платформы в
   общей шапке: тот же отступ `--page-gutter`, что у строки шапки (`platform_nav.css`, 20 px; на телефоне 14 и 12).

     <div class="page-head"><div><h1>Пароли</h1><p class="page-head-sub">…</p></div>
       <div class="page-head-actions"><button class="btn-primary">+ Запись</button></div></div>
     <nav class="page-tabs"><a href="…" class="is-active" aria-current="page">Все</a><a href="…">Личное</a></nav> */
:root { --page-gutter: 20px; }
@media (max-width: 899px), (pointer: coarse) and (max-height: 500px) { :root { --page-gutter: 14px; } }
@media (max-width: 720px) { :root { --page-gutter: 12px; } }
:where(.page-head) { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin: 0 0 16px; }
:where(.page-head) :where(h1) { margin: 0; color: var(--theme-text); font-size: 24px; font-weight: 700; line-height: 1.25; }
:where(.page-head-sub) { margin: 4px 0 0; color: var(--theme-muted); font-size: 14px; line-height: 1.4; }
:where(.page-head-actions) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
:where(.page-tabs) { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; padding: 0; border-bottom: 1px solid var(--theme-line); }
:where(.page-tabs) > :where(a, button) {
  display: inline-flex; align-items: center; min-height: 36px; margin: 0 0 -1px; padding: 8px 12px;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none;
  color: var(--theme-muted); font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
}
:where(.page-tabs) > :where(a, button):hover { color: var(--theme-text); text-decoration: none; }
:where(.page-tabs) > :where(.is-active, [aria-current="page"], [aria-selected="true"]) { border-bottom-color: var(--theme-accent); color: var(--theme-text); }
@media (max-width: 899px), (pointer: coarse) and (max-height: 500px) {
  :where(.page-head) :where(h1) { font-size: 22px; }
  :where(.page-tabs) { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  :where(.page-tabs) > :where(a, button) { flex: 0 0 auto; min-height: 44px; white-space: nowrap; }
}

/* Ссылка «назад» (G6-26): «← Название», 14 px, цветом ссылки. Ссылка в тексте (`.text-link`) — цветом ссылки без
   подчёркивания, подчёркивание — под мышью. */
:where(.back-link) { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; color: var(--theme-link); font-size: 14px; font-weight: 600; text-decoration: none; }
:where(.back-link):hover { color: var(--theme-link); text-decoration: underline; }
:where(.text-link) { color: var(--theme-link); text-decoration: none; }
:where(.text-link):hover { color: var(--theme-link); text-decoration: underline; }
/* На телефоне ссылка «назад» — под палец, как вкладки и кнопки (ревью: «← На главную» в «Новостях» была 32 px). */
@media (max-width: 899px), (pointer: coarse) and (max-height: 500px) {
  :where(.back-link) { min-height: 44px; }
}

/* Кнопка темы в месте общей шапки `#themeToggleSlot` (`static/theme.js`): круг, размеры и цвета — у шапки
   (`platform_nav.css`, `.header .header-theme-slot > button`); здесь — только значок. */
.theme-toggle { cursor: pointer; }
.theme-toggle svg { display: block; width: 20px; height: 20px; }

/* Цвета общей шапки (`platform_nav.css`, переменные `--hdr-*` на `:root`) — ночью свои; правила шапки не меняются. */
html[data-theme="dark"] {
  --hdr-ink: var(--theme-text);
  --hdr-muted: var(--theme-muted);
  --hdr-line: var(--theme-line);
  --hdr-line-strong: var(--theme-line-strong);
  --hdr-surface: var(--theme-surface);
  --hdr-hover: var(--theme-surface-3);
  --hdr-bar-bg: var(--theme-surface);
  --hdr-pill-bg: var(--theme-surface);
  --hdr-link: var(--theme-link);
  --hdr-focus: var(--theme-link);
  --hdr-btn-bg: var(--theme-strong);
  --hdr-btn-ink: #ffffff;
  --hdr-btn-secondary-bg: #4b5a6e;
  --hdr-current-bg: var(--theme-accent);
  --hdr-current-mark: var(--theme-success-solid);
  --hdr-badge-bg: #d92d20;
  --hdr-shadow: rgba(0, 0, 0, 0.5);
  /* Шапка в одну строку (v1.10.0, вариант A): вкладка раздела, где человек сейчас, кружок профиля, затемнение под
     листом «☰ Меню». Кружок — «сильным» синим: на акцентном #4a7cc0 белые инициалы не дотягивают до 4.5:1. */
  --hdr-accent: var(--theme-link);
  --hdr-accent-soft: var(--theme-info-soft);
  --hdr-avatar-bg: var(--theme-strong);
  --hdr-avatar-ink: #ffffff;
  --hdr-backdrop: rgba(0, 0, 0, 0.55);
}

/* Поправки, которые не выразить заменой литерала (цвета считает скрипт страницы, или цвет задаёт браузер). */

/* Выделение найденного (`<mark>`): у браузера — чёрный текст на жёлтом; страницы красят только фон. */
html[data-theme="dark"] mark { background-color: var(--theme-warn-soft-2); color: var(--theme-text); }

/* РНП: условное форматирование маржи — скрипт (`07_rows.js`) смешивает светлые красный/жёлтый/зелёный подложки
   (`--margin-format-bg`) и даёт тёмный текст своей ступени (`--margin-format-fg`: красный #942525, жёлтый #8a5800,
   жёлто-зелёный #486d32, зелёный #17663f). Ночью подложку красит насыщенный цвет текста ступени, а не бледная дневная
   подложка (v1.10.0, пятый круг, G2-17): прежние 22 % почти белой подложки поверх панели давали у всех трёх одинаковый
   серый (#474d50 / #494b4f / #494a51, разница 1.02:1) — хорошую маржу было не отличить от отрицательной. Теперь
   красная, жёлтая и зелёная ступени — тёмно-красная, тёмно-жёлтая и тёмно-зелёная, текст — светлый своего тона
   (не ниже 7:1). */
html[data-theme="dark"] td.margin-format {
  background: color-mix(in srgb, var(--margin-format-fg) 42%, var(--theme-surface));
  color: color-mix(in srgb, var(--margin-format-fg) 28%, #ffffff);
}
html[data-theme="dark"] td.margin-format b { color: inherit; }
html[data-theme="dark"] td.margin-format.margin-estimated,
html[data-theme="dark"] td.margin-format.margin-preliminary { background: var(--theme-warn-soft); }

/* Чат AI днём: кнопки «скрепка» и «микрофон» наследуют белый текст кнопок чата, а фон у них днём светлый. */
html:not([data-theme="dark"]) .composer .attach-btn { color: var(--theme-text); }
/* Чат AI: время под своим сообщением — на синем пузыре; серый приглушённый там не читался (2:1) ни ночью, ни днём. */
.thread .msg.user .meta { color: rgba(255, 255, 255, 0.78); }

/* >>> ночные правила сборки редактора базы знаний (scripts/theme_colors.py --write) */
html[data-theme="dark"] .kb-ed{--kb-ink:var(--theme-text);--kb-text:var(--theme-text);--kb-muted:var(--theme-muted);--kb-line:var(--theme-line);--kb-line-strong:var(--theme-line);--kb-panel:var(--theme-surface);--kb-soft:var(--theme-surface-2);--kb-accent:var(--theme-accent);--kb-accent-soft:var(--theme-info-soft);--kb-danger:var(--theme-danger-solid);--kb-danger-soft:var(--theme-danger-soft)}
html[data-theme="dark"] .kb-ed-btn{color:var(--theme-text-2)}
html[data-theme="dark"] .kb-ed-btn[data-cmd=highlight][data-color=green] .kb-ed-hl-bar{stroke:var(--theme-success)}
html[data-theme="dark"] .kb-ed-btn[data-cmd=highlight][data-color=blue] .kb-ed-hl-bar{stroke:var(--theme-link)}
html[data-theme="dark"] .kb-ed-btn[data-cmd=highlight][data-color=red] .kb-ed-hl-bar{stroke:var(--theme-danger)}
html[data-theme="dark"] .kb-ed-btn[data-cmd=highlight][data-color=gray] .kb-ed-hl-bar{stroke:var(--theme-faint)}
html[data-theme="dark"] .kb-ed-subbar{background:var(--theme-surface)}
html[data-theme="dark"] .kb-ed-banner{border:1px solid var(--theme-danger-line)}
html[data-theme="dark"] .kb-ed-prose code{background:var(--theme-surface-2)}
html[data-theme="dark"] .kb-ed-prose pre{background:var(--theme-surface-3)}
html[data-theme="dark"] .kb-ed-prose blockquote{background:var(--theme-surface-2);color:var(--theme-text-2)}
html[data-theme="dark"] .kb-hl--yellow{background:var(--theme-warn-soft)}
html[data-theme="dark"] .kb-hl--green{background:var(--theme-success-soft)}
html[data-theme="dark"] .kb-hl--blue{background:var(--theme-surface-3)}
html[data-theme="dark"] .kb-hl--red{background:var(--theme-danger-soft-2)}
html[data-theme="dark"] .kb-hl--gray{background:var(--theme-surface-3)}
html[data-theme="dark"] .kb-mention{border:1px solid var(--theme-line);background:var(--theme-surface-2);color:var(--theme-link)}
html[data-theme="dark"] .kb-mention--position{background:var(--theme-violet-soft);border-color:var(--theme-violet-line);color:var(--theme-violet)}
html[data-theme="dark"] .kb-mention--block{background:var(--theme-warn-soft);border-color:var(--theme-warn-line);color:var(--theme-warn)}
html[data-theme="dark"] .kb-mention--article{background:var(--theme-success-soft);border-color:var(--theme-success-line);color:var(--theme-success)}
html[data-theme="dark"] .kb-callout{border:1px solid var(--theme-info-line);background:var(--theme-surface-2)}
html[data-theme="dark"] .kb-callout[data-tone=success]{background:var(--theme-success-soft);border-color:var(--theme-success-line)}
html[data-theme="dark"] .kb-callout[data-tone=warning]{background:var(--theme-warn-soft);border-color:var(--theme-warn-line)}
html[data-theme="dark"] .kb-callout[data-tone=danger]{background:var(--theme-danger-soft);border-color:var(--theme-danger-line)}
html[data-theme="dark"] .kb-callout[data-tone=neutral]{background:var(--theme-surface-2);border-color:var(--theme-line)}
html[data-theme="dark"] .kb-callout-icon:hover{background:var(--theme-hover)}
html[data-theme="dark"] .kb-ed-prose .is-empty:before{color:var(--theme-faint)}
html[data-theme="dark"] .kb-ed-seg-btn{color:var(--theme-text-2)}
html[data-theme="dark"] .kb-ed-video-stage video{background:var(--theme-surface-3)}
html[data-theme="dark"] .kb-ed-embed{background:var(--theme-strong)}
html[data-theme="dark"] .kb-ed-embed[data-provider=rutube]{background:var(--theme-strong)}
html[data-theme="dark"] .kb-ed-embed[data-provider=vk]{background:var(--theme-strong)}
html[data-theme="dark"] .kb-ed-handle{color:var(--theme-faint)}
html[data-theme="dark"] .kb-ed-toast.is-error{border-color:var(--theme-danger-line)}
html[data-theme="dark"] .kb-ed-popover,html[data-theme="dark"] .kb-ed-menu,html[data-theme="dark"] .kb-ed-dialog{color:var(--theme-text)}
html[data-theme="dark"] .kb-ed-popover{border:1px solid var(--theme-line);background:var(--theme-surface)}
html[data-theme="dark"] .kb-ed-popover-label{color:var(--theme-muted)}
html[data-theme="dark"] .kb-ed-linkbtn{color:var(--theme-link)}
html[data-theme="dark"] .kb-ed-linkbtn:hover{background:var(--theme-surface-2)}
html[data-theme="dark"] .kb-ed-linkbtn.is-danger{color:var(--theme-danger)}
html[data-theme="dark"] .kb-ed-tone:hover{background:var(--theme-surface-2)}
html[data-theme="dark"] .kb-ed-tone-swatch{border:1px solid var(--theme-info-line);background:var(--theme-surface-2)}
html[data-theme="dark"] .kb-ed-tone[data-tone=success] .kb-ed-tone-swatch{background:var(--theme-success-soft);border-color:var(--theme-success-line)}
html[data-theme="dark"] .kb-ed-tone[data-tone=warning] .kb-ed-tone-swatch{background:var(--theme-warn-soft);border-color:var(--theme-warn-line)}
html[data-theme="dark"] .kb-ed-tone[data-tone=danger] .kb-ed-tone-swatch{background:var(--theme-danger-soft)}
html[data-theme="dark"] .kb-ed-tone[data-tone=neutral] .kb-ed-tone-swatch{background:var(--theme-surface-2);border-color:var(--theme-line)}
html[data-theme="dark"] .kb-ed-emoji:hover{background:var(--theme-surface-2)}
html[data-theme="dark"] .kb-ed-swatch{border:1px solid var(--theme-line);color:var(--theme-text)}
html[data-theme="dark"] .kb-ed-menu{border:1px solid var(--theme-line);background:var(--theme-surface)}
html[data-theme="dark"] .kb-ed-menu-group{color:var(--theme-muted)}
html[data-theme="dark"] .kb-ed-menu-item{color:var(--theme-text)}
html[data-theme="dark"] .kb-ed-menu-item.is-active{background:var(--theme-info-soft)}
html[data-theme="dark"] .kb-ed-menu-icon{border:1px solid var(--theme-line);background:var(--theme-surface);color:var(--theme-text-2)}
html[data-theme="dark"] .kb-ed-menu-hint{color:var(--theme-muted)}
html[data-theme="dark"] .kb-ed-menu-empty{color:var(--theme-muted)}
html[data-theme="dark"] .kb-ed-dialog{border:1px solid var(--theme-line);background:var(--theme-surface)}
html[data-theme="dark"] .kb-ed-dialog-x{color:var(--theme-muted)}
html[data-theme="dark"] .kb-ed-dialog-x:hover{background:var(--theme-surface-2)}
html[data-theme="dark"] .kb-ed-dialog-error{background:var(--theme-danger-soft);color:var(--theme-danger)}
html[data-theme="dark"] .kb-ed-button{border:1px solid var(--theme-line);background:var(--theme-surface);color:var(--theme-text)}
html[data-theme="dark"] .kb-ed-button:hover:not(:disabled){background:var(--theme-surface-2)}
html[data-theme="dark"] .kb-ed-button.is-danger{border-color:var(--theme-danger-line);color:var(--theme-danger)}
html[data-theme="dark"] .kb-ed-field-label{color:var(--theme-muted)}
html[data-theme="dark"] .kb-ed-input{border:1px solid var(--theme-line);background:var(--theme-surface);color:var(--theme-text)}
html[data-theme="dark"] .kb-ed-hint{color:var(--theme-muted)}
html[data-theme="dark"] .kb-ed-tabs{border-bottom:1px solid var(--theme-line)}
html[data-theme="dark"] .kb-ed-tab{color:var(--theme-muted)}
html[data-theme="dark"] .kb-ed-tab.is-active{color:var(--theme-text)}
html[data-theme="dark"] .kb-ed-file-chosen{color:var(--theme-text-2)}
/* <<< конец ночных правил редактора */

/* Поле даты на телефоне (бета 25.10.2026, iPhone): родное поле Safari не ужимается по колонке — «24 окт. 2026 г.»
   уходило за правый край в «Рейтинге менеджеров». Без родного оформления поле берёт ширину колонки, календарь по
   нажатию остаётся; дата — слева, как текст в соседних полях. */
@media (max-width: 899px), (pointer: coarse) and (max-height: 500px) {
  input[type="date"], input[type="month"], input[type="datetime-local"] {
    -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%;
  }
  input[type="date"]::-webkit-date-and-time-value, input[type="month"]::-webkit-date-and-time-value,
  input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; }
}
