/* Аудит Директа — design system reused from Test-system: neutral admin-panel
   language (system-ui font, #2563eb accent, CSS token surfaces), light/dark
   via html[data-theme]. Severity/verdict/finding components are this app's
   own, restyled onto the shared tokens. */

:root {
  --fg: #1a1a1a;
  --muted: #6b7280;
  --muted-2: #9aa1ab;
  --bg: #ffffff;
  --bg-subtle: #f6f7f9;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --danger: var(--sev-critical);
  --ok: #2a9252;
  --radius: 6px;
  --gap: 1rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --gap-tight: .625rem;   /* 10px — шаг внутри плотных блоков */
  --fs-ui: 13.5px;        /* размер служебного текста: кнопки, табы, мета */
  --fs-ui-sm: 12.5px;     /* вторая строка в ячейках, подписи */
  --topbar-h: 44px;       /* было 53px */

  /* Шкала балла / severity — набор «Синий → красный» (дивергентная, читается
     при дальтонизме). ОДИН цвет на зону для обеих тем: сплошной цвет (число,
     полоса, точка) в тёмной теме НЕ переопределяется. Плашка и текст
     смешиваются из него с --bg / --fg текущей темы, поэтому оттенок тот же,
     а контраст подстраивается сам. Все пять зон: --cf-top «Отлично» (синий),
     --cf-ly «Хорошо» (бирюзовый) — в Cash Flow-блоке ниже; --sev-medium,
     --sev-high, --sev-critical — здесь. --ok остаётся зелёным «успехом»
     (статусы, галочки) и в шкалу не входит, как и --sev-low (серый).
     Сплошные цвета держат ≥3:1 на тёмной карточке; жёлтый и бирюзовый на
     белом ниже 3:1 — балл всегда подписан словом, цвет не единственный сигнал. */
  --sev-critical: #d03739; --sev-high: #df7421; --sev-medium: #d1ac4e;
  --sev-critical-tint: color-mix(in oklab, var(--sev-critical) 18%, var(--bg));
  --sev-critical-text: color-mix(in oklab, var(--sev-critical) 50%, var(--fg));
  --sev-high-tint:     color-mix(in oklab, var(--sev-high) 18%, var(--bg));
  --sev-high-text:     color-mix(in oklab, var(--sev-high) 50%, var(--fg));
  --sev-medium-tint:   color-mix(in oklab, var(--sev-medium) 18%, var(--bg));
  --sev-medium-text:   color-mix(in oklab, var(--sev-medium) 50%, var(--fg));
  /* Статусы — тоже из токенов темы, поэтому красятся вместе с ней и одинаково
     читаются в обоих режимах: «в работе» / info — от акцента, «ожидает» —
     от нейтральных цветов, «готово» — от --ok, «вручную» — от --sev-medium.
     Менять их под тему не нужно: достаточно задать --accent, --ok и шкалу. */
  --sev-low: var(--muted);
  --sev-low-tint: color-mix(in oklab, var(--fg) 7%, var(--bg));
  --sev-low-text: color-mix(in oklab, var(--fg) 62%, var(--bg));
  --ok-tint: color-mix(in oklab, var(--ok) 16%, var(--bg));
  --ok-text: color-mix(in oklab, var(--ok) 55%, var(--fg));
  --info-tint: color-mix(in oklab, var(--accent) 13%, var(--bg));
  --info-text: color-mix(in oklab, var(--accent) 62%, var(--fg));
  --override-tint: color-mix(in oklab, var(--sev-medium) 18%, var(--bg));
  --override-text: color-mix(in oklab, var(--sev-medium) 55%, var(--fg));

  /* design_handoff_client_profile/ второй пакет: правила, поповеры, чипы, сплит */
  --switch-off: #d5d8dd;     /* фон выключенного тумблера */
  --row-flag: #fbfcfd;       /* фон строки «изменено / есть переопределение» */
  --pop-shadow: 0 8px 22px color-mix(in oklab, var(--fg) 14%, transparent);
  --field-strong: #cfd4db;   /* dashed-рамки кнопок «+ условие» */
  --bg-raised: #f6f7f9;      /* шапки таблиц и групп (light — совпадает с --bg-subtle) */
  --border-strong: #e5e7eb;  /* рамки полей ввода (light — совпадает с --border) */
}

/* Нативные элементы в цвет темы: галочки, радио, ползунки, курсор в поле,
   выделение текста, полосы прокрутки. accent-color / caret-color / scrollbar-color
   наследуются, поэтому хватает корня. */
:root { accent-color: var(--accent); caret-color: var(--accent); scrollbar-color: var(--border-strong) transparent; }
::selection { background: color-mix(in oklab, var(--accent) 30%, transparent); color: inherit; }

[x-cloak] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

* { box-sizing: border-box; }
button, select, input, table { font-family: inherit; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg-subtle);
  color: var(--fg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- шапка ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px;
  height: var(--topbar-h); padding: 0 22px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: var(--fs-ui); line-height: 1; color: var(--fg); text-decoration: none; }
.topbar nav { display: flex; gap: 16px; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: var(--fs-ui); transition: color 0.15s; }
.topbar nav a:hover { color: var(--fg); text-decoration: none; }
.topbar nav a.active { color: var(--fg); font-weight: 600; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 15px; font-size: var(--fs-ui); }

/* путь «Cash Flow / Клиент ▾» (base.html) */
.topbar-trail { display: flex; align-items: center; gap: 4px; min-width: 0; }
.topbar-trail .sep { margin: 0 4px; color: var(--muted-2); font-size: 15px; line-height: 1; }
.trail-root { display: contents; }
.topbar-link { color: var(--muted); font-size: var(--fs-ui); transition: color 0.15s; }
.topbar-link:hover { color: var(--fg); text-decoration: none; }
.topbar-link.active { color: var(--fg); font-weight: 600; }
/* последний шаг пути (имя объекта может быть длинным) сжимается с «…» */
.topbar-trail .step-here { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* меню аккаунта: кружок с инициалом; точка — ждут заявки на регистрацию (админу) */
.account-menu > summary { display: flex; }
.avatar {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px; flex: none;
  background: color-mix(in oklab, var(--accent) 16%, var(--bg)); color: var(--accent);
  font-size: 12px; font-weight: 700; line-height: 1;
}
.account-menu[open] .avatar { box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 35%, transparent); }
.avatar-pip {
  position: absolute; top: -2px; right: -2px; width: 9px; height: 9px; border-radius: 999px;
  background: var(--accent); border: 2px solid var(--bg);
}
.account-menu .pop-body { top: calc(100% + 8px); min-width: 230px; max-width: calc(100vw - 32px); }
.account-who { padding: 7px 8px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border); line-height: 1.35; }
.account-who b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.account-who span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.account-menu .menu-item .settings-nav-badge { margin-left: auto; }
.account-menu .account-who + .menu-item-form { margin-top: 0; padding-top: 0; border-top: 0; }

/* Переключатель клиента в шапке: поле-таблетка вместо кнопки + панели с
   вторым полем. В покое компактное (на странице клиента — точка и имя, как
   ступень пути), по фокусу растёт до ширины самого длинного имени, а панель
   под ним — только список той же ширины. Ширины --w-closed / --w-open
   считает client_switcher.js по именам клиентов (запасные значения — здесь). */
.client-switcher { position: relative; margin-left: 6px; flex: none; width: var(--w-closed, 200px); }
/* ширина анимируется только после первого открытия: при загрузке страницы JS
   подставляет --w-closed, и без этого шеврон «ехал» бы на новое место */
.client-switcher.anim { transition: width .16s ease; }
.client-switcher.open { width: var(--w-open, 340px); }
.client-switcher.has-cur { margin-left: 0; }
@media (prefers-reduced-motion: reduce) { .client-switcher.anim { transition: none; } }
.client-switcher .box {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: var(--bg-subtle); color: var(--muted-2); cursor: text;
}
.client-switcher.open .box { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.client-switcher .box svg { width: 14px; height: 14px; flex: none; }
.client-switcher .lens { display: inline-flex; }
.client-switcher .chev { display: none; cursor: pointer; }
.client-switcher input {
  flex: 1; min-width: 0; width: auto; display: block; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none;
  font: inherit; font-size: var(--fs-ui); color: var(--fg);
}
.client-switcher input:focus { border: 0; box-shadow: none; }
.client-switcher input::placeholder { color: var(--muted); }
/* страница клиента: в покое вместо поля — точка и имя-ссылка на страницу
   клиента и отдельная зона 🔍, которая открывает список (по клику это поле поиска) */
.client-switcher .cur-link {
  display: none; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 32px; padding: 0 6px 0 8px;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: var(--fs-ui); font-weight: 600; color: var(--fg);
}
.client-switcher .cur-link:hover { background: var(--bg-subtle); text-decoration: none; }
.client-switcher .cur-link .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-switcher.has-cur:not(.open) .cur-link { display: flex; }
.client-switcher.has-cur:not(.open) input,
.client-switcher.has-cur:not(.open) .lens { display: none; }
.client-switcher.has-cur:not(.open) .box { padding: 0; gap: 0; background: transparent; cursor: default; }
.client-switcher.has-cur:not(.open) .box:hover { background: transparent; }
.client-switcher .chev {
  align-items: center; justify-content: center; padding: 0; border: 0; background: transparent;
  color: inherit; font: inherit;
}
.client-switcher.has-cur:not(.open) .chev {
  display: inline-flex; width: 26px; height: 32px; border-radius: 0 var(--radius) var(--radius) 0; color: var(--muted-2);
}
/* кнопка нужна только в покое на странице клиента (лупа открывает поиск);
   в самом поле — своя лупа слева, второй кнопки там нет */
.client-switcher.has-cur:not(.open) .chev:hover { background: var(--bg-subtle); color: var(--fg); }
/* на страницах глубже клиента в пути есть следующий шаг: в покое поле по
   содержимому, иначе между ▾ и «Аудит №N» повисает пустота (--w-closed
   остаётся минимумом в 110px); открытому полю ширину по-прежнему задаёт JS */
.client-switcher.has-cur:not(.open) { width: auto; }
.client-switcher .dot { width: 6px; height: 6px; border-radius: 999px; flex: none; }
.dot-ok { background: var(--ok); }
.dot-danger { background: var(--danger); }
/* защита по умолчанию: любая иконка спрайта без своего компонентного
   правила размера (кнопка/таб/next-steps/…) не должна раздуваться до
   собственных intrinsic-размеров SVG */
svg.ico { width: 14px; height: 14px; flex: none; }

.client-switcher .panel {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  padding: 6px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--pop-shadow);
}
.client-switcher.open .panel { display: block; }
.client-switcher-empty { margin: 8px 4px; padding: 0; font-size: 12.5px; color: var(--muted); text-align: center; }

.client-switcher ul {
  margin: 0; padding: 0; list-style: none;
  /* ровно 10 строк (34px каждая) видно без прокрутки, дальше — скролл */
  max-height: 340px; overflow-y: auto;
}
.client-switcher li { margin: 0; }
.client-switcher li[hidden] { display: none; }
.client-switcher li a {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px; border-radius: 4px;
  color: var(--fg); text-decoration: none; font-size: 13px; white-space: nowrap;
}
.client-switcher li a:hover { background: var(--bg-subtle); }
/* текущий клиент — акцентный фон и галочка (не серый, как у наведения);
   «#id» только у клиентов с одинаковым именем */
.client-switcher li.cur a { background: color-mix(in oklab, var(--accent) 11%, var(--bg)); color: var(--accent); font-weight: 600; }
.client-switcher .tail { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding-left: 12px; }
.client-switcher .tail .ck { width: 13px; height: 13px; color: var(--accent); }
.client-switcher .tail .id { font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--muted-2); }

@media (max-width: 640px) {
  .client-switcher { --w-closed: 140px; }
  .client-switcher.open { width: min(var(--w-open, 340px), 62vw); }
  /* узкий экран: в пути остаётся «● Клиент ▾ / шаги», начало «Cash Flow /»
     прячется — к списку клиентов ведёт ▾, на главную — логотип в шапке страницы */
  .topbar-trail.in-client .trail-root { display: none; }
}

/* хлебные крошки: «Клиенты › Клиент › Отчёт №N» */
.crumbs { font-size: 0.86rem; color: var(--muted-2); margin: 0 0 10px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.crumbs .sep { margin: 0 7px; }

.container { max-width: 1080px; margin: 22px auto 40px; padding: 0 20px; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-header h1 { margin: 0; }
.page-header .muted { max-width: 640px; }

/* появление страницы — один спокойный такт */
@media (prefers-reduced-motion: no-preference) {
  .container > * { animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) backwards; }
  .container > *:nth-child(2) { animation-delay: 0.05s; }
  .container > *:nth-child(3) { animation-delay: 0.1s; }
  .container > *:nth-child(n+4) { animation-delay: 0.15s; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
}

/* ---------- типографика ---------- */
h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.25; margin: 0 0 6px; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 12px; }
.eyebrow {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted-2); margin: 0 0 6px;
}
.muted { color: var(--muted); font-weight: 400; }
.muted-2 { color: var(--muted-2); font-weight: 400; }
.small { font-size: 0.86rem; }
.error { color: var(--danger); }

/* ---------- карточки, формы ---------- */
.card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px;
}
.card.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }

label { display: block; margin: 12px 0; font-size: 0.92rem; color: var(--muted); }
label input, label select, label textarea { display: block; margin-top: 5px; width: 100%; }
input, select, textarea {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: 0.95rem; color: var(--fg); background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

/* ---------- кнопки (портировано из Test-system: .btn/.btn-primary/.btn-ghost/.btn-danger) ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit; font-size: var(--fs-ui); font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:hover { text-decoration: none; background: var(--bg-subtle); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; flex: none; color: var(--muted); }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); padding: 6px 12px; font-weight: 600; }
/* hover темнее акцента темы — в тёмной теме тоже (было #4f88f0 при #6ea8fe) */
.btn-primary:hover { background: color-mix(in oklab, var(--accent) 85%, #000); border-color: color-mix(in oklab, var(--accent) 85%, #000); }
.btn-primary svg { width: 13px; height: 13px; color: currentColor; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-subtle); border-color: var(--muted-2); }
.btn-danger { background: var(--sev-critical); color: #fff; border-color: var(--sev-critical); }
.btn-danger:hover { background: color-mix(in oklab, var(--sev-critical) 82%, #000); border-color: color-mix(in oklab, var(--sev-critical) 82%, #000); }
.btn-danger svg { color: currentColor; }
.btn-danger-ghost { background: transparent; color: var(--sev-critical-text); border-color: var(--border); }
.btn-danger-ghost:hover { background: var(--sev-critical-tint); border-color: var(--sev-critical); }
.btn-danger-ghost svg { color: currentColor; }
.btn-sm { padding: 5px 10px; font-size: var(--fs-ui-sm); }
.btn-wide { display: flex; width: 100%; justify-content: center; text-align: center; margin-top: 8px; }
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }
/* кнопка без подписи — только иконка (напр. «Удалить клиента») */
.btn-icon { padding: 6px 8px; }
.btn-icon svg { width: 15px; height: 15px; }
.btn-icon.btn-danger-ghost { border-color: transparent; }
/* disabled-состояние «Запустить аудит», когда клиент не подключён к Директу */
.btn[aria-disabled="true"] {
  border-color: #d1d5db; background: var(--bg-subtle); color: var(--muted-2);
  cursor: not-allowed; pointer-events: none;
}
.btn[aria-disabled="true"] svg { color: var(--muted-2); }

/* ---------- модальные окна ---------- */
dialog.modal {
  border: 0; border-radius: 10px; padding: 26px 28px;
  width: min(430px, calc(100vw - 32px));
  background: var(--bg); color: var(--fg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}
dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
dialog.modal[open] { animation: modal-in 0.2s cubic-bezier(0.2, 0.7, 0.3, 1); }
dialog.modal[open]::backdrop { animation: fade-in 0.2s ease; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
}
@keyframes fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  dialog.modal[open], dialog.modal[open]::backdrop { animation: none; }
}
dialog.modal h2 { margin-bottom: 8px; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px;
}
.modal-schedule { width: min(560px, calc(100vw - 32px)); }
/* «Добавить клиента»: поле сразу под заголовком, ниже — три шага пути
   (создать → подключить Директ → аудит) вместо абзаца пояснения */
dialog.modal-add-client { padding: 22px 24px; }
dialog.modal-add-client h2 { margin-bottom: 0; }
dialog.modal-add-client label { margin: 12px 0 0; }
dialog.modal-add-client .modal-actions { margin-top: 18px; }
.add-steps { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 9px; }
.add-steps li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; font-size: 0.86rem; color: var(--muted); line-height: 1.4; }
.add-steps i {
  width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border-strong);
  display: grid; place-items: center; font: 600 11px/1 var(--font); font-style: normal; color: var(--muted-2);
}
.add-steps li.on i { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.add-steps b { color: var(--fg); font-weight: 600; }

/* Shared confirm dialog (window.appConfirm) — ported from Test-system. */
.confirm-modal {
  position: fixed; inset: 0;
  z-index: 1100;
  align-items: center; justify-content: center;
  padding: 1.5rem;
}
.confirm-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}
.confirm-modal__panel {
  position: relative;
  width: min(440px, 95vw);
  background: var(--bg);
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  padding: 1.1rem 1.2rem 1rem;
  display: flex; flex-direction: column; gap: 0.8rem;
}
.confirm-modal__title { margin: 0; font-size: 1.05rem; font-weight: 600; }
.confirm-modal__body { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.confirm-modal__field { display: flex; flex-direction: column; gap: 0.35rem; }
.confirm-modal__label { font-size: 0.82rem; color: var(--muted); }
.confirm-modal__label code {
  font-family: var(--mono); background: var(--bg-subtle);
  padding: 0.05rem 0.3rem; border-radius: 3px; font-size: 0.85rem; color: var(--fg);
}
.confirm-modal__input {
  padding: 0.45rem 0.6rem; font-size: 0.95rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--fg); font-family: var(--mono);
}
.confirm-modal__input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.confirm-modal__checkbox { display: flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; user-select: none; cursor: pointer; }
.confirm-modal__actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.2rem; }

/* ---------- таблицы ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table td { font-variant-numeric: tabular-nums; }
.table th { background: var(--bg-subtle); color: var(--muted-2); font-weight: 500; font-size: 11.5px; letter-spacing: 0.02em; padding: 8px 12px; white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--muted); }
.table th.sortable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.table th.sortable::after { content: '↕'; margin-left: 4px; opacity: 0.4; }
.table th.sortable[aria-sort="ascending"]::after { content: '↑'; opacity: 1; }
.table th.sortable[aria-sort="descending"]::after { content: '↓'; opacity: 1; }
/* Пагинируемые таблицы Cash Flow сортируются по клику на ссылку в заголовке
   (перезагрузка страницы с новым sort/dir), а не JS-модулем table_sort.js —
   ссылка занимает всю ячейку, чтобы кликабельная область совпадала с
   таблицами, сортируемыми на клиенте. Индикатор сортировки живёт внутри
   ссылки, чтобы шапка оставалась в одну строку. */
.table th.sortable:has(a.sort-link)::after { content: none; }
.table th.sortable a.sort-link { display: block; margin: -8px -12px; padding: 8px 12px; color: inherit; text-decoration: none; }
.table th.sortable a.sort-link::after { content: '↕'; margin-left: 4px; opacity: 0.4; }
.table th.sortable[aria-sort="ascending"] a.sort-link::after { content: '↑'; opacity: 1; }
.table th.sortable[aria-sort="descending"] a.sort-link::after { content: '↓'; opacity: 1; }
.table th.sortable a.sort-link:hover { color: var(--muted); }
.table th.sortable a.sort-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* у колонки с «(?)» ссылка сортировки — строчная, иначе поповер уходит на вторую строку */
.table th.sortable:has(.pop) a.sort-link { display: inline-block; margin: 0; padding: 0; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
.table-scroll { overflow-x: auto; }
.table tbody tr.row-clickable { cursor: pointer; transition: background 0.12s; }
.table tbody tr.row-clickable:hover { background: var(--bg-subtle); }

/* широкая таблица кампаний: компактнее, заголовки и числа не переносятся */
.campaigns-table { font-size: var(--fs-ui-sm); }
.campaigns-table th, .campaigns-table td { padding: 11px 10px; }
.campaigns-table th { white-space: nowrap; font-size: 11.5px; padding: 8px 10px; }
.campaigns-table th.sortable::after { margin-left: 2px; }
.campaigns-table td.num { white-space: nowrap; }
.campaigns-table td:first-child { min-width: 160px; }
.audits-table tbody tr { transition: background 0.12s; }
.audits-table tbody tr:hover { background: var(--bg-subtle); }
.audits-table tbody tr.row-clickable { cursor: pointer; }
.audits-table tbody tr.row-clickable:hover { background: var(--bg-subtle); }

.client-card.row-clickable { cursor: pointer; }
.client-card.row-clickable:hover { background: var(--bg-subtle); }
.client-card.row-clickable .table-scroll { cursor: auto; }

/* ---------- уведомления ---------- */
.alert { padding: 0.6rem 0.8rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-error { background: var(--sev-critical-tint); border: 1px solid var(--sev-critical); color: var(--sev-critical-text); }
.alert-success { background: var(--ok-tint); border: 1px solid var(--ok); color: var(--ok-text); }

/* ---------- пустые состояния ---------- */
.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}
.empty .btn-primary { margin-top: 0.5rem; }

/* ---------- бейджи ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; }

.status-pending   { background: var(--sev-low-tint); color: var(--sev-low-text); }
.status-planned   { background: var(--bg-subtle); color: var(--muted); border: 1px dashed var(--muted-2); }
.status-planned::before { content: none; }
.row-planned td { color: var(--muted); }
.status-fetching, .status-analyzing { background: var(--info-tint); color: var(--info-text); }
.status-done      { background: var(--ok-tint); color: var(--ok-text); }
.status-failed    { background: var(--sev-critical-tint); color: var(--sev-critical-text); }
.status-pending::before, .status-fetching::before, .status-analyzing::before,
.status-done::before, .status-failed::before { content: none; }

/* статусы Cash Flow — своя шкала enum'ов (task 04) */
.status-draft, .status-cancelled { background: var(--sev-low-tint); color: var(--sev-low-text); }
.status-queued, .status-running  { background: var(--info-tint); color: var(--info-text); }
.status-completed                { background: var(--ok-tint); color: var(--ok-text); }
.status-partial                  { background: var(--sev-medium-tint); color: var(--sev-medium-text); }
.status-draft::before, .status-cancelled::before, .status-queued::before, .status-running::before,
.status-completed::before, .status-partial::before { content: none; }

.schedule-badge { background: var(--info-tint); color: var(--info-text); font-weight: 500; }
.schedule-badge::before { content: none; }

.sev-critical { background: var(--sev-critical-tint); color: var(--sev-critical-text); }
.sev-critical::before { background: var(--sev-critical); }
.sev-high     { background: var(--sev-high-tint); color: var(--sev-high-text); }
.sev-high::before { background: var(--sev-high); }
.sev-medium   { background: var(--sev-medium-tint); color: var(--sev-medium-text); }
.sev-medium::before { background: var(--sev-medium); }
.sev-low      { background: var(--sev-low-tint); color: var(--sev-low-text); }
.sev-low::before { background: var(--sev-low); }

/* ---------- клиенты ---------- */
.client-card { padding: 20px 24px 14px; transition: border-color 0.15s; }
.client-card:hover { border-color: var(--muted-2); }
.client-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap; margin-bottom: 10px;
}
.client-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.client-id h2 { margin: 0; }
.client-id p { margin: 1px 0 0; }
.row-link { color: var(--fg); font-weight: 500; }
.client-link { color: var(--fg); text-decoration: none; }
.client-link:hover { text-decoration: underline; text-decoration-color: var(--muted-2); text-underline-offset: 3px; }
.check-yes { color: var(--ok-text); font-weight: 600; }
.check-no { color: var(--muted-2); }
.no-audits { margin: 4px 0 10px; }

td.row-actions { text-align: right; white-space: nowrap; }

.sev-dots { display: inline-flex; gap: 12px; flex-wrap: wrap; }
.sev-dot {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.88rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.sev-dot i { width: 9px; height: 9px; border-radius: 50%; }
.ok-note { color: var(--ok-text); font-weight: 500; font-size: 0.9rem; }

.empty-state { text-align: center; padding: 52px 24px; }
.empty-state h2 { margin-bottom: 6px; }
.empty-state p { max-width: 380px; margin: 0 auto 20px; }
.empty-mark {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-fg);
  font-size: 1.4rem; font-weight: 700;
}

/* ---------- вход (7a) ---------- */
.login-page .topbar { display: none; }
.login-page .container { max-width: 400px; margin-top: max(48px, 12vh); }
.login-card { max-width: 340px; margin-left: auto; margin-right: auto; padding: 18px 20px; }
/* sign-up honeypot (register.html): out of sight and out of the tab order,
   but still a real input that form-filling bots find and fill */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.auth-hero { text-align: center; margin-bottom: 20px; }
.auth-hero h1 { font-size: 16px; margin: 0; }
.auth-hero p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted-2); }
.auth-card { padding: 24px 26px; }
.auth-footnote { text-align: center; font-size: 12.5px; color: var(--muted-2); margin-top: 14px; }
.auth-footnote a { color: inherit; }
/* 152-ФЗ consent box on /register: checkbox beside its text, not stacked */
.consent-check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; }
.consent-check input { width: auto; flex: none; margin-top: 2px; }
.consent-note { margin: 0 0 12px; font-size: 12px; }

/* ---------- /legal/* (consent, privacy policy) ---------- */
.login-page .container:has(.legal-doc) { max-width: 760px; margin-top: 32px; }
.legal-doc { padding: 24px 28px; line-height: 1.55; }
.legal-doc h1 { font-size: 20px; margin: 0 0 4px; }
.legal-doc h2 { font-size: 15px; margin: 22px 0 6px; }
.legal-doc .legal-draft {
  margin: 12px 0 18px; padding: 10px 14px; border-radius: var(--radius);
  border: 2px dashed var(--danger); color: var(--danger); font-weight: 700; text-align: center;
}

/* ---------- публичная страница подключения (7c/7d) ---------- */
.public-card { padding: 20px 22px; overflow: hidden; }

/* --- цветная шапка + сворачиваемые подробности (вариант C).
   invite — акцент; granted/denied/problem — по семантике (--ok / нейтраль / --danger). --- */
.pc-hero {
  display: flex; align-items: center; gap: 12px;
  margin: -20px -22px 16px; padding: 18px 22px;
  background: var(--accent); color: var(--accent-fg);
}
.pc-hero--ok     { background: color-mix(in oklab, var(--ok) 86%, #000); color: #fff; }
.pc-hero--muted  { background: color-mix(in oklab, var(--fg) 72%, var(--bg)); color: var(--bg); }
.pc-hero--bad    { background: var(--sev-critical); color: #fff; }
html[data-theme="dark"] .pc-hero--ok    { background: color-mix(in oklab, var(--ok) 34%, var(--bg)); color: color-mix(in oklab, var(--ok) 18%, #fff); }
html[data-theme="dark"] .pc-hero--muted { background: var(--bg-raised); color: var(--fg); }
html[data-theme="dark"] .pc-hero--bad   { background: color-mix(in oklab, var(--sev-critical) 40%, var(--bg)); color: #fff; }
.pc-hero-ico {
  flex: none; width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center; background: rgba(255, 255, 255, .16);
}
.pc-hero-ico svg { width: 18px; height: 18px; color: currentColor; }
h1.pc-hero-agency { margin: 0; font-size: 15px; font-weight: 650; line-height: 1.25; }
.pc-hero-sub { margin: 2px 0 0; font-size: 12.5px; line-height: 1.4; opacity: .85; }

.pc-folds { margin-top: 14px; border-top: 1px solid var(--border); }
.pc-fold { border-bottom: 1px solid var(--border); }
.pc-fold > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0; font-size: 13px; font-weight: 500; color: var(--fg);
}
.pc-fold > summary::-webkit-details-marker { display: none; }
.pc-fold-chev {
  flex: none; width: 14px; height: 14px; color: var(--muted-2);
  transition: transform .15s;
}
.pc-fold[open] > summary .pc-fold-chev { transform: rotate(180deg); }
.pc-fold-body { padding: 0 0 12px 22px; }
.pc-fold-body p {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 6px 0 0; font-size: 12.5px; line-height: 1.45;
}
.pc-fold-body p:first-child { margin-top: 0; }
.pc-fold-body .ico { flex: none; width: 13px; height: 13px; margin-top: 2px; }

/* ---------- новый аудит ---------- */
.period-options { display: grid; gap: 8px; margin: 14px 0; }
.period-option {
  display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--fg); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.period-option:hover { border-color: var(--muted-2); }
.period-option:has(input:checked) { border-color: var(--accent); background: var(--bg-subtle); }
.period-option input { width: auto; margin: 0; }
.dates { display: flex; gap: 12px; margin: 4px 0 14px; }
.dates label { flex: 1; margin: 0; }

/* ---------- расписание аудитов ---------- */
.schedule-summary {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap;
}
.schedule-summary h2 { margin-bottom: 4px; }
.schedule-summary p { margin: 0; }
.schedule-form .schedule-toggle { display: inline-flex; margin: 10px 0 14px; }
.schedule-controls { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.schedule-controls label { flex: 1 1 160px; max-width: 240px; margin: 0; font-size: 0.9rem; }
.schedule-delete { margin-top: 12px; }

/* ---------- статус аудита ---------- */
.progress-track {
  height: 6px; border-radius: 999px; background: var(--bg-subtle);
  overflow: hidden; margin: 18px 0 10px; position: relative;
  border: 1px solid var(--border);
}
.progress-track::after {
  content: ""; position: absolute; inset: 0; width: 40%; border-radius: 999px;
  background: var(--accent); animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(280%); }
}
@media (prefers-reduced-motion: reduce) {
  .progress-track::after { animation: none; width: 100%; opacity: 0.25; }
}

/* этапы аудита (5c) — список вместо indeterminate-полосы */
.stage-badge { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; }
.steps { margin: 14px 0 10px; }
.step { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13.5px; }
.step-name { color: var(--muted-2); }
.step.is-done .step-name { color: var(--fg); }
.step.is-running .step-name { color: var(--fg); font-weight: 600; }
.step-detail { margin-left: auto; font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.step.is-running .step-detail { color: var(--muted); font-weight: 400; }
.step-mark {
  flex: none; width: 18px; height: 18px; border-radius: 999px;
  display: grid; place-items: center;
}
.step-mark.is-done { background: var(--ok-tint); }
.step-mark.is-done svg { width: 10px; height: 10px; color: var(--ok-text); }
.step-mark.is-running { border: 2px solid var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.step-mark.is-pending { border: 1px dashed var(--border-strong); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .step-mark.is-running { animation: none; border-top-color: var(--accent); } }

.progress-thin { height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; margin: 10px 0 14px; }
.progress-thin > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }

/* причина падения (5d) */
.fail-reason {
  display: flex; gap: 10px; padding: 12px 13px; border-radius: var(--radius);
  background: color-mix(in oklab, var(--sev-critical) 7%, var(--bg));
  border: 1px solid color-mix(in oklab, var(--sev-critical) 24%, var(--bg));
}
.fail-reason svg { flex: none; width: 15px; height: 15px; color: var(--sev-critical); margin-top: 1px; }
.fail-reason b { display: block; font-size: 13.5px; color: var(--sev-critical-text); margin-bottom: 2px; }
.fail-reason p { margin: 0; font-size: 13px; color: var(--muted); }

.tech { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.tech > summary {
  display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: 12.5px; color: var(--muted);
}
.tech > summary::-webkit-details-marker { display: none; }
.tech > summary svg { width: 11px; height: 11px; transition: transform .15s; }
.tech[open] > summary svg { transform: rotate(90deg); }
.tech-copy { margin-left: auto; }
.tech-body {
  margin-top: 8px; padding: 8px 9px; border-radius: 5px; background: var(--bg-subtle);
  border: 1px solid var(--border); font-family: var(--mono); font-size: 11.5px;
  line-height: 1.6; color: var(--muted); white-space: pre-wrap; word-break: break-word;
}

/* ---------- отчёт: заголовок ---------- */
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.report-head .meta { color: var(--muted); font-size: var(--fs-ui-sm); margin: 5px 0 0; }
.report-actions { display: flex; gap: 6px; flex: none; }

/* ---------- профиль клиента: заголовок, галочка подключения, табы, полоса-уведомление ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.profile-head .report-actions { margin-left: auto; }

.connected-check {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 18px; height: 18px; border-radius: 999px;
  background: var(--ok-tint); color: var(--ok-text);
}
.connected-check svg { width: 11px; height: 11px; }

/* меню действий («Изменить») — второй пункт удаления клиента, отделён линией */
.menu-item-form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--border); }
.menu-item-danger { color: var(--sev-critical-text); }
.menu-item-danger:hover { background: var(--sev-critical-tint); }
.menu-item-danger svg { color: currentColor; }

.tabs { display: flex; gap: 22px; align-items: center; border-bottom: 1px solid var(--border); margin: 14px 0 18px; }
.tabs a {
  display: flex; align-items: center; gap: 7px; padding: 9px 1px;
  font-size: var(--fs-ui); font-weight: 400; color: var(--muted); text-decoration: none;
}
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--fg); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.tab-count {
  padding: 1px 6px; border-radius: 999px;
  background: var(--sev-critical-tint); color: var(--sev-critical-text);
  font-size: 11px; font-weight: 600; line-height: 1.5;
}
@media (max-width: 640px) { .tabs { overflow-x: auto; } }

.notice {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; border-radius: var(--radius); margin-top: 13px;
  font-size: var(--fs-ui); line-height: 1.45;
}
.notice svg { flex: none; width: 15px; height: 15px; }
.notice b { font-weight: 600; }
.notice-danger { background: var(--sev-critical-tint); border: 1px solid color-mix(in oklab, var(--sev-critical) 28%, var(--bg)); color: var(--sev-critical-text); }
.notice .notice-actions { margin-left: auto; display: flex; gap: 7px; flex: none; }
.notice .btn-sm { padding: 5px 10px; font-size: var(--fs-ui-sm); }
.notice .btn-outline { background: var(--bg); border-color: color-mix(in oklab, var(--sev-critical) 35%, var(--bg)); color: var(--sev-critical-text); }
.notice .btn-outline:hover { background: var(--sev-critical-tint); }
.notice .btn-solid { background: var(--sev-critical); border-color: var(--sev-critical); color: #fff; font-weight: 600; }
.notice .btn-solid:hover { background: color-mix(in oklab, var(--sev-critical) 82%, #000); border-color: color-mix(in oklab, var(--sev-critical) 82%, #000); }

/* ---------- «что делать дальше»: топ-3 находки (обзор клиента + отчёт) ---------- */
.next-steps { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.next-steps .step { display: flex; gap: 13px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.next-steps .step:last-child { border-bottom: 0; }
.next-steps .step-num {
  flex: none; width: 20px; height: 20px; border-radius: 999px; color: #fff;
  font-weight: 700; font-size: 11.5px; line-height: 20px; text-align: center;
}
.next-steps .step-num.sev-critical { background: var(--sev-critical); }
.next-steps .step-num.sev-high { background: var(--sev-high); }
.next-steps .step-num.sev-medium { background: var(--sev-medium); }
.next-steps .step-num.sev-low { background: var(--sev-low); }
.next-steps .step-body { min-width: 0; }
.next-steps .step-title { font-weight: 600; font-size: 14px; line-height: 1.4; }
.next-steps .step-title a { color: inherit; text-decoration: none; }
.next-steps .step-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.next-steps .step-context { font-weight: 400; color: var(--muted-2); }
.next-steps .step-desc { font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.next-steps .step-badge {
  margin-left: auto; flex: none; align-self: center;
  padding: 2px 8px; border-radius: 999px; font-weight: 600; font-size: 11.5px; line-height: 1.6;
}
.next-steps .step-link {
  margin-left: auto; flex: none; align-self: center; font-size: var(--fs-ui-sm);
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
}
.next-steps .step-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.next-steps .step-link svg { width: 11px; height: 11px; }

/* строка под .next-steps: полоса severity + «ещё N» / «правил пройдено» */
.next-steps-foot { margin-top: 9px; display: flex; align-items: center; gap: 10px; font-size: var(--fs-ui-sm); color: var(--muted); }
.next-steps-meter { display: flex; height: 5px; width: 190px; border-radius: 999px; overflow: hidden; flex: none; }
.next-steps-meter span { min-width: 2px; }

/* показатели инлайн-строками (обзор клиента) */
.inline-stats {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 26px;
  padding-top: 14px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.inline-stats + .inline-stats { margin-top: 9px; padding-top: 0; border-top: 0; }
.inline-stats b { color: var(--fg); font-weight: 700; font-size: 15px; line-height: 1; }
.inline-stats .schedule-line { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.inline-stats .schedule-line svg { width: 13px; height: 13px; }

/* ---------- вкладка «Обзор»: модульные блоки ---------- */
.notice-info { background: var(--info-tint); border: 1px solid var(--border); color: var(--info-text); }
.notice-info .btn-outline { background: var(--bg); border-color: var(--border); color: var(--info-text); }

.ov-block { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); margin-top: 14px; overflow: hidden; }
.ov-bh {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--bg-subtle);
}
.ov-bh .ov-ico { width: 14px; height: 14px; color: var(--muted-2); flex: none; }
.ov-name { font-weight: 600; font-size: var(--fs-ui-sm); }
.ov-live { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ok-text); }
.ov-cached { font-size: 11px; color: var(--muted-2); }
.ov-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--ok); flex: none; }
.ov-bb { padding: 14px; }
.ov-bb.ov-empty { text-align: left; }
.ov-foot { margin: 9px 0 0; font-size: 11.5px; color: var(--muted-2); }

/* «Обзор»/«Графики»: единая кнопка обновления в полосе табов — подпись с
   последним временем обновления + кнопка-иконка, которая же служит
   индикатором опроса (крутится, пока идёт htmx-поллинг каждые 2с). Заменяет
   прежнюю пару #ov-loading/#gr-loading (голый спиннер в .tabs) + .ov-refresh
   (та же ссылка «обновить», продублированная в каждом async-блоке —
   partials/refresh_control.html). */
/* Подпись того же размера, что чип цели (12,5px): период — цветом текста,
   «обновлено…» — светлее; кнопка — иконка без кружка, фон при наведении. */
.ov-update { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 4px; }
.ov-update-lbl { font-size: var(--fs-ui-sm); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ov-update-lbl b { font-weight: 600; color: var(--fg); }
.ov-update-when { color: var(--muted-2); }
.ov-update.has-warn .ov-update-when { color: var(--info-text); }
.ov-update-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 28px; height: 28px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--muted); padding: 0; cursor: pointer;
}
.ov-update-btn svg { width: 14px; height: 14px; }
.ov-update-btn:hover { color: var(--fg); background: var(--bg-raised); }
.ov-update-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ov-update-btn.is-loading { color: var(--accent); cursor: wait; }
.ov-update-btn.is-loading svg { animation: spin .8s linear infinite; }
.ov-update-btn.is-warn, .ov-update-btn.is-warn:hover { color: var(--info-text); background: var(--info-tint); }
/* manual-refresh cooldown (app/overview/snapshot.py / app/graphs/data.py
   manual_refresh_locked_until) — button stays visible but inert, title carries
   the "доступно через N мин" wait time. */
.ov-update-btn[aria-disabled="true"] {
  color: var(--muted-2); cursor: not-allowed; pointer-events: none;
}
/* Snapshot build in progress (partials/refresh_control.html progress_ring):
   the button stops spinning and wears a ring of one arc per step — done arcs
   grey, the current one pulses, the rest empty — around a smaller still icon. */
.ov-update-btn.has-ring { position: relative; }
.ov-update-btn.has-ring svg { animation: none; }
.ov-update-btn.has-ring > svg:not(.ov-ring) { width: 11px; height: 11px; }
.ov-update-btn .ov-ring { position: absolute; inset: 0; width: 28px; height: 28px; transform: rotate(-90deg); }
.ov-ring circle { fill: none; stroke: var(--border-strong); stroke-width: 2.5; stroke-linecap: round; }
.ov-ring circle.is-done { stroke: var(--muted); }
.ov-ring circle.is-cur { stroke: var(--accent); animation: ov-pulse 1s ease-in-out infinite; }
@keyframes ov-pulse { 50% { opacity: .35; } }
/* «готово за 6 мин 4 с» — 2 s after a ring finishes (static/js/refresh_progress.js) */
.ov-update-when.is-done { color: var(--ok-text); font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .ov-update-btn.is-loading svg, .ov-ring circle.is-cur { animation: none; }
}
@media (max-width: 640px) {
  /* .tabs scrolls horizontally at this width (below) — pin the button to the
     frame's right edge instead of letting it scroll off with the tabs, same
     gap the old #ov-loading spinner would've had (never addressed, since it
     carried no click target); label drops, title="" still explains the icon. */
  .ov-update-when { display: none; }
  .ov-update { position: sticky; right: 0; padding-left: 14px; background: linear-gradient(to right, transparent, var(--bg-subtle) 30%); }
}
.ov-slot { display: block; }
/* Drag-to-reorder the blocks themselves (static/js/overview_sort.js) — only
   wired up when the list carries data-ov-sort-editable (FULL_ACCESS_ROLES,
   see main.py). Mirrors .gr-dragging in the "Графики" tab. */
.ov-tab.is-editing [data-ov-sort-editable] .ov-slot { cursor: grab; }
.ov-slot.ov-dragging {
  position: fixed; z-index: 50; cursor: grabbing; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); opacity: .96;
}
.ov-slot-placeholder {
  margin-top: 14px; border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--bg-subtle);
}
.ov-skel .ov-name { color: var(--muted-2); }
.ov-skel-hint { margin-left: auto; font-size: 11px; color: var(--muted-2); }
.ov-skel-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--muted-2); flex: none; }
.ov-skel-bar { display: block; height: 12px; border-radius: 6px; margin: 8px 0;
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--border) 37%, var(--bg-subtle) 63%);
  background-size: 400% 100%; animation: ov-shimmer 1.4s ease infinite; }
@keyframes ov-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.ov-bh-right { margin-left: auto; font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.ov-bh-link { margin-left: auto; font-size: var(--fs-ui-sm); display: inline-flex; align-items: center; gap: 5px; }
.ov-bh-link svg { width: 12px; height: 12px; }
.ov-live-ico { width: 11px; height: 11px; }
.ov-pill { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.ov-pill-bad { background: var(--sev-critical-tint); color: var(--sev-critical-text); }
.ov-pill-ok { background: var(--ok-tint); color: var(--ok-text); }
.ov-warn { color: var(--sev-medium-text); }
.ov-verdict { margin: 0; font-size: 14px; line-height: 1.45; text-wrap: pretty; }
.ov-chip { font-size: 11.5px; padding: 1px 8px; border-radius: 4px; background: var(--bg-raised); border: 1px solid var(--border); color: var(--fg); white-space: nowrap; }

/* «Статус аккаунта»: подпись над значением */
.ov-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; }
.ov-fact-l { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted-2); margin-bottom: 2px; }
/* «(i)» у подписи факта — тот же .pop, что и у карточек «Графиков» */
.ov-info-pop { display: inline-flex; }
.ov-info-pop .pop-trigger { display: inline-flex; align-items: center; color: var(--muted-2); }
.ov-info-pop .pop-trigger:hover { color: var(--fg); }
.ov-info-pop[open] .pop-trigger { color: var(--accent); }
.ov-info-pop .pop-trigger svg { width: 13px; height: 13px; }
.ov-info-pop .pop-body { top: 20px; right: -4px; left: auto; width: 290px; max-width: calc(100vw - 40px); }
.ov-info-pop .pop-note + .pop-note { margin-top: 6px; }
/* .ov-block clips to its rounded corners; let an open «(i)» spill out */
.ov-block:has(.ov-info-pop[open]) { overflow: visible; }
.ov-fact-v { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ov-fact-sub { font-weight: 400; font-size: 12px; color: var(--muted); }
.ov-fact-link { font-weight: 400; font-size: 12px; }
.ov-qmeter { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: -1px; }
.ov-qmeter i { width: 5px; height: 10px; border-radius: 1px; background: var(--border); }
.ov-qmeter i.on { background: var(--ok); }
@media (max-width: 640px) {
  .ov-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* в две колонки «Качество» уходит влево — поповер открывается вправо */
  .ov-info-pop .pop-body { left: -4px; right: auto; }
}

/* «Расход и темп»: одна карточка с перегородками, как «Структура» — слева
   расход за 30 дней с графиком до краёв ячейки (снизу и по бокам), справа
   «в день» и месяц. Подписи и числа — классы «Структуры» (.ov-ld-*). */
.ov-spark { display: block; width: 100%; height: 28px; margin-top: 8px; }
.ov-spark-line { fill: none; stroke: var(--gr-series-1); stroke-width: 1.5; stroke-linejoin: round; }
.ov-spark-area { fill: var(--gr-series-1); fill-opacity: .1; }
.ov-spend { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.ov-spend-main { display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; min-width: 0; }
.ov-spend-v { font-size: 22px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.ov-spend-main .ov-spark { width: calc(100% + 28px); height: 94px; margin: auto -14px -11px; padding-top: 10px; }
.ov-spend-side { display: grid; grid-template-rows: 1fr 1fr; border-left: 1px solid var(--border); min-width: 0; }
.ov-spend-side > div { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 11px 14px; min-width: 0; }
.ov-spend-side > div + div { border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  .ov-spend { grid-template-columns: minmax(0, 1fr); }
  .ov-spend-side { grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 0; border-top: 1px solid var(--border); }
  .ov-spend-side > div + div { border-top: 0; border-left: 1px solid var(--border); }
}

/* «Реклама не показывается с …» — самая верхняя строка «Обзора», когда ни
   одна кампания не активна (blocks.spend_context → stopped) */
.ov-stopline {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 9px 14px;
  border-radius: var(--radius); background: var(--sev-high-tint); color: var(--sev-high-text); font-size: 13px;
}
.ov-stopline svg { width: 15px; height: 15px; flex: none; }

/* «Эффективность»: воронка показ → клик → конверсия одной карточкой, шаги
   через перегородки; CTR и конверсия — плашки на перегородках, у цен —
   сдвиг к пред. 30 дням (.ov-delta, blocks.efficiency_context) */
.ov-funnel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ov-funnel > div { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; min-width: 0; }
.ov-funnel > div + div { border-left: 1px solid var(--border); padding-left: 60px; }
.ov-fn-v { font-size: 19px; font-weight: 700; line-height: 1.35; font-variant-numeric: tabular-nums; }
.ov-funnel .is-empty .ov-fn-v { font-size: 14px; color: var(--muted); padding-block: 3px; }
.ov-fn-c { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ov-fn-c b { color: var(--fg); }
.ov-fn-rate {
  position: absolute; left: 0; top: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; padding: 3px 9px 4px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
  font-size: 10.5px; line-height: 1.3; color: var(--muted-2); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ov-fn-rate b { font-size: 13px; color: var(--fg); }
@media (max-width: 640px) {
  /* шаги стопкой — плашка встаёт на горизонтальную перегородку */
  .ov-funnel { grid-template-columns: minmax(0, 1fr); }
  .ov-funnel > div + div { border-left: 0; border-top: 1px solid var(--border); padding: 20px 14px 11px; }
  .ov-fn-rate { left: 50%; top: 0; flex-direction: row; gap: 6px; }
}

/* «Вердикт»: правила пройдено / не пройдено + сдвиг к прошлому аудиту */
.ov-rules-top { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 9px; }
.ov-rules-n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ov-rules-n small { font-size: 13px; font-weight: 400; color: var(--muted); }
.ov-delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 3px; }
.ov-delta svg { width: 11px; height: 11px; }
.ov-delta.good { color: var(--ok-text); }
.ov-delta.bad { color: var(--sev-critical-text); }
.ov-delta.flat { color: var(--muted); font-weight: 400; }
.ov-stack { display: flex; height: 8px; border-radius: 3px; overflow: hidden; gap: 2px; }
.ov-stack span { min-width: 3px; }
.ov-stack-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 7px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ov-stack-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ov-stack-legend i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.ov-stack-legend b { color: var(--fg); }
.ov-sev-swatch { background: linear-gradient(90deg, var(--sev-critical) 0 33%, var(--sev-high) 33% 66%, var(--sev-medium) 66%); }
.ov-steps-wrap { margin-top: 14px; }

/* «Гигиена»: чек-лист 2×2, окрашены только сработавшие проверки */
.ov-alert { display: flex; gap: 9px; align-items: flex-start; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; line-height: 1.45; }
.ov-block .ov-bh + .ov-alert { border-top: 0; }
.ov-alert .ov-ai { flex: none; width: 15px; height: 15px; margin-top: 1px; }
.ov-alert .ov-ai.crit { color: var(--sev-critical); }
.ov-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ov-check { padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--border); min-width: 0; }
.ov-check:nth-child(odd) { border-right: 1px solid var(--border); }
.ov-check:nth-child(-n+2) { border-top: 0; }
.ov-check-top { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); }
.ov-check-top svg { width: 13px; height: 13px; flex: none; }
.ov-check-val { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.ov-check-sub { font-size: 12px; color: var(--muted); }
.ov-check.is-crit { background: var(--sev-critical-tint); }
.ov-check.is-crit .ov-check-top svg, .ov-check.is-crit .ov-check-val { color: var(--sev-critical-text); }
.ov-check.is-high { background: var(--sev-high-tint); }
.ov-check.is-high .ov-check-top svg, .ov-check.is-high .ov-check-val { color: var(--sev-high-text); }
.ov-check.is-med { background: var(--sev-medium-tint); }
.ov-check.is-med .ov-check-top svg, .ov-check.is-med .ov-check-val { color: var(--sev-medium-text); }
.ov-check.is-ok .ov-check-top svg { color: var(--ok); }
.ov-check.is-ok .ov-check-val { color: var(--ok-text); }

/* «Аномалии»: дневной расход + коридор нормы (геометрия — blocks.anomaly_chart) */
.ov-anom-hit { color: var(--sev-high-text); font-weight: 600; }
.ov-chart-scroll { overflow-x: auto; }
.ov-chart { display: block; width: 100%; min-width: 520px; height: auto; overflow: visible; }
.ov-chart text { font-size: 11px; fill: var(--muted-2); font-variant-numeric: tabular-nums; }
.ov-chart-grid { stroke: var(--border); stroke-width: 1; }
.ov-chart-band { fill: var(--gr-series-1); fill-opacity: .12; }
.ov-chart-area { fill: var(--gr-series-1); fill-opacity: .06; }
.ov-chart-line { fill: none; stroke: var(--gr-series-1); stroke-width: 1.8; stroke-linejoin: round; }
.ov-chart-out { fill: var(--sev-high); stroke: var(--bg); stroke-width: 2; }
.ov-chart-end { fill: var(--bg); stroke: var(--gr-series-1); stroke-width: 1.5; }
.ov-chart .ov-chart-ann { fill: var(--sev-high-text); font-weight: 600; font-size: 11.5px; }
.ov-chart-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.ov-chart-key span { display: inline-flex; align-items: center; gap: 6px; }
.ov-chart-key i { width: 14px; height: 8px; border-radius: 2px; }
.ov-key-line { background: var(--gr-series-1); }
.ov-key-band { background: color-mix(in srgb, var(--gr-series-1) 18%, transparent); }
.ov-chg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.ov-chg-ico { width: 13px; height: 13px; flex: none; }

/* «Структура»: уровни аккаунта — «работает из всего» + полоска долей */
.ov-ladder { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ov-ladder > div { padding: 11px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ov-ladder > div + div { border-left: 1px solid var(--border); }
.ov-ld-l { font-size: 12px; color: var(--muted); }
.ov-ld-v { font-size: 17px; font-weight: 700; line-height: 1.35; font-variant-numeric: tabular-nums; }
.ov-ld-v small { margin-left: 3px; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.ov-ld-s { font-size: 11.5px; color: var(--muted-2); min-height: 1.5em; }
.ov-ld-bar { display: flex; gap: 2px; height: 4px; margin: 5px 0 3px; border-radius: 2px; overflow: hidden; background: var(--bg-subtle); }
.ov-ld-bar .is-on { background: var(--ok); }
.ov-ld-bar .is-pause { background: var(--sev-medium); }
.ov-ld-bar .is-acc { background: var(--gr-series-1); }
.ov-ld-bar .is-rest { background: color-mix(in oklab, var(--muted-2) 45%, var(--bg)); }
/* клетка лесенки «Структура» — кнопка; ссылки в подписи открывают ту же шторку с фильтром */
.ov-ladder > .is-drill { padding: 0; gap: 0; }
.ov-ladder > .is-drill:hover { background: var(--bg-subtle); }
.ov-cell-btn {
  appearance: none; display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 11px 14px 0;
  border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; min-width: 0;
}
.ov-cell-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0; }
.ov-cell-btn .ov-ld-l { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ov-cell-btn .ov-ld-l svg { width: 12px; height: 12px; color: var(--muted-2); transform: rotate(-90deg); transition: color .15s; }
.ov-cell-btn:hover .ov-ld-l svg { color: var(--accent); }
.ov-ladder > .is-drill > .ov-ld-s { padding: 0 14px 11px; }
.ov-cell-link { appearance: none; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
.ov-cell-link:hover { color: var(--accent); }
@media (max-width: 640px) {
  .ov-ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-ladder > div:nth-child(3) { border-left: 0; }
  .ov-ladder > div:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* «Кампании»: доля расхода против доли конверсий */
.ov-share-legend { gap: 5px; }
.ov-share-legend i { width: 8px; height: 8px; border-radius: 2px; }
.ov-share-legend i.cv { margin-left: 6px; }
.ov-share-legend i.sp, .ov-share-bars .sp i, .ov-trk i.sp { background: var(--gr-series-1); }
.ov-share-legend i.cv, .ov-share-bars .cv i, .ov-trk i.cv { background: var(--gr-series-3); }
.ov-share-row {
  display: grid; grid-template-columns: minmax(150px, 240px) minmax(0, 1fr) minmax(130px, 170px);
  gap: 6px 16px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px;
}
.ov-share-head { border-top: 0; padding-block: 8px; background: var(--bg-subtle); border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--muted-2); }
.ov-share-head + .ov-share-row { border-top: 0; }
.ov-share-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ov-share-name b { font-weight: 600; overflow-wrap: anywhere; }
.ov-sdot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted-2); }
.ov-sdot.is-on { background: var(--ok); }
.ov-share-bars { display: flex; flex-direction: column; gap: 3px; }
.ov-share-bars div { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ov-share-bars i { display: block; height: 7px; border-radius: 2px; min-width: 2px; }
.ov-share-v { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ov-share-v small { display: block; font-size: 11.5px; }
.ov-share-v.is-bad small { color: var(--sev-critical-text); font-weight: 600; }
.ov-share-v.is-good small { color: var(--ok-text); font-weight: 600; }
.ov-share-v.is-flat small { color: var(--muted); }
.ov-share-foot { padding: 0 14px 10px; }
@media (max-width: 640px) {
  .ov-share-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ov-share-row .ov-share-bars { grid-column: 1 / -1; grid-row: 2; }
  .ov-share-hide-sm { display: none; }
}

/* «Сегменты»: расход, конверсии и CPA по устройствам */
.ov-seg-verdict { padding-bottom: 12px; }
.ov-seg-bar { width: 30%; }
.ov-trk { height: 7px; background: var(--bg-subtle); border-radius: 2px; overflow: hidden; min-width: 60px; }
.ov-trk i { display: block; height: 100%; border-radius: 2px; min-width: 2px; }
.ov-seg-pct { font-size: 11.5px; color: var(--muted); }
.ov-seg-cpa.is-bad { color: var(--sev-critical-text); font-weight: 600; }
.ov-seg-cpa.is-good { color: var(--ok-text); font-weight: 600; }

.ov-cf { display: flex; align-items: center; gap: 16px; }
.ov-cf-score { font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
/* цвет числа = сплошной токен зоны (один на обе темы) */
.ov-cf-score.score-green { color: var(--cf-top); }
.ov-cf-score.score-light-yellow { color: var(--cf-ly); }
.ov-cf-score.score-yellow { color: var(--sev-medium); }
.ov-cf-score.score-orange { color: var(--sev-high); }
.ov-cf-score.score-red { color: var(--sev-critical); }
.ov-cf-score.score-none { color: var(--muted-2); }
.ov-cf-body { min-width: 0; font-size: 13px; }
.ov-cf-link { margin-left: auto; font-size: var(--fs-ui-sm); display: inline-flex; align-items: center; gap: 5px; flex: none; }
.ov-cf-link svg { width: 12px; height: 12px; }

/* block-visibility config — settings page (settings_overview_blocks.html):
   a «Порядок и видимость · 9 из 10 · Сохранить» row, the list in two
   numbered columns (read down, then across), and the selected block's
   preview under it at the full section width — the blocks are drawn for
   the «Обзор» tab and broke in a column next to the list */
.ov-cfg-top { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin: 0 0 10px; }
.ov-cfg-count { font-size: var(--fs-ui-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.ov-cfg-dirty { font-size: var(--fs-ui-sm); color: var(--override-text); }
.ov-cfg-top .btn, .ov-cfg-note { margin-left: auto; }
.ov-cfg-note { font-size: var(--fs-ui-sm); color: var(--muted); }
.ov-block-choices { display: flex; flex-direction: column; gap: 1px; }
.ov-cfg .ov-block-choices {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(5, auto);
  grid-auto-flow: column; gap: 1px 20px; counter-reset: ov-cfg-n;
}
.ov-cfg .ov-block-choice:not(.is-dragging) { counter-increment: ov-cfg-n; }
.ov-cfg .ov-block-choice::before {
  content: counter(ov-cfg-n); flex: none; width: 16px; text-align: right;
  font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums;
}
.ov-cfg .ov-block-choice-placeholder::before { content: none; }
[data-block-sort] .ov-block-choice { cursor: grab; }
.ov-block-choice { display: flex; gap: 8px; align-items: center; height: 36px; padding: 0 6px; border-radius: var(--radius); }
.ov-block-choice:hover { background: var(--bg-subtle); }
.ov-block-choice.is-selected { background: var(--info-tint); }
.ov-block-choice input { flex: none; width: auto; margin: 0; }
.ov-block-choice__title {
  flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--fg);
  font: inherit; font-size: var(--fs-ui); font-weight: 600; text-align: left; cursor: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ov-block-choice:has(input:not(:checked)) .ov-block-choice__title { color: var(--muted); font-weight: 500; }
/* Drag-to-reorder (static/js/block_sort.js) — same mechanic as .gr-dragging
   in the "Графики" tab: lifted out of flow to follow the pointer, with a
   dashed placeholder holding its slot in the list. */
.ov-block-choice.is-dragging {
  position: fixed; z-index: 50; cursor: grabbing; pointer-events: none;
  background: var(--bg); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); opacity: .96;
}
.ov-block-choice-placeholder {
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--bg-subtle);
}
.ov-grip { flex: none; display: inline-flex; align-items: center; color: var(--muted-2); cursor: grab; }
.ov-grip svg { width: 14px; height: 14px; }
.ov-move { flex: none; display: inline-flex; gap: 2px; }
.ov-move .btn-icon { padding: 3px 5px; }
.ov-move .btn-icon svg { width: 13px; height: 13px; }
.ov-move .ov-up svg { transform: rotate(180deg); }
.ov-block-choice .ov-move { opacity: 0; transition: opacity .1s; }
.ov-block-choice:hover .ov-move, .ov-block-choice:focus-within .ov-move, .ov-block-choice.is-selected .ov-move { opacity: 1; }

.ov-cfg-preview { margin-top: 14px; min-width: 0; background: var(--bg-subtle); border-radius: var(--radius); padding: 16px 18px 18px; }
.ov-sample h2 { margin: 0; font-size: 1.05rem; }
.ov-sample-desc { margin: 4px 0 0; font-size: 13px; color: var(--muted); max-width: 62ch; }
.ov-sample-meta { margin: 6px 0 0; font-size: var(--fs-ui-sm); color: var(--muted-2); }
.ov-sample-off { display: none; }
.ov-sample.is-off .ov-sample-off { display: inline; }
.ov-sample-frame { position: relative; margin-top: 18px; }
.ov-sample-frame > .ov-block { margin-top: 0; }
.ov-sample.is-off .ov-sample-frame > .ov-block { opacity: .5; filter: grayscale(1); }
.ov-sample-lbl {
  position: absolute; top: -8px; right: 12px; z-index: 1; padding: 0 6px;
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); background: var(--bg-subtle);
}

/* Каталог блоков отчёта /settings/report-blocks (settings_report_blocks.html):
   раздел на блок, под шапкой — каждый вид с радио и настоящим блоком в рамке */
.rb-cat-tabs { margin-top: 0; }
.rb-cat-sample .rb-cat-object select { max-width: 420px; }
.rb-cat-empty { margin: 0 0 12px; }
.rb-cat-list { display: flex; flex-direction: column; }
.rb-cat-desc { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.rb-cat-hidden { color: var(--muted-2); }
.rb-cat-opts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: var(--fs-ui-sm); }
.rb-cat-opts label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: normal; color: var(--fg); }
/* global `input { width: 100% }` would put the option box on its own line */
.rb-cat-opts input { width: auto; flex: none; margin: 0; align-self: center; }
/* одна строка на блок: порядок · тумблер · название · вид · «Пример» */
.rb-bar {
  position: sticky; top: 12px; z-index: 4; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  margin: 0 0 12px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.rb-bar .settings-label { margin-right: auto; }
.rb-bar .ov-cfg-note { margin-left: 0; }
.rb-bar .btn[disabled] { opacity: .45; cursor: default; }
.rb-sum { font-size: var(--fs-ui-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.rb-table { padding: 0; overflow: hidden; }
.rb-cols, .rb-row {
  display: grid; grid-template-columns: 62px 44px minmax(0, 1fr) minmax(280px, 1.25fr) 92px;
  gap: 0 10px; align-items: start; padding: 9px 10px;
}
.rb-cols { background: var(--bg-raised); border-bottom: 1px solid var(--border); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); }
.rb-cat-block { border-bottom: 1px solid var(--border); min-width: 0; }
.rb-cat-block:last-child { border-bottom: 0; }
.rb-name { min-width: 0; }
.rb-name h2 { display: inline; margin: 0; font-size: .95rem; }
.rb-cat-block.is-off .rb-name { opacity: .55; }
.rb-tag, .rb-chg { display: inline-block; font-size: 11px; line-height: 1.5; border-radius: 999px; padding: 0 7px; margin-left: 6px; white-space: nowrap; vertical-align: 1px; }
.rb-tag { color: var(--muted); border: 1px solid var(--border); }
.rb-chg { background: var(--override-tint); color: var(--override-text); font-weight: 500; }
.rb-chg[hidden] { display: none; }
.rb-sw { position: relative; display: inline-flex; margin: 4px 0 0; }
.rb-sw input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.rb-sw input:checked + .switch { background: var(--accent); }
.rb-sw input:checked + .switch::after { left: 14px; }
.rb-sw input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.rb-sw input:disabled + .switch { opacity: .6; cursor: default; }
.rb-view { min-width: 0; }
.rb-seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 12px; }
.rb-seg label {
  position: relative; display: inline-flex; align-items: center; margin: 0; padding: 4px 10px;
  font-size: 12px; color: var(--muted); background: var(--bg); border-left: 1px solid var(--border); cursor: pointer;
}
.rb-seg label:first-child { border-left: 0; }
.rb-seg label:has(input:checked) { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.rb-seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.rb-seg label:has(input:disabled) { cursor: default; }
.rb-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.rb-seg b { font-weight: inherit; }
.rb-glyph { width: 26px; height: 16px; margin-right: 6px; flex: none; }
.rb-vd { margin: 5px 0 0; max-width: 46ch; font-size: 12.5px; color: var(--muted); }
.rb-def { font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.rb-ex { text-align: right; }
.rb-ex .btn svg { transition: transform .12s; }
.rb-ex [aria-expanded="true"] svg { transform: rotate(180deg); }
.rb-prev { padding: 12px 14px 14px; background: var(--bg-subtle); border-top: 1px solid var(--border); min-width: 0; }
.rb-prev .rb-cat-frame { margin: 0; }
.rb-prev .rb-cat-hidden { margin: 0; }
@media (max-width: 760px) {
  .rb-cols { display: none; }
  .rb-row { grid-template-columns: 62px 44px minmax(0, 1fr); }
  .rb-view, .rb-ex { grid-column: 1 / -1; margin-top: 8px; text-align: left; }
}
.rb-cat-frame { margin-top: 14px; padding: 12px; border-radius: var(--radius); background: var(--bg-subtle); }
.rb-cat-frame .ov-sample-lbl { top: -7px; background: var(--bg); }
/* opacity only: greyscale would hide the overspend red the admin is judging */
.rb-cat-block.is-off .rb-cat-frame { opacity: .6; }
/* «Все срезы» в виде шторки: закрытый <dialog> не виден, в каталоге его
   содержимое стоит статичной копией под кнопкой */
.rb-cat-frame dialog.cf-slices-drawer {
  display: block; position: static; margin: 10px 0 0; width: auto; max-width: 100%;
  height: auto; max-height: none; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none;
}
.rb-cat-frame dialog.cf-slices-drawer .sd-results { max-height: 360px; }
.rb-cat-frame dialog.cf-slices-drawer .sd-close { display: none; }

/* «Обзор» edit mode (static/js/overview_edit.js): the tab itself is the
   editor — a sticky bar, a tray of hidden blocks, and a strip over each block */
.ov-editbar, .ov-tray, .ov-edit-tools { display: none; }
.ov-tab.is-editing .ov-empty-card { display: none; }
.ov-tab.is-editing .ov-editbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 14px; padding: 9px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--info-tint); font-size: var(--fs-ui);
}
.ov-editbar-t { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-right: auto; }
.ov-editbar-t .muted { font-size: var(--fs-ui-sm); }
.ov-editbar-org { font-size: var(--fs-ui-sm); color: var(--muted); }
.ov-editbar-org form { display: inline; }
.ov-editbar .ov-org-own, .ov-editbar.has-override .ov-org-inherit { display: none; }
.ov-editbar.has-override .ov-org-own { display: inline; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.ov-tab.is-editing .ov-tray { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding: 0 2px; }
.ov-tray-lbl { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.ov-tray form { margin: 0; }
.ov-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px;
  border: 1px dashed var(--border-strong); border-radius: 999px; background: var(--bg);
  color: var(--fg); font: inherit; font-size: var(--fs-ui-sm); cursor: pointer;
}
.ov-chip svg { width: 12px; height: 12px; color: var(--muted); }
.ov-chip:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
.ov-chip:hover svg { color: var(--accent); }
.ov-tray-empty { display: none; font-size: var(--fs-ui-sm); color: var(--muted-2); }
.ov-tray:not(:has(form:not([hidden]))) .ov-tray-empty { display: inline; }
.ov-tray-idle { flex-basis: 100%; margin: 2px 0 0; font-size: var(--fs-ui-sm); color: var(--muted-2); }

.ov-tab.is-editing .ov-slot {
  margin-top: 12px; padding: 0 6px 6px; border: 1px dashed var(--border-strong);
  border-radius: calc(var(--radius) + 3px); scroll-margin-top: 64px;
}
.ov-tab.is-editing .ov-slot > .ov-block { margin-top: 0; }
.ov-tab.is-editing .ov-edit-tools { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 2px; }
.ov-edit-hint { flex: 1; min-width: 0; font-size: 11.5px; color: var(--muted-2); }
.ov-edit-tools .ov-hide { padding: 3px 8px; }
.ov-edit-tools .ov-hide svg { width: 13px; height: 13px; }
.ov-edit-tools .ov-hide:hover { color: var(--sev-critical-text); }
.ov-slot.is-hiding { opacity: .4; pointer-events: none; }
.ov-tab.is-editing .ov-slot:target { animation: ov-flash 1.6s ease-out; }
@keyframes ov-flash { from { border-color: var(--accent); box-shadow: 0 0 0 3px var(--info-tint); } }
@media (prefers-reduced-motion: reduce) { .ov-tab.is-editing .ov-slot:target { animation: none; border-color: var(--accent); } }

@media (max-width: 760px) {
  .ov-cfg .ov-block-choices { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; }
}

@media (max-width: 640px) {
  .ov-kpis { gap: 8px 18px; }
  .ov-cf { flex-wrap: wrap; }
  .ov-cf-link { margin-left: 0; }
}

/* ---------- тумблер (правила, правила клиента) ---------- */
.switch {
  position: relative; flex: none; width: 28px; height: 16px; border-radius: 999px;
  background: var(--switch-off); border: 0; padding: 0; cursor: pointer;
  transition: background 0.12s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 999px; background: #fff; transition: left 0.12s;
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { left: 14px; }
.switch-sm { width: 24px; height: 14px; }
.switch-sm::after { width: 10px; height: 10px; }
.switch-sm[aria-checked="true"]::after { left: 12px; }

/* ---------- порог внутри предложения ---------- */
.inline-num {
  display: inline-flex; align-items: center; padding: 1px 7px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg); color: var(--fg); font-weight: 600;
  font-variant-numeric: tabular-nums; width: auto;
}
.inline-num:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); outline: 0; }

/* ---------- каталог правил: заголовок группы + строка ---------- */
.list-group {
  padding: 7px 16px; background: var(--bg-raised);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted-2);
}
.rule-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.rule-row:last-child { border-bottom: 0; }
.rule-row.is-off { opacity: .62; }
.rule-row.is-flagged { background: var(--row-flag); }
.rule-code { font-family: var(--mono); font-size: 11.5px; color: var(--muted-2); }

/* ---------- поповер «(?)» ---------- */
.pop { position: relative; }
.pop > summary { list-style: none; cursor: pointer; }
.pop > summary::-webkit-details-marker { display: none; }
/* триггер по умолчанию — «(?)»; кнопка-триггер (запуск аудита) переопределяет
   классами .btn/.btn-primary, поэтому цвет/размер живут только тут, не выше */
.pop > summary.pop-trigger { font-size: var(--fs-ui-sm); color: var(--muted-2); }
.pop[open] > summary.pop-trigger { color: var(--accent); font-weight: 600; }
.pop-body {
  position: absolute; top: 22px; right: -4px; width: 352px; padding: 11px 13px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--pop-shadow); text-align: left; z-index: 20;
  white-space: normal; /* поповер внутри <th>/<td> с nowrap иначе не переносит текст */
}
/* «(?)» в шапке таблицы — в одну строку с названием колонки, а не под ним */
.table th .pop { display: inline-block; }
/* запуск аудита (5b) — шире, ниже (под primary-кнопкой, не под «(?)») */
/* base.html ставит .pop-up, когда снизу не хватает места до края окна */
.pop.pop-up > .pop-body { top: auto; bottom: calc(100% + 6px); }
.pop-launch .pop-body { top: 38px; right: 0; width: 330px; padding: 14px 15px; }
.pop-launch .period-picker .chips { flex-wrap: wrap; }
.pop-title {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted-2); margin: 0 0 6px;
}
.code-block {
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 5px;
  padding: 8px 9px; color: var(--fg); white-space: pre-wrap;
}
.pop-note { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 8px 0 0; }

/* ---------- меню действий («Изменить») ---------- */
.actions-menu > summary.btn { gap: 6px; }
.actions-menu > summary.btn .caret { width: 12px; height: 12px; }
.actions-menu[open] > summary.btn { background: var(--bg-subtle); border-color: var(--muted-2); }
.actions-menu-body { top: calc(100% + 4px); right: 0; left: auto; width: max-content; min-width: 190px; padding: 4px; }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: 4px;
  background: transparent; color: var(--fg); font: inherit; font-size: 13px;
  cursor: pointer; text-align: left; white-space: nowrap;
}
.menu-item:hover { background: var(--bg-subtle); }
.menu-item svg { width: 14px; height: 14px; flex: none; color: var(--muted); }

/* ---------- чипы-фильтры ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--muted); font-size: var(--fs-ui-sm);
  cursor: pointer; line-height: 1.3;
}
.chip:hover { border-color: var(--muted-2); }
.chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); font-weight: 600; }
.chip-accent[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: var(--accent); color: var(--fg); }

/* ---------- сегмент «Как у всех / Вкл / Выкл» ---------- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 12px; }
.seg > * {
  appearance: none; -webkit-appearance: none; font: inherit;
  padding: 4px 10px; color: var(--muted-2);
  border: 0; border-left: 1px solid var(--border); border-radius: 0;
  cursor: pointer; background: var(--bg);
}
.seg > *:first-child { border-left: 0; }
.seg > [aria-pressed="true"] { background: var(--bg-raised); color: var(--fg); font-weight: 600; }
.seg > [aria-pressed="true"].is-on { background: var(--accent); color: var(--accent-fg); }
.seg > *:focus-visible { outline-offset: -2px; }

/* ---------- автосохранение строки ---------- */
.saved-hint {
  margin-top: 6px; display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: var(--ok-text);
  animation: fade-out .3s 5s forwards;
}
.saved-hint svg { width: 12px; height: 12px; flex: none; }
.saved-hint a { color: var(--muted); }
.saved-hint.is-error { color: var(--sev-critical-text); animation: none; }
@keyframes fade-out { to { opacity: 0; visibility: hidden; } }

.link-quiet {
  background: none; border: 0; padding: 0; margin: 0; color: var(--muted);
  font-size: var(--fs-ui-sm); font-family: inherit; cursor: pointer;
}
.link-quiet:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- две колонки: рабочая область + липкая панель ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.split-aside { position: sticky; top: 12px; }
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .split-aside { position: static; }
}
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 640px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

/* ---------- вердикт ---------- */
.verdict { border: 0; background: transparent; padding: 20px 0 0; margin-bottom: 16px; }
.verdict-head { display: flex; align-items: center; gap: 10px; }
.verdict-title { font-size: 19px; font-weight: 700; line-height: 1.3; margin: 0; }
.verdict-title::before {
  content: ""; display: inline-block; width: 9px; height: 9px;
  border-radius: 50%; margin-right: 9px;
}
.verdict.tone-critical .verdict-title::before { background: var(--sev-critical); }
.verdict.tone-serious  .verdict-title::before { background: var(--sev-high); }
.verdict.tone-warning  .verdict-title::before { background: var(--sev-medium); }
.verdict.tone-good     .verdict-title::before { background: var(--ok); }
.verdict-head .sev-meter { margin-left: auto; width: 230px; height: 6px; flex: none; }
.verdict-note { margin: 6px 0 16px; max-width: 720px; color: var(--muted); font-size: var(--fs-ui); }

/* светофор серьёзности: сегменты с зазором 2px */
.sev-meter { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; }
.sev-meter span { min-width: 14px; }
.sev-meter .seg-critical { background: var(--sev-critical); }
.sev-meter .seg-high     { background: var(--sev-high); }
.sev-meter .seg-medium   { background: var(--sev-medium); }
.sev-meter .seg-low      { background: var(--sev-low); }

/* сетка равных плиток; разделитель рисуется в межколоночном зазоре,
   у первой плитки ряда он выходит за край и срезается overflow'ом */
.verdict-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 18px 32px; margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border); overflow: hidden;
}
.stat { position: relative; min-width: 0; }
.stat::before {
  content: ""; position: absolute; left: -16px; top: 3px; bottom: 3px;
  width: 1px; background: var(--border);
}
.stat .value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.stat .label { font-size: 0.82rem; color: var(--muted-2); }

/* ---------- фильтры + разделы отчёта: один ряд чипов ---------- */
.filters {
  display: flex; gap: 7px; align-items: center; flex-wrap: wrap;
  padding: 0 0 16px; border: 0; background: transparent;
}
.chip {
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--muted); font: inherit; font-size: var(--fs-ui-sm);
  line-height: 1.3;
  cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--muted-2); background: var(--bg); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.chip b { font-weight: 600; }
.filters .divider { width: 1px; height: 18px; background: var(--border); margin: 0 4px; flex: none; }
.filters select { margin-left: auto; max-width: 280px; }
.filters .filter-label { color: var(--muted-2); font-size: var(--fs-ui-sm); }

.toc { display: contents; }
.toc a {
  text-decoration: none; font-size: var(--fs-ui-sm); color: var(--muted);
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
  transition: border-color 0.15s, color 0.15s;
}
.toc a:hover { color: var(--fg); border-color: var(--muted-2); }
.toc a .n { color: var(--muted-2); }

/* ---------- находки ---------- */
.report-block { scroll-margin-top: 80px; }
.report-block h2 { display: flex; align-items: baseline; gap: 10px; }
.report-block h2 .count { font-size: 0.85rem; font-weight: 400; color: var(--muted-2); }

.finding {
  border-left: 3px solid var(--sev-low);
  padding: 4px 0 4px 16px; margin: 18px 0;
  scroll-margin-top: 80px;
}
/* длинная серия находок одного правила: показываем первые 5 */
.finding-group[data-collapsed] .finding:nth-of-type(n+6) { display: none; }
.show-more {
  background: transparent; color: var(--muted); border: 1px dashed var(--border);
  padding: 7px 14px; font-size: 0.88rem; border-radius: var(--radius); margin: 0 0 14px 19px;
  cursor: pointer;
}
.show-more:hover { background: var(--bg-subtle); color: var(--fg); border-color: var(--muted-2); }
.finding[data-severity="critical"] { border-left-color: var(--sev-critical); }
.finding[data-severity="high"]     { border-left-color: var(--sev-high); }
.finding[data-severity="medium"]   { border-left-color: var(--sev-medium); }

.finding-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.finding-head .object {
  font-weight: 600; max-width: min(540px, 100%);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.finding-head .rule-code {
  margin-left: auto; font-size: 0.8rem; color: var(--muted-2); cursor: default;
}
.finding .message { margin: 8px 0 0; max-width: 720px; overflow-wrap: anywhere; }
.recommendation {
  display: flex; gap: 10px; margin: 10px 0 0; padding: 12px 14px;
  background: var(--bg-subtle); border-radius: var(--radius);
  font-size: 0.92rem; max-width: 720px;
}
.recommendation .rec-label { flex: none; }
.recommendation .rec-text { color: var(--muted); }
.recommendation .rec-text b { color: var(--fg); font-weight: 600; }

/* пустое состояние */
.all-good { text-align: center; padding: 44px 24px; }
.all-good .icon {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--ok-tint); color: var(--ok-text);
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}
.all-good h2 { margin-bottom: 6px; }

/* ---------- данные аккаунта ---------- */
.note {
  display: flex; gap: 8px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--info-tint); color: var(--info-text); font-size: 0.88rem;
  margin: 12px 0;
}

/* ---------- правила аудита (M7) ---------- */
.client-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.rules-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.rule-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rule-title-row .rule-code { font-family: var(--mono); font-size: 0.78rem; color: var(--muted-2); }

.builtin-rules { display: grid; }
.rules-block-label {
  margin: 20px 0 2px; font-size: 0.76rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2);
}
.rules-block-label:first-child { margin-top: 8px; }
.rules-foot { display: flex; justify-content: flex-end; margin-top: 16px; }
.builtin-rule {
  display: flex; gap: 12px; align-items: flex-start; margin: 0;
  padding: 12px 4px; border-bottom: 1px solid var(--border);
  color: var(--fg); cursor: pointer;
}
.builtin-rule:last-child { border-bottom: 0; }
.builtin-rule > input[type=checkbox] { width: auto; margin-top: 4px; flex: none; }
.builtin-rule-body { display: grid; gap: 4px; }
.builtin-rule:has(input:not(:checked)) .builtin-rule-body { opacity: 0.5; }

.rule-sentence { color: var(--muted); font-size: 0.92rem; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.param-input {
  width: 88px; padding: 4px 8px; font-size: 0.92rem;
  font-variant-numeric: tabular-nums; text-align: right;
}

.custom-rules { display: grid; }
.custom-rule {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 12px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.custom-rule:last-child { border-bottom: 0; }
.custom-rule.rule-off .custom-rule-main { opacity: 0.5; }
.custom-rule-main p { margin: 4px 0 0; }
.custom-rule-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.custom-rule-actions form { margin: 0; }

/* конструктор */
.form-errors { border-color: var(--sev-critical); background: var(--sev-critical-tint); color: var(--sev-critical-text); }
.form-errors ul { margin: 8px 0 0; padding-left: 20px; }
.rule-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.rule-form-grid .span2 { grid-column: span 2; }
.check-label { display: flex; align-items: center; gap: 8px; }
.check-label input { width: auto; margin: 0; }

.cond-group {
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 11px 13px; margin: 11px 0;
}
.cond-group-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.cond-group-head b {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.cond-row { display: flex; align-items: center; gap: 7px; margin: 8px 0; flex-wrap: wrap; }
.cond-if { flex: none; width: 22px; font-size: 12px; font-weight: 700; }
.cond-row:first-child .cond-if { visibility: hidden; }
.cond-field { max-width: 300px; }
.cond-op { max-width: 150px; }
.cond-value { max-width: 200px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cond-del {
  background: transparent; color: var(--muted-2); border: 0; padding: 4px 8px;
  font-size: 1.1rem; line-height: 1; cursor: pointer; margin-left: auto;
}
.cond-del:hover { background: var(--sev-critical-tint); color: var(--sev-critical-text); border-radius: var(--radius); }
/* «+ условие И» — единственная прямая .btn-ghost внутри группы (добавляется JS'ом) */
.cond-group > .btn-ghost { border-style: dashed; border-color: var(--field-strong); margin-top: 4px; }
#add-group {
  display: block; width: 100%; text-align: center; margin: 11px 0 0;
  padding: 9px; border: 1px dashed var(--field-strong); border-radius: var(--radius);
  color: var(--muted); background: transparent;
}
#add-group:hover { background: var(--bg-subtle); }

.form-actions { display: flex; gap: 10px; margin: 4px 0 24px; }

/* предпросмотр */
.preview-controls { display: flex; gap: 10px; align-items: center; flex: none; }
.preview-note {
  padding: 10px 14px; border-radius: var(--radius); background: var(--info-tint);
  color: var(--info-text); font-size: 0.92rem;
}
.preview-finding {
  border-left: 3px solid var(--sev-low); padding: 6px 0 6px 14px; margin: 12px 0;
  background: transparent;
}
.preview-finding.sev-critical { border-left-color: var(--sev-critical); background: transparent; color: inherit; }
.preview-finding.sev-high { border-left-color: var(--sev-high); background: transparent; color: inherit; }
.preview-finding.sev-medium { border-left-color: var(--sev-medium); background: transparent; color: inherit; }
.preview-finding.sev-low { background: transparent; color: inherit; }

/* правила клиента */
.client-rules { display: grid; }
.client-rule {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
  padding: 12px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; margin: 0;
}
.client-rule:last-child { border-bottom: 0; }
.client-rule-main { display: grid; gap: 8px; min-width: 0; }
.client-rule-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.client-rule .rule-sentence { display: flex; gap: 14px; flex-wrap: wrap; }
.param-override { margin: 0; display: grid; gap: 3px; }
.param-override .param-input { width: 110px; text-align: left; }
.override-badge { background: var(--override-tint); color: var(--override-text); }
.override-badge::before { content: none; }
.badge.off { background: var(--sev-low-tint); color: var(--sev-low-text); }
.badge.off::before { content: none; }
.client-rule.has-override { background: var(--override-tint); border-radius: var(--radius); padding-left: 10px; padding-right: 10px; }

/* ---------- настройки: тема (карточки тем + режим) ----------
   Миниатюра — две половины, светлый и тёмный режим темы. Цвета половин
   инлайн из settings.html (литералы, не токены: миниатюра должна выглядеть
   так же, в какой бы теме ни была сама страница); полоска шкалы красится
   своим data-theme-name. */
/* /settings: меню разделов слева, раздел справа (settings_layout.html).
   Контейнер шире обычного, чтобы разделу досталась ширина вкладки «Обзор»
   (≈1040px) — на «Блоках обзора» превью блоков рисуется в ней. */
.container:has(> .settings-shell) { max-width: 1300px; }
.settings-shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-nav { position: sticky; top: 12px; display: grid; gap: 1px; padding: 10px; margin: 0; min-width: 0; }
.settings-nav-cap {
  margin: 12px 0 4px; padding: 0 8px; font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2);
}
.settings-nav-cap:first-child { margin-top: 2px; }
.settings-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px; border-radius: 5px; font-size: var(--fs-ui); color: var(--fg);
}
.settings-nav a:hover { background: var(--bg-subtle); text-decoration: none; }
.settings-nav a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; }
.settings-nav small { font-size: 12px; color: var(--muted-2); font-weight: 400; font-variant-numeric: tabular-nums; }
.settings-nav-badge {
  min-width: 18px; padding: 0 6px; border-radius: 999px; text-align: center;
  font-size: 11.5px; font-weight: 600; line-height: 18px;
  background: var(--accent); color: var(--accent-fg);
}
/* «Наблюдение» в меню: упала проверка /healthz (что именно — в title пункта) */
.settings-nav-alarm {
  width: 8px; height: 8px; margin-right: 4px; border-radius: 999px; flex: none; background: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 22%, transparent);
}
.settings-pane { min-width: 0; }
@media (max-width: 760px) {
  .settings-shell { grid-template-columns: minmax(0, 1fr); }
  /* меню становится прокручиваемой строкой, группы — без подписей */
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; padding: 6px; }
  .settings-nav-cap { display: none; }
  .settings-nav a { flex: none; white-space: nowrap; }
}

.settings-section { padding: 14px 0 18px; border-top: 1px solid var(--border); }
.seclog td { vertical-align: top; }
/* размер текста и отступы — как у таблиц Cash Flow (.campaigns-table); min-width первой колонки там не нужен */
.seclog td:first-child { min-width: 0; }
/* неудачные входы и отказы — то, ради чего журнал открывают */
.seclog-action { white-space: nowrap; }
.seclog-login_failed { color: var(--sev-critical-text); }
/* «Наблюдение»: /settings/errors, /activity, /summary (tasks/observability/02).
   Таблицы — те же .seclog/.campaigns-table; здесь только акценты. */
.seg > a { text-decoration: none; }
.seg > [aria-current="true"] { background: var(--bg-raised); color: var(--fg); font-weight: 600; }
.obs-toolbar { margin: 0 0 12px; }
.obs-h { font-size: 13.5px; font-weight: 600; margin: 18px 0 8px; }
.obs-h .muted { font-weight: 400; }
.obs-mono { font-family: var(--mono); font-size: 11.5px; }
.obs-err-cell .obs-mono { margin-left: 6px; word-break: break-all; }
.obs-err-msg { font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.obs-source { white-space: nowrap; color: var(--muted); }
.obs-resolved td { color: var(--muted); }
.obs-err-head { display: grid; gap: 12px; }
.obs-err-head .inline-stats + .inline-stats { margin-top: 0; }
.obs-err-title { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.obs-err-title h2 { margin: 0; overflow-wrap: anywhere; }
.obs-trace {
  margin: 0; padding: 10px 12px; max-height: 420px; overflow: auto; border-radius: var(--radius);
  background: var(--bg-subtle); border: 1px solid var(--border); color: var(--fg);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.obs-activity td { padding-top: 6px; padding-bottom: 6px; }
/* htmx-подзапросы — часть страницы, их глушим; бизнес-события — то, ради чего смотрят */
.obs-activity .obs-htmx td { color: var(--muted-2); font-size: 11.5px; }
.obs-activity .obs-kind-event td { font-weight: 600; }
.obs-activity .obs-kind-event td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.obs-activity .obs-kind-job td:first-child { box-shadow: inset 3px 0 0 var(--muted-2); }
.obs-activity .obs-has-error td:first-child { box-shadow: inset 3px 0 0 var(--sev-critical); }
.obs-activity .obs-highlight td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
/* активность: адрес запроса и статус с названием */
.obs-path { font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.obs-path-c { white-space: nowrap; }
.obs-path-m { display: inline-block; min-width: 3.4ch; margin-right: 6px; color: var(--muted-2); }
.obs-path-none { color: var(--muted-2); }
.obs-htmx .obs-path { font-size: 11px; }
.obs-st { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.obs-st-code { min-width: 3ch; text-align: right; }
.obs-st-word { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.obs-3xx .obs-st-word { color: var(--info-text); }
.obs-4xx .obs-st-word { color: var(--sev-medium-text); }
.obs-5xx .obs-st-word { color: var(--sev-critical-text); }
.obs-err-link { color: var(--sev-critical-text); font-weight: 600; white-space: nowrap; }
.obs-5xx { color: var(--sev-critical-text); font-weight: 600; }
.obs-4xx { color: var(--sev-medium-text); }
.obs-summary-strip { padding: 12px 14px; }
.obs-summary-strip .inline-stats { padding-top: 0; border-top: 0; gap: 6px 26px; }
.obs-delta { font-size: 11.5px; color: var(--muted-2); margin-left: 2px; }
.obs-up { color: var(--ok-text); }
.obs-down { color: var(--sev-critical-text); }
.obs-funnel td:first-child { width: 40%; }
.obs-bar-cell { width: 40%; }
.obs-bar { display: block; height: 6px; min-width: 2px; border-radius: 999px; background: var(--accent); }
.obs-weeks .obs-current td { color: var(--muted); }
/* проверки /healthz (tasks/observability/03): точки в строке справа от вкладок и в вердикте «Сейчас» */
.obs-health-item { display: inline-flex; align-items: baseline; gap: 6px; }
.obs-health-dot { width: 7px; height: 7px; border-radius: 999px; flex: none; align-self: center; }
.obs-health-ok { background: var(--ok); }
.obs-health-fail { background: var(--danger); }
.obs-health-na { background: var(--muted-2); }
/* вкладки «Наблюдения» (settings_observe_layout.html): Сейчас / Сводка /
   Активность / Ошибки / Безопасность, (i) с пояснением к вкладке и справа
   те же проверки /healthz в одну строку (подробности — в title) */
.obs-tabs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: 0 0 14px; }
.obs-tabs nav { display: flex; gap: 2px; overflow-x: auto; }
.obs-tabs nav a {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; margin-bottom: -1px;
  font-size: var(--fs-ui); color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.obs-tabs nav a:hover { color: var(--fg); text-decoration: none; }
.obs-tabs nav a[aria-current="page"] { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }
.obs-tabs .settings-nav-badge { min-width: 16px; padding: 0 5px; font-size: 11px; line-height: 16px; }
/* неудачные входы за 24 ч — тревожный, а не счётчик «надо разобрать» */
.obs-tabs .obs-tab-warn { background: var(--sev-critical-tint); color: var(--sev-critical-text); }
/* (i) стоит в конце строки вкладок, поповер открывается влево */
.obs-help .pop-body { left: auto; right: -4px; font-size: var(--fs-ui-sm); line-height: 1.5; color: var(--muted); }
.obs-help > summary.pop-trigger { display: inline-flex; }
.obs-help > summary svg { width: 14px; height: 14px; }
/* событие безопасности → «Активность» в этот момент */
.obs-xlink { font-size: 11.5px; white-space: nowrap; }

/* «Наблюдение», общие куски вкладок (раунд 3: Ошибки / Активность / Безопасность / Сводка).
   Таблица в карточке без полей (.obs-flush), строка-инструменты над ней,
   плотные строки, пустое состояние и подвал списка. */
.obs-flush { padding: 0; overflow: hidden; }
.obs-nowrap { white-space: nowrap; }
.obs-pad { margin: 0; padding: 12px; }
.obs-minw0 { min-width: 0; }
.obs-noshrink { flex: none; }
.obs-back { margin: 0 0 4px; }
.obs-err-msg-head { margin: 4px 0 0; }
.obs-toolbar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.obs-search { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.obs-search input { width: 230px; max-width: 100%; padding: 4px 9px; font-size: 12.5px; }
.obs-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.obs-sticky { max-height: 70vh; overflow: auto; }
.obs-sticky thead th { position: sticky; top: 0; z-index: 1; box-shadow: inset 0 -1px 0 var(--border); }
.obs-tight .campaigns-table td { padding-top: 7px; padding-bottom: 7px; }
.obs-tight .obs-err-cell { width: 58%; max-width: 0; }
.obs-err-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obs-err-line .obs-mono { margin-left: 8px; }
.obs-err-line .obs-err-inl { margin-left: 10px; font-size: 12px; color: var(--muted); }
.obs-src { display: inline-block; padding: 0 7px; border: 1px solid var(--border); border-radius: 999px; font-size: 11.5px; line-height: 17px; color: var(--muted); white-space: nowrap; }
.obs-empty { display: grid; justify-items: center; gap: 3px; padding: 28px 14px; text-align: center; font-size: 13px; }
.obs-empty b { font-size: 13.5px; font-weight: 600; }
.obs-empty svg { width: 22px; height: 22px; color: var(--ok); margin-bottom: 4px; }
.obs-empty .btn { margin-top: 8px; }
.obs-foot { display: flex; gap: 4px 16px; flex-wrap: wrap; padding: 7px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--bg-subtle); font-variant-numeric: tabular-nums; }
.obs-empty-row td { padding: 22px 12px; text-align: center; color: var(--muted); }

/* фильтры: одна строка, подпись слева от поля, применяются сразу (data-autosubmit) */
.obs-filters { display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; }
.obs-filters .obs-f { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: 12.5px; color: var(--muted); }
.obs-filters .obs-f select, .obs-filters .obs-f input { display: inline-block; margin: 0; width: auto; padding: 4px 8px; font-size: 12.5px; }
.obs-filters .obs-f select { max-width: 220px; }
.obs-filters .obs-f-id input { width: 150px; }
.obs-filters .obs-meta { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.obs-step { display: inline-flex; align-items: center; gap: 4px; }
.obs-step .btn { padding: 3px 8px; }
.obs-reset { font-size: 12.5px; }
.obs-note { margin: -4px 0 12px; font-size: 12.5px; color: var(--muted); }

/* активность: одна таблица, сессии — строки-разделители внутри своих <tbody> */
.obs-grp-h td { padding: 6px 12px; background: var(--bg-subtle); border-bottom: 1px solid var(--border); font-size: 12.5px; }
.obs-activity .obs-grp-h td { padding-top: 6px; padding-bottom: 6px; box-shadow: none; font-weight: 400; color: var(--fg); }
.obs-grp-h b { font-weight: 600; }
.obs-grp-h .muted { margin-left: 8px; }

/* шапка вкладок: справа плашка состояния сервиса (поповер со всеми проверками) */
.obs-hp { margin-left: auto; padding: 4px 0; }
.obs-hp > summary { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; color: var(--muted); background: var(--bg); }
.obs-hp > summary:hover { border-color: var(--muted-2); color: var(--fg); }
.obs-hp.obs-health-bad > summary { border-color: color-mix(in oklab, var(--sev-critical) 45%, var(--bg)); background: var(--sev-critical-tint); color: var(--sev-critical-text); font-weight: 600; }
.obs-hp .pop-body { top: 32px; right: 0; left: auto; width: 290px; font-size: var(--fs-ui-sm); }
.obs-hp-row { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; }
.obs-hp-row .obs-health-dot { align-self: center; }
.obs-hp-row > span:last-child { margin-left: auto; text-align: right; color: var(--muted); font-size: 12px; }
.obs-hp-row > .obs-5xx { color: var(--sev-critical-text); }

/* «Сейчас» (settings_observe.html): вердикт → «Дела» → «Люди» | «Сегодня».
   Шапки, строки и крупные цифры карточек — общие .obs-dash-*. */
.obs-card { margin: 0; padding: 0; overflow: hidden; min-width: 0; }
.obs-refresh { margin-left: auto; padding: 6px 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.obs-verdict { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; padding: 12px 14px; margin: 0 0 12px; font-size: 13px; }
.obs-verdict-state { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.obs-verdict-state::before { content: ""; width: 10px; height: 10px; border-radius: 999px; background: var(--ok); }
.obs-verdict-bad { background: var(--sev-critical-tint); border-color: color-mix(in oklab, var(--sev-critical) 45%, var(--bg)); }
.obs-verdict-bad .obs-verdict-state::before { background: var(--sev-critical); }
.obs-verdict-checks { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.obs-verdict-checks > span { display: inline-flex; align-items: center; gap: 5px; }
/* ошибка исправлена / заявка подтверждена прямо из «Дел» — строка с отменой */
.obs-flash { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; margin: -4px 0 12px; padding: 0 2px; font-size: 12.5px; color: var(--muted); }
.obs-flash form { display: inline; margin: 0; }
.obs-linkbtn { font: inherit; border: 0; padding: 0; background: none; color: var(--accent); cursor: pointer; }
.obs-linkbtn:hover { text-decoration: underline; }
.obs-tasks { margin-bottom: 12px; }
.obs-task { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.obs-task:last-child { border-bottom: 0; }
.obs-sev { width: 8px; height: 8px; border-radius: 2px; align-self: center; }
.obs-sev-crit { background: var(--sev-critical); }
.obs-sev-high { background: var(--sev-high); }
.obs-sev-info { background: var(--accent); }
.obs-task-main { min-width: 0; }
.obs-task-main > b { font-weight: 600; }
.obs-task-d { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obs-task-act { display: inline-flex; gap: 10px; align-items: center; font-size: 12px; white-space: nowrap; }
.obs-task-act form { margin: 0; }
.obs-now-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 960px) { .obs-now-grid { grid-template-columns: minmax(0, 1fr); } }
/* «Люди»: строка на человека; клик раскрывает его день (details), наведение
   подсвечивает его часы на графике (observe_now.js) */
.obs-people .obs-dash-h { flex-wrap: wrap; }
.obs-people-seg { margin-left: 4px; }
.obs-people-seg > a { padding: 1px 9px; font-size: 11.5px; }
.obs-person { border-top: 1px solid var(--border); font-size: 13px; transition: background .12s; }
.obs-dash-h + .obs-person { border-top: 0; }
.obs-person[data-hl]:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.obs-person-row { display: grid; grid-template-columns: 12px 150px minmax(0, 1fr); gap: 2px 10px; align-items: baseline; padding: 9px 12px; list-style: none; }
summary.obs-person-row { cursor: pointer; }
summary.obs-person-row::-webkit-details-marker { display: none; }
.obs-person-car { font-size: 9px; color: var(--muted-2); transition: transform .15s; }
.obs-person[open] .obs-person-car { transform: rotate(90deg); }
.obs-person-who { min-width: 0; }
.obs-person-who b { display: block; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obs-person-who > span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.obs-person-system .obs-person-who b { color: var(--muted); }
.obs-person-live { display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 999px; background: var(--ok); vertical-align: 1px; }
.obs-person-sum { min-width: 0; font-size: 12.5px; color: var(--muted); }
.obs-person-sum b { color: var(--fg); font-weight: 600; }
.obs-person-r { grid-column: 3; display: inline-flex; gap: 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.obs-person-tl { margin: 0 12px 10px 34px; padding: 2px 0 2px 12px; border-left: 2px solid var(--border); font-size: 12.5px; }
.obs-person-tl > div { display: flex; gap: 10px; align-items: baseline; padding: 2px 0; }
.obs-person-t { width: 40px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.obs-tl-page { color: var(--muted); }
.obs-tl-ev { font-weight: 600; }
.obs-tl-err { color: var(--sev-critical-text); font-weight: 600; }
.obs-tl-more { font-size: 12px; }
/* «Сегодня»: запросы по часам (viewBox 240 × высота, 10 единиц на час) */
.obs-hc { padding: 4px 12px 10px; }
.obs-hc-cap { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 4px; font-size: 11.5px; color: var(--muted-2); }
.obs-hc svg { display: block; width: 100%; }
.obs-hc-bar { fill: color-mix(in oklab, var(--accent) 38%, var(--bg)); }
.obs-hc-now { fill: var(--accent); }
.obs-hc-err { fill: var(--sev-critical); }
.obs-hc-base { fill: var(--border); }
.obs-hc-person { fill: var(--accent); display: none; }
.obs-hc-focus .obs-hc-bar, .obs-hc-focus .obs-hc-now { opacity: .28; }
.obs-hc-focus .obs-hc-person.on { display: block; }
.obs-hc-who { color: var(--accent); font-weight: 600; }
.obs-hc-axis { display: flex; justify-content: space-between; margin-top: 3px; font-size: 10.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.obs-week { padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.obs-week-h { display: flex; margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.obs-week-h a { margin-left: auto; }
.obs-week .inline-stats { padding-top: 0; border-top: 0; gap: 6px 22px; font-size: 12.5px; }
.obs-dash-h { display: flex; align-items: baseline; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.obs-dash-h b { font-weight: 600; }
.obs-dash-h > a { margin-left: auto; font-size: 12px; white-space: nowrap; }
.obs-dash-row { display: flex; align-items: baseline; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.obs-dash-row:last-child { border-bottom: 0; }
.obs-dash-t { flex: none; width: 76px; color: var(--muted); font-variant-numeric: tabular-nums; }
.obs-dash-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obs-dash-r { margin-left: auto; flex: none; color: var(--muted); white-space: nowrap; }
a.obs-dash-r { color: var(--accent); }
.obs-dash-big { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 10px 12px 12px; font-size: 12.5px; color: var(--muted); }
.obs-dash-big b { display: block; font-size: 20px; line-height: 1.15; color: var(--fg); font-variant-numeric: tabular-nums; }
.obs-dash-empty { margin: 0; padding: 10px 12px; }
.settings-label { font-weight: 600; font-size: 13.5px; margin: 0; }
.settings-hint { font-size: 12.5px; margin: 2px 0 0; color: var(--muted); }
/* тема на строку: радио, миниатюра, название и шкала балла этой темы —
   строка несёт data-theme-name, и [data-theme-name] ниже перекрашивает
   токены шкалы только внутри неё */
.theme-rows { display: grid; margin-top: 10px; }
.theme-row {
  display: grid; grid-template-columns: 16px 104px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  margin: 0; padding: 9px 8px; border-top: 1px solid var(--border); cursor: pointer; color: var(--fg);
}
.theme-row:first-child { border-top: 0; }
.theme-row:hover { background: var(--bg-subtle); }
.theme-row:has(input:checked) { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.theme-row input { width: auto; margin: 0; }
.theme-row .theme-thumb { height: 40px; }
.theme-row .theme-thumb-half { grid-template-rows: 7px 1fr; }
.theme-row .tt-body { padding: 3px; }
.theme-row .tt-card { gap: 2px; padding: 2px; }
.theme-row-name { display: block; font-size: 13.5px; font-weight: 600; }
.theme-row-desc { display: block; font-size: 12.5px; color: var(--muted); }
.theme-row-scale { display: flex; gap: 6px; }
.theme-row-scale .cf-score-num { min-width: 22px; font-size: 15px; text-align: right; }
@media (max-width: 600px) {
  .theme-row { grid-template-columns: 16px 88px minmax(0, 1fr); row-gap: 6px; }
  .theme-row-scale { grid-column: 3; }
}
.theme-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.theme-head .settings-hint { margin: 0; }
.theme-head .mode-seg { margin: 0 0 0 auto; }
.theme-thumb { border: 1px solid var(--border); border-radius: 4px; overflow: hidden; display: flex; height: 62px; }
.theme-thumb-half { flex: 1; min-width: 0; display: grid; grid-template-rows: 10px 1fr; }
.tt-bar { display: flex; align-items: center; gap: 3px; padding: 0 5px; border-bottom: 1px solid; }
.tt-bar i { display: block; width: 12px; height: 3px; border-radius: 2px; }
.tt-body { padding: 5px; }
.tt-card { display: grid; gap: 4px; padding: 4px; border: 1px solid; border-radius: 3px; }
.tt-line { height: 3px; width: 70%; border-radius: 2px; opacity: .5; }
.tt-strip { display: flex; height: 5px; border-radius: 2px; overflow: hidden; }
.tt-strip i { flex: 1; }
.tt-btn { width: 22px; height: 6px; border-radius: 2px; }

.mode-seg { display: inline-flex; flex-wrap: wrap; margin: 8px 0 16px; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.mode-seg label { margin: 0; cursor: pointer; }
.mode-seg span { display: block; padding: 5px 12px; font-size: 13px; color: var(--muted); border-right: 1px solid var(--border); }
.mode-seg label:last-child span { border-right: 0; }
.mode-seg input:checked + span { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--fg); font-weight: 600; }
.mode-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* строка настройки, переиспользуемая для будущих разделов */
.settings-field { display: flex; align-items: center; gap: 16px; padding: 14px 0 0; border-top: 1px solid var(--border); }
.settings-field-body { flex: 1; min-width: 0; }
.settings-field-control { flex: none; }

@media (max-width: 640px) {
  .rule-form-grid { grid-template-columns: 1fr; }
  .rule-form-grid .span2 { grid-column: auto; }
  .cond-field, .cond-op, .cond-value { max-width: 100%; }
  .preview-controls { flex-wrap: wrap; }
}

/* ---------- печать / PDF ---------- */
.print-only { display: none; }

@media print {
  body { background: #fff; }
  .topbar, .filters, .toc, .no-print, dialog { display: none !important; }
  .container { margin: 0; max-width: none; }
  .container > * { animation: none !important; }
  .card { border: 1px solid #ddd; break-inside: avoid; }
  .report-block { break-inside: auto; }
  .finding, .verdict, .report-head { break-inside: avoid; }
  a { text-decoration: none; color: inherit; }
  .print-only { display: block; }
  .report-print-footer {
    margin-top: 24px; padding-top: 10px; border-top: 1px solid #ddd;
    font-size: 0.8rem; color: #666;
  }
  /* цвета серьёзности обязаны пережить печать */
  .badge, .sev-meter span, .sev-legend .dot, .verdict-top .dot, .sev-dot i,
  .verdict-title::before, .recommendation, .all-good .icon, .note {
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
  /* свёрнутые серии находок раскрываются целиком */
  .finding-group[data-collapsed] .finding:nth-of-type(n+6) { display: block; }
}

@media (max-width: 640px) {
  .topbar { height: auto; padding: 10px 16px; flex-wrap: wrap; }
  .topbar__right { flex: 1 1 100%; justify-content: space-between; gap: 14px; }
  .brand { white-space: nowrap; }
  .topbar nav { gap: 14px; }
  .report-actions { flex-wrap: wrap; }
  .report-head { flex-direction: column; }
  .profile-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .profile-head .report-actions { margin-left: 0; }
  .filters select { margin-left: 0; width: 100%; }
  .verdict-stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px 24px; }
  .stat::before { left: -12px; }
  td.row-actions { text-align: left; }
}

/* ---------- Cash Flow (task 04) ---------- */
:root {
  /* «Отлично» / «Норма» и «Хорошо» — верх шкалы балла (см. severity-блок
     выше: один цвет на обе темы, плашка и текст — color-mix) */
  --cf-top: #1380c7;
  --cf-top-tint: color-mix(in oklab, var(--cf-top) 18%, var(--bg));
  --cf-top-text: color-mix(in oklab, var(--cf-top) 50%, var(--fg));
  --cf-ly: #3fa8bf;
  --cf-ly-tint: color-mix(in oklab, var(--cf-ly) 18%, var(--bg));
  --cf-ly-text: color-mix(in oklab, var(--cf-ly) 50%, var(--fg));
}

/* Темы (Настройки → «Тема», localStorage `portal.themeName`, атрибут
   data-theme-name ставит base.html до первой отрисовки; без атрибута —
   «Директ» из :root). Тема = пять сплошных цветов шкалы балла (здесь) +
   нейтральные цвета и акцент для светлого и тёмного режима (блок «Темы» после
   тёмной темы). Шкала — один hex на оба режима, -tint/-text на :root
   смешиваются из них заново. Селектор шкалы без `html`, чтобы тот же атрибут
   красил полоски-образцы на карточках настроек. */
[data-theme-name="direct"] { --cf-top: #1380c7; --cf-ly: #3fa8bf; --sev-medium: #d1ac4e; --sev-high: #df7421; --sev-critical: #d03739; }
[data-theme-name="signal"] { --cf-top: #20a04e; --cf-ly: #86af17; --sev-medium: #dfa706; --sev-high: #e47000; --sev-critical: #db3834; }
[data-theme-name="calm"]   { --cf-top: #3c9467; --cf-ly: #759843; --sev-medium: #b48920; --sev-high: #cc7038; --sev-critical: #c04c48; }
[data-theme-name="even"]   { --cf-top: #3eab5e; --cf-ly: #8b9e0f; --sev-medium: #b78b00; --sev-high: #d77526; --sev-critical: #df6864; }
[data-theme-name="jewel"]  { --cf-top: #009772; --cf-ly: #7bba3a; --sev-medium: #ebaa2d; --sev-high: #e9683f; --sev-critical: #cd285e; }

/* новый аудит Cash Flow: панель запуска с тремя номерами шагов, методология
   пилюлями, таблица кампаний с липкой шапкой и док снизу, когда панель
   запуска ушла из вида */
.cf-new { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.cf-new .card { margin-bottom: 0; }
.cf-new label { margin: 0; color: inherit; font-size: inherit; }
.cf-new label input { display: inline-block; margin-top: 0; width: auto; }
.cf-launch-row {
  display: grid; gap: 12px 16px; align-items: start;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr) minmax(0, 1.2fr) auto;
}
.cf-launch-field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.cf-launch-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-ui-sm); color: var(--muted); white-space: nowrap; }
.cf-launch-note { margin: 0; font-size: 12px; color: var(--muted); }
.cf-launch-note.error { color: var(--sev-critical-text); }
.cf-field-error { margin: 0; font-size: 12px; color: var(--sev-critical-text); }
.cf-launch-btn { height: 40px; padding: 0 18px; font-size: 14px; justify-content: center; }
/* пока не всё заполнено, кнопка контурная; нажать можно — покажет, чего нет */
.cf-launch-btn.is-pending,
.cf-launch-btn.is-pending:hover {
  background: var(--bg); color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 40%, var(--border));
}
.cf-money { position: relative; display: block; }
.cf-new .cf-money input { width: 100%; height: 40px; padding-right: 30px; font-variant-numeric: tabular-nums; }
.cf-money::after {
  content: "₽"; position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}

/* номер шага: серое кольцо → зелёный круг, номер остаётся */
.cf-step {
  display: inline-grid; place-items: center; flex: none; width: 17px; height: 17px; border-radius: 50%;
  border: 1.5px solid var(--muted-2); color: var(--muted); font-size: 10.5px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; transition: background .15s, border-color .15s, color .15s;
}
.cf-step.is-done { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.cf-launch-field.is-invalid .cf-step { border-color: var(--danger); color: var(--sev-critical-text); }
.cf-launch-field.is-ok .cf-goal-trigger,
.cf-new .cf-launch-field.is-ok .cf-money input { border-color: color-mix(in oklab, var(--ok) 55%, var(--border-strong)); }
.cf-launch-field.is-ok .cf-coverage { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ok) 55%, var(--border-strong)); }
.cf-launch-field.is-invalid .cf-goal-trigger,
.cf-new .cf-launch-field.is-invalid .cf-money input { border-color: var(--danger); }
.cf-launch-field.is-invalid .cf-coverage { box-shadow: inset 0 0 0 1px var(--danger); }

/* цель Метрики — <details class="pop">: закрытие по клику вне и Esc — base.html */
.cf-goal-dd { position: relative; }
.cf-goal-trigger {
  display: flex; align-items: baseline; gap: 8px; height: 40px; padding: 0 30px 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg);
  line-height: 38px; white-space: nowrap; overflow: hidden; position: relative;
}
.cf-goal-trigger::after {
  content: ""; position: absolute; right: 13px; top: 14px; width: 6px; height: 6px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg);
}
.cf-goal-dd[open] > .cf-goal-trigger { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.cf-goal-dd.is-disabled > .cf-goal-trigger { cursor: default; background: var(--bg-subtle); }
.cf-goal-current { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cf-goal-current.is-empty { font-weight: 400; color: var(--muted-2); }
.cf-goal-counter { flex: none; font-size: var(--fs-ui-sm); color: var(--muted); }
.cf-goal-body {
  top: calc(100% + 4px); left: 0; right: auto; width: max(100%, 340px); max-width: calc(100vw - 32px);
  padding: 8px; display: grid; gap: 6px;
}
.cf-goal-body input[type=search] { width: 100%; padding: 6px 9px; font-size: var(--fs-ui); }
.cf-goal-options { max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.cf-goal-group {
  position: sticky; top: 0; display: flex; gap: 6px; padding: 6px 8px;
  background: var(--bg-raised); color: var(--muted-2); border-radius: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.cf-goal-group span { font-family: var(--mono); font-weight: 400; letter-spacing: 0; }
.cf-goal-option {
  display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 4px;
  background: transparent; color: var(--fg); font: inherit; font-size: var(--fs-ui); text-align: left; cursor: pointer;
}
.cf-goal-option:hover { background: var(--bg-subtle); }
.cf-goal-option.is-selected { background: var(--bg-subtle); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.cf-goal-num { margin-left: auto; flex: none; font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--muted-2); }
.cf-goal-empty { margin: 0; padding: 8px; font-size: var(--fs-ui-sm); color: var(--muted); }

/* покрытие — поле только для чтения, полоса из кампаний по нижнему краю */
.cf-coverage {
  position: relative; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 11px;
  border-radius: var(--radius); background: var(--bg-raised); overflow: hidden; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cf-coverage b { font-size: 15px; }
.cf-coverage span { font-size: var(--fs-ui-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.cf-coverage-bar { display: flex; overflow: hidden; }
.cf-coverage .cf-coverage-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; }
.cf-coverage-bar i {
  flex-basis: 0; min-width: 2px; background: var(--accent);
  border-right: 1px solid var(--bg); transition: background .2s;
}
.cf-coverage-bar i:last-child { border-right: 0; }
.cf-coverage-bar i.is-off { background: var(--border-strong); }

/* методология: кнопка «Расчёт» справа от крошек открывает окно — плитки
   с настройками слева, панель «Как считается» справа */
.cf-toprow { display: flex; align-items: center; gap: 12px; min-height: 30px; }
.cf-toprow .crumbs { margin: 0; }
.cf-method-pop { margin-left: auto; }
.cf-method-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--bg);
  font-size: var(--fs-ui); color: var(--muted); white-space: nowrap; transition: border-color .12s;
}
.cf-method-btn:hover { border-color: var(--muted-2); color: var(--fg); }
.cf-method-pop[open] > .cf-method-btn { border-color: var(--accent); color: var(--fg); }
.cf-method-btn.is-changed { border-color: color-mix(in oklab, var(--accent) 55%, var(--border)); }
.cf-method-btn svg { width: 14px; height: 14px; flex: none; }
.cf-method-btn b { color: var(--fg); font-weight: 600; }
.cf-method-btn.is-changed b { color: var(--accent); }
.cf-win { top: calc(100% + 6px); right: 0; left: auto; width: 800px; max-width: calc(100vw - 32px); padding: 16px 16px 0; overflow: hidden; }
.cf-win-main { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; }
.cf-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.cf-tile { display: grid; gap: 7px; align-content: start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.cf-tile-wide { grid-column: 1 / -1; }
.cf-tile.is-changed { border-color: color-mix(in oklab, var(--accent) 55%, var(--border)); }
.cf-tile-t { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-ui-sm); color: var(--muted); }
.cf-tile-v { font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 600; }
.cf-tile-d { font-size: 12px; line-height: 1.4; color: var(--muted); }
/* шапка окна: состояние расчёта и «Сбросить» */
.cf-win-set { min-width: 0; }
.cf-win-head { display: flex; align-items: center; gap: 10px; min-height: 22px; margin-bottom: 12px; }
.cf-win-head .pop-title { margin: 0; }
.cf-win-state { font-size: var(--fs-ui-sm); color: var(--muted); }
.cf-link {
  display: inline-flex; align-items: center; gap: 5px; margin: -3px -6px -3px auto; padding: 3px 6px; border: 0; border-radius: 4px;
  background: transparent; color: var(--accent); font: inherit; font-size: var(--fs-ui-sm); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.cf-link:hover:not(:disabled) { background: color-mix(in oklab, var(--accent) 12%, var(--bg)); }
.cf-link:disabled { color: var(--muted-2); font-weight: 500; cursor: default; }
.cf-link svg { width: 13px; height: 13px; flex: none; }
/* «Допуск к CPA» на всю ширину: тумблер слева, пояснение справа */
.cf-mg { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 7px 18px; }
.cf-mg .cf-tile-t { grid-column: 1; }
.cf-mg .cf-switch { grid-column: 1; grid-row: 2; }
.cf-mg .cf-tile-d { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.cf-tile-wide .cf-slider { margin: 2px 8px 0; }
.cf-seg { height: 28px; border-color: var(--border-strong); border-radius: var(--radius); font-size: var(--fs-ui); width: 100%; }
.cf-seg > label { position: relative; flex: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; color: var(--muted); cursor: pointer; border-color: var(--border-strong); white-space: nowrap; }
.cf-seg > label input { position: absolute; opacity: 0; pointer-events: none; }
.cf-seg > label:hover { color: var(--fg); }
.cf-seg > label:has(input:checked) { background: var(--fg); color: var(--bg); font-weight: 600; }
.cf-seg > label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.cf-tile.is-changed .cf-seg > label:has(input:checked) { background: var(--accent); color: var(--accent-fg); }
.cf-switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-ui); color: var(--fg); }
.cf-switch input { position: absolute; opacity: 0; pointer-events: none; }
.cf-switch i { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--switch-off); transition: background .15s; }
.cf-switch i::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s;
}
.cf-switch input:checked + i { background: var(--accent); }
.cf-switch input:checked + i::after { transform: translateX(14px); }
.cf-switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.cf-calc { align-self: start; padding: 12px 14px; border-radius: var(--radius); background: var(--bg-subtle); }
.cf-calc .pop-title { margin-bottom: 8px; }
.cf-calc .cf-formulas-list { grid-template-columns: 1fr; gap: 1px; }
.cf-calc .cf-formulas-list dd { margin-bottom: 8px; }
/* неизменяемые условия аудита — полоса внизу окна */
.cf-win-fixed {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; margin: 16px -16px 0; padding: 9px 16px;
  border-top: 1px solid var(--border); background: var(--bg-subtle);
  font-size: 12.5px; color: var(--muted);
}
.cf-win-fixed-lead { display: inline-flex; align-items: center; gap: 6px; }
.cf-win-fixed svg { width: 13px; height: 13px; }
.cf-win-fixed b { font-weight: 600; color: var(--fg); }
/* правила методики с примерами на введённом KPI */
.cf-formulas-list { display: grid; grid-template-columns: max-content 1fr; gap: 9px 14px; margin: 0; font-size: 12.5px; line-height: 1.45; }
.cf-formulas-list dt { color: var(--muted); }
.cf-formulas-list dd { margin: 0; color: var(--fg); }
.cf-formulas-ex { display: block; margin-top: 2px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cf-formulas-ex b, .cf-formulas-list dd > b { color: var(--fg); font-weight: 600; }
@media (max-width: 860px) {
  /* окно во всю ширину страницы, панель формул уходит под плитки */
  .cf-toprow { position: relative; }
  .cf-method-pop { position: static; }
  .cf-win { left: 0; right: 0; width: auto; max-width: none; }
  .cf-win-main { grid-template-columns: minmax(0, 1fr); }
  .cf-win { max-height: calc(100vh - 140px); overflow-y: auto; }
}
@media (max-width: 560px) {
  .cf-tiles { grid-template-columns: minmax(0, 1fr); }
  .cf-mg { grid-template-columns: minmax(0, 1fr); }
  .cf-mg .cf-tile-d { grid-column: 1; grid-row: auto; }
  .cf-win-state { display: none; }
}

/* светофор: зоны в масштабе 0–60%, метки порогов тянутся */
.cf-z-norm        { background: var(--cf-top-tint);       color: var(--cf-top-text); }
.cf-z-minor       { background: var(--sev-medium-tint);   color: var(--sev-medium-text); }
.cf-z-significant { background: var(--sev-high-tint);     color: var(--sev-high-text); }
.cf-z-red         { background: var(--sev-critical-tint); color: var(--sev-critical-text); }
.cf-slider { position: relative; padding-bottom: 30px; margin-top: 2px; user-select: none; touch-action: none; }
.cf-slider-track { position: relative; height: 28px; border-radius: 5px; overflow: hidden; background: var(--bg-raised); }
.cf-slider-zone {
  position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding: 0 7px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cf-slider-handle {
  position: absolute; top: -5px; width: 16px; height: 38px; margin-left: -8px; padding: 0;
  border: 0; background: transparent; cursor: ew-resize; touch-action: none;
}
.cf-slider-handle::before {
  content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 4px; border-radius: 2px;
  background: var(--fg); box-shadow: 0 0 0 2px var(--bg);
}
.cf-slider-handle:focus-visible { outline: none; }
.cf-slider-handle:focus-visible::before { background: var(--accent); }
.cf-slider-handle span {
  position: absolute; top: 40px; left: 50%; transform: translateX(-50%);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--fg);
}
.cf-slider-end { position: absolute; left: 0; bottom: 0; font-size: 11px; color: var(--muted-2); }
.cf-slider-end--max { left: auto; right: 0; }
.cf-slider-end--max::before { content: "60%+"; }

/* таблица кампаний: шапка с фильтрами и заголовки колонок липнут к верху */
.cf-campaigns-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  position: sticky; top: 0; z-index: 5; margin: -16px -18px 0; padding: 14px 18px 10px;
  background: var(--bg); border-radius: var(--radius) var(--radius) 0 0;
}
.cf-campaigns-bar h2 { margin: 0; flex: 1; font-size: 1rem; }
.cf-campaigns-bar h2 .muted { font-size: var(--fs-ui-sm); margin-left: 6px; }
.cf-campaigns-bar input[type=search] { width: 220px; padding: 5px 10px; font-size: var(--fs-ui); }
.cf-campaigns:not(.show-all):not(.is-searching) .cf-extra-row { display: none; }
/* overflow-x у .table-scroll ломает sticky — на широком экране таблица и так влезает */
@media (min-width: 761px) {
  .cf-campaigns .table-scroll { overflow: visible; }
  .cf-campaigns-table thead th { position: sticky; top: var(--cf-bar-h, 0px); z-index: 4; }
}
.cf-campaigns-table th:first-child input, .cf-campaigns-table td:first-child input[type=checkbox] { margin: 0; }
.cf-campaigns-table td:first-child { min-width: 0; width: 34px; padding-right: 0; }
.cf-campaigns-table td:nth-child(2) { min-width: 220px; }
.cf-campaigns-table tbody tr { cursor: pointer; }
.cf-campaigns-table tbody tr:hover td { background: var(--row-flag); }
.cf-campaigns-table tbody tr:has(.cf-campaign-checkbox:checked) td { background: color-mix(in srgb, var(--accent) 5%, var(--bg)); }
.cf-campaigns-table tbody tr:has(.cf-campaign-checkbox:checked) td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.cf-campaigns-table tr:has(.cf-campaign-checkbox:not(:checked)) td:not(:first-child) { color: var(--muted-2); }
.cf-campaigns-table tfoot td { border-bottom: 0; background: var(--bg-subtle); font-size: var(--fs-ui); font-weight: 600; }
.cf-sub { display: block; font-size: 12px; color: var(--muted); }
.cf-share { display: inline-flex; align-items: center; gap: 8px; }
.cf-share-pct { min-width: 3.4em; text-align: right; }
.cf-share-track { width: 64px; height: 5px; border-radius: 999px; background: var(--bg-raised); overflow: hidden; }
.cf-share-track i { display: block; height: 100%; background: var(--accent); opacity: .75; }
tr:has(.cf-campaign-checkbox:not(:checked)) .cf-share-track i { background: var(--muted-2); opacity: .5; }
.cf-kpi-set {
  border: 0; padding: 0; background: none; font: inherit; font-size: var(--fs-ui-sm);
  color: var(--muted-2); cursor: pointer;
}
.cf-kpi-set:hover, tr:hover .cf-kpi-set { color: var(--accent); }

/* док снизу: итог по трём шагам и кнопка, пока панель запуска вне экрана */
.cf-dock {
  position: sticky; bottom: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 4px; padding: 10px 18px; background: var(--bg);
  border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -8px 18px rgba(0, 0, 0, .08); transition: opacity .15s, transform .15s, visibility .15s;
}
.cf-dock.is-away { opacity: 0; transform: translateY(8px); visibility: hidden; }
.cf-dock > .cf-coverage-bar { position: absolute; left: 0; right: 0; top: -1px; height: 3px; border-radius: var(--radius) var(--radius) 0 0; }
.cf-dock-item {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 280px; padding: 4px 11px 4px 5px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--fg);
  font: inherit; font-size: var(--fs-ui); cursor: pointer;
}
.cf-dock-item:hover { border-color: var(--muted-2); }
.cf-dock-item > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-dock-item:has(.cf-step:not(.is-done)) > span:last-child { color: var(--muted); }
.cf-dock-btn { margin-left: auto; height: 34px; }

@media (max-width: 900px) {
  .cf-launch-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .cf-launch-row { grid-template-columns: minmax(0, 1fr); }
  .cf-campaigns-bar input[type=search] { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cf-dock, .cf-step, .cf-coverage-bar i, .cf-method-btn, .cf-switch i, .cf-switch i::after { transition: none; }
}

/* результаты: вкладки */
.cf-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 4px 0 20px; flex-wrap: wrap; }
.cf-tabs a { padding: 10px 16px; color: var(--muted); text-decoration: none; font-size: 0.92rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.cf-tabs a:hover { color: var(--fg); text-decoration: none; }
.cf-tabs a.active { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }

/* Score */
.cf-score-row { display: flex; align-items: baseline; gap: 16px; margin: 6px 0 4px; flex-wrap: wrap; }
.cf-score-value { font-size: 3rem; font-weight: 800; line-height: 1; color: var(--score-color, var(--fg)); }
.cf-score-label { font-size: 1.05rem; font-weight: 600; color: var(--score-text, var(--fg)); background: var(--score-tint, var(--bg-subtle)); padding: 4px 14px; border-radius: 999px; }
.score-green         { --score-color: var(--cf-top);      --score-tint: var(--cf-top-tint);      --score-text: var(--cf-top-text); }
.score-light-yellow  { --score-color: var(--cf-ly);       --score-tint: var(--cf-ly-tint);       --score-text: var(--cf-ly-text); }
.score-yellow        { --score-color: var(--sev-medium);  --score-tint: var(--sev-medium-tint);  --score-text: var(--sev-medium-text); }
.score-orange        { --score-color: var(--sev-high);    --score-tint: var(--sev-high-tint);    --score-text: var(--sev-high-text); }
.score-red           { --score-color: var(--sev-critical);--score-tint: var(--sev-critical-tint);--score-text: var(--sev-critical-text); }
.score-none .cf-score-value { color: var(--muted-2); }

/* Cash Flow audits list — score is the focal point, status is demoted text
   (см. client_tab_cashflow.html, clients.html). Bar reuses the --score-* band vars above. */
.cf-score-cell { display: flex; align-items: center; gap: 10px; min-width: 120px; max-width: 180px; }
.cf-score-num {
  font-size: 18px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; text-align: right;
  min-width: 22px; color: var(--score-color, var(--fg));
}
.cf-score-track {
  flex: 1; height: 6px; border-radius: 999px;
  background: var(--border); overflow: hidden;
}
.cf-score-fill { display: block; height: 100%; border-radius: 999px; background: var(--score-color, var(--muted-2)); }

/* Статус аудита живёт рядом с номером: «Завершён» не показываем вовсе,
   всё остальное — компактный бейдж. Отдельной колонки «Статус» нет. */
.cf-audit-id { display: inline; }
.cf-audit-badge {
  display: inline-block; vertical-align: baseline;
  margin-left: 6px; padding: 3px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 600; line-height: 1.3;
  letter-spacing: .02em; white-space: nowrap;
  color: var(--sev-low-text); background: var(--sev-low-tint);
}
.cf-audit-badge.is-failed  { color: var(--sev-critical-text); background: var(--sev-critical-tint); }
.cf-audit-badge.is-partial { color: var(--sev-medium-text);   background: var(--sev-medium-tint); }
.cf-audit-badge.is-active  { color: var(--info-text);         background: var(--info-tint); }
.cf-audit-badge.is-queued  { color: var(--muted); background: transparent; border: 1px dashed var(--muted-2); padding: 2px 6px; }

/* Идущий аудит в списке (app/cashflow/progress.py): полоса собрана из частей
   ячейки оценки (.cf-score-cell: число слева, дорожка 6px справа), но дорожка
   из пяти сегментов-фаз и идёт через колонки «Оценка» и «Экономия». Серая, а не
   акцентная: акцент почти не отличим от синей зоны «Отлично». Число стоит
   ровно под числами баллов соседних строк, дорожка начинается правее на
   --run-gap; подписи фаз под дорожкой вынесены из потока (absolute), поэтому
   строка той же высоты, что соседние. */
.audits-table { --run-gap: 7px; --run-cap-gap: 3px; }
.cf-run-cell { position: relative; }
.cf-run { max-width: none; gap: 0; --score-color: var(--sev-low); }
.cf-run-num { display: flex; align-items: baseline; flex: none; width: 32px; min-width: 0; margin-right: var(--run-gap); text-align: left; }
.cf-run-num b { width: 22px; text-align: right; font-weight: 700; }
.cf-run-num small { width: 10px; padding-left: 1px; font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap; }
.cf-run-track { display: flex; gap: 3px; background: transparent; overflow: visible; }
.cf-run-track i { display: block; height: 100%; border-radius: 999px; background: var(--border); overflow: hidden; }
.cf-run-track i b { display: block; height: 100%; border-radius: 999px; background: var(--score-color); transition: width .3s ease; }
.cf-run-names {
  position: absolute; display: flex; gap: 3px;
  top: calc(50% + 3px + var(--run-cap-gap)); left: calc(12px + 32px + var(--run-gap)); right: 12px;
}
.cf-run-names span { display: flex; justify-content: center; min-width: 0; font-size: 10.5px; line-height: 12px; color: var(--muted-2); white-space: nowrap; }
.cf-run-names span.is-done { color: var(--muted); }
.cf-run-names span.is-cur { color: var(--fg); font-weight: 600; }

/* Очередь и выполнение не кликаются (отчёта ещё нет): ни руки, ни наведения.
   Очередь тусклее выполнения; у выполняющегося серые текст и номер, а бейдж и
   полоса прогресса в полную силу. */
.audits-table tbody tr.is-pending { cursor: default; }
.audits-table tbody tr.is-pending:hover { background: transparent; }
.audits-table tr.is-queued td { opacity: .5; }
.audits-table tr.is-active td:nth-child(-n+2), .audits-table tr.is-active .cf-audit-id b { color: var(--muted); }

/* Плашка под таблицей, когда аудит из списка дошёл до конца (audit_progress.js) */
.audit-toasts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.audit-toast {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px;
  border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border);
  box-shadow: var(--pop-shadow); font-size: var(--fs-ui);
}
.audit-toast svg { width: 15px; height: 15px; flex: none; }
.audit-toast .is-ok { color: var(--ok-text); }
.audit-toast .is-bad { color: var(--sev-critical-text); }
.audit-toast .btn { margin-left: auto; }
@keyframes row-flash { from { background: color-mix(in srgb, var(--accent) 12%, transparent); } to { background: transparent; } }
.audits-table tr.just-finished td { animation: row-flash 2.4s ease-out; }
@media (prefers-reduced-motion: reduce) { .audits-table tr.just-finished td { animation: none; } }

/* светофор объектов — переиспользует .badge */
.cf-traffic-green             { background: var(--cf-top-tint); color: var(--cf-top-text); }
.cf-traffic-yellow_minor      { background: var(--sev-medium-tint); color: var(--sev-medium-text); }
.cf-traffic-yellow_significant{ background: var(--sev-high-tint); color: var(--sev-high-text); }
.cf-traffic-red                { background: var(--sev-critical-tint); color: var(--sev-critical-text); }
.cf-traffic-informational      { background: var(--info-tint); color: var(--info-text); }
.cf-traffic-not_applicable     { background: var(--sev-low-tint); color: var(--sev-low-text); }
.cf-traffic-green::before, .cf-traffic-yellow_minor::before, .cf-traffic-yellow_significant::before,
.cf-traffic-red::before, .cf-traffic-informational::before, .cf-traffic-not_applicable::before { content: none; }

/* Вкладки Поиск/РСЯ/Отклонения: колонки «Статус» нет — светофор живёт в
   самом числе колонки «Отклонение» (Поиск/РСЯ — по m.traffic_light,
   Отклонения — по величине отклонения). Цвет только текста оказался «не
   очевидной заливкой» (фидбек маркетинга 2026-09) — теперь это тонированная
   плашка тех же tint/text-пар, что и чипы зон над таблицей (.cf-zone-*), так
   что цвет строки читается по легенде. Проблемные зоны ещё и полужирные.
   .cf-traffic-* выше остаётся: им пользуется карточка объекта. */
.cf-dev {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.35;
}
.cf-dev-green              { color: var(--cf-top-text); background: var(--cf-top-tint); }
.cf-dev-yellow_minor       { color: var(--sev-medium-text); background: var(--sev-medium-tint); font-weight: 600; }
.cf-dev-yellow_significant { color: var(--sev-high-text); background: var(--sev-high-tint); font-weight: 600; }
.cf-dev-red                { color: var(--sev-critical-text); background: var(--sev-critical-tint); font-weight: 600; }
.cf-dev-informational      { color: var(--muted-2); padding-inline: 0; }
.cf-dev-not_applicable     { color: var(--muted-2); padding-inline: 0; }

/* Чипы зон над таблицей: фильтр по светофору + легенда цвета в одном ряду
   (partials/cashflow_zone_chips.html). Пока ни одна зона не выбрана, все
   чипы «включены» (таблица показывает всё); после выбора невыбранные
   приглушаются. Пустая зона видна, но неактивна — легенда остаётся полной. */
.cf-zones { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-right: auto; min-width: 0; }
.cf-zone {
  --z-text: var(--muted); --z-tint: var(--bg-subtle); --z-dot: var(--muted-2);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; border: 1px solid transparent;
  background: var(--z-tint); color: var(--z-text);
  font-size: 12.5px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
}
.cf-zone-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--z-dot); flex: none; }
.cf-zone-range { font-weight: 500; opacity: .8; font-variant-numeric: tabular-nums; }
.cf-zone-n { font-weight: 700; font-variant-numeric: tabular-nums; }
.cf-zone-green              { --z-text: var(--cf-top-text);       --z-tint: var(--cf-top-tint);       --z-dot: var(--cf-top); }
.cf-zone-yellow_minor       { --z-text: var(--sev-medium-text);   --z-tint: var(--sev-medium-tint);   --z-dot: var(--sev-medium); }
.cf-zone-yellow_significant { --z-text: var(--sev-high-text);     --z-tint: var(--sev-high-tint);     --z-dot: var(--sev-high); }
.cf-zone-red                { --z-text: var(--sev-critical-text); --z-tint: var(--sev-critical-tint); --z-dot: var(--sev-critical); }
.cf-zone-not_applicable     { --z-text: var(--sev-low-text);      --z-tint: var(--sev-low-tint);      --z-dot: var(--sev-low); }
a.cf-zone:hover { border-color: var(--z-dot); text-decoration: none; }
.cf-zone.is-on { border-color: var(--z-dot); box-shadow: inset 0 0 0 1px var(--z-dot); }
.cf-zones.has-selection .cf-zone:not(.is-on) { opacity: .5; }
.cf-zones.has-selection a.cf-zone:not(.is-on):hover { opacity: .85; }
.cf-zone.is-empty { opacity: .45; cursor: default; }
.cf-zone.is-empty .cf-zone-n { font-weight: 500; }
.cf-zone-clear { font-size: 12.5px; color: var(--muted); padding: 4px 6px; }
.cf-zone-clear:hover { color: var(--fg); text-decoration: none; }

.cf-window-primary td { background: var(--bg-subtle); font-weight: 600; }
.cf-pagination { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

/* Cash Flow report tabs — "direction C": a plain-language lead sentence and a
   thin .inline-stats strip sit above each tab's table (which drops its own
   card chrome). */

/* Report header (shared by every tab — this partial is outside the tab
   include). The breadcrumb/actions line, the tinted score box and the audit's
   setup (.cf-facts) sit in one chrome-less block; a full-width .inline-stats
   strip of findings runs beneath. */
.cf-head { margin-bottom: 18px; }
.cf-head-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 16px; }
.cf-head-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cf-head-actions { display: flex; gap: 6px; flex: none; margin-left: auto; }
.cf-head > .alert { margin: 12px 0 0; }

.cf-head-band { display: flex; gap: 26px; margin-top: 14px; }
.cf-scorebox {
  flex: none; min-width: 190px; align-self: flex-start;
  padding: 8px 16px 12px; border-radius: 9px;
  background: var(--score-tint, var(--bg-subtle));
}
.cf-scorebox.score-none { background: var(--bg-subtle); }
.cf-scorebox .cf-score-cap { color: var(--score-text, var(--muted-2)); }
.cf-scorebox .cf-score-lead { margin: 2px 0 7px; }
.cf-scorebox .cf-score-cell { max-width: none; margin: 0; }
.cf-scorebox .cf-score-cell .cf-score-num { display: none; }
.cf-scorebox .cf-score-track { height: 8px; }
.cf-scorebox .muted.small { margin-top: 6px; }

.cf-facts {
  align-self: center; margin: 0;
  display: grid; grid-template-columns: auto 1fr; gap: 3px 14px;
  font-size: 12.5px; line-height: 1.5;
}
.cf-facts dt { color: var(--muted-2); }
.cf-facts dd { margin: 0; color: var(--fg); font-weight: 400; }
.cf-facts dd .badge { margin-left: 6px; }
.cf-facts-dim { color: var(--muted-2); }

@media (max-width: 640px) {
  .cf-head-band { flex-direction: column; gap: 14px; }
  .cf-scorebox { min-width: 0; padding: 8px 14px 10px; }
  .cf-score-lead b { font-size: 28px; }
  .cf-facts { align-self: stretch; grid-template-columns: repeat(2, auto 1fr); column-gap: 10px 14px; }
}

/* Score box — «Б2»: балл ведёт крупным числом, полоса .cf-score-cell
   демонстративно короткая (только заполнение + цвет зоны), «(?)» у подписи
   раскрывает, как считается балл. */
.cf-score-cap {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; line-height: 1; color: var(--muted-2); margin-bottom: 3px;
}
.cf-score-cap .pop { display: flex; align-items: center; }
.cf-score-lead {
  display: flex; align-items: baseline; gap: 8px;
  margin: 2px 0 9px; font-variant-numeric: tabular-nums;
}
.cf-score-lead b { font-size: 38px; font-weight: 800; line-height: 1; color: var(--score-color, var(--fg)); }
.cf-score-lead .cf-score-max { font-size: 15px; color: var(--muted-2); }
.cf-score-lead .cf-score-word { font-size: 15px; font-weight: 600; color: var(--score-text, var(--fg)); margin-left: 4px; }
.cf-score-lead.score-none b { color: var(--muted-2); }

.cf-score-pop .pop-trigger { display: inline-flex; align-items: center; color: var(--muted-2); }
.cf-score-pop .pop-trigger:hover { color: var(--fg); }
.cf-score-pop[open] .pop-trigger { color: var(--accent); }
.cf-score-pop .pop-trigger svg { width: 14px; height: 14px; }
.cf-score-pop .pop-body { top: 24px; left: -8px; right: auto; width: 300px; max-width: calc(100vw - 40px); }
.cf-verdict { margin-bottom: 12px; }
.cf-lead { margin: 0; font-size: 14px; line-height: 1.5; color: var(--fg); max-width: 78ch; }
.cf-lead b { font-weight: 700; }
.cf-verdict .inline-stats { font-size: 12.5px; }
/* overview verdict is the strip alone — no lead above it: drop the rule/pad and
   pin the strip to the lead's 21px line box so the card is the same 55px as the
   other tabs (16px pad + 21px + 16px pad + 2px border) */
.cf-verdict .inline-stats:first-child {
  padding-top: 0; border-top: 0;
  min-height: 21px; align-items: center;
}
/* verdict sentence spans the card's full width and wraps when it overruns */
.cf-verdict .cf-lead { max-width: none; }

.cf-table-card { padding: 0; overflow: hidden; }
/* Cash Flow report tables never wrap a row — .table-scroll handles the overflow */
.cf-table-card .table td { white-space: nowrap; }

/* Обзор: у кампании с индивидуальным KPI — общий KPI аудита зачёркнут
   второй строкой под действующим значением (заменяет бейдж «override»). */
.cf-kpi-was {
  display: block;
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--muted-2);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  font-variant-numeric: tabular-nums;
}
.cf-table-card > .cf-pagination { margin: 0; padding: 12px 16px 14px; }
.cf-table-card > .cf-empty { margin: 0; padding: 2px 16px 16px; }

/* Cash Flow object drill-down (cashflow_object.html) — same header idiom as the
   report (.cf-head/.cf-head-top), then a .cf-banner "direction C" verdict strip
   over a chrome-less window table whose columns mirror the Поиск/РСЯ object
   tables (Расход · Конв. · CPA · KPI · Отклонение · Экономия). */
.cf-obj-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 0; }
.cf-obj-title h1 { margin: 0; font-size: 19px; font-weight: 700; }
.cf-obj-meta { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.cf-obj-meta .badge { margin-left: 4px; }

/* Verdict banner: one tinted full-width strip carrying the server-built
   explanation sentence, the headline potential-saving figure flush right, and
   the audit setup as a hairline .cf-facts row. Colour vars come from a
   .score-* class (cashflow_traffic_band) — the same --score-* set the report
   header's score box uses. A bare .inline-stats band of the 30-day figures
   follows, matching the report tabs' lead-then-strip rhythm. */
.cf-banner {
  background: var(--score-tint, var(--bg-subtle));
  border: 1px solid var(--border);
  border-left: 3px solid var(--score-color, var(--muted-2));
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 12px;
}
.cf-banner .cf-lead { max-width: none; white-space: normal; overflow: visible; }
.cf-banner-main { display: flex; align-items: flex-start; gap: 26px; }
.cf-banner-main .cf-lead { flex: 1; }
.cf-banner-fig { flex: none; max-width: 38%; text-align: right; font-variant-numeric: tabular-nums; }
.cf-banner-fig b {
  display: block; font-size: 22px; font-weight: 800; line-height: 1.15;
  color: var(--score-color, var(--fg));
}
.cf-banner-fig span { font-size: 11px; color: var(--score-text, var(--muted-2)); }
.cf-facts.cf-facts--row {
  display: flex; flex-wrap: wrap; gap: 4px 22px;
  margin: 12px 0 0; padding-top: 11px; border-top: 1px solid var(--border);
}
.cf-facts--row > div { display: flex; gap: 6px; }
.cf-obj-strip { margin-bottom: 12px; }
.cf-obj-strip .inline-stats { font-size: 12.5px; }

/* the no-data fallback keeps the old .cf-verdict card */
.cf-obj-verdict .cf-lead { max-width: 78ch; }

@media (max-width: 640px) {
  .cf-banner-main { flex-direction: column; gap: 10px; }
  .cf-banner-fig { max-width: none; text-align: left; }
}
/* "7 дней" doesn't need the 160px name column .campaigns-table gives object rows */
.cf-window-table td:first-child, .cf-window-table th:first-child { min-width: 0; }

/* DEV-43: «Фильтр» / «Столбцы» popups above the search/network/deviations
   tables. The trigger row sits above .cf-table-card; the panels are .pop-body
   overlays, so opening one never pushes the table down. Popup conditions
   also show as removable chips (.cf-fchips) on their own line under the row. */
.cf-tablebar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
/* basis 0 so the zone row wraps inside itself instead of pushing the buttons
   onto the next line now that the bar wraps (for the condition chips) */
.cf-tablebar > .cf-zones { flex: 1 1 0; }
.cf-filter-pop > summary.btn { display: inline-flex; align-items: center; gap: 6px; }
.cf-filter-pop > summary.btn svg { width: 13px; height: 13px; color: currentColor; }
.cf-filter-pop > summary.is-armed { border-color: var(--accent); color: var(--accent); }
.cf-filter-count {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--accent);
  color: var(--accent-fg); font-size: 11px; font-weight: 700; line-height: 1;
}
/* Drops down under its own button, right edges aligned. Height is capped so
   trigger + panel fit the viewport — only the middle scrolls, the footer
   buttons never do; cashflow_filter.js scrolls the page just enough to show
   the whole panel when it opens low on the screen, and nudges it back from
   the left edge on narrow screens. */
.cf-filter-body {
  top: calc(100% + 6px); right: 0; left: auto;
  width: 440px; max-width: calc(100vw - 32px); padding: 0;
  max-height: min(620px, calc(100dvh - 80px)); display: flex; flex-direction: column;
}
.cf-filter-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cf-filter-scroll {
  display: flex; flex-direction: column; gap: 16px; flex: 1; min-height: 0;
  padding: 14px 15px; overflow-y: auto; overscroll-behavior: contain;
}
.ff-grp { display: flex; flex-direction: column; gap: 8px; }
.ff-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ff-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted-2);
}
.ff-label b { margin-left: 3px; color: var(--fg); font-variant-numeric: tabular-nums; }
.ff-hint { font-size: 11px; color: var(--muted-2); }
.ff-field { display: grid; gap: 4px; margin: 0; }
.ff-field > span { font-size: 11px; color: var(--muted); }
.ff-field select {
  font: inherit; font-size: 12.5px; padding: 6px 8px; width: 100%; margin: 0;
  border: 1px solid var(--border-strong); border-radius: 5px; background: var(--bg); color: var(--fg);
}
/* поле с иконкой (поиск) и поле с единицей (диапазон): рамка на обёртке */
.ff-ctl, .ff-box {
  display: flex; align-items: center; min-width: 0; margin: 0;
  border: 1px solid var(--border-strong); border-radius: 5px; background: var(--bg);
}
.ff-ctl { gap: 6px; padding: 0 8px; cursor: text; }
.ff-ctl svg { width: 13px; height: 13px; color: var(--muted-2); flex: none; }
.ff-ctl input, .ff-box input {
  font: inherit; font-size: 12.5px; color: var(--fg);
  border: 0; background: transparent; width: 100%; min-width: 0; outline: none; margin: 0;
}
.ff-ctl input { padding: 6px 0; }
.ff-box input { padding: 5px 0 5px 7px; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.ff-box input::-webkit-outer-spin-button, .ff-box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ff-box em { font-style: normal; font-size: 12px; color: var(--muted-2); padding: 0 7px 0 3px; }
.ff-field select:focus, .ff-ctl:focus-within, .ff-box:focus-within { outline: none; border-color: var(--accent); }
.ff-ctl.is-on, .ff-field.is-on select { border-color: var(--accent); background: var(--info-tint); }
/* Диапазоны — список строк «подпись · от · до · ×»; заполненная строка
   подсвечена, её × (только с JS) очищает обе границы. */
.ff-rows { display: grid; gap: 2px; }
.ff-range {
  display: grid; grid-template-columns: minmax(0, 1fr) 104px 8px 104px 22px;
  align-items: center; gap: 6px; padding: 3px 4px 3px 8px; border-radius: 5px;
}
.ff-range-l { margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ff-range > i { font-style: normal; text-align: center; color: var(--muted-2); }
.ff-range.is-on { background: var(--info-tint); }
.ff-range.is-on .ff-range-l { color: var(--fg); font-weight: 600; }
.ff-clear {
  display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 4px; background: transparent; color: var(--muted);
  cursor: pointer; visibility: hidden;
}
.ff-clear svg { width: 11px; height: 11px; }
.ff-clear:hover { background: var(--bg); color: var(--fg); }
.ff-js .ff-range.is-on .ff-clear { visibility: visible; }
.cf-filter-foot {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 10px 14px; border-top: 1px solid var(--border);
}
.cf-filter-foot-gap { flex: 1; }

/* условия фильтра чипами под кнопками — × ведёт на URL без этого условия */
.cf-fchips { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.cf-fchip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 3px 4px 3px 10px; border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--bg); font-size: 12.5px; line-height: 1.3;
}
.cf-fchip-k { color: var(--muted); white-space: nowrap; }
.cf-fchip-v { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-fchip-x { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; border-radius: 50%; color: var(--muted); }
.cf-fchip-x:hover { background: var(--bg-subtle); color: var(--fg); text-decoration: none; }
.cf-fchip-x svg { width: 10px; height: 10px; }

/* «Столбцы»: «В таблице» (нумерованы, ↑ ↓ при наведении/фокусе) и «Скрыты» */
.cf-columns-body { width: 300px; max-height: min(560px, calc(100dvh - 80px)); }
.cf-columns-body .cf-filter-scroll { gap: 8px; padding: 10px 12px; }
.cf-column-options { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 6px; }
.cf-column-list { list-style: none; padding: 0; margin: 0 0 6px; }
.cf-column-list[data-column-list="on"] { counter-reset: cf-col; }
.cf-column-row { display: flex; align-items: center; gap: 4px; padding-right: 2px; border-radius: 5px; }
.cf-column-row:hover, .cf-column-row:focus-within { background: var(--bg-subtle); }
.cf-column-option {
  display: flex; flex: 1; min-width: 0; align-items: center; gap: 8px; padding: 4px;
  min-height: 30px; margin: 0; cursor: pointer; font-size: .8125rem;
}
.cf-column-option::before { content: ""; width: 14px; flex: none; }
[data-column-list="on"] .cf-column-option::before {
  counter-increment: cf-col; content: counter(cf-col);
  font-size: 11px; text-align: right; color: var(--muted-2); font-variant-numeric: tabular-nums;
}
[data-column-list="off"] .cf-column-option { color: var(--muted); }
[data-column-list="off"]:not(:has(.cf-column-row))::before {
  content: "Все столбцы в таблице"; display: block; padding: 4px 6px; font-size: 12px; color: var(--muted-2);
}
.cf-column-option input { flex: 0 0 16px; width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--accent); }
.cf-column-moves:not([hidden]) { display: flex; gap: 1px; opacity: 0; transition: opacity .12s; }
.cf-column-row:hover .cf-column-moves, .cf-column-row:focus-within .cf-column-moves { opacity: 1; }
@media (hover: none) { .cf-column-moves:not([hidden]) { opacity: 1; } }
.cf-column-move {
  display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer;
}
.cf-column-move svg { width: 13px; height: 13px; }
.cf-column-move:hover { background: var(--bg); color: var(--fg); }
.cf-column-move[aria-disabled="true"] { opacity: .3; cursor: default; }
.cf-column-option input:focus-visible, .cf-column-move:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cf-columns-body .cf-filter-foot { padding: 8px 12px; flex-shrink: 0; }
.cf-columns-error { color: var(--sev-critical-text); }
@media (pointer: coarse) {
  .cf-zone, .cf-zone-clear { min-height: 36px; }
  .cf-column-option { min-height: 44px; }
  .cf-column-move { width: 44px; height: 44px; }
  .cf-columns-pop .btn { min-height: 44px; }
  .ff-clear, .cf-fchip-x { width: 36px; height: 36px; }
}

@media (max-width: 640px) {
  .cf-tablebar > .cf-zones { flex-basis: 100%; }
  .cf-filter-body { width: calc(100vw - 32px); }
  .ff-range { grid-template-columns: minmax(0, 1fr) 8px minmax(0, 1fr) 22px; }
  .ff-range-l { grid-column: 1 / -1; }
}

/* =========================================================================
   Dark theme
   -------------------------------------------------------------------------
   Activated by data-theme="dark" on <html>; applied by an inline script in
   base.html *before* first paint to avoid a flash of light theme.
   ========================================================================= */
html[data-theme="dark"] {
  --fg: #d6d8de;
  --muted: #8b93a0;
  --muted-2: #6b7480;
  /* карточки (--bg) светлее фона страницы (--bg-subtle) — как на скриншотах
     прода; см. design_handoff_client_profile/README.md, «Открытые вопросы» */
  --bg: #181c24;
  --bg-subtle: #11141a;
  --border: #262b35;
  --accent: #6ea8fe;
  --accent-fg: #0b0e12;
  /* светлее красного шкалы: им рисуется текст ошибок и точки на тёмном */
  --danger: color-mix(in oklab, var(--sev-critical) 72%, #fff);
  --ok: #6cc486;

  /* Шкала балла и производные от неё статусы (--ok-tint, --info-tint, --sev-low…)
     здесь не переопределяются — см. severity-блок :root: они смешиваются из
     --bg / --fg / --accent этой темы. */

  --switch-off: #333a47;
  --row-flag: #1c2027;
  --pop-shadow: 0 14px 34px rgba(0, 0, 0, .5);
  --field-strong: #3a4250;
  --bg-raised: #1f2530;
  --border-strong: #333a47;

  color-scheme: dark;
}

/* =========================================================================
   Темы — нейтральные цвета, акцент и палитра графиков (--gr-*) для светлого и
   тёмного режима (шкала балла — в блоке Cash Flow выше).
   Светлый блок темы стоит ПОСЛЕ html[data-theme="dark"] с той же
   специфичностью и перебил бы его в тёмном режиме, поэтому у каждой темы
   тёмный блок задаёт тот же набор токенов (у него специфичность выше).
   Значения повторены в settings.html для миниатюр — менять вместе.
   ========================================================================= */
html[data-theme-name="signal"] {
  --fg: #161616; --muted: #6b6b6b; --muted-2: #9e9e9e; --bg: #ffffff; --bg-subtle: #f3f3f3;
  --border: #e2e2e2; --accent: #262626; --accent-fg: #ffffff; --bg-raised: #f3f3f3;
  --border-strong: #e2e2e2; --row-flag: #fbfbfb; --switch-off: #d6d6d6; --field-strong: #cfcfcf;
  --gr-series-1: #3f4652; --gr-series-2: #e06a00; --gr-series-3: #1f9d4c; --gr-series-4: #c48a00; --gr-series-5: #d6403b;
  --gr-seq-100: #d5d7da; --gr-seq-250: #999da4; --gr-seq-400: #3f4652; --gr-seq-700: #0e1115;
  --gr-div-good: #1f9d4c; --gr-div-mid: #ececec;
}
html[data-theme="dark"][data-theme-name="signal"] {
  --fg: #dcdcdc; --muted: #8e8e8e; --muted-2: #6e6e6e; --bg: #1c1c1c; --bg-subtle: #131313;
  --border: #2d2d2d; --accent: #e8e8e8; --accent-fg: #141414; --bg-raised: #232323;
  --border-strong: #3a3a3a; --row-flag: #202020; --switch-off: #3a3a3a; --field-strong: #444444;
  --gr-series-1: #aab2c0; --gr-series-2: #f08a2e; --gr-series-3: #3dbd6b; --gr-series-4: #e0a21a; --gr-series-5: #ef6b66;
  --gr-seq-100: #404145; --gr-seq-250: #6d7179; --gr-seq-400: #aab2c0; --gr-seq-700: #e9ebef;
  --gr-div-good: #3dbd6b; --gr-div-mid: #272727;
}
html[data-theme-name="calm"] {
  --fg: #23211d; --muted: #736d63; --muted-2: #a39c90; --bg: #fffdf9; --bg-subtle: #f4f1eb;
  --border: #e5dfd4; --accent: #2f6f73; --accent-fg: #ffffff; --bg-raised: #f4f1eb;
  --border-strong: #e5dfd4; --row-flag: #fcfaf6; --switch-off: #dbd5ca; --field-strong: #d3ccc0;
  --gr-series-1: #2f6f73; --gr-series-2: #c26a36; --gr-series-3: #6b8f3a; --gr-series-4: #b8861c; --gr-series-5: #a8567a;
  --gr-seq-100: #d5dfdd; --gr-seq-250: #97b4b4; --gr-seq-400: #2f6f73; --gr-seq-700: #092022;
  --gr-div-good: #2f6f73; --gr-div-mid: #eeece8;
}
html[data-theme="dark"][data-theme-name="calm"] {
  --fg: #dcd7ce; --muted: #958e82; --muted-2: #756e63; --bg: #1f1d1a; --bg-subtle: #151412;
  --border: #322e29; --accent: #6fb3b0; --accent-fg: #111110; --bg-raised: #26231f;
  --border-strong: #3d3832; --row-flag: #23211d; --switch-off: #3d3832; --field-strong: #474139;
  --gr-series-1: #6fb3b0; --gr-series-2: #dc8a56; --gr-series-3: #9ab868; --gr-series-4: #d9b04a; --gr-series-5: #c9779b;
  --gr-seq-100: #35433f; --gr-seq-250: #4f726f; --gr-seq-400: #6fb3b0; --gr-seq-700: #dceceb;
  --gr-div-good: #6fb3b0; --gr-div-mid: #2a2824;
}
html[data-theme-name="even"] {
  --fg: #161a23; --muted: #646c7c; --muted-2: #969eae; --bg: #ffffff; --bg-subtle: #f2f4f8;
  --border: #e0e4ed; --accent: #4a4fd8; --accent-fg: #ffffff; --bg-raised: #f2f4f8;
  --border-strong: #e0e4ed; --row-flag: #fbfcfe; --switch-off: #d3d8e2; --field-strong: #cbd1dd;
  --gr-series-1: #4a4fd8; --gr-series-2: #d96d1f; --gr-series-3: #1f9a60; --gr-series-4: #bf8a00; --gr-series-5: #cc4a86;
  --gr-seq-100: #d6ddfb; --gr-seq-250: #9caaf1; --gr-seq-400: #4a4fd8; --gr-seq-700: #121447;
  --gr-div-good: #4a4fd8; --gr-div-mid: #ecedee;
}
html[data-theme="dark"][data-theme-name="even"] {
  --fg: #d4d8e2; --muted: #868ea0; --muted-2: #666e80; --bg: #161a25; --bg-subtle: #0e1119;
  --border: #252b3a; --accent: #8f95ff; --accent-fg: #0d0f1a; --bg-raised: #1d2231;
  --border-strong: #313849; --row-flag: #1a1f2b; --switch-off: #313849; --field-strong: #3a4256;
  --gr-series-1: #8f95ff; --gr-series-2: #f0873a; --gr-series-3: #4cc283; --gr-series-4: #e0ac2c; --gr-series-5: #ec7bae;
  --gr-seq-100: #34395b; --gr-seq-250: #5b60a0; --gr-seq-400: #8f95ff; --gr-seq-700: #e1e5ff;
  --gr-div-good: #8f95ff; --gr-div-mid: #212530;
}
html[data-theme-name="jewel"] {
  --fg: #1c1720; --muted: #6f6776; --muted-2: #a199a8; --bg: #ffffff; --bg-subtle: #f6f4f8;
  --border: #e6e1eb; --accent: #8a3a9e; --accent-fg: #ffffff; --bg-raised: #f6f4f8;
  --border-strong: #e6e1eb; --row-flag: #fcfbfd; --switch-off: #d9d3df; --field-strong: #d1cad8;
  --gr-series-1: #8a3a9e; --gr-series-2: #e0583a; --gr-series-3: #00856a; --gr-series-4: #b8860b; --gr-series-5: #3b6fd4;
  --gr-seq-100: #e8d7ec; --gr-seq-250: #c59dd0; --gr-seq-400: #8a3a9e; --gr-seq-700: #2a0d31;
  --gr-div-good: #00856a; --gr-div-mid: #edeced;
}
html[data-theme="dark"][data-theme-name="jewel"] {
  --fg: #ddd6e2; --muted: #948a9c; --muted-2: #72697b; --bg: #1c1822; --bg-subtle: #131018;
  --border: #2e2836; --accent: #cf8fe0; --accent-fg: #150f18; --bg-raised: #231e2a;
  --border-strong: #3a3343; --row-flag: #201b27; --switch-off: #3a3343; --field-strong: #443c4e;
  --gr-series-1: #cf8fe0; --gr-series-2: #f2825f; --gr-series-3: #2fc9a0; --gr-series-4: #e3b43c; --gr-series-5: #7ea2f0;
  --gr-seq-100: #483651; --gr-seq-250: #815c8d; --gr-seq-400: #cf8fe0; --gr-seq-700: #f4e3f8;
  --gr-div-good: #2fc9a0; --gr-div-mid: #27232d;
}

html[data-theme="dark"] .empty-mark { color: var(--accent-fg); }
html[data-theme="dark"] .check-yes { color: var(--ok-text); }


/* =========================================================================
   «Графики» (app/graphs/, /clients/{id}/graphs) — chart series/heatmap
   tokens. Слоты: 1 основная серия, 2 вторая, 3 конверсии, 4 линия CPA,
   5 отказы; --gr-seq-* — четыре точки градиента тепловой карты (graphs.js
   читает их через getComputedStyle и разбирает только hex/rgb — поэтому
   готовые hex, не color-mix); --gr-div-good / -mid — «дешевле среднего» и
   середина дивергентной шкалы. Здесь значения темы «Директ» (светлые и
   тёмные); у остальных четырёх тем свои — внутри их блоков в «Темах» выше,
   те же токены в светлом и тёмном режиме. Все слоты на светлом фоне ≥3:1.
   ========================================================================= */
:root {
  --gr-series-1: #2a78d6; --gr-series-2: #e0592a; --gr-series-3: #13966a; --gr-series-4: #c28800; --gr-series-5: #d4558c;
  --gr-seq-100: #d5e4f9; --gr-seq-250: #97bdee; --gr-seq-400: #2a78d6; --gr-seq-700: #072346;
  --gr-div-good: #2a78d6; --gr-div-mid: #ededed;
  /* «дороже среднего» — красный шкалы балла текущей темы */
  --gr-div-bad: var(--sev-critical);
}
html[data-theme="dark"] {
  --gr-series-1: #3987e5; --gr-series-2: #d95926; --gr-series-3: #199e70; --gr-series-4: #c98500; --gr-series-5: #d55181;
  --gr-seq-100: #233854; --gr-seq-250: #2e5a92; --gr-seq-400: #3987e5; --gr-seq-700: #cee2fb;
  --gr-div-good: #3987e5; --gr-div-mid: #23272f;
}

.gr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 960px) { .gr-grid { grid-template-columns: minmax(0, 1fr); } }
.gr-card { display: flex; flex-direction: column; min-width: 0; }
.gr-card[data-gr-key="heatmap"] { grid-column: 1 / -1; }
/* подписи групп карточек («Динамика», «Где тратим», «Детали») — только в
   порядке по умолчанию (app/graphs/cards.py:GROUP_STARTS) */
.gr-group-label {
  grid-column: 1 / -1; margin: 10px 0 -4px; font-size: 10.5px; font-weight: 600;
  color: var(--muted-2); text-transform: uppercase; letter-spacing: .04em;
}
.gr-group-label:first-child { margin-top: 0; }
.gr-card.wide { grid-column: 1 / -1; }

/* Drag-to-reorder (static/js/graphs_sort.js) — only wired up when the grid
   carries data-gr-sort-editable (FULL_ACCESS_ROLES, see main.py). */
.gr-grid[data-gr-sort-editable] .gr-card { cursor: grab; }
.gr-card.gr-dragging {
  position: fixed; z-index: 50; cursor: grabbing; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); opacity: .96;
}
.gr-card-placeholder {
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--bg-subtle);
}
.gr-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.gr-card-head h2 { margin: 0; font-size: 14.5px; font-weight: 650; }
/* .gr-desc теперь только для служебной пометки о неполном месяце, которую
   graphs.js вставляет под графиком «Помесячная динамика»; описания карточек
   переехали в поповер .gr-info-pop (см. gr_info в _charts.html) */
.gr-desc { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; max-width: 60ch; }
/* инфо-«(?)» в заголовке карточки */
.gr-info-pop { flex: none; }
.gr-info-pop .pop-trigger { display: inline-flex; align-items: center; color: var(--muted-2); }
.gr-info-pop .pop-trigger:hover { color: var(--fg); }
.gr-info-pop[open] .pop-trigger { color: var(--accent); }
.gr-info-pop .pop-trigger svg { width: 15px; height: 15px; }
.gr-info-pop .pop-body { top: 24px; right: -4px; left: auto; width: 300px; max-width: calc(100vw - 40px); }
.gr-chart-wrap { position: relative; }
.gr-chart-wrap[hidden] { display: none; }
.gr-chart-wrap.h240 { height: 240px; }
.gr-chart-wrap.h180 { height: 180px; }
.gr-chart-wrap.h280 { height: 280px; }
.gr-two-panel { display: flex; flex-direction: column; gap: 4px; }
.gr-panel-label {
  font-size: 10.5px; font-weight: 600; color: var(--muted-2); text-transform: uppercase;
  letter-spacing: .03em; margin: 6px 0 0;
}

.gr-rank-list { list-style: none; margin: 0; padding: 0; }
.gr-rank-list li {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 8px; align-items: center;
  padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.gr-rank-list li:last-child { border-bottom: none; }
.gr-rank-list .gr-idx { color: var(--muted-2); font-size: 11px; }
.gr-rank-list .gr-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-rank-detail { color: var(--muted); font-size: 11.5px; }
.gr-rank-list .gr-val { color: var(--fg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gr-rank-list .gr-flag {
  display: inline-block; margin-left: 6px; font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: var(--sev-medium-tint); color: var(--sev-medium-text);
}
.gr-bar-track { grid-column: 1 / -1; position: relative; height: 5px; background: var(--bg-subtle); border-radius: 3px; margin-top: 3px; }
.gr-bar-track .gr-fill { position: absolute; inset: 0; border-radius: 3px; background: var(--gr-series-1); }

.gr-heat-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.gr-heat-table th { font-weight: 600; color: var(--muted); text-align: center; padding: 4px 6px; font-size: 10.5px; }
.gr-heat-table th:first-child, .gr-heat-table td:first-child { text-align: left; padding-left: 8px; color: var(--muted); font-weight: 600; }
.gr-heat-table td { text-align: center; padding: 8px 6px; border-radius: 5px; }
.gr-heat-table .gr-cell-cost { display: block; font-weight: 700; }
.gr-heat-table .gr-cell-conv { display: block; font-size: 10px; }
#gr-heatmap { overflow-x: auto; }
.gr-heat-table { min-width: 760px; }
.gr-heat-table td { white-space: nowrap; }
.gr-empty { color: var(--muted); font-size: .875rem; }
.gr-data { margin-top: 12px; font-size: .8125rem; }
.gr-data summary { cursor: pointer; color: var(--accent); width: fit-content; }
.gr-table-scroll { max-height: 320px; overflow: auto; margin-top: 8px; }
.gr-data table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.gr-data caption { text-align: left; font-weight: 600; padding-bottom: 6px; }
.gr-data th, .gr-data td { padding: 6px 8px; text-align: right; white-space: nowrap; }
.gr-data th:first-child { text-align: left; }
.gr-data thead th { position: sticky; top: 0; background: var(--bg); }
.gr-data tbody tr { border-top: 1px solid var(--border); }
@media (max-width: 480px) {
  .gr-rank-list li { grid-template-columns: 20px minmax(0, 1fr); }
  .gr-rank-list .gr-name { white-space: normal; overflow: visible; }
  .gr-rank-list .gr-val { grid-column: 2; white-space: normal; }
}

/* скелетон вкладки на первую отрисовку, пока htmx не подставит настоящие
   графики из /graphs/fragment — крупнее ov-skel (карточки графиков выше) */
.gr-skel-card { height: 260px; display: flex; flex-direction: column; }
.gr-skel-card .ov-skel-bar { margin: 10px 0; }
.gr-skel-card .gr-skel-fill { flex: 1; margin-top: 10px; border-radius: 6px; background: var(--bg-subtle); }

/* «Графики» (редизайн 2026-09-28): чип цели в полосе табов, переключатель
   тепловой карты, доли кампаний, метки CPA, строка «Качество трафика» */
.gr-goal { margin-left: auto; flex: none; }
.gr-goal + .ov-update { margin-left: 12px; }
.gr-goal-chip {
  display: inline-flex; align-items: baseline; gap: 5px; max-width: 280px; padding: 3px 10px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
  font-size: var(--fs-ui-sm); color: var(--fg); white-space: nowrap;
}
.gr-goal-chip.is-static { margin-left: auto; }
.gr-goal-chip.is-all { border-color: var(--sev-high); }
.gr-goal-k { color: var(--muted); }
.gr-goal-name { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.gr-goal[open] > .gr-goal-chip { border-color: var(--accent); }
.gr-goal-body.pop-body { top: calc(100% + 6px); right: 0; left: auto; width: 360px; }
@media (max-width: 640px) { .gr-goal-chip { max-width: 170px; } }

.gr-head-tools { display: flex; align-items: center; gap: 10px; }
.gr-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 12px; }
.gr-seg button { font: inherit; border: 0; background: transparent; color: var(--muted); padding: 2px 10px; cursor: pointer; }
.gr-seg button + button { border-left: 1px solid var(--border); }
.gr-seg button[aria-pressed="true"] { background: var(--bg-subtle); color: var(--fg); font-weight: 600; }
.gr-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gr-heat-table td.is-blank { background: var(--bg-subtle); color: var(--muted-2); }

.gr-pill {
  display: inline-block; margin-left: 6px; font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: var(--bg-subtle); color: var(--muted); font-variant-numeric: tabular-nums;
}
.gr-pill.is-bad { background: var(--sev-high-tint); color: var(--sev-high-text); }
.gr-pill.is-good { background: var(--info-tint); color: var(--info-text); }
.gr-pill.is-odd { background: var(--sev-medium-tint); color: var(--sev-medium-text); }

.gr-legend-mini { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0 8px; font-size: 11.5px; color: var(--muted); }
#gr-campaigns .gr-legend-mini { margin-top: 0; }
.gr-head-tools .gr-legend-mini { margin: 0; justify-content: flex-end; min-width: 0; }
.gr-head-tools .gr-legend-mini span { white-space: nowrap; }
.gr-legend-mini i { display: inline-block; width: 10px; height: 6px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.gr-legend-mini i.is-cost { background: var(--gr-series-1); }
.gr-legend-mini i.is-conv { background: var(--gr-series-3); }
.gr-legend-mini i.is-good { background: var(--gr-div-good); }
.gr-legend-mini i.is-bad { background: var(--gr-div-bad); }
.gr-share-rows { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 0 14px; font-size: 12.5px; }
.gr-share-row { display: contents; }
.gr-share-row > * { padding: 7px 0; border-bottom: 1px solid var(--border); }
.gr-share-row:last-child > * { border-bottom: none; }
.gr-share-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-share-bars { display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.gr-share-bar { display: block; height: 5px; min-width: 2px; border-radius: 3px; }
.gr-share-bar.is-cost { background: var(--gr-series-1); }
.gr-share-bar.is-conv { background: var(--gr-series-3); }
.gr-share-val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--fg); }
@media (max-width: 640px) {
  .gr-share-rows { grid-template-columns: minmax(0, 1fr); }
  .gr-share-row > * { border-bottom: none; padding: 2px 0; }
  .gr-share-val { text-align: left; white-space: normal; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
}
.gr-inline-stats { border-top: 0; padding-top: 0; margin-bottom: 6px; }

/* ---------- шторка «Структура» (dialog#ov-drawer, partials/overview/structure_drawer.html) ---------- */
dialog.ov-drawer {
  margin: 0 0 0 auto; padding: 0; border: 0; border-left: 1px solid var(--border);
  width: min(780px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  background: var(--bg); color: var(--fg); box-shadow: var(--pop-shadow); overflow: hidden;
}
dialog.ov-drawer::backdrop { background: rgba(17, 20, 26, .38); }
dialog.ov-drawer[open] { animation: sd-in .18s cubic-bezier(.2, .7, .3, 1); }
dialog.ov-drawer[open]::backdrop { animation: fade-in .18s ease; }
@keyframes sd-in { from { transform: translateX(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.ov-drawer[open], dialog.ov-drawer[open]::backdrop { animation: none; } }
#ov-drawer-body { height: 100%; }
.sd { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sd-hd { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.sd-hd h3 { margin: 0; font-size: 14px; }
.sd-close { margin-left: auto; appearance: none; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 7px; border-radius: 4px; font-size: 18px; line-height: 1; }
.sd-close:hover { color: var(--fg); background: var(--bg-subtle); }
.sd-tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.sd-tab { appearance: none; border: 0; background: none; font: inherit; font-size: var(--fs-ui-sm); color: var(--muted); padding: 7px 8px 8px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.sd-tab b { margin-left: 4px; font-weight: 500; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.sd-tab:hover { color: var(--fg); }
.sd-tab.is-on { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }
.sd-tool { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.sd-search { flex: 1; min-width: 150px; display: flex; align-items: center; gap: 6px; margin: 0; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--muted-2); }
.sd-search svg { width: 13px; height: 13px; flex: none; }
.sd-search input { width: 100%; padding: 0; border: 0; background: none; outline: none; font: inherit; font-size: var(--fs-ui-sm); color: var(--fg); }
.sd-search:focus-within { border-color: var(--accent); }
.sd-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sd-seg button { appearance: none; border: 0; background: var(--bg); font: inherit; font-size: 12px; color: var(--muted); padding: 3px 10px; cursor: pointer; font-variant-numeric: tabular-nums; }
.sd-seg button + button { border-left: 1px solid var(--border); }
.sd-seg button.is-on { background: var(--info-tint); color: var(--info-text); font-weight: 600; }
.sd-chip { display: inline-flex; align-items: center; gap: 2px; padding: 1px 4px 1px 9px; border-radius: 999px; background: var(--info-tint); color: var(--info-text); font-size: 11.5px; font-weight: 600; }
.sd-chip-x { appearance: none; border: 0; background: none; color: inherit; cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1; }
.sd-hint { margin: 0; padding: 6px 14px; border-bottom: 1px solid var(--border); background: var(--bg-subtle); font-size: 11.5px; color: var(--muted); }
.sd-hint b { color: var(--fg); font-weight: 600; }
.sd-results { flex: 1; min-height: 0; overflow: auto; }
.sd-table { --cols: minmax(0, 1fr) repeat(var(--n), 84px); }
.sd-row { display: grid; grid-template-columns: var(--cols); gap: 12px; align-items: center; padding: 7px 14px; border-top: 1px solid var(--border); font-size: var(--fs-ui-sm); font-variant-numeric: tabular-nums; }
.sd-row.is-attn { background: color-mix(in oklab, var(--sev-medium) 9%, var(--bg)); }
.sd-row .r { text-align: right; min-width: 0; }
.sd-row .r.dim { color: var(--muted); }
.sd-head { position: sticky; top: 0; z-index: 1; border-top: 0; border-bottom: 1px solid var(--border); background: var(--bg); font-size: 11.5px; color: var(--muted-2); padding-block: 6px; }
.sd-sort { appearance: none; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; white-space: nowrap; }
.sd-sort.r { text-align: right; }
.sd-sort:hover, .sd-sort.is-on { color: var(--fg); }
.sd-sort.is-on { font-weight: 600; }
.sd-sort em { margin-left: 3px; font-style: normal; font-size: 9px; color: var(--accent); }
.sd-n { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sd-t { min-width: 0; }
.sd-t b { font-weight: 600; overflow-wrap: anywhere; }
.sd-sub { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted-2); overflow-wrap: anywhere; }
.sd-row.lv1 .sd-n { padding-left: 20px; }
.sd-row.lv2 .sd-n { padding-left: 40px; }
.sd-row.lv1 .sd-t b, .sd-row.lv2 .sd-t b { font-weight: 500; }
.sd-tw { appearance: none; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--muted-2); cursor: pointer; }
.sd-tw:hover { color: var(--fg); background: var(--bg-subtle); }
.sd-tw svg { width: 11px; height: 11px; transform: rotate(-90deg); transition: transform .15s; }
.sd-tw.is-open svg { transform: none; }
.sd-tw-sp { flex: none; width: 18px; }
.sd-pill { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.sd-pill.ok { background: var(--ok-tint); color: var(--ok-text); }
.sd-pill.warn { background: var(--sev-medium-tint); color: var(--sev-medium-text); }
.sd-pill.bad { background: var(--sev-critical-tint); color: var(--sev-critical-text); }
.sd-empty { margin: 0; padding: 14px; font-size: var(--fs-ui-sm); }
.sd-foot, .sd-more { margin: 0; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted-2); }
.sd-more.lv1 { padding-left: 34px; }

/* ---------- блоки отчёта Cash Flow: шторка «Все срезы» (partials/cashflow_blocks/slices.html) ---------- */
.cf-slices-open { margin: 0 0 16px; }
.cf-slices-drawer .sd-results { padding: 0 14px 14px; }
.cf-slices-drawer .sd-results .table-scroll { margin-top: 10px; }
.cf-slices-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--sev-medium); vertical-align: middle; }

/* ---------- блоки отчёта Cash Flow, варианты страницы объекта (tasks/report-blocks/03) ----------
   Все цвета — токены темы: доля расхода — --muted-2, доля перерасхода —
   --sev-critical, подложки — --bg-subtle / --border. */
/* verdict `badge` — рядом с заголовком; verdict `line` — баннер без фактов */
.cf-obj-badge { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cf-obj-saving { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cf-obj-saving b { color: var(--fg); font-size: 15px; font-weight: 700; }
.cf-verdict-line { padding-block: 10px; }
/* address `line` — строка меты с «+N» */
.cf-addr-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; overflow-wrap: anywhere; }
.cf-addr-more { display: inline-block; margin-left: 4px; }
.cf-addr-more > summary { display: inline-block; padding: 0 6px; border: 1px solid var(--border); border-radius: 999px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.cf-addr-more[open] > summary, .cf-addr-more > summary:hover { color: var(--accent); border-color: var(--accent); }
.cf-addr-more .pop-body { width: 380px; max-width: calc(100vw - 40px); color: var(--fg); font-size: var(--fs-ui-sm); }
.cf-addr-pop-list { margin: 0 0 10px; padding-left: 16px; line-height: 1.5; }
.cf-addr-pop-list:last-child { margin-bottom: 0; }
/* address `tree` */
.cf-tree { list-style: none; margin: 0; padding: 0; }
.cf-tree .cf-tree { padding-left: 16px; border-left: 1px solid var(--border); margin: 4px 0 4px 6px; }
.cf-tree li { margin: 4px 0; }
.cf-tree-node { display: block; overflow-wrap: anywhere; }
.cf-share-bar { display: block; max-width: 280px; height: 4px; margin-top: 3px; border-radius: 2px; background: var(--bg-subtle); overflow: hidden; }
.cf-share-bar i { display: block; height: 100%; background: var(--muted-2); }
/* numbers `tiles` */
.cf-num-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.cf-num-tile { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); min-width: 0; }
.cf-num-tile b { display: block; font-size: 20px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.cf-num-tile span { font-size: 11.5px; color: var(--muted); }
/* numbers `kpi` — горизонтальная шкала */
.cf-num-kpi { margin-bottom: 12px; }
.cf-num-kpi-line { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.cf-num-kpi-line b { color: var(--fg); font-size: 15px; font-weight: 700; }
.cf-kpi-scale { max-width: 560px; padding: 0 0 18px; }
.cf-kpi-track { position: relative; height: 10px; border-radius: 5px; background: var(--sev-critical-tint); }
.cf-kpi-ok { position: absolute; inset: 0 auto 0 0; border-radius: 5px 0 0 5px; background: var(--bg-subtle); border: 1px solid var(--border); border-right: 0; }
.cf-kpi-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--muted); }
.cf-kpi-tick.is-target { background: var(--muted-2); }
.cf-kpi-marker { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--fg); border: 2px solid var(--bg); }
.cf-kpi-marker.is-over { background: var(--sev-critical); }
.cf-kpi-labels { position: relative; height: 0; font-size: 11px; color: var(--muted); }
.cf-kpi-labels span { position: absolute; top: 6px; transform: translateX(-50%); white-space: nowrap; }
.cf-kpi-labels span.is-target { top: 20px; color: var(--muted-2); }
.cf-kpi-scale:has(.is-target) { padding-bottom: 32px; }
/* windows `compact` / `trend` */
.cf-win-compact { font-size: 13px; }
.cf-win-compact td:first-child { white-space: nowrap; }
.cf-trend-plot { position: relative; display: flex; gap: 18px; height: 120px; max-width: 360px; margin-top: 8px; border-bottom: 1px solid var(--border); }
.cf-trend-col, .cf-trend-col-lbl { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.cf-trend-bar { width: 60%; max-width: 48px; border-radius: 3px 3px 0 0; background: var(--muted-2); }
.cf-trend-bar.is-over { background: var(--sev-critical); }
.cf-trend-target { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--muted); z-index: 1; }
.cf-trend-target span { position: absolute; right: 0; bottom: 2px; font-size: 11px; color: var(--muted); background: var(--bg); padding-left: 4px; }
.cf-trend-labels { display: flex; gap: 18px; max-width: 360px; margin-top: 4px; }
.cf-trend-col-lbl { justify-content: flex-start; font-size: 11.5px; color: var(--muted); text-align: center; }
.cf-trend-col-lbl b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
/* symptoms `rows` / `sentences` / `chips` и общий (i) */
.cf-sym-rows { display: flex; flex-direction: column; }
.cf-sym-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 16px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.cf-sym-row:first-child { border-top: 0; }
.cf-sym-row-text { min-width: 0; overflow-wrap: anywhere; }
/* scoped: «Все срезы» `sections` reuses .cf-sym-type on its <details> */
.cf-sym-row-text .cf-sym-type { display: block; font-size: 11px; color: var(--muted-2); text-transform: lowercase; }
.cf-split { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cf-split-bar, .cf-bar { display: inline-block; width: 72px; height: 6px; border-radius: 3px; background: var(--bg-subtle); overflow: hidden; }
.cf-split-bar i, .cf-bar i { display: block; height: 100%; background: var(--muted-2); }
.cf-split-bar.is-excess i, .cf-bar.is-excess i { background: var(--sev-critical); }
.cf-split-pct { min-width: 32px; color: var(--muted); }
.cf-split-pct.is-excess { color: var(--fg); font-weight: 600; }
.cf-split-arrow { color: var(--muted-2); }
.cf-split-legend { margin: 8px 0 0; }
.cf-key { display: inline-block; width: 10px; height: 6px; border-radius: 2px; background: var(--muted-2); vertical-align: middle; }
.cf-key.is-excess { background: var(--sev-critical); }
.cf-sym-pop { display: inline-block; vertical-align: middle; }
.cf-sym-pop > summary.pop-trigger { display: inline-flex; align-items: center; color: var(--muted-2); }
.cf-sym-pop > summary.pop-trigger:hover, .cf-sym-pop[open] > summary.pop-trigger { color: var(--accent); }
.cf-sym-pop > summary.pop-trigger svg { width: 14px; height: 14px; }
.cf-sym-pop .pop-body, .cf-sym-chip .pop-body { width: 400px; max-width: calc(100vw - 40px); }
.cf-sym-info { font-size: 12px; }
.cf-sym-info th, .cf-sym-info td { padding: 4px 6px; }
.cf-sym-info th[scope="row"] { font-weight: 500; color: var(--muted); white-space: nowrap; }
.cf-sym-sentences { margin: 0; padding-left: 18px; line-height: 1.6; }
.cf-sym-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-sym-chip > summary { display: inline-block; padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-subtle); font-size: var(--fs-ui-sm); }
.cf-sym-chip > summary b { color: var(--sev-critical-text, var(--sev-critical)); }
.cf-sym-chip[open] > summary { border-color: var(--accent); }
.cf-sym-chip .pop-body { left: 0; right: auto; }
.cf-sym-chips-note { margin: 6px 0 0; }
/* levers `paired` / `table` */
.cf-levers-paired { margin: 0 0 10px; padding-left: 18px; line-height: 1.6; }
.cf-levers-paired b { font-weight: 600; }
.cf-levers-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 13px; }
.cf-levers-facts > div { display: contents; }
.cf-levers-facts dt { color: var(--muted); }
.cf-levers-facts dd { margin: 0; overflow-wrap: anywhere; }
/* блоки-графики: устройства, дни недели, пол и возраст, регионы */
.cf-bars { display: flex; flex-direction: column; gap: 6px; }
.cf-bars-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr); gap: 12px; align-items: center; font-size: var(--fs-ui-sm); }
.cf-bars-lbl { min-width: 0; overflow-wrap: anywhere; }
.cf-bars-row.is-hot .cf-bars-lbl { font-weight: 600; }
.cf-bars-pair { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cf-bars-line { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.cf-bars-line .cf-bar { flex: 1; max-width: 260px; }
.cf-bars-pct { min-width: 34px; font-size: 11.5px; color: var(--muted); }
.cf-bars-pct.is-excess { color: var(--fg); }
.cf-bars-more { margin: 4px 0 0; }
.cf-chart-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 24px; }
.cf-chart-part { min-width: 0; }
/* tables of seven columns don't fit two abreast at the report width */
.cf-chart-pair.is-stacked { grid-template-columns: minmax(0, 1fr); }
.cf-chart-part h3 { margin: 0 0 6px; font-size: 13px; }
.cf-stack { display: flex; flex-direction: column; gap: 6px; }
.cf-stack-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 11.5px; color: var(--muted); }
.cf-stack-bar { display: flex; height: 20px; border-radius: 4px; overflow: hidden; background: var(--bg-subtle); }
.cf-stack-seg { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 6px; font-style: normal; font-size: 11px; line-height: 20px; color: var(--fg);
  background: color-mix(in oklab, var(--muted-2) max(12%, 60% - var(--seg) * 12%), var(--bg)); border-right: 1px solid var(--bg); }
.cf-stack-bar.is-excess .cf-stack-seg { background: color-mix(in oklab, var(--sev-critical) max(14%, 75% - var(--seg) * 14%), var(--bg)); }
.cf-stack-seg.is-hot { font-weight: 700; }
.cf-stack-keys { margin: 8px 0 0; }
.cf-cols { display: flex; gap: 8px; max-width: 460px; }
.cf-cols-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; font-size: 11.5px; }
.cf-cols-plot { position: relative; width: 100%; height: 90px; border-bottom: 1px solid var(--border); }
.cf-cols-spend, .cf-cols-excess { position: absolute; bottom: 0; left: 50%; border-radius: 2px 2px 0 0; }
.cf-cols-spend { width: 70%; transform: translateX(-50%); background: color-mix(in oklab, var(--muted-2) 45%, var(--bg)); }
.cf-cols-excess { width: 36%; transform: translateX(-50%); background: var(--sev-critical); }
.cf-cols-pct { font-variant-numeric: tabular-nums; }
.cf-cols-day { color: var(--muted); }
.cf-cols-col.is-hot .cf-cols-day { color: var(--fg); font-weight: 600; }
.cf-heat { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 4px; max-width: 520px; }
.cf-heat-cell { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border-radius: 4px; font-size: 11px; font-variant-numeric: tabular-nums;
  background: color-mix(in oklab, var(--sev-critical) calc(var(--heat) * .55), var(--bg-subtle)); }
.cf-heat-cell b { font-size: 13px; }
.cf-heat-day, .cf-heat-sub { color: var(--muted); }
.cf-heat-cell.is-hot { outline: 2px solid var(--sev-critical); outline-offset: -2px; }
/* ---------- блоки отчёта Cash Flow, варианты «Обзора» аудита (tasks/report-blocks/04) ---------- */
/* заголовок блока с (i) «срезы пересекаются …» */
.cf-block-head { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.cf-block-head h2 { margin: 0; }
.cf-block-note .pop-body { left: 0; right: auto; width: 320px; }
/* savings `hero` */
.cf-save-hero { margin-bottom: 12px; }
.cf-save-hero-num { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cf-save-hero-num b { display: block; color: var(--fg); font-size: 28px; font-weight: 700; line-height: 1.15; }
.cf-save-hero-rate { color: var(--fg); font-weight: 600; }
.cf-save-hero-bar { display: block; max-width: 420px; height: 6px; margin: 8px 0 6px; border-radius: 3px; background: var(--bg-subtle); overflow: hidden; }
.cf-save-hero-bar i { display: block; height: 100%; background: var(--sev-critical); }
.cf-save-hero-spend { margin: 0; }
/* symptoms `rows`: строка — <summary>, тело — цифры, кампании, настройки */
.cf-sym-acc { border-top: 1px solid var(--border); }
.cf-sym-acc:first-child { border-top: 0; }
.cf-sym-acc > summary { list-style: none; cursor: pointer; border-top: 0; }
.cf-sym-acc > summary::-webkit-details-marker { display: none; }
.cf-sym-acc > summary:hover .cf-sym-row-sentence { color: var(--accent); }
/* шеврон справа: SVG, не «▸» — 11px глиф в --muted-2 читался точкой */
.cf-sym-acc-caret { display: block; width: 14px; height: 14px; flex: none; color: var(--muted); transform: rotate(-90deg); transition: transform .15s; }
.cf-sym-acc[open] .cf-sym-acc-caret { transform: none; }
.cf-sym-acc > summary:hover .cf-sym-acc-caret { color: var(--accent); }
.cf-sym-acc-more td { font-size: 12px; }
.cf-sym-scope { font-size: var(--fs-ui-sm); }
.cf-sym-setting { display: block; margin-top: 2px; color: var(--muted); }
.cf-sym-acc-body { display: flex; flex-direction: column; gap: 10px; padding: 0 0 12px; }
.cf-sym-acc-body .cf-sym-lever p { margin: 0 0 2px; }
.cf-sym-acc-body .cf-sym-list { margin: 0; padding-left: 18px; line-height: 1.5; }
/* levers (аудит) */
.cf-acc-levers-item h3 { margin: 10px 0 4px; font-size: 13px; }
.cf-acc-levers-item:first-of-type h3 { margin-top: 0; }
.cf-acc-levers-item .cf-sym-list { margin: 0; padding-left: 18px; line-height: 1.6; }
.cf-acc-levers-table th[scope="row"] { font-weight: 500; white-space: nowrap; }
.cf-acc-levers-table td { min-width: 180px; vertical-align: top; }
/* campaigns `shares`: KPI под названием */
.cf-bars-note { display: block; font-size: 11px; color: var(--muted); }
/* «Все срезы»: подстроки кампаний под строкой среза аккаунта */
.cf-sub-parent { cursor: pointer; }
.cf-sub-toggle { display: inline-block; width: 16px; margin: 0 4px 0 -2px; padding: 0; border: 0; background: none; color: var(--muted-2); font-size: 11px; cursor: pointer; transition: transform .15s; }
.cf-sub-toggle[aria-expanded="true"] { transform: rotate(90deg); }
.cf-sub-parent:hover .cf-sub-toggle { color: var(--accent); }
.cf-sub-row td { font-size: 12px; color: var(--muted); background: var(--bg-subtle); }
.cf-sub-row td:first-child { padding-left: 26px; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .cf-num-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cf-sym-row { grid-template-columns: minmax(0, 1fr) auto; }
  .cf-sym-row .cf-split { grid-column: 1 / -1; grid-row: 2; }
  .cf-sym-acc .cf-sym-row { grid-template-columns: minmax(0, 1fr) auto; }
  .cf-sym-acc .cf-sym-acc-caret { grid-column: 2; grid-row: 1; }
  .cf-save-hero-num b { font-size: 24px; }
  .cf-bars-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .cf-levers-facts { grid-template-columns: minmax(0, 1fr); }
  .cf-levers-facts dd { margin-bottom: 4px; }
}
.sd-more.lv2 { padding-left: 54px; }
.sd-foot .link-btn { margin-left: 8px; font-size: var(--fs-ui-sm); }
@media (max-width: 640px) {
  .sd-table { --cols: minmax(0, 1fr) repeat(2, 76px); }
  .sd-row > span:nth-child(n+4) { display: none; }
}

/* «Обратная связь»: форма пользователя и текст сообщения на вкладке «Наблюдения» */
.fb-card { max-width: 560px; margin-inline: auto; }
.fb-title { margin: 0 0 6px; font-size: 20px; }
.fb-card textarea { width: 100%; resize: vertical; font: inherit; }
.fb-msg { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 70ch; }

/* =========================================================================
   Лендинг (/ для анонимов, templates/landing.html, app/landing.py).
   Тема — как везде (html[data-theme], «Как в системе» по умолчанию), цвета
   из токенов приложения; зоны шкалы и чипы отклонений — те же, что в отчёте.
   Исключение — первый экран: полоса цвета кадров ролика (--lp-band) в обеих
   темах, чтобы у ролика не было видно краёв. Пересоберут ролик с другим фоном —
   меняйте --lp-band вместе с ним.
   ========================================================================= */
.landing {
  --lp-band: #0b0f17; --lp-band-fg: #e8ebf1; --lp-band-muted: #9aa3b2; --lp-band-line: rgba(255, 255, 255, .12);
  --lp-w: 1180px;
  background: var(--bg-subtle);
}
.lp-band { background: var(--lp-band); color: var(--lp-band-fg); padding: 0 28px 44px; }
.lp-top { max-width: var(--lp-w); margin: 0 auto; display: flex; align-items: center; gap: 16px; height: 60px; }
.lp-brand { color: #fff; font-weight: 700; font-size: 15px; line-height: 1; }
.lp-brand:hover { text-decoration: none; }
.lp-top-r { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: var(--fs-ui); }
.lp-top-r > a:not(.btn) { color: var(--lp-band-muted); }
.lp-top-r > a:not(.btn):hover { color: #fff; text-decoration: none; }
.lp-band .btn-ghost { color: var(--lp-band-fg); border-color: rgba(255, 255, 255, .22); }
.lp-band .btn-ghost:hover { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .34); }
.lp-band .lp-title { color: #fff; }
.lp-band .lp-sub { color: #aab2c0; }
.lp-band .lp-fine { color: #7f8899; }

.lp-title { margin: 0 0 10px; font-size: 36px; line-height: 1.1; font-weight: 760; letter-spacing: -.02em; text-wrap: balance; }
.lp-sub { margin: 0; max-width: 62ch; font-size: 16.5px; line-height: 1.5; color: var(--muted); }
.lp-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-lg { padding: 10px 18px; font-size: 15px; font-weight: 600; }
.btn-lg.btn-ghost { font-weight: 500; }
.lp-fine { margin: 8px 0 0; font-size: 12.5px; color: var(--muted-2); }
.lp-h2 { margin: 0 0 18px; font-size: 26px; line-height: 1.15; font-weight: 740; letter-spacing: -.015em; }

/* ролик: без рамки и скруглений — сливается с полосой */
.lp-media { max-width: var(--lp-w); margin: 0 auto; }
.lp-video { display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--lp-band); }
/* ролик — беззвучная петля (landing.js); кнопка пауза/пуск в углу */
.lp-video-wrap { position: relative; margin: 0; }
.lp-video-toggle {
  position: absolute; right: 12px; bottom: 12px; width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  color: #fff; background: rgba(11, 15, 23, .62); border: 1px solid rgba(255, 255, 255, .22);
}
.lp-video-toggle:hover { background: rgba(11, 15, 23, .82); }
.lp-video-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lp-video-toggle[hidden] { display: none; }
.lp-video-toggle .i-play, .lp-video-toggle.is-paused .i-pause { display: none; }
.lp-video-toggle.is-paused .i-play { display: block; }
/* пока файла ролика нет — карточка-превью отчёта (светлая, из токенов темы) */
.lp-preview { max-width: 520px; margin: 24px auto; padding: 22px 26px 20px; color: var(--fg); box-shadow: var(--pop-shadow); }
.lp-preview-h { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted-2); }
.lp-preview-t { margin: 12px 0 0; font-size: 14px; color: var(--muted); }

/* под роликом заголовок и кнопка */
.lp-pitch { max-width: var(--lp-w); margin: 26px auto 0; display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: end; }
.lp-act { text-align: right; }

/* шкала зон: 0–39 / 40–59 / 60–74 / 75–89 / 90–100, как cashflow_score_band */
.lp-zones { position: relative; display: grid; grid-template-columns: 40fr 20fr 15fr 15fr 10fr; gap: 3px; margin: 16px 0 6px; }
.lp-zones i { display: block; height: 6px; border-radius: 2px; }
.lp-zones .z-crit { background: var(--sev-critical); }
.lp-zones .z-bad  { background: var(--sev-high); }
.lp-zones .z-ok   { background: var(--sev-medium); }
.lp-zones .z-good { background: var(--cf-ly); }
.lp-zones .z-top  { background: var(--cf-top); }
.lp-pin { position: absolute; top: -4px; width: 3px; height: 14px; border-radius: 2px; background: var(--fg); transform: translateX(-1.5px); }
.lp-zone-names { display: grid; grid-template-columns: 40fr 20fr 15fr 15fr 10fr; gap: 3px; font-size: 10.5px; color: var(--muted-2); text-align: left; }
.lp-zone-names span:last-child { text-align: right; }

/* «Что в отчёте» — три карточки вместо трёх экранов */
.lp-what, .lp-faq, .lp-end { max-width: calc(var(--lp-w) + 56px); margin: 0 auto; padding: 56px 28px; }
.lp-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lp-cards .card { margin: 0; padding: 18px 20px; display: flex; flex-direction: column; }
.lp-card-k { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.lp-card-t { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.lp-card-k + .lp-card-t { margin-top: 2px; }
.lp-mini { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13.5px; }
.lp-mini li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.lp-mini li:first-child { border-top: 0; }
.lp-mini-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-mini b { font-variant-numeric: tabular-nums; }
.lp-mini .cf-dev { font-size: 12px; justify-self: start; }

/* частые вопросы: аккордеон на <details>, без JS */
.lp-faq-list { border-top: 1px solid var(--border); }
.lp-faq-list details { border-bottom: 1px solid var(--border); }
.lp-faq-list summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 15px 2px; font-size: 16px; font-weight: 600; cursor: pointer; }
.lp-faq-list summary::-webkit-details-marker { display: none; }
.lp-faq-list summary::after {
  content: ""; margin-left: auto; flex: none; width: 9px; height: 9px;
  border-right: 2px solid var(--muted-2); border-bottom: 2px solid var(--muted-2);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s;
}
.lp-faq-list details[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.lp-faq-list summary:focus-visible { outline-offset: -2px; }
.lp-faq-list p { margin: -4px 0 16px; padding-right: 32px; color: var(--muted); max-width: 64ch; }
.lp-what + .lp-faq { padding-top: 24px; }

/* короткий призыв в конце */
.lp-end { padding-top: 0; }
.lp-end .card { display: flex; align-items: center; gap: 18px; padding: 22px 26px; margin: 0; }
.lp-end h2 { margin: 0; font-size: 22px; font-weight: 720; }
.lp-end p { margin: 0; color: var(--muted); font-size: 14px; }
.lp-end .lp-cta { margin-left: auto; flex: none; }

.lp-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; padding: 18px 20px 24px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted-2); }
.lp-foot a { color: inherit; }

@media (max-width: 760px) {
  /* на телефоне ролик во всю ширину экрана, текст — с полями */
  .lp-band { padding: 0 0 32px; }
  .lp-top { padding: 0 16px; height: 50px; }
  .lp-pitch { grid-template-columns: 1fr; gap: 16px; margin-top: 18px; padding: 0 16px; }
  .lp-act { text-align: left; }
  .lp-act .btn { width: 100%; justify-content: center; }
  .lp-title { font-size: 26px; }
  .lp-sub { font-size: 16px; }
  .lp-preview { margin: 16px; }
  .lp-what, .lp-faq, .lp-end { padding: 40px 16px; }
  .lp-end { padding-top: 0; }
  .lp-cards { grid-template-columns: 1fr; }
  .lp-h2 { font-size: 22px; }
  .lp-end .card { flex-direction: column; align-items: stretch; }
  .lp-end .lp-cta { margin-left: 0; }
}

/* Колонна входа и регистрации на лендинге (templates/landing.html, landing_auth.js):
   растёт вниз из-под шапки справа, цвета полосы в обеих темах (как шапка — стыка не
   видно), страница под затемнением. Шапка над затемнением — копия настоящей; у
   выбранной кнопки полоска по нижнему краю шапки, прямо над колонной. Поля мельче,
   чем в приложении: колонна 360 px. */
html:has(> body.landing) { scrollbar-gutter: stable; }  /* замок прокрутки не сдвигает шапку */
.landing.is-auth { overflow: hidden; }
.lp-auth { position: fixed; inset: 0; z-index: 50; }
.lp-auth-dim { position: absolute; inset: 0; background: rgba(5, 8, 13, .64); backdrop-filter: blur(2px); cursor: default; }
.lp-auth-bar { position: absolute; top: 0; left: 0; right: 0; padding: 0 28px; background: var(--lp-band); color: var(--lp-band-fg); }
.lp-auth-bar .lp-top-r { align-self: stretch; }
.lp-auth-bar .lp-top-r > a { position: relative; }
.lp-auth-bar .lp-top-r > a.is-on:not(.btn) { color: #fff; }
.lp-auth-bar .lp-top-r > a.is-on::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: calc(50% - 30px); height: 2px;
  border-radius: 2px 2px 0 0; background: var(--accent);
}
.lp-auth-panel {
  /* тёмные значения токенов приложения: поля, кнопки и ошибки берут их отсюда */
  --fg: #e8ebf1; --muted: #a3acba; --muted-2: #7f8899; --bg: var(--lp-band);
  --bg-subtle: rgba(255, 255, 255, .05); --border: rgba(255, 255, 255, .14);
  --sev-critical-tint: rgba(208, 55, 57, .16); --sev-critical-text: #f2a5a7;
  --ok-tint: rgba(108, 196, 134, .16); --ok-text: #9bd9ab;
  position: absolute; top: 60px; right: 0; bottom: 0; width: 360px; overflow: auto; overscroll-behavior: contain;
  padding: 16px 22px 20px; background: var(--bg); color: var(--fg); color-scheme: dark; font-size: 15px;
  border-left: 1px solid var(--lp-band-line); box-shadow: -30px 30px 70px rgba(0, 0, 0, .5);
}
.lp-auth-panel a:not(.btn) { color: #9cc2ff; }
.lp-auth-panel label { margin: 10px 0; font-size: 13px; }
.lp-auth-panel label input { margin-top: 4px; padding: 7px 10px; font-size: 14px; }
.lp-auth-panel input:not([type=checkbox]) { background: rgba(255, 255, 255, .045); border-color: var(--border); }
.lp-auth-panel input[aria-invalid="true"] { border-color: #e2575a; }
.lp-auth-panel input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(226, 87, 90, .22); }
.lp-auth-panel .btn-wide { margin-top: 12px; padding: 8px 12px; font-size: 14px; }
.lp-auth-panel .alert { margin: 6px 26px 4px 0; padding: 7px 10px; font-size: 13px; }
.lp-auth-panel .consent-check { margin: 12px 0 6px; font-size: 12px; }
.lp-auth-panel .consent-note { margin: 0 0 4px; font-size: 11.5px; color: var(--muted); }
.lp-auth-panel a.lp-auth-x {
  position: absolute; top: 6px; right: 6px; z-index: 1; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 6px; color: var(--muted);
}
.lp-auth-panel a.lp-auth-x:hover { background: var(--bg-subtle); color: var(--fg); }
.lp-auth-lead { margin: 2px 26px 2px 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.lp-auth-hint { margin: 10px 0 0; font-size: 12px; color: var(--muted-2); text-align: center; }
.lp-fld { margin-bottom: 10px; }
.lp-fld label { margin-bottom: 0; }
.lp-fld-err { margin: 4px 0 0; font-size: 12px; color: var(--sev-critical-text); }
.lp-fld-err-consent { margin: -4px 0 8px; }
.lp-auth-done { text-align: center; padding: 18px 0 4px; }
.lp-auth-done-ic {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 10px;
  border-radius: 50%; background: var(--ok-tint); color: var(--ok-text);
}
.lp-auth-done h2 { margin: 0 0 6px; font-size: 18px; color: #fff; }
.lp-auth-done p { margin: 0 0 6px; font-size: 13.5px; color: var(--muted); }
/* анимация — только когда колонну открыл скрипт (is-anim); открытая сервером на
   /login и /register появляется сразу */
@media (prefers-reduced-motion: no-preference) {
  .lp-auth.is-anim .lp-auth-dim { animation: lp-auth-fade .22s ease-out; }
  .lp-auth.is-anim .lp-auth-panel { animation: lp-auth-pour .3s cubic-bezier(.2, .7, .3, 1); }
  .lp-auth.is-anim .lp-auth-panel > section { animation: lp-auth-rise .2s .1s ease-out backwards; }
  .lp-auth.is-anim.from-scroll .lp-auth-bar { animation: lp-auth-bar .22s cubic-bezier(.2, .7, .3, 1); }
  .lp-auth.is-anim .lp-auth-bar .lp-top-r > a.is-on::after { animation: lp-auth-tab .2s ease-out; }
  .lp-auth.is-closing .lp-auth-dim { animation: lp-auth-fade .17s ease-in reverse forwards; }
  .lp-auth.is-closing .lp-auth-panel { animation: lp-auth-pour .17s ease-in reverse forwards; }
}
@keyframes lp-auth-fade { from { opacity: 0; } }
@keyframes lp-auth-pour { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes lp-auth-rise { from { opacity: 0; transform: translateY(-6px); } }
@keyframes lp-auth-bar { from { transform: translateY(-100%); } }
@keyframes lp-auth-tab { from { opacity: 0; transform: scaleX(.3); } }
@media (max-width: 760px) {
  .lp-auth-bar { padding: 0; }
  .lp-auth-bar .lp-top-r > a.is-on::after { bottom: calc(50% - 25px); }
  .lp-auth-panel { top: 50px; width: 100%; padding: 14px 16px 20px; border-left: 0; }
}
