/* ============================================================
   console.css — дизайн-система консоли ВСД
   Фирменный стиль: белый лист, светло-серые зоны, глубокий красный
   как акцент (кнопки действий, активный пункт меню, тонкие детали).
   Красным не заливаем большие площади — он работает точечно.

   Порядок разделов:
     1. токены        6. каркас консоли     11. модальные окна
     2. типографика   7. карточки           12. состояния
     3. кнопки        8. таблицы            13. журнал изменений
     4. поля          9. чипы и статусы     14. утилиты
     5. вход         10. фильтры            15. лендинг
                                            16. мобильная адаптация
   Новые разделы собираются из этих классов — своего CSS не пишем.
   ============================================================ */

/* ============================================================
   1. ТОКЕНЫ
   ============================================================ */
:root {
  /* фирменный красный */
  --red: #c8102e;
  --red-dark: #a50d26;
  --red-soft: #fdeef1;
  --red-line: #f2c9d2;

  /* поверхности */
  --surface: #ffffff;
  --bg: #f7f7f8;
  --bg-2: #f2f2f4;
  --line: #e5e5e5;
  --line-strong: #d6d6d8;

  /* текст */
  --fg: #1a1a1a;
  --fg-muted: #6b6b70;
  --fg-soft: #9a9aa0;

  /* статусы */
  --ok: #1b8a3f;
  --ok-soft: #eaf6ee;
  --warn: #e6a100;
  --warn-soft: #fdf5e3;
  --danger: #c8102e;
  --danger-soft: #fdeef1;

  /* геометрия */
  --r-sm: 8px;
  --r: 10px;
  --r-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(26, 26, 26, .06);
  --shadow: 0 2px 10px rgba(26, 26, 26, .07);
  --shadow-lg: 0 16px 40px rgba(26, 26, 26, .18);

  --sidebar-w: 244px;
  --topbar-h: 58px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   2. ТИПОГРАФИКА
   ============================================================ */
h1 { font-size: 21px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
.page-sub { color: var(--fg-muted); font-size: 13px; margin-top: 3px; }
.muted { color: var(--fg-muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ============================================================
   3. КНОПКИ
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 550;
  padding: 9px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--bg); }
.btn:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.btn:disabled { opacity: .55; cursor: default; }

.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--red-line); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--red); }
.btn-ghost:hover { background: var(--red-soft); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  display: none;                       /* появляется только на телефоне */
  border: 1px solid transparent; background: transparent;
  color: var(--fg); font-size: 20px; line-height: 1;
  padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer;
}
.icon-btn:hover { background: var(--bg); }

/* ============================================================
   4. ПОЛЯ ВВОДА
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12px; font-weight: 550; color: var(--fg-muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }

input, select, textarea {
  font: inherit; color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}
input:disabled, select:disabled {
  background: var(--bg); color: var(--fg-muted); cursor: not-allowed;
}
select {
  appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%236b6b70' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; }
.form-hint { color: var(--fg-muted); font-size: 12px; }

/* ============================================================
   5. ВХОД
   ============================================================ */
.auth-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 26px 24px;
  display: flex; flex-direction: column; gap: 14px;
  border-top: 3px solid var(--red);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.auth-logo {
  width: 44px; height: 44px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--red); color: #fff; border-radius: var(--r);
  font-weight: 700; font-size: 15px; letter-spacing: .02em;
}
.auth-title { font-size: 15px; font-weight: 650; line-height: 1.25; }
.auth-sub { font-size: 12px; color: var(--fg-muted); }
.auth-hint { font-size: 12px; color: var(--fg-muted); text-align: center; }

/* ============================================================
   6. КАРКАС КОНСОЛИ
   ============================================================ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 0 16px; height: var(--topbar-h); flex: none;
  border-bottom: 1px solid var(--line);
}
.brand-logo {
  width: 32px; height: 32px; flex: none; border-radius: var(--r-sm);
  background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; letter-spacing: .02em;
}
.brand-name { font-weight: 620; font-size: 13px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--fg-muted); }

.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px;
       overflow-y: auto; flex: 1; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--fg-muted); background: none; border: none;
  font: inherit; font-size: 14px; text-align: left; width: 100%;
  cursor: pointer; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg); color: var(--fg); }
.nav-item.active { background: var(--red-soft); color: var(--fg); font-weight: 600; }
.nav-item.active::before {           /* красная полоса слева */
  content: ""; position: absolute; left: 0; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--red);
}
.nav-item.active .nav-icon { color: var(--red); }
.nav-icon svg { width: 18px; height: 18px; display: block; }
.nav-icon { width: 20px; text-align: center; font-size: 15px; flex: none;
  color: var(--fg-muted);
            color: var(--fg-soft); }

/* Функции, которых ещё нет: видны как карта продукта, но не кликаются */
.nav-soon { color: var(--fg-soft); cursor: default; }
.nav-soon:hover { background: none; color: var(--fg-soft); }
.nav-status { font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em;
              color: var(--fg-soft); flex: none; }
.nav-badge {
  flex: none; min-width: 20px; text-align: center;
  background: var(--red); color: #fff; border-radius: 20px;
  font-size: 11.5px; font-weight: 650; padding: 1px 6px;
}
.nav-item.active .nav-badge { background: #fff; color: var(--red); }

.sidebar-foot { border-top: 1px solid var(--line); padding: 12px 14px; flex: none; }
.side-user { font-size: 13px; font-weight: 600; }
.side-role { font-size: 11.5px; color: var(--fg-muted); margin-bottom: 8px; }
.lang-switch { display: flex; gap: 4px; margin-bottom: 8px; }
.lang-switch button {
  flex: 1; font: inherit; font-size: 11.5px; font-weight: 600;
  letter-spacing: .03em; padding: 5px 0;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--fg-muted); cursor: pointer;
}
.lang-switch button.active {
  background: var(--red); border-color: var(--red); color: #fff;
}

.side-logout {
  color: var(--fg-muted); background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); padding: 6px 10px; font: inherit; font-size: 12.5px;
  cursor: pointer; width: 100%;
}
.side-logout:hover { background: var(--bg); color: var(--fg); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: none;
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-org { color: var(--fg-muted); font-size: 13px; }
.topbar-org::before { content: "·"; margin: 0 8px; color: var(--fg-soft); }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--red-soft); color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-weight: 650; font-size: 12px; flex: none;
}

.page { padding: 22px 24px 40px; flex: 1; }
.page-head { display: flex; align-items: flex-start; gap: 12px;
             flex-wrap: wrap; margin-bottom: 16px; }
.page-head .grow { flex: 1; min-width: 200px; }

.scrim { position: fixed; inset: 0; background: rgba(26, 26, 26, .4);
         z-index: 25; display: none; }
.scrim.show { display: block; }

/* ============================================================
   7. КАРТОЧКИ
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-head .grow { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }
.card-foot {
  padding: 11px 16px; border-top: 1px solid var(--line);
  background: var(--bg); border-radius: 0 0 var(--r) var(--r);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; }
.kv dt { color: var(--fg-muted); font-size: 13px; }
.kv dd { font-size: 13.5px; }

.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 16px; min-width: 130px; flex: 1;
}
.stat-label { font-size: 12px; color: var(--fg-muted); }
.stat-value { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }

/* ============================================================
   8. ТАБЛИЦЫ
   Одна разметка на десктоп и телефон: на узком экране строка
   превращается в карточку, подписи берутся из data-label.
   ============================================================ */
/* Обёртка со скроллом: у краёв — градиент, видно, что таблица шире экрана */
.table-scroll { position: relative; }
.table-scroll::before, .table-scroll::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 30px;
  pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 2;
}
.table-scroll::after {
  right: 0;
  background: linear-gradient(to left, rgba(26, 26, 26, .14),
                                       rgba(26, 26, 26, 0));
}
.table-scroll::before {
  left: 0;
  background: linear-gradient(to right, rgba(26, 26, 26, .14),
                                        rgba(26, 26, 26, 0));
}
.table-scroll.more-right::after, .table-scroll.more-left::before { opacity: 1; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }

/* Узкая колонка ужимается по содержимому (№, дата) */
th.col-narrow, td.col-narrow { width: 1%; white-space: nowrap; }
/* Широкая текстовая: две строки с раскрытием по клику */
th.col-wide, td.col-wide { min-width: 220px; max-width: 340px; }
.clamp2 {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; cursor: pointer;
}
.clamp2.open { -webkit-line-clamp: unset; line-clamp: unset; }
thead th {
  text-align: left; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--fg-muted);
  background: var(--bg);
  padding: 9px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 9px 14px; border-bottom: 1px solid var(--line);
  font-size: 13.5px; vertical-align: middle;
}
tbody tr:nth-child(even) { background: #fafafa; }     /* зебра */
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--red-soft); }
td.right, th.right { text-align: right; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--fg-muted); margin-top: 1px; }

/* Карточка заявки на согласование */
.req-card + .req-card { margin-top: 12px; }
.req-amount { font-size: 19px; font-weight: 680; white-space: nowrap;
              font-variant-numeric: tabular-nums; }
.req-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
            margin-bottom: 8px; }
.req-line { font-size: 13.5px; line-height: 1.55; }
.req-line + .req-line { margin-top: 2px; }
.req-card .card-foot { justify-content: flex-start; }

/* ============================================================
   9. ЧИПЫ И СТАТУСЫ
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 550; line-height: 1.5;
  padding: 2px 9px; border-radius: 20px;
  background: var(--bg-2); color: var(--fg-muted); white-space: nowrap;
}
.chip-brand { background: var(--red-soft); color: var(--red); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }

/* самовывозы: крупный бейдж статуса оплаты (склад и касса) */
.pay-badge { display: inline-block; font-weight: 700; font-size: 14px;
  padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.pay-paid { background: var(--ok-soft); color: var(--ok); }
.pay-wait { background: var(--warn-soft); color: #8a6200; }
.pay-transfer { background: #E8F0FA; color: #0F4C81; }
.pay-partial { background: var(--warn-soft); color: #8a6200; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* Переключатель отчётов/видов */
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.seg-item {
  font: inherit; font-size: 13.5px; font-weight: 550;
  padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--fg-muted); cursor: pointer; white-space: nowrap;
}
.seg-item:hover { background: var(--bg); color: var(--fg); }
.seg-item.active {
  background: var(--red); border-color: var(--red); color: #fff;
}

/* вкладка «Самовывозы» в кассе: счётчики и состояния */
.seg-badge { display: inline-block; min-width: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
  vertical-align: middle; }
.seg-item.active .seg-badge { background: #fff; color: var(--red); }
.pk-cnt { display: inline-block; min-width: 17px; padding: 0 5px;
  border-radius: 9px; background: var(--bg-2); color: var(--fg-muted);
  font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; }
.disp-sect.pk-sect-danger { color: var(--danger); }
.disp-sect.pk-sect-ok { color: var(--ok); }
.card-head .head-metric { display: flex; flex-direction: column;
  align-items: flex-end; gap: 1px; }
.card-head .hm-label { font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em; color: var(--fg-muted); }
.card-head .hm-val { font-size: 16px; font-weight: 700; color: var(--red-dark);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.pk-list .hist-row { align-items: flex-start; }
.pk-list .hist-num { flex: 1 1 auto; min-width: 0; max-width: 46%;
  overflow-wrap: anywhere; }
.pk-list .hist-emp { white-space: normal; }
.qr-notfound { margin: 0 0 10px; border-left: 4px solid var(--warn);
  font-size: 13.5px; }
.chip-info { background: #E8F1FB; color: #1B5E9E; }
.ts-box { border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 12px; }
.ts-line { display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; padding: 2px 0;
  font-variant-numeric: tabular-nums; }
.ts-line.ts-total { border-top: 1px solid var(--line-strong);
  margin-top: 4px; padding-top: 6px; font-weight: 700;
  font-size: 14.5px; }
.rt-trip { cursor: pointer; }
.rt-trip .hist-emp { white-space: normal; }
.rt-trip:hover { background: var(--bg); }
.rt-body { border-left: 3px solid var(--line-strong);
  margin: 0 0 6px 8px; padding-left: 8px; }
.rt-hit { background: var(--warn-soft); }
.ts-emp { cursor: pointer; }
.ts-emp:hover td { background: var(--bg); }
.ts-role td { color: var(--fg-muted); font-size: 12.5px;
  background: var(--bg-1); }
.ts-role-name { padding-left: 26px; }
.ts-total td { border-top: 2px solid var(--line-strong);
  background: #FFF9E6; }

/* Итоги над таблицей: липнут под шапкой, чтобы сумма всегда была видна */
.totals-bar {
  position: sticky; top: var(--topbar-h); z-index: 15;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-sm);
  padding: 12px 16px; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 9px;
  transition: opacity .15s;
}
.totals-bar.is-loading { opacity: .45; }
.totals-main { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.totals-value {
  font-size: 26px; font-weight: 680; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.totals-unit { color: var(--fg-muted); font-size: 14px; }
.totals-count { margin-left: auto; color: var(--fg-muted); font-size: 13px; }
.totals-chips {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.tgroup-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--fg-soft); margin-right: 2px; flex: none;
}
.tchip {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-size: 12.5px; padding: 3px 10px; border-radius: 20px;
  background: var(--bg); border: 1px solid var(--line); white-space: nowrap;
}
.tchip b { font-variant-numeric: tabular-nums; }
.tchip .c { color: var(--fg-muted); font-size: 11.5px; }
.tchip-more { cursor: pointer; color: var(--red);
              background: var(--red-soft); border-color: var(--red-line); }
.tchip-more:hover { background: #fbe3e8; }

/* ============================================================
   10. ФИЛЬТРЫ
   ============================================================ */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.filters .search { flex: 1; min-width: 220px; max-width: 420px; }
.filters select { width: auto; min-width: 150px; }
.filters input[type="date"] { width: auto; min-width: 150px; }
.filters .spacer { flex: 1; }

/* ============================================================
   11. МОДАЛЬНЫЕ ОКНА
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(26, 26, 26, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.modal {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; max-height: 90dvh;  /* dvh сжимается с клавиатурой */
  display: flex; flex-direction: column;
}
.modal.narrow { max-width: 420px; }
.modal-head {
  padding: 16px 20px 12px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 10px; flex-shrink: 0;
}
.modal-head .grow { flex: 1; min-width: 0; }
.modal-close {
  border: none; background: none; font-size: 20px; line-height: 1;
  color: var(--fg-soft); cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.modal-close:hover { background: var(--bg); color: var(--fg); }
.modal-body { padding: 18px 20px; overflow-y: auto;
  /* без flex:1 + min-height:0 флекс-ребёнок не ужимается ниже контента:
     длинный список раздувал модалку за вьюпорт и футер уезжал вниз */
  flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  /* футер ВНЕ прокручиваемой области (тело скроллится само) —
     физически не может уехать; sticky не нужен */
  flex-shrink: 0; background: var(--surface);
}

.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 19px; font-weight: 600; letter-spacing: .08em;
  background: var(--red-soft); color: var(--fg);
  border: 1px dashed var(--red); border-radius: var(--r-sm);
  padding: 13px; text-align: center; user-select: all; word-break: break-all;
}

.notice { border-radius: var(--r-sm); padding: 10px 13px; font-size: 13px;
          border: 1px solid transparent; }
.notice-warn { background: var(--warn-soft); color: #8a6200;
               border-color: #f0e0b8; }
.notice-info { background: var(--bg); color: var(--fg-muted);
               border-color: var(--line); }
.notice-danger { background: var(--danger-soft); color: var(--danger);
                 border-color: var(--red-line); }

/* ============================================================
   12. СОСТОЯНИЯ
   ============================================================ */
.empty { text-align: center; padding: 40px 16px; color: var(--fg-muted); }
.empty-icon { font-size: 26px; opacity: .5; display: block; margin-bottom: 8px; }
.loading { display: flex; align-items: center; justify-content: center;
           gap: 10px; padding: 40px 16px; color: var(--fg-muted); }
.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--red);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   13. ЖУРНАЛ ИЗМЕНЕНИЙ
   ============================================================ */
.log-list { display: flex; flex-direction: column; }
.log-item { padding: 9px 0; border-top: 1px solid var(--line); }
.log-item:first-child { border-top: none; }
.log-main { font-size: 13.5px; }
.log-meta { font-size: 12px; color: var(--fg-muted); margin-top: 1px; }
.log-old { color: var(--fg-muted); text-decoration: line-through; }
.log-new { font-weight: 600; }

/* ============================================================
   14. УТИЛИТЫ И ТОСТЫ
   ============================================================ */
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 7px; }
.grow { flex: 1; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.mt { margin-top: 14px; }
.mt-sm { margin-top: 8px; }
.mb-sm { margin-bottom: 8px; }
/* sticky-таблица кассы: ЕДИНСТВЕННЫЙ скролл-контейнер — .table-scroll
   (и вертикаль, и горизонталь), иначе sticky прилипает не туда */
.sticky-table .table-scroll { max-height: 68vh; overflow: auto; }
.sticky-table .table-wrap { overflow: visible; }
.sticky-table thead th { position: sticky; top: 0; z-index: 3; }
/* строка итогов сразу под sticky-шапкой — тоже липнет */
.sticky-table thead td.head-totals { position: sticky; z-index: 3;
  background: #FFF9E6; font-weight: 600; font-size: 12.5px;
  padding: 5px 8px; border-bottom: 2px solid var(--line);
  text-align: right; font-variant-numeric: tabular-nums; }
/* итоги реестра колонками, а не строкой текста */
.head-totals .reg-totals { display: flex; flex-wrap: wrap; text-align: left; }
.head-totals .rt-cell { flex: 1 1 0; min-width: 92px; display: flex;
  flex-direction: column; gap: 1px; padding: 2px 12px;
  border-right: 1px solid var(--line); }
.head-totals .rt-cell:last-child { border-right: none; }
.head-totals .rt-label { font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em; color: var(--fg-muted); }
.head-totals .rt-val { font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.head-totals .rt-cash { background: var(--red-soft); margin: -2px 0;
  padding-top: 4px; padding-bottom: 4px; }
.head-totals .rt-cash .rt-label { color: var(--red-dark); }
.head-totals .rt-cash .rt-val { color: var(--red-dark); }
.head-totals .rt-pend .rt-val { color: var(--fg-soft); }
.head-totals .rt-pend .rt-label { color: var(--fg-soft); }
.sticky-table tr.row-total td { position: sticky; bottom: 0;
  background: var(--bg); z-index: 2; }
@media (max-width: 720px) {
  /* мобайл: таблица становится карточками — sticky отключается */
  .sticky-table .table-scroll { max-height: none; overflow: visible; }
  .sticky-table thead th,
  .sticky-table thead td.head-totals,
  .sticky-table tr.row-total td { position: static; }
}
/* сумма накладной над кнопками оплаты */
.pay-amount { font-size: 26px; font-weight: 700; text-align: center; }
/* расформированные: серым, действия недоступны */
.row-muted { opacity: .55; }
.row-danger { box-shadow: inset 3px 0 0 var(--danger);
  background: var(--danger-soft); }
/* склад с телефона: крупные сворачиваемые плашки водитель·рейс */
.wh-plate {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; margin: 6px 0 4px; border: none;
  border-radius: 8px; background: #1A1A1A; color: #fff;
  font-size: 15.5px; font-weight: 600; text-align: left; cursor: pointer;
}
.wh-plate .sub { display: block; font-size: 13px; font-weight: 400;
  opacity: .8; margin-top: 2px; }
.wh-plate .arr { margin-left: auto; font-size: 15px; opacity: .7; }
.wh-date-head { font-size: 15px; font-weight: 700; margin: 14px 4px 2px;
  color: var(--fg-muted); text-transform: uppercase; }
.ret-plate { background: #7A1420; }
/* очерёдность рейсов: 1 — фирменный красный, дальше светлее */
.wh-plate.wh-t1 { background: #C8102E; }
.wh-plate.wh-t2 { background: #DE5C71; }
.wh-plate.wh-t3 { background: #EFA3B0; color: #3A0710; }
.wh-plate.wh-t3 .sub { opacity: .75; }
.wh-plate.wh-t0 { background: #5A5A5A; }
/* миниатюры фото приёмки: 140px в ряд, клик — полный размер */
.wg-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.wg-thumb { width: 140px; height: 140px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in;
  display: block; background: var(--bg); }
@media (max-width: 720px) { .wg-thumb { width: 120px; height: 120px; } }
.wg-detail { border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin: 0 0 10px; background: var(--card, #fff); }
/* превью фото с удалением (приёмка вагонов) */
.ph-wrap { position: relative; display: inline-block; margin: 0 6px 6px 0; }
.ph-del { position: absolute; top: -7px; right: -7px; width: 22px;
  height: 22px; border: none; border-radius: 50%; background: #C8102E;
  color: #fff; font-size: 12px; line-height: 22px; cursor: pointer;
  padding: 0; }
/* фильтры одним компактным рядом (Отгруженные) */
.filters-compact { flex-wrap: nowrap; overflow-x: auto; gap: 6px; }
.filters-compact .search { min-width: 150px; }
.filters-compact select, .filters-compact input[type="date"] {
  min-width: 108px; flex: 0 0 auto; }
@media (max-width: 720px) {
  #whBody .btn { min-height: 44px; }
  .wh-plate { font-size: 15px; }
}
/* итоговая строка таблицы */
tr.cash-manual-row td { background: #FFF9E6; }
tr.row-gap td { background: #FDECEC; }
tr.row-gap td:first-child { box-shadow: inset 3px 0 0 #C8102E; }
tr.row-total td { font-weight: 700; border-top: 2px solid var(--line);
  background: var(--bg); }
/* наличка, изменённая кассиром вручную */
.cash-manual { background: #FFF3CD; border-radius: 6px;
  padding: 2px 6px; cursor: pointer; }
.cash-edit { cursor: pointer; border-bottom: 1px dashed var(--fg-muted); }
/* QR-контроль: водитель отметил QR, а платежа в сверенной выписке нет */
.qr-missing { color: #C8102E; font-weight: 700; }
.ok-text { color: #1B7A3D; }
.warn-text { color: #A66B00; }
.row-muted .hist-num b { text-decoration: line-through; }
.mb { margin-bottom: 14px; }

.toast-box {                            /* угол экрана, не перекрывает работу */
  position: fixed; z-index: 60; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none; max-width: min(92vw, 420px);
}
.toast {
  background: var(--fg); color: #fff;
  border-radius: var(--r-sm); padding: 10px 15px;
  font-size: 13px; line-height: 1.4; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
.toast.in { opacity: 1; transform: none; }
.toast-error { background: var(--danger); }
.toast-ok { background: var(--ok); }

/* ============================================================
   15. МОИ ЗАЯВКИ И PWA
   ============================================================ */
.my-card { display: flex; align-items: flex-start; gap: 12px;
           padding: 13px 15px; }
.my-card + .my-card { border-top: 1px solid var(--line); }
.my-card .grow { min-width: 0; }
.my-title { font-weight: 600; font-size: 14.5px; }
.my-sub { font-size: 13px; color: var(--fg-muted); margin-top: 1px; }
.my-line { font-size: 12.5px; color: var(--fg-muted); margin-top: 2px; }
.my-amount { font-weight: 650; white-space: nowrap;
             font-variant-numeric: tabular-nums; }
.my-card.wait { border-left: 3px solid var(--warn); }
.my-card.ok { border-left: 3px solid var(--ok); }
.my-card.bad { border-left: 3px solid var(--danger); }

.bell { position: relative; }
.bell-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px;
  background: var(--red); color: #fff; border-radius: 20px;
  font-size: 11px; font-weight: 650; padding: 0 5px; text-align: center;
}
.note-item { padding: 9px 0; border-top: 1px solid var(--line);
             font-size: 13.5px; white-space: pre-line; }
.note-item:first-child { border-top: none; }
.note-item.unread { font-weight: 550; }
.note-at { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }

.type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.type-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 10px; border: 1px solid var(--line-strong);
  border-radius: var(--r); background: var(--surface); cursor: pointer;
  font: inherit; text-align: center;
}
.type-btn:hover { border-color: var(--red); background: var(--red-soft); }
.type-btn .ic { font-size: 24px; line-height: 1; }
.type-btn .nm { font-size: 13.5px; font-weight: 550; }

.done-num {
  font-size: 20px; font-weight: 680; text-align: center;
  background: var(--red-soft); border-radius: var(--r-sm); padding: 12px;
}

/* Группы видов заявок на экране «Подать заявку» */
.type-group + .type-group { margin-top: 16px; }
.type-group-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--fg-muted); margin: 0 0 8px;
}
/* на широком экране групп больше — карточки в три колонки */
@media (min-width: 901px) {
  .type-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Карточка запроса согласия — выделена, это требует действия */
.consent-card { border-left: 3px solid var(--red); }

/* Сворачиваемый блок («Последние решения») */
.collapse-head { cursor: pointer; user-select: none; }
.collapse-head:hover { background: var(--bg); }
.collapse-arrow { font-size: 15px; color: var(--fg-soft); flex: none; }

/* Приглушённый счётчик на вкладке (есть записи, но решать нечего) */
.seg-dim { opacity: .55; font-weight: 400; }

/* Компактные строки истории решений */
.hist-list { display: flex; flex-direction: column; }
.hist-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 4px; border-top: 1px solid var(--line); font-size: 13px;
}
.hist-row:first-child { border-top: none; }
.hist-num { flex: none; font-weight: 600; min-width: 110px; }
.hist-emp { flex: 1; min-width: 0; overflow: hidden;
            text-overflow: ellipsis; white-space: nowrap; }
.hist-val { flex: none; font-variant-numeric: tabular-nums;
            color: var(--fg-muted); }
.hist-status { flex: none; white-space: nowrap; }
.hist-at { flex: none; color: var(--fg-soft); font-size: 12px;
           white-space: nowrap; }

/* Чек в карточке: маленькое превью, клик — полный размер */
.receipt-box {
  display: inline-flex; align-items: center; margin-top: 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  overflow: hidden; cursor: zoom-in; background: var(--bg);
}
.receipt-thumb { display: block; width: 84px; height: 84px;
                 object-fit: cover; }
.receipt-pdf { display: none; font-size: 13px; font-weight: 550;
               padding: 10px 14px; }
.receipt-box.is-pdf { cursor: pointer; }
.receipt-box.is-pdf .receipt-thumb { display: none; }
.receipt-box.is-pdf .receipt-pdf { display: inline; }
.receipt-full { max-width: 100%; max-height: 70vh; display: block;
                margin: 0 auto; border-radius: var(--r-sm);
                cursor: zoom-in; }

/* Распределение: две колонки, на телефоне одна */
.disp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.disp-sect { font-size: 11.5px; font-weight: 600; text-transform: uppercase;
             letter-spacing: .04em; color: var(--fg-muted);
             padding: 10px 14px 4px; }
.disp-item { display: flex; align-items: center; gap: 10px;
             padding: 9px 14px; border-top: 1px solid var(--line);
             font-size: 13.5px; cursor: default; }
.disp-item input[type="checkbox"] { width: auto; }
.disp-group { background: var(--bg-2); font-weight: 500; }
.disp-groupbody { border-top: 1px solid var(--line); }
.disp-sub { display: flex; align-items: center; gap: 10px;
            padding: 7px 14px 7px 28px; border-top: 1px solid var(--line);
            font-size: 12.5px; background: var(--bg-1); }
.disp-sub:first-child { border-top: none; }
.veh-card + .veh-card { margin-top: 12px; }

/* Прогресс точек */
.progress-wrap { background: var(--bg-2); border-radius: 20px; height: 8px;
                 overflow: hidden; min-width: 90px; margin-bottom: 3px; }
.progress-bar { background: var(--ok); height: 100%; border-radius: 20px;
                transition: width .3s; }

/* Вычерки водителя */
.cut-row { display: flex; align-items: center; gap: 10px; }

/* Самовывозы на складе и доске */
.pickup-today { background: var(--warn-soft); border-radius: var(--r-sm); }
.pickup-overdue { background: var(--danger-soft); border-radius: var(--r-sm); }
.pickup-overdue .hist-emp { color: var(--danger); font-weight: 550; }

@media (max-width: 900px) {
  .disp-grid { grid-template-columns: 1fr; }
}

.install-bar {
  position: sticky; bottom: 0; z-index: 18;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(26, 26, 26, .07);
  padding: 10px 14px;
}

/* ============================================================
   16. ЛЕНДИНГ (страница до входа)
   ============================================================ */
.lp-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--line);
  height: 64px; display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
}
.lp-header .brand-logo { width: 36px; height: 36px; font-size: 13px; }
.lp-header .grow { flex: 1; }

.lp-hero { background: var(--surface); padding: 56px 24px 40px;
           text-align: center; border-bottom: 1px solid var(--line); }
.lp-hero h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.02em; }
.lp-hero .accent { color: var(--red); }
.lp-slogan { font-size: 17px; color: var(--fg-muted); margin-top: 12px; }
.lp-note { font-size: 13px; color: var(--fg-soft); margin-top: 8px; }

.lp-chips {                          /* девять функций: 3×3 на десктопе */
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 26px 20px; max-width: 720px; margin: 34px auto 0; padding: 0 8px;
}
.lp-chip {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  background: none; border: none; font: inherit; cursor: pointer;
  color: var(--fg); text-decoration: none;
}
.lp-chip-circle svg { width: 34px; height: 34px; color: var(--red); }
.lp-chip-circle {
  width: 92px; height: 92px; border-radius: 50%;
  border: 2px solid var(--red-line); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; line-height: 1;
  transition: border-color .15s, background .15s, transform .15s;
}
.lp-chip:hover .lp-chip-circle svg { width: 34px; height: 34px; color: var(--red); }
.lp-chip-circle {
  border-color: var(--red); background: var(--red-soft);
  transform: translateY(-2px);
}
.lp-chip-label { font-size: 13.5px; font-weight: 600; }
.lp-chip-note { font-size: 11.5px; color: var(--fg-soft); }

.lp-section { padding: 54px 24px; scroll-margin-top: 64px; }
.lp-section:nth-of-type(even) { background: var(--surface); }
.lp-section:nth-of-type(odd) { background: var(--bg); }
.lp-inner { max-width: 780px; margin: 0 auto; }
.lp-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--red);
  border: 1px solid var(--red-line); background: var(--surface);
  border-radius: 20px; padding: 3px 11px; margin-bottom: 14px;
}
.lp-section h2 { font-size: 25px; letter-spacing: -.01em; }
.lp-lead { font-size: 15.5px; color: var(--fg-muted); margin-top: 10px; }
.lp-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.lp-list li { list-style: none; padding-left: 22px; position: relative;
              font-size: 14.5px; }
.lp-list li::before {
  content: ""; position: absolute; left: 4px; top: 8px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--red);
}
.lp-actions { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }

.lp-footer {
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 26px 24px; text-align: center;
  color: var(--fg-muted); font-size: 12.5px;
}

/* ============================================================
   16. МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================================ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .icon-btn { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .topbar-org { display: none; }
  .topbar-user .name { display: none; }
  .page { padding: 16px 12px 40px; }

  /* таблица → карточки */
  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr {
    background: var(--surface) !important;
    border: 1px solid var(--line); border-radius: var(--r);
    box-shadow: var(--shadow-sm); padding: 6px 2px; margin-bottom: 10px;
  }
  tbody tr:last-child { margin-bottom: 0; }
  tbody td {
    border: none; padding: 6px 13px;
    display: flex; align-items: baseline; gap: 12px; font-size: 13.5px;
  }
  tbody td::before {
    content: attr(data-label);
    flex: none; width: 42%; max-width: 150px;
    color: var(--fg-muted); font-size: 12px;
  }
  tbody td.cell-primary { display: block; padding-top: 10px; }
  tbody td.cell-primary::before { content: none; }
  tbody td.actions { display: flex; justify-content: flex-start;
                     padding: 10px 13px 12px; gap: 8px; }
  tbody td.actions::before { content: none; }
  tbody td.actions .btn { flex: 1; margin: 0 !important; }
  tbody td.hide-mobile { display: none; }

  .kv { grid-template-columns: 118px 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .filters .search { max-width: none; }
  .filters select, .filters input[type="date"] { flex: 1; min-width: 130px; }

  /* 16px — иначе iOS зумит страницу при фокусе */
  input, select, textarea { font-size: 16px; }

  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: none; max-height: 100vh; max-height: 100dvh;
           border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .modal-foot .btn { flex: 1; }
  /* главная кнопка («Выдано»/«Сохранить») — ПЕРВОЙ: при открытой
     клавиатуре и переносе кнопок видна именно она, а не «Отмена» */
  .modal-foot .btn-primary { order: -1; }
  .modal-foot { border-radius: 0; }

  .toast-box { right: 12px; left: 12px; bottom: 12px; max-width: none;
               align-items: stretch; }

  /* история решений на телефоне: строка в две линии, время под номером */
  .hist-row { flex-wrap: wrap; row-gap: 2px; }
  .hist-emp { flex-basis: 100%; order: 5; }

  /* лендинг: фишки в две колонки */
  .lp-header { padding: 0 14px; }
  .lp-hero { padding: 38px 16px 30px; }
  .lp-hero h1 { font-size: 26px; }
  .lp-slogan { font-size: 15px; }
  .lp-chips { grid-template-columns: repeat(2, 1fr); gap: 18px 12px;
              margin-top: 26px; }
  .lp-chip-circle svg { width: 34px; height: 34px; color: var(--red); }
.lp-chip-circle { width: 80px; height: 80px; font-size: 26px; }
  .lp-section { padding: 38px 16px; }
  .lp-section h2 { font-size: 21px; }
  .lp-actions .btn { flex: 1; }

  .seg { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }

  /* Итоги остаются сверху и липкими; чипы прокручиваются вбок */
  .totals-bar { padding: 11px 13px; gap: 8px; }
  .totals-value { font-size: 22px; }
  .totals-count { margin-left: 0; width: 100%; }
  .totals-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  /* строка превращается в карточку — боковых теней быть не должно */
  .table-scroll::before, .table-scroll::after { content: none; }
  th.col-wide, td.col-wide { max-width: none; min-width: 0; }
  .clamp2 { -webkit-line-clamp: 3; line-clamp: 3; }
}

/* переплаты: строки-варианты решения (блок 5, Д) */
.radio-row { display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 4px 0; }
.radio-row input { margin: 0; }


/* компактная разбивка реестра (касса; список реестров бэкофиса) */
.tbl-compact td { padding: 4px 6px; line-height: 1.3; }
.tbl-compact th { padding: 6px; }
.tbl-compact .cell-sub { font-size: 11px; line-height: 1.25;
  margin-top: 0; }
.tbl-compact .chip { padding: 0 5px; font-size: 10.5px;
  line-height: 16px; }
.tbl-compact .pt-line { display: flex; align-items: center; gap: 6px;
  min-width: 0; }
.tbl-compact .pt-name { font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0;
  flex: 1 1 auto; max-width: 34ch; }
.tbl-compact .pt-badges { display: inline-flex; gap: 3px; flex: none; }
.sticky-table thead td.tot-cell { position: sticky; z-index: 3;
  background: #FFF9E6; font-weight: 700; font-size: 12.5px;
  padding: 4px 6px; border-bottom: 2px solid var(--line);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.tot-cell.rt-cash-cell { background: var(--red-soft);
  color: var(--red-dark); }
th.has-tip { cursor: help; }
th.has-tip .th-tip { border-bottom: 1px dotted currentColor; }
.hist-compact .hist-row { padding: 5px 10px; }
@media (max-width: 720px) {
  .sticky-table thead td.tot-cell { position: static; }
}

/* ============================================================
   РАЗДЕЛ «КАДРЫ» — табель (сетка сотрудник × дни)
   Цвета кодов те же, что в XLSX (services/timesheet.XLSX_FILL)
   ============================================================ */
.ts-wrap { overflow: auto; max-height: calc(100vh - 260px); border: 1px solid var(--line); border-radius: var(--r); }
.ts-grid { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
.ts-grid th, .ts-grid td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; height: 26px; text-align: center; white-space: nowrap; }
.ts-grid thead th { position: sticky; top: 0; background: var(--bg-2); z-index: 3; font-weight: 600; padding: 4px 3px; }
.ts-grid thead th .wd { display: block; font-size: 10px; font-weight: 400; color: var(--fg-muted); }
.ts-grid thead th.wk { background: #e8e8e8; }
.ts-grid td.ts-name, .ts-grid th.ts-name { position: sticky; left: 0; background: var(--surface); text-align: left; padding: 3px 8px; min-width: 200px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; z-index: 2; border-right: 2px solid var(--line-strong); }
.ts-grid thead th.ts-name { z-index: 4; background: var(--bg-2); }
.ts-grid td.ts-name .pos { display: block; font-size: 10.5px; color: var(--fg-muted); font-weight: 400; }
.ts-grid tr.ts-dept td { background: var(--bg-2); text-align: left; font-weight: 600; padding: 4px 8px; position: sticky; left: 0; }
.ts-grid td.ts-cell { min-width: 30px; cursor: default; position: relative; }
.ts-grid td.ts-cell.editable { cursor: pointer; }
.ts-grid td.ts-cell.editable:hover { outline: 2px solid var(--red); outline-offset: -2px; }
.ts-grid td.ts-cell.wk { background: #ededed; }
.ts-grid td.ts-cell.c-8 { background: #e2f0d9; }
.ts-grid td.ts-cell.c-8p { background: #c6e0b4; }
.ts-grid td.ts-cell.c-8z { background: #ddebf7; }
.ts-grid td.ts-cell.c-o { background: #fff2cc; }
.ts-grid td.ts-cell.c-ot { background: #fce4d6; }
.ts-grid td.ts-cell.c-b { background: #f8cbad; }
.ts-grid td.ts-cell.c-k { background: #d9d2e9; }
.ts-grid td.ts-cell.c-nn { background: #ffb3b3; }
.ts-grid td.ts-cell.ov { font-weight: 700; box-shadow: inset 0 0 0 2px #444; }
.ts-grid td.ts-cell.nt::after { content: ''; position: absolute; right: 2px; bottom: 2px; width: 6px; height: 6px; border-radius: 50%; background: #2f75b5; }
.ts-grid td.ts-cell.conf { box-shadow: inset 0 0 0 2px var(--red); }
.ts-grid td.ts-cell.future { color: var(--fg-muted); }
.ts-grid td.ts-tot { background: var(--bg-2); font-weight: 600; min-width: 34px; }
.ts-grid td.ts-tot.dim { color: var(--fg-muted); font-weight: 400; }
.ts-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--fg-muted); margin-top: 10px; }
.ts-legend .sw { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; border: 1px solid var(--line); border-radius: 3px; }
.ts-pal { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ts-pal button { font: inherit; padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; }
.ts-pal button.cur { background: var(--red); border-color: var(--red); color: #fff; }
.ts-hist { font-size: 12px; color: var(--fg-muted); margin-top: 8px; max-height: 140px; overflow: auto; }
.ts-hist div { padding: 3px 0; border-bottom: 1px dashed var(--line); }
@media (max-width: 720px) {
  .ts-grid td.ts-name, .ts-grid th.ts-name { min-width: 140px; max-width: 160px; }
  .ts-wrap { max-height: calc(100vh - 220px); }
}

/* «Отчёты»: ссылка «→» на рабочий экран в полосе группы */
.seg-item.seg-link { border-style: dashed; }
.seg-item.seg-link .muted { margin-left: 4px; }

/* ============================================================
   17. «РУКОВОДСТВО → ДАШБОРД» (дашборд директора, services/director_dash)
   Mobile-first: 360–414 px без горизонтального скролла страницы; KPI по
   2 в ряд, таблица типов → карточки; графики скроллятся только внутри.
   Цвета — только токены (тёмная тема консоли появится — подхватит).
   ============================================================ */
.dd-lead-seg { margin-bottom: 10px; }
.dd-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
               margin-bottom: 14px; }
.dd-controls input[type="date"] { min-height: 44px; font-size: 16px; width: auto;
  padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--fg); font-family: inherit; }
.dd-controls .btn { min-height: 44px; }
.dd-seg { margin-bottom: 0; }
.dd-seg .seg-item { min-height: 44px; padding: 10px 14px; }
.dd-seg-sm { margin-bottom: 0; }
.dd-seg-sm .seg-item { min-height: 36px; padding: 6px 12px; }
/* три группы × 3 карточки: на телефоне 3 в строку (≈110 px каждая на
   375 px), поэтому цифра 17 px и перенос по любому месту */
.dd-groups { display: grid; gap: 12px; margin-bottom: 16px; }
@media (min-width: 901px) { .dd-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dd-group { min-width: 0; }
.dd-group-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
                 margin: 0 2px 6px; }
.dd-group-head h2 { font-size: 15px; }
.dd-axis { font-size: 11px; color: var(--fg-soft); }
.dd-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dd-group-foot { margin: 6px 2px 0; line-height: 1.5; overflow-wrap: anywhere; }
.dd-kpi { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 10px; min-width: 0; cursor: pointer;
  box-shadow: var(--shadow-sm); -webkit-tap-highlight-color: transparent; }
.dd-kpi.full { border-color: var(--red-line); background: var(--red-soft); }
.dd-kpi-label { font-size: 12px; color: var(--fg-muted); line-height: 1.3; }
/* ось показателя отдельной строкой, без nowrap — иначе на 375 px тег
   выталкивал карточку за экран */
.dd-tag { display: block; font-size: 9.5px; text-transform: uppercase;
          letter-spacing: .04em; color: var(--fg-soft); margin-top: 1px; }
.dd-kpi-val { font-size: 22px; font-weight: 700; letter-spacing: -.01em;
  line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere; }
.dd-kpi-sub { font-size: 12px; color: var(--fg-muted); margin-top: 4px; overflow-wrap: anywhere; }
.dd-kpi-sub .chip { font-size: 11px; padding: 1px 7px; }
.dd-kpi-mtd { font-size: 12px; color: var(--fg-soft); margin-top: 3px; overflow-wrap: anywhere; }
.dd-progress { height: 6px; background: var(--bg-2); border-radius: 3px;
               overflow: hidden; margin-top: 6px; }
.dd-progress i { display: block; height: 100%; background: var(--red); }
.dd-type { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.dd-type:last-child { border-bottom: none; }
.dd-type:hover { background: var(--bg); }
.dd-type-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dd-type-pct { font-weight: 700; color: var(--red-dark); font-variant-numeric: tabular-nums; }
.dd-type-nums { font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }
.dd-type-money { font-size: 12.5px; color: var(--fg-muted); margin-top: 6px; line-height: 1.6; }
.dd-table td, .dd-table th { font-variant-numeric: tabular-nums; }
.dd-hint { padding: 8px 14px; }
.dd-phone { display: block; }
.dd-desktop { display: none; }
@media (min-width: 901px) { .dd-phone { display: none; } .dd-desktop { display: block; } }
.dd-charts { display: grid; gap: 16px; margin-top: 16px; }
@media (min-width: 901px) { .dd-charts { grid-template-columns: 1fr 1fr; } }
/* грид-ячейка по умолчанию min-width:auto — широкий SVG растянул бы
   карточку и всю страницу; скролл только внутри .dd-chart-scroll */
.dd-charts .card { margin-top: 0; min-width: 0; }
.dd-chart-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.dd-chart { display: block; width: 100%; height: auto; }
.dd-chart .dd-hit { cursor: pointer; }
.dd-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px;
             color: var(--fg-muted); margin-top: 6px; }
.dd-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px;
               margin-right: 4px; vertical-align: -1px; }
.dd-alerts { margin-bottom: 16px; }
.dd-alerts .card-head { cursor: pointer; }
.dd-badge { display: inline-block; min-width: 20px; padding: 0 7px; margin-left: 6px;
  border-radius: 10px; background: var(--red); color: #fff; font-size: 12px;
  font-weight: 700; line-height: 20px; text-align: center; vertical-align: 2px; }
.dd-badge.ok { background: var(--ok); }
.dd-alert-row { display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; cursor: pointer; }
.dd-alert-row:last-child { border-bottom: none; }
.dd-alert-row .right { text-align: right; white-space: nowrap; }
.dd-alert-row .cell-sub { white-space: normal; }
.dd-reg-head { margin-bottom: 12px; font-size: 13.5px; line-height: 1.5; }
.dd-reg-tot { font-size: 13px; }
@media (max-width: 720px) {
  .dd-controls input[type="date"] { flex: 1 1 100%; }
  .dd-kpi { padding: 8px 8px; }
  .dd-kpi-label { font-size: 11px; }
  .dd-kpi-val { font-size: 17px; }
  .dd-kpi-sub, .dd-kpi-mtd { font-size: 10.5px; }
}

/* ============================================================
   17. КАССА → «ОТЧЁТ QR»: карточки итогов (телефон — по 2 в ряд),
   сверка, фильтры режима день/период
   ============================================================ */
.qr-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
          gap: 10px; margin-bottom: 14px; }
.qr-kpi .stat { min-width: 0; border-left: 4px solid var(--line); }
.qr-kpi .stat-value { font-size: 17px; white-space: nowrap; overflow: hidden;
                      text-overflow: ellipsis; }
.qr-kpi .stat-ok { border-left-color: var(--ok); }
.qr-kpi .stat-warn { border-left-color: var(--warn); }
.qr-kpi .stat-danger { border-left-color: var(--danger); }
.qr-kpi .stat-brand { border-left-color: var(--red); }
.qr-filters .qr-mode { margin: 0; flex: none; }
.qr-recon-row { padding: 6px 0; border-top: 1px solid var(--line); }
.qr-recon-row:first-child { border-top: none; }
@media (max-width: 600px) {
  .qr-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .qr-kpi .stat { padding: 10px 12px; }
  .qr-kpi .stat-value { font-size: 15px; white-space: normal; }
  .qr-filters input[type="date"] { flex: 1 1 45%; min-width: 0; }
}

/* ============================================================
   Строки позиций в диалогах возврата: код Core+ перед названием,
   поиск, подсветка отмеченных. Длинное название переносится, поле
   количества остаётся справа (телефон — комментарий на вторую строку).
   ============================================================ */
.ret-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
            color: var(--fg-muted); font-weight: 500; }
.ret-title { white-space: normal; overflow-wrap: anywhere; }
.ret-line { padding: 3px 4px; border-radius: var(--r-sm); }
.ret-line .grow { min-width: 0; }
.ret-line.ret-has { background: var(--ok-soft); }
.ret-line.ret-hide { display: none; }
.ret-line .acc-note { width: 130px; }
.ret-shown { margin-top: 4px; }
@media (max-width: 720px) {
  .ret-line { flex-wrap: wrap; }
  .ret-line .grow { flex: 1 1 150px; }
  .ret-line .acc-note { flex: 1 1 100%; width: auto; }
}

/* ============================================================
   Торговая команда → Маршруты: карточки кодов торговых (mobile-first).
   Код · торговый · супервайзер · точек (офиц.) · дебиторка · последняя
   отгрузка · с какого числа. Вакансия и уволенный — цветная полоска.
   ============================================================ */
.srt-sum { display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center;
           font-size: 13px; color: var(--fg-muted); margin-bottom: 10px; }
.srt-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.srt-card { background: var(--surface); border: 1px solid var(--line);
            border-radius: var(--r); padding: 12px 14px;
            box-shadow: var(--shadow-sm); border-left: 4px solid var(--line); }
.srt-card.srt-vacant { border-left-color: var(--warn); }
.srt-card.srt-dismissed { border-left-color: var(--danger); }
.srt-card.srt-temp { border-left-color: #1B5E9E; }
.srt-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.srt-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
            font-weight: 700; font-size: 17px; flex: none; min-width: 34px; }
.srt-emp { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.srt-emp .chip { margin-left: 6px; vertical-align: middle; }
.srt-sub { font-size: 12px; color: var(--fg-muted); margin-top: 3px; }
.srt-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
             gap: 6px 10px; margin-top: 10px; }
.srt-stat .srt-l { display: block; font-size: 11px; color: var(--fg-muted);
                   text-transform: uppercase; letter-spacing: .02em; }
.srt-stat .srt-v { font-size: 15px; font-weight: 600;
                   font-variant-numeric: tabular-nums; }
.srt-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.srt-actions .btn { flex: 1 1 auto; }
.srt-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
               margin-bottom: 10px; }
.srt-filters .search { flex: 1 1 180px; min-width: 0; }
.srt-filters .seg { margin-bottom: 0; }
.srt-hist { display: flex; flex-direction: column; }
.srt-hist-row { display: flex; gap: 10px; padding: 8px 0;
                border-top: 1px solid var(--line); font-size: 13px; }
.srt-hist-row:first-child { border-top: none; }
.srt-hist-when { flex: none; min-width: 150px; font-variant-numeric: tabular-nums; }
.srt-hist-who { flex: 1; min-width: 0; }
.srt-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.srt-check input { width: auto; }
@media (min-width: 720px) {
  .srt-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .srt-actions .btn { flex: none; }
}
@media (min-width: 1100px) {
  .srt-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Счета на оплату (services/bills.py) ---------- */
.bl-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
              margin-bottom: 10px; }
.bl-filters .search { flex: 1 1 200px; min-width: 0; }
.bl-filters select, .bl-filters input[type="date"] { width: auto; }
.bl-check { display: inline-flex; align-items: center; gap: 6px;
            font-size: 13px; cursor: pointer; }
.bl-check input { width: auto; margin: 0; }
.bl-sum { display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center;
          font-size: 13px; color: var(--fg-muted); margin-bottom: 8px; }
.bl-actions-top { display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
                  margin-bottom: 10px; }
.bl-list { display: flex; flex-direction: column; gap: 8px; }
.bl-more { display: flex; justify-content: center; margin-top: 12px; }
/* карточка оператора: чекбокс · основная колонка · правая колонка
   (статус + кнопки); всем колонкам min-width:0, чтобы длинные строки
   переносились, а не налезали на соседей */
.bl-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(230px, 320px);
          gap: 6px 14px; align-items: start; background: var(--surface);
          border: 1px solid var(--line); border-left: 4px solid var(--line-strong);
          border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; }
.bl-row > * { min-width: 0; }
.bl-c-sel { grid-column: 1; }
.bl-c-main { grid-column: 2; }
.bl-c-side { grid-column: 3; }
.bl-row.bl-same { border-left-color: var(--warn); background: #fffdf5; }
.bl-row.bl-err { border-left-color: var(--danger); }
.bl-row.bl-paid, .bl-card.bl-paid { border-left-color: var(--ok); }
.bl-c-sel input { width: 18px; height: 18px; margin-top: 2px; }
.bl-c-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bl-c-main > * { overflow-wrap: anywhere; }
.bl-head { display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: baseline; }
.bl-num { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bl-date { color: var(--fg-muted); white-space: nowrap; }
.bl-amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bl-point { font-weight: 600; overflow-wrap: anywhere; }
.bl-c-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; min-width: 0; }
.bl-c-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.bl-c-status { display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
               text-align: right; }
.btn-xs { padding: 2px 6px; font-size: 12px; line-height: 1.2; }
.mt-xs { margin-top: 4px; }
.bl-cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
.bl-card { background: var(--surface); border: 1px solid var(--line);
           border-left: 4px solid var(--line-strong); border-radius: var(--r-sm);
           padding: 12px 14px; font-size: 13px; min-width: 0; }
.bl-card > * { overflow-wrap: anywhere; }
.bl-card.bl-same { border-left-color: var(--warn); }
.bl-card-head { display: flex; justify-content: space-between; gap: 10px;
                align-items: baseline; flex-wrap: wrap; }
.bl-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.bl-card-actions .btn { flex: 1 1 auto; }
.bl-status { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.bl-settings { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.bl-h3 { font-size: 15px; margin: 0 0 10px; }
.bl-settings textarea { width: 100%; font: inherit; padding: 8px 10px;
                        border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
.bl-settings-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
@media (min-width: 901px) { .bl-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .bl-row { grid-template-columns: 28px minmax(0, 1fr); }
  .bl-row .bl-c-main { grid-column: 2; }
  .bl-row .bl-c-side { grid-column: 2; align-items: flex-start; }
  .bl-row .bl-c-status { align-items: flex-start; text-align: left; }
  .bl-row .bl-c-actions { justify-content: flex-start; }
  .bl-c-actions .btn { flex: 1 1 auto; }
}
