/* Главный экран. Без сборки; ВСЕ цвета — переменные. Две темы: data-theme = light | dark (по умолчанию light).
   Палитра снята пикселями со скриншотов сайта cntrl.pro: светлая — фон #F3F5F9, карточки #FFFFFF, основная кнопка #02071B,
   акцент #2A56F5; тёмная — фон #02071B, карточки #0A1230, основная кнопка #6F8CFF с тёмным текстом. */
:root {
  color-scheme: light;
  --bg: #f3f5f9; --bg-filters: #ffffff; --text: #02071b; --text-2: #3a4460; --muted: #586176;
  --border: #c7cedc; --border-soft: #dce1eb; --grey: #eef1f7; --grey-2: #e2e7f1;
  --surface: #ffffff; --head-bg: #f3f5f9; --head-text: #1b2440;
  --accent-fg: #1537b8; --accent: #2a56f5; --accent-hover: #1f45d6; --accent-text: #ffffff; --accent-soft: #e7ecff; --accent-border: #c7cedc;
  --btn-bg: #02071b; --btn-fg: #ffffff; --btn-hover: #1a2142;
  --grand: #e7ecff; --grand-line: #2a56f5; --total: #eef1f8; --open: #f7f9fc; --tag: #e7ecff;
  --green: #0f7b4a; --green-soft: #e6f6ee;
  --danger: #b42318; --danger-soft: #fef3f2; --danger-border: #f3b4ae; --danger-hover: #fee4e2;
  /* Сравнение периодов «Статистики» (доработка period-compare, п. 2): зелёный «рост» рядом с --danger («падение») */
  --positive: #1a7f37;
  --warn-bg: #fffaeb; --warn-border: #fedf89; --warn-text: #7a2e0e;
  --row-hover: rgba(42, 86, 245, .05); --shadow: rgba(2, 7, 27, .16);
  --tip-bg: #02071b; --tip-text: #edf0f8;
  /* Кнопка режима (разд. 17.1): включённая — зелёная, выключенная — серая; пары «текст/фон» >= 4,5:1, рамка серой >= 3:1 */
  --mode-on-bg: #0f7b4a; --mode-on-fg: #ffffff; --mode-on-border: #0f7b4a; --mode-on-hover: #0b6a3f;
  --mode-off-bg: #eef1f7; --mode-off-fg: #3a4460; --mode-off-border: #6b7488; --mode-off-hover: #e2e7f1;
  /* Кнопка «Настройки столбцов» (v3.24.0): светлая подкраска, чтобы не сливалась с серыми кнопками; пары «текст/фон» >= 4,5:1 */
  --cols-bg: #e3eaff; --cols-fg: #0f2a8f; --cols-border: #6a85e8; --cols-hover: #d3defe; --cols-active: #c2d1fd;
  --cols-open-bg: #c2d1fd; --cols-open-fg: #0b2178; --cols-open-border: #2a56f5;
  --cols-part-bg: #fffaeb; --cols-part-fg: #7a2e0e; --cols-part-border: #e0a63a; --cols-part-hover: #fef0c7;
  /* v3.27.5: оформление «Настроек» (источники, кабинеты, курс): подложки форм, шапки таблиц, строки списков, линии. Пары «текст/фон» >= 4,5:1 */
  --panel-bg: #eef2fb; --panel-border: #b9c3da; --thead-bg: #dfe6f5; --row-bg: #f6f8fc; --row-bg-hover: #eaf0ff; --row-line: #d3dae9; --row-hover-2: rgba(42, 86, 245, .09);
  --r-btn: 12px; --r-box: 20px;
  --head1-h: 30px; --head-h: 72px;
  --row-h: 34px;
  --indent: 18px; --pad: 8px; --tree-min: 220px; --tree-max: 340px;
  --cell-bg: var(--surface); --cell-bg-group: var(--open); --cell-bg-total: var(--total); --cell-bg-grand: var(--grand);
  --pin-shadow: rgba(2, 7, 27, .16);
  /* Значок-воронка в заголовках отчёта (.cf-btn, th.has-cf): единая формула «икона + зазор [+ текст условия]»
     вместо трёх ранее независимо подобранных padding-left (доработка period-compare, п. 1). Не зависят от темы. */
  --cf-icon-w: 16px;        /* видимая ширина неактивного значка (контур + паддинги + svg 12px) */
  --cf-icon-w-active: 20px; /* видимая ширина активного значка (.cf-btn.is-active, padding 0 3px) */
  --cf-gap: 6px;            /* фиксированный зазор значок → текст, одинаковый во всех состояниях */
}
:root[data-theme="dark"] { color-scheme: dark;
  --bg: #02071b; --bg-filters: #0a1230; --text: #edf0f8; --text-2: #c4cbde; --muted: #a0a9c0;
  --border: #2a3767; --border-soft: #1c2750; --grey: #111a3f; --grey-2: #1c2750;
  --surface: #0a1230; --head-bg: #0e1738; --head-text: #c9d0e6;
  --accent-fg: #9db0ff; --accent: #6f8cff; --accent-hover: #8299ff; --accent-text: #02071b; --accent-soft: #141e4a; --accent-border: #2a3767;
  --btn-bg: #6f8cff; --btn-fg: #02071b; --btn-hover: #8299ff;
  --grand: #16225a; --grand-line: #6f8cff; --total: #0e1738; --open: #0c1436; --tag: #1c2750;
  --green: #4ade80; --green-soft: #12301f;
  --danger: #ffb3ba; --danger-soft: #36111d; --danger-border: #6b2433; --danger-hover: #4a1826;
  /* Сравнение периодов «Статистики» (доработка period-compare, п. 2): контрастный зелёный для тёмной темы */
  --positive: #4ade80;
  --warn-bg: #3a2f12; --warn-border: #6b5518; --warn-text: #fde68a;
  --row-hover: rgba(111, 140, 255, .09); --shadow: rgba(0, 0, 0, .6);
  --tip-bg: #edf0f8; --tip-text: #02071b; --pin-shadow: rgba(0, 0, 0, .6);
  --mode-on-bg: #4ade80; --mode-on-fg: #03210f; --mode-on-border: #4ade80; --mode-on-hover: #6ee7a0;
  --mode-off-bg: #1c2750; --mode-off-fg: #c4cbde; --mode-off-border: #7a86a6; --mode-off-hover: #26336a;
  --cols-bg: #1d2b66; --cols-fg: #d5dfff; --cols-border: #6f8cff; --cols-hover: #27388a; --cols-active: #2f4299;
  --cols-open-bg: #2f4299; --cols-open-fg: #f0f3ff; --cols-open-border: #9db0ff;
  --cols-part-bg: #3a2f12; --cols-part-fg: #fde68a; --cols-part-border: #b88a1c; --cols-part-hover: #4a3c16;
  --panel-bg: #131e4b; --panel-border: #3d4d8a; --thead-bg: #1d2b66; --row-bg: #0f1a42; --row-bg-hover: #18266a; --row-line: #2a3767; --row-hover-2: rgba(111, 140, 255, .16); }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 Manrope, Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-font-smoothing: antialiased; color: var(--text); background: var(--bg); }

/* Кнопки: единая высота 32px */
button { font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--surface);
         border-radius: var(--r-btn); padding: 0 16px; height: 36px; font-weight: 500; color: var(--text); line-height: 1.2;
         transition: background .12s, border-color .12s, color .12s; }
button:hover { background: var(--grey); border-color: var(--muted); }
button:active { background: var(--grey-2); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Отдельные кнопки с промежутками (периоды, уровни); активная — акцентная заливка */
.btns { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.btns button { color: var(--text); border-color: var(--border); background: var(--surface); }
.btns button:hover { background: var(--grey); border-color: var(--muted); }
.btns button.is-active { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); font-weight: 600; }
.expand-tools #collapse-all.is-active { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); font-weight: 600; }
.btns button.is-active:hover,
.expand-tools #collapse-all.is-active:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger); }
.btn-neutral { color: var(--text-2); }
.btn-logout { color: var(--text-2); }
input, select { font: inherit; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); padding: 6px 10px; border-radius: 10px; }
.notice { background: var(--grey); color: var(--text); padding: 6px 10px; border-radius: 10px; }
.notice.error, #message.error { background: var(--danger-soft); border: 1px solid var(--danger-border); color: var(--danger); }
#message .retry { margin-left: 8px; padding: 2px 12px; font: inherit; cursor: pointer; border-radius: 8px;
                  border: 1px solid var(--danger-border); background: transparent; color: var(--danger); }
#message .retry:hover, #message .retry:focus-visible { background: var(--danger-border); }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 24px; /* v3.40.0: было 14px, закреплённая часть ниже */
          background: var(--bg); border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; gap: 8px; }
/* Заголовок и «Последнее обновление» одним блоком: время мелко под заголовком, правая часть шапки не распухает (QA-29) */
.topbar-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar-title #tgb-update { font-size: 12px; line-height: 1.3; }
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.topbar-right { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; min-width: 0; }

/* Закреплённая шапка (v3.39.0, v3.40.0). Широкий экран (от 1150 px): .page-head держит верхнюю строку и, на страницах настроек и
   «Регистраций и пополнений», вкладки проектов и разделов, а на «Боты» и «Кабинеты и источники» ещё и внутренние вкладки страницы
   (.pagetabs) - всё закреплено одним блоком, тень под всем блоком. Отступы и высоты строк уменьшены (v3.40.0), кнопки не ниже 34 px. Узкий экран: закреплена только верхняя строка
   (.topbar), вкладки идут обычным порядком, шапка не съедает полэкрана. Низкое окно (ландшафт телефона) и шапка выше 40% окна: ничего не закреплено.
   --sticky-h - высота закреплённой части; точное значение ставит sticky-head.js, здесь запасное до его загрузки.
   Цвета - переменные обеих тем; тень под шапкой появляется, когда страница прокручена (класс page-scrolled на <html>). */
:root { --sticky-h: 64px; }
html { scroll-padding-top: calc(var(--sticky-h) + 8px); }
.page-head { position: sticky; top: 0; z-index: 45; background: var(--bg); border-bottom: 1px solid var(--border-soft); }
.page-head > .topbar { border-bottom: 0; }
.page-head > .topbar:not(:last-child) { border-bottom: 1px solid var(--border-soft); }
.page-head-tabs { padding-bottom: 8px; }
.page-head-ptabs { padding-bottom: 0; } /* внутренние вкладки страницы сами замыкают шапку: нижний отступ не нужен */
html.page-scrolled .page-head { box-shadow: 0 6px 12px -6px var(--pin-shadow); }
@media (max-width: 1149.98px) {
  .page-head { display: contents; }
  .page-head > .topbar { position: sticky; top: 0; z-index: 45; border-bottom: 1px solid var(--border-soft); }
  html.page-scrolled .page-head { box-shadow: none; }
  html.page-scrolled .page-head > .topbar { box-shadow: 0 6px 12px -6px var(--pin-shadow); }
  .page-head > .pagetabs { border-bottom: 1px solid var(--border-soft); } /* шапка не закреплена и границы у неё нет: линия под вкладками своя */
}
@media (max-height: 450px) {
  .page-head, .page-head > .topbar { position: static; box-shadow: none !important; }
}
/* sticky-head.js: окно низкое или шапка заняла бы больше 40% высоты окна (маленький телефон) - обычная шапка, не закреплённая */
html.head-free .page-head, html.head-free .page-head > .topbar { position: static; box-shadow: none !important; }

.filters { padding: 18px 20px; display: grid; gap: 16px; background: var(--bg-filters); margin: 16px 24px 0;
           border: 1px solid var(--border-soft); border-radius: var(--r-box); }
.period, .selects, .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filters label, .field { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }
.field-label { font-size: 12px; color: var(--text-2); }
.date-field input { height: 36px; width: 148px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-btn);
                     background: var(--surface); color: var(--text); font: inherit; }
.date-field input:focus { border-color: var(--accent); outline: 0; }
#f-contains { height: 36px; padding: 0 10px; border: 1px solid var(--border);
                              border-radius: var(--r-btn); background: var(--surface); color: var(--text); }
#f-contains:focus { border-color: var(--accent); outline: 0; }
.selects label { min-width: 170px; max-width: 280px; flex: 0 1 190px; }
.selects select[multiple] { min-height: 64px; }
.selects .reset-btn { height: 36px; }
/* v3.41.0: проект без рекламы скрывает лишние фильтры и кнопки (скрипт ставит hidden) */
.selects label[hidden], .expand-tools [hidden], .expand-tools[hidden], .topbar-title [hidden] { display: none !important; }
.selects label > .ms, .selects label > input { min-width: 0; width: 100%; box-sizing: border-box; }

/* Свой мультивыбор (поверх <select multiple>, который скрывается после инициализации).
   Поле ВСЕГДА одной высоты (36px, как пустое «Все») при любом числе выбранных значений: выбранное не раскрывается
   в поле, а показывается сводкой «первое значение +N»; полный список с галочками — в панели под полем. */
.ms { position: relative; }
.ms-control { display: flex; flex-wrap: nowrap; align-items: center; gap: 0; height: 36px; overflow: hidden;
              padding: 0 26px 0 10px; border: 1px solid var(--border); border-radius: var(--r-btn);
              background: var(--surface); cursor: text; position: relative; color: var(--text); font-size: 14px; }
.ms-control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ms-summary { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; max-width: 100%; margin-right: 4px; }
.ms-summary[hidden], .ms-more[hidden] { display: none; }
.ms-first { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-more { flex: 0 0 auto; background: var(--accent-soft); color: var(--accent-fg); border-radius: 8px; padding: 0 7px;
           font-size: 12px; font-weight: 600; line-height: 20px; }
.ms.is-typing .ms-summary { display: none; }
/* есть выбранное и поиск не набирается: полю поиска достаточно каретки, всё место — сводке; при наборе оно растёт */
.ms.has-value:not(.is-typing) .ms-input { flex: 0 0 4px; width: 4px; min-width: 0; }
.ms-clear { border: 0; background: transparent; padding: 0 4px; line-height: 1.3; color: var(--text-2);
            border-radius: 3px; height: auto; }
.ms-clear:hover { background: var(--grey-2); color: var(--danger); border: 0; }
.ms-clear { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); font-size: 16px; }
.ms-input:focus-visible { outline: 0; } /* фокус виден по рамке поля (:focus-within) */
.ms-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.ms-input { flex: 1 1 24px; min-width: 24px; width: 100%; height: 100%; border: 0; outline: 0; padding: 0; background: transparent;
            color: inherit; text-overflow: ellipsis; }
.ms-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 2px;
           max-height: 240px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
           border-radius: 12px; box-shadow: 0 8px 24px var(--shadow); color: var(--text); font-size: 14px; }
.ms-list[hidden] { display: none; }
.ms-opt { padding: 5px 8px; cursor: pointer; overflow-wrap: anywhere; }
.ms-opt.is-active { background: var(--grey); }
.ms-opt.is-selected { background: var(--accent-soft); font-weight: 600; }
.ms-opt.is-selected::before { content: "✓ "; color: var(--accent); }
/* «Выбрать все найденные (N)» / «Снять найденные (N)»: первая строка списка при введённом поиске, липкая при прокрутке */
.ms-bulk { position: sticky; top: 0; z-index: 1; padding: 7px 8px; cursor: pointer; font-weight: 600; color: var(--accent-fg);
           background: var(--surface); border-bottom: 1px solid var(--border-soft); overflow-wrap: anywhere; }
.ms-bulk:hover, .ms-bulk.is-active { background: var(--grey); }
@media (max-width: 600px) { .ms-bulk { padding: 10px 8px; } }
.ms-empty { padding: 6px 8px; color: var(--muted); font-size: 12px; }
@media (max-width: 600px) {
  .selects label { min-width: 100%; max-width: none; }
  /* Даты в одну строку, две колонки поровну (gap как у остальных полей); кнопки периодов — на всю ширину ниже */
  .period { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
  .period .presets { grid-column: 1 / -1; }
  .date-field { min-width: 0; }
  /* 16px: меньше — iOS приближает страницу при фокусе */
  .date-field input { width: 100%; min-width: 0; box-sizing: border-box; font-size: 16px; padding: 0 6px 0 8px; }
  /* стрелка/значок календаря без лишних полей: «06.10.2026» целиком помещается и на 320 px */
  .date-field input::-webkit-calendar-picker-indicator { margin: 0; padding: 0 0 0 2px; }
  .date-field input::-webkit-datetime-edit { padding: 0; }
  .date-field input::-webkit-datetime-edit-fields-wrapper { padding: 0; }
}
.expand-tools { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions { column-gap: 28px; }
/* Выбор столбцов (v3.23.1; v3.24.2): подпись над кнопкой (стиль .field-label, как подписи полей фильтров), в кнопке только «Все» / «N из M»;
   блок прижат к правому краю ряда кнопок; панель с галочками под кнопкой, правым краём по правому краю кнопки (на телефоне -
   обычным блоком в потоке панели фильтров) */
.cols-tools { position: relative; display: grid; gap: 4px; margin-left: auto; justify-items: end; }
.cols-pop { position: absolute; z-index: 30; right: 0; top: calc(100% + 4px); width: max-content; max-width: min(600px, calc(100vw - 16px));
            max-height: min(70vh, 460px); overflow-y: auto; padding: 12px 14px; display: grid; gap: 10px; background: var(--surface);
            border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px var(--shadow); color: var(--text); font-size: 14px; }
/* Кнопка: светлая подкраска; открыта (aria-expanded) - плотнее; часть столбцов скрыта (data-partial) - тёплая подкраска */
.cols-tools .cols-btn { min-width: 64px; text-align: center; background: var(--cols-bg); color: var(--cols-fg); border-color: var(--cols-border); font-weight: 600; }
.cols-tools .cols-btn:hover { background: var(--cols-hover); border-color: var(--cols-open-border); }
.cols-tools .cols-btn:active { background: var(--cols-active); }
.cols-tools .cols-btn[aria-expanded="true"] { background: var(--cols-open-bg); color: var(--cols-open-fg); border-color: var(--cols-open-border); box-shadow: inset 0 -2px 0 var(--cols-open-border); }
.cols-tools .cols-btn[data-partial="1"] { background: var(--cols-part-bg); color: var(--cols-part-fg); border-color: var(--cols-part-border); }
.cols-tools .cols-btn[data-partial="1"]:hover { background: var(--cols-part-hover); }
.cols-tools .cols-btn[data-partial="1"][aria-expanded="true"] { background: var(--cols-part-hover); box-shadow: inset 0 -2px 0 var(--cols-part-border); }
.cols-tools .cols-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cols-pop[hidden] { display: none; }
.cols-group { display: grid; gap: 2px; }
.cols-title { font-size: 12px; color: var(--text-2); font-weight: 600; margin-bottom: 2px; }
.cols-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); column-gap: 14px; }
.filters .cols-item { display: flex; align-items: center; gap: 8px; padding: 4px 2px; min-height: 28px; font-size: 14px; color: var(--text); cursor: pointer; }
.cols-item input { margin: 0; flex: none; width: 16px; height: 16px; accent-color: var(--accent); }
.filters .cols-item input:disabled + span { color: var(--text-2); }
.filters .cols-item:has(input:disabled) { cursor: default; }
.filters .cols-all { padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); font-weight: 600; }
@media (max-width: 600px) {
  .cols-tools { width: 100%; margin-left: 0; justify-items: start; } /* под остальными кнопками, в потоке */
  .cols-pop { position: static; width: 100%; max-width: none; max-height: none; box-sizing: border-box; box-shadow: none; }
  .cols-grid { grid-template-columns: 1fr; }
  .filters .cols-item { min-height: 40px; }
}

.login { max-width: 360px; margin: 15vh auto; padding: 28px; display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-box); }
.login a { color: var(--accent-fg); }
.login button[type="submit"] { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); font-weight: 600; }
.login button[type="submit"]:hover { background: var(--btn-hover); }
.login form { display: grid; gap: 10px; }
.login label { display: grid; gap: 3px; }
.login .field { display: grid; gap: 3px; }
.login input { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-btn); background: var(--surface); color: var(--text); }
/* Поле пароля с кнопкой-«глазиком» справа внутри поля; встроенную кнопку показа Edge/IE скрываем, чтобы не было двух */
.pw-field { position: relative; display: grid; }
.login .pw-field input { padding-right: 44px; width: 100%; min-width: 0; }
.pw-field input::-ms-reveal, .pw-field input::-ms-clear { display: none; }
.pw-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 36px; height: 32px; padding: 0;
             display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted); border-radius: 10px; }
.pw-toggle:hover { background: var(--grey); color: var(--text); border: 0; }
.pw-toggle:active { background: var(--grey-2); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.pw-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pw-toggle .i-eye-off, .pw-toggle[aria-pressed="true"] .i-eye { display: none; }
.pw-toggle[aria-pressed="true"] .i-eye-off { display: block; }

/* Таблица: шапка и общий итог закреплены при прокрутке */
/* Пол высоты 320px: на низком окне таблице всегда остаётся место хотя бы под шапку и несколько строк
   (раньше при высоте окна 360px оставалось ~100px: шапка, «Всего» и одна строка). Ландшафт телефона — отдельный блок внизу. */
.table-wrap { overflow: auto; max-height: max(calc(100vh - 260px), 320px); background: var(--surface); margin: 16px 24px 24px;
              border: 1px solid var(--border-soft); border-radius: var(--r-box); }
.table-wrap.loading { opacity: .6; }
table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
th, td { padding: 6px 12px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; color: var(--text); }
th { background: var(--head-bg); text-align: left; font-weight: 600; vertical-align: bottom; font-size: 12.5px;
     position: sticky; top: 0; z-index: 3; border-bottom: 1px solid var(--border); white-space: normal; min-width: 72px; max-width: 110px;
     line-height: 1.25; color: var(--head-text); }
th[data-tip] { cursor: help; }
th[data-tip]:hover, th[data-tip]:focus-visible { background: var(--grey-2); }
tbody tr:hover td { background-image: linear-gradient(var(--row-hover), var(--row-hover)); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Значения метрик в отчёте — по центру ячейки, ровно под заголовком (заголовки тоже по центру); tabular-nums держит цифры столбцом */
#report td.num { text-align: center; font-variant-numeric: tabular-nums; }
/* Ширина первой колонки задаёт --tree-w (JS: ручка в заголовке, localStorage); без JS — прежние 340px */
.tree-col { min-width: var(--tree-w, var(--tree-min)); max-width: var(--tree-w, var(--tree-max)); width: var(--tree-w, var(--tree-max)); text-align: left; white-space: normal;
            overflow-wrap: anywhere; position: sticky; left: 0; z-index: 1; background: var(--cell-bg);
            border-right: 1px solid var(--border-soft); }
td.tree-col { padding-left: calc(var(--pad) + var(--lvl, 0) * var(--indent)); }
th.tree-col { z-index: 5; background: var(--head-bg); }
th.tree-col[data-tip]:hover, th.tree-col[data-tip]:focus-visible { background: var(--grey-2); }
.tree-col .label { vertical-align: middle; }
/* Содержимое ячейки первой колонки: flex фиксированной ширины (= колонка минус отступ уровня, правый паддинг и граница).
   Явная ширина нужна, чтобы длинная подпись не раздвигала колонку при table-layout: auto. */
td.tree-col .cell-in { display: flex; align-items: center; min-width: 0;
                       width: calc(var(--tree-w, var(--tree-max)) - var(--pad) - var(--lvl, 0) * var(--indent) - 13px); }
.cell-in > .toggle, .cell-in > .toggle-gap { flex: none; }
.cell-in > .label, .cell-in > .flat-text { flex: 1 1 auto; min-width: 0; }
/* Тень справа у закреплённой колонки — только когда таблица прокручена вправо (класс ставит JS) */
.table-wrap.is-scrolled .tree-col { border-right-color: var(--border); box-shadow: 4px 0 6px -2px var(--pin-shadow); }
/* Двухуровневая шапка: 1-й ряд — группы (липнет к top:0), 2-й — подзаголовки (липнет под ним).
   Заголовки без группы растянуты на оба ряда (rowspan=2). Везде выравнивание по низу; у чисел — вправо. */
thead tr.head-2 th { top: var(--head1-h); white-space: nowrap; max-width: none; }
th.group { text-align: center; vertical-align: middle; height: var(--head1-h); color: var(--text); font-size: 12px;
           letter-spacing: .02em; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
thead tr.head-2 th.conv-first { border-left: 1px solid var(--border); }
thead tr.head-2 th.conv-last { border-right: 1px solid var(--border); }
/* Переключатель темы: одна квадратная кнопка-значок (солнце в светлой теме, луна в тёмной) */
.theme-toggle { width: 36px; flex: 0 0 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }

/* Виртуальный режим (большие отчёты, см. report-virtual.js): в DOM только окно строк, поэтому все строки
   обязаны быть одной высоты — подпись в одну строку с многоточием (полный текст — в подсказке title).
   Ширины колонок фиксирует JS (colgroup + table-layout: fixed), иначе они менялись бы при прокрутке. */
.table-wrap { overflow-anchor: none; }
table.is-virtual tbody td { height: var(--row-h); padding-top: 0; padding-bottom: 0; overflow: hidden; text-overflow: ellipsis; }
table.is-virtual tbody td.tree-col { white-space: nowrap; overflow-wrap: normal; }
table.is-virtual tbody td.tree-col .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
table.is-virtual tbody tr.vpad td { padding: 0; border: 0; background: transparent; }
table.is-virtual tbody tr.vpad:hover td { background-image: none; }

.row-grand td { color: var(--text); position: sticky; top: var(--head-h); z-index: 2; background: var(--grand);
                font-weight: 700; border-bottom: 2px solid var(--grand-line); }
.row-grand td.tree-col { left: 0; z-index: 4; background: var(--cell-bg-grand); }
.row-total td { background: var(--cell-bg-total); font-weight: 600; border-top: 1px solid var(--border); }
.row-group.is-open td { background: var(--cell-bg-group); }
.toggle { width: 22px; height: 22px; padding: 0; border-radius: 8px; margin-right: 6px; line-height: 1; }
.toggle-gap { display: inline-block; width: 28px; }

/* Название проекта в шапке (режим «домен проекта» и страницы раздела с одним проектом в хабе) */
.project-name { font-weight: 600; }
/* Верхнее меню - вкладки (v3.24.0): обёртка не меняет раскладку прежних кнопок шапки */
.topnav { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; min-width: 0; }
@media (max-width: 600px) {
  /* чуть теснее, чтобы «Отчёт» и «Регистрации и пополнения» (жирным у текущей) вместе помещались в строку при 360 px:
     число строк меню, а с ним положение «темы» и «Выйти», не зависит от того, какая вкладка открыта */
  .topnav { gap: 8px; }
  .topnav .btn-link { padding: 0 14px; }
}

/* Тултип заголовков: узкий столбик с переносом строк */
.tip { position: fixed; z-index: 100; max-width: 240px; width: max-content; padding: 10px 14px;
       background: var(--tip-bg); color: var(--tip-text); border-radius: 12px; font-size: 13px; line-height: 1.4;
       white-space: pre-line; overflow-wrap: break-word; box-shadow: 0 6px 18px var(--shadow); pointer-events: none; }
.tip[hidden] { display: none; }
@media (max-width: 600px) {
  :root { --indent: 10px; --tree-min: 120px; --tree-max: 42vw; }
  :root { --pad: 6px; }
  .topbar { padding: 12px 14px; }
  /* шапка переносится целиком: «Выйти» и ссылки не уходят за экран (QA-02) */
  .topbar-right { width: 100%; }
  .topbar-right > .muted, .topbar-right > .project-name { min-width: 0; overflow-wrap: anywhere; }
  .filters { margin: 12px 12px 0; padding: 14px; border-radius: 16px; }
  .table-wrap { margin: 12px 12px 16px; border-radius: 16px; }
  .toggle-gap { width: 22px; }
  .btns button { flex: 1 1 auto; }
  .expand-tools { width: 100%; }
}

/* Ссылка «Настройки» / «К отчёту» в шапке: выглядит как кнопка (те же размеры, что у button) */
.btn-link { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border: 1px solid var(--border);
            border-radius: var(--r-btn); background: var(--surface); color: var(--text-2); font-weight: 500; text-decoration: none;
            line-height: 1.2; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn-link:hover { background: var(--grey); border-color: var(--muted); }
.btn-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Единое верхнее меню (v3.22.3): текущий раздел подсвечен на всех страницах */
.btn-link[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-fg); font-weight: 600; }

/* Страница «Настройки» */
/* Контейнер по центру: поля слева/справа (padding-inline) равны на любой ширине; max-width — 1100px контента + поля */
.settings { display: grid; gap: 16px; margin: 16px auto 24px; padding-inline: 24px; max-width: 1240px; }
/* Только страница «Боты» (v3.44.1): контейнер шире на ~18% (1460 px вместо 1240), по центру с полями; остальные настройки прежние.
   Вкладки и меню шапки выровнены по тому же краю (.page-head-bots есть только на этой странице). */
.settings.bots, .page-head-bots .subnav, .page-head-bots .projnav, .page-head-bots .pagetabs { max-width: 1460px; }
.settings .card { padding: 18px 20px; background: var(--bg-filters); border: 1px solid var(--border-soft); border-radius: var(--r-box); display: grid; gap: 12px; }
.settings h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.settings h3 { margin: 8px 0 0; font-size: 14px; }
.settings p { margin: 0; }
.settings .hint { color: var(--text-2); }
.settings .notice[hidden], .settings .warn[hidden] { display: none; }
.settings input[type="text"], .settings select { height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-btn);
                                                 background: var(--surface); color: var(--text); font: inherit; min-width: 0; }
/* Выпадающие списки в настройках (v3.22.15): своя стрелка на градиентах (без внешних ресурсов и data: URI), отступ 12px
   от правого края, справа место под стрелку, чтобы текст не заезжал под неё. Цвет стрелки — var(--text-2), обе темы.
   Мультивыбор отчёта (.selects) и диалоги сюда не входят. */
.settings select:not([multiple]) { -webkit-appearance: none; appearance: none; padding-right: 32px; cursor: pointer;
                                   text-overflow: ellipsis;
                                   background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
                                                     linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
                                   background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
                                   background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; }
.settings select:not([multiple]):disabled { cursor: default; }
.settings input[type="date"] { height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-btn);
                               background: var(--surface); color: var(--text); font: inherit; min-width: 0; }
.settings input[type="text"]:focus, .settings input[type="date"]:focus, .settings select:focus { border-color: var(--accent); outline: 0; }
.settings input[type="text"]:focus-visible, .settings select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.settings .is-invalid { border-color: var(--danger); background: var(--danger-soft); }
.btn-primary { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); font-weight: 600; }
.btn-primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
button:disabled { opacity: .5; cursor: default; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.inline-form .field { min-width: 180px; }
.check { display: inline-flex; align-items: center; gap: 8px; height: 36px; font-size: 13px; color: var(--text-2); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.source-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.source-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface);
                  border: 1px solid var(--border-soft); border-radius: var(--r-btn); }
.source-list .src-name { font-weight: 600; flex: 0 1 auto; max-width: 100%; overflow-wrap: anywhere; }
.source-list input[type="text"] { flex: 1 1 200px; }
.source-list .src-count { color: var(--muted); font-size: 12.5px; }
/* v3.27.4: только список источников «Настроек» (#sources): строка по центру блока, длинное название обрезается многоточием (полное имя в title),
   название, счётчик и обе кнопки остаются в одной строке. Список внешних ботов на странице «Боты» (.source-list в bots.html) не затронут. */
#sources { grid-template-columns: minmax(0, 1fr); } /* без этого nowrap-название раздувает колонку списка за блок */
#sources li { justify-content: space-between; }
/* v3.27.5: строка источника: название и «N кабинета» слева, кнопки у правого края; строка в рамке на лёгкой подложке, подсветка при наведении */
#sources li { padding: 10px 14px; background: var(--row-bg); border-color: var(--border); transition: background .12s, border-color .12s; }
#sources li:hover { background: var(--row-bg-hover); border-color: var(--panel-border); }
#sources .src-count { margin-right: auto; }
#sources .src-btns { display: flex; gap: 8px; flex-shrink: 0; }
#sources li.muted { justify-content: center; color: var(--muted); }
@media (min-width: 601px) {
  #sources li { flex-wrap: nowrap; }
  #sources .src-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; overflow-wrap: normal; }
  #sources li > :not(.src-name) { flex-shrink: 0; }
  #sources input[type="text"] { flex-shrink: 1; min-width: 0; }
}
@media (max-width: 600px) { /* телефон: кнопки переносятся под название и прижимаются вправо, без горизонтальной прокрутки */
  #sources .src-name { flex: 1 1 100%; } /* название на своей строке, под ним слева счётчик, кнопки справа - одинаково для короткого и длинного названия */
  #sources .src-btns { margin-left: auto; }
}
/* Селектор с .settings (специфичность выше .table-wrap): иначе правила .table-wrap из блоков «телефон портрет» и
   «ландшафт» (они ниже по файлу) возвращали обёртке кабинетов max-height отчёта и поля, а в карточном режиме
   (overflow: visible) содержимое вылезало за коробку фиксированной высоты и налезало на следующие блоки. */
.settings .cabinets-wrap { margin: 0; max-height: none; border: 1px solid var(--panel-border); border-radius: var(--r-btn); overscroll-behavior: auto; }
#cabinets td { vertical-align: middle; }
#cabinets { width: 100%; }
#cabinets td.cab-name input, #cabinets td.cab-source select, #cabinets td.cab-mode select { width: 100%; min-width: 0; box-sizing: border-box; }
/* v3.27.4: колонки таблицы кабинетов по содержимому внутри блока .card-inner (не шире 900 px): «Название» берёт остаток,
   «Источник» не уже ~150 px (виден «Telegram Ads» целиком), «ID кабинета» в одну строку, «Загрузка из TgBooster» - не больше двух,
   «Сохранить» и «Удалить» рядом обычным размером шрифта, статус строки (если есть) - отдельной строкой ниже. */
#cabinets th { white-space: normal; }
@media (min-width: 1001px) { /* табличный режим; ниже 1001 px таблица превращается в карточки */
  #cabinets th, #cabinets td { padding-inline: 6px; }
  #cabinets th:nth-child(1), #cabinets td:nth-child(1) { white-space: nowrap; width: 1%; }
  #cabinets td.cab-name { width: 38%; min-width: 240px; }
  #cabinets td.cab-source { width: 24%; min-width: 160px; }
  #cabinets th:nth-child(4), #cabinets td.cab-mode { width: 1%; min-width: 130px; }
  #cabinets th:nth-child(5), #cabinets td.cab-load { width: 1%; min-width: 100px; }
  #cabinets th:nth-child(6), #cabinets td:nth-child(6) { width: 1%; white-space: nowrap; }
  #cabinets td.cab-source select { padding-left: 10px; padding-right: 30px; }
  #cabinets .row-actions { display: grid; grid-template-columns: repeat(2, 7rem); gap: 6px; justify-items: stretch; }
  #cabinets .row-actions button { padding-inline: 8px; white-space: nowrap; }
  #cabinets .row-status { grid-column: 1 / -1; min-width: 0; text-align: center; }
}
#cabinets .row-status:empty { display: none; }
/* v3.31.0: кнопка «Найти новые кабинеты в TgBooster», заметка о новых кабинетах и подсветка найденных строк (обе темы) */
.discover-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.discover-status { font-size: 13px; min-width: 0; }
.discover-status.error { color: var(--danger); }
#cabinets tr.is-new td { background: var(--green-soft); }
#cabinets tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--green); }
#cabinets tr.is-new.is-dirty td { background: var(--accent-soft); }
.new-badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 8px; font-size: 11px; font-weight: 600;
             background: var(--green-soft); color: var(--green); border: 1px solid var(--green); vertical-align: middle; }
#cabinets tr.is-dirty td { background: var(--accent-soft); }
/* v3.27.4: карточки «Источники», «Кабинеты» и «Курс» снова на всю ширину контента (как «Боты»); всё их содержимое лежит во внутреннем
   блоке .card-inner: не шире 900 px, по центру карточки (равные поля слева и справа). На узком экране блок занимает всю карточку.
   Правило одно, в шаблонах только класс. */
.settings .card-inner { display: grid; gap: 12px; width: 100%; max-width: 900px; min-width: 0; margin-inline: auto; }
.settings .card-inner .table-wrap { max-width: 100%; }
/* «Кабинеты» и «Источники» (v3.27.5: обе карточки страницы одной ширины, без ступеньки по левому краю): до 1000 px; «Курс» - столбцом по таблице */
.settings .card-inner.card-inner-wide { max-width: 1000px; }
/* «Курс»: заголовок, пояснение, форма и таблица - один центрированный столбец по ширине таблицы (общая ось слева и справа).
   Пояснение не расширяет столбец (width: 0 + min-width: 100%), переносится по его ширине. */
@media (min-width: 1001px) {
  .settings .card-inner.fx-col { width: fit-content; min-width: min(100%, 560px); }
  .fx-col > p, .fx-col > form { width: 0; min-width: 100%; } /* v3.27.5: подложка формы не расширяет столбец, ось та же, что у таблицы */
}
#fx-add .field, #cabinet-add .field { min-width: 0; }
#cabinet-add .field select { width: 180px; max-width: 100%; } /* v3.27.5: 180 вместо 220 - форма на подложке уже на 32 px, кнопка должна остаться в строке с полями на 1440 */
/* плейсхолдеры (v3.27.5): стандартный цвет Chromium давал 3,99:1 в тёмной теме */
.settings ::placeholder { color: var(--muted); opacity: 1; }
#fx-add .field input { width: 170px; max-width: 100%; box-sizing: border-box; }
/* v3.27.3: ОДНО правило выравнивания для всех таблиц настроек и администрирования (внутри main.settings: кабинеты, курс, боты,
   перехватчики, пользователи, внесённые записи, журнал): и заголовки, и значения по центру. Специфичность нулевая (:where),
   поэтому карточный режим узких экранов (text-align: left у #cabinets td, #fx-table td, table.cards td, .users-table td) и
   точечные правила их перебивают. Таблицы отчёта (#report) и страницы «Статистика» (#stats) лежат вне main.settings и не затронуты. */
:where(.settings) table :where(th, td), :where(.settings) table :where(th, td).num { text-align: center; }
/* Блок «Курс» (v3.27.0): таблица строк «Действует с» / «Курс», та же подсветка несохранённой строки, что у кабинетов */
.settings .fx-wrap { margin: 0; max-height: none; border: 1px solid var(--panel-border); border-radius: var(--r-btn); overscroll-behavior: auto; }
#fx-table td { vertical-align: middle; }
#fx-table { width: 100%; }
#fx-table td.fx-rate input, #fx-table td.fx-date input { width: 100%; min-width: 0; box-sizing: border-box; }
@media (min-width: 1001px) { /* v3.27.4: таблица курса по содержимому и по центру блока, поля даты и курса не растягиваются */
  #fx-table { width: auto; }
  #fx-table td.fx-rate input, #fx-table td.fx-date input { width: 170px; }
  #fx-table th, #fx-table td { padding-inline: 12px; }
}
#fx-table .row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
#fx-table .row-status { min-width: 0; }
#fx-table tr.is-dirty td { background: var(--accent-soft); }
/* v3.32.0: курс по кабинетам - список «Для кабинета» в форме, колонки «Кабинет» и «Период», пометка «сейчас», граница между наборами строк */
#fx-add .field select { width: 220px; max-width: 100%; box-sizing: border-box; }
#fx-table .fx-cab-text, #fx-table .fx-period-text { display: inline-block; max-width: 160px; overflow-wrap: anywhere; vertical-align: middle; }
#fx-table td.fx-period, #fx-table td.fx-cab { white-space: normal; }
@media (min-width: 1001px) { /* пять колонок должны уместиться в блок 900 px: компактные поля, длинные названия и период переносятся */
  #fx-table td.fx-rate input { width: 100px; }
  #fx-table td.fx-date input { width: 145px; }
  #fx-table th, #fx-table td { padding-inline: 8px; }
}
#fx-table tr.fx-group-start td { border-top: 2px solid var(--panel-border); }
.fx-now { display: inline-block; padding: 0 6px; border-radius: 8px; font-size: 11px; font-weight: 600; white-space: nowrap;
          background: var(--green-soft); color: var(--green); border: 1px solid var(--green); vertical-align: middle; }
.fx-note { margin: 0; }
#fx-status { min-height: 1.4em; margin: 8px 0 0; }
#fx-status.error { color: var(--danger); }
.row-status { font-size: 12.5px; color: var(--green); min-width: 90px; }
.row-status.error { color: var(--danger); white-space: normal; max-width: 280px; }
/* v3.27.5: оформление карточек «Источники», «Кабинеты», «Курс» (только внутри main.settings .card-inner; общие .source-list, «Боты», отчёт не затронуты).
   Заголовок карточки с линией-разделителем, пояснения мельче и серее, формы добавления на подложке, таблицы в рамке с тонированной шапкой. Цвета - переменные обеих тем. */
.settings .card-inner > h2 { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.settings .card-inner > p.hint, .settings .card-inner > p.muted { font-size: 13px; color: var(--muted); }
.settings .card-inner > #load-hint, .settings .card-inner > #cabinets-empty { font-size: 12.5px; color: var(--muted); }
.settings .card-inner > #load-hint { padding-left: 10px; border-left: 3px solid var(--border); }
.settings .card-inner > form.inline-form { padding: 14px 16px 16px; background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 14px; }
.settings .card-inner > form.inline-form > h3 { flex: 1 1 100%; margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .01em; color: var(--text-2); }
:is(#source-add, #cabinet-add, #fx-add, #cabinets, #fx-table) :is(input[type="text"], input[type="date"], select):not(:focus):not(.is-invalid) { border-color: var(--panel-border); }
#source-add .field { flex: 1 1 260px; max-width: 420px; }
#source-add .field input { width: 100%; }
:is(#cabinets, #fx-table) thead th { background: var(--thead-bg); color: var(--head-text); font-weight: 700; border-bottom: 1px solid var(--panel-border); }
:is(#cabinets, #fx-table) tbody td { border-bottom-color: var(--row-line); }
:is(#cabinets, #fx-table) tbody tr:last-child td { border-bottom: 0; }
:is(#cabinets, #fx-table) tbody tr:hover td { background-image: linear-gradient(var(--row-hover-2), var(--row-hover-2)); }
@media (max-width: 600px) {
  .settings { margin: 12px auto 16px; padding-inline: 12px; }
  .settings .card { padding: 14px; border-radius: 16px; }
  .inline-form .field, .inline-form button { flex: 1 1 100%; }
  #fx-add .field input, #fx-add .field select { width: 100%; }
  .settings .card-inner > form.inline-form { padding: 12px; }
  #source-add .field { max-width: none; }
}

/* Таблица кабинетов на узком экране: карточка на строку, без горизонтальной прокрутки (QA-05).
   Подписи полей — из CSS (шапка таблицы скрыта), «Сохранить» и «Удалить» всегда в видимой области. */
@media (max-width: 1000px) {
  .settings .cabinets-wrap { overflow: visible; border: 0; background: transparent; }
  #cabinets, #cabinets tbody, #cabinets tr, #cabinets td { display: block; width: auto; }
  #cabinets thead { display: none; }
  #cabinets tr { display: grid; gap: 10px; padding: 12px; margin-bottom: 10px; background: var(--row-bg);
                 border: 1px solid var(--border); border-radius: var(--r-btn); }
  #cabinets td { padding: 0; border: 0; min-width: 0; text-align: left; white-space: normal; }
  #cabinets td::before { display: block; margin-bottom: 3px; font-size: 12px; color: var(--muted); }
  #cabinets td:nth-child(1)::before { content: "ID кабинета"; }
  #cabinets td:nth-child(2)::before { content: "Название"; }
  #cabinets td:nth-child(3)::before { content: "Источник"; }
  #cabinets td.cab-mode::before { content: "Способ загрузки"; }
  #cabinets td.cab-mode select { width: 100%; min-width: 0; }
  #cabinets td.cab-load { display: flex; align-items: center; gap: 8px; }
  #cabinets td.cab-load::before { content: "Загрузка из TgBooster"; margin: 0; }
  #cabinets td.cab-name input, #cabinets td.cab-source select { width: 100%; min-width: 0; }
  #cabinets .row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
  #cabinets tr.is-dirty { background: var(--accent-soft); }
  #cabinets tr.is-dirty td { background: transparent; }
  #cabinets tr.is-new { background: var(--green-soft); border-color: var(--green); }
  #cabinets tr.is-new td { background: transparent; }
  #cabinets tr.is-new.is-dirty { background: var(--accent-soft); border-color: var(--border); }
  #cabinets tr.is-new td:first-child { box-shadow: none; }
  .discover-bar #cab-discover { flex: 1 1 100%; min-height: 44px; }
  .settings .fx-wrap { overflow: visible; border: 0; background: transparent; }
  #fx-table, #fx-table tbody, #fx-table tr, #fx-table td { display: block; width: auto; }
  #fx-table thead { display: none; }
  #fx-table tr { display: grid; gap: 10px; padding: 12px; margin-bottom: 10px; background: var(--row-bg);
                 border: 1px solid var(--border); border-radius: var(--r-btn); }
  #fx-table td { padding: 0; border: 0; min-width: 0; text-align: left; white-space: normal; }
  #fx-table td::before { display: block; margin-bottom: 3px; font-size: 12px; color: var(--muted); }
  #fx-table td:nth-child(1)::before { content: "Кабинет"; }
  #fx-table td:nth-child(2)::before { content: "Действует с"; }
  #fx-table td:nth-child(3)::before { content: "Курс"; }
  #fx-table td:nth-child(4)::before { content: "Период"; }
  #fx-table td.fx-rate input { min-width: 0; }
  #fx-table .fx-cab-text, #fx-table .fx-period-text { max-width: none; }
  #fx-table tr.fx-group-start { margin-top: 18px; }
  #fx-table tr.fx-group-start td { border-top: 0; }
  #fx-table .row-actions { flex-wrap: wrap; }
  #fx-table tr.is-dirty { background: var(--accent-soft); }
  #fx-table tr.is-dirty td { background: transparent; }
  .row-status.error { max-width: 100%; }
}

/* Страница «Боты» (ступень 1): вторичная навигация настроек, таблица ботов BotHelp, диалоги, мобильные карточки */
.subnav { display: flex; flex-wrap: wrap; gap: 8px; max-width: 1240px; margin: 6px auto 0; padding-inline: 24px; }
.subnav a { display: inline-flex; align-items: center; height: 34px; padding: 0 16px; border: 1px solid var(--border); border-radius: var(--r-btn);
            background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; }
.subnav a:hover { background: var(--grey); border-color: var(--muted); }
.subnav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.subnav a[aria-current="page"] { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); font-weight: 600; }
/* Вкладки проектов EN/RU внутри «Регистраций и пополнений» и «Настроек» (v3.24.0): вторая строка, подчёркнутые вкладки */
.projnav { display: flex; flex-wrap: wrap; gap: 4px 8px; max-width: 1240px; margin: 8px auto 0; padding-inline: 24px; }
.projnav a { display: inline-flex; align-items: center; height: 34px; padding: 0 16px; border-bottom: 3px solid transparent;
             color: var(--text-2); text-decoration: none; font-weight: 600; letter-spacing: .04em; border-radius: 8px 8px 0 0; }
.projnav a:hover { background: var(--grey); color: var(--text); border-bottom-color: var(--border); }
.projnav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.projnav a[aria-current="page"] { color: var(--accent-fg); border-bottom-color: var(--accent); background: var(--accent-soft); }
/* Вкладки внутри страницы (v3.39.0): «Боты» и «Кабинеты и источники». С v3.40.0 лежат внутри .page-head (последняя строка шапки)
   и закреплены вместе с ней от 1150 px; уже - идут обычным порядком. Линию под ними даёт нижняя граница шапки.
   Кнопки (переключают блоки без перезагрузки); число и красная точка на вкладке. Контраст - переменные обеих тем. */
.pagetabs { display: flex; flex-wrap: wrap; gap: 4px 6px; max-width: 1240px; margin: 6px auto 0; padding-inline: 24px; }
.pagetabs [role="tab"] { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent;
                         border-radius: 8px 8px 0 0; background: transparent; color: var(--text-2); font-weight: 600; }
.pagetabs [role="tab"]:hover { background: var(--grey); color: var(--text); border-bottom-color: var(--border); }
.pagetabs [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pagetabs [role="tab"][aria-selected="true"] { color: var(--accent-fg); border-bottom-color: var(--accent); background: var(--accent-soft); }
.pagetabs [role="tab"][hidden] { display: none; }
.tab-count { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--grey-2); color: var(--text-2);
             font-size: 12px; font-weight: 600; line-height: 1.4; text-align: center; font-variant-numeric: tabular-nums; }
.pagetabs [aria-selected="true"] .tab-count { background: var(--surface); color: var(--accent-fg); }
.tab-count[hidden], .tab-dot[hidden] { display: none; }
.tab-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }
.tabpanel[hidden] { display: none; }
.tabpanel { display: grid; gap: 16px; min-width: 0; }
@media (max-width: 720px) {
  .pagetabs { gap: 2px; margin-top: 8px; padding-inline: 12px; }
  .pagetabs [role="tab"] { flex: 1 1 auto; justify-content: center; min-height: 44px; padding: 0 10px; }
}
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head > div { display: grid; gap: 4px; min-width: 0; flex: 1 1 320px; }
.settings .bots-wrap { margin: 0; max-height: none; border: 1px solid var(--border-soft); border-radius: var(--r-btn); overflow: visible; overscroll-behavior: auto; }
.settings .bots-wrap[hidden] { display: none; }
table.cards td { vertical-align: middle; }
table.cards .row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
table.cards tr.is-off .bot-name { color: var(--muted); }
table.cards .bot-link { overflow-wrap: anywhere; } /* ссылка на бота (v3.44.0): длинный адрес не раздвигает таблицу */
.addr-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.addr-confirm[hidden] { display: none; }
@media (max-width: 720px) { .addr-confirm button { min-height: 44px; } }
.settings .card[hidden], .settings .bots-wrap[hidden], #ext-block[hidden] { display: none; }
/* Таблица перехватчиков на рабочем столе: восемь колонок, поэтому ячейки переносятся и таблица не шире блока */
@media (min-width: 1151px) {
  table.cards { width: 100%; min-width: 0; }
  table.cards th, table.cards td { white-space: normal; overflow-wrap: anywhere; padding-inline: 6px; }
  table.cards .fail-note { white-space: normal; }
  /* Колонки таблицы ботов BotHelp (v3.44.0, QA М-7): фиксированная раскладка с процентами, чтобы длинный адрес в «Ссылке»
     не раздувал колонку и не ломал заголовки («Назначение» не переносится по слогам даже на 1280 px).
     Ссылка сама сжимается: одна строка с многоточием, полный адрес - во всплывающей подсказке (title). */
  #bots { table-layout: fixed; }
  #bots th { overflow-wrap: normal; word-break: normal; }
  /* v3.44.1: десять колонок (две ссылки отдельно); контейнер страницы «Боты» шире (1460 px), см. .settings.bots */
  #bots th:nth-child(1) { width: 11%; }
  #bots th:nth-child(2) { width: 8%; min-width: 92px; }
  #bots th:nth-child(3) { width: 8%; }
  #bots th:nth-child(4) { width: 15%; min-width: 132px; } /* «Состояние»: шире, чем в v3.44.0 (13%), и бейдж переносится по словам: не наезжает на «Порог молчания» (D7) */
  #bots th:nth-child(5) { width: 8%; }
  #bots th:nth-child(6) { width: 9%; }
  #bots th:nth-child(7) { width: 6%; }
  #bots th:nth-child(8) { width: 10%; }
  #bots th:nth-child(9) { width: 11%; }
  #bots th:nth-child(10) { width: 14%; }
  #bots .badge { white-space: normal; max-width: 100%; text-align: center; }
  #bots td { overflow-wrap: break-word; } /* метка и название переносятся по словам; посреди слова - только если слово не помещается в строку */
  #bots .bot-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Выравнивание (v3.27.3): все колонки по центру, и заголовки, и значения - общее правило `:where(.settings) table` выше;
     здесь только центровка вложенных блоков (стопка «значение + пометка»). */
  #bots .cell-stack, #interceptors .cell-stack, #ss-table .cell-stack { justify-items: center; }
  #bots .status-note, #interceptors .status-note { margin-inline: auto; }
  /* «Действия» в одну строку; место добывается у колонок «Название» и «Бот» */
  table.cards .row-actions { flex-wrap: nowrap; justify-content: center; gap: 6px; }
  table.cards .row-actions button, table.cards .row-actions summary { white-space: nowrap; padding-inline: 8px; font-size: 13px; }
  table.cards td:last-child, table.cards th:last-child { white-space: nowrap; }
}
.status-note { display: block; margin-top: 4px; font-size: 12.5px; color: var(--text-2); white-space: normal; overflow-wrap: anywhere; max-width: 280px; }
.status-note.warn-note { color: var(--warn-text); }
.status-note.danger-note { color: var(--danger); }  /* v3.37.0: красная пометка «Очередь» внешнего бота; --danger задан для светлой и тёмной тем */
.cell-stack { display: grid; gap: 2px; justify-items: start; min-width: 0; }
#interceptors th:first-child, #interceptors td:first-child { min-width: 72px; }
.cell-sub { display: block; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.char-count { font-size: 12px; }
.manual > summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.manual > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.manual ol { margin: 4px 0 8px; padding-left: 20px; display: grid; gap: 4px; }
.source-list .src-actions { margin-left: auto; }
.fail-note { color: var(--danger); font-size: 12px; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
/* Таблица перехватчиков: заголовки и бейджи не ломаются; при нехватке места сужаются «Название» и «Бот» */
#interceptors { width: 100%; }
#interceptors .badge { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
@media (min-width: 1151px) {
  #interceptors th { white-space: nowrap; max-width: none; font-size: 12px; padding-inline: 8px; }  /* 9 столбцов (v3.22): на 1152 px без горизонтальной прокрутки */
  #interceptors .row-actions { gap: 4px; }
  #interceptors .row-actions button, #interceptors .row-actions summary { padding-inline: 6px; }
  #interceptors th:nth-child(3), #interceptors td:nth-child(3) { min-width: 124px; }
  /* 4 — «Порог молчания» (v3.22), далее «Получено», «Доставлено», «За сутки», «Очередь», «Действия» */
  #interceptors th:nth-child(4), #interceptors td:nth-child(4) { min-width: 84px; }
  #interceptors th:nth-child(5), #interceptors td:nth-child(5) { min-width: 72px; }
  #interceptors th:nth-child(6), #interceptors td:nth-child(6), #interceptors th:nth-child(7), #interceptors td:nth-child(7) { min-width: 84px; }
  #interceptors th:nth-child(8) { min-width: 72px; }
  #interceptors th:nth-child(9) { min-width: 66px; }
  #interceptors td:nth-child(1) { min-width: 72px; }
  #interceptors td:nth-child(2) { min-width: 88px; }
  #interceptors td:nth-child(1), #interceptors td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; }
  #interceptors td:nth-child(4), #interceptors td:nth-child(5), #interceptors td:nth-child(6), #interceptors td:nth-child(7) { white-space: nowrap; }
  /* длинный бейдж («Перезапуск через 25 с») переносится целиком, а не обрезается; короткие («Работает») не ломаются */
  #interceptors .badge { white-space: normal; text-overflow: clip; overflow: visible; text-align: center; }
}
.time-exact { font-size: 11.5px; white-space: nowrap; }
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.badge-neutral { background: var(--grey); color: var(--text-2); }
.badge-muted { background: var(--grey-2); color: var(--muted); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.error[hidden], .field[hidden], .warn[hidden], dialog [hidden] { display: none !important; }
details.menu { position: relative; }
details.menu > summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 10px;
                         border: 1px solid var(--border); border-radius: var(--r-btn); background: var(--surface); cursor: pointer; font-weight: 700; user-select: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary:hover { background: var(--grey); border-color: var(--muted); }
details.menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; display: grid; gap: 2px; min-width: 240px; padding: 6px;
             background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-btn); box-shadow: 0 8px 24px var(--shadow); }
.menu-list button { border: 0; background: transparent; text-align: left; height: 36px; width: 100%; border-radius: 8px; }
.menu-list button:hover { background: var(--grey); }
dialog { width: min(720px, 94vw); max-height: 92vh; overflow: auto; padding: 20px; border: 1px solid var(--border); border-radius: var(--r-box);
         background: var(--bg-filters); color: var(--text); }
dialog::backdrop { background: rgba(2, 7, 27, .55); }
dialog form { display: grid; gap: 12px; }
dialog h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
dialog h3 { margin: 4px 0 0; font-size: 14px; }
dialog p { margin: 0; }
dialog input[type="text"], dialog input[type="password"], dialog select { height: 36px; width: 100%; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-btn);
                                                                           background: var(--surface); color: var(--text); font: inherit; min-width: 0; }
dialog input[type="text"]:focus-visible, dialog input[type="password"]:focus-visible, dialog select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dlg-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.dlg-actions .check { margin-right: auto; }
.sink-group { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.sink-group legend { padding: 0; margin-bottom: 4px; font-size: 12px; color: var(--text-2); }
.sink-group .check { height: auto; min-height: 32px; }
.sink-sheet { display: grid; gap: 10px; min-width: 0; }
.sink-sheet code { overflow-wrap: anywhere; }
.copy-list { display: grid; gap: 8px; }
.addr-token { display: grid; gap: 8px; margin-bottom: 14px; }
.addr-token h3 { margin: 0; }
.copy-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.copy-label { color: var(--text-2); font-size: 13px; }
.copy-row > .copy-value:last-child { grid-column: 2 / -1; }
.copy-value { display: block; padding: 6px 10px; background: var(--grey); border: 1px solid var(--border-soft); border-radius: 8px;
              font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
/* Карточный режим таблицы ботов: до 1150 px (телефон в ландшафте, планшеты). Таблица из семи колонок в этой
   ширине не помещается, а прокрутки внутри обёртки нет (она overflow: visible ради выпадающего меню) (QA D-2). */
@media (max-width: 1150px) {
  .settings .bots-wrap { overflow: visible; border: 0; background: transparent; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: auto; }
  table.cards thead { display: none; }
  table.cards tr { display: grid; gap: 8px; padding: 12px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-btn); }
  table.cards td { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px; align-items: center; padding: 0; border: 0; text-align: left; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
  table.cards td::before { content: attr(data-label); font-size: 12px; color: var(--muted); }
  table.cards td.num { text-align: left; }
  table.cards td:first-child { display: block; font-size: 15px; }
  table.cards td:first-child::before { content: none; }
  table.cards .row-actions { flex-wrap: wrap; }
  /* v3.38.0: значения ячеек в карточке по центру своей колонки, как на рабочем столе (название бота слева, как заголовок карточки) */
  #interceptors td:not(:first-child), #bots td:not(:first-child) { text-align: center; }
  #interceptors td:not(:first-child) .cell-stack, #bots td:not(:first-child) .cell-stack { justify-items: center; }
  #interceptors .status-note, #bots .status-note { margin-inline: auto; }
  #interceptors td .row-actions, #bots td .row-actions { justify-content: center; }
  .fail-note { white-space: normal; overflow-wrap: anywhere; }
  .bot-name, .bot-label, .copy-value { overflow-wrap: anywhere; word-break: break-word; }
  /* меню в карточке раскрывается вправо от кнопки в пределах карточки, а не за левый край */
  .menu-list { left: 0; right: auto; max-width: calc(100vw - 32px); }
}
/* Блок «TgBooster: ключ доступа» (v3.22.12): длинная подпись кнопки переносится, а не раздвигает страницу */
#tgb-section .row-actions button { max-width: 100%; white-space: normal; text-align: center; }
#tgb-section .badge { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .subnav { margin-top: 8px; padding-inline: 12px; }
  .subnav a { flex: 1 1 auto; justify-content: center; min-height: 44px; }
  .projnav { margin-top: 8px; padding-inline: 12px; }
  .projnav a { flex: 1 1 0; justify-content: center; min-height: 44px; }
  .card-head > button { flex: 1 1 100%; min-height: 44px; }
  #tgb-section .row-actions button { flex: 1 1 100%; min-height: 44px; }
  table.cards .row-actions button, details.menu > summary, .dlg-actions button, #ext-list button { min-height: 44px; }
  /* меню «⋯» — нижняя панель */
  .menu-list { position: fixed; left: 0; right: 0; bottom: 0; top: auto; min-width: 0; max-width: none; border-radius: 16px 16px 0 0; padding: 10px 12px 16px; z-index: 50; max-height: 100dvh; overflow-y: auto; }
  .menu-list button { height: 48px; }
  dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border-width: 0; padding: 16px 14px; }
  .copy-row { grid-template-columns: minmax(0, 1fr); }
  .copy-row button { width: 100%; min-height: 44px; }
  .dlg-actions { flex-direction: column-reverse; align-items: stretch; }
  .dlg-actions .check { margin-right: 0; }
  .sink-group .check { min-height: 44px; }
  dialog input[type="text"], dialog input[type="password"], dialog select { height: 44px; }
}

/* Сортировка по столбцу: заголовок — кнопка без рамки (внешний вид th сохраняется), стрелка направления.
   Под стрелку всегда зарезервировано место, чтобы ширина заголовка не прыгала при смене сортировки. */
.sort-btn { display: block; width: 100%; height: auto; padding: 0; margin: 0; border: 0; border-radius: 6px; background: transparent;
            color: inherit; font: inherit; font-weight: inherit; line-height: inherit; text-align: inherit; cursor: pointer; }
.sort-btn:hover { background: transparent; border: 0; }
.sort-btn:active { background: transparent; }
.sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sort-ind { display: inline-block; min-width: 1.1em; margin-left: 3px; text-align: center; font-size: .8em; color: var(--accent-fg); }
th.is-sorted { color: var(--accent-fg); }
th.is-sorted .sort-btn { color: var(--accent-fg); }
thead tr.head-2 .sort-btn { white-space: normal; }

/* Шапка как в Google Таблице: заголовки по центру по горизонтали и вертикали, слова переносятся по ширине колонки,
   единая высота шапки (оба ряда по --head1-h = 30px: две строки по 30px вмещают 3 строки заголовка, высота шапки прежняя (60px)).
   Стрелка сортировки остаётся в потоке сразу за последним словом (под неё и раньше резервировалось 1.1em), поэтому
   ширины колонок и перенос слов не меняются; текст вместе со стрелкой стоит по центру (у неотсортированных
   колонок подпись левее геометрического центра ячейки примерно на полстрелки, ~7px). Правила только для thead:
   числа в ячейках по-прежнему вправо. */
thead th, thead th.num, thead th.tree-col { text-align: center; vertical-align: middle; white-space: normal; overflow-wrap: normal; }
thead tr.head-2 th { white-space: normal; height: 30px; }
/* Место под стрелку (3px + 1.1em шрифта стрелки = 14px, как раньше) — поле справа у подписи: оно «приклеено» к
   последнему слову и не уезжает на лишнюю строку. Сама стрелка — absolute без смещений: стоит в этом поле сразу за
   текстом и ширины не занимает, поэтому появление стрелки колонки не раздвигает. */
thead .sort-btn > span:first-child { display: inline; padding-right: 14px; }
thead .sort-ind { position: absolute; min-width: 0; margin-left: -11px; }
/* v3.22.10: заголовки таблицы отчёта строго по центру (и блок, и строки при переносе). Подпись без поля под стрелку
   (раньше padding-right: 14px сдвигал текст влево на полстрелки, у колонок с переносом это выглядело «хаотично»);
   стрелка сортировки лежит в правом поле ячейки (padding th = 12px) и текст не двигает. «Группировка» (дерево) — по левому краю.
   Правила только для #report: таблицы других страниц (forms.css) не затронуты. */
#report thead th, #report thead th.num, #report thead th.group { text-align: center; }
#report thead th.tree-col { text-align: left; }
#report thead .sort-btn, #report thead .sort-btn > span { text-align: center; text-wrap: balance; }
#report thead .sort-btn > span:first-child { display: inline; padding: 0; }
#report thead .sort-ind { position: absolute; top: 50%; right: 2px; margin: 0; min-width: 0; transform: translateY(-50%); }

/* Плоский список по уровню: в первой колонке название и мелкий путь родителей, обе подписи — по одной строке
   с многоточием (полный текст в title), все строки одной высоты (нужно виртуализации). Отступов и «+/−» нет. */
:root { --row-h-flat: 46px; }
tr.row-flat td { height: var(--row-h-flat); vertical-align: middle; padding-top: 0; padding-bottom: 0; }
td.tree-col.flat-cell { padding-left: var(--pad); white-space: nowrap; overflow-wrap: normal; }
.flat-name, .flat-crumb { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flat-name { line-height: 1.3; }
.flat-crumb { font-size: 11.5px; line-height: 1.3; color: var(--muted); }
table.is-virtual tbody tr.row-flat td { height: var(--row-h-flat); }
#load-hint { margin: 8px 0 0; font-size: 13px; }

/* Ручка ширины первой колонки: правая граница липкого заголовка; мышь и touch (touch-action: none), клавиатура (стрелки) */
.col-resizer { position: absolute; top: 0; right: 0; bottom: 0; width: 12px; cursor: col-resize; touch-action: none;
               user-select: none; -webkit-user-select: none; z-index: 6; }
.col-resizer::after { content: ""; position: absolute; top: 8px; bottom: 8px; right: 4px; width: 3px; border-radius: 3px;
                      background: var(--border); transition: background .12s; }
.col-resizer:hover::after, .col-resizer:focus-visible::after, body.is-col-resizing .col-resizer::after { background: var(--accent); }
.col-resizer:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
/* Курсор и запрет выделения - только на body (селектор «body *» заставлял браузер пересчитывать стили всех ячеек большой таблицы).
   Курсор над таблицей остаётся col-resize за счёт захвата указателя ручкой. */
body.is-col-resizing { cursor: col-resize; user-select: none; -webkit-user-select: none; }
/* Линия-подсказка при перетаскивании (v3.40.0): двигается transform, раскладку таблицы не трогает; ширина применяется при отпускании */
.col-guide { position: fixed; left: 0; width: 2px; background: var(--accent); z-index: 60; pointer-events: none; will-change: transform; }
.col-guide::after { content: attr(data-w); position: absolute; top: 4px; left: 6px; padding: 2px 8px; border-radius: 8px; white-space: nowrap;
                    font-size: 12px; font-weight: 600; background: var(--accent); color: var(--accent-text); }
@media (pointer: coarse) { .col-resizer { width: 20px; } .col-resizer::after { right: 8px; } }

/* Кнопка копирования названия: видна при наведении на строку и при фокусе внутри строки; на touch — всегда */
.copy-btn { flex: none; width: 24px; height: 24px; margin-left: 4px; padding: 0; border: 0; border-radius: 8px; background: transparent;
            color: var(--muted); display: inline-flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .1s, color .1s; }
.copy-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.copy-btn .i-ok { display: none; }
.copy-btn:hover { background: var(--grey-2); border: 0; color: var(--text); }
tbody tr:hover .copy-btn, tbody tr:focus-within .copy-btn, .copy-btn:focus-visible, .copy-btn.is-copied { opacity: 1; }
.copy-btn.is-copied { color: var(--green); }
.copy-btn.is-copied .i-copy { display: none; }
.copy-btn.is-copied .i-ok { display: inline; }
@media (hover: none), (pointer: coarse) { .copy-btn { opacity: 1; } }

/* Плашка «Скопировано» (aria-live): внизу экрана, пустая — невидима */
.copy-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 110; max-width: calc(100vw - 32px);
              padding: 8px 14px; border-radius: 12px; background: var(--tip-bg); color: var(--tip-text); font-size: 13px;
              box-shadow: 0 6px 18px var(--shadow); pointer-events: none; transition: opacity .12s; }
.copy-toast:empty { opacity: 0; padding: 0; }
.copy-toast.is-error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); }

/* самые узкие экраны (320-360 px): боковые поля панели меньше (правило — ниже, после блока «Телефон») */

/* Панель «Фильтры» (кнопка и сводка): вне телефона скрыта, фильтры раскрыты как обычно */
.filters-bar { display: none; }
.filters-body { display: grid; gap: 16px; }
.filters-summary { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.filters-toggle { flex: none; }
.filters-toggle::after { content: "▾"; margin-left: 8px; font-size: 11px; }
.filters.is-open .filters-toggle::after { content: "▴"; }

/* ТЕЛЕФОН = ширина <= 600 px (портрет) ИЛИ низкий экран в ландшафте. Тот же список запросов — PHONE_QUERY в
   report-filter-bar.js (сверяет node-тест). Планшет (> 600 px, в т.ч. портрет 768) и десктоп сюда не попадают и не меняются.
   - шапка компактная, «Последнее обновление ТГ бустера» остаётся на виду отдельной строкой;
   - панель фильтров свёрнута в строку «Фильтры ▾ + сводка выбранного», раскрывается кнопкой (выбор хранит JS, sessionStorage);
   - «Раскрыть до» и «Вид» лежат ВНУТРИ панели: при свёрнутой скрыты, при раскрытой переносятся на следующие строки
     (flex-wrap, без горизонтальной прокрутки; вынос из панели в 15a95b0 отменён по просьбе клиента);
   - предупреждение TgBooster и сообщения (ошибка, сброс значений) лежат вне сворачиваемой части и видны всегда. */
@media (max-width: 600px), (max-height: 500px) and (orientation: landscape) {
  .topbar { padding: 8px 12px; gap: 4px 8px; }
  .topbar h1 { font-size: 17px; }
  .topbar-right { gap: 4px 10px; }
  .topbar-right button, .topbar-right .btn-link { height: 32px; }
  .filters { margin: 8px 12px 0; padding: 8px 12px; gap: 8px; border-radius: 14px; }
  .filters-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .filters-toggle { height: 32px; padding: 0 12px; }
  .filters:not(.is-open) .filters-body { display: none; }
  .filters-body { gap: 12px; }
  /* «Раскрыть до» / «Вид» в раскрытой панели: кнопки 32px, группы и кнопки переносятся на новые строки */
  .actions { display: flex; flex-wrap: wrap; gap: 8px 12px; }
  .expand-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
  .expand-tools .btns { flex-wrap: wrap; gap: 6px; min-width: 0; }
  .expand-tools button { flex: 0 1 auto; height: 32px; padding: 0 12px; white-space: nowrap; }
  .expand-tools .field-label { flex: none; }
  .cols-tools .cols-btn { height: 32px; padding: 0 12px; }
  #filters .warn, #filters .notice { padding: 4px 8px; font-size: 13px; }
  .ms-list { max-height: min(240px, 45vh); }
}
/* Портрет телефона: «Последнее обновление» под заголовком (в блоке заголовка); сводка в две строки */
/* ВЫСОТА таблицы на телефоне задаёт report-fit.js (инлайн height/max-height/margin-bottom: видимая высота окна - верх
   таблицы - 8px). max-height ниже (и в блоке ландшафта) — запасной вариант до загрузки скрипта и без JS. */
@media (max-width: 600px) {
  .topbar-right { flex: 1 1 100%; }
  .topbar-title { flex: 1 1 100%; }
  .project-name { font-weight: 700; }
  .filters-summary { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
                     font-size: 12.5px; line-height: 1.3; }
  .table-wrap { margin: 8px 12px 12px; border-radius: 14px; max-height: max(calc(100vh - 230px), 320px);
                max-height: max(calc(100dvh - 230px), 320px); }
}
@media (max-width: 360px) {
  .filters { padding-left: 8px; padding-right: 8px; }
}

/* Низкий экран в ландшафте (телефон повёрнут, высота ~300-500px). Раньше таблица брала calc(100vh - 260px) и после
   панели фильтров от неё оставалась одна строка. Теперь:
   - таблица — почти во весь экран (высота окна минус поля), шапка и первая колонка по-прежнему липкие внутри неё;
   - «Раскрыть до» и «Вид» — внутри сворачиваемой панели (при свёрнутой не занимают высоту);
   - вложенной «ловушки» прокрутки нет: жест внутри таблицы двигает таблицу, а у её края (и по любому месту вне
     таблицы) — страницу (overscroll-behavior: auto — цепочка прокрутки включена явно).
   Высота строк и шапки НЕ меняется: виртуализация и липкие отступы (--head-h) считаются по тем же размерам, что и в портрете. */
@media (max-height: 500px) and (orientation: landscape) {
  .table-wrap { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); margin: 8px 12px; border-radius: 14px;
                overscroll-behavior: auto; scroll-margin-top: 8px; }
}

/* Блок «Режим» (v3.22.1): в первой строке фильтров правее «Этот месяц», отступ 28 px (gap 12 + margin 16); подпись как у полей («Дата с»),
   под ней кнопка с названием текущего режима и значок «?» справа от неё. «Таблица» серая, «Все действия» зелёная. */
.mode-field { position: relative; display: grid; gap: 4px; min-width: 0; margin-left: 16px; font-size: 12px; color: var(--text-2); }
.mode-row { display: inline-flex; align-items: center; gap: 8px; }
.counting-toggle { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px; min-width: 130px;
                   border: 1px solid var(--mode-off-border); background: var(--mode-off-bg); color: var(--mode-off-fg);
                   font-size: 14px; white-space: nowrap; }
.counting-toggle:hover { background: var(--mode-off-hover); border-color: var(--mode-off-border); }
.counting-toggle.is-active { background: var(--mode-on-bg); border-color: var(--mode-on-border); color: var(--mode-on-fg); font-weight: 700; }
.counting-toggle.is-active:hover { background: var(--mode-on-hover); border-color: var(--mode-on-hover); }
/* «?»: круг 24 px, область нажатия 44x44 (псевдоэлемент); без title: подсказку показывает .counting-tip */
.counting-help { position: relative; width: 24px; min-width: 24px; height: 24px; padding: 0; border-radius: 50%; font-size: 13px;
                 font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.counting-help::after { content: ""; position: absolute; inset: -10px; }
.counting-help[aria-expanded="true"] { background: var(--grey-2); border-color: var(--muted); }
.counting-tip { position: absolute; z-index: 40; left: 0; top: calc(100% + 4px); width: max-content; max-width: min(36ch, calc(100vw - 64px));
                padding: 10px 14px; border-radius: 12px; background: var(--tip-bg); color: var(--tip-text); font-size: 13px;
                line-height: 1.45; box-shadow: 0 6px 18px var(--shadow); overflow-wrap: break-word;
                max-height: 45vh; overflow-y: auto; overscroll-behavior: contain; } /* 360x640: подсказка прокручивается внутри (QA-20) */
.counting-tip[hidden] { display: none !important; }
.counting-tip p { margin: 0 0 6px; }
.counting-tip p:last-child { margin-bottom: 0; }
@media (pointer: coarse) {
  .counting-toggle { min-height: 44px; }
  .counting-help { width: 44px; min-width: 44px; height: 44px; }
  .counting-help::after { inset: 0; }
}
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0);
           white-space: nowrap; border: 0; }
/* конверсия больше 100 % в режиме «Все действия» (Q88): звёздочка + скрытый текст для чтения с экрана */
td.conv-over { position: relative; } /* предок для .sr-only: иначе скрытый текст растягивает страницу вширь (QA-01) */
td.conv-over::after { content: "\00a0*"; font-weight: 700; }

/* Телефон: блок «Режим» занимает свою строку внутри панели периода */
@media (max-width: 600px), (max-height: 500px) and (orientation: landscape) {
  #tgb-errors, #message { order: 3; }
  .period .mode-field { grid-column: 1 / -1; margin-left: 0; }
  .counting-toggle { min-height: 44px; }
  .counting-help { width: 44px; min-width: 44px; height: 44px; }
  .counting-help::after { inset: 0; }
}

/* «Загрузить сейчас» в блоке TgBooster (v3.22.14): период, даты, индикатор */
.tgb-period { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.tgb-period .field { min-width: 0; }
.tgb-period select { min-width: 200px; }
.tgb-dates { display: flex; flex-wrap: wrap; gap: 12px; }
.tgb-dates[hidden], .tgb-period [hidden] { display: none; }
.settings input[type="date"] { height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-btn);
                               background: var(--surface); color: var(--text); font: inherit; min-width: 0; }
.settings input[type="date"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#tgb-section [hidden] { display: none; }
#tgb-load-result.is-loading::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
                                      border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
                                      animation: tgb-spin .9s linear infinite; }
@keyframes tgb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #tgb-load-result.is-loading::before { animation: none; } }
@media (max-width: 600px) {
  .tgb-period, .tgb-dates { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .tgb-period select, .settings .tgb-period input[type="date"] { width: 100%; height: 44px; font-size: 16px; }
}

/* Страница «Статистика» (v3.26.0): таблица воронки по проектам. Шрифт и цвета как у отчёта; первый столбец закреплён,
   на телефоне таблица прокручивается по горизонтали ВНУТРИ блока (страница не уезжает вбок) */
.stats-wrap { max-height: none; }
.stats-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stats-table { width: 100%; min-width: 100%; }
.stats-table th, .stats-table td { white-space: nowrap; }
.stats-table thead th { max-width: none; min-width: 96px; vertical-align: middle; }
.stats-table th.num { text-align: center; }
.stats-table th.stat-name { text-align: left; position: sticky; left: 0; z-index: 4; min-width: 200px; background: var(--head-bg); border-right: 1px solid var(--border-soft); }
.stats-table tbody th.stat-name { z-index: 1; background: var(--surface); font-weight: 600; font-size: 14px; color: var(--text); white-space: normal; }
.stats-table td.num { text-align: center; font-variant-numeric: tabular-nums; } /* как в отчёте: значения по центру под заголовком */
.stats-table tr.is-cr th.stat-name, .stats-table tr.is-cr td { color: var(--text-2); font-size: 13px; }
.stats-table tr.is-cr th.stat-name { font-weight: 500; padding-left: 24px; }
.stats-table td.is-nodata { color: var(--muted); }
.stats-table th.is-total, .stats-table td.is-total { background: var(--total); font-weight: 700; border-left: 1px solid var(--border); }
.stats-table th.is-total { color: var(--head-text); }
.stats-note { margin: 0 24px 16px; font-size: 13px; }
.stats-note[hidden] { display: none; }
@media (max-width: 600px) {
  .stats-table th.stat-name { min-width: 150px; }
  .stats-table tbody th.stat-name { font-size: 13px; }
  .stats-note { margin: 0 12px 12px; }
}

/* Боты внутри источника (v3.45.0): заголовок источника - кнопка ▸/▾; подколонки справа от итога источника отделены фоном и
   левой/правой границей; таблица прокручивается по горизонтали внутри .table-wrap (первая колонка закреплена, как раньше) */
/* v3.45.1: Список «Развернуть» и «Столбцы» на одной линии: первый у левого края блока фильтров, вторая справа (на узком экране - перенос
   с тем же порядком: слева «Развернуть», ниже/справа «Столбцы») */
.stats-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 12px; }
.stats-toolbar .stats-bots-tools { position: relative; display: flex; align-items: flex-end; margin: 0; }
.stats-toolbar .cols-tools { margin-left: auto; width: auto; justify-items: end; }
.bots-btn::after { content: "▾"; margin-left: 8px; font-size: 11px; }
.bots-btn[aria-expanded="true"]::after { content: "▴"; }
.bots-btn:disabled { cursor: not-allowed; }
/* Панель - по образцу .cols-pop, но левым краём по левому краю кнопки; вверх (is-up), если снизу не хватает места */
.bots-pop { right: auto; left: 0; min-width: 220px; }
.bots-pop.is-up { top: auto; bottom: calc(100% + 4px); }
.bots-list { display: grid; gap: 2px; }
/* Раскрыт хотя бы один источник или панель открыта (data-active="1"): заливка как у активной вкладки навигации (.subnav a[aria-current]; в тёмной теме - инверсия переменных) */
.bots-btn[data-active="1"] { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); font-weight: 600; }
.bots-btn[data-active="1"]:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.bots-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px), (max-height: 500px) and (orientation: landscape) { .bots-btn { height: 32px; padding: 0 12px; } }
@media (max-width: 600px) {
  .stats-toolbar .cols-tools:has(.cols-pop:not([hidden])), .stats-toolbar .stats-bots-tools:has(.bots-pop:not([hidden])) { width: 100%; justify-items: start; } /* открытая панель - во всю ширину, на своей строке */
  .stats-toolbar .stats-bots-tools { flex-wrap: wrap; gap: 8px; }
  .bots-pop { position: static; min-width: 0; width: 100%; box-sizing: border-box; box-shadow: none; }
}
.stats-history-hint { margin: 12px 24px 0; }
@media (max-width: 600px) { .stats-history-hint { margin: 8px 12px 0; } }
.stats-table th.has-bots { padding: 0; }
.stats-table .src-toggle { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 40px; padding: 0 10px; cursor: pointer; font: inherit; font-weight: inherit; color: inherit; }
.stats-table .src-toggle:hover { background: var(--cols-hover, rgba(127,127,127,.12)); }
.stats-table .src-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.stats-table .src-arrow { font-size: 12px; line-height: 1; }
.stats-table th.is-sub, .stats-table td.is-sub { background: var(--sub-bg, rgba(127,127,127,.08)); font-weight: 500; min-width: 88px; }
.stats-table th.is-sub { display: table-cell; font-size: 13px; }
.stats-table th.is-sub .sub-name { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0 auto; }
.stats-table th.is-sub.is-other { min-width: 150px; }
.stats-table th.is-sub.is-other .sub-name { white-space: normal; max-width: 170px; line-height: 1.25; overflow-wrap: anywhere; }
.stats-table th.is-sub .sub-label { display: block; font-size: 11px; font-weight: 400; color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0 auto; }
.stats-table .is-sub.sub-first { border-left: 2px solid var(--border); }
.stats-table .is-sub.sub-last { border-right: 2px solid var(--border); }
.stats-table td.is-source-sum { font-weight: 700; }
.stats-table tr.is-cr td.is-sub { font-size: 12.5px; }

/* Сравнение периодов (доработка period-compare, п. 2): вторая строка в ячейке — не ломает узкую таблицу
   статистики, т.к. показывается только когда период сравнения заполнен (обычный режим — одна строка, как сейчас).
   Переиспользуем .cell-stack (строка выше, общий паттерн «значение + подпись»), под «Статистику» — своё
   выравнивание по центру (там td.num и так по центру) и компактный gap. */
.stats-table .cell-stack { justify-items: center; gap: 1px; min-width: 0; }
.stats-table td.num .num-main { font-variant-numeric: tabular-nums; }
.stat-delta {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11.5px; line-height: 1.2; font-variant-numeric: tabular-nums;
  color: var(--muted); white-space: nowrap;
}
.stat-delta.is-up { color: var(--positive); }
.stat-delta.is-down { color: var(--danger); }
.stat-delta-arrow { font-size: 9px; line-height: 1; }
/* Доработка после v3.34.6, п.3: значение периода сравнения — первый видимый компонент строки дельты
   (перед стрелкой), приглушённый цвет, моноширинные цифры, небольшой отступ от стрелки. */
.stat-delta-base { color: var(--muted); margin-right: 1px; font-variant-numeric: tabular-nums; }

/* Второй блок периода «Период сравнения» (доработка period-compare, п. 2): визуально как первый .period,
   без required на полях — пустые поля означают «сравнение выключено», это не ошибка. */
.period-label { display: block; width: 100%; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 2px; }
.compare-period { padding-top: 12px; border-top: 1px solid var(--border-soft); }

/* Общая страница «Боты» (v3.26.0): боты сгруппированы по назначению (проекту), у каждого бота подпись назначения */
table.cards tr.group-row th { text-align: left; background: var(--grey); font-weight: 600; padding: 8px 10px; border-top: 1px solid var(--border-soft); }
table.cards tr.group-row .group-name { margin-right: 10px; }
table.cards tr.group-row .group-note { font-weight: 400; }
.bot-dest { white-space: nowrap; }
.tgb-project { max-width: 280px; }
@media (min-width: 1151px) {
  /* v3.27.3: «Название», «Назначение», «Метка» теперь по центру (общее правило); по левому краю остаётся только строка-заголовок группы */
  #bots tr.group-row th { text-align: left; }
}
@media (max-width: 1150px) {
  table.cards tr.group-row { display: block; padding: 0; margin: 14px 0 6px; background: transparent; border: 0; }
  table.cards tr.group-row th { display: block; border: 0; padding: 4px 2px; background: transparent; font-size: 15px; }
}

/* Фильтры по числовым столбцам (v3.30.0): значок воронки в заголовке, рядом с ним условие ("≥ 1", "1–50"); по клику - поповер
   «от» / «до». Только переменные темы; высота шапки не растёт (значок 24 px, на касании 32 px). Поповер лежит в <body>
   (position: fixed), поэтому не обрезается прокруткой таблицы; на узком экране - во всю ширину минус 16 px. */
/* Значок лежит в левом поле ячейки (absolute): подпись заголовка остаётся по центру, высота шапки не меняется.
   Доработка period-compare (п. 1): зазор значок→текст — одна формула «икона + зазор [+ текст условия]» через
   переменные --cf-icon-w/--cf-icon-w-active/--cf-gap (:root), а не три независимо подобранные константы (было:
   14px без фильтра / calc(24px + --cf-w) у is-cf-on / 20px у is-cst-on — разные "базы" для одного и того же значка
   .cf-btn.is-active, отсюда неодинаковый на глаз зазор). Без условия поля симметричны: ширина таблицы почти
   прежняя. При действующем условии растёт только ЛЕВОЕ поле: на значок, зазор и текст условия (--cf-w ставит JS,
   не больше 44 px; дольше - многоточие, полный текст в title). Зона нажатия по высоте 36 px (псевдоэлемент) у
   заголовков первого ряда; в подзаголовках конверсий (высота 30 px) она не больше строки. */
#report thead th.has-cf { padding-left: calc(var(--cf-icon-w) + var(--cf-gap)); padding-right: 14px; min-width: 72px; }
#report thead tr:not(.head-2) th.has-cf { max-width: 114px; }
#report thead th.has-cf.is-cf-on { padding-left: calc(var(--cf-icon-w-active) + var(--cf-gap) + var(--cf-w, 0px)); }
#report thead tr:not(.head-2) th.has-cf.is-cf-on { max-width: calc(122px + var(--cf-w, 0px)); }
/* Столбец «Статус» (значок .cst-btn, без текста условия рядом - сам значок просто шире в .is-active, см.
   .cf-btn.is-active padding 0 3px вместо 0 1px) - та же база «активный значок + зазор», что у is-cf-on, но без
   --cf-w (нет текста условия). Раньше была отдельная константа 20px (хотфикс 2026-10-23), несовпадающая по базе
   с 24px у is-cf-on — отсюда и был разный на глаз зазор для одного и того же значка. */
#report thead th.has-cf.is-cst-on { padding-left: calc(var(--cf-icon-w-active) + var(--cf-gap)); }
/* Откат доработки v3.34.7, п.1 (владелец вернул первую версию, v3.34.6): заголовок столбцов с фильтром
   (.has-cf) снова центрируется, как и все остальные (#report thead th { text-align: center } выше) —
   left-align убран. Зазор значок→текст у широких/двухстрочных столбцов из-за этого на глаз растёт
   пропорционально ширине колонки (ровно то, что v3.34.7 и устраняла), но владелец предпочёл этот
   вариант после сравнения на живом сайте с центрированной группой (v3.34.8, тоже откачена). При
   повторном запросе левого выравнивания — вернуть блок text-align: left для .has-cf/.sort-btn/
   .sort-btn > span:first-child, который стоял здесь (история: коммит 9f96540, v3.34.7). */
.cf-btn { position: absolute; left: 1px; top: 50%; transform: translateY(-50%); z-index: 1; display: inline-flex; align-items: center; justify-content: flex-start; gap: 2px;
          min-width: 12px; height: 24px; margin: 0; padding: 0 1px; border: 1px solid transparent; border-radius: 8px; background: transparent;
          color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.cf-btn::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 24px; transform: translateY(-50%); }
#report thead tr:not(.head-2) .cf-btn::after { height: 36px; }
.cf-btn svg { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.cf-btn:hover { background: var(--grey-2); border-color: transparent; color: var(--text); }
.cf-btn:active { background: var(--grey-2); }
.cf-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cf-btn.is-active { background: var(--cols-bg); color: var(--cols-fg); border-color: var(--cols-border); padding: 0 3px; }
.cf-btn.is-active svg { fill: currentColor; fill-opacity: .3; }
.cf-btn.is-active:hover { background: var(--cols-hover); border-color: var(--cols-open-border); color: var(--cols-fg); }
.cf-btn[aria-expanded="true"] { border-color: var(--accent); }
.cf-cond { max-width: var(--cf-w, 44px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (pointer: coarse) {
  /* касание: значок - кнопка 24 x 24 px (на 5 px заходит в поле соседней ячейки, оно пустое), поля ячейки по той же
     формуле, что и на мышке, только со своими --cf-icon-w/--cf-icon-w-active (значок шире на касании) — та же
     единая формула «икона + зазор [+ текст условия]», что и в основном блоке выше; переопределяем переменные в
     :root на время действия медиа-запроса. */
  :root { --cf-icon-w: 20px; --cf-icon-w-active: 24px; }
  .cf-btn { left: -5px; min-width: 24px; justify-content: center; }
  .cf-btn svg { width: 14px; height: 14px; }
  #report thead th.has-cf { padding-left: calc(var(--cf-icon-w) + var(--cf-gap)); padding-right: 14px; }
  #report thead tr:not(.head-2) th.has-cf { max-width: 114px; }
  #report thead th.has-cf.is-cf-on { padding-left: calc(var(--cf-icon-w-active) + var(--cf-gap) + var(--cf-w, 0px)); }
  #report thead tr:not(.head-2) th.has-cf.is-cf-on { max-width: calc(130px + var(--cf-w, 0px)); }
  #report thead th.has-cf.is-cst-on { padding-left: calc(var(--cf-icon-w-active) + var(--cf-gap)); }
}

/* Поповер фильтра столбца (v3.30.1: компактный вид): ширина ~230 px, поля и кнопка по 32 px, шрифт 13 px, мелкие подписи «от»/«до» */
.cf-pop { position: fixed; z-index: 60; width: min(232px, calc(100vw - 16px)); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; padding: 6px 12px 12px; box-sizing: border-box;
          background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
          box-shadow: 0 6px 18px var(--shadow); font-size: 13px; font-weight: 400; text-align: left; }
.cf-pop[hidden] { display: none; }
.cf-body { display: grid; gap: 8px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px; margin: -2px; }
.cf-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cf-title { padding-top: 2px; font-size: 12px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.cf-close { flex: none; width: 24px; height: 24px; margin-right: -6px; padding: 0; border: 0; border-radius: 6px; background: transparent;
            color: var(--muted); font-size: 18px; line-height: 1; }
.cf-close:hover { background: var(--grey-2); border: 0; color: var(--text); }
.cf-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.cf-field { display: grid; gap: 2px; font-size: 11px; line-height: 1.2; color: var(--text-2); }
.cf-field input { width: 100%; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px;
                  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }
.cf-field input[aria-invalid="true"] { border-color: var(--danger); }
.cf-error { margin: 0; font-size: 12px; line-height: 1.3; color: var(--danger); }
.cf-error[hidden] { display: none; }
.cf-act { width: 100%; height: 32px; padding: 0 10px; font-size: 13px; background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); font-weight: 600; }
.cf-act:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.cf-act[data-mode="reset"] { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.cf-act[data-mode="reset"]:hover { background: var(--danger-hover); border-color: var(--danger); }
/* Устройства с касанием (телефон в любой ориентации, планшет): поля 16 px, иначе iOS приближает страницу при фокусе; крестик ~32 px
   (удобная цель для пальца). На компьютере с мышью - 13 px и маленький крестик */
@media (pointer: coarse) { .cf-field input { font-size: 16px; } .cf-close { width: 32px; height: 32px; font-size: 22px; } }

/* Поповер фильтра «Статус» (доработка campaign-status): три чекбокса вместо полей «от»/«до» (.cf-pop/.cf-head/
   .cf-body/.cf-act переиспользуются как есть). */
.cst-list { display: grid; gap: 6px; }
.cst-item { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.cst-item input { flex: none; width: 16px; height: 16px; }
@media (pointer: coarse) { .cst-item input { width: 20px; height: 20px; } }
.cst-count { color: var(--muted); }

/* Столбец «Статус»: текстовая колонка (не метрика) — по левому краю, без моноширинных цифр (заголовок th.has-cf
   уже выровнен по центру общим правилом thead th) */
#report td.status { text-align: left; font-variant-numeric: normal; }

.row-empty td { position: static; padding: 18px 12px; border-bottom: 0; color: var(--muted); white-space: normal; text-align: left; }
.row-empty td > span { position: sticky; left: 12px; display: inline-block; max-width: calc(100vw - 80px); }

/* Источники статистики на странице «Боты» (v3.38.0): форма «Название + Добавить источник» над таблицей; подпись столбца и счётчик ботов
   по центру, как остальные таблицы настроек. Цвета - только через переменные темы (светлая и тёмная). */
.ss-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 12px 0 4px; }
.ss-form .field { flex: 1 1 260px; max-width: 420px; }
.ss-form[hidden], #ss-section [hidden] { display: none; }
.ss-form input[type="text"] { height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-btn);
                              background: var(--surface); color: var(--text); font: inherit; min-width: 0; }
.ss-form input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#ss-hint { margin: 4px 0 12px; font-size: 13px; }
#ss-table td .ss-label { font-weight: 600; letter-spacing: .02em; }
#ss-table tr.is-off td { color: var(--muted); }
#ss-table td.num, #ss-table th.num { text-align: center; }
@media (max-width: 600px) {
  .ss-form .field { flex: 1 1 100%; max-width: none; }
  .ss-form input[type="text"] { width: 100%; height: 44px; font-size: 16px; }
  .ss-form button { width: 100%; min-height: 44px; }
}
#dlg-ss-edit input[type="text"] { height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-btn);
                                  background: var(--surface); color: var(--text); font: inherit; width: 100%; box-sizing: border-box; }
