/* MONÉ Professional TMS — журнал отгрузок.
   Идея оформления: вкладки как цветные копии накладной (жёлтая, розовая,
   зелёная, голубая), всё остальное — белые «листы» и синие «чернила».
   Каталоги помечены серым цветом (#665e5f).

   1.0 — три уровня поверхностей, чтобы таблицы не сливались с фоном:
   «стол» (фон программы, тёплый серый, заметно темнее) → белые листы и
   таблицы → окна поверх. Невыбранные вкладки окрашены бледным цветом своей
   копии, выбранная — белая, как лист под ней. Границы полей ввода и кнопок —
   не светлее 3:1 к белому (WCAG 1.4.11), текст на «столе» — не светлее 4.5:1.

   1.1 — внутри листа нет тёплого серого: шапка таблицы и строки-группы были
   того же тона, что «стол», и таблица будто «прорезалась» полосами фона.
   Теперь всё внутри листа — белое или холодно-голубоватое (в тон синим
   «чернилам»), а тёплый серый остаётся только снаружи. Листы обведены
   рамкой темнее, «стол» — на тон темнее.

   1.3 — см. комментарий у :root: тёмная полоса, холодный стол, тени, тёмная тема. */

:root {
  /* 1.3 — Ц1–Ц5: тёмная полоса «копирка» под шапкой и вкладками, холодный «стол» в одной
     температуре с листами, глубина тенью вместо тёмных рамок, один цвет — одно значение
     (цвет раздела — только на вкладке, в строках — цвет статуса). Все цвета — переменные:
     тёмная тема (В7) переопределяет их ниже. */
  color-scheme: light;
  --band: #1c2541;          /* полоса шапки и вкладок */
  --band-ink: #ffffff;
  --band-ink-soft: rgba(255, 255, 255, 0.74);
  --band-rule: rgba(255, 255, 255, 0.30);
  --band-fill: rgba(255, 255, 255, 0.12);
  --canvas: #cfd5de;        /* стол — фон программы */
  --canvas-ink: #3f4a57;    /* текст прямо на столе (подвал) — 6.1:1 */
  --paper: #f5f7fa;         /* светлая подложка внутри листа */
  --sheet: #ffffff;
  --sheet-edge: #b3bcc9;    /* рамка листа на столе */
  --sheet-head: #e9edf5;    /* шапка таблицы */
  --sheet-head-ink: #22324a;
  --sheet-head-rule: #a9b5ca;
  --sheet-head-active: #d3ddf0;
  --group: #f1f4f9;         /* строка-группа (перевозчик) в Сводке */
  --hover: #edf1f7;         /* наведение на строку — нейтральное */
  --selected: #e3e9fc;      /* отмеченная строка */
  --selected-rule: #c3cff5;
  --ink: #1d2733;
  --ink-soft: #56616c;
  --ink-faint: #a3acb3;
  --tab-ink: #1d2733;
  --rule: #cfd5de;          /* границы внутри листа */
  --rule-soft: #e4e8ee;     /* линии между строками */
  --rule-strong: #8f99a8;   /* поля ввода, кнопки — 3:1 к белому */
  --inverse: #1d2733;       /* тёмная плашка с белым текстом (подсказка, уведомление) */
  --inverse-ink: #ffffff;
  --carbon: #2b44a8;        /* главный акцент: главная кнопка, выбор */
  --carbon-hover: #22388f;
  --carbon-text: #2b44a8;   /* ссылки и акцентный текст */
  --carbon-ink: #ffffff;
  --carbon-wash: #eef1fb;
  --carbon-soft: #e3e9fc;   /* «сегодня» — светлая метка */
  --carbon-soft-ink: #22388f;
  --stamp: #b42318;         /* только проблемы */
  --stamp-text: #b42318;
  --stamp-wash: #fdeceb;
  --stamp-edge: #f0c4bf;
  --warn: #D9A400;
  --warn-wash: #FFF3BF;
  --warn-ink: #6B5200;
  --warn-edge: #E3C44A;
  --ok: #2e9b5f;
  --ok-wash: #e2f3e7;
  --ok-tint: #f4fbf6;
  --ok-ink: #1e5e3a;
  --ok-edge: #9fd3b3;
  --return: #c2367a;
  --return-ink: #8a1f52;
  --note-wash: #fff1d6;
  --note-ink: #7a4b00;
  --flash: #fff1a8;
  --row-done: #E8F5EC;       --row-done-hover: #D9EFE0;
  --row-problem: #FCE9E7;    --row-problem-hover: #F8D9D5;
  --row-cancelled: #F6D3CF;  --row-cancelled-hover: #F0C2BC;  --row-cancelled-ink: #6A2A23;
  --row-unpaid: #FFF3BF;     --row-unpaid-hover: #FFEB9C;

  --copy-canary: #f2d75c;
  --copy-pink: #eda2b2;
  --copy-green: #86c695;
  --copy-blue: #86b1e6;
  --copy-catalog: #7b8798;   /* серый для каталогов */
  /* бледные копии — фон невыбранных вкладок (на тёмной полосе — 9,5–11,9:1 к ней) */
  --tint-canary: #f8e48f;
  --tint-pink: #f3c0cc;
  --tint-green: #b9dfc3;
  --tint-blue: #bdd5f2;
  --tint-catalog: #dfe4ec;

  /* Э1: глубина — три уровня тени (лист, меню, окно) */
  --lift-1: 0 1px 2px rgba(24, 32, 43, 0.10), 0 6px 16px rgba(24, 32, 43, 0.08);
  --lift-2: 0 2px 6px rgba(24, 32, 43, 0.12), 0 12px 28px rgba(24, 32, 43, 0.18);
  --lift-3: 0 4px 12px rgba(24, 32, 43, 0.14), 0 24px 56px rgba(24, 32, 43, 0.24);
  --backdrop: rgba(20, 28, 48, 0.38);
  /* Э2: короткие переходы — отклик на действие */
  --ease: 140ms cubic-bezier(0.2, 0, 0, 1);

  --radius: 6px;
  --font: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --row-pad: 8px;            /* В7: «Компактные строки» — 5px */
}

/* В7: тёмная тема — по системе или выбранная вручную (меню «Ещё» → «Оформление»).
   data-theme ставит app.js: "dark" — тёмная (вручную или по системе), "light" — светлая. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --band: #18213b;
  --canvas: #0f131a;
  --canvas-ink: #9ba7b6;
  --paper: #1f2732;
  --sheet: #19202a;
  --sheet-edge: #2c3644;
  --sheet-head: #222b37;
  --sheet-head-ink: #cdd6e3;
  --sheet-head-rule: #3a4658;
  --sheet-head-active: #2c3a55;
  --group: #1e2631;
  --hover: #232d3a;
  --selected: #1f2d52;
  --selected-rule: #33467e;
  --ink: #e3e8ef;
  --ink-soft: #9ba7b6;
  --ink-faint: #6b7787;
  --tab-ink: #e3e8ef;
  --rule: #2e3846;
  --rule-soft: #252e3a;
  --rule-strong: #5a6678;
  --inverse: #e3e8ef;
  --inverse-ink: #11161d;
  --carbon: #4a68dc;
  --carbon-hover: #5a77e6;
  --carbon-text: #9db2ff;
  --carbon-wash: #1f2a45;
  --carbon-soft: #22305a;
  --carbon-soft-ink: #c3d0ff;
  --stamp: #c4372b;
  --stamp-text: #ff9c8f;
  --stamp-wash: #3a2022;
  --stamp-edge: #6e3530;
  --warn: #e0b23a;
  --warn-wash: #3a3115;
  --warn-ink: #f2d98a;
  --warn-edge: #7a6420;
  --ok: #3fb174;
  --ok-wash: #173326;
  --ok-tint: #152a20;
  --ok-ink: #9fdcb7;
  --ok-edge: #2f6b4a;
  --return: #d9579a;
  --return-ink: #f2a6cb;
  --note-wash: #3a2c14;
  --note-ink: #f0c787;
  --flash: #4a4215;
  --row-done: #16291f;       --row-done-hover: #1b3326;
  --row-problem: #301c1f;    --row-problem-hover: #3a2226;
  --row-cancelled: #3a1d1d;  --row-cancelled-hover: #452224;  --row-cancelled-ink: #f0b8b0;
  --row-unpaid: #332b12;     --row-unpaid-hover: #3d3416;
  --copy-catalog: #8793a6;
  --tint-canary: #5b5124;
  --tint-pink: #5a3540;
  --tint-green: #2f4a37;
  --tint-blue: #2d4260;
  --tint-catalog: #343e4d;
  --lift-1: 0 1px 2px rgba(0, 0, 0, 0.40), 0 6px 16px rgba(0, 0, 0, 0.28);
  --lift-2: 0 2px 6px rgba(0, 0, 0, 0.45), 0 12px 28px rgba(0, 0, 0, 0.45);
  --lift-3: 0 4px 12px rgba(0, 0, 0, 0.50), 0 24px 56px rgba(0, 0, 0, 0.55);
  --backdrop: rgba(4, 7, 14, 0.62);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--carbon); outline-offset: 2px; }

/* ---------- верхняя панель ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap;
  padding: 14px 24px 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { display: block; height: 40px; width: auto; }
.brand-app {
  font-weight: 600; font-size: 15px; color: var(--band-ink-soft);
  padding-left: 12px; border-left: 1px solid var(--sheet-edge);
  line-height: 24px;
}
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* переключатель Отгрузки / Каталоги */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--band-fill); border-radius: 8px;
}
.seg-btn {
  font: inherit; font-weight: 500; color: var(--band-ink-soft);
  min-height: 30px; padding: 0 14px; border: 0; border-radius: 6px;
  background: transparent; cursor: pointer;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"] {
  background: var(--sheet); color: var(--ink);
  box-shadow: 0 1px 2px rgba(29, 39, 51, 0.22);
}

/* ---------- кнопки ---------- */
.btn {
  font: inherit; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 0 14px;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--carbon); color: var(--carbon-ink); }
.btn-primary:hover { background: var(--carbon-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-quiet { background: var(--sheet); color: var(--ink); border-color: var(--rule-strong); }
.btn-quiet:hover { background: var(--paper); border-color: var(--ink-soft); }
.btn-danger { background: var(--stamp); color: #fff; }
.btn-danger-quiet { background: transparent; color: var(--stamp-text); padding: 0 6px; }
.btn-danger-quiet:hover { background: var(--stamp-wash); }
.btn-small { min-height: 30px; padding: 0 10px; }
.btn-link {
  background: none; border: 0; padding: 0 2px; min-height: 0;
  color: var(--carbon-text); font-weight: 500; text-decoration: underline;
  text-underline-offset: 2px; text-decoration-thickness: 1px;
}
.icon-btn {
  font: inherit; font-size: 22px; line-height: 1;
  width: 34px; height: 34px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--ink-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--paper); color: var(--ink); }

/* ---------- вкладки-копии ---------- */
.tabs {
  display: flex; gap: 4px; padding: 0 24px;
  overflow-x: auto; scrollbar-width: none;
}
.tab {
  --copy: var(--rule);
  --tint: var(--tint-catalog);
  position: relative;
  font: inherit; font-weight: 500; color: var(--tab-ink);
  display: flex; align-items: center; gap: 8px;
  padding: 11px 16px 9px;
  border: 1px solid var(--sheet-edge); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--tint); cursor: pointer; white-space: nowrap;
}
.tab::before {
  content: ""; position: absolute; left: -1px; right: -1px; top: -1px;
  height: 5px; border-radius: var(--radius) var(--radius) 0 0;
  background: var(--copy);
}
.tab:hover { color: var(--ink); background: var(--sheet); }
.tab[aria-selected="true"] {
  background: var(--sheet); color: var(--ink); font-weight: 600;
  margin-bottom: -1px; padding-bottom: 10px; z-index: 1;
}
.tab[aria-selected="true"]::before { height: 6px; }
.tab-count {
  font-size: 12px; font-weight: 500; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.copy-canary { --copy: var(--copy-canary); --tint: var(--tint-canary); }
.copy-pink   { --copy: var(--copy-pink); --tint: var(--tint-pink); }
.copy-green  { --copy: var(--copy-green); --tint: var(--tint-green); }
.copy-blue   { --copy: var(--copy-blue); --tint: var(--tint-blue); }
.copy-catalog { --copy: var(--copy-catalog); --tint: var(--tint-catalog); }

/* ---------- лист с таблицей ---------- */
.sheet {
  margin: 0 24px; background: var(--sheet);
  border: 1px solid var(--sheet-edge); border-radius: 0 var(--radius) var(--radius) var(--radius);
}
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--rule);
}
.search { flex: 1 1 260px; max-width: 420px; }
.search input {
  width: 100%; font: inherit; min-height: 34px; padding: 0 12px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet);
  color: var(--ink);
}
.search input:focus { background: var(--sheet); border-color: var(--carbon); outline: none; }
.count { color: var(--ink-soft); font-variant-numeric: tabular-nums; margin-right: auto; }

.table-wrap { overflow: auto; max-height: calc(100vh - 230px); }
.grid {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.grid th, .grid td {
  text-align: left; vertical-align: top;
  padding: 8px 12px; border-bottom: 1px solid var(--rule-soft);
}
.grid th {
  position: sticky; top: 0; z-index: 1;
  background: var(--sheet-head); border-bottom: 1px solid var(--sheet-head-rule);
  font-size: 12.5px; font-weight: 600; color: var(--sheet-head-ink);
  min-width: 110px; max-width: 220px;
}
.grid th.wide, .grid td.wide { min-width: 280px; max-width: 360px; }
.grid th.date, .grid td.date { min-width: 118px; }
.grid td.date { white-space: nowrap; }
.nw { white-space: nowrap; }
.grid th.num, .grid td.num { text-align: right; min-width: 90px; }
.grid th.num .sort-btn { text-align: right; }
.grid td.time { white-space: nowrap; }
.grid td.multiline { white-space: pre-line; }
.grid td.note { color: var(--ink-soft); }
.offcat {
  text-decoration: underline dashed var(--stamp);
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.maplink { color: var(--carbon-text); font-weight: 500; text-underline-offset: 2px; }
.sort-btn {
  font: inherit; color: inherit; background: none; border: 0; padding: 0;
  text-align: left; cursor: pointer; display: inline-flex; gap: 4px;
}
.sort-btn:hover { color: var(--ink); }
.sort-mark { color: var(--carbon-text); }
.grid tbody tr { cursor: pointer; }
/* полосы через строку — длинные строки легче читать (раскраска по статусу ниже их перекрывает) */
/* 1.3 (Ц5): «зебры» больше нет — наведение и выбор заметнее */
.grid tbody tr:hover td { background: var(--carbon-wash); }
.grid td { overflow-wrap: break-word; }
.grid td.muted { color: var(--ink-faint); }
.today {
  display: inline-block; padding: 0 6px; border-radius: 4px;
  background: var(--carbon); color: #fff; font-weight: 500;
}
.late-date {                       /* отгрузка просрочена (0.11.1) */
  display: inline-block; padding: 0 6px; border-radius: 4px;
  background: var(--stamp); color: #fff; font-weight: 500;
}
mark { background: var(--flash); color: inherit; border-radius: 2px; }

.empty { padding: 48px 24px; text-align: center; color: var(--ink-soft); }
.empty p { margin: 0 0 14px; }

/* ---------- статусы заказа ---------- */
.status-pill {
  --st-bg: var(--rule-soft); --st-fg: var(--ink-soft); --st-dot: var(--ink-faint);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px 2px 8px; border-radius: 999px;
  border: 1px solid transparent;
  background: var(--st-bg); color: var(--st-fg);
  font: inherit; font-size: 13px; font-weight: 500; line-height: 20px;
  white-space: nowrap;
}
.status-pill::before {
  content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--st-dot);
}
button.status-pill { cursor: pointer; }
button.status-pill:hover { border-color: var(--st-dot); }
.status-none { background: transparent; border: 1px dashed var(--rule); }
.status-none::before { background: transparent; box-shadow: inset 0 0 0 1px var(--ink-faint); }
.grid th.status, .grid td.status { min-width: 140px; white-space: nowrap; }

/* меню смены статуса из таблицы */
.status-menu {
  position: fixed; z-index: 20; display: grid; gap: 4px; padding: 6px;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: var(--lift-2);
}
.status-menu .status-pill { justify-content: flex-start; padding: 4px 12px 4px 10px; }
.status-menu .status-pill[aria-checked="true"] { border-color: var(--st-dot); box-shadow: inset 0 0 0 1px var(--st-dot); }

/* фильтр по статусу над таблицей */
.status-filter {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 16px; border-bottom: 1px solid var(--rule);
}
.status-all {
  font: inherit; font-size: 13px; font-weight: 500; line-height: 20px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink);
}
.status-all[aria-pressed="true"] { background: var(--inverse); border-color: var(--inverse); color: var(--inverse-ink); }
.status-count { font-variant-numeric: tabular-nums; opacity: 0.7; }
.status-chip.is-empty { opacity: 0.45; }
.status-filter.has-active .status-chip.status-pill:not([aria-pressed="true"]) { opacity: 0.45; }
.status-chip[aria-pressed="true"].status-pill { border-color: var(--st-dot); box-shadow: inset 0 0 0 1px var(--st-dot); opacity: 1; }

/* выбор статуса в карточке записи */
.status-options { display: flex; flex-wrap: wrap; gap: 6px; }
.status-option { cursor: pointer; }
.status-option .status-pill {
  padding: 4px 12px 4px 10px; background: var(--sheet);
  color: var(--ink-soft); border-color: var(--rule);
}
.status-option:hover .status-pill { border-color: var(--st-dot); }
.status-option input:checked + .status-pill {
  background: var(--st-bg); color: var(--st-fg);
  border-color: var(--st-dot); box-shadow: inset 0 0 0 1px var(--st-dot);
}
.status-option input:focus-visible + .status-pill { outline: 2px solid var(--carbon); outline-offset: 2px; }

/* ---------- подсветка строк по статусу ---------- */
.grid tbody tr.tone-done td    { background: var(--row-done); }
.grid tbody tr.tone-problem td { background: var(--row-problem); }
.grid tbody tr.tone-unpaid td  { background: var(--row-unpaid); }
.grid tbody tr.tone-done:hover td    { background: var(--row-done-hover); }
.grid tbody tr.tone-problem:hover td { background: var(--row-problem-hover); }
.grid tbody tr.tone-cancelled td { background: var(--row-cancelled); color: var(--row-cancelled-ink); }
.grid tbody tr.tone-cancelled:hover td { background: var(--row-cancelled-hover); }
.grid tbody tr.tone-unpaid:hover td  { background: var(--row-unpaid-hover); }

/* ---------- галочка в таблице и в форме ---------- */
.grid th.check, .grid td.check { text-align: center; min-width: 96px; }
.grid th.check .sort-btn { text-align: center; }
.row-check, .check-field input {
  width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--carbon);
}
.field.check-field {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius);
  font-weight: 500;
}
.field.check-field input { width: 18px; min-height: 0; padding: 0; }
.unpaid-chip {
  font: inherit; font-size: 13px; font-weight: 500; line-height: 20px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--warn-edge); background: var(--warn-wash); color: var(--warn-ink);
}
.unpaid-chip[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--warn); border-color: var(--warn); }
.status-filter.has-active .unpaid-chip:not([aria-pressed="true"]) { opacity: 0.45; }

/* ---------- сводка «Сегодня / Завтра» ---------- */
.dash { margin: 0 24px; }
.dash-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 4px 0 14px;
}
.day-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.day-arrow { font-size: 26px; border: 1px solid var(--rule-strong); background: var(--sheet); }
.day-input {
  font: inherit; font-weight: 500; color: var(--ink);
  min-height: 34px; padding: 0 10px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet);
}
.btn-quiet:disabled { opacity: 0.5; cursor: default; }
.dash-block {
  background: var(--sheet); border: 1px solid var(--sheet-edge); border-radius: var(--radius);
  margin-bottom: 16px; overflow: hidden;
}
.dash-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--rule);
}
.dash-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.dash-today .dash-head { border-top: 4px solid var(--carbon); }
.dash-tomorrow .dash-head { border-top: 4px solid var(--copy-catalog); }
.dash-returns .dash-head { border-top: 4px solid var(--return); }     /* «Возвращаются» (1.0) */
.dash-returns .dash-head h2 { color: var(--return-ink); }
.dash-late .dash-head { border-top: 4px solid var(--stamp); }
.dash-late .dash-head h2 { color: var(--stamp-text); }
.dash-empty { margin: 0; padding: 18px 16px; color: var(--ink-soft); }
.dash-wrap { max-height: none; }
.dash-grid th { position: static; }
.dash-grid tbody tr.group-row { cursor: default; }
.dash-grid tbody tr.group-row td {
  background: var(--group); border-bottom: 1px solid var(--rule); border-top: 1px solid var(--rule);
  padding: 7px 12px; box-shadow: inset 4px 0 0 var(--carbon);   /* полоса слева — начало группы */
}
.dash-grid tbody tr.group-row:hover td { background: var(--group); }
.group-name { font-weight: 600; margin-right: 10px; }
.group-count { color: var(--ink-soft); font-size: 13px; }
.dash-main { font-weight: 500; }
.dash-sub { color: var(--ink-soft); font-size: 13px; margin-top: 2px; white-space: pre-line; }
.dash-what { white-space: nowrap; }
.section-chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 13px; color: var(--ink-soft);
}
.section-chip::before {
  content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--copy);
}

/* ---------- маршрутный лист ---------- */
.panel-wide { width: min(620px, 100vw); }
.route-wrap { display: flex; flex-direction: column; height: 100%; }
.route-foot { justify-content: flex-start; }
.route-btn { margin-left: 14px; }
.carrier-status-btn { margin-left: 8px; }
.no-route-note { margin-left: 2px; }
.ask-list { margin: 0 0 10px; padding-left: 18px; max-height: 50vh; overflow: auto; font-size: 14px; }
.ask-list li { margin: 2px 0; }
.route-notice { margin: 0 0 12px; }
.route-summary { margin: 4px 0 10px; }
.route-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.route-stop {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: start;
  padding: 10px 10px 10px 8px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--sheet);
}
.route-stop.no-gps { border-color: var(--stamp-edge); background: var(--stamp-wash); }
.route-n {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--inverse); color: var(--inverse-ink); font-weight: 600; font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.route-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.route-time {
  font-size: 12.5px; font-weight: 500; padding: 0 6px; border-radius: 4px;
  background: var(--carbon-wash); color: var(--carbon-text); font-variant-numeric: tabular-nums;
}
.route-leg { font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.route-order { font-size: 13px; margin-top: 4px; }
.route-warn { font-size: 12.5px; color: var(--stamp-text); margin-top: 2px; }
.route-move { display: flex; flex-direction: column; gap: 2px; }
.route-move .icon-btn { font-size: 16px; width: 30px; height: 28px; border: 1px solid var(--rule); }
.route-move .icon-btn:disabled { opacity: 0.35; cursor: default; }
.route-hint { margin-top: 12px; }
.dash-map { font-size: 12.5px; display: inline-block; margin-top: 2px; }

/* ---------- закончить работу ---------- */
.btn-stop { color: var(--stamp-text); border-color: var(--stamp-edge); }
.btn-stop:hover { background: var(--stamp-wash); }
.confirm-box {
  width: min(420px, calc(100vw - 32px)); padding: 22px 22px 18px;
  border: 1px solid var(--rule); border-radius: 10px;
  background: var(--sheet); color: var(--ink);
  box-shadow: var(--lift-3);
}
.confirm-box::backdrop { background: var(--backdrop); }
.confirm-box h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.confirm-box p { margin: 0 0 10px; }
.confirm-box .foot-actions { margin-top: 16px; }
.closed-screen {
  min-height: 100vh; display: grid; place-content: center; justify-items: center;
  gap: 6px; padding: 24px; text-align: center;
}
.closed-screen .brand-logo { height: 40px; margin-bottom: 18px; }
.closed-screen h1 { margin: 0; font-size: 26px; font-weight: 600; }
.closed-screen p { margin: 0; max-width: 46ch; }

/* ---------- отметка строк и действия с отмеченными ---------- */
.grid th.sel, .grid td.sel { width: 36px; min-width: 36px; text-align: center; padding-left: 10px; padding-right: 4px; }
.grid tbody tr.is-selected td { box-shadow: inset 0 1px 0 var(--selected-rule), inset 0 -1px 0 var(--selected-rule); }
.grid tbody tr.is-selected td.sel { box-shadow: inset 3px 0 0 var(--carbon), inset 0 1px 0 var(--selected-rule), inset 0 -1px 0 var(--selected-rule); }
.bulk-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--rule);
  background: var(--carbon-wash);
}
.bulk-bar select {
  font: inherit; min-height: 32px; padding: 0 28px 0 10px; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet);
}

/* ---------- период ---------- */
.period { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.period-select, .period-custom input {
  font: inherit; min-height: 34px; padding: 0 10px; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet);
}
.period-select { padding-right: 28px; }
.period-select.is-active { background: var(--carbon-wash); border-color: var(--carbon); color: var(--carbon-text); font-weight: 500; }
.period-custom { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- значок количества тревог на «Сводке» ---------- */
.seg-badge {
  display: inline-grid; place-items: center; margin-left: 6px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--stamp); color: #fff; font-size: 11px; font-weight: 600;
  font-variant-numeric: tabular-nums; vertical-align: 1px;
}

/* ---------- «Требует внимания» ---------- */
.alerts .dash-head { border-top: 4px solid var(--stamp); }
.alert-grid { display: grid; gap: 1px; background: var(--rule); }
.alert-cat { background: var(--sheet); padding: 12px 16px; }
.alert-cat.level-red { box-shadow: inset 3px 0 0 var(--stamp); }
.alert-cat.level-amber { box-shadow: inset 3px 0 0 var(--warn); }
.alert-head { display: flex; align-items: baseline; gap: 8px; }
.alert-count {
  font-size: 12px; font-weight: 600; padding: 0 6px; border-radius: 9px;
  background: var(--rule-soft); color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.level-red .alert-count { background: var(--stamp-wash); color: var(--stamp-text); }
.level-amber .alert-count { background: var(--warn-wash); color: var(--warn-ink); }
.alert-cat .hint { margin: 2px 0 8px; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.alert-item {
  font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer;
  display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.2fr); gap: 4px 14px; align-items: baseline;
  padding: 6px 8px; border: 0; border-radius: var(--radius); background: transparent;
}
.alert-item:hover { background: var(--carbon-wash); }
.alert-title { font-weight: 500; overflow-wrap: anywhere; }
.alert-detail { color: var(--ink-soft); font-size: 13px; }
@media (max-width: 760px) {
  .alert-item { grid-template-columns: 1fr; }
}

/* ---------- подвал ---------- */
.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px 20px; color: var(--canvas-ink); font-size: 12.5px;
}

/* ---------- боковая панель (диалог) ---------- */
.panel {
  margin: 0 0 0 auto; height: 100vh; max-height: 100vh;
  width: min(460px, 100vw); max-width: 100vw; padding: 0; border: 0;
  border-left: 1px solid var(--rule);
  background: var(--sheet); color: var(--ink);
  box-shadow: var(--lift-3);
}
.panel-narrow { width: min(420px, 100vw); }
.panel::backdrop { background: var(--backdrop); }
.panel[open] { animation: slide-in 160ms ease-out; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .panel[open] { animation: none; } }

.panel form { display: flex; flex-direction: column; height: 100%; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--rule);
  border-top: 5px solid var(--copy, var(--rule));
}
.panel-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.panel-body { flex: 1; overflow: auto; padding: 16px 20px; }
.panel-body p { margin: 0 0 12px; }
.hint { color: var(--ink-soft); font-size: 13px; }
.addr-note { color: var(--note-ink); }   /* «В заказе указано: …» — не адрес из каталога (0.12) */
.suggest-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; }
.suggest-chip {
  font: inherit; font-size: 13px; cursor: pointer; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--sheet); color: var(--ink);
}
.suggest-chip:hover { border-color: var(--carbon); color: var(--carbon-text); }
.panel-meta { margin: 0; padding: 0 20px 12px; color: var(--ink-soft); font-size: 12.5px; }
.panel-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--rule); flex-wrap: wrap;
}
.foot-actions { display: flex; gap: 8px; margin-left: auto; }
.confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--stamp-text); font-weight: 500; max-width: 100%; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; color: var(--ink);
  min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet);
}
.field select { padding-right: 28px; }
.field .hint { display: block; margin-top: 4px; }

/* время «с … до …» */
.time-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.time-word { color: var(--ink-soft); }
.time-pick { display: inline-flex; align-items: center; gap: 2px; }
.field .time-pick select { width: auto; min-width: 62px; padding-right: 22px; font-variant-numeric: tabular-nums; }
.time-colon { font-weight: 600; }

/* выбор из каталога */
.adder { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.field .adder input { flex: 1 1 160px; width: auto; min-height: 30px; }
.adder-hint { flex-basis: 100%; }
.notice {
  margin-top: 6px; padding: 8px 10px; border-radius: var(--radius);
  background: var(--stamp-wash); color: var(--stamp-text); font-size: 13px;
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline;
}
.infocard {
  margin-top: 6px; padding: 8px 10px; border-radius: var(--radius);
  background: var(--paper); border-left: 3px solid var(--copy-catalog);
  font-size: 13px; display: grid; gap: 4px;
}
.info-line { display: grid; grid-template-columns: 9.5em 1fr; gap: 8px; white-space: pre-line; }
.info-label { color: var(--ink-soft); }

/* поле, которое программа заполнила сама */
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--flash); } to { background: var(--sheet); } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }

.form-error {
  margin: 0 20px 10px; padding: 8px 10px; border-radius: var(--radius);
  background: var(--stamp-wash); color: var(--stamp-text); font-weight: 500;
}
.field textarea { min-height: 64px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--carbon); outline: none; box-shadow: 0 0 0 3px var(--carbon-wash); }

.report {
  margin-top: 8px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--carbon-wash); font-size: 13px;
}
.report.error { background: var(--stamp-wash); color: var(--stamp-text); }
.report ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- уведомление ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--inverse); color: var(--inverse-ink); padding: 10px 16px; border-radius: var(--radius);
  font-weight: 500; z-index: 10; max-width: calc(100vw - 32px);
}
.toast.error { background: var(--stamp); }

/* ---------- узкие экраны ---------- */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px 8px; }
  .top-actions { margin-left: 0; }
  .info-line { grid-template-columns: 1fr; gap: 0; }
  .tabs { padding: 0 16px; }
  .sheet { margin: 0 16px; }
  .dash { margin: 0 16px; }
  .foot { padding: 12px 16px 20px; }
  .toolbar { padding: 12px; }
  .search { max-width: none; flex-basis: 100%; }
  .table-wrap { max-height: none; }
}

/* ---------- 0.7: копирование номеров, комментарии, вес, забор, доверенность ---------- */
.copy-code {
  font: inherit; color: inherit; background: none; border: 0; padding: 0 2px; margin: 0 -2px;
  text-align: left; cursor: copy; border-radius: 4px;
  text-decoration: underline dotted var(--ink-soft); text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.copy-code:hover { color: var(--carbon-text); text-decoration-color: var(--carbon); background: var(--sheet); }
.copy-code.copied { animation: copied 0.9s ease-out; }
@keyframes copied { from { background: var(--ok-wash); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .copy-code.copied { animation: none; } }

.grid td.note .clamp, .dash-grid td.note .clamp {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; white-space: pre-line; cursor: default;
}
.has-tip { text-decoration: underline dotted var(--ink-soft); text-underline-offset: 3px; cursor: help; }
.hover-tip {
  position: fixed; z-index: 30; max-width: min(460px, calc(100vw - 16px)); max-height: 60vh; overflow: auto;
  padding: 10px 12px; border-radius: 8px; background: var(--inverse); color: var(--inverse-ink);
  font-size: 13px; line-height: 1.45; white-space: pre-line; pointer-events: none;
  box-shadow: var(--lift-2);
}

.kind-chip {
  display: inline-block; padding: 1px 7px; border-radius: 999px; margin-right: 4px;
  background: var(--note-wash); color: var(--note-ink); font-size: 12px; font-weight: 600; vertical-align: 1px;
}
.pickup-line { margin: 0 0 4px; }
.poa-btn { margin-left: 8px; }

.field-group {
  margin: 18px 0 12px; padding-top: 14px; border-top: 1px solid var(--rule);
}
.field-group-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.field-group .hint { margin: 0 0 10px; }

/* ---------- 0.8: архив, «Откуда» ---------- */
.archive-chip {
  font: inherit; font-size: 13px; font-weight: 500; line-height: 20px; margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 12px; border-radius: 999px; cursor: pointer;
  border: 1px dashed var(--ink-faint); background: var(--paper); color: var(--ink);
}
.archive-chip::before { content: "▸"; font-size: 11px; color: var(--ink-soft); }
.archive-chip[aria-pressed="true"]::before { content: "▾"; color: var(--inverse-ink); }
.archive-chip:hover { border-color: var(--ink-soft); background: var(--sheet); }
.archive-chip[aria-pressed="true"] { background: var(--inverse); border: 1px solid var(--inverse); color: var(--inverse-ink); opacity: 1; }
.status-filter.has-active .archive-chip { opacity: 1; }
.grid tbody tr.is-archived td { color: var(--ink-soft); }
.grid tbody tr.is-archived td.status .status-pill { opacity: 0.85; }
.route-origin { margin: 2px 0 2px; font-size: 13px; }

/* ---------- 0.9: забор внутри точки маршрута ---------- */
.route-pickup { margin: 0 0 8px; padding: 0 0 8px; border-bottom: 1px dashed var(--rule); font-size: 13.5px; }
.route-arrow { margin-top: 4px; font-size: 12.5px; color: var(--ink-soft); }

/* ---------- 0.10: короба и паллеты, Telegram ---------- */
.places-inputs { display: flex; gap: 10px; }
.places-part { flex: 1 1 0; display: flex; flex-direction: column; gap: 3px; }
.places-part > span { font-size: 12.5px; color: var(--ink-soft); }
.grid td.places { white-space: nowrap; }
.tg-status { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--paper); margin-bottom: 12px; font-weight: 500; }
.tg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.tg-ok .tg-dot { background: var(--ok); }
.tg-starting .tg-dot { background: var(--warn); }
.tg-error { background: var(--stamp-wash); color: var(--stamp-text); }
.tg-error .tg-dot { background: var(--stamp); }
.tg-token-line { margin: 0 0 8px; }
.tg-token { margin-bottom: 8px; }
.tg-chat { border: 1px solid var(--rule); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.tg-chat.is-allowed { border-color: var(--ok-edge); background: var(--ok-tint); }
.tg-chat.is-gone { opacity: 0.6; }
.tg-chat-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.tg-flag { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--note-ink); background: var(--note-wash);
  padding: 1px 8px; border-radius: 999px; }
.is-allowed .tg-flag { color: var(--ok-ink); background: var(--ok-wash); }
.tg-chat-row { display: flex; gap: 8px; margin: 8px 0 4px; }
.tg-chat-row select { flex: 1; font: inherit; min-height: 32px; padding: 0 8px; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--sheet); }
.tg-chat-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-soft); align-items: center; }
.tg-forget { margin-left: auto; color: var(--ink-soft); }
.tg-commands { margin: 0 0 10px; padding-left: 18px; }
#tgBtn { position: relative; }
.tg-chat-row input[type="text"] { flex: 1; font: inherit; min-height: 32px; padding: 0 8px; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--sheet); }
.tg-log { list-style: none; margin: 0 0 12px; padding: 0; font-size: 13px; }
.tg-log li { padding: 6px 0; border-bottom: 1px solid var(--rule-soft); }
.tg-log li.ok div { color: var(--ok-ink); }

/* ---------- 1.1: фильтры колонок (как в Excel), дата у отмеченных ---------- */
.th-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 2px; }
.grid th.num .th-inner { justify-content: flex-end; }
.grid th.check .th-inner { justify-content: center; }
.filter-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 20px; height: 20px; margin-left: 2px; padding: 0; border: 0; border-radius: 4px;
  background: transparent; color: var(--sheet-head-ink); opacity: 0.4; cursor: pointer;
}
.filter-btn:hover, .filter-btn:focus-visible { opacity: 1; background: var(--carbon-wash); }
.filter-btn.is-on { opacity: 1; background: var(--carbon); color: #fff; }
.grid th.is-filtered { background: var(--sheet-head-active); }
.col-filter {
  position: fixed; z-index: 25; width: min(320px, calc(100vw - 16px));
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: var(--sheet); border: 1px solid var(--sheet-edge); border-radius: 8px;
  box-shadow: var(--lift-2);
}
.cf-head { display: flex; flex-direction: column; gap: 2px; }
.cf-head .hint { font-size: 12px; }
.cf-search {
  font: inherit; min-height: 32px; padding: 0 10px; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet);
}
.cf-all { display: flex; align-items: center; gap: 8px; font-weight: 500; padding: 2px 4px; cursor: pointer; }
.cf-list {
  max-height: min(320px, 50vh); overflow: auto; border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 4px 0;
}
.cf-item { display: flex; align-items: center; gap: 4px; padding: 0 6px 0 8px; }
.cf-item:hover { background: var(--carbon-wash); }
.cf-item label { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 0; cursor: pointer; }
.cf-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-n { color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.cf-only {
  font: inherit; font-size: 12px; color: var(--carbon-text); background: none; border: 0; padding: 2px 4px;
  cursor: pointer; visibility: hidden; text-decoration: underline; text-underline-offset: 2px;
}
.cf-item:hover .cf-only, .cf-only:focus-visible { visibility: visible; }
.cf-foot { display: flex; justify-content: space-between; align-items: center; }
.col-filter input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--carbon); }
#colFilterReset { margin-right: auto; margin-left: -4px; }
.bulk-date-group { display: inline-flex; align-items: center; gap: 6px; }
.bulk-date-label { font-weight: 500; }
.bulk-date {
  font: inherit; min-height: 32px; padding: 0 8px; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet);
}
.bulk-date-group select {
  font: inherit; min-height: 32px; padding: 0 28px 0 10px; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet);
}

/* ---------- ЭТрН: черновики для Диадока (1.2) ---------- */
.etrn-btn { margin-left: 8px; }
.etrn-body { display: grid; gap: 12px; }
.etrn-lead { margin: 0; }
.etrn-card { border: 1px solid var(--rule); border-left: 4px solid var(--ok); border-radius: var(--radius);
  background: var(--sheet); padding: 10px 14px; }
.etrn-card.not-ready { border-left-color: var(--stamp); }
.etrn-common { border-left-color: var(--carbon); background: var(--carbon-wash); }
.etrn-card h3 { margin: 0; font-size: 15px; }
.etrn-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 4px; }
.etrn-num { margin-left: auto; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.etrn-badge { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; }
.etrn-badge.ok { background: var(--ok-wash); color: var(--ok-ink); }
.etrn-badge.bad { background: var(--stamp-wash); color: var(--stamp-text); }
.etrn-line { margin: 2px 0; font-size: 14px; }
.etrn-us { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; font-size: 14px; font-weight: 600;
  cursor: pointer; }
.etrn-us input { width: 17px; height: 17px; margin: 0; accent-color: var(--carbon); }
.etrn-issues { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.etrn-issues li { margin: 2px 0; }
.etrn-issues .btn-link { margin-left: 6px; padding: 0; }
.etrn-error li::marker { color: var(--stamp-text); }
.etrn-error li > span { color: var(--stamp-text); }
.etrn-warn li::marker { color: var(--warn); }
.etrn-warn li > span { color: var(--warn-ink); }
.etrn-t3 { margin-top: 8px; font-size: 14px; }
.etrn-t3 summary { cursor: pointer; color: var(--carbon-text); font-weight: 600; }
.etrn-t3 .hint { margin: 6px 0; }
.etrn-t3-table { border-collapse: collapse; }
.etrn-t3-table th, .etrn-t3-table td { text-align: left; vertical-align: top; padding: 3px 12px 3px 0;
  border-bottom: 1px solid var(--rule-soft); font-weight: 400; }
.etrn-t3-table th { color: var(--ink-soft); white-space: nowrap; }
.etrn-howto { margin: 0; }
.etrn-foot { justify-content: flex-end; gap: 14px; }

/* =====================================================================
   1.3 — цвет (Ц1–Ц6), эффекты (Э1–Э6), таблицы (В1, В7), карточка (В2),
   Сводка (В3), окно ЭТрН (В4), меню «Ещё» (В5), рейсы (Ф5), правка в ячейке (Ф3)
   ===================================================================== */
@font-face {
  font-family: "Golos Text"; font-style: normal; font-display: swap; font-weight: 400 900;
  src: url("/static/fonts/golos-text-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text"; font-style: normal; font-display: swap; font-weight: 400 900;
  src: url("/static/fonts/golos-text-cyrillic-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Golos Text"; font-style: normal; font-display: swap; font-weight: 400 900;
  src: url("/static/fonts/golos-text-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Golos Text"; font-style: normal; font-display: swap; font-weight: 400 900;
  src: url("/static/fonts/golos-text-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
:root[data-density="compact"] { --row-pad: 5px; }

/* ---------- Ц1: тёмная полоса — шапка и вкладки ---------- */
.topbar { background: var(--band); padding: 12px 24px; color: var(--band-ink); }
.tabs { background: var(--band); padding-top: 4px; }
.brand-logo { filter: brightness(0) invert(1); }
.brand-app { color: var(--band-ink-soft); border-left-color: var(--band-rule); }
.seg { background: var(--band-fill); }
.seg-btn { color: var(--band-ink-soft); }
.seg-btn:hover { color: var(--band-ink); }
.seg-btn[aria-pressed="true"] { background: #ffffff; color: #1d2733; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.band-btn {
  font: inherit; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 14px; border-radius: var(--radius); cursor: pointer; text-decoration: none;
  background: transparent; color: var(--band-ink); border: 1px solid var(--band-rule);
}
.band-btn:hover { background: var(--band-fill); border-color: rgba(255, 255, 255, 0.55); }
.band-btn[aria-expanded="true"] { background: #ffffff; color: #1d2733; border-color: #ffffff; }
.more-caret { font-size: 10px; opacity: 0.8; }
.tab { border-color: transparent; color: var(--tab-ink); }
.tab:hover { background: var(--sheet); }
.tab[aria-selected="true"] { border-color: transparent; }
.tab-count { color: inherit; opacity: 0.72; }
.dash { padding-top: 14px; }

/* меню «Ещё» (В5) */
.more-menu {
  position: fixed; z-index: 26; min-width: 320px; padding: 6px;
  background: var(--sheet); color: var(--ink); border: 1px solid var(--sheet-edge); border-radius: 8px;
  box-shadow: var(--lift-2); animation: pop-in 120ms ease-out;
}
.more-item {
  font: inherit; color: inherit; text-decoration: none; text-align: left; width: 100%;
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px;
  border: 0; border-radius: var(--radius); background: transparent; cursor: pointer;
}
.more-item:hover, .more-item:focus-visible { background: var(--hover); }
.more-item.is-danger { color: var(--stamp-text); }
.more-sep { height: 1px; margin: 6px 4px; background: var(--rule); }
.more-label { padding: 6px 10px 2px; font-size: 12.5px; color: var(--ink-soft); }
.more-choice { display: flex; gap: 4px; padding: 4px 6px 6px; }
.more-choice button {
  flex: 1; font: inherit; font-size: 13px; min-height: 30px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink);
}
.more-choice button[aria-pressed="true"] { background: var(--inverse); border-color: var(--inverse); color: var(--inverse-ink); }
.more-check { width: 16px; height: 16px; margin: 0; accent-color: var(--carbon); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- Э1: глубина — тень вместо тёмной рамки ---------- */
.sheet, .dash-block { border-color: var(--sheet-edge); box-shadow: var(--lift-1); }
.sheet { border-top-color: transparent; }
.panel { border-left-color: var(--sheet-edge); }

/* ---------- Ц5: строки — без «зебры», наведение нейтральное, выбор голубой ---------- */
.grid th, .grid td { padding: var(--row-pad) 8px; }
.grid th.sel, .grid td.sel { padding-left: 10px; padding-right: 2px; }
.grid tbody tr:hover td { background: var(--hover); }
.grid tbody tr.tone-done:hover td { background: var(--row-done-hover); }
.grid tbody tr.tone-problem:hover td { background: var(--row-problem-hover); }
.dash-grid tbody tr.group-row:hover td { background: var(--group); }
.grid tbody tr.is-selected td { background: var(--selected); box-shadow: inset 0 -1px 0 var(--selected-rule); }
.grid tbody tr.is-selected td.sel { box-shadow: inset 3px 0 0 var(--carbon), inset 0 -1px 0 var(--selected-rule); }
.grid td.muted { color: var(--ink-faint); }

/* ---------- Ц3: раздел в строках — нейтральная метка, цвет — у статуса ---------- */
.section-chip::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-faint); border-radius: 2px; }

/* ---------- Ц4: «сегодня» — светлая метка; сплошная заливка — только у просрочки ---------- */
.today { background: var(--carbon-soft); color: var(--carbon-soft-ink); font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--selected-rule); }
.dash-tomorrow .dash-head { border-top-color: var(--copy-catalog); }

/* ---------- Ц6: статусы не меняются; пустые фильтры читаемее; тёмная тема ---------- */
.status-chip.is-empty, .status-filter.has-active .status-chip.status-pill:not([aria-pressed="true"]) { opacity: 0.6; }
:root[data-theme="dark"] .status-pill:not(.status-none) {
  background: color-mix(in srgb, var(--st-dot) 22%, var(--sheet));
  color: color-mix(in srgb, var(--st-dot) 45%, #ffffff);
}
:root[data-theme="dark"] .brand-logo { opacity: 0.92; }

/* ---------- Э2: отклик на действие ---------- */
.btn, .band-btn, .seg-btn, .tab, .status-pill, .status-all, .archive-chip, .suggest-chip, .filter-btn,
.more-item, .icon-btn, .grid td, .alert-item {
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease),
    opacity var(--ease), transform 80ms ease-out;
}
.btn:active, .band-btn:active, .seg-btn:active, .status-pill:active { transform: translateY(1px); }
.btn-primary { box-shadow: 0 1px 2px rgba(34, 56, 143, 0.35); }
.btn-primary:hover { box-shadow: 0 2px 8px rgba(34, 56, 143, 0.35); }

/* ---------- Э3: подсветка изменённой строки (бот, другое окно, массовые действия) ---------- */
.grid tbody tr.row-flash td { animation: row-flash 1.8s ease-out; }
@keyframes row-flash { from { background-color: var(--flash); } }

/* ---------- Э4: тень под шапкой таблицы и у закреплённых колонок при прокрутке ---------- */
.grid th { box-shadow: inset 0 -1px 0 var(--sheet-head-rule); }
.table-wrap.is-scrolled-y .grid thead th { box-shadow: inset 0 -1px 0 var(--sheet-head-rule), 0 6px 8px -6px rgba(0, 0, 0, 0.28); }
.table-wrap.is-scrolled-x .grid .pin-last { box-shadow: 6px 0 8px -6px rgba(0, 0, 0, 0.30); }
.table-wrap.is-scrolled-x.is-scrolled-y .grid thead th.pin-last {
  box-shadow: inset 0 -1px 0 var(--sheet-head-rule), 6px 0 8px -6px rgba(0, 0, 0, 0.30);
}

/* ---------- Э5: окна открываются и закрываются плавно, затемнение без размытия ---------- */
.panel[open]::backdrop, .confirm-box[open]::backdrop { animation: fade-in 160ms ease-out; }
.confirm-box[open] { animation: pop-in 140ms ease-out; }
.panel.is-closing { animation: slide-out 140ms ease-in forwards; }
.confirm-box.is-closing { animation: fade-out 120ms ease-in forwards; }
.panel.is-closing::backdrop, .confirm-box.is-closing::backdrop { animation: fade-out 140ms ease-in forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes slide-out { to { transform: translateX(28px); opacity: 0; } }

/* ---------- В1: таблицы в ширину окна ---------- */
.grid th { white-space: nowrap; min-width: 0; max-width: none; }
.grid td { min-width: 0; }
.grid th .sort-btn > span:first-child { white-space: nowrap; }
.grid th.wide, .grid td.wide { min-width: 170px; max-width: 250px; }
.grid th.date, .grid td.date { min-width: 0; }
.grid th.num, .grid td.num { min-width: 0; }
.grid td.code { white-space: nowrap; }
.grid td.note { min-width: 150px; max-width: 230px; }
.grid th.check, .grid td.check { min-width: 0; }
.grid td.ref { min-width: 90px; max-width: 170px; }
/* закреплённые колонки: отметка, статус, номер заказа (left считает app.js) */
.grid .pin { position: sticky; left: var(--pin-left, 0); z-index: 1; background: var(--sheet); }
.grid thead th.pin { z-index: 3; background: var(--sheet-head); }
.grid thead th { z-index: 2; }
.combo-main { font-weight: 500; }
.combo-sub { color: var(--ink-soft); font-size: 13px; margin-top: 1px; white-space: pre-line; }
.track-link { margin-left: 8px; font-size: 12.5px; color: var(--carbon-text); font-weight: 500; white-space: nowrap; }
/* правка прямо в ячейке (Ф3) */
.grid td.editable { cursor: text; }
.grid tbody td.editable:hover { box-shadow: inset 0 0 0 1px var(--rule-strong); }
.grid td.editable.is-editing { box-shadow: inset 0 0 0 2px var(--carbon); }
.cell-editor {
  position: fixed; z-index: 27; display: flex; flex-direction: column; gap: 8px; padding: 10px;
  width: max-content; min-width: 240px; max-width: min(340px, calc(100vw - 16px));
  background: var(--sheet); color: var(--ink); border: 1px solid var(--sheet-edge); border-radius: 8px;
  box-shadow: var(--lift-2); animation: pop-in 120ms ease-out;
}
.cell-editor-title { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.cell-editor input, .cell-editor select {
  font: inherit; min-height: 34px; padding: 0 10px; color: var(--ink); width: 100%;
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet);
}
.cell-editor input:focus, .cell-editor select:focus { border-color: var(--carbon); outline: none; box-shadow: 0 0 0 3px var(--carbon-wash); }
.cell-editor .places-inputs { gap: 8px; }
.cell-editor-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.cell-editor-quick button {
  font: inherit; font-size: 12.5px; min-height: 26px; padding: 0 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
}
.cell-editor-quick button:hover { border-color: var(--carbon); color: var(--carbon-text); }
.cell-editor-list { max-height: 220px; overflow: auto; display: grid; gap: 1px; margin: 0 -4px; }
.cell-editor-list button {
  font: inherit; text-align: left; padding: 6px 8px; border: 0; border-radius: var(--radius); cursor: pointer;
  background: transparent; color: var(--ink);
}
.cell-editor-list button:hover, .cell-editor-list button:focus-visible { background: var(--hover); }
.cell-editor-list button[aria-current="true"] { background: var(--selected); font-weight: 600; }
.cell-editor-foot { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.cell-editor-foot .hint { font-size: 12px; }
/* итоги под таблицей (В7) */
.totals {
  display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 9px 16px; border-top: 1px solid var(--rule);
  background: var(--paper); color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums;
  border-radius: 0 0 var(--radius) var(--radius);
}
.totals strong { color: var(--ink); font-weight: 600; }
/* выбор колонок (В1) */
.col-chooser { position: fixed; z-index: 25; width: min(300px, calc(100vw - 16px)); padding: 10px;
  background: var(--sheet); border: 1px solid var(--sheet-edge); border-radius: 8px; box-shadow: var(--lift-2);
  display: flex; flex-direction: column; gap: 6px; animation: pop-in 120ms ease-out; }
.col-chooser-list { max-height: min(380px, 60vh); overflow: auto; display: grid; gap: 1px; }
.col-chooser label { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--radius); cursor: pointer; }
.col-chooser label:hover { background: var(--hover); }
.col-chooser input { width: 16px; height: 16px; margin: 0; accent-color: var(--carbon); }
.col-chooser-foot { display: flex; justify-content: space-between; padding-top: 4px; border-top: 1px solid var(--rule); }
.btn-cols.is-on { border-color: var(--carbon); color: var(--carbon-text); }

/* ---------- В2: широкая карточка в две колонки ---------- */
.panel-card { width: min(860px, 100vw); }
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; align-items: start; }
.edit-grid > .span-2, .edit-grid > .field-section { grid-column: 1 / -1; }
.field-section { margin: 6px 0 12px; border-top: 1px solid var(--rule); padding-top: 12px; }
.field-section > .edit-grid { margin-top: 8px; }
.field-section .field-group { margin: 0; padding: 0; border: 0; }
details.field-section > summary {
  list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 4px 6px; margin: -4px -6px; border-radius: var(--radius);
}
details.field-section > summary::-webkit-details-marker { display: none; }
details.field-section > summary:hover { background: var(--hover); }
details.field-section > summary::before { content: "▸"; color: var(--ink-soft); font-size: 12px; transition: transform var(--ease); }
details.field-section[open] > summary::before { transform: rotate(90deg); }
.section-fill { font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.section-fill.is-empty { color: var(--warn-ink); }
.section-fill.is-full { color: var(--ok-ink); }
@media (max-width: 720px) { .edit-grid { grid-template-columns: 1fr; } }

/* ---------- В3: Сводка ---------- */
.day-stats {
  display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 12px;
  background: var(--sheet); border: 1px solid var(--sheet-edge); border-radius: var(--radius); box-shadow: var(--lift-1);
}
.day-stat { flex: 1 1 120px; padding: 10px 16px; border-left: 1px solid var(--rule-soft); min-width: 0; }
.day-stat:first-child { border-left: 0; }
.day-stat-n { display: block; font-size: 22px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.day-stat-l { display: block; font-size: 12.5px; color: var(--ink-soft); }
.day-stat.is-warn .day-stat-n { color: var(--warn-ink); }
.day-stat.is-return .day-stat-n { color: var(--return-ink); }
.day-stat.is-ok .day-stat-n { color: var(--ok-ink); }
.day-stat-sub { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
/* Ф6: неделя вперёд */
.week {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 0 0 14px;
}
.week-day {
  font: inherit; color: var(--ink); text-align: left; cursor: pointer; min-width: 0;
  display: flex; flex-direction: column; gap: 1px; padding: 8px 10px;
  background: var(--sheet); border: 1px solid var(--sheet-edge); border-radius: var(--radius);
}
.week-day:hover { border-color: var(--rule-strong); box-shadow: var(--lift-1); }
.week-day[aria-current="date"] { border-color: var(--carbon); box-shadow: inset 0 0 0 1px var(--carbon); }
.week-day.is-weekend .week-date { color: var(--ink-soft); }
.week-day.is-empty { background: var(--paper); }
.week-date { font-size: 12.5px; font-weight: 500; }
.week-n { font-size: 20px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.week-day.is-empty .week-n { color: var(--ink-faint); }
.week-sec { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-warn { font-size: 12px; color: var(--warn-ink); font-weight: 500; }
@media (max-width: 900px) { .week { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 520px) { .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* одинаковые колонки во всех блоках, перенос комментария */
.dash-grid { table-layout: fixed; min-width: 1060px; }
.dash-grid td.note .clamp { -webkit-line-clamp: 3; line-clamp: 3; }
.dash-grid td { overflow-wrap: anywhere; }
.dash-grid td.time, .dash-grid td.nw { white-space: normal; }
.dash-what { white-space: normal; }
/* «доставлено N из M» и «всё доставлено» (Э6) */
.group-progress { display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; font-size: 13px; color: var(--ink-soft);
  font-variant-numeric: tabular-nums; vertical-align: middle; }
.group-bar { width: 72px; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.group-bar > span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.dash-grid tbody tr.group-row.is-done td { background: var(--ok-wash); box-shadow: inset 4px 0 0 var(--ok); }
.dash-grid tbody tr.group-row.is-done:hover td { background: var(--ok-wash); }
.group-done { color: var(--ok-ink); font-weight: 600; margin-left: 10px; }
.group-done::before { content: "✓ "; }

/* ---------- В4: окно ЭТрН — что заполнить, по карточкам ---------- */
.etrn-todo { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.etrn-todo-item { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); }
.etrn-todo-item.is-error { border-left: 3px solid var(--stamp); }
.etrn-todo-item.is-warn { border-left: 3px solid var(--warn); }
.etrn-todo-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 8px 10px; }
.etrn-todo-head .etrn-todo-what { grid-column: 1; grid-row: 1; }
.etrn-todo-head .etrn-todo-n { grid-column: 1; grid-row: 2; }
.etrn-todo-head .btn { grid-column: 2; grid-row: 1 / span 2; }
.etrn-todo-what { font-weight: 600; }
.etrn-todo-n { font-size: 12.5px; color: var(--ink-soft); }
.etrn-todo-item.is-error .etrn-todo-n { color: var(--stamp-text); }

.etrn-todo details { padding: 0 10px 8px; }
.etrn-todo summary { cursor: pointer; font-size: 13px; color: var(--ink-soft); }
.etrn-todo ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }

/* ---------- Ф5: рейсы перевозчиков ---------- */
.panel-trips { width: min(980px, 100vw); }
.trips-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--rule); }
.trips-bar input, .trips-bar select {
  font: inherit; min-height: 34px; padding: 0 10px; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet);
}
.trips-bar .spacer { flex: 1; }
.trips-group { margin-bottom: 18px; }
.trips-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 6px; }
.trips-head h3 { margin: 0; font-size: 16px; }
.trips-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.trips-table th, .trips-table td { padding: 6px 8px; border-bottom: 1px solid var(--rule-soft); text-align: left; vertical-align: top; }
.trips-table th { font-size: 12.5px; color: var(--sheet-head-ink); background: var(--sheet-head); font-weight: 600; white-space: nowrap; }
.trips-table td.num, .trips-table th.num { text-align: right; }
.trips-table tfoot td { font-weight: 600; border-bottom: 0; background: var(--paper); }
.trips-dest { color: var(--ink-soft); font-size: 13px; }
.trips-cost { width: 110px; text-align: right; font: inherit; min-height: 30px; padding: 0 8px; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--sheet); }
.trips-cost.is-rate { color: var(--ink-soft); font-style: italic; }
.trips-note { width: 100%; min-width: 120px; font: inherit; font-size: 13px; min-height: 30px; padding: 0 8px; color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); }
.trips-src { display: block; font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.trips-total { font-size: 15px; }

/* ---------- уведомление с кнопкой «Отменить» ---------- */
.toast { display: flex; align-items: center; gap: 14px; box-shadow: var(--lift-2); animation: toast-in 160ms ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.toast-action {
  font: inherit; font-weight: 600; color: inherit; background: transparent; cursor: pointer;
  border: 1px solid currentColor; border-radius: var(--radius); padding: 3px 10px; opacity: 0.92;
}
.toast-action:hover { opacity: 1; background: rgba(127, 127, 127, 0.18); }

/* узкие окна (В5): шапка в один ряд, кнопки — в «Ещё» */
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; gap: 10px 12px; }
  .brand-app { display: none; }
  .day-stat { flex-basis: 45%; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .band-btn, .seg-btn, .tab, .status-pill, .grid td, .more-item, .alert-item { transition: none; }
  .grid tbody tr.row-flash td, .more-menu, .cell-editor, .col-chooser, .toast,
  .panel.is-closing, .confirm-box.is-closing, .panel[open]::backdrop, .confirm-box[open] { animation: none; }
}
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* В1: воронка фильтра появляется при наведении на заголовок (место под неё не занимается) */
.grid th .th-inner { position: relative; }
.grid th .filter-btn { position: absolute; right: -4px; top: 50%; transform: translateY(-50%); opacity: 0;
  background: var(--sheet-head-active); border-radius: 4px; }
.grid th:hover .filter-btn, .grid th:focus-within .filter-btn { opacity: 0.85; }
.grid th .filter-btn:hover, .grid th .filter-btn:focus-visible { opacity: 1; background: var(--sheet-head-active); }
.grid th .filter-btn.is-on { opacity: 1; position: static; transform: none; box-shadow: none; background: var(--carbon); }
#etrnDialog { width: min(760px, 100vw); }

/* 1.3.1: галочка с пояснением в карточке («Получатель в ЭТрН ББ») */
.field.check-field.has-hint { align-items: flex-start; }
.field.check-field.has-hint input { margin-top: 2px; flex: none; }
.check-text { display: flex; flex-direction: column; gap: 4px; }
.check-text .hint { font-weight: 400; }
.band-stop:hover { background: rgba(196, 55, 43, 0.9); border-color: rgba(196, 55, 43, 0.9); }

/* 1.3.1: полоса «неделя» со стрелками — листать на 7 дней назад и вперёд */
.week-wrap { display: flex; align-items: stretch; gap: 6px; margin: 0 0 14px; }
.week-wrap[hidden] { display: none; }
.week-wrap .week { flex: 1; min-width: 0; margin: 0; }
.week-arrow {
  flex: none; width: 30px; height: auto; font-size: 24px;
  border: 1px solid var(--sheet-edge); background: var(--sheet); color: var(--ink-soft);
}
.week-arrow:hover { color: var(--ink); border-color: var(--rule-strong); box-shadow: var(--lift-1); }

/* 1.3.1: «Требует внимания» — по дням (сегодня / завтра), блок и дни сворачиваются */
.alerts .dash-head { align-items: center; }
.alerts .dash-head .spacer { flex: 1; }
.alerts.is-folded .dash-head { border-bottom: 0; }
.alert-sum { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.alert-sum[hidden] { display: none; }
.alert-sum-day {
  font-size: 13px; font-weight: 500; padding: 1px 8px; border-radius: 999px;
  background: var(--stamp-wash); color: var(--stamp-text);
}
.alert-day + .alert-day { border-top: 1px solid var(--rule); }
.alert-day-head {
  font: inherit; color: var(--ink); width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--group); border: 0; border-bottom: 1px solid var(--rule);
  cursor: pointer; text-align: left;
}
.alert-day-head:hover { background: var(--hover); }
.alert-day-head .alert-count { background: var(--paper); color: var(--ink-soft); }
.alert-day-today .alert-day-head .alert-count { background: var(--stamp-wash); color: var(--stamp-text); }
.alert-day-head[aria-expanded="false"] { border-bottom: 0; }
.alert-caret { display: inline-block; font-size: 12px; color: var(--ink-soft); transition: transform var(--ease); }
.alert-day-head[aria-expanded="false"] .alert-caret { transform: rotate(-90deg); }
.alert-grid[hidden], .alert-days[hidden] { display: none; }

/* 1.4: вход на сервере — имя в шапке, пользователи */
.band-user { color: var(--band-ink-soft); font-size: 14px; padding: 0 2px 0 6px; white-space: nowrap; align-self: center; }
.band-user[hidden] { display: none; }
#usersDialog { width: min(820px, calc(100vw - 32px)); }
.users-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.users-table th, .users-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.users-table th { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.users-actions { white-space: nowrap; text-align: right; }
.users-actions .btn + .btn { margin-left: 6px; }
.users-note { background: var(--ok-wash); color: var(--ok-ink); border: 1px solid var(--ok-edge); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px; }
.users-note strong { font-size: 15px; letter-spacing: 0.01em; user-select: all; }
.users-note .hint { margin: 4px 0 0; color: inherit; }
.users-add { border-top: 1px solid var(--rule); padding-top: 14px; }
.users-add h3 { margin: 0 0 10px; font-size: 15px; }
.users-add-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .users-add-grid { grid-template-columns: 1fr; } }

/* 1.4: страница входа */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--canvas); }
.login-card { width: min(380px, 100%); background: var(--sheet); border: 1px solid var(--sheet-edge); border-radius: 10px;
  box-shadow: var(--lift-2); overflow: hidden; }
.login-band { background: var(--band); padding: 18px 24px; display: flex; align-items: center; gap: 12px; }
.login-band .brand-logo { filter: brightness(0) invert(1); }
.login-band .brand-app { color: var(--band-ink); font-weight: 600; font-size: 18px; }
.login-form { padding: 22px 24px 24px; display: grid; gap: 14px; }
.login-form h1 { margin: 0; font-size: 20px; }
.login-form .btn { width: 100%; justify-content: center; padding: 10px; }
