/* Портал заказчика — единый стиль для страниц входа и дашборда.
   Акцентный цвет клиента приходит через --accent (см. base.html). */

:root {
  --accent: #333;
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --ink: #1c1e21;
  --muted: #6b7280;
  --line: #e5e7eb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--accent); }

/* ---------- Вход ---------- */
.auth-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  border-top: 4px solid var(--accent);
}

.auth-brand { text-align: center; margin-bottom: 22px; }

.auth-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #fff;
  background: var(--accent);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.auth-brand h1 { font-size: 20px; margin: 0 0 4px; }
.auth-sub { margin: 0; color: var(--muted); font-size: 14px; }

.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

.auth-form input {
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.btn-primary {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
  transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.06); }

/* ---------- Верхняя панель дашборда ---------- */
.topbar { background: var(--card-bg); border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: none;
  margin: 0 auto;
  padding: 14px 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-badge {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
}
.topbar-title { font-weight: 600; }
.topbar-logout { display: flex; align-items: center; gap: 12px; }
/* Правая часть шапки: язык, показ исходных данных, выход. */
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-lang { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.topbar-lang .lang-opt {
  padding: 3px 9px; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  color: var(--muted); text-decoration: none; background: transparent;
}
.topbar-lang .lang-opt + .lang-opt { border-left: 1px solid var(--line); }
.topbar-lang .lang-opt:hover { color: var(--accent); }
.topbar-lang .lang-opt.is-on { background: var(--accent); color: #fff; }
.lang-orig {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--muted); text-decoration: none;
}
.lang-orig:hover { color: var(--accent); }
.lang-orig .lang-box {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border: 1px solid var(--line); border-radius: 3px;
  font-size: 10px; line-height: 1; color: var(--accent);
}
.lang-orig.is-on { color: var(--ink); }
.lang-orig.is-on .lang-box { border-color: var(--accent); }
.auth-lang { float: right; margin: -4px 0 0 12px; }
@media (max-width: 720px) { .topbar-right { gap: 8px; } .lang-orig span:last-child { display: none; } }
.topbar-user { color: var(--muted); font-size: 14px; }

.btn-ghost {
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--bg); }

/* ---------- Контент ---------- */
.page { flex: 1; max-width: none; margin: 0 auto; padding: 28px 5%; width: 100%; }

.hero { margin-bottom: 28px; }
.hero h1 { font-size: 26px; margin: 0 0 8px; }
.hero-sub { margin: 0; color: var(--muted); max-width: 640px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 17px; margin: 0 0 8px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 3px 9px;
  border-radius: 999px;
}
.card-soon { opacity: .92; }

/* ---------- Подвал ---------- */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

/* ---------- Топбар: бренд-ссылка + хлебные крошки ---------- */
.topbar-home { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.topbar-crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.topbar-crumbs a { color: var(--muted); text-decoration: none; }
.topbar-crumbs a:hover { color: var(--accent); }
.topbar-crumbs .crumb-sep { color: var(--line); }

/* Фильтры (сезон/категория) — под заголовком СЛЕВА: в правом углу заказчик их
   не замечал. Поэтому колонка, а не space-between. */
.hero-compact { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 20px; }
.hero-compact h1 { margin-bottom: 0; }

/* ---------- Стартовая: плашки-площадки в два столбца ---------- */
/* Стартовая тянется на всю высоту экрана: плашки занимают всё, что осталось
   под приветствием, до нижнего отступа страницы (padding .page). */
.page-start { display: flex; flex-direction: column; }
.page-start .split { flex: 1; min-height: 0; }
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
}
.split-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: #fff;
  border: none;
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(16,24,40,.14);
  padding: 34px 34px;
  min-height: 210px;
  overflow: hidden;
  transition: transform .12s, box-shadow .12s, filter .12s;
}
/* Цвета маркетплейсов */
.split-wb { background: linear-gradient(120deg, #7b1fa2 0%, #cb11ab 55%, #e6337e 100%); }
.split-oz { background: linear-gradient(120deg, #0044cc 0%, #005bff 55%, #2f86ff 100%); }
.split-card:hover:not(.is-soon) { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(16,24,40,.20); }
.split-kicker { font-size: 12px; color: rgba(255,255,255,.82); text-transform: uppercase; letter-spacing: .06em; }
.split-card h2 { font-size: 28px; margin: 8px 0 10px; color: #fff; }
.split-card p { margin: 0 auto 16px; color: rgba(255,255,255,.9); font-size: 15px; max-width: 46ch; }
.split-go { font-weight: 700; color: #fff; font-size: 15px; }
.split-card.is-soon { filter: grayscale(.55) brightness(.97); opacity: .9; cursor: default; }
.split-card .card-tag {
  position: absolute; top: 18px; right: 20px;
  background: rgba(255,255,255,.22); color: #fff;
  padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
/* На узких экранах плашки складываются в один столбец */
@media (max-width: 780px) {
  .split { grid-template-columns: 1fr; }
  .split-card { min-height: 150px; }
}

/* ---------- Оглавление WB ---------- */
.wb-toc { list-style: none; counter-reset: none; margin: 0 0 24px; padding: 0; }
.wb-toc-item { margin-bottom: 10px; }
.wb-toc-item a {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; text-decoration: none; color: var(--ink); font-weight: 500;
  box-shadow: var(--shadow); transition: border-color .12s, transform .12s;
}
.wb-toc-item a:hover { border-color: var(--accent); transform: translateX(2px); }
.wb-toc-item.is-soon a { color: var(--muted); font-weight: 400; }
.wb-toc-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px; flex: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
  font-size: 13px; font-weight: 700;
}
.wb-toc-item .card-tag { margin-left: auto; position: static; }

.wb-download-wrap { text-align: right; }
.wb-download { color: var(--accent); font-weight: 600; text-decoration: none; }
.wb-download:hover { text-decoration: underline; }
.wb-download-note { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- Фильтр сезонов ---------- */
.wb-toolbar { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; }
.wb-toolbar label { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }

/* Панель бенчмарков ниши */
.bench-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card-bg); }
.bench-table th, .bench-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.bench-table thead th { background: #eef0f2; color: var(--muted); font-weight: 600; font-size: 12px; }
.bench-table .align-r { text-align: right; }
.wb-toolbar select {
  font-size: 14px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card-bg); color: var(--ink); cursor: pointer;
}
.wb-toolbar select:focus { outline: none; border-color: var(--accent); }

/* ---------- Блоки и таблицы ---------- */
.wb-block { margin-bottom: 28px; }
.wb-block-title { font-size: 17px; margin: 0 0 12px; }
/* Уточнение к заголовку блока (напр. сколько строк показано из скольких) */
.wb-block-sub { margin-left: 10px; font-size: 13px; font-weight: 400; color: var(--muted); }

.wb-table-wrap {
  overflow: auto;
  /* Длинные таблицы прокручиваются ВНУТРИ себя, а не растягивают страницу:
     иначе шапка (она sticky) уезжает вверх вместе со всем документом, и через
     полсотни строк уже не понять, что за столбец перед тобой. Потолок высоты
     задан так, чтобы над таблицей оставались заголовок блока и настройки. */
  max-height: min(76vh, 820px);
  overscroll-behavior: contain;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.wb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wb-table th, .wb-table td { padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
/* Шапку залипаем целиком, а не построчно: у таблиц с группами столбцов
   («СРС топ-5/10/30») строк заголовка две, и с общим top: 0 вторая наехала бы
   на первую. Отдельный z-index у thead держит её над закреплёнными колонками. */
.wb-table thead { position: sticky; top: 0; z-index: 4; }
.wb-table thead th {
  position: sticky; top: 0; background: #eef0f2; color: var(--muted);
  font-weight: 600; font-size: 12px; text-align: left; z-index: 2;
  padding-right: 26px; cursor: pointer; user-select: none;
  /* Подписи разной высоты (одна строка и две) прижимаем к низу — тогда нижняя
     строка заголовка стоит ровно над данными. */
  vertical-align: bottom;
}
/* Длинные подписи переносим на две строки вместо того, чтобы растягивать
   столбец: у широких таблиц («Анализ логистики») заголовок вроде «Доля
   отменённых заказов» задавал ширину столбца втрое больше самих чисел.
   Ограничение ставим на подпись, а не на ячейку: max-width у th в таблице с
   авторазметкой браузер трактует как пожелание и часто игнорирует. */
.wb-table thead th .th-label {
  display: inline-block; max-width: 140px; white-space: normal; line-height: 1.25;
}
.wb-table thead th:first-child { z-index: 3; }
/* Граница под шапкой рисуется тенью: собственный border у sticky-ячейки
   прокручивается вместе с содержимым и на границе пропадает. */
.wb-table thead th { box-shadow: inset 0 -1px 0 var(--line); }
/* Числовые столбцы: подпись прижата вправо, ровно над значениями. Кнопка
   фильтра переезжает влево — иначе она съедала бы 26px справа и заголовок
   вставал левее данных (у ячеек отступ 12px). */
.wb-table thead th.align-r { text-align: right; padding-right: 12px; padding-left: 26px; }
.wb-table thead th.align-r .th-filter { right: auto; left: 5px; }
.wb-table thead th:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.wb-table thead th.sort-asc .th-label::after { content: " ▲"; font-size: 9px; color: var(--accent); }
.wb-table thead th.sort-desc .th-label::after { content: " ▼"; font-size: 9px; color: var(--accent); }
.th-filter {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 11px; line-height: 1; padding: 3px 4px; border-radius: 4px; opacity: .45;
}
.wb-table thead th:hover .th-filter { opacity: 1; }
.wb-table thead th.has-filter .th-filter { opacity: 1; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* Excel-подобный поповер фильтра/сортировки */
.wb-filter-pop {
  position: fixed; z-index: 50; width: 252px;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 10px; font-size: 13px;
  /* Высоту задаёт скрипт по свободному месту на экране; здесь только правило,
     что содержимое при нехватке места прокручивается, а не обрезается. */
  display: flex; flex-direction: column; overflow: auto;
}
.pop-sort { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.pop-sort-btn {
  text-align: left; background: transparent; border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; cursor: pointer; font-size: 13px; color: var(--ink);
}
.pop-sort-btn:hover { border-color: var(--accent); color: var(--accent); }
.pop-search { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; }
.pop-search:focus { outline: none; border-color: var(--accent); }
.pop-all { display: flex; align-items: center; gap: 6px; font-weight: 600; padding: 3px 0; border-bottom: 1px solid var(--line); margin-bottom: 4px; cursor: pointer; }
.pop-list { max-height: 200px; overflow-y: auto; }
.pop-item { display: flex; align-items: center; gap: 6px; padding: 3px 2px; cursor: pointer; }
.pop-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item:hover { background: var(--bg); }
.pop-actions { display: flex; gap: 8px; margin-top: 8px; }
.pop-apply, .pop-clear { flex: 1; padding: 7px; font-size: 13px; border-radius: 8px; cursor: pointer; }
.pop-clear { border: 1px solid var(--line); background: transparent; }

/* --- Стратегия (Коммерческое предложение): иконка + цветная метка + тултип --- */
.strat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 7px; border-radius: 999px; cursor: help;
  font-weight: 600; font-size: 12px; white-space: nowrap;
  border: 1px solid transparent;
}
.strat::before { content: attr(data-ico); font-size: 13px; }
.strat-zahvat { color: #0a7d33; background: #e7f6ec; border-color: #b7e3c4; }
.strat-optim  { color: #9a6a00; background: #fdf4e3; border-color: #f2dcae; }
.strat-uhod   { color: #b42318; background: #fdeceb; border-color: #f6c9c5; }
/* сезонность (порядковая, сине-градиентная) */
.seas-strong { color: #123f78; background: #e2ecfa; border-color: #b9d2f4; }
.seas-mid    { color: #1c5cab; background: #eef4fc; border-color: #cfe0f8; }
.seas-none   { color: #6b7280; background: #f1f1ef; border-color: #e2e1db; }

/* --- Графики над таблицей --- */
.charts-block { margin-bottom: 28px; }
.charts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.charts-grid > .chart-card-wide { grid-column: 1 / -1; }
/* Широкие карточки живут отдельным блоком под сеткой и видны всегда: под
   спойлер они не прячутся, а в общей сетке растягивали её на лишнюю колонку
   (см. `_charts.html`). Каждая — на всю ширину страницы. */
.charts-wide { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
.charts-wide:first-child { margin-top: 0; }
/* Сетка под «длинные» графики (десятки строк): ячейка примерно в половину
   страницы. На всю ширину такие карточки читаются плохо — подпись строки
   занимает фиксированную долю ячейки, и слева остаётся пустое поле. */
.charts-grid.charts-grid-lg { grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); }
.charts-toggle {
  margin-top: 14px; border: none; background: transparent; cursor: pointer;
  color: var(--accent); font-weight: 600; font-size: 14px; padding: 6px 0;
}
.charts-toggle::before { content: "▸ "; }

/* --- Вкладки разделов WB (дубль оглавления) --- */
.wb-tabs { background: var(--card-bg); border-bottom: 1px solid var(--line); }
.wb-tabs-inner {
  max-width: none; margin: 0 auto; padding: 0 5%;
  display: flex; gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.wb-tab {
  padding: 12px 14px; white-space: nowrap; text-decoration: none;
  color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent;
}
.wb-tab:hover { color: var(--ink); }
.wb-tab.is-current { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.wb-tab.is-soon { color: #b9b7b0; }
.wb-tab.is-soon.is-current { color: var(--accent); }

/* Панель охвата графиков: сколько строк рисовать и по какой полосе значения */
.wb-scope { padding: 10px 14px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 14px; }
.wb-scope-note { flex-basis: 100%; margin: 2px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }

/* Вкладки второго уровня (разрезы внутри раздела) */
.wb-subtabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 14px; }
.wb-subtab {
  padding: 7px 14px; border-radius: 999px; text-decoration: none; font-size: 14px;
  color: var(--muted); background: #f1f1ef; border: 1px solid transparent;
}
.wb-subtab:hover { color: var(--ink); }
.wb-subtab.is-current {
  color: var(--accent); background: #fff; font-weight: 600;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

/* Плитки KPI (сводка медиаплана): главный ответ раздела — до графиков.
   auto-fit + minmax, чтобы шесть плиток сами перестроились в 3×2 и 2×3. */
.mp-kpi {
  display: grid; gap: 10px; margin-bottom: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  /* .hero-compact — колонка с align-items:flex-start, поэтому без явной ширины
     сетка сжимается до содержимого и плитки встают в один столбец. */
  width: 100%; align-self: stretch;
}
.mp-kpi-card {
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow);
  border-left: 4px solid var(--line);
}
.mp-kpi-card.is-pos { border-left-color: #0ca30c; }
.mp-kpi-card.is-neg { border-left-color: #d03b3b; }
.mp-kpi-label { font-size: 12px; color: var(--muted); }
.mp-kpi-value { font-size: 22px; font-weight: 700; line-height: 1.25; margin: 2px 0; }
.mp-kpi-hint { font-size: 12px; color: var(--muted); line-height: 1.35; }
.chart-card {
  margin: 0; background: var(--card-bg); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px;
}
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.chart-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 999px; flex: none;
  font-size: 11px; font-style: italic; font-weight: 700; cursor: help;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.chart-note { margin-top: 10px; font-size: 12px; color: var(--muted); }
.chart-seg-lbl { fill: #fff; font-size: 10px; font-weight: 600; }
.chart-axis { stroke: #c3c2b7; stroke-width: 1; }
.chart-tick { fill: #898781; font-size: 10px; }

/* переключатель внутри карточки графика (режим виджета, выбор региона/категории) */
.chart-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: -4px 0 12px; }
.chart-ctl label { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.chart-ctl select {
  font: inherit; font-size: 12px; padding: 4px 8px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%;
}
.chart-ctl select:focus { outline: none; border-color: var(--accent); }
.chart-ctl-tabs { display: inline-flex; gap: 2px; background: #f1f1ef; border-radius: 999px; padding: 2px; }
.chart-ctl-tabs a {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; text-decoration: none;
  color: var(--muted); white-space: nowrap;
}
.chart-ctl-tabs a.is-current { background: #fff; color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }

/* горизонтальная легенда под графиком */
.chart-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 0; padding: 0; }
.chart-legend li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); }

/* спойлер «показать ещё» */
.charts-more { margin: -12px 0 28px; }
.charts-more > summary {
  cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px;
  padding: 8px 0; list-style: none; user-select: none;
}
.charts-more > summary::-webkit-details-marker { display: none; }
.charts-more > summary::before { content: "▸ "; }
.charts-more[open] > summary::before { content: "▾ "; }
.chart-empty { color: var(--muted); font-size: 13px; padding: 20px 0; text-align: center; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-lbl { fill: #52514e; font-size: 11px; }
.chart-val { fill: #1c1e21; font-size: 11px; font-variant-numeric: tabular-nums; }

/* HTML-столбчатые (чёткий текст при любом масштабе) */
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar-row { display: grid; grid-template-columns: minmax(80px, 38%) 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.hbar-label { color: #52514e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.hbar-label[data-tip] { cursor: help; text-decoration: underline dotted; text-underline-offset: 2px; text-decoration-color: var(--line); }
.hbar-track { background: #eef0f2; border-radius: 5px; height: 18px; overflow: hidden; position: relative; }
.hbar-fill { height: 100%; border-radius: 5px; min-width: 2px; }
.hbar-val { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.hbar-extra { color: var(--muted); font-weight: 400; font-size: 11px; }
/* опорная линия (порог / среднее по всем) поперёк столбца */
.hbar-ref { position: absolute; top: -1px; bottom: -1px; border-left: 2px dashed #6b6a66; }
/* Разделитель между верхом и низом рейтинга внутри одной карточки */
.hbar-split { text-align: center; font-size: 11px; color: var(--muted); letter-spacing: 2px;
  border-top: 1px dashed var(--line); padding-top: 7px; margin-top: 2px; }
.hbar-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--line); }
.hbar-link:hover { color: var(--accent); }
/* 100%-стек */
.sbar-row { display: grid; grid-template-columns: minmax(80px, 32%) 1fr; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 9px; }
.sbar-track { display: flex; height: 20px; border-radius: 5px; overflow: hidden; background: #eef0f2; }
.sbar-seg { height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 600; }
/* стек с абсолютной шкалой: столбцы сравнимы между строками, поэтому фон трека
   не заливается целиком и сегменты не растягиваются на всю ширину */
.sbar-abs { background: #f5f6f7; }

/* группированная столбчатая: несколько тонких столбцов на одну подпись */
.gbars { display: flex; flex-direction: column; gap: 12px; }
.gbar-row { display: grid; grid-template-columns: minmax(80px, 32%) 1fr; align-items: center; gap: 10px; font-size: 13px; }
.gbar-bars { display: flex; flex-direction: column; gap: 3px; }
.gbar-line { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.gbar-line .hbar-track { height: 11px; }
.gbar-na { color: var(--muted); }

/* матрица полос: обе величины разложены на диапазоны, в клетке — сами объекты
   (замена точечной диаграмме, где точки безымянные) */
.bmx-grid { display: grid; gap: 6px; align-items: stretch; }
.bmx-corner { font-size: 10px; color: var(--muted); line-height: 1.35; align-self: end; padding-bottom: 4px; }
.bmx-colhd { font-size: 12px; font-weight: 600; color: #52514e; text-align: center; align-self: end; padding-bottom: 4px; }
.bmx-rowhd {
  font-size: 12px; font-weight: 600; color: #52514e; border-radius: 8px;
  padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.bmx-n { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.bmx-cell { border-radius: 8px; padding: 8px 10px; border: 1px solid transparent; min-height: 52px; }
.bmx-cell ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.bmx-cell li {
  background: rgba(255,255,255,.8); border: 1px solid rgba(0,0,0,.06); border-radius: 6px;
  padding: 2px 8px; font-size: 12px; color: #2f2e2c; cursor: help;
}
.bmx-cell li.bmx-none { border: none; background: none; color: #c3c2b7; cursor: default; }
.bmx-pos { background: #eaf6ec; border-color: #bfe3c6; }
.bmx-mid { background: #fdf6e3; border-color: #ecdca6; }
.bmx-neg { background: #fdeceb; border-color: #f3c9c5; }

/* матрица мини-гистограмм (замена тепловой карты) */
.mx-wrap { overflow-x: auto; }
.mx-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.mx-table th { font-weight: 600; color: #52514e; text-align: left; padding: 4px 6px; vertical-align: bottom; }
.mx-table thead th span { display: inline-block; max-width: 92px; line-height: 1.2; font-size: 11px; color: var(--muted); }
/* Столбец с названиями строк ужимаем по содержимому (width:1% + nowrap), иначе
   при table-layout:auto он забирает половину карточки под пустоту. */
.mx-row-lb, .mx-corner { width: 1%; white-space: nowrap; }
.mx-row-lb { position: sticky; left: 0; background: var(--card-bg); z-index: 1; }
.mx-cell { padding: 2px 4px; border-top: 1px solid #f1f1ef; min-width: 74px; }
.mx-cell a { display: block; text-decoration: none; color: var(--ink); }
.mx-bar { display: block; height: 8px; border-radius: 3px; background: #2a78d6; opacity: .8; min-width: 2px; }
.mx-cell a:hover .mx-bar { opacity: 1; }
.mx-val { display: block; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mx-empty { color: #c3c2b7; text-align: center; }

/* донат + легенда */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-svg { width: 132px; height: 132px; flex: none; }
.donut-center { fill: #1c1e21; font-size: 20px; font-weight: 700; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.donut-legend li[data-tip] { cursor: help; }
.lg-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.lg-ico { font-size: 13px; }
.lg-lb { color: var(--ink); }
.lg-val { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- Оверлей загрузки (при задержке перехода > 3с) --- */
.load-overlay {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center;
  background: rgba(20,22,26,.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.load-overlay.is-on { display: flex; animation: load-fade .2s ease; }
@keyframes load-fade { from { opacity: 0; } to { opacity: 1; } }
.load-card {
  background: #fff; border-radius: 14px; padding: 26px 30px;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
  display: flex; flex-direction: column; align-items: center; gap: 16px; min-width: 240px;
}
.load-spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid #e6e8eb; border-top-color: var(--accent);
  animation: load-spin .8s linear infinite;
}
@keyframes load-spin { to { transform: rotate(360deg); } }
.load-bar { width: 200px; height: 6px; border-radius: 6px; background: #e9ecef; overflow: hidden; }
.load-bar-fill { height: 100%; width: 40%; border-radius: 6px; background: var(--accent); animation: load-slide 1.1s ease-in-out infinite; }
@keyframes load-slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.load-text { font-size: 14px; color: #52514e; font-weight: 600; }

/* --- Матрица привлекательности 2×2 --- */
.quad { display: grid; grid-template-columns: 30px 1fr; gap: 6px; }
.quad-main { display: flex; flex-direction: column; gap: 6px; }
.quad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quad-cell { border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line); background: #fafbfc; min-height: 96px; }
.quad-lead { background: #eaf6ec; border-color: #bfe3c6; }
.quad-opp  { background: #eaf1fb; border-color: #c3d8f5; }
.quad-vol  { background: #fdf6e3; border-color: #ecdca6; }
.quad-out  { background: #f2f2f0; border-color: #dcdcd8; }
.quad-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.quad-title { font-weight: 700; font-size: 14px; color: var(--ink); }
.quad-n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.quad-hint { font-size: 11px; color: var(--muted); margin: 2px 0 8px; line-height: 1.35; }
.quad-cats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.quad-cats li { background: rgba(255,255,255,.75); border: 1px solid rgba(0,0,0,.06); border-radius: 6px; padding: 2px 8px; font-size: 12px; color: #2f2e2c; cursor: help; }
.quad-cats li.quad-empty { border: none; background: none; color: var(--muted); cursor: default; }
.quad-yaxis { display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 4px 0; font-size: 11px; color: var(--muted); }
.quad-yaxis .quad-ax-name { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 600; color: #52514e; white-space: nowrap; }
.quad-xaxis { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 0 4px; }
.quad-xaxis .quad-ax-name { font-weight: 600; color: #52514e; }

/* --- Тултип --- */
.wb-tip {
  position: fixed; z-index: 60; max-width: 300px;
  background: #1c1e21; color: #fff; padding: 9px 11px; border-radius: 8px;
  font-size: 12px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,.28);
  pointer-events: none;
}
/* Непрозрачные зебра/ховер — нужны, чтобы залипающая колонка не просвечивала */
.wb-table tbody tr { background: #ffffff; }
.wb-table tbody tr:nth-child(even) { background: #f6f7f8; }
.wb-table tbody tr:hover { background: #eaf1fb; }
/* Залипающая первая колонка со сплошным фоном (совпадает с фоном строки) */
.wb-table th:first-child, .wb-table td:first-child { position: sticky; left: 0; }
/* Название ниши на Ozon — полный путь дерева на 60 символов: закреплённая
   колонка съедала треть экрана, и показатели правее не помещались. Держим её
   узкой и обрезаем в ОДНУ строку: перенос по словам раздувал строки до пяти
   этажей и таблица переставала читаться. Полное имя — в подсказке ячейки. */
.wb-table tbody td:first-child, .wb-table tbody td:nth-child(2) {
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wb-table thead th:first-child .th-label,
.wb-table thead th:nth-child(2) .th-label { max-width: 150px; }
.wb-table tbody td:first-child { z-index: 1; background: #ffffff; }
.wb-table tbody tr:nth-child(even) td:first-child { background: #f6f7f8; }
.wb-table tbody tr:hover td:first-child { background: #eaf1fb; }

/* Строки «на особых условиях» (ниша вне основного охвата медиаплана):
   приглушаем текст, чтобы они отличались от основного списка, но читались.
   Курсив нужен рядом с закреплёнными колонками: там своя заливка, и одного
   цвета мало, чтобы отличие было заметно. */
.wb-table tbody tr.row-dim td { color: #9aa3ad; font-style: italic; }
.wb-table tbody tr.row-dim:hover td { color: #4b5563; }
/* Плановая выручка ниже исторической: план замещает текущую рекламу, и там,
   где объём урезан сильнее, чем реклама приносит сейчас, ниша теряет оборот.
   Цвет важнее приглушения, поэтому правило идёт после .row-dim. */
.wb-table tbody tr.row-warn td { color: #c0392b; }
.wb-table tbody tr.row-dim.row-warn td { color: #d98a80; }
.wb-table tbody tr.row-warn:hover td { color: #a02b1c; }

/* Вторая колонка-разрез («Подкатегория») тоже закрепляется: у широких таблиц
   строка уезжает на два экрана вправо, и одной «Категории» мало, чтобы понять,
   чья это строка. Смещение (left) проставляет wb.js — ширина первой колонки
   зависит от содержимого и меняется при смене раздела и ширины окна. */
.wb-table.sticky-2 th:nth-child(2), .wb-table.sticky-2 td:nth-child(2) {
  position: sticky;
}
.wb-table.sticky-2 tbody td:nth-child(2) { z-index: 1; background: #ffffff; }
.wb-table.sticky-2 tbody tr:nth-child(even) td:nth-child(2) { background: #f6f7f8; }
.wb-table.sticky-2 tbody tr:hover td:nth-child(2) { background: #eaf1fb; }
.wb-table.sticky-2 thead th:nth-child(2) { z-index: 3; }
/* Третья закреплённая колонка («Стратегия»): смещение проставляет wb.js. */
.wb-table.sticky-3 th:nth-child(3), .wb-table.sticky-3 td:nth-child(3) {
  position: sticky;
}
.wb-table.sticky-3 tbody td:nth-child(3) { z-index: 1; background: #ffffff; }
.wb-table.sticky-3 tbody tr:nth-child(even) td:nth-child(3) { background: #f6f7f8; }
.wb-table.sticky-3 tbody tr:hover td:nth-child(3) { background: #eaf1fb; }
.wb-table.sticky-3 thead th:nth-child(3) { z-index: 3; }
/* Граница закреплённой области: без неё непонятно, где кончается «шапка строки»
   и начинаются уехавшие показатели. У трёх колонок её несёт третья. */
.wb-table.sticky-2:not(.sticky-3) th:nth-child(2),
.wb-table.sticky-2:not(.sticky-3) td:nth-child(2) {
  border-right: 1px solid var(--line);
}
.wb-table.sticky-3 th:nth-child(3), .wb-table.sticky-3 td:nth-child(3) {
  border-right: 1px solid var(--line);
}
.wb-table:not(.sticky-2) th:first-child, .wb-table:not(.sticky-2) td:first-child {
  border-right: 1px solid var(--line);
}
.align-r { text-align: right; }
.align-l { text-align: left; }
.wb-empty { text-align: center; color: var(--muted); padding: 22px; }

/* Иконка выбранной стратегии в левой колонке «Индексов» */
.lead-ico::before { content: attr(data-ico); margin-right: 7px; font-size: 13px; }
.lead-ico { cursor: help; }

/* Цветные оценки индексов (неяркие) */
.eval { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.eval[data-tip] { cursor: help; }
.eval-pos { background: #e7f4e9; color: #2e7d32; }
.eval-neg { background: #fdecea; color: #c0392b; }
.eval-mid { background: #fdf6e3; color: #9a7d0a; }
.eval-na  { background: #f1f1ef; color: #6b7280; }
.wb-rows-extra.is-collapsed { display: none; }

.wb-below { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.wb-caption { color: var(--muted); font-size: 13px; }
.wb-caption a { color: var(--accent); }
.wb-count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.wb-more, .wb-all {
  border: 1px solid var(--line); background: var(--card-bg); border-radius: 8px;
  padding: 7px 12px; font-size: 13px; cursor: pointer; color: var(--ink);
}
.wb-more:hover, .wb-all:hover { border-color: var(--accent); color: var(--accent); }
.wb-dl { margin-left: auto; color: var(--accent); font-weight: 600; text-decoration: none; font-size: 13px; }
.wb-dl:hover { text-decoration: underline; }
/* Вторая ссылка выгрузки (в медиаплане — готовая книга): авто-отступ уже
   отработал на первой, второй нужен обычный интервал, иначе они слипаются. */
.wb-dl + .wb-dl { margin-left: 18px; }
.pop-desc {
  font-size: 12px; color: var(--muted); line-height: 1.4;
  margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}

/* ---------- Пустой блок «Выводы» ---------- */
.wb-note {
  border: 1px dashed var(--line); border-radius: 12px; padding: 18px 20px;
  color: var(--muted); background: color-mix(in srgb, var(--bg) 50%, transparent);
}
/* Авто-выводы: акцентный callout */
.wb-summary {
  border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 14px 20px;
  background: color-mix(in srgb, var(--accent) 5%, #fff);
}
.wb-summary-line { margin: 6px 0; font-size: 15px; line-height: 1.5; color: var(--ink); }
.wb-summary-line:first-child { margin-top: 0; }
.wb-summary-line:last-child { margin-bottom: 0; }
/* Уточнение под выводом (перечисление ниш): тот же абзац по смыслу, но тише —
   это подробность, а не сам вывод. */
.wb-summary-note { margin: 2px 0 6px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.wb-summary-note:last-child { margin-bottom: 0; }
/* Название графика, к которому относится вывод: выводы идут по графикам, и без
   подписи пришлось бы сопоставлять их с картинками сверху по памяти. */
.wb-summary-topic { color: var(--accent); }

/* ---------- Заглушка «Скоро» ---------- */
.soon-wrap { display: grid; place-items: center; padding: 40px 0; }
.soon-card { max-width: 460px; text-align: center; padding: 32px; }
.soon-card h1 { font-size: 22px; margin: 8px 0; }
.soon-card p { color: var(--muted); margin: 0 0 18px; }

/* ---------- Настройки таблицы («шестерёнка» в панели фильтров) ---------- */
.wb-gear { position: relative; }
.wb-gear > summary {
  list-style: none; cursor: pointer; user-select: none;
  width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card-bg); color: var(--muted); font-size: 15px; line-height: 1;
}
.wb-gear > summary::-webkit-details-marker { display: none; }
.wb-gear > summary::after { content: "\2699"; }
.wb-gear > summary:hover { border-color: var(--accent); color: var(--accent); }
.wb-gear[open] > summary { border-color: var(--accent); color: var(--accent); }
/* Настроек расчёта полтора десятка. Раскладываем их сеткой в три колонки —
   панель получается почти квадратной и целиком помещается на экране; в один
   столбец она вытягивалась на три экрана вниз. Пара «настройка + подсказка»
   лежит в общем блоке, иначе сетка растаскивает их по разным колонкам. */
.wb-gear-body {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0;
  padding: 14px; background: var(--card-bg);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  display: grid; grid-template-columns: repeat(3, 214px);
  gap: 10px 16px; align-content: start;
  max-height: min(80vh, 640px); overflow-y: auto; overscroll-behavior: contain;
}
@media (max-width: 1100px) { .wb-gear-body { grid-template-columns: repeat(2, 214px); } }
@media (max-width: 720px) { .wb-gear-body { grid-template-columns: 1fr; } }
.wb-gear-item { min-width: 0; }
.wb-gear-body label {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px;
  font-size: 12px; color: var(--muted);
}
.wb-gear-body select { font-size: 13px; padding: 5px 8px; }
/* Подсказка свёрнута до двух строк и раскрывается по наведению: полный текст
   под каждым селектором снова растянул бы панель. */
.wb-gear-hint {
  margin: 3px 0 0; font-size: 11px; line-height: 1.3; color: var(--muted);
  max-height: 2.6em; overflow: hidden;
}
.wb-gear-item:hover .wb-gear-hint { max-height: none; color: var(--ink); }

/* ---------- Группы столбцов в шапке (реклама, СРМ/СРС/СРО) ---------- */
/* Три «топ-N» одного показателя сливаются в общий заголовок с иконкой: и место
   по ширине экономится, и аббревиатура расшифрована один раз на группу.
   Обе строки шапки липкие, поэтому у нижней смещение = высота верхней (30px). */
.wb-table.has-grp thead tr.hdr-top th { top: 0; }
.wb-table.has-grp thead tr.hdr-sub th { top: 30px; }
.wb-table thead th.grp-th {
  height: 30px; padding: 5px 12px; cursor: default; text-align: center;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
.wb-table thead th.grp-th:hover { background: #eef0f2; color: var(--muted); }
.wb-table.has-grp thead tr.hdr-sub th { font-weight: 500; }
/* Эмодзи на сером фоне шапки сливаются, поэтому иконка сидит в цветном бейдже:
   цвет и есть основная мнемоника (показы / клики / заказы / реклама). */
.col-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 16px; margin-right: 6px; vertical-align: -3px;
  border-radius: 5px; font-size: 10px; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .08);
}
.ico-ads { background: #ffd9c2; }   /* реклама в выдаче — оранжевый */
.ico-cpm { background: #cfe4ff; }   /* СРМ, показы — синий */
.ico-cpc { background: #c8f2d6; }   /* СРС, клики — зелёный */
.ico-cpo { background: #ffe6a8; }   /* СРО, заказы — янтарный */
/* Логистика: группы столбцов ABC */
.ico-abc   { background: #e4e0f5; }  /* наполненность матрицы — сиреневый */
.ico-loc   { background: #c8f2d6; }  /* локализация — зелёный */
.ico-ads2  { background: #cfe4ff; }  /* продажи в день — синий */
.ico-stock { background: #ffe6a8; }  /* остатки — янтарный */
.ico-turn  { background: #ffd9c2; }  /* оборачиваемость — оранжевый */
/* SEO: имя признака — ссылка на разбивку по карточкам */
.seo-drill { color: inherit; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.seo-drill:hover { color: var(--accent); text-decoration-color: var(--accent); }
.seo-values { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }

.ico-us   { background: #c8f2d6; }  /* SEO: наши карточки — зелёный */
.ico-them { background: #e4e2dd; }  /* SEO: конкуренты — нейтральный серый */

/* Сноска под блоком «Выводы» (оговорки к расчёту) */
.wb-footnote { margin: 12px 0 0; font-size: 13px; font-style: italic; color: var(--muted); }

/* ---------- Справочник по показателям ---------- */
/* Значок «?» в шапке столбца и на плитке KPI: ведёт к строке справочника внизу
   страницы. Тултип отвечает «что это», справочник — ещё и «сколько это хорошо».
   Видим ВСЕГДА, а не по наведению: пока значок появлялся только под курсором,
   его наличие выглядело случайным — «у одних показателей есть, у других нет». */
.th-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 5px; vertical-align: 1px;
  border-radius: 50%; font-size: 10px; font-weight: 700; line-height: 1;
  text-decoration: none; color: var(--muted); background: #e0e3e7;
  opacity: .6; transition: opacity .12s, background .12s, color .12s;
}
.wb-table thead th:hover .th-help,
.wb-table thead th:focus-within .th-help { opacity: 1; }
.th-help:hover { color: #fff; background: var(--accent); opacity: 1; }
/* Подпись столбца и значок — один блок с переносом: у ячейки шапки
   `white-space: nowrap`, поэтому без обёртки значок вылезал за узкий столбец
   и попадал визуально в соседний. Ограничение ширины переезжает на обёртку. */
.wb-table thead th .th-head {
  display: inline-block; max-width: 150px; white-space: normal; line-height: 1.25;
}
.wb-table thead th .th-head .th-label { display: inline; max-width: none; }
/* На плитках KPI значок крупнее: там он один на карточку и ему есть место. */
.mp-kpi-label .th-help { opacity: .75; }
.mp-kpi-card:hover .mp-kpi-label .th-help { opacity: 1; }

.gloss {
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  overflow: hidden;
}
.gloss-summary {
  cursor: pointer; padding: 12px 16px; list-style: none;
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.gloss-summary::-webkit-details-marker { display: none; }
.gloss-summary::before {
  content: "▸"; color: var(--muted); font-size: 12px; transition: transform .15s;
}
.gloss[open] .gloss-summary::before { transform: rotate(90deg); }
.gloss-summary:hover { background: color-mix(in srgb, var(--accent) 5%, #fff); }
.gloss-title { font-size: 17px; font-weight: 600; }
.gloss-hint { font-size: 13px; color: var(--muted); }
.gloss-body { padding: 4px 16px 18px; border-top: 1px solid var(--line); }
.gloss-sub { font-size: 15px; margin: 26px 0 4px; }
.gloss-note { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.gloss-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.gloss-table th, .gloss-table td {
  border: 1px solid var(--line); padding: 8px 10px; vertical-align: top;
  text-align: left;
}
.gloss-table thead th {
  background: #f2f4f6; font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); font-weight: 600;
  position: sticky; top: 0; z-index: 1;
}
.gloss-table tbody th { font-weight: 600; width: 19%; background: #fbfbfc; }
/* Формула — моноширинным: дроби и множители в ней должны читаться как формула,
   а не как продолжение текста соседней колонки. */
.gloss-table td.gloss-f {
  width: 19%; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px; color: #374151; background: #fcfcfd;
}
.gloss-table td:nth-child(3) { width: 29%; }
/* Легенда исходных величин над таблицей */
.gloss-legend {
  columns: 2; column-gap: 28px; margin: 0 0 12px; padding-left: 18px;
  font-size: 13px; color: var(--muted);
}
.gloss-legend li { margin-bottom: 3px; break-inside: avoid; }
.gloss-legend .gloss-sym { margin-left: 0; margin-right: 4px; }
/* Подсветка строки, на которую только что перешли по «?» — иначе в таблице на
   полсотни строк непонятно, куда именно тебя привели. */
.gloss-table tbody tr:target,
.gloss-table tbody tr.is-target { background: color-mix(in srgb, var(--accent) 12%, #fff); }
.gloss-table tbody tr:target th,
.gloss-table tbody tr.is-target th { background: color-mix(in srgb, var(--accent) 16%, #fff); }
.gloss-grp {
  display: block; font-size: 11px; font-weight: 500; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em;
}
.gloss-sym {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
  font-size: 11px; font-weight: 700; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
/* `.wb-dl` под таблицей прижата вправо (`margin-left:auto`) — здесь ссылок две,
   и авто-отступ развёл бы их по разным краям блока. */
.gloss-dl { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; }
.gloss-dl .wb-dl { margin-left: 0; }
