:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e9f0;
  --text: #1f2733;
  --text-muted: #6b7688;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(17, 24, 39, .08), 0 1px 2px rgba(17, 24, 39, .04);
  --shadow-lg: 0 10px 30px rgba(17, 24, 39, .18);
  --radius: 12px;

  /* Высота липкой шапки сайта. Все остальные липкие элементы (итог расчёта,
     заголовок таблицы) прилипают НЕ к нулю, а к этой отметке — иначе они уезжают
     под шапку, которая непрозрачна и лежит выше по z-index. Точное значение
     выставляет common.js замером, здесь — запасное на время до его загрузки. */
  --header-h: 60px;

  --st-new-bg: #bfd7fe;      --st-new-fg: #1e40af;
  --st-prog-bg: #fde68a;     --st-prog-fg: #92400e;
  --st-done-bg: #bbf7d0;     --st-done-fg: #166534;
  --st-cancel-bg: #fecaca;   --st-cancel-fg: #991b1b;
  --st-clar-bg: #ddd6fe;     --st-clar-fg: #5b21b6;
  --st-unpr-bg: #d5dae1;     --st-unpr-fg: #374151;
  --st-cxl-bg: #c8d2df;      --st-cxl-fg: #334155;
  --st-call-bg: #fed7aa;     --st-call-fg: #9a3412;   /* На прозвоне */

  /* Планки групп прайса — чтобы глаз находил нужный блок доски по цвету. */
  --g1: #3b82f6;  --g2: #06b6d4;  --g3: #f59e0b;  --g4: #a855f7;  --g5: #10b981;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --surface: #1a212b;
    --surface-2: #212a36;
    --border: #2c3644;
    --text: #e6ebf2;
    --text-muted: #93a0b3;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 34px rgba(0, 0, 0, .55);

    --st-new-bg: #1e40af;      --st-new-fg: #dbeafe;
    --st-prog-bg: #854d0e;     --st-prog-fg: #fef08a;
    --st-done-bg: #166534;     --st-done-fg: #dcfce7;
    --st-cancel-bg: #991b1b;   --st-cancel-fg: #fee2e2;
    --st-clar-bg: #5b21b6;     --st-clar-fg: #ede9fe;
    --st-unpr-bg: #3f4757;     --st-unpr-fg: #e5e7eb;
    --st-cxl-bg: #3f4d5e;      --st-cxl-fg: #e5e7eb;
    --st-call-bg: #9a3412;     --st-call-fg: #ffedd5;   /* На прозвоне */

    --g1: #60a5fa;  --g2: #22d3ee;  --g3: #fbbf24;  --g4: #c084fc;  --g5: #34d399;
  }
}

* { box-sizing: border-box; }

/* Фикс: атрибут hidden должен скрывать даже элементы с display: flex/grid */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  /* Курсор ввода (I-beam) браузер по умолчанию рисует над ЛЮБЫМ текстом, и
     заголовки с подписями выглядят так, будто в них можно печатать. Оставляем
     его только в тех полях, где действительно печатают (правила ниже). */
  cursor: default;
}

/* Селекторы намеренно низкой специфичности: частные правила
   (.datefield — pointer, .input:disabled — not-allowed) должны их перебивать. */
input, textarea { cursor: text; }
input[type="checkbox"], input[type="radio"] { cursor: pointer; }
select, button, summary { cursor: pointer; }
button:disabled, select:disabled { cursor: not-allowed; }
/* Поле, которое роль не вправе менять, не должно приглашать печатать. */
input:disabled, textarea:disabled, input[readonly], textarea[readonly] { cursor: not-allowed; }

/* Заголовки, подписи и кнопки — это части интерфейса, а не текст для чтения и
   копирования. Запрещаем их выделять: браузер перестаёт ставить в них курсор
   ввода (в том числе при включённом «просмотре с курсором», F7), и на телефоне
   при тапе не выскакивает лупа выделения.
   ДАННЫЕ (телефоны, адреса, суммы в таблицах) выделять по-прежнему можно —
   их копируют. */
h1, h2, h3,
.page__title, .section-title, .card__head, .card__icon,
.field__label, .field__hint, .filter__label,
.stat, .stat__value, .stat__label,
.btn, .nav-link, .pager__btn, .pill, .brand, .user-chip,
.calc-col__title, .calc-head__label, .calc-script__title, .calc-row__unit,
.table th, .table td::before {
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Шапка ---- */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand__logo { font-size: 30px; }
.brand__title { margin: 0; font-size: 19px; font-weight: 700; }
.brand__subtitle { margin: 0; font-size: 13px; color: var(--text-muted); }
.header-actions { display: flex; gap: 10px; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ---- Кнопки ---- */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .04s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--icon {
  padding: 6px 9px;
  font-size: 13px;
  line-height: 1;
}
.btn--sm { padding: 5px 12px; font-size: 13px; }
.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--st-cancel-bg); border-color: var(--danger); }

/* ---- Статистика ---- */
.stats {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  margin-bottom: 20px;
  overflow-x: auto;
  /* Полоса — скролл-бокс, а .stat:hover приподнимает плитку на 2px. Без верхнего
     просвета верхняя кромка плитки при наведении срезалась краем скролл-бокса. */
  padding-top: 3px;
  padding-bottom: 4px;
}
.stats > .stat, .stats > .revenue-tile { flex: 1 1 0; min-width: 124px; }
/* На десктопе — СЕТКА в ОДНУ строку. auto-fill minmax(150px, 1fr) раскладывал
   плитки по «сколько влезет по 150px» — при 9–10 плитках это 7 в первом ряду и
   огрызок из 2–3 во втором. grid-auto-flow: column кладёт все плитки в одну
   строку, а minmax(0, 1fr) делает колонки равными и разрешает им сжиматься
   (без minmax(0,…) колонка не ужимается уже своего содержимого и строка
   вылезает за край).

   Колонок много, поэтому на десктопе плитка компактнее: меньше поля, мельче
   цифра и подпись — иначе «Не оформленные» не помещается в ~110px колонки. */
@media (min-width: 1000px) {
  .stats {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    overflow-x: visible;
  }
  /* Селектор тот же, что у flex-правила выше: min-width: 124px оттуда действует и
     на grid-элементы и не даёт колонкам сжаться — 10 плиток вылезали за контейнер. */
  .stats > .stat, .stats > .revenue-tile { min-width: 0; padding: 13px 10px; }
  .stat__value { font-size: 22px; }
  /* 11px, а не 12: на «Отчётах» плиток 10 (есть выручка), колонка ~113px, и самое
     длинное слово подписи — «оформленные» — при 12px на пару пикселей шире колонки
     и обрезается. Перенос его не спасает: слово одно, делить его нечем. */
  .stat__label, .revenue-tile__label { font-size: 11px; line-height: 1.25; }
  /* Сумма может вырасти до семизначной («1 250 000 ₽») и в узкой колонке не
     помещается — даём ей ужиматься по ширине окна, а не вылезать за плитку. */
  .revenue-tile__value { font-size: clamp(15px, 1.25vw, 22px); white-space: nowrap; }
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color .12s, transform .06s;
  border-left: 4px solid var(--border);
}
.stat:hover { transform: translateY(-2px); }
.stat.is-active { border-color: var(--primary); }
.stat--waiting { border-left-color: var(--st-new-fg); }
.stat--calling { border-left-color: var(--st-call-fg); }
.stat--clarifying { border-left-color: var(--st-clar-fg); }
.stat--unprocessed { border-left-color: var(--st-unpr-fg); }
.stat--progress { border-left-color: var(--st-prog-fg); }
.stat--done { border-left-color: var(--st-done-fg); }
.stat--rejected { border-left-color: var(--st-cancel-fg); }
.stat--cancelled { border-left-color: var(--st-cxl-fg); }
.stat__value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat__label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Плитка выручки — выделена, не кликабельна */
.revenue-tile {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.revenue-tile__value { font-size: 24px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.revenue-tile__label { font-size: 13px; opacity: .85; margin-top: 2px; }
.cell-money { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Выручка отдельной строкой на всю ширину (отчёты). Подпись слева, сумма справа —
   семизначным значениям есть куда расти, за край они не вылезают. */
.revenue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
}
.revenue-row[hidden] { display: none; }
.revenue-row__label { font-size: 15px; font-weight: 600; opacity: .9; }
.revenue-row__value {
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---- Панель инструментов ---- */
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar__search { flex: 1; min-width: 220px; }
.toolbar__filter { width: 200px; }

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }

/* ---- Таблица ---- */
.section-title {
  margin: 26px 0 12px;
  font-size: 17px;
  font-weight: 650;
  color: var(--text);
}

/* ==== Расчёт цены: «доска» ====================================================
   Все услуги видны сразу. Ничего не раскрывается и не скроллится внутри блока:
   во время звонка время съедает навигация, а не ввод. Позиции строк постоянны —
   через неделю диспетчер попадает в нужную ячейку не глядя.
   ВАЖНО: у доски НЕТ своего overflow — иначе position:sticky у шапки не работает. */
.calc-city { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.calc-body { gap: 10px; }
.calc-warn {
  margin: 0; padding: 10px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--st-prog-bg) 45%, var(--surface));
  color: var(--text); font-size: 13px;
}

/* --- липкая шапка: итог и фраза всегда перед глазами ---
   top: var(--header-h), а НЕ 0. Шапка сайта тоже липкая, тоже прилипает к нулю,
   непрозрачна и лежит выше (z-index 30 против 5). При top: 0 плашка пряталась под
   неё ровно верхними ~60px — то есть строкой с суммой и кнопкой «Сбросить»: замер
   показывал, что в точке цифры итога лежит логотип CRM. */
.calc-head {
  position: sticky; top: var(--header-h); z-index: 5;
  margin: 0 -18px; padding: 10px 18px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.calc-head__row { display: flex; align-items: baseline; gap: 10px; }
.calc-head__label { font-size: 13px; color: var(--text-muted); }
.calc-head__value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.calc-head__count { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.calc-head__time { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.calc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.calc-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 9px;
  border-radius: 999px; font-size: 12px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}
.calc-chip--bad { background: color-mix(in srgb, var(--danger, #dc2626) 16%, var(--surface)); }
.calc-chip__x {
  all: unset; cursor: pointer; padding: 0 5px; border-radius: 999px;
  color: var(--text-muted); font-size: 13px; line-height: 1;
}
.calc-chip__x:hover { color: var(--text); background: var(--border); }

/* --- фраза для клиента: её произносят вслух, поэтому крупно --- */
.calc-script { margin-top: 10px; }
.calc-script__title {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.calc-script__say { margin: 6px 0 8px; font-size: 15.5px; line-height: 1.5; }
.calc-script__hint { margin-top: 8px; font-size: 12.5px; color: var(--text-muted); }
.calc-script__hint summary { cursor: pointer; }

/* --- поиск-прожектор: подсвечивает строку, ничего не добавляет --- */
.calc-search { position: relative; display: flex; align-items: center; }
.calc-search__input { padding-right: 92px; font-size: 13.5px; }
.calc-search__count {
  position: absolute; right: 34px; font-size: 11.5px; color: var(--text-muted);
  pointer-events: none;
}
/* `all: unset` идёт ПЕРВЫМ. Стоя после position/right, он их же и сбрасывал:
   крестик становился обычным flex-элементом и вылезал за правый край поля,
   а поле дёргалось в ширине на первом введённом символе. */
.calc-search__clear {
  all: unset;
  position: absolute; right: 8px; cursor: pointer;
  padding: 2px 6px; border-radius: 6px; color: var(--text-muted); font-size: 13px;
}
.calc-search__clear:hover { color: var(--text); background: var(--border); }

/* Калькулятор занимает всю ширину формы (обе колонки сетки): доске нужна ширина,
   иначе названия услуг обрезаются многоточием и по ним не попасть глазом. */
.calc-card--wide { grid-column: 1 / -1; }

/* --- доска ---
   Пять групп идут многоколоночной раскладкой: браузер сам выравнивает высоту
   колонок и не оставляет дыр справа. Жёсткая сетка оставляла пустой правый край
   (3 группы в первом ряду, 2 во втором). */
.calc-board { display: block; }
.calc-col { border-left: 3px solid var(--g, var(--border)); padding-left: 9px; }

.calc-groups { columns: 3; column-gap: 22px; }
.calc-groups > .calc-col {
  /* Группа НЕ рвётся между колонками. Разрешить разрыв — соблазнительно (колонки
     балансируются идеально, пустого места ноль), но тогда колонка начинается со
     строк без заголовка: «Мойка витрин», «Химчистка кресла» висят сиротами, и
     диспетчер под телефонный разговор не понимает, к какой группе они относятся.
     Пустоту убираем не разрывом, а ПОРЯДКОМ групп в PRICING_GROUPS (app.py):
     7+5 | 5+5 | 8 строк вместо прежних 7+5 | 5+8 | 5. */
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  /* Просвет между группами задаётся ТОЛЬКО снизу. Верхний отступ здесь (или на
     заголовке, откуда он протекает наружу) сдвинул бы вниз лишь первую группу:
     у групп, перенесённых в начало новой колонки, браузер верхний отступ срезает,
     а у самой первой оставляет — заголовки колонок разъезжались на 12px. */
  margin: 0 0 12px;
}
/* Заголовок группы не остаётся один в конце колонки, а строка не рвётся пополам. */
.calc-col__title { break-after: avoid; }
.calc-row { break-inside: avoid; }
/* Три колонки — только на полной ширине страницы (.page упирается в 1280px, и строка
   доски получается 373px). Между 1150 и 1280px колонки были у́же, и длинные названия
   («Мойка балконного остекления» — 185px текста) не помещались и дожёвывались
   многоточием. Замер: бюджет строки на «название + цена» там всего 224px против
   нужных 267px. */
@media (max-width: 1280px) { .calc-groups { columns: 2; } }

/* Группа — <details>, чтобы её можно было свернуть на телефоне. На десктопе она
   всегда раскрыта и выглядит как обычный заголовок: ни маркера, ни курсора-руки. */
.calc-col__title {
  margin: 0 0 4px; font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted);
  list-style: none; cursor: default;
  display: flex; align-items: center; gap: 8px;
}
.calc-col__title::-webkit-details-marker { display: none; }
/* Счётчик выбранного нужен только когда группа свёрнута (телефон). */
.calc-col__badge { display: none; }
/* Колонка цены — фиксированная, а не auto. При auto она мерилась по содержимому и
   росла, когда «от 3 500 ₽» превращалось в жирную сумму: колонка названия ровно на
   столько же сжималась, и длинные названия дожёвывались многоточием прямо во время
   набора количества. Замер: название прыгало на 8px на каждой введённой цифре.
   Ширины подобраны замером, а не на глаз: строка доски — 373px, самому длинному
   названию нужно 193px, самой длинной цене «от 1 000 ₽» — 73px. Служебные колонки
   ужаты до минимума, чтобы всё это уместилось. */
.calc-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 76px 48px 34px;
  gap: 5px; align-items: center; min-height: 30px; border-radius: 6px;
}
.calc-row__name {
  all: unset; cursor: pointer; font-size: 13px; padding: 5px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calc-row__name:hover, .calc-row__name:focus-visible { color: var(--primary); }
.calc-row__slot {
  font-size: 11.5px; color: var(--text-muted); text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.calc-row__qty {
  padding: 4px 6px; font-size: 13px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.calc-row__unit { font-size: 11.5px; color: var(--text-muted); }

.calc-row.is-on { background: color-mix(in srgb, var(--primary) 9%, transparent); }
.calc-row.is-on .calc-row__name { font-weight: 650; }
/* Размер шрифта здесь НЕ меняем — иначе поехала бы ширина колонки. Хватает цвета и жира. */
.calc-row.is-on .calc-row__slot { color: var(--primary); font-weight: 700; }
.calc-row.is-off { opacity: .38; }
.calc-row.is-off .calc-row__name { cursor: default; }
.calc-row.is-dim { opacity: .3; }
.calc-row.is-hit { outline: 2px solid var(--primary); outline-offset: 1px; }
@keyframes calc-bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.08); } }
.calc-row.is-bump .calc-row__slot { animation: calc-bump .18s ease-out; }

/* --- сохранённая смета (роль без права считать) --- */
.calc-saved { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.calc-saved li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.calc-saved__total { font-weight: 650; border-bottom: 0 !important; padding-top: 10px !important; }

.commission-box {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 17px; font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.calc-fab { display: none; }
@media (max-width: 700px) {
  /* Строка в два яруса: имя сверху, цена/поле/единица снизу. Крупнее для пальца. */
  .calc-row { grid-template-columns: minmax(0, 1fr) auto 64px 36px; min-height: 44px; }
  .calc-row__name { grid-column: 1 / -1; font-size: 15px; white-space: normal; }
  .calc-row__slot { grid-row: 2; grid-column: 1 / 3; text-align: left; }
  .calc-row__qty { grid-row: 2; font-size: 16px; min-height: 38px; }  /* 16px — иначе iOS зумит */
  .calc-row__unit { grid-row: 2; }
  .calc-head__value { font-size: 21px; }
  /* Итог виден, куда бы ни уехал скролл формы. */
  .calc-fab {
    display: flex; position: sticky; bottom: 0; z-index: 6;
    align-items: center; gap: 10px; margin: 0 -18px -16px; padding: 10px 18px;
    background: var(--surface); border-top: 1px solid var(--border);
    /* Плашка доходит до самого края карточки, а у .card нет overflow: hidden —
       без своего скругления её непрозрачный фон заливал углы поверх дуги карточки. */
    border-radius: 0 0 var(--radius) var(--radius);
  }
  .calc-fab__sum { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .calc-fab__count { font-size: 12px; color: var(--text-muted); }
}
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
/* Липкий заголовок таблицы был МЁРТВ: overflow-x: auto делает overflow-y тоже auto,
   .table-wrap становится скролл-портом для sticky, а по вертикали он не прокручивается
   никогда — заголовок просто уезжал вверх вместе со страницей (замер: y = −28px).
   Таблица шириной 900px на экране ≥1000px помещается целиком, горизонтальная прокрутка
   там не нужна. `clip` по X (вместо auto) не создаёт скролл-контейнер, поэтому sticky
   начинает считать от вьюпорта — и при этом скруглённые углы карточки не выпирают,
   как было бы при overflow: visible. */
@media (min-width: 1000px) {
  .table-wrap { overflow-x: clip; overflow-y: visible; }
}
/* Числовые колонки отчёта по диспетчерам. */
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.row-total td { font-weight: 650; border-top: 2px solid var(--border); }
/* Таблица диспетчеров узкая — не растягиваем её до 900px, как список заявок. */
#disp-table { min-width: 420px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 900px; }
.table th, .table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  background: var(--surface-2);
  position: sticky;
  top: var(--header-h);        /* не 0: иначе спрячется под липкой шапкой сайта */
  z-index: 2;                  /* иначе строки таблицы просвечивают сквозь заголовок */
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.row-open { cursor: pointer; }
.cell-id { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cell-name { font-weight: 600; }
.cell-muted { color: var(--text-muted); font-size: 13px; }
.cell-actions { text-align: right; white-space: nowrap; }

/* ---- Статус-бейдж / селект ---- */
.status-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 30px 5px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background-color: var(--surface);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%238a94a6" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.status-select:hover:not(:disabled) { border-color: var(--primary); }
.status-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring, rgba(59,130,246,.25)); }
.status--waiting { background-color: var(--st-new-bg); color: var(--st-new-fg); }
/* «На прозвоне» — мигает, чтобы диспетчер не забыл перезвонить. */
.status--calling {
  background-color: var(--st-call-bg); color: var(--st-call-fg);
  animation: blink-status 1.2s ease-in-out infinite;
}
@keyframes blink-status { 0%, 100% { opacity: 1; } 50% { opacity: .42; } }
.status--clarifying { background-color: var(--st-clar-bg); color: var(--st-clar-fg); }
.status--unprocessed { background-color: var(--st-unpr-bg); color: var(--st-unpr-fg); }
.status--in_progress { background-color: var(--st-prog-bg); color: var(--st-prog-fg); }
.status--done { background-color: var(--st-done-bg); color: var(--st-done-fg); }
.status--rejected { background-color: var(--st-cancel-bg); color: var(--st-cancel-fg); }
.status--cancelled { background-color: var(--st-cxl-bg); color: var(--st-cxl-fg); }

/* ---- Подсветка строк заявок по статусу ---- */
.row--waiting     { background: color-mix(in srgb, var(--st-new-bg) 34%, var(--surface)); }
.row--clarifying  { background: color-mix(in srgb, var(--st-clar-bg) 34%, var(--surface)); }
.row--unprocessed { background: color-mix(in srgb, var(--st-unpr-bg) 34%, var(--surface)); }
.row--in_progress { background: color-mix(in srgb, var(--st-prog-bg) 34%, var(--surface)); }
.row--done        { background: color-mix(in srgb, var(--st-done-bg) 34%, var(--surface)); }
.row--rejected    { background: color-mix(in srgb, var(--st-cancel-bg) 34%, var(--surface)); }
.row--cancelled   { background: color-mix(in srgb, var(--st-cxl-bg) 30%, var(--surface)); }
.row--waiting     td:first-child { box-shadow: inset 4px 0 0 var(--st-new-fg); }
.row--clarifying  td:first-child { box-shadow: inset 4px 0 0 var(--st-clar-fg); }
.row--unprocessed td:first-child { box-shadow: inset 4px 0 0 var(--st-unpr-fg); }
.row--in_progress td:first-child { box-shadow: inset 4px 0 0 var(--st-prog-fg); }
.row--done        td:first-child { box-shadow: inset 4px 0 0 var(--st-done-fg); }
.row--rejected    td:first-child { box-shadow: inset 4px 0 0 var(--st-cancel-fg); }
.row--cancelled   td:first-child { box-shadow: inset 4px 0 0 var(--st-cxl-fg); }
.row--calling     { background: color-mix(in srgb, var(--st-call-bg) 34%, var(--surface)); }
.row--calling     td:first-child { animation: blink-bar 1.2s ease-in-out infinite; }
@keyframes blink-bar {
  0%, 100% { box-shadow: inset 4px 0 0 var(--st-call-fg); }
  50%      { box-shadow: inset 4px 0 0 transparent; }
}
/* Уважаем системную настройку «меньше движения»: мигание отключается,
   но цвет и полоса остаются — статус всё равно заметен. */
@media (prefers-reduced-motion: reduce) {
  .status--calling { animation: none; }
  .row--calling td:first-child {
    animation: none;
    box-shadow: inset 4px 0 0 var(--st-call-fg);
  }
}

/* Автор заявки в шапке формы */
.form-author { color: var(--text-muted); font-size: 13px; align-self: center; }
.check--wide { width: 100%; }

/* ---- Пустое состояние ---- */
.empty { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.empty p { margin: 0 0 14px; font-size: 15px; }

/* ---- Модальное окно ---- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15, 20, 27, .5); backdrop-filter: blur(2px); }
.modal__dialog {
  position: relative;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
}
.modal__dialog--sm { max-width: 420px; }
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface);
}
.modal__head h2 { margin: 0; font-size: 17px; }
.modal__close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--text-muted); cursor: pointer; }
.modal__close:hover { color: var(--text); }

/* ---- Форма ---- */
.form { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field__label b { color: var(--danger); }
.field__error { font-size: 12px; color: var(--danger); min-height: 1px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.field--narrow { max-width: 120px; }
.input.is-invalid { border-color: var(--danger); outline-color: var(--danger); }
.form__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

.amount-modal__text { margin: 0; font-size: 14px; color: var(--text-muted); }
.hint { font-size: 12px; color: var(--text-muted); margin: 4px 0 0; }

/* ---- Города ---- */
.city-add { display: flex; gap: 10px; }
.city-add .input { flex: 1; }
.city-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.city-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2);
}
.city-item.is-closed { opacity: .7; }
.city-item--empty { justify-content: center; color: var(--text-muted); }
.city-item__name { flex: 1; font-weight: 600; }
.city-item__badge {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
}
.city-item__badge.open { background: var(--st-done-bg); color: var(--st-done-fg); }
.city-item__badge.closed { background: var(--st-cancel-bg); color: var(--st-cancel-fg); }

/* ---- Уведомление ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  opacity: 0;
  transition: opacity .2s, transform .2s;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-error { background: var(--danger); }

/* ---- Экран входа ---- */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.login__card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; }
.login__logo { font-size: 44px; text-align: center; }
.login__title { margin: 0; font-size: 20px; text-align: center; }
.login__subtitle { margin: 0 0 6px; font-size: 14px; color: var(--text-muted); text-align: center; }
.login__error { color: var(--danger); font-size: 13px; min-height: 1em; text-align: center; }
.btn--block { width: 100%; justify-content: center; }

/* ---- Пользовательский чип в шапке ---- */
.user-chip { position: relative; display: flex; flex-direction: column; align-items: flex-end; padding: 4px 10px; border-radius: 10px; cursor: pointer; line-height: 1.2; }
.user-chip:hover { background: var(--surface-2); }
.user-chip__name { font-weight: 600; font-size: 14px; }
.user-chip__role { font-size: 12px; color: var(--text-muted); }
.user-menu { position: absolute; top: 100%; right: 0; margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 170px; overflow: hidden; display: none; z-index: 20; }
.user-chip.is-open .user-menu { display: block; animation: pop .15s ease both; }
.user-menu__item { display: block; width: 100%; text-align: left; padding: 10px 14px; background: none; border: none; font-size: 14px; color: var(--text); cursor: pointer; }
.user-menu__item:hover { background: var(--surface-2); }

/* ---- Баннер смены пароля ---- */
.banner { background: var(--st-prog-bg); color: var(--st-prog-fg); text-align: center; padding: 9px 16px; font-size: 14px; }
.linklike { background: none; border: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; padding: 0; font-weight: 600; }
.field__hint { font-weight: 400; color: var(--text-muted); font-size: 12px; }

/* ---- Отключённые поля ---- */
.input:disabled, .status-select:disabled { opacity: .6; cursor: not-allowed; background: var(--surface-2); }

/* ---- Пагинация ---- */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pager__info { font-size: 14px; color: var(--text-muted); font-variant-numeric: tabular-nums; margin-left: 8px; }
.pager__btn { min-width: 36px; padding-left: 10px; padding-right: 10px; }
.pager__btn.is-active { background: var(--primary); color: #fff; border-color: var(--primary); pointer-events: none; }
.pager__gap { color: var(--text-muted); padding: 0 2px; }
.cell-clip { text-align: center; font-size: 13px; color: var(--text-muted); white-space: nowrap; }

/* ---- Вложения ---- */
.att-list { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.att-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.att-item--empty { justify-content: center; color: var(--text-muted); font-size: 13px; }
.att-item__name { flex: 1; color: var(--primary); text-decoration: none; font-size: 14px; word-break: break-all; }
.att-item__name:hover { text-decoration: underline; }
.att-item__meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.att-upload { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.att-hint { font-size: 12px; color: var(--text-muted); }

/* ---- Список пользователей ---- */
.user-new { border: 1px solid var(--border); border-radius: 10px; padding: 4px 12px; }
.user-new summary { cursor: pointer; padding: 8px 0; font-weight: 600; font-size: 14px; }
.user-new__body { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.user-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.user-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.user-item.is-off { opacity: .6; }
.user-item__info { flex: 1; min-width: 0; }
.user-item__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-item__name { font-weight: 600; }
.user-item__role { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--st-new-bg); color: var(--st-new-fg); }
.user-item__role.role-admin { background: var(--st-cancel-bg); color: var(--st-cancel-fg); }
.user-item__role.role-director { background: var(--st-done-bg); color: var(--st-done-fg); }
.user-item__off { font-size: 12px; color: var(--danger); }
.user-item__sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.user-item__actions { display: flex; gap: 6px; flex-shrink: 0; }
.modal__dialog--lg { max-width: 640px; }

/* ---- Лента слотов времени (как в референсе: время + загрузка) ---- */
.sched__date { max-width: 200px; margin-bottom: 8px; }
.timeslots {
  display: flex; gap: 4px; overflow-x: auto; padding: 2px 0 8px;
  scrollbar-width: thin;
}
.slot {
  flex: 0 0 auto; min-width: 56px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); cursor: pointer;
  font-variant-numeric: tabular-nums; transition: border-color .1s, background .1s, transform .04s;
}
.slot__time { font-size: 13px; font-weight: 600; }
.slot__count { font-size: 12px; color: var(--text-muted); line-height: 1; }
.slot:hover:not(:disabled) { border-color: var(--primary); transform: translateY(-1px); }
.slot--busy { background: var(--st-prog-bg); border-color: var(--st-prog-fg); }
.slot--busy .slot__count { color: var(--st-prog-fg); font-weight: 700; }
.slot--full { background: var(--st-cancel-bg); border-color: var(--st-cancel-fg); }
.slot--full .slot__count { color: var(--st-cancel-fg); font-weight: 700; }
.slot.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot.is-active .slot__time, .slot.is-active .slot__count { color: #fff; }
.slot:disabled { opacity: .5; cursor: not-allowed; }
.slot--custom { border-style: dashed; }
/* Полоска-подсказка над лентой */
.slot-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.slot-legend span { display: inline-flex; align-items: center; gap: 5px; }
.slot-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; border: 1px solid var(--border); }
.slot-legend .lg-free { background: var(--surface); }
.slot-legend .lg-busy { background: var(--st-prog-bg); border-color: var(--st-prog-fg); }
.slot-legend .lg-full { background: var(--st-cancel-bg); border-color: var(--st-cancel-fg); }

/* ---- Заявка отдельной страницей (широкая, многоколоночная) ---- */
#form-view { max-width: 1160px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.page-head__title { margin: 0; font-size: 20px; }
.form--page {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 26px; gap: 16px;
}
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.sched-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sched-controls .sched__date { margin-bottom: 0; }
.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; }
.flags { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.flag { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.flag input { width: 16px; height: 16px; }
.form--page .timeslots { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.form--page .slot { padding: 9px 4px; font-size: 14px; }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
.form--page .form__actions {
  position: sticky; bottom: 0; background: var(--surface);
  padding-top: 14px; margin: 6px -26px -24px; padding: 14px 26px 22px;
  border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
}

/* ---- Панель фильтров ----
   Сетка, а не flex-перенос: фильтров 11 плюс «Сбросить», в строку они не влезают, и
   у flex-элементов последнего ряда flex-grow раздувал их до 359px против 130px у
   остальных (а на 900px одно поле «по» растягивалось на пол-экрана). Панель
   выглядела рваной на всех ширинах. В сетке все поля одной ширины. */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px; align-items: end;
  margin-bottom: 16px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
/* .filter живёт и внутри .report-controls — там родитель flex, поэтому базовое
   правило не задаёт ни flex, ни grid-размещение. */
.filter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter__label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.filter__reset { height: 38px; align-self: end; justify-self: start; }

/* ---- Кликабельное имя клиента ---- */
.client-link { background: none; border: none; padding: 0; font: inherit;
  color: var(--primary); font-weight: 600; cursor: pointer; text-align: left; }
.client-link:hover { text-decoration: underline; }

/* ---- Карточка клиента ---- */
.client-summary { display: flex; flex-wrap: wrap; gap: 22px; padding: 4px 0 10px; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv__label { font-size: 12px; color: var(--text-muted); }
.kv__value { font-weight: 700; font-size: 17px; }
.client-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.status-chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.client-sub { font-size: 14px; margin: 10px 0 6px; color: var(--text-muted); }
.client-req-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.client-req { display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); flex-wrap: wrap; }
.client-req--empty { justify-content: center; color: var(--text-muted); }
.client-req--open { cursor: pointer; transition: border-color .12s, background .12s; }
.client-req--open:hover { border-color: var(--primary); }
.client-req__id { font-weight: 700; font-variant-numeric: tabular-nums; }
.client-req__meta { flex: 1; font-size: 13px; color: var(--text-muted); min-width: 120px; }

@media (max-width: 720px) {
  /* Плитки статистики — ровно 3 в ряд. Было auto-fill minmax(96px): на 700px это
     давало 6 штук по 102px, подписи ломались на две строки. */
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); overflow-x: visible; }
  .stats > .stat, .stats > .revenue-tile { min-width: 0; }
  .app-header__inner, .container { padding-left: 14px; padding-right: 14px; }
  .field-row { flex-direction: column; }
  .field--narrow { max-width: none; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .user-item { flex-direction: column; align-items: stretch; }
}

/* ==================== Многостраничный сайт: шапка и меню ==================== */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.site-header__inner { max-width: 1280px; margin: 0 auto; padding: 10px 22px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand__logo { font-size: 24px; }
.brand__title { font-weight: 700; font-size: 15px; white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav-link { text-decoration: none; color: var(--text-muted); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 8px; background: none; border: none; cursor: pointer; font-family: inherit; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-active { color: var(--primary); background: var(--st-new-bg); }
.nav-drop { position: relative; }
.nav-drop__menu { position: absolute; top: 100%; left: 0; margin-top: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 170px; display: none; z-index: 40; overflow: hidden; }
.nav-drop.is-open .nav-drop__menu { display: block; animation: pop .15s ease both; }
.nav-drop__btn { display: inline-flex; align-items: center; }
.nav-drop__item { display: block; padding: 9px 14px; text-decoration: none; color: var(--text); font-size: 14px; }
.nav-drop__item:hover { background: var(--surface-2); }
.site-header__actions { display: flex; align-items: center; gap: 14px; }
/* Гамбургер-меню (скрыт на десктопе, показывается на мобильных) */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 40px; padding: 0 10px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer;
}
.nav-toggle:hover { border-color: var(--primary); }
.nav-toggle span { display: block; width: 100%; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.site-header.is-nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.is-nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-header.is-nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.page { max-width: 1280px; margin: 0 auto; padding: 22px; }
.page__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page__title { margin: 0; font-size: 22px; }
.muted { color: var(--text-muted); }
/* ---- Гамбургер включается ТАМ, ГДЕ МЕНЮ ПЕРЕСТАЁТ ПОМЕЩАТЬСЯ, а не на телефоне.
   Было: гамбургер с 768px, а меню админа (5 пунктов) вместе с логотипом, кнопкой
   «Новая заявка» и профилем требует ~1050px. В полосе 769–1050px ссылки переносились,
   и липкая шапка вырастала с 60px до 96px (900/1024) и до 134px (800) — тот же дефект
   «шапка в несколько строк», что чинили для телефона. Замер по фактической высоте. */
@media (max-width: 1100px) {
  .nav-toggle { display: flex; }
  .site-nav { display: none; }
  .site-header__inner { flex-wrap: nowrap; gap: 10px; }
  .site-header__actions { margin-left: auto; }
  /* Единственное, что имеет право уйти на новую строку, — раскрытое меню. */
  .site-header.is-nav-open .site-header__inner { flex-wrap: wrap; }
  .site-header.is-nav-open .site-nav {
    display: flex; flex-direction: column; align-items: stretch;
    order: 3; flex-basis: 100%; gap: 2px;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
  }
  .site-header.is-nav-open .site-nav .nav-link { width: 100%; padding: 12px; }
  .site-header.is-nav-open .nav-drop { width: 100%; }
  .site-header.is-nav-open .nav-drop__btn { width: 100%; justify-content: space-between; }
  .site-header.is-nav-open .nav-drop.is-open .nav-drop__menu {
    position: static; box-shadow: none; border: none; background: none;
    margin: 2px 0 4px 10px; min-width: 0; animation: none;
  }
  .site-header.is-nav-open .nav-drop__item { padding: 10px 12px; }
}
@media (max-width: 820px) {
  .brand__title { font-size: 14px; }
}

.report-controls { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.report-controls .filter { flex: 0 0 auto; }


/* ==================== Карточки формы заявки ==================== */
.form-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.form-topbar__left, .form-topbar__right { display: flex; align-items: center; gap: 10px; }
/* Карточки — ПРЯМЫЕ элементы сетки, а не содержимое двух независимых колонок.
   Только так парные карточки («Клиент» / «Адрес выезда») попадают в одну строку
   сетки и выравниваются по высоте. У flex-колонок такой связи между собой нет,
   и вторая карточка слева начиналась не на той же высоте, что справа.
   Скрытые карточки (display:none) выпадают из сетки, строки упаковываются
   плотно — лишних пустых промежутков не появляется. */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
.card.col-a { grid-column: 1; min-width: 0; }
.card.col-b { grid-column: 2; min-width: 0; }
/* Карточка без пары растягивается на обе колонки. «История изменений» видна только
   администратору, поэтому у остальных четырёх ролей рядом с «Претензиями» зияла
   пустая ячейка сетки (замер: 627×234px). Класс ставит request-form.js. */
.card.is-wide { grid-column: 1 / -1; }
.card--grow { display: flex; flex-direction: column; }
.card--grow .card__body { flex: 1; }
.field--grow { flex: 1; display: flex; flex-direction: column; }
.input--grow { flex: 1; min-height: 120px; resize: vertical; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__head { padding: 12px 18px 4px; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; background: none; }
.card__icon { font-size: 16px; }
.card__body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.card__body .form--page { padding: 0; border: none; box-shadow: none; background: none; }
@media (max-width: 900px) {
  /* Одна колонка. Сбрасываем закрепление за колонками, иначе grid-column:2
     создало бы вторую колонку и вернуло бы двухколоночную раскладку. */
  .form-grid { grid-template-columns: 1fr; }
  .card.col-a, .card.col-b, .calc-card--wide { grid-column: 1; }
}

/* ==================== Календарь дат ==================== */
.datefield { cursor: pointer; }
.datefield::-webkit-calendar-picker-indicator { opacity: 0; display: none; }
.datepicker { z-index: 100; width: 284px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 12px; user-select: none; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-title { font-weight: 700; font-size: 15px; }
.dp-nav { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 18px; line-height: 1; }
.dp-nav:hover { background: var(--surface-2); border-color: var(--primary); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-wd { margin-bottom: 4px; }
.dp-wdc { text-align: center; font-size: 12px; color: var(--text-muted); padding: 4px 0; }
.dp-day { border: none; background: none; color: var(--text); border-radius: 8px; padding: 8px 0; cursor: pointer; font-size: 14px; font-variant-numeric: tabular-nums; }
.dp-day:hover:not(.dp-empty) { background: var(--surface-2); }
.dp-day.is-weekend { color: var(--danger); }
.dp-day.is-today { outline: 1px solid var(--primary); outline-offset: -1px; }
.dp-day.is-selected { background: var(--primary); color: #fff; font-weight: 700; }
.dp-empty { visibility: hidden; cursor: default; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.dp-link { background: none; border: none; color: var(--primary); cursor: pointer; font-weight: 600; font-size: 14px; padding: 4px 6px; }
.dp-link:hover { text-decoration: underline; }

/* ==================== Флаги-переключатели ==================== */
.flags-bar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; }
.pill { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer; user-select: none; transition: all .15s ease; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill__dot { display: none; }
.pill:hover { border-color: var(--primary); transform: translateY(-1px); }
.pill:has(input:checked) { background: var(--st-new-bg); border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.pill:has(input:disabled) { opacity: .55; cursor: not-allowed; }

/* ==================== Блок времени ==================== */
.timeinfo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.timeinfo__box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.timeinfo__box--accent { background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(37,99,235,.02)); border-color: var(--primary); }
.timeinfo__label { font-size: 12px; color: var(--text-muted); }
.timeinfo__val { font-size: 26px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.timeinfo__sub { font-size: 12px; color: var(--text-muted); min-height: 14px; }
.timedrop { position: relative; }
/* Меню времени — единственный попап, который живёт внутри карточки (календарь
   рендерится в body). Пока оно открыто, поднимаем карточку над соседними. */
.card:has(.timedrop.is-open) { position: relative; z-index: 30; }
.timedrop__btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 14px; font-family: inherit; cursor: pointer; transition: border-color .15s; }
.timedrop__btn:hover:not(:disabled) { border-color: var(--primary); }
.timedrop__btn:disabled { opacity: .6; cursor: not-allowed; }
.timedrop__caret { color: var(--text-muted); transition: transform .18s; }
.timedrop.is-open .timedrop__caret { transform: rotate(180deg); }
.timedrop__menu {
  position: absolute; z-index: 200; top: calc(100% + 6px); right: 0;
  width: min(340px, 86vw);
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 8px; animation: pop .16s ease;
}
.timedrop__menu[hidden] { display: none; }
.timedrop--up .timedrop__menu { top: auto; bottom: calc(100% + 6px); }
.timedrop__item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 2px; border: 1px solid transparent; background: var(--surface-2);
  color: var(--text); border-radius: 8px; cursor: pointer; font-variant-numeric: tabular-nums;
  transition: border-color .1s, background .1s, transform .04s;
}
.timedrop__item:hover { border-color: var(--primary); transform: translateY(-1px); }
.timedrop__item.is-active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.timedrop__t { font-size: 13px; font-weight: 600; }
.timedrop__c { font-size: 10px; line-height: 1; min-height: 10px; color: var(--text-muted); }
.timedrop__item.is-busy { background: var(--st-prog-bg); }
.timedrop__item.is-busy .timedrop__t, .timedrop__item.is-busy .timedrop__c { color: var(--st-prog-fg); }
.timedrop__item.is-full { background: var(--st-cancel-bg); }
.timedrop__item.is-full .timedrop__t, .timedrop__item.is-full .timedrop__c { color: var(--st-cancel-fg); }
.timedrop__item.is-active .timedrop__t, .timedrop__item.is-active .timedrop__c { color: #fff; }

/* ==================== Анимации ==================== */
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes inUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.anim-pop { animation: pop .16s ease; }
/* fill-mode именно backwards, а НЕ both. При both конечный кадр остаётся «в силе»
   навсегда, и transform карточки вычисляется в matrix(1,0,0,1,0,0) вместо none —
   а любой transform, отличный от none, навсегда делает карточку stacking context.
   Тогда выпадающие меню внутри карточки (выбор времени, календарь) со своим
   z-index заперты внутри неё и уходят ПОД карточку, которая идёт следом: слоты
   времени видны, но кликнуть по ним нельзя. backwards гасит анимацию после
   завершения, оставляя карточку обычным элементом; вид при этом тот же —
   конечный кадр совпадает с собственными стилями карточки. */
.anim-in { animation: inUp .34s cubic-bezier(.22,.61,.36,1) backwards; animation-delay: var(--d, 0s); }
.datepicker { animation: pop .16s ease; }
.btn { transition: background .14s, border-color .14s, transform .05s, box-shadow .14s; }
.btn:hover { transform: translateY(-1px); }
.stat { transition: border-color .14s, transform .12s, box-shadow .14s; }
.input, .status-select { transition: border-color .14s, box-shadow .14s; }
.table tbody tr { transition: background .12s; }
.modal__dialog { animation: pop .18s ease; }
.toast { transition: opacity .2s, transform .2s; }
@media (prefers-reduced-motion: reduce) {
  .anim-in, .anim-pop, .datepicker, .timedrop__menu, .modal__dialog, .nav-drop__menu, .user-menu { animation: none !important; }
  .btn:hover, .stat:hover, .pill:hover { transform: none !important; }
}

.city-item__meta { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.city-add { flex-wrap: wrap; }
.city-new { margin-bottom: 16px; }


/* ==================== Иконки (SVG) ==================== */
.ic { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.ic svg { width: 1em; height: 1em; display: block; }
.card__icon { font-size: 18px; color: var(--primary); }
.brand__logo { font-size: 22px; color: var(--primary); }
.login__logo { font-size: 46px; color: var(--primary); display: flex; justify-content: center; margin-bottom: 6px; }
.pill .ic, .btn--icon .ic { font-size: 15px; }
.cell-clip .ic { font-size: 14px; vertical-align: -2px; }

/* ==================== Автозаполнение / кнопки полей ==================== */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus,
.input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 40px var(--surface) inset;
  box-shadow: 0 0 0 40px var(--surface) inset;
  caret-color: var(--text);
  transition: background-color 100000s ease-in-out 0s;
}
.att-input { font-size: 13px; color: var(--text-muted); }
.att-input::file-selector-button {
  appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; margin-right: 10px; transition: background .12s, border-color .12s;
}
.att-input::file-selector-button:hover { background: var(--surface-2); border-color: var(--primary); }
input[type=number] { appearance: textfield; -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ==================== Мобильная адаптация ==================== */
/* Прокрутка к элементу (scrollIntoView, переход по якорю, фокус) не должна
   подставлять его под липкую шапку сайта. */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 8px); }

/* Планшеты и крупные телефоны */
@media (max-width: 768px) {
  .page { padding: 16px 14px; }
  /* Гамбургер и раскрытое меню описаны выше, в блоке ≤1100px — здесь только то,
     что специфично для телефона. */
  .site-header__inner { padding: 9px 14px; }
  .site-header__actions { gap: 10px; }
  .user-chip__role { display: none; }            /* компактный профиль */
  .user-chip__name { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Крупнее шрифт полей — iOS не зумит при фокусе (нужно >=16px) */
  .input, .status-select, .timedrop__btn, .att-input { font-size: 16px; }

  .form-topbar { flex-wrap: wrap; }
  .form-topbar__left, .form-topbar__right { flex-wrap: wrap; }
  .form-topbar__right { width: 100%; }
  .form-topbar__right .btn { flex: 1; justify-content: center; }
  .form-author { flex-basis: 100%; align-self: flex-start; }

  /* Фильтры списка — по два в ряд, кнопка сброса на всю ширину */
  .filters { grid-template-columns: repeat(2, 1fr); }
  .filter__reset { grid-column: 1 / -1; justify-self: stretch; }

  /* Крупнее зоны нажатия у мелких кнопок */
  .btn--sm { padding: 8px 13px; }
  .btn--icon { padding: 8px 11px; }

  .page__title { font-size: 20px; }
  .stat__value { font-size: 22px; }
  .table th, .table td { padding: 10px 11px; }
  .report-controls .filter { flex: 1 1 calc(50% - 6px); }
}

/* Телефоны */
@media (max-width: 560px) {
  .filters { grid-template-columns: 1fr; }
  .report-controls .filter { flex-basis: 100%; }
  /* Элемент города/источника: имя на своей строке, метки и кнопки — ниже */
  .city-item { flex-wrap: wrap; }
  .city-item__name { flex-basis: 100%; }
  .client-summary { gap: 14px; }
  .modal { padding: 10px; }
  .modal__dialog--sm { max-width: 100%; }
  .form { padding: 16px; }
}

/* Узкие телефоны */
@media (max-width: 430px) {
  .timedrop__menu { grid-template-columns: repeat(4, 1fr); width: min(320px, 92vw); }
  .quick-dates .btn { flex: 1; }
}

/* ==================== Шапка на телефоне: строго ОДНА строка ==================
   Было: гамбургер + логотип + «+ Новая заявка» + имя не влезали в 390px, шапка
   переносилась на два ряда и съедала пол-экрана. Ужимаем содержимое, а не
   разрешаем перенос.

   ВАЖНО про пороги. Ужимать надо ровно настолько, насколько не хватает места, и ни
   капли больше. Замер на 390px: гамбургер 42 + логотип 44 + кнопка + профиль = ~300px
   из 390 — свободно ещё 90px, а прежние пороги при этом уже рубили кнопку до голого
   «+» и резали имя многоточием («Администрат…»). Пороги пересчитаны по замеру:
   ширины ниже — это то, что реально требуется тексту, а не догадка. */
@media (max-width: 768px) {
  .site-header__inner { flex-wrap: nowrap; row-gap: 0; gap: 8px; }
  /* Меню, раскрытое гамбургером, — единственное, что имеет право уйти на новую строку. */
  .site-header.is-nav-open .site-header__inner { flex-wrap: wrap; }
  .site-header__actions { gap: 8px; min-width: 0; }
  .cta-new { padding-left: 12px; padding-right: 12px; white-space: nowrap; }
  .cta-new__long { display: none; }              /* «+ заявка» вместо «+ Новая заявка» */
  .user-chip { padding: 4px 6px; min-width: 0; }
  /* «Администратор» — самая длинная роль, ей нужно 104px. Даём 150px с запасом. */
  .user-chip__name { max-width: 150px; }
}
/* Название «CRM «Клининг на выезд»» требует 208px. Вместе с гамбургером, кнопкой и
   профилем всё это перестаёт помещаться примерно с 540px — ниже остаётся логотип. */
@media (max-width: 560px) {
  .brand__title { display: none; }
}
/* Совсем узко (iPhone SE, 320px): жертвуем подписью кнопки, а не именем — кнопку
   и без текста узнают по «+», а обрезанное «Администрат…» выглядит поломкой.
   Замер: при кнопке-«+» имени остаётся 123px, ему нужно 104px. */
@media (max-width: 340px) {
  .cta-new__short { display: none; }
  .cta-new { padding-left: 14px; padding-right: 14px; font-size: 18px; }
  .user-chip__name { max-width: 120px; }
}

/* ==================== Таблицы → карточки на телефоне ==================== */
/* На узких экранах широкая таблица неудобна (горизонтальная прокрутка 11 колонок).
   Каждую строку показываем карточкой: имя-заголовок + строки «подпись: значение». */
@media (max-width: 700px) {
  .table-wrap { border: none; box-shadow: none; background: none; overflow: visible; }
  .table, .table tbody { display: block; }
  .table { min-width: 0; font-size: 15px; }
  .table thead { display: none; }

  .table tr {
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 12px; overflow: hidden;
  }
  /* Строка карточки: «подпись | значение». minmax(0,1fr) даёт значению сжиматься
     и переноситься — карточка никогда не выходит за ширину экрана. */
  .table td {
    display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: baseline;
    padding: 9px 14px; border-bottom: 1px solid var(--border);
    text-align: right; box-shadow: none; white-space: normal; overflow-wrap: anywhere;
  }
  .table td:last-child { border-bottom: none; }
  .table td::before {
    content: attr(data-label); text-align: left;
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    text-transform: none; letter-spacing: 0;
  }
  /* Второстепенное в карточке скрываем (видно при открытии заявки) */
  .table td.cell-muted, .table td.cell-clip { display: none; }
  /* Имя клиента — крупный заголовок карточки, наверху */
  .table td.cell-name {
    order: -1; display: flex; justify-content: flex-start; text-align: left;
    flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; background: var(--surface-2);
  }
  .table td.cell-name::before { display: none; }
  .table td.cell-name .client-link { font-size: 16px; }
  .table td.cell-id { color: var(--text-muted); font-size: 13px; }
  .table td.cell-money { font-weight: 700; }
  .table td .status-select { justify-self: end; max-width: 100%; font-size: 14px; }
  /* Клиенты: имя — заголовок, счётчик крупнее */
  .table td[data-label="Заявок"] { font-weight: 600; }
}

/* ==================== История изменений заявки ==================== */
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.hist-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 11px; border-left: 2px solid var(--primary); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.hist-when { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.hist-text { font-size: 13px; line-height: 1.4; word-break: break-word; }
.hist-old { color: var(--text-muted); text-decoration: line-through; }
.hist-new { color: var(--text); font-weight: 600; }
.hist-empty { color: var(--text-muted); text-align: center; border-left-color: transparent; }

/* ==================== Пометки-флаги в списке заявок ==================== */
.flag-badges { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.flag-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 3px 7px; border-radius: 999px; white-space: nowrap;
}
.flag-badge .ic { font-size: 12px; }
.flag-badge--urgent { background: var(--st-cancel-bg); color: var(--st-cancel-fg); }
.flag-badge--callback { background: var(--st-prog-bg); color: var(--st-prog-fg); }
.flag-badge--review { background: var(--st-clar-bg); color: var(--st-clar-fg); }
.flag-badge--claim { background: var(--st-cancel-bg); color: var(--st-cancel-fg); }
/* Срочные строки — заметный левый акцент поверх статусной подсветки */
tr.is-urgent td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
tr.is-urgent .cell-id::after { content: "!"; color: var(--danger); font-weight: 800; margin-left: 3px; }

/* ==================== Кастомная прокрутка (под стиль сайта) ==================== */
.table-wrap, .stats { scrollbar-width: thin; scrollbar-color: var(--border) var(--surface-2); }
.table-wrap::-webkit-scrollbar, .stats::-webkit-scrollbar { height: 10px; }
.table-wrap::-webkit-scrollbar-track, .stats::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 999px; }
.table-wrap::-webkit-scrollbar-thumb, .stats::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 999px; border: 2px solid var(--surface-2);
}
.table-wrap:hover::-webkit-scrollbar-thumb, .stats:hover::-webkit-scrollbar-thumb { background: var(--text-muted); }
.table-wrap::-webkit-scrollbar-thumb:hover, .stats::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ==================== Кастомные чекбоксы (выбор городов и т.п.) ==================== */
.check { gap: 8px; padding: 3px 2px; }
.check input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 18px; height: 18px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--surface); cursor: pointer;
  display: inline-grid; place-content: center;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.check input[type="checkbox"]::before {
  content: ""; width: 11px; height: 11px; transform: scale(0);
  transition: transform .12s ease; background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.check input[type="checkbox"]:hover { border-color: var(--primary); }
.check input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--st-new-bg); }
.check input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
.check input[type="checkbox"]:checked::before { transform: scale(1); }

/* ==================== Претензии ==================== */
.claim-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.claim-item {
  display: flex; flex-direction: column; gap: 5px; padding: 10px 12px;
  border: 1px solid var(--border); border-left: 3px solid var(--danger);
  border-radius: 8px; background: var(--surface-2);
}
.claim-item.is-resolved { border-left-color: var(--st-done-fg); opacity: .85; }
.claim-item__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.claim-item__meta { font-size: 12px; color: var(--text-muted); }
.claim-item__text { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.claim-item__resolved { font-size: 12px; color: var(--text-muted); }
.claim-status { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.claim-status--open { background: var(--st-cancel-bg); color: var(--st-cancel-fg); }
.claim-status--resolved { background: var(--st-done-bg); color: var(--st-done-fg); }
.claim-item .btn--sm { align-self: flex-start; margin-top: 2px; }
.claim-empty { border: none; background: none; padding: 8px; color: var(--text-muted); text-align: center; }
.claim-add { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.claim-add .form__actions { margin: 0; }

.user-item__role.role-okk { background: var(--st-clar-bg); color: var(--st-clar-fg); }
.user-item__role.role-city_admin { background: var(--st-prog-bg); color: var(--st-prog-fg); }


/* ============================================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ (телефон в руке, а не мышь)
   Правила ниже — итог замеров на экране 390×844: см. что было не так в каждом
   комментарии. Блок идёт последним, чтобы перебивать частные правила выше.
   ========================================================================= */
@media (max-width: 700px) {

  /* --- 1. Ничего не должно вылезать за край экрана ---------------------------
     #disp-table задан по id (min-width: 420px) и перебивал мобильное
     `.table { min-width: 0 }` — из-за этого отчёты уезжали вбок на 44px. */
  #disp-table { min-width: 0; }

  /* --- 2. iOS зумит вьюпорт, если у поля шрифт меньше 16px -------------------
     Экран «прыгает» при каждом тапе в поле. 16px лечит это на корню. */
  .input, .status-select, select, textarea, .calc-search__input { font-size: 16px; }

  /* --- 3. Палец — не мышь: цель меньше ~44px тяжело нажать -------------------
     Замер показал кнопки 20–38px по высоте. */
  .btn { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
  .input:not(textarea), select { min-height: 44px; }
  .status-select { min-height: 40px; padding: 8px 30px 8px 12px; }
  .calc-row__name { min-height: 44px; }
  .calc-search__input { min-height: 44px; }
  summary { min-height: 44px; display: flex; align-items: center; }
  /* Логотип в шапке был 22×22 — в него не попасть. */
  .brand { min-height: 44px; min-width: 44px; }
  /* «сменить пароль» в баннере — строчная ссылка высотой 20px. Больше растягивать
     нельзя: она внутри предложения, и высокий блок разорвал бы строку баннера. */
  .linklike { display: inline-block; padding: 9px 4px; }

  /* --- 4. Доска расчёта: мелкий шрифт нечитаем с телефона --------------------
     Замер: 78 элементов мельче 12px. Цена и единица — то, что диспетчер читает
     клиенту вслух, они не могут быть в 11px. */
  .calc-row__slot, .calc-row__unit { font-size: 13px; }
  .calc-col__title { font-size: 12px; }
  .calc-chip { font-size: 13px; padding: 5px 5px 5px 10px; }
  .calc-chip__x { padding: 4px 7px; }
  .calc-script__say { font-size: 16px; }
  .calc-head__label, .calc-head__count, .calc-head__time { font-size: 13px; }
  .calc-search__count { font-size: 12px; }
  /* Доска на телефоне — строго одна колонка, иначе строки сплющиваются. */
  .calc-groups { columns: 1; }
  /* Группы сворачиваются: 30 строк в столбик растянули бы форму на тысячи пикселей.
     Первая группа («Уборка помещения») остаётся открытой. */
  .calc-col__title {
    cursor: pointer; font-size: 13px; padding: 10px 2px; margin: 0; min-height: 44px;
  }
  .calc-col__title::after {
    content: "▾"; margin-left: auto; font-size: 14px; transition: transform .15s;
  }
  .calc-col[open] .calc-col__title::after { transform: rotate(180deg); }
  /* Счётчик выбранного — единственный признак, что в свёрнутой группе что-то есть. */
  .calc-col__badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
    letter-spacing: 0;
  }

  /* --- 5. Фильтры: 11 полей в столбик занимали целый экран до первой заявки ---
     common.js сворачивает их в <details>. Раскрывается по тапу. */
  .filters-fold {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px;
  }
  .filters-fold__head {
    padding: 12px 14px; font-weight: 650; font-size: 15px;
    display: flex; align-items: center; gap: 8px; cursor: pointer;
  }
  .filters-fold__head::-webkit-details-marker { display: none; }
  .filters-fold__head::after {
    content: "▾"; margin-left: auto; color: var(--text-muted);
    transition: transform .15s;
  }
  .filters-fold[open] .filters-fold__head::after { transform: rotate(180deg); }
  .filters-fold__count {
    padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700;
    background: var(--primary); color: #fff;
  }
  .filters-fold .filters {
    margin: 0; border: none; box-shadow: none; background: none;
    border-top: 1px solid var(--border); border-radius: 0;
  }

  /* --- 6. Плитки статусов: 3 в ряд, читаемо, не режутся ----------------------
     Сетка задана выше (блок ≤720px). Раньше здесь стояли flex-правила поверх уже
     включённого display: grid — они не действовали вовсе, и вместо трёх плиток в
     ряд получалось шесть. */
  .stat { padding: 12px 10px; }
  .stat__value { font-size: 22px; }
  .stat__label { font-size: 12px; }      /* мельче 12px на телефоне не читается */

  /* --- 8. Точечное: то, что осталось мелким после замеров -------------------- */
  /* Селект статуса прямо в карточке заявки. Правило `.table td .status-select`
     выше по специфичности, поэтому переопределяем именно им, иначе останется 14px
     (и iOS будет зумить экран при каждом тапе). */
  .table td .status-select { font-size: 16px; min-height: 44px; }
  /* Имя клиента — главная ссылка карточки, в неё и целятся пальцем. Замер: 89×35 —
     не дотягивала до 44px. */
  .client-link { display: inline-block; padding: 11px 0; min-height: 44px; }

  /* --- 7. Верхняя панель формы: кнопки в строку, не наезжают ----------------- */
  .form-topbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .form-topbar__right { flex-wrap: wrap; }
  .form-topbar__right .btn { flex: 1 1 auto; justify-content: center; }
}

/* Совсем узкие экраны (iPhone SE и подобные). */
@media (max-width: 400px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .page { padding-left: 12px; padding-right: 12px; }
}
