/* Оболочка сервиса. Токены и облик — 1:1 с эталоном вида
   prototypes/ct2-ui-v2/styles.css (§0 SPEC_prototype_screen_inventory).
   Сборка новая: здесь только то, что нужно каркасу, плюс адаптив —
   в эталоне его не было, а сервис обязан читаться с телефона. */

:root {
  --navy-950: #061a2f;
  --navy-900: #09233e;
  --navy-800: #103654;
  --blue-600: #1467e8;
  --blue-700: #0f56c6;
  --blue-50: #edf5ff;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #172033;
  --muted: #667085;
  --muted-2: #98a2b3;
  --border: #dfe4eb;
  --border-strong: #c9d1dc;
  --green: #16865c;
  --green-bg: #eaf8f1;
  --red: #cc3a3a;
  --red-bg: #fff0f0;
  --orange: #b95f12;
  --orange-bg: #fff4e8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --sidebar-w: 224px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font: 13px/1.45 Inter, "Segoe UI", Arial, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- каркас: боковая навигация + рабочая область ---------- */

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.sidebar {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  color: #d8e3ef;
  background: var(--navy-950);
  border-right: 1px solid #142f49;
}
.brand {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue-600);
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.brand strong { display: block; color: #fff; letter-spacing: .08em; font-size: 15px; }
.brand span { color: #7f97ae; font-size: 10px; }

.workspace { padding: 14px 12px 10px; }
.workspace > span, .nav-separator span {
  display: block;
  margin: 0 7px 6px;
  color: #6f879e;
  letter-spacing: .08em;
  font-size: 9px;
  font-weight: 700;
}
.workspace .tenant-card {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: #d9e5f0;
  text-align: left;
  background: var(--navy-900);
  border: 1px solid #1e3b56;
  border-radius: 7px;
}
.workspace .tenant-card b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-dot { width: 8px; height: 8px; background: #28a978; border-radius: 50%; }
.market-dot.off { background: #7c8ea1; }

#nav { min-height: 0; overflow-y: auto; padding: 2px 9px 10px; }
.nav-item {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  margin: 2px 0;
  padding: 0 10px 0 6px;
  color: #aebfd0;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .055); }
.nav-item.active { color: #fff; background: var(--blue-600); }
.nav-item i { font-style: normal; text-align: center; font-weight: 700; }
.nav-item b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.nav-item em {
  min-width: 19px;
  padding: 1px 5px;
  color: #a9bfd3;
  text-align: center;
  background: #153653;
  border-radius: 10px;
  font-size: 10px;
  font-style: normal;
}
.nav-item.active em { color: #fff; background: rgba(4, 37, 83, .35); }
.nav-separator { padding-top: 15px; }

.sidebar-foot { margin-top: auto; padding: 10px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sync-state { display: flex; align-items: center; gap: 8px; padding: 5px 8px 10px; color: #7890a6; font-size: 10px; }
.sync-state i { width: 7px; height: 7px; background: #36b37e; border-radius: 50%; flex: none; }
.sync-state i.stale { background: #e99a3a; }
.sync-state i.off { background: #7c8ea1; }
.sync-state b { color: #a9bbcc; font-weight: 500; }

.workspace-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar {
  min-height: 68px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.crumbs { margin-bottom: 2px; color: var(--muted-2); font-size: 10px; }
.crumbs span { padding: 0 4px; }
.crumbs b { color: var(--muted); font-weight: 500; }
.topbar h1 { margin: 0; font-size: 19px; line-height: 1.2; letter-spacing: -.02em; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.data-age { color: var(--muted); font-size: 11px; }
.data-age b { color: var(--text); font-weight: 600; }

.icon-button, .primary-button, .secondary-button { height: 34px; border-radius: 6px; }
.icon-button {
  width: 34px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
}
.primary-button {
  padding: 0 13px;
  color: #fff;
  background: var(--blue-600);
  border: 1px solid var(--blue-600);
  font-weight: 650;
}
.primary-button:hover { background: var(--blue-700); }
.secondary-button {
  padding: 0 11px;
  color: #344054;
  background: var(--surface);
  border: 1px solid var(--border-strong);
}
.secondary-button:hover { background: #f4f6f8; }
.danger-button { color: var(--red); border-color: #eab6b6; }
.danger-button:hover { background: var(--red-bg); }

/* Кнопка открытия навигации — видна только на узком экране. */
.nav-toggle { display: none; }
.scrim { display: none; }

#content { min-height: 0; overflow: auto; padding: 18px 22px 28px; outline: none; }
.page { max-width: 1560px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.page-head h2 { margin: 0 0 3px; font-size: 16px; }
.page-head p { margin: 0; color: var(--muted); font-size: 11px; }

/* ---------- панели, таблицы, значки ---------- */

.panel, .data-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.data-panel { overflow: hidden; }
.panel-head {
  min-height: 46px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.panel-head h3 { margin: 0; font-size: 12px; }
.panel-head span { color: var(--muted); font-size: 10px; }
.panel-body { padding: 13px 14px; }
.panel + .panel, .data-panel + .data-panel, .panel + .data-panel, .data-panel + .panel { margin-top: 12px; }

/* Широкая таблица прокручивается внутри своей рамки: страница по
   горизонтали не едет ни на каком экране. */
.table-scroll { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11px; }
th {
  height: 34px;
  padding: 7px 10px;
  color: #536174;
  text-align: left;
  white-space: nowrap;
  background: #f3f6f9;
  border-bottom: 1px solid var(--border-strong);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .025em;
  text-transform: uppercase;
}
td { height: 35px; padding: 7px 10px; white-space: nowrap; background: #fff; border-bottom: 1px solid #e6eaf0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f7faff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.primary { color: #194a83; font-weight: 650; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 10px; font-size: 9px; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.green { color: var(--green); background: var(--green-bg); }
.badge.red { color: var(--red); background: var(--red-bg); }
.badge.orange { color: var(--orange); background: var(--orange-bg); }
.badge.gray { color: #667085; background: #eef1f4; }

.empty-callout { padding: 35px 20px; color: var(--muted); text-align: center; }
.state-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 11px 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 8px;
  font-size: 13px;
}
.state-note.error { border-left-color: var(--red); background: var(--red-bg); }
.state-note.ok { border-left-color: var(--green); background: var(--green-bg); }
.state-note.empty { color: var(--muted); border-left-color: var(--border-strong); background: var(--surface-2); }

/* ---------- формы (экран «Кабинеты») ---------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field span { color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select {
  min-width: 0;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: 0;
  font-size: 12px;
}
.field input:focus, .field select:focus { border-color: var(--blue-600); }
.field small { color: var(--muted-2); font-size: 10px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.cabinet-card + .cabinet-card { margin-top: 12px; }
.cabinet-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cabinet-head b { font-size: 13px; }
.cabinet-head .grow { flex: 1 1 auto; min-width: 0; }

/* ---------- экран «Цены»: сбор и фильтры ---------- */

/* Поля тянутся и переносятся: на 375px они встают в столбец, страница
   по горизонтали не едет — едет только сама таблица внутри рамки. */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.filters .field { flex: 1 1 150px; }
.counter { padding-bottom: 9px; color: var(--muted); white-space: nowrap; font-size: 11px; }
.inline-field { flex: 1 1 150px; }
.panel-head .inline-field span { margin-bottom: 1px; }

/* ---------- экран «Себестоимость»: загрузка файлом, правка, история ---------- */

/* Поле выбора файла живёт по правилам остальных полей формы, только выше:
   имя файла в одну строку высотой 36px не помещается. */
.field input[type="file"] { height: auto; padding: 7px 8px; font-size: 11px; }

/* Кнопки строки таблицы не растягивают колонку и не рвутся по буквам. */
.row-actions { display: flex; gap: 6px; }
.row-actions .secondary-button { height: 28px; padding: 0 9px; font-size: 10px; }

/* Список причин отказа: заголовок сверху, причины столбиком — так он читается
   и на 375px, где строка «строка 4, колонка …» в одну линию не влезает. */
.problems-note { flex-direction: column; align-items: flex-start; gap: 4px; }
.problems { margin: 0; padding-left: 18px; font-size: 12px; }
.problems li { margin-top: 3px; }

/* ---------- экран «Юнитка»: лист владельца как есть ---------- */

/* Переключатель WB / Ozon (эталон §14). Выбор запоминается браузером. */
.switcher { display: inline-flex; padding: 2px; background: #eef1f5; border: 1px solid var(--border); border-radius: 8px; }
.switch-button { height: 28px; padding: 0 14px; color: var(--muted); background: transparent; border: 0; border-radius: 6px; font-size: 11px; font-weight: 650; }
.switch-button.active { color: var(--text); background: #fff; box-shadow: var(--shadow); }

/* Полоса причин неполноты: почему в витрине есть пустые места. */
/* Причин бывает много (у каждой колонки своя). Полоса не растёт на весь
   экран: выше трёх строк она прокручивается, и таблица остаётся видна. */
.unit-notes { display: flex; flex-wrap: wrap; gap: 6px; max-height: 86px; overflow-y: auto; margin-bottom: 10px; }
.unit-notes:empty { display: none; }
.unit-notes .badge { max-width: 100%; white-space: normal; text-align: left; }

/* Ширины колонок задаются на <col>, поэтому раскладка фиксированная: ручной
   размер обязан держаться, а не пересчитываться по содержимому. Ширина
   таблицы — по сумме колонок: лист едет по горизонтали внутри своей рамки. */
.unit-table { table-layout: fixed; width: max-content; min-width: 100%; }
.unit-table th, .unit-table td { position: relative; overflow: hidden; text-overflow: ellipsis; }
.unit-table th.unit-group { height: auto; padding-bottom: 3px; color: var(--muted-2); white-space: normal; border-bottom: 0; }
.unit-table thead tr:last-child th { height: auto; padding-top: 3px; white-space: normal; vertical-align: bottom; }

/* Первая колонка закреплена: на 375px строка не теряется при перемотке. */
.unit-table th:first-child, .unit-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left;
  box-shadow: 1px 0 0 var(--border);
}
/* Фон у закреплённой ячейки задан обеим — и шапке, и строке. Опираться на
   общий стиль таблицы здесь нельзя: сквозь прозрачную закреплённую ячейку
   при горизонтальной перемотке едет остальная таблица. */
.unit-table thead th:first-child { z-index: 3; background: #f3f6f9; }
.unit-table td:first-child { background: #fff; }
.unit-table tbody tr:hover td:first-child { background: #f7faff; }

/* Число и пропуск нажимаются: по клику приходит след. Кнопка выглядит как
   обычная ячейка — лист от этого не меняется. */
.cell-trace { max-width: 100%; padding: 0; color: inherit; background: none; border: 0; font: inherit; text-align: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-trace:hover, .cell-trace:focus-visible { color: var(--blue-700); text-decoration: underline; }
.cell-trace.missing { color: var(--muted-2); font-style: italic; }

/* Ручки размера: правый край заголовка — ширина, нижний край первой ячейки —
   высота. Как в Sheets; двойной клик возвращает размер по умолчанию. */
.col-grip { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; touch-action: none; }
.col-grip:hover { background: var(--blue-600); }
.row-grip { position: absolute; left: 0; bottom: 0; width: 100%; height: 5px; cursor: row-resize; touch-action: none; }
.row-grip:hover { background: var(--blue-600); }

/* Карточка следа: формула словами, подстановка, период, источник. */
.trace-card { margin-bottom: 12px; }
.trace-body { display: flex; flex-direction: column; gap: 4px; }
.trace-value { font-size: 18px; font-weight: 700; }
.trace-value.missing { color: var(--muted); font-size: 14px; font-style: italic; }
.trace-line { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* ---------- экран входа ---------- */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: min(380px, 100%); padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.gate-card h1 { margin: 0 0 4px; font-size: 18px; }
.gate-card p { margin: 0 0 16px; color: var(--muted); font-size: 12px; }

/* ---------- экран «Юнитка (лист)» (только просмотр) ---------- */

/* Перенос panel/renderer/styles.css «Юнитка — зеркало листа 1в1 (U2)» и unit_hdr (:441-499) на
   токены сайта: полотно шире окна в своей рамке, шапка и первая колонка закреплены, текст
   переносится как в Sheets. Светофор идёт после подложки и перекрывает её порядком правил. */
.unit-mirror-age { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.unit-mirror-age.stale { color: var(--orange); font-weight: 600; }
.unit-mirror .unit-reasons { margin-bottom: 6px; color: var(--orange); font-size: 11px; }
.unit-mirror-scroll { max-width: 100%; max-height: calc(100vh - 220px); overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
table.unit-mirror { table-layout: fixed; width: max-content; min-width: 100%; border-collapse: collapse; font-size: 12px; }
table.unit-mirror th, table.unit-mirror td { height: auto; padding: 3px 8px; overflow: hidden; white-space: normal;
  overflow-wrap: anywhere; vertical-align: top; border-bottom: 1px solid var(--border); }
table.unit-mirror thead { position: sticky; top: 0; z-index: 3; }
/* Общий th сайта — заглавные буквы и разрядка; у зеркала шапка как в листе (панель: text-transform none). */
table.unit-mirror th { color: var(--muted); font-size: 11px; font-weight: 500; font-style: italic; text-align: left;
  letter-spacing: normal; text-transform: none; background: var(--surface-2); }
table.unit-mirror .art { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
table.unit-mirror th.art { z-index: 4; background: var(--surface-2); }
table.unit-mirror td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* unit_hdr_04: ключевые колонки на подложке, их заголовки жирнее, вспомогательные приглушены. */
table.unit-mirror td.um-key { background: var(--blue-50); }
table.unit-mirror th.um-key-h { font-weight: 600; }
table.unit-mirror td.um-aux { color: var(--muted-2); }

/* Легенда порогов маржинальности — теми же цветами, что светофор. */
.um-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 6px; color: var(--muted); font-size: 11px; }
.um-legend-chip { padding: 1px 7px; color: var(--text); border-radius: 4px; }
.um-legend-note.um-legend-red { color: var(--red); }

/* Светофор (logic.js unitCellMark): фон, «нет остатка» — красный текст. */
.um-legend-chip.um-good, table.unit-mirror td.um-good { background: rgba(22, 134, 92, .18); }
.um-legend-chip.um-ok, table.unit-mirror td.um-ok { background: rgba(22, 134, 92, .09); }
.um-legend-chip.um-warn, table.unit-mirror td.um-warn { background: rgba(185, 95, 18, .14); }
.um-legend-chip.um-bad, table.unit-mirror td.um-bad { background: rgba(204, 58, 58, .16); }
table.unit-mirror td.um-out { color: var(--red); }

/* Телефон (375px): страница вбок не едет — таблица листается в своей рамке ниже по высоте. */
@media (max-width: 600px) {
  .unit-mirror-scroll { max-height: 70vh; }
  .um-legend { gap: 4px 8px; font-size: 10px; }
}

/* Черновик расчёта строки (unit_mirror_trace.js): нижняя карточка на всю ширину, строка — слагаемое. */
table.unit-mirror tbody td { cursor: pointer; }
.umt-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .35); }
.umt-card { position: fixed; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow-y: auto; box-sizing: border-box;
  padding: 12px 16px 20px; background: var(--surface); border-radius: 12px 12px 0 0; font-size: 14px; line-height: 1.45;
  overflow-wrap: anywhere; box-shadow: 0 -4px 20px rgba(0, 0, 0, .2); }
.umt-head { display: flex; align-items: flex-start; gap: 8px; }
.umt-title { flex: 1; }
.umt-close { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.umt-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.umt-tab { padding: 3px 8px; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; }
.umt-tab.active { background: var(--blue-50); font-weight: 600; }
.umt-plates { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin-bottom: 8px; }
.umt-plate span:first-child { color: var(--muted); }
.umt-flag { flex-basis: 100%; padding: 4px 8px; border-radius: 6px; }
.umt-flag.umt-ok { background: rgba(22, 134, 92, .14); color: var(--green); }
.umt-flag.umt-diff { background: rgba(204, 58, 58, .12); color: var(--red); }
.umt-flag.umt-gray { background: var(--surface-2); color: var(--muted); }
.umt-num { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.umt-missing { color: var(--orange); }
.umt-root, .umt-line { margin: 4px 0; }
.umt-children { padding-left: 12px; border-left: 2px solid var(--border); }
.umt-step > summary, .umt-leaf { padding: 3px 0; cursor: pointer; }
.umt-source, .umt-origin, .umt-foot, .umt-note { color: var(--muted); }
.umt-changed { color: var(--red); }
.umt-foot { margin-top: 10px; }
.umt-toast { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50; padding: 10px 14px; border-radius: 8px;
  background: var(--surface-2); box-shadow: 0 2px 10px rgba(0, 0, 0, .2); font-size: 14px; }

/* ---------- экран «P&L» ---------- */

/* Свежесть снимка словами: возраст, период, перенос листа, оговорка среза.
   Устаревший снимок подсвечивается цветом, а не прячется. */
.pnl-age { margin: 0; color: var(--muted); font-size: 11px; }
.pnl-age.stale { color: var(--orange); font-weight: 600; }
.pnl-age .pnl-carried { color: var(--orange); }
.pnl-age .pnl-note { color: var(--muted-2); }

/* Ряд управления: площадки и «доли от выручки» переносятся, а не расширяют
   страницу — правило 375px общее с остальными экранами. */
.pnl-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Кнопки площадок и «доли от выручки» — .pnl-tab панели (styles.css:646-648):
   рамка, активная — заливкой. */
.pnl-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.pnl-controls .pnl-tab { height: auto; padding: 2px 10px; color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: 4px; box-shadow: none; font-size: 12px; font-weight: 400; cursor: pointer; }
.pnl-controls .pnl-tab.active { color: var(--blue-700); background: var(--blue-50); border-color: var(--blue-600); }

/* Блок-кабинет: заголовок нажимается и сворачивает таблицу; как в панели
   (styles.css:655-660) — каретка слева, название крупно по центру полосой,
   счётчик недель справа тусклым. */
.pnl-block-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: #eef1f5; cursor: pointer; user-select: none; }
.pnl-block-head .caret { width: 10px; color: var(--muted-2); font-size: 12px; font-style: normal; }
.pnl-block-head .cab-name { flex: 1; min-width: 0; text-align: center; font-size: 19px;
  font-weight: 700; color: #23324a; letter-spacing: .01em; overflow-wrap: anywhere; }
.pnl-block-head .grp-counts { color: var(--muted); font-size: 11px; white-space: nowrap; }
.pnl-src { margin: 8px 0 0; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.pnl-src .dim { margin-left: 8px; color: var(--muted-2); }

/* Таблица «Статья × неделя»: ширина по содержимому, едет внутри общего
   scroll-кадра (.table-scroll) — страница по горизонтали не едет. */
.pnl-table { width: max-content; min-width: 100%; }

/* Первая колонка закреплена и непрозрачна — как у «Юнитки»: при перемотке
   строка читается по статье. Фон задан явным цветом: сквозь прозрачную
   закреплённую ячейку при перемотке едет остальная таблица. */
.pnl-table th.art, .pnl-table td.art { position: sticky; left: 0; text-align: left;
  max-width: 300px; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--border); }

/* Заголовки колонок — курсивом, тусклые, 11px, как в панели. */
.pnl-table th { color: var(--muted); font-size: 11px; font-style: italic; font-weight: 600;
  letter-spacing: .02em; text-transform: none; }
.pnl-table thead th.art { z-index: 3; background: #f3f6f9; }
.pnl-table tbody td.art { background: #fff; }

/* Уровни и смысл строк — как в листе: группы и KPI полужирны с лёгкой
   заливкой, статьи внутри группы — с отступом, проценты — курсивом. */
.pnl-table tr.main td { font-weight: 700; background: #eef2f9; }
.pnl-table tr.main td.art { font-size: 12px; }
.pnl-table tr.k-kpi td.art { color: #194a83; }
/* Ключевые показатели — жирные с заливкой; налог — жёлтой (tr.kpi / tr.kpi.tax). */
.pnl-table tr.kpi td { font-weight: 700; background: #e8ebf0; }
.pnl-table tr.kpi.tax td { background: #f7f0d4; }
.pnl-table tr.kpi.pct td { font-style: italic; }
.pnl-table td.neg { color: #b3261e; }
.pnl-table tr.sub td.art { padding-left: 26px; }
.pnl-table tr.pct td { font-style: italic; }
.pnl-table tr.sp td { height: 6px; border: 0; background: #fff; }

/* Непрозрачные варианты закреплённой ячейки для групповых строк. */
.pnl-table tbody tr.main td.art { background: #e6edf8; }
.pnl-table tbody tr.kpi td.art { background: #e8ebf0; }
.pnl-table tbody tr.kpi.tax td.art { background: #f7f0d4; }

/* Подсветка динамики недели и «Δ нед.» — готовые классы с сервера;
   у групповых строк заливка плотнее, как в листе. */
.pnl-table td.hl-good { background: rgba(70, 170, 110, .20); }
.pnl-table td.hl-bad { background: rgba(210, 90, 90, .18); }
.pnl-table tr.main td.hl-good { background: rgba(70, 170, 110, .28); }
.pnl-table tr.main td.hl-bad { background: rgba(210, 90, 90, .26); }
.pnl-table tr.kpi td.hl-good { background: rgba(70, 170, 110, .28); }
.pnl-table tr.kpi td.hl-bad { background: rgba(210, 90, 90, .26); }
.pnl-table td.delta { text-align: right; white-space: nowrap; font-size: 11px; }
.pnl-table td.delta-good { color: var(--green); font-weight: 650; }
.pnl-table td.delta-bad { color: var(--red); font-weight: 650; }

/* Строка под курсором — слабая подсветка поверх любой заливки строки
   (панель: rgba(120,150,200,.09)); закреплённая ячейка остаётся непрозрачной. */
.pnl-table tbody tr:hover > td { background-image: linear-gradient(rgba(120, 150, 200, .09), rgba(120, 150, 200, .09)); }

/* Доля от выручки под числом; отмеченная флагом — с рамкой и цветом. */
.pnl-table td .cs-share { font-size: 10px; color: var(--muted-2); line-height: 1.1; margin-top: 1px; }
.pnl-table td.cs-flag { box-shadow: inset 0 0 0 1px rgba(214, 190, 90, .8); }
.pnl-table td.cs-flag .cs-share { color: var(--orange); font-weight: 700; }

/* ---------- экран «Продажи» ---------- */

/* Перенос 1:1 из панели CT v1 (panel/renderer/styles.css:646-1024 и правил
   таблицы «Продаж» ниже по файлу), значения светлой темы (body.light) —
   сайт светлый. Кегль ячеек — как у остальных таблиц сайта. */
.sales-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.sales-age-box { margin-left: auto; }
.sales-age { margin: 0; color: var(--muted); font-size: 11px; }
.sales-age.stale { color: var(--orange); font-weight: 600; }
.sales-src { margin: 8px 0 0; color: var(--muted-2); font-size: 11px; }

/* Одна прокрутка на весь кабинет: колонки блоков едут вместе. */
.sales-scroll { max-width: 100%; max-height: calc(100vh - 190px); overflow: auto; overscroll-behavior: contain; }
.sales-canvas { width: max-content; min-width: 100%; }

/* шапка SKU — единственное цветное пятно в блоке, она же навигация */
.sku { margin-bottom: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.sku-head { background: rgba(240, 145, 40, .20); border-radius: 7px 7px 0 0; cursor: pointer; user-select: none; }
.sku-head.total { background: rgba(76, 141, 255, .20); }
.sku-head .sku-head-in { position: sticky; left: 0; display: inline-flex; align-items: center; gap: 9px; max-width: 100vw; padding: 5px 12px; }
.sku-head .caret { width: 10px; color: var(--muted); font-weight: 700; }
.sku-head .sku-id { color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sku-head .sku-name { color: var(--text); font-size: 15px; font-weight: 700; }
.sku-head .grp-counts { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* Сетка одна на все SKU: ширины колонок жёсткие (table-layout: fixed
   работает только при заданной ширине — её даёт --cols из salesTable). */
.sales-table {
  --art: 224px;
  width: calc(var(--art) + var(--cols, 0) * 86px + 70vw);
  table-layout: fixed;
  user-select: none;
}
.sales-table th, .sales-table td {
  height: auto; padding: 2px 8px; line-height: 1.35;
  border-right: 1px solid #d9dde3; border-bottom: 1px solid #d9dde3;
}
.sales-table thead th {
  position: sticky; top: 0; z-index: 3; padding: 4px 8px;
  color: var(--muted); font-size: 11.5px; font-weight: 600;
  background: var(--surface); text-transform: none;
}
.sales-table thead th.num { width: 86px; min-width: 86px; color: var(--text); font-size: 12px; font-weight: 700; }
.sales-table th.art, .sales-table td.art {
  position: sticky; left: 0; z-index: 2; width: var(--art); min-width: var(--art); max-width: var(--art);
  overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap;
  background: var(--surface); border-right: 1px solid var(--border); cursor: pointer;
}
.sales-table thead th.art { z-index: 4; }
.sales-table th.tail, .sales-table td.tail { width: 70vw; padding: 0; background: transparent; border: 0; }

/* все строки на нейтральном полотне; иерархия — начертанием и цветом текста */
.sales-table tbody tr > td { background: transparent; font-weight: 400; }
.sales-table tbody tr > td.art { background: var(--surface); }
.sales-table tr.plan > td { color: var(--muted); }
.sales-table tr.plan > td.art { font-style: italic; }
.sales-table tr.dow > td { color: var(--muted); font-size: 11px; }
.sales-table tr.key > td, .sales-table tr.key > td.art { font-weight: 700; }
.sales-table tr.pct > td { font-style: italic; }

/* заголовок кампании: жирный, с воздухом сверху; клик сворачивает метрики */
.sales-table tr.ad-head { cursor: pointer; }
.sales-table tr.ad-head > td, .sales-table tr.ad-head > td.art { padding-top: 14px; font-weight: 700; }
.sales-table tr.ad-head:hover > td.art { color: var(--blue-600); }
.sales-table tr.ad-head .ad-caret { display: inline-block; width: 14px; color: var(--muted); font-weight: 700; }
.sales-table tr.ad-head.no-kids { cursor: default; }
.sales-table tr.ad-head.no-kids:hover > td.art { color: var(--text); }

/* метрики кампании: отступ + приглушённый цвет */
.sales-table tr.ad-sub > td { color: var(--muted); font-style: normal; }
.sales-table tr.ad-sub > td.art { padding-left: 30px; }
.sales-table tr.ad-sub.key > td { color: var(--text); font-weight: 700; }

/* тонкая линия и воздух — только там, где блок меняется по смыслу */
.sales-table tr.group-start > td { padding-top: 12px; border-top: 1px solid var(--border-strong); }

/* единственный цветной сигнал — цвет цифры: лучше/хуже соседнего дня */
.sales-table td.hl-good { background: none; color: #0b8a43; font-weight: 600; }
.sales-table td.hl-bad { background: none; color: #d0342c; font-weight: 600; }

/* перекрестье: строка под курсором и колонка дня */
.sales-table tbody tr:hover > td, .sales-table td.col-hl { background: rgba(20, 45, 90, .07); }
.sales-table tbody tr:hover > td.col-hl { background: rgba(20, 45, 90, .11); }
.sales-table tbody tr:hover > td.art {
  color: var(--text); font-weight: 700; background: #a2bce9; box-shadow: inset 3px 0 0 var(--blue-600);
}
.sales-table thead th.col-hl { color: var(--text); background: #c9d8f3; }

/* закреплённая строка: клик по названию */
.sales-table tbody tr.locked > td { background: rgba(240, 190, 70, .13); }
.sales-table tbody tr.locked > td.art { font-weight: 700; background: #f9edcf; box-shadow: inset 3px 0 0 #e8b23d; }

@media (max-width: 560px) {
  .sales-age-box { margin-left: 0; }
  .sales-table { --art: 140px; }
  .sku-head .sku-name { font-size: 13px; }
}

/* ---------- экран «Остатки» ---------- */

/* Перенос 1:1 из panel/renderer/styles.css:426-560 (mart-*, mart-stocks, wh-*,
   cp). Токены панели → токены сайта: --dim → --muted, --fg → --text,
   --line → --border, --blue → --blue-600, --gray → --muted-2; белые
   полупрозрачные подложки тёмной темы — тёмными на светлой. */
.mart-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.mart-totals { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; }
.mart-totals .low { color: var(--orange); }
.mart-age { margin-left: auto; color: var(--muted); font-size: 11px; }
.mart-age.stale { color: var(--orange); }
.mart-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.mart-controls input[type="search"] { flex: 1; min-width: 120px; padding: 3px 6px;
  background: var(--surface); color: inherit; border: 1px solid var(--border); border-radius: 4px; }
.mart-controls select { background: var(--surface); color: inherit;
  border: 1px solid var(--border); border-radius: 4px; padding: 3px; }
.mart-controls #mart-wh { max-width: 260px; }
.mart-check { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.mart-count { color: var(--muted); white-space: nowrap; }

/* Таблица: размеры панели поверх общих правил сайта (заглавные 9px, 35px). */
table.mart { width: 100%; border-collapse: collapse; font-size: 12px; }
table.mart th { height: auto; padding: 3px 4px; color: var(--muted); font-size: 12px; font-weight: 500;
  letter-spacing: normal; text-transform: none; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); }
table.mart td { height: auto; padding: 3px 4px; background: none; border-bottom: 1px solid rgba(16, 24, 40, .06); }
table.mart th.num, table.mart td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.mart td.plat { color: var(--muted); font-size: 11px; }
table.mart td.art, table.mart td.sku { white-space: nowrap; }
table.mart td.sku { color: var(--muted); font-variant-numeric: tabular-nums; }
table.mart td.name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.mart td.wh { color: var(--muted); font-size: 11px; max-width: 380px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.mart .dim { color: var(--muted); }

/* «Заканчивается» — жёлтый фон строки; наведение и открытая строка — поверх. */
table.mart tr.low td { background: rgba(224, 160, 48, .10); }
table.mart.mart-stocks tr.clickable { cursor: pointer; }
table.mart.mart-stocks tr.clickable:hover > td { background: rgba(16, 24, 40, .05); }
table.mart.mart-stocks tr.open > td { background: rgba(76, 141, 255, .10); }
table.mart.mart-stocks td.pick { color: var(--text); font-weight: 600; }

.wh-chip { display: inline-block; margin-right: 5px; padding: 0 5px; border-radius: 4px;
  background: rgba(16, 24, 40, .06); color: var(--muted); white-space: nowrap; }
.wh-chip b { color: var(--text); font-weight: 500; }
.wh-more { color: var(--muted); font-style: italic; }

/* Карточка раскрытой строки: распределение товара по складам полосами. */
table.mart tr.wh-detail > td { padding: 6px 4px 10px; white-space: normal; }
.wh-card { background: rgba(16, 24, 40, .03); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px 10px; }
.wh-card-head { color: var(--text); margin-bottom: 6px; font-size: 12px; }
.wh-row { display: flex; align-items: center; gap: 8px; height: 20px; }
.wh-name { width: 190px; color: var(--muted); font-size: 11px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.wh-bar { flex: 1; min-width: 40px; height: 10px; background: rgba(16, 24, 40, .05);
  border-radius: 3px; overflow: hidden; }
.wh-bar i { display: block; height: 100%; background: var(--blue-600); opacity: .85; border-radius: 3px; }
.wh-row.wh-tail .wh-name { font-style: italic; }
.wh-row.wh-tail .wh-bar i { background: var(--muted-2); opacity: .5; }
.wh-qty { width: 62px; text-align: right; font-variant-numeric: tabular-nums; }
.wh-pct { width: 46px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Метка «копировать»: бледная, при наведении на строку заметнее, после
   клика на секунду — галочка. */
.cp { display: inline-block; margin-left: 5px; font-style: normal; cursor: pointer;
  color: var(--muted); opacity: .35; font-size: 11px; transition: opacity .12s, color .12s; }
tr:hover .cp { opacity: .8; }
.cp:hover { opacity: 1; color: var(--blue-600); }
/* 0,9 с галочки — длительность анимации: её конец снимает класс done. */
.cp.done { opacity: 1; color: var(--green); animation: cp-done .9s; }
.cp.done::after { content: ' ✓'; }
@keyframes cp-done { from, to { opacity: 1; } }
.mart-src { margin-top: 8px; font-size: 11px; color: var(--muted); }

/* 375px: управление в столбик, чипы итогов и свежесть — переносом. */
@media (max-width: 560px) {
  .mart-head { flex-wrap: wrap; }
  .mart-age { margin-left: 0; }
  .mart-controls { flex-direction: column; align-items: stretch; }
  .mart-controls input[type="search"] { min-width: 0; }
  .mart-controls #mart-wh { max-width: none; }
  .wh-name { width: 110px; }
}
/* ---------- экран «Заказы» ---------- */

/* Свежесть снимка словами: возраст, период, «сегодня» витрины и её оговорка.
   Устаревший снимок подсвечивается цветом, а не прячется. */
.orders-age { margin: 0; color: var(--muted); font-size: 11px; }
.orders-age.stale { color: var(--orange); font-weight: 600; }
.orders-age .orders-note { color: var(--muted-2); }

/* Площадка: имя и под ним три блока витрины подряд. */
.orders-platform + .orders-platform { margin-top: 18px; }
.orders-name { margin: 0 0 8px; font-size: 13px; }

/* Блок витрины: строка заголовка над таблицей. Таблица едет внутри общего
   scroll-кадра (.table-scroll), страница по горизонтали не едет. */
.orders-block + .orders-block { margin-top: 10px; }
.orders-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.orders-head b { font-size: 12px; }
.orders-head .orders-hint { color: var(--muted); font-size: 10px; white-space: nowrap; }

/* Заголовок «Динамики» нажимается и сворачивает таблицу. */
.orders-head.toggle { cursor: pointer; user-select: none; }
.orders-head.toggle .caret { width: 12px; color: var(--muted-2); font-style: normal; }

/* ---------- экран «Инциденты» ---------- */

/* Свежесть снимка часового словами; устаревший — цветом, а не прячется. */
.incidents-age { margin: 0; color: var(--muted); font-size: 11px; }
.incidents-age.stale { color: var(--orange); font-weight: 600; }

/* Сводка часового: «цвет число» подряд, в порядке ответа. */
.incidents-summary { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; font-size: 12px; }
.incidents-count { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Открытый инцидент выделен полосой и фоном; наведение идёт следом. */
.incidents-row.open td:first-child { box-shadow: inset 2px 0 0 var(--red); }
.incidents-row.open td { background: var(--red-bg); }
.incidents-row:hover td, .incidents-row.open:hover td { background: #f7faff; }
.incidents-when { white-space: nowrap; }
.incidents-since { display: block; color: var(--muted); font-size: 10px; }

/* Блок «Объекты»: заголовок нажимается и сворачивает таблицу. */
.incidents-block { margin-top: 14px; }
.incidents-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; cursor: pointer; user-select: none; }
.incidents-head b { font-size: 12px; }
.incidents-head .caret { width: 12px; color: var(--muted-2); font-style: normal; }
.incidents-head .incidents-hint { color: var(--muted); font-size: 10px; }

/* ---------- экран «Пульт» ---------- */

/* Переключатели выручка/заказы и период стоят рядом и переносятся. */
.pult-switches { display: flex; flex-wrap: wrap; gap: 8px; }

/* Свежесть витрины и каждого источника; устаревшее — цветом. */
.pult-fresh { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--muted); }
.pult-age { flex: 1 1 100%; margin: 0; }
.pult-age.stale, .pult-source.stale { color: var(--orange); font-weight: 600; }

/* Шесть плиток: на широком экране в ряд по три и больше, на телефоне по две. */
.pult-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pult-tile { min-width: 0; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.pult-tile.stale { border-color: var(--orange); }
.pult-tile-title { color: var(--muted); font-size: 11px; }
.pult-tile strong { display: block; margin: 4px 0 2px; font-size: 18px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pult-tile strong.pult-empty { color: var(--muted); font-size: 13px; font-weight: 600; }
.pult-delta { font-size: 11px; font-weight: 650; }
.pult-delta.up { color: var(--green); }
.pult-delta.down { color: var(--red); }
.pult-tile-sub { margin-top: 3px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.pult-tile-stale { margin-top: 3px; color: var(--orange); font-size: 10px; font-weight: 650; }

/* График: viewBox тянется на всю ширину, линии — без анимации. */
.pult-chart { margin-bottom: 14px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.pult-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.pult-lg.fact { color: var(--blue-600); font-weight: 650; }
.pult-lg.plan { color: var(--muted-2); }
.pult-lg.prev { color: var(--muted); }
.pult-lg.inc { color: var(--red); }
.pult-svg { display: block; width: 100%; height: auto; }
.pult-svg polyline { fill: none; stroke-width: 2; stroke-linejoin: round; }
.pult-l-fact { stroke: var(--blue-600); fill: var(--blue-600); }
.pult-l-plan { stroke: var(--muted-2); fill: var(--muted-2); stroke-dasharray: 5 4; }
.pult-l-prev { stroke: var(--muted); fill: var(--muted); stroke-dasharray: 1 4; stroke-linecap: round; }
.pult-inc { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 3 3; }
.pult-ax { fill: var(--muted); font-size: 10px; }

/* Четыре блока: две колонки на широком экране, одна на телефоне. */
.pult-blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pult-block { min-width: 0; }
.pult-block-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.pult-block-head b { font-size: 12px; }
.pult-block-head span { color: var(--muted); font-size: 10px; }
.pult-rows { padding: 4px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.pult-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 12px; border-bottom: 1px solid var(--border); }
.pult-row:last-child { border-bottom: 0; }
.pult-row b { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.state-note.pult-warn { margin-top: 12px; border-left-color: var(--orange); background: var(--orange-bg); }

/* Телефон (375px): плитки по две, блоки в одну колонку, ничего не шире экрана. */
@media (max-width: 480px) {
  .pult-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pult-blocks { grid-template-columns: minmax(0, 1fr); }
  .pult-tile strong { font-size: 15px; }
}

/* ---------- экран «Карта» ---------- */

/* Шапка источника; устаревший реестр — цветом, а не прячется. */
.map-age { margin: 0; color: var(--muted); font-size: 11px; }
.map-age.stale { color: var(--orange); font-weight: 600; }
.map-switch { display: flex; gap: 6px; }
.map-on { border-color: var(--blue-600); color: var(--blue-700); background: var(--blue-50); }
.map-errors { margin: 6px 0 0; color: var(--red); font-size: 11px; }

/* Потоки: переносятся строками, длинное имя не распирает страницу. */
.map-flows { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.map-flow { max-width: 100%; white-space: normal; text-align: left; }

/* Дорожки: на широком экране пять колонок, ниже 1024px — секции подряд. */
.map-lanes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-items: start; }
.map-lane { min-width: 0; }
.map-lane h3 { margin: 0 0 6px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.map-node, .map-fold { margin-bottom: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.map-node.map-hot { border-color: var(--orange); background: var(--orange-bg); }
.map-node-head, .map-fold-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 12px;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.map-node-body, .map-fold-body { padding: 0 9px 8px; font-size: 11px; }
.map-node-body b { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.map-line { overflow-wrap: anywhere; }
.map-sub { padding-left: 16px; color: var(--muted); }
.map-fold .map-fold { margin: 4px 0; }
.map-fold-head .caret { width: 12px; color: var(--muted-2); }
.map-hint { margin-left: auto; color: var(--muted); font-size: 10px; }

@media (max-width: 1023px) {
  .map-lanes { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- экран «СПП» (только просмотр) ---------- */
.mart-v1 { margin-right: 8px; padding: 1px 5px; border: 1px solid var(--muted); border-radius: 3px;
  color: var(--muted); font-size: 10px; cursor: help; }
.mart .spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 18px; margin: 0;
  min-width: 60px; }
.mart .spark i { width: 4px; background: var(--blue-600); border-radius: 1px 1px 0 0; min-height: 2px;
  opacity: .75; }
.mart tr.low .spark i { background: var(--orange); opacity: .9; }
.mart .up { color: var(--green); }
.mart .down { color: var(--red); }
.mart td.dim { color: var(--muted); }
.mart-prices tr.clickable { cursor: pointer; }
.mart-prices tr.open > td { background: rgba(76,141,255,.07); }
.mart-days { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.mart-days .pr-days { background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.mart-days .pr-days.on { color: var(--text); border-color: var(--blue-600); }
.mart .spark i.gap { background: var(--border); height: 8%; }
.fc-row > td { padding: 0 12px 12px; }
.fullchart { background: rgba(0,0,0,.15); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; }
.fc-head { color: var(--text); margin-bottom: 8px; }
.fc-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.fc-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: 100%; min-width: 0; }
.fc-col b { font-size: 9px; font-weight: 500; color: var(--muted); margin-bottom: 2px; white-space: nowrap; }
.fc-col i { width: 100%; max-width: 22px; background: var(--blue-600); opacity: .8;
  border-radius: 2px 2px 0 0; min-height: 2px; }
.fc-col i.now { background: var(--orange); opacity: 1; }
.fc-col i.gap { background: var(--border); height: 3px; }
.fc-col span { font-size: 9px; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.mart .spark { padding: 2px 3px; border-radius: 4px; transition: background .12s; position: relative; }
.mart .spark:hover { background: rgba(255,255,255,.08); }
.mart .spark i { position: relative; transition: background .08s, opacity .08s; }
.mart .spark i::before { content: ''; position: absolute; left: -1px; right: -1px; top: -8px; bottom: -8px; }
.mart .spark i:hover { background: #eaf1ff; opacity: 1; }
.mart tr.low .spark i:hover { background: #fff6d6; opacity: 1; }
.mart .spark i:hover::after { content: attr(data-t); position: absolute; bottom: calc(100% + 7px);
  left: 50%; transform: translateX(-50%); background: #0f1723; color: #eaf1ff;
  border: 1px solid var(--blue-600); border-radius: 6px; padding: 3px 7px; font-size: 11px;
  line-height: 1.3; white-space: nowrap; z-index: 30; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.45); }
.mart .spark:hover { background: rgba(0,0,0,.05); }
.mart .spark i:hover { background: #16233a; }
.mart tr.low .spark i:hover { background: #6b4e00; }
.mart .spark i:hover::after { background: #ffffff; color: #1a2433; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.mart .spark.sparse { border-bottom: 1px dotted var(--orange); }
.mart-prices tr.open > td { background: rgba(76,141,255,.14); }
.mart-prices tr.open > td:first-child { box-shadow: inset 3px 0 0 var(--blue-600); }
.mart-prices tr.open > td { border-top: 1px solid var(--blue-600); }
.fc-head { display: flex; align-items: center; gap: 8px; }
.fc-close { margin-left: auto; background: transparent; border: 1px solid var(--border);
  color: var(--muted); border-radius: 6px; padding: 1px 7px; cursor: pointer; line-height: 1.4; }
.fc-close:hover { color: var(--text); border-color: var(--blue-600); }
.fc-col { position: relative; }
.fc-col:hover i { background: #eaf1ff; opacity: 1; }
.fc-col:hover i.now { background: #fff6d6; }
.fc-col:hover b, .fc-col:hover span { color: var(--text); }
.fc-col:hover::after { content: ''; position: absolute; inset: -2px -1px; background: rgba(76,141,255,.12);
  border-radius: 4px; pointer-events: none; }
.fc-col:hover i { background: #16233a; }
.mart .spark.plain i:hover::after { content: none; }
.fc-col.empty i.gap { background: none; border-bottom: 2px dotted var(--border); }
.fc-col.empty span { color: var(--muted); }

/* ---------- экран «A/B-тесты» (только просмотр) ---------- */

/* Свежесть витрины; устаревшая — цветом, а не прячется. */
.ab-age { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.ab-age.stale { color: var(--orange); font-weight: 600; }

/* Раскладка v1: список слева, карточка справа; на телефоне — друг над другом. */
.ab-layout { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 14px; align-items: start; }
.ab-list { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ab-row { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; color: var(--text); text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.ab-row.active { border-color: var(--blue-600); box-shadow: inset 2px 0 0 var(--blue-600); }
.ab-row span, .ab-row em { color: var(--muted); font-size: 11px; font-style: normal; overflow-wrap: anywhere; }

.ab-card { min-width: 0; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.ab-title { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.ab-title > div { flex: 1 1 220px; min-width: 0; }
.ab-title h2 { margin: 0 0 3px; font-size: 16px; overflow-wrap: anywhere; }
.ab-title small { color: var(--muted); font-size: 11px; }
.ab-status, .ab-readonly { padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.ab-status { color: var(--blue-700); background: var(--blue-50); }
.ab-readonly { color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); }

/* Вариант — строка: буква и файл, затем четыре метрики. */
.ab-variants { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ab-variant { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.ab-file { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.ab-file small { color: var(--muted); font-size: 10px; }
.ab-letter { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; color: #fff; background: var(--navy-800); border-radius: 6px; font-style: normal; font-weight: 700; }
.ab-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ab-metric { display: flex; flex-direction: column; min-width: 0; font-variant-numeric: tabular-nums; }
.ab-metric small { color: var(--muted); font-size: 10px; }

.ab-line { margin: 4px 0; font-size: 12px; overflow-wrap: anywhere; }
.ab-verdict { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; padding: 8px 10px; background: var(--surface-2); border-left: 3px solid var(--border-strong); border-radius: 6px; font-size: 12px; }
.ab-verdict.winner { background: var(--green-bg); border-left-color: var(--green); }
.ab-block { margin-top: 12px; }
.ab-block h3 { margin: 0 0 6px; font-size: 13px; }
.ab-svg { display: block; width: 100%; max-width: 480px; height: auto; }
.ab-bar { fill: var(--blue-600); }
.ab-ax { fill: var(--muted); font-size: 11px; }

/* Журнал окон: исключённое окно — фоном и причиной. */
.ab-window { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.ab-window em { color: var(--muted); font-style: normal; }
.ab-window.dirty { background: var(--orange-bg); }
.ab-check { font-size: 12px; }
.ab-check.ok { color: var(--green); }
.ab-check.pending { color: var(--orange); }
.ab-check.bad { color: var(--red); }
.ab-report { margin-top: 12px; font-size: 12px; }
.ab-report summary { font-weight: 650; cursor: pointer; }

/* Телефон: список над карточкой, вариант в строку, метрики 2×2. */
@media (max-width: 600px) {
  .ab-layout { grid-template-columns: minmax(0, 1fr); }
  .ab-variant { grid-template-columns: minmax(0, 1fr); }
  .ab-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- экран «Задачи» (только просмотр) ---------- */

/* Свежесть снимка; устаревший — цветом, числа видны. */
.tasks-age { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.tasks-age.stale { color: var(--orange); font-weight: 600; }
.tasks-muted { margin: 0; color: var(--muted); font-size: 12px; }

.tasks-plan { margin-bottom: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.tasks-plan h2 { margin: 0 0 6px; font-size: 13px; }
.tasks-plan ol { margin: 0; padding-left: 20px; font-size: 12px; overflow-wrap: anywhere; }

.tasks-new { margin-bottom: 10px; }
.tasks-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 8px 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.tasks-input { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 12px; color: var(--muted); }
.tasks-input input, .tasks-input select, .tasks-input textarea { min-width: 0; padding: 6px 8px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; }
.tasks-input textarea { min-height: 54px; resize: vertical; }
.tasks-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.tasks-actions .tasks-input { flex: 0 1 200px; }
.tasks-editor { flex-basis: 100%; }
.tasks-error { flex-basis: 100%; margin: 0; color: var(--red); font-size: 12px; }
.tasks-error:empty { display: none; }
.tasks-move { margin-left: 6px; padding: 0 6px; }
.tasks-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.tasks-switch { display: flex; flex-wrap: wrap; gap: 6px; }
.tasks-on { color: var(--blue-700); background: var(--blue-50); border-color: var(--blue-600); }

/* Карточка v1: полоса приоритета слева, просрочка красным, архив приглушён. */
.tasks-list { display: flex; flex-direction: column; gap: 8px; }
.tasks-card { position: relative; min-width: 0; padding: 12px 14px 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow-wrap: anywhere; }
.tasks-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--muted-2); border-radius: 10px 0 0 10px; }
.tasks-card.priority-P0::before { background: var(--red); }
.tasks-card.priority-P1::before { background: var(--orange); }
.tasks-card.priority-P2::before { background: var(--blue-600); }
.tasks-card.priority-P3::before { background: var(--green); }
.tasks-card.overdue { border-color: #eab6b6; }
.tasks-card.archived { opacity: .68; }
.tasks-card.focused { box-shadow: 0 0 0 2px var(--blue-600); }
.tasks-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tasks-card-head > div { min-width: 0; }
.tasks-card h3 { margin: 2px 0 0; font-size: 14px; }
.tasks-card time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.tasks-card time.late { color: var(--red); font-weight: 700; }
.tasks-kicker { color: var(--muted); font-size: 11px; }
.tasks-done-badge { color: var(--green); }
.tasks-goal, .tasks-field { margin: 6px 0 0; font-size: 12px; }
.tasks-more { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 12px; }
.tasks-more summary { color: var(--blue-700); cursor: pointer; }
.tasks-stages { margin: 4px 0; padding-left: 20px; }
.tasks-stages li.done { color: var(--green); }

/* Шкала v1: 14 дней + 6 недель; строка шире экрана — прокрутка в своей рамке, не страницы. */
.tasks-timeline { max-width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.tasks-tl-row { display: grid; grid-template-columns: 210px repeat(20, minmax(34px, 1fr)); width: max-content; min-width: 100%; min-height: 39px; border-top: 1px solid var(--border); cursor: pointer; }
.tasks-tl-header { min-height: 0; border-top: 0; cursor: default; }
.tasks-tl-label { padding: 6px 2px; color: var(--muted); font-size: 9px; text-align: center; }
.tasks-tl-label.week { background: var(--blue-50); }
.tasks-tl-group { position: sticky; left: 0; padding: 7px 9px; color: var(--muted); background: var(--surface-2); border-top: 1px solid var(--border); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.tasks-tl-name { position: sticky; left: 0; z-index: 1; display: grid; align-content: center; min-width: 0; padding: 4px 9px; background: var(--surface); }
.tasks-tl-name b { overflow: hidden; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.tasks-tl-name span { color: var(--muted); font-size: 9px; }
.tasks-tl-row.overdue .tasks-tl-name b { color: var(--red); }
.tasks-tl-cell { position: relative; border-left: 1px solid var(--border); }
.tasks-tl-cell.active::before { content: ''; position: absolute; top: 14px; right: 0; left: 0; height: 9px; background: var(--blue-600); opacity: .45; }
.tasks-tl-cell.due::after { content: ''; position: absolute; top: 13px; left: calc(50% - 5px); width: 10px; height: 10px; background: var(--blue-600); border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }
.tasks-tl-cell.priority-P0.active::before, .tasks-tl-cell.priority-P0.due::after { background: var(--red); }
.tasks-tl-cell.priority-P1.active::before, .tasks-tl-cell.priority-P1.due::after { background: var(--orange); }
.tasks-tl-cell.priority-P3.active::before, .tasks-tl-cell.priority-P3.due::after { background: var(--green); }
.tasks-tl-milestone { position: absolute; top: 9px; left: 50%; z-index: 1; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 3px; color: var(--surface); background: var(--text); border-radius: 5px; font-size: 10px; font-weight: 800; transform: translateX(-50%); }

/* Телефон: срок под заголовком, имя задачи на шкале уже. */
@media (max-width: 600px) {
  .tasks-card-head { flex-direction: column; gap: 4px; }
  .tasks-tl-row { grid-template-columns: 140px repeat(20, minmax(34px, 1fr)); }
}

/* ---------- экран «Поставки» (только просмотр) ---------- */
table.mart.cov-table th.num { text-align: right; }
table.mart.cov-table tr.clickable { cursor: pointer; }
table.mart.cov-table tr.open > td { background: rgba(76,141,255,.10); }
td.cov-ship { font-weight: 600; }
.cov-anomaly { margin-left: 4px; cursor: help; color: var(--orange); }
.cov-note { margin-left: 4px; cursor: help; color: var(--muted); font-size: 10px;
  white-space: nowrap; }
.cov-banner { margin: 0 0 6px; padding: 5px 8px; border-radius: 4px; font-size: 12px; }
.cov-banner.blocked { background: rgba(224,160,48,.12); color: var(--orange); }
.cov-banner.error { background: rgba(217,123,112,.12); color: var(--red); }
td.cov-none { text-align: center; padding: 14px; color: var(--muted); }
tr.cov-detail > td { padding: 6px 4px 10px; }
.cov-card { background: rgba(16, 24, 40, .03); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px 10px; }
table.cov-inner { width: 100%; font-size: 12px; }
table.cov-inner th { text-align: left; color: var(--muted); font-weight: 500;
  border-bottom: 1px solid var(--border); padding: 2px 6px; }
table.cov-inner td { padding: 2px 6px; border-bottom: 1px solid rgba(16, 24, 40, .06); }
table.cov-inner td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.cov-inner tr.cur td { background: rgba(76,141,255,.10); }
.cov-views { display: inline-flex; gap: 4px; }
.cov-window { align-items: center; }
.cov-window-cap { font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; margin-right: 2px; }
.cov-window .cov-win:disabled { opacity: .45; cursor: not-allowed; }
.cov-hint { margin: 0 0 6px; font-size: 12px; color: var(--muted); }

/* ---------- экран «День» (только просмотр) ---------- */
.day-layout { display: grid; gap: 10px; }
.day-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.day-head h1 { font-size: 21px; }
.day-auto-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-top: 5px; }
.day-auto-head h2 { margin: 2px 0 0; font-size: 18px; }
.day-plan { display: grid; gap: 8px; padding: 11px; border: 1px solid var(--border);
  border-radius: 12px; background: rgba(85,174,241,.045); transition: border-color .15s, background .15s; }
.day-plan.drag-over { border-color: var(--blue-600); background: rgba(85,174,241,.13); }
.day-plan-head { display: flex; align-items: baseline; gap: 9px; color: var(--muted); font-size: 11px; letter-spacing: .07em; }
.day-plan-head small { letter-spacing: 0; }
.day-plan-add { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 7px; }
.day-plan-add select { min-width: 0; padding: 7px 9px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; }
.day-plan-add button { padding: 7px 13px; border: 0; border-radius: 8px; color: white;
  background: var(--blue-600); font: inherit; font-weight: 650; cursor: pointer; }
.day-plan-add button:disabled, .day-plan-add select:disabled { opacity: .45; cursor: default; }
.day-plan-items { display: grid; gap: 7px; }
.day-plan-empty { padding: 18px; border: 1px dashed var(--border); border-radius: 9px;
  color: var(--muted); text-align: center; }
.day-head-btns { display: flex; gap: 6px; }
.day-head-btns .secondary, .day-actions .secondary { color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer; }
.day-head-btns .secondary:hover, .day-actions .secondary:hover { color: var(--text); border-color: var(--muted); }
.day-card { position: relative; display: grid; grid-template-columns: 34px 1fr auto; gap: 12px;
  padding: 14px 15px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); overflow: hidden; }
.day-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--muted-2); }
.day-card.priority-P0::before { background: var(--red); }
.day-card.priority-P1::before { background: var(--orange); }
.day-card.priority-P2::before { background: var(--blue-600); }
.day-card.priority-P3::before { background: var(--green); }
.day-card.overdue { border-color: rgba(255,84,73,.42); }
.day-card.manual { background: var(--surface); cursor: grab; }
.day-card[data-day-card]:not(.dragging) { cursor: pointer; }
.day-card.dragging { opacity: .42; }
.day-num { font-size: 21px; font-weight: 800; color: var(--muted); align-self: start; cursor: grab; }
.day-body { min-width: 0; }
.day-body h3 { font-size: 15px; }
.day-why { color: var(--orange); font-size: 12px; margin-top: 3px; }
.day-next { font-size: 13px; margin-top: 6px; }
.day-meta { display: flex; gap: 10px; color: var(--muted); font-size: 11px; margin-top: 6px; }
.day-actions { display: grid; gap: 6px; align-content: start; }
.day-actions .done-btn { border: 0; border-radius: 8px; padding: 6px 12px; background: var(--green);
  color: white; font: inherit; font-weight: 650; cursor: pointer; }
.day-spheres-head { display: flex; align-items: baseline; gap: 8px; margin-top: 6px;
  color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.sphere-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.sphere-block { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; text-align: left;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  color: var(--text); font: inherit; cursor: pointer; }
.sphere-block:hover { border-color: var(--muted); }
.sphere-block.current { border-color: var(--blue-600); }
.sphere-block.open { background: var(--surface); border-color: var(--blue-600); }
.sphere-name { font-weight: 700; }
.sphere-count { font-weight: 800; color: var(--blue-600); }
.sphere-block small { grid-column: 1 / -1; color: var(--muted); overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; }
.sphere-tasks { display: grid; gap: 6px; }
.sphere-task { padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface-2); }
.sphere-task:hover { border-color: var(--muted); }
.sphere-task.overdue b { color: var(--red); }
.sphere-task span { color: var(--muted); font-size: 11px; }
.sphere-task-row { display: grid; gap: 2px; cursor: pointer; }
.sphere-task-line { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; }
.day-sphere-add { padding: 5px 9px; border: 1px solid var(--border); border-radius: 7px;
  color: var(--muted); background: transparent; font: inherit; cursor: pointer; }
.day-sphere-add:hover { color: var(--text); border-color: var(--muted); }
.day-detail { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 4px; }
@media (max-width: 760px) {
  .day-card { grid-template-columns: 28px 1fr; }
  .day-actions { grid-column: 2; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .day-auto-head { align-items: start; flex-direction: column; }
}

/* ---------- матрица товар × дни: «Тренд СПП», «Позиции WB» ---------- */
.trend-wrap { overflow: auto; max-height: calc(100vh - 210px); }
table.trend { border-collapse: separate; border-spacing: 0; font-size: 11px; }
table.trend th, table.trend td { white-space: nowrap; padding: 3px 6px; }
table.trend thead th { position: sticky; top: 0; z-index: 3; background: var(--surface);
  border-bottom: 1px solid var(--border); }
table.trend .t-art { position: sticky; left: 0; z-index: 2; background: var(--surface);
  text-align: left; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
table.trend thead .t-art { z-index: 4; }
table.trend .t-spark { position: sticky; left: 160px; z-index: 2; background: var(--surface); }
table.trend thead .t-spark { z-index: 4; }
table.trend .t-date { color: var(--muted); font-weight: 500; }
table.trend .t-art .sku { display: block; color: var(--muted); font-size: 10px; }
table.trend .t-cell { text-align: right; color: var(--text); }
table.trend .t-cell.up { background: rgba(52,168,83,.18); }
table.trend .t-cell.down { background: rgba(255,84,73,.16); }
table.trend .t-cell.empty { background: transparent; }
table.trend tbody tr:hover .t-cell { background-color: rgba(16, 24, 40, .05); }
table.trend tbody tr:hover .t-art,
table.trend tbody tr:hover .t-spark { color: var(--text); }

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

/* Планшет: колонка навигации уже, отступы меньше. */
@media (max-width: 1100px) {
  :root { --sidebar-w: 198px; }
  #content { padding: 16px 16px 24px; }
  .topbar { padding: 10px 16px; }
}

/* Телефон (проверяется на 375px): навигация уезжает в выдвижную панель,
   рабочая область занимает всю ширину, ничего не выходит за экран. */
@media (max-width: 720px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 30;
    width: min(280px, 86vw);
    height: 100%;
    transform: translateX(-100%);
    transition: transform .18s ease-out;
  }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.nav-open .scrim {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: block;
    background: rgba(6, 26, 47, .45);
    border: 0;
  }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .topbar { min-height: 58px; padding: 10px 14px; }
  .topbar h1 { font-size: 17px; }
  #content { padding: 14px 14px 22px; }
  .page-head { align-items: flex-start; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .filters .field, .inline-field { flex: 1 1 100%; }
  .filters .primary-button, .panel-head .primary-button { flex: 1 1 auto; }
  .top-actions { width: 100%; }
  .top-actions .primary-button { flex: 1 1 auto; }
  /* P&L: блоки друг под другом, таблица едет в своей рамке, а закреплённая
     «Статья» не съедает экран. */
  .pnl-table th.art, .pnl-table td.art { max-width: 150px; }
  .pnl-block-head .cab-name { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
