/*
 * Оформление интерфейса «Production».
 *
 * Один файл без препроцессоров и сборки. Палитра и размеры собраны в переменные:
 * менять внешний вид можно правкой блока :root, не трогая правила ниже.
 * Тёмная тема включается автоматически по настройке системы.
 */

:root {
  --bg: #f4f5f3;
  --surface: #ffffff;
  --surface-2: #fafbf9;
  --border: #dcdfd8;
  --text: #1f2420;
  --muted: #6b7269;
  --accent: #2f6f4e;
  --accent-soft: #e6f0ea;
  --ok: #2f6f4e;
  --warn: #9a6b1f;
  --danger: #a63a2f;
  --work: #2b5b86;
  --radius: 14px;
  --radius-sm: 9px;
  /* Поле внутри карточки: 20 точек на компьютере, 16 на телефоне. */
  --pad: 20px;
  --line: color-mix(in srgb, var(--border) 70%, transparent);
  --shadow: 0 1px 2px rgba(20, 30, 24, 0.04), 0 2px 14px rgba(20, 30, 24, 0.045);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141715;
    --surface: #1c211e;
    --surface-2: #232823;
    --border: #333a35;
    --text: #e7ebe6;
    --muted: #98a096;
    --accent: #6fb98f;
    --accent-soft: #21302a;
    --ok: #6fb98f;
    --warn: #d6a656;
    --danger: #e07a6c;
    --work: #6ba4d8;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  }
}

* {
  box-sizing: border-box;
}

/* Safari на iPhone увеличивает шрифт при повороте экрана «для удобства» — и вёрстка,
   рассчитанная на свою ширину, начинает вылезать за край. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
}

h1 {
  font-size: 26px;
}
h2 {
  font-size: 17px;
}
h3 {
  font-size: 16px;
}

a {
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: var(--mono);
  font-size: 0.94em;
  white-space: nowrap;
}

.right {
  text-align: right;
}

.nowrap {
  white-space: nowrap;
}

/* --------------------------------------------------------------- оболочка

   Широкий экран: боковая панель с разделами слева, рабочая область справа.
   Телефон (до 900 точек): панели нет, сверху строка с названием раздела, снизу —
   вкладки со значками. Разметка одна на оба вида, переключает её этот файл. */

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
}

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

.logo {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 12px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px;
  color: var(--text);
  text-decoration: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-text strong {
  font-size: 16px;
}

.brand-text span {
  font-size: 12px;
  color: var(--muted);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.side-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-group-title {
  padding: 0 10px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.side-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}

.side-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.side-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* «Найти заказ» — похожа на поле ввода, чтобы её узнавали как поиск, а не как раздел. */
.side-search {
  margin: 14px 0 4px;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.side-search span:not(.side-kbd) {
  flex: 1;
}

.side-kbd {
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface);
}

.side-user {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  min-width: 0;
}

.who-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.who-name {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who-role {
  font-size: 12px;
  color: var(--muted);
}

.side-actions {
  display: flex;
  flex-direction: column;
}

.side-action {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.side-action:hover {
  background: var(--surface-2);
  color: var(--text);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.avatar-small {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  font-size: 12px;
}

.icon {
  flex: 0 0 auto;
  display: block;
}

/* Верхняя строка и вкладки — только на телефоне. */
.topbar,
.tabbar {
  display: none;
}

.content {
  flex: 1;
  padding: 24px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Раздел появляется мягко, а не вспышкой. Кому движение мешает — без него. */
.content > * {
  animation: rise 0.18s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation: none !important;
    transition: none !important;
  }
}

/* Контур раздела, пока он грузится. */
.skeleton .sk-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px var(--pad);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sk-head,
.sk-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sk-row {
  flex-direction: row;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sk-line {
  display: block;
  height: 12px;
  flex: 1;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.sk-title {
  height: 18px;
  flex: none;
  width: 32%;
}

.sk-sub {
  flex: none;
  width: 55%;
}

.sk-short {
  flex: 0 0 22%;
}

.sk-tiny {
  flex: 0 0 12%;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  align-items: start;
}

/* --------------------------------------------------------------- карточки */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Шапка без черты снизу: заголовок отделён воздухом, а не линией — так карточка
   читается одним куском, как в современных рабочих системах. */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px var(--pad) 12px;
  flex-wrap: wrap;
}

.card-title h2 {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.card-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.card-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* «⋯» с остальными действиями шапки — только на телефоне. Селектор с родителем:
   иначе его перебивает `.btn-icon`, объявленный ниже по файлу. */
.card-actions .card-more {
  display: none;
}

.card-body {
  padding: 4px 0 0;
}

.card-body .fields,
.card-body .note,
.card-body .empty,
.card-body .loading,
.card-body .form,
.card-body .toolbar,
.card-body > .form-row,
.card-body > .stats,
.card-body > h3 {
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.card-body > h3 {
  margin-top: 18px;
  font-size: 15px;
}

.card-body > *:last-child {
  margin-bottom: 14px;
}

/* --------------------------------------------------------------- таблицы */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th:first-child,
td:first-child {
  padding-left: var(--pad);
}

th:last-child,
td:last-child {
  padding-right: var(--pad);
}

/* Заголовки колонок — тихие и без капслока: их читают один раз, а смотрят на данные. */
th {
  font-weight: 500;
  color: var(--muted);
  font-size: 12.5px;
  background: var(--surface-2);
  white-space: nowrap;
  padding-top: 9px;
  padding-bottom: 9px;
}

@media (hover: hover) and (min-width: 721px) {
  tbody tr:hover {
    background: color-mix(in srgb, var(--surface-2) 75%, transparent);
  }
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr.clickable {
  cursor: pointer;
}

tbody tr.clickable:hover {
  background: var(--surface-2);
}

td.right,
th.right {
  text-align: right;
  white-space: nowrap;
}

td.actions {
  white-space: nowrap;
  text-align: right;
}

td.actions .btn {
  margin-left: 6px;
  vertical-align: middle;
}

/* Длинный список с шапкой, которая не уходит вверх при прокрутке. Шапка липнет к
   ближайшей прокручиваемой рамке, а у таблицы она своя (листается вбок) — поэтому
   рамка листается и вниз, высотой в экран. На телефоне шапки нет: строки — карточки. */
@media (min-width: 721px) {
  .table-sticky-head {
    max-height: calc(100vh - 120px);
    overflow: auto;
  }

  .table-sticky-head thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: inset 0 -1px 0 var(--line);
  }

  .table-sticky-head thead th.actions-menu {
    right: 0;
    z-index: 3;
  }
}

/* Колонка, где только «⋯»: если таблица шире окна (ноутбук, планшет), она прокручивается
   вбок, а «⋯» остаётся у правого края — иначе до него не дотянуться, не пролистав. */
td.actions-menu {
  position: sticky;
  right: 0;
  background: var(--surface);
  box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------------------- элементы */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}

/* Цветной статус — с точкой впереди: цвет узнаётся и там, где слово не прочитано. */
.badge-ok::before,
.badge-work::before,
.badge-wait::before,
.badge-danger::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}

.badge-ok {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--ok);
}

.badge-work {
  background: color-mix(in srgb, var(--work) 12%, transparent);
  border-color: transparent;
  color: var(--work);
}

.badge-wait {
  background: color-mix(in srgb, var(--warn) 15%, transparent);
  border-color: transparent;
  color: var(--warn);
}

.badge-danger {
  background: color-mix(in srgb, var(--danger) 13%, transparent);
  border-color: transparent;
  color: var(--danger);
}

.progress {
  height: 6px;
  min-width: 70px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 20px;
  padding-top: 12px;
}

/* Счётчики этапа идут одной строкой и переносятся, если не влезли: на телефоне
   три метки в узкой ячейке иначе растянули бы карточку. */
.counters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Плитки сводки. От `.fields` отличаются размером числа: сводку читают с расстояния
   вытянутой руки, а не вчитываются в неё, — поэтому число крупное, а подпись мелкая.
   Сетка та же (auto-fit), поэтому на телефоне плитки встают в одну колонку сами. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding-top: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  /* Длинная сумма («1 234 567,00 ₽») не должна разрывать плитку на телефоне. */
  overflow-wrap: anywhere;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

.stat-hint {
  font-size: 12px;
  color: var(--muted);
}

.stat-danger {
  border-color: var(--danger);
}

.stat-danger .stat-value {
  color: var(--danger);
}

.stat-warn {
  border-color: var(--warn);
}

.stat-warn .stat-value {
  color: var(--warn);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
}

.field-value {
  font-weight: 500;
}

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, filter 0.12s;
}

.btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(20, 30, 24, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  background: var(--accent);
}

.btn-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

a.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding-top: 12px;
}

.form {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

/* Скрытое поле формы: display: flex иначе перебил бы атрибут hidden. */
.input[hidden] {
  display: none;
}

.input {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.input input,
.input select,
.input textarea {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  width: 100%;
  min-height: 38px;
}

.input textarea {
  resize: vertical;
}

.input input:focus,
.input select:focus,
.input textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: -1px;
}

/* Поле даты «ДД.ММ.ГГГГ» (web/ui.js, dateInput): текст с маской и значок календаря;
   поверх значка — прозрачное обычное поле даты, оно открывает выбор даты браузера. */
.date-field {
  position: relative;
  display: flex;
}

.input .date-field input[type='text'] {
  padding-right: 44px;
}

.input .date-field input.invalid {
  border-color: var(--danger, #c0392b);
}

.date-pick {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  pointer-events: none;
}

.date-field:hover .date-pick {
  color: var(--text);
}

/* Прозрачное обычное поле даты поверх значка: по нему и нажимают. */
.input .date-field input.date-native {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 40px;
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

/* --------------------------------------------------------------- сообщения */

.note,
.empty,
.loading {
  margin: 12px 0;
  color: var(--muted);
  font-size: 14px;
}

.empty,
.loading {
  padding: 16px;
  text-align: center;
}

.note-error {
  color: var(--danger);
}

.note-ok {
  color: var(--ok);
}

.note-warn {
  color: var(--warn);
}

/* Кнопки под списком строк заявки: «+ Ещё позиция» и «+ Баллон БМК» в один ряд. */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Выбор позиции поиском: подсказки раскрываются под полем, в потоке формы. */
.picker-list {
  margin-top: 4px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.picker-item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 9px 11px;
  cursor: pointer;
}

.picker-item:last-child {
  border-bottom: 0;
}

.picker-item:hover,
.picker-item.active {
  background: var(--accent-soft);
}

.picker-item.chosen {
  font-weight: 600;
}

.picker-build {
  color: var(--accent);
}

.picker-meta {
  font-size: 12px;
  color: var(--muted);
}

.picker-empty {
  padding: 9px 11px;
  font-size: 14px;
  color: var(--muted);
}

/* Конструктор БМК: шесть параметров ровной сеткой — три в ряд, на телефоне два. */
.bmk-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 560px) {
  .bmk-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Конструктор БМК: собранная маркировка и характеристики, как в КП. */
.bmk-result {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.bmk-marking {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.bmk-result .note {
  margin: 6px 0;
}

.bmk-chars {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

/* Этап заказа в цехе у менеджера: полоса и под ней «Этап 3 из 10: Намотка». */
.order-stage {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  font-size: 13px;
}

/* Строки новой заявки: позиция, количество и крестик в ряд, под ними — что скажет склад.
   Ряд не переносится на телефоне: количество узкое, а крестик должен стоять у своей строки. */
.order-lines {
  display: grid;
  gap: 10px;
}

.order-line {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.order-line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px auto;
  gap: 8px;
  align-items: end;
}

.order-line .note {
  margin: 0;
  font-size: 13px;
}

/* Обработка помимо цвета у строки заявки (web/finishes.js): свёрнута, в заголовке — что
   выбрано. Галочки — «пилюлями» в строку: их десяток, в столбик форма стала бы втрое длиннее. */
.finish-picker > summary {
  cursor: pointer;
  font-size: 14px;
  list-style: none;
  padding: 4px 0;
}

.finish-picker > summary::-webkit-details-marker {
  display: none;
}

.finish-picker > summary::before {
  content: '▸';
  display: inline-block;
  width: 16px;
  color: var(--muted);
}

.finish-picker[open] > summary::before {
  content: '▾';
}

.finish-picker[open] {
  display: grid;
  gap: 8px;
  padding-bottom: 4px;
}

.finish-group {
  display: grid;
  gap: 4px;
}

.finish-group-title {
  font-size: 12px;
  color: var(--muted);
}

.finish-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.finish-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}

.finish-chip:hover,
.finish-chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.finish-chip input {
  margin: 0;
  accent-color: var(--accent, currentColor);
}

/* Обработка под цветом в составе заказа. */
.line-finish {
  font-size: 12px;
  color: var(--muted);
}

.form-error {
  color: var(--danger);
  font-size: 14px;
  margin: 4px 0 0;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.toast {
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 14px;
  max-width: 380px;
  animation: toast-in 0.2s ease;
}

.toast-ok {
  border-left: 3px solid var(--ok);
}

.toast-error {
  border-left: 3px solid var(--danger);
}

.toast-info {
  border-left: 3px solid var(--work);
}

.toast-link {
  cursor: pointer;
}

/* Счётчик на пункте меню: сколько заявок ждёт ответа. */
.nav-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: auto;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.nav-count[hidden] {
  display: none;
}

/* На вкладке телефона, плитке «Ещё» и в узкой панели подписи нет — счётчик садится на
   угол значка. */
.side-item,
.tab,
.tile {
  position: relative;
}

.tab .nav-count,
.tile .nav-count {
  position: absolute;
  top: 2px;
  left: calc(50% + 6px);
  margin: 0;
}

@media (min-width: 901px) and (max-width: 1280px) {
  .side-item .nav-count {
    position: absolute;
    top: 2px;
    right: 2px;
    margin: 0;
  }
}

.toast.leaving {
  opacity: 0;
  transition: opacity 0.3s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* --------------------------------------------------------------- модальное окно */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 17, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
  width: min(560px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
}

.modal-body > .form {
  padding-top: 0;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------- меню действий

   Кнопка «⋯» в строке таблицы и то, что она открывает: на широком экране — меню под
   кнопкой, на телефоне — шторку снизу. Пункты одинаковые, разметку строит ui.js. */

.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
}

.btn-icon:hover:not(:disabled),
.btn-icon[aria-expanded='true'] {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.menu {
  position: fixed;
  z-index: 60;
  min-width: 230px;
  max-width: min(320px, calc(100vw - 16px));
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 38px rgba(15, 20, 17, 0.18), 0 2px 8px rgba(15, 20, 17, 0.08);
  animation: menu-in 0.12s ease-out;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.menu-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.menu-item .icon {
  margin-top: 1px;
  color: var(--muted);
}

.menu-item:hover:not(:disabled),
.menu-item:focus-visible {
  background: var(--surface-2);
  outline: none;
}

.menu-item:disabled {
  cursor: not-allowed;
  color: var(--muted);
}

.menu-danger,
.menu-danger .icon {
  color: var(--danger);
}

.menu-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.menu-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.menu-sep {
  height: 1px;
  margin: 5px 4px;
  background: var(--border);
}

.icon-gap {
  width: 18px;
  flex: 0 0 18px;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 20, 17, 0.42);
  animation: fade-in 0.16s ease-out;
}

.sheet-overlay.leaving {
  opacity: 0;
  transition: opacity 0.16s;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.sheet {
  width: min(560px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
  padding-bottom: env(safe-area-inset-bottom);
  animation: sheet-up 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

.sheet-grip {
  width: 38px;
  height: 5px;
  margin: 8px auto 2px;
  border-radius: 3px;
  background: var(--border);
}

.sheet-head {
  padding: 8px 20px 4px;
}

.sheet-head p {
  margin: 2px 0 0;
  font-size: 13px;
}

.sheet-body {
  padding: 8px 12px;
  overflow-y: auto;
}

.sheet-body > .who {
  padding: 8px 10px 12px;
}

.sheet-menu {
  display: flex;
  flex-direction: column;
}

.sheet-menu .menu-item,
.sheet-menu .side-action {
  padding: 13px 10px;
  font-size: 16px;
}

.sheet-menu .side-action {
  color: var(--text);
}

.sheet-menu .menu-item .icon,
.sheet-menu .side-action .icon {
  width: 20px;
  height: 20px;
}

.sheet-foot {
  padding: 8px 16px 12px;
  border-top: 1px solid var(--border);
}

.sheet-foot .btn {
  width: 100%;
  padding: 11px;
  font-size: 15px;
}

.sheet-group + .sheet-group {
  margin-top: 14px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 4px 0;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

.tile .icon {
  color: var(--muted);
}

.tile.active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.tile.active .icon {
  color: var(--accent);
}

/* --------------------------------------------------------------- вход */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
  width: min(520px, 100%);
}

.login-card h1 {
  margin-bottom: 2px;
}

/* Логин и пароль в столбик: на узком экране строка из двух полей и кнопки не помещается. */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0 0;
}

.login-form input {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.login-form input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: -1px;
}

.login-form .btn {
  margin-top: 2px;
}

/* Переключение «вход ⇄ регистрация» и кнопки, выглядящие ссылкой.
   Кнопка, а не <a>: никуда не ведёт, а переключает экран — ссылка сбивала бы с толку
   и не работала бы с клавиатуры так, как ожидается от действия. */
.login-switch {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.linklike {
  font: inherit;
  font-size: inherit;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.linklike:hover {
  text-decoration-thickness: 2px;
}

.linklike:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Форма регистрации: полей больше, чем у входа, и каждому нужна подпись. */
.register-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0 0;
}

.register-form .btn {
  margin-top: 4px;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
}

/* Демонстрационный вход. Всего блока нет, когда на сервере снят DEMO_MODE. */
.login-demo {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.login-hint {
  margin: 14px 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.demo-password {
  margin: 0 0 10px;
}

.demo-password input {
  font: inherit;
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.demo-password input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: -1px;
}

.login-accounts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 6px;
}

.account {
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.account:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.account-current,
.account-current:hover {
  cursor: default;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.account-name {
  font-size: 14px;
  font-weight: 500;
}

.account-role {
  font-size: 12px;
  color: var(--muted);
}

/* --------------------------------------------------------------- песочница */

/* Демо для посетителей сайта студии: не форма входа, а приглашение попробовать.
   «С чего начать» — пять ролей с подсказкой, что в каждой нажать; остальные сотрудники
   свёрнуты, чтобы список из двенадцати человек не встречал посетителя первым. */
.sandbox-card {
  width: min(560px, 100%);
}

.sandbox-eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Выбор производства: кнопки-переключатели, переносятся на телефоне. */
.sandbox-projects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 4px;
}

.sandbox-project {
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.sandbox-project:hover {
  border-color: var(--accent);
}

.sandbox-project.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

.sandbox-subtitle {
  margin: 20px 0 8px;
  font-size: 15px;
}

.sandbox-tries {
  display: grid;
  gap: 6px;
}

.sandbox-try {
  width: 100%;
  padding: 10px 12px;
}

.sandbox-all {
  margin-top: 14px;
}

.sandbox-all > summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--accent);
}

.sandbox-all .login-demo {
  margin-top: 4px;
  padding-top: 0;
  border-top: 0;
}

.sandbox-foot {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.sandbox-foot a {
  color: var(--accent);
}

/* --------------------------------------------------------------- витрина */

/* Витрина — это не экран входа, а страница о системе: рассказ, снимки экранов,
   демонстрационная дверь и подвал. Оформление у неё своё и живёт отдельно от
   рабочего интерфейса: там плотность и таблицы, здесь воздух и крупный текст.
   Переменные — общие, поэтому тёмная тема достаётся витрине даром.

   Снимки экранов ниже (.shot и всё, что внутри) — это разметка, а не картинки:
   в поставке нет ни одного файла изображения, а внешние ресурсы интерфейсу
   запрещены. Зато они не устаревают и работают в обеих темах. */

.showcase {
  --wrap: 1060px;
  --ink: color-mix(in srgb, var(--text) 78%, transparent);
  background: var(--surface);
  color: var(--text);
}

.showcase-wrap {
  width: min(var(--wrap), 100%);
  margin: 0 auto;
  padding: 0 24px;
}

/* Разделы вспоминаются по имени, поэтому ссылки в шапке ведут якорями. Отступ
   сверху — чтобы липкая шапка не накрывала заголовок раздела при переходе. */
.showcase section {
  scroll-margin-top: 64px;
}

/* ---------------------------------------------------------- шапка */

.showcase-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  /* Сплошной фон, а не «матовое стекло»: с ним Safari на iPhone при прокрутке оставлял
     полосу от прошлого кадра — та же беда, из-за которой уехали нижние вкладки. */
  background: var(--surface);
}

.showcase-nav-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 52px;
}

.showcase-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.showcase-logo {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex: none;
}

.showcase-nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
  font-size: 13.5px;
}

.showcase-nav-links a {
  color: var(--ink);
  text-decoration: none;
}

.showcase-nav-links a:hover {
  color: var(--accent);
}

.showcase-nav-demo {
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--surface);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
}

.showcase-nav-demo:hover {
  filter: brightness(1.08);
}

/* ---------------------------------------------------------- первый экран */

.showcase-hero {
  padding: clamp(56px, 9vw, 104px) 0 clamp(40px, 6vw, 72px);
  text-align: center;
  background: radial-gradient(
      120% 100% at 50% 0%,
      color-mix(in srgb, var(--accent-soft) 70%, transparent),
      transparent 62%
    ),
    var(--surface);
}

.showcase-eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.showcase-title {
  margin: 14px 0 0;
  font-size: clamp(34px, 6.4vw, 62px);
  line-height: 1.06;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.showcase-lead {
  margin: 20px auto 0;
  max-width: 640px;
  font-size: clamp(16px, 2.1vw, 20px);
  line-height: 1.5;
  color: var(--ink);
}

.showcase-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.showcase-btn {
  display: inline-block;
  padding: 11px 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.showcase-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.showcase-btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}

.showcase-btn.primary:hover {
  color: var(--surface);
  filter: brightness(1.08);
}

.showcase-hero-note {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.showcase-hero-shot {
  margin-top: clamp(32px, 5vw, 56px);
}

/* ---------------------------------------------------------- числа */

.showcase-numbers {
  padding: clamp(28px, 4vw, 44px) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.showcase-numbers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}

.showcase-number b {
  display: block;
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.showcase-number span {
  display: block;
  margin-top: 5px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink);
}

/* ---------------------------------------------------------- разделы */

.showcase-section {
  padding: clamp(56px, 8vw, 96px) 0;
}

.showcase-section:nth-of-type(even) {
  background: var(--bg);
}

.showcase-h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.14;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-align: center;
}

.showcase-sub {
  margin: 14px auto 0;
  max-width: 620px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  text-align: center;
}

/* Путь заявки: семь шагов подряд. Сетка, а не список в столбик — иначе на широком
   экране семь коротких строк выглядят потерянными. */
.showcase-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px 28px;
  margin: clamp(28px, 4vw, 44px) 0 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.showcase-step {
  display: flex;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.showcase-step-number {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.showcase-step b {
  font-size: 15px;
  font-weight: 600;
}

.showcase-step p {
  margin: 3px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}

/* ---------------------------------------------------------- возможности */

.showcase-features {
  display: flex;
  flex-direction: column;
  gap: clamp(48px, 7vw, 88px);
  margin-top: clamp(40px, 6vw, 72px);
}

.showcase-feature {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
}

/* Развороты чередуются: текст то слева, то справа. Порядок меняется только на
   широком экране — в один столбец текст всегда идёт первым. */
.showcase-feature.flip .showcase-feature-text {
  order: 2;
}

.showcase-icon {
  width: 26px;
  height: 26px;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.showcase-feature-text h3 {
  margin: 12px 0 0;
  font-size: clamp(21px, 2.8vw, 28px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.showcase-feature-text p {
  margin: 12px 0 0;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
}

.showcase-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: clamp(48px, 7vw, 80px);
}

.showcase-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.showcase-card b {
  display: block;
  margin-top: 12px;
  font-size: 16px;
  font-weight: 600;
}

.showcase-card p {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

/* ---------------------------------------------------------- снимки экранов */

.shot {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 30, 24, 0.05), 0 18px 44px rgba(20, 30, 24, 0.09);
  overflow: hidden;
  text-align: left;
}

.showcase-hero-shot .shot {
  max-width: 860px;
  margin: 0 auto;
}

.shot-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.shot-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--border);
}

.shot-title {
  margin-left: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.shot-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.shot-order-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.shot-order-number {
  font-size: 14px;
  font-weight: 600;
}

.shot-order-days {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.shot-order-days.ok {
  color: var(--ok);
}

.shot-order-days.warn {
  color: var(--warn);
}

.shot-order-client {
  margin-top: 1px;
  font-size: 12.5px;
  color: var(--muted);
}

/* Полоса этапов: доля пройденного маршрута. Тот же приём, что на рабочих экранах. */
.shot-track {
  height: 5px;
  margin-top: 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}

.shot-track-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.shot-order-stage {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink);
}

.shot-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.shot-row-name {
  flex: 1;
}

.shot-row-qty {
  color: var(--muted);
  white-space: nowrap;
}

.shot-mark {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11.5px;
  white-space: nowrap;
}

.shot-mark.ok {
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
  background: var(--accent-soft);
  color: var(--ok);
}

.shot-mark.warn {
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  color: var(--warn);
}

.shot-mark.bad {
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
}

.shot-foot {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.shot-task b {
  font-size: 14px;
}

.shot-task span {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.shot-counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.shot-count {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  text-align: center;
}

.shot-count b {
  display: block;
  font-size: 18px;
  font-weight: 600;
}

.shot-count span {
  font-size: 11.5px;
  color: var(--muted);
}

.shot-count.ok b {
  color: var(--ok);
}

.shot-count.warn b {
  color: var(--warn);
}

.shot-verdict {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.shot-serial {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.shot-serial-sub {
  margin-top: -6px;
  font-size: 12.5px;
  color: var(--muted);
}

.shot-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.shot-step-name {
  width: 104px;
  flex: none;
  font-weight: 500;
}

.shot-step-who {
  flex: 1;
  color: var(--ink);
}

.shot-step-when {
  color: var(--muted);
  font-size: 12px;
}

/* ---------------------------------------------------------- дверь */

.showcase-demo {
  border-top: 1px solid var(--border);
}

/* Дверь витрины: тот же демонстрационный вход, что на рабочей установке, только
   вписанный в карточку по центру страницы. Правила самого входа не дублируются —
   здесь снимается лишь черта, которая отделяла его от формы логина. */
.showcase-door {
  width: min(720px, 100%);
  margin: clamp(24px, 4vw, 36px) auto 0;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.showcase-door .login-demo {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.showcase-door .login-hint {
  margin-top: 0;
}

.showcase-door .login-form {
  margin-top: 0;
}

/* ---------------------------------------------------------- подвал */

.showcase-footer {
  padding: clamp(40px, 6vw, 64px) 0 28px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: 13.5px;
}

.showcase-footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 28px;
}

.showcase-col b {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}

.showcase-col a {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  text-decoration: none;
}

.showcase-col a:hover {
  color: var(--accent);
}

.showcase-col p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.showcase-col-brand .showcase-brand {
  margin-bottom: 10px;
}

/* Адрес рабочей установки — то, ради чего сотрудник уходит с витрины: выделен
   цветом, чтобы не потеряться среди прочих ссылок подвала. */
.showcase-work a {
  color: var(--accent);
  font-weight: 500;
}

.showcase-footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: clamp(28px, 4vw, 40px);
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------------------------------------------------------- узкий экран */

/* Телефон: развороты складываются в один столбец, шапка теряет часть ссылок —
   на 360 точках они всё равно не помещаются, а кнопка демонстрации важнее. */
@media (max-width: 780px) {
  .showcase-feature {
    grid-template-columns: 1fr;
  }

  .showcase-feature.flip .showcase-feature-text {
    order: 0;
  }

  .showcase-nav-links a:not(.showcase-nav-work) {
    display: none;
  }
}

@media (max-width: 520px) {
  .showcase-wrap {
    padding: 0 16px;
  }

  .showcase-nav-links {
    display: none;
  }

  .shot-step-name {
    width: 88px;
  }

  .showcase-footer-bottom {
    flex-direction: column;
  }
}

/* --------------------------------------------------------------- сотрудники */

/* Аватар, ФИО и логин в одной ячейке: логин мельче и тише — он служебный, а ищут
   человека глазами по фамилии. */
.staff-person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.staff-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.staff-name {
  font-weight: 500;
}

.staff-login {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.staff-login-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.staff-email {
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* Над списком: поиск и переключатель «все / активные / отключённые». */
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 4px var(--pad) 12px;
}

.search-input {
  flex: 1 1 260px;
  min-width: 0;
  min-height: 38px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.search-input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: -1px;
  background: var(--surface);
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.segment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.segment.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 20, 17, 0.1);
}

.locked {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  cursor: help;
}

.segment-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- роли */

/* Форма роли длинная: название, десяток экранов, десяток разделов. Блоки с заголовками
   разбивают её на три понятные части, иначе получается стена полей. */
.form-block {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.form-block h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Экраны — галочками в две-три колонки: их около десятка, в столбик было бы длинно. */
.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px;
}

.check {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 2px 8px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.check:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.check input {
  grid-row: span 2;
  align-self: center;
}

.check-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.check-hint {
  grid-column: 2;
  font-size: 12px;
  color: var(--muted);
}

/* Права: раздел, его описание и выпадающий список уровня. */
.perms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.perm > span:first-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Права в таблице — метками: так видно набор роли одним взглядом, а «none» не
   показывается вовсе, иначе половина строки была бы про отсутствие прав. */
.perm-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* --------------------------------------------------------------- приглашения */

/* Код переписывают с экрана и диктуют — поэтому моноширинный и крупный. */
.invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 26px;
  letter-spacing: 2px;
  text-align: center;
  margin: 8px 0;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--accent-soft);
  user-select: all;
}

.invite-known {
  margin: 0;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 13px;
}

.invite-code-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  user-select: all;
}

/* --------------------------------------------------------------- паспорт изделия */

.passport-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px 0;
}

.passport-serial {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
}

.timeline {
  list-style: none;
  margin: 14px 0 0;
  padding: 0 16px 4px 28px;
  border-left: 2px solid var(--border);
  margin-left: 20px;
}

.timeline li {
  position: relative;
  padding-bottom: 14px;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: -35px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}

.timeline .stage-name {
  font-weight: 500;
}

.timeline .stage-meta {
  font-size: 13px;
  color: var(--muted);
}

/* --------------------------------------------------------------- узкий экран */

/* Ноутбук: панель сворачивается до полосы со значками. Таблица заявок с восемью
   колонками при полной панели на 1280 точках уже не влезала, и кнопки уезжали за край.
   Названия разделов — во всплывающей подсказке (`title`). */
@media (min-width: 901px) and (max-width: 1280px) {
  .shell {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .sidebar {
    align-items: center;
    padding: 14px 10px;
  }

  .sidebar-brand {
    padding: 2px 0;
  }

  .brand-text,
  .side-group-title,
  .side-item span,
  .side-action span,
  .who-text {
    display: none;
  }

  .side-nav {
    align-items: center;
  }

  .side-group {
    align-items: center;
  }

  .side-group + .side-group {
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .side-item,
  .side-action {
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
  }

  .side-user {
    align-items: center;
  }

  .who {
    padding: 4px 0;
  }

  .content {
    padding: 20px;
  }
}

@media (max-width: 900px) {
  /* Боковая панель уступает место верхней строке и нижним вкладкам. */
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  /* Фон у закреплённых полос — сплошной, без «матового стекла». Safari на iPhone при
     прокрутке длинной страницы перерисовывает полосу с `backdrop-filter` не вместе со
     страницей: верхняя часть экрана остаётся от прошлого кадра, и нижние вкладки
     оказываются посреди страницы. Со сплошным фоном этого не происходит. Красоты
     меньше, зато меню стоит там, где ему положено. */
  .topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .topbar-title {
    flex: 1;
    min-width: 0;
    font-size: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-search {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }

  .topbar-me {
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
  }

  /* Вкладки внизу: до пяти равных ячеек, значок над подписью. Панель не прокручивается
     вбок никогда — лишние разделы уходят в «Ещё». */
  /* Сообщения поднимаются над вкладками: иначе «Новая заявка на производство»
     ложится прямо на меню и закрывает его на те десять секунд, что висит. */
  .toasts {
    left: 12px;
    right: 12px;
    bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .toast {
    max-width: none;
  }

  .tabbar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    /* Своим слоем: тогда полосу двигает не пересчёт страницы, а сам браузер, и при
       быстрой прокрутке она не отстаёт от неё. См. пояснение у .topbar выше. */
    transform: translateZ(0);
    will-change: transform;
  }

  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 0;
    padding: 4px 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .tab span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tab.active {
    color: var(--accent);
  }

  .content {
    padding: 16px 14px calc(88px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 720px) {
  :root {
    --pad: 16px;
  }

  /* Плитки сводки — по две в ряд: по одной на всю ширину они растягивали экран
     директора на три прокрутки, а читают их одним взглядом. */
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat {
    padding: 12px 14px;
  }

  .stat-value {
    font-size: 19px;
  }

  /* Плитка без пары — во всю ширину: так ряд не выглядит недостроенным, а длинная
     сумма не переносит «₽» на новую строку. */
  .stats > .stat:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  /* Шапка карточки на телефоне: главная кнопка во всю ширину, остальные — в «⋯». */
  .card-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .card-actions > .btn:first-child {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
  }

  .card-actions > .btn:only-child {
    grid-column: 1 / -1;
  }

  .card-actions.with-more > .btn:not(:first-child):not(.card-more) {
    display: none;
  }

  .card-actions .card-more {
    display: inline-grid;
    width: 46px;
    height: auto;
    border-color: var(--border);
    color: var(--text);
  }


  /* --------------------------------------------------------------- таблицы как карточки

     На телефоне таблица шире экрана: чтобы дотянуться до кнопки действия, пришлось бы
     смахивать содержимое вбок. Поэтому та же разметка показывается блоками — строка
     становится карточкой, у каждого значения появляется подпись колонки из data-label,
     а кнопки уходят вниз во всю ширину. Разметка одна, переключает её только CSS. */

  .table-wrap {
    overflow-x: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  /* Шапка не нужна: подписи переехали к самим значениям. */
  thead {
    display: none;
  }

  tbody tr {
    padding: 14px var(--pad);
    border-bottom: 1px solid var(--line);
  }

  tbody tr:last-child {
    border-bottom: none;
  }

  td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
    border-bottom: none;
    text-align: right;
  }

  td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 13px;
    color: var(--muted);
    text-align: left;
  }

  /* Ячейки карточки — без боковых полей таблицы: поле задаёт сама карточка. */
  td:first-child,
  td:last-child {
    padding-left: 0;
    padding-right: 0;
  }

  /* У колонки без заголовка подписи нет — не оставляем пустое место. */
  td:not([data-label])::before {
    display: none;
  }

  td.right {
    text-align: right;
  }

  /* Действия — отдельным рядом внизу карточки, кнопки во всю ширину, чтобы попадать
     пальцем без прицеливания. */
  td.actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }

  td.actions .btn {
    margin-left: 0;
    width: 100%;
    padding: 10px 13px;
  }

  /* На телефоне у кнопки должна быть видимая граница: без неё «Отменить» и «Карточка»
     читаются как обычный текст и в них не целятся пальцем. */
  td.actions .btn-ghost {
    border-color: var(--border);
    color: var(--text);
  }

  /* Метка состояния — не кнопка: она не должна растягиваться на всю ширину карточки. */
  td.actions .badge {
    justify-self: center;
  }

  /* Первая колонка — заголовок карточки: крупно, без подписи, слева. Так карточка
     читается как в мобильном приложении — «кто или что» сверху, подробности под ним. */
  tbody tr {
    position: relative;
  }

  tbody td:first-child {
    justify-content: flex-start;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    padding-bottom: 6px;
  }

  tbody td:first-child::before {
    display: none;
  }

  /* Колонка, где только «⋯», не занимает ряд внизу: кнопка встаёт в правый верхний
     угол карточки, как меню у письма в почте. */
  td.actions-menu {
    position: absolute;
    top: 8px;
    right: 10px;
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  tr:has(> td.actions-menu) > td:first-child {
    padding-right: 44px;
  }

  td.actions .btn-icon,
  td.actions-menu .btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
  }

  /* Главное действие во всю ширину, «⋯» рядом с ним. */
  td.actions-split {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  td.actions-split .badge {
    justify-self: start;
    align-self: center;
  }

  td.actions-split .btn-icon {
    border-color: var(--border);
    color: var(--text);
    height: auto;
  }

  td.actions-split > .btn:only-child:not(.btn-icon) {
    grid-column: 1 / -1;
  }

  td.actions-split > .btn-icon:only-child {
    grid-column: 2;
    width: 44px;
  }

  /* Карточка сотрудника: имя с аватаром сверху, под ним одной строкой роль,
     подразделение и метки. Подписи «Роль», «Доступ» здесь не нужны — по самим
     значениям и так понятно, что есть что, а карточка выходит вдвое короче. */
  .staff-list tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 14px 16px;
  }

  .staff-list tbody td {
    display: inline-flex;
    width: auto;
    padding: 0;
    text-align: left;
  }

  .staff-list tbody td::before {
    display: none;
  }

  .staff-list tbody td:first-child {
    width: 100%;
    padding: 0 44px 4px 0;
  }

  .staff-list td[data-label='Роль'] {
    font-size: 13px;
    align-items: center;
    gap: 6px;
  }

  .staff-list td[data-label='Вход'] .staff-email {
    font-size: 12px;
  }

    /* Поиск над списком — во всю ширину, переключатель под ним растягивается тоже. */
  .list-toolbar {
    padding: 12px 14px 4px;
  }

  .search-input {
    flex-basis: 100%;
    font-size: 16px; /* меньше 16 точек iPhone увеличивает страницу при вводе */
  }

  .segmented {
    width: 100%;
  }

  .segment {
    flex: 1;
    justify-content: center;
  }

  /* Диалог на телефоне выезжает снизу, как шторка: до кнопок достаёт большой палец. */
  .overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .modal-foot .btn {
    flex: 1;
    padding: 11px;
    font-size: 15px;
  }

  /* Полоса прогресса растягивается на всю ширину карточки. */
  .progress {
    min-width: 120px;
    flex: 1;
  }
}

/* --------------------------------------------------------------- поля на телефоне

   Safari на iPhone увеличивает страницу, когда палец ставит курсор в поле с текстом
   мельче 16 точек, — и обратно уже не уменьшает. У заказчика так и вышло: пароль
   демонстрации был полем в 15 точек, после него всё приложение осталось увеличенным,
   страница «гуляла» вправо-влево, и так в каждом разделе — страница-то одна.
   Поэтому на сенсорных экранах поля — ровно 16 точек. `:root` поднимает правило над
   `.input input` и `.login-form input`, не прибегая к !important. */
@media (max-width: 900px), (pointer: coarse) {
  :root :is(input, select, textarea) {
    font-size: 16px;
  }
}


/* --------------------------------------------------------------- уведомления на телефон */

/*
 * Полоска «Включите уведомления» над содержимым экрана. Она не всплывает и не мигает:
 * предложение, а не тревога. Закрыть её можно крестиком — до конца рабочего дня
 * (см. web/push.js), потому что уведомления заказчик просил у всех, и полоска должна
 * вернуться, если человек так и не включил их.
 */
.push-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 16px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 14px;
}

.push-banner svg {
  flex: none;
  color: var(--accent);
}

.push-text {
  flex: 1;
  min-width: 0;
}

.push-banner .btn {
  flex: none;
}

.push-close {
  flex: none;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}

.push-close:hover {
  color: var(--text);
}

@media (max-width: 520px) {
  /* На телефоне подпись переносится, а кнопка встаёт под неё: иначе строка выдавливает
     содержимое вбок — та же беда, из-за которой переделывали меню. */
  .push-banner {
    flex-wrap: wrap;
    margin: 10px 12px 0;
  }

  .push-text {
    flex: 1 1 100%;
    order: -1;
  }
}

/* --------------------------------------------------------------- номера изделий */

/*
 * Форма «Номера»: по блоку на изделие. Блоки разделены линией, а не карточками:
 * их бывает десять и больше, и десять карточек в окне превращаются в лестницу.
 */
.serial-unit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.serial-unit:first-of-type {
  border-top: 0;
}

.serial-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* «Кто делал» — подпись, а не заголовок: ОТК смотрит на неё краем глаза. */
.serial-made {
  font-size: 13px;
  color: var(--muted);
}

/* Свёрнутые блоки карточки заказа — расчёт доставки и обезжиривание. Заказ открывают ради содержимого,
   а не ради перевозки, поэтому по умолчанию он занимает одну строку. Раскрытый —
   отделяется рамкой, чтобы поля расчёта не смешались с полями заказа. */
.delivery-quote,
.fold-block {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-2);
}

.delivery-quote > summary,
.fold-block > summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.delivery-quote > summary::-webkit-details-marker,
.fold-block > summary::-webkit-details-marker {
  display: none;
}

/* Свой треугольник: встроенный маркер в разных браузерах выглядит по-разному, а этот
   одинаков и поворачивается вместе с блоком. */
.delivery-quote > summary::before,
.fold-block > summary::before {
  content: '▸';
  display: inline-block;
  width: 16px;
  color: var(--muted);
}

.delivery-quote[open] > summary::before,
.fold-block[open] > summary::before {
  content: '▾';
}

.delivery-quote[open] > summary,
.fold-block[open] > summary {
  margin-bottom: 4px;
}

/* Справка на экране производства: карточка, свёрнутая в строку. Шапка — та же, что у
   карточки, только нажимается целиком. */
.reference-fold > summary {
  cursor: pointer;
  list-style: none;
  flex-wrap: nowrap;
  padding-bottom: 18px;
}

.reference-fold > summary::-webkit-details-marker {
  display: none;
}

/* Вместо треугольника — «Показать» / «Скрыть» справа: так видно, что строку нажимают. */
.reference-toggle {
  margin-left: auto;
  flex: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.reference-fold:not([open]) .when-open,
.reference-fold[open] .when-closed {
  display: none;
}

.reference-fold[open] > summary {
  padding-bottom: 4px;
}

.reference-fold > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.reference-title {
  margin: 16px var(--pad) 2px;
  font-size: 15px;
}

.reference-subtitle {
  margin: 0 var(--pad) 8px;
}

/* Техкарта баллона: строки бланка «работа — исполнитель — дата» и замеры номинал/факт. */
.tc-form {
  max-width: 920px;
}

.tc-work {
  display: grid;
  gap: 6px;
}

.tc-work-title,
.tc-caption {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.tc-hint {
  margin: -4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.tc-measures {
  display: grid;
  grid-template-columns: minmax(80px, 0.8fr) repeat(3, minmax(0, 1fr));
  gap: 6px 10px;
  align-items: center;
}

.tc-measures-head {
  font-size: 12px;
  color: var(--muted);
}

.tc-measures-label {
  font-size: 13px;
  color: var(--muted);
}

.tc-measures input {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  width: 100%;
  min-width: 0;
  min-height: 38px;
}

.tc-measures input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: -1px;
}

.tc-row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.tc-search {
  display: flex;
  padding: 0 var(--pad) 8px;
}

.passport-techcard {
  padding: 12px 16px 0;
}

/* Номера уехавших изделий в окне отгрузки: галочки в строку, переносятся. */
.serial-picks {
  display: grid;
  gap: 6px;
  margin-top: -4px;
}

.serial-picks-title {
  font-size: 13px;
  color: var(--muted);
}

.serial-picks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.serial-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  min-height: 32px;
  cursor: pointer;
}

/* Галочка в форме. `input()` рисует «подпись сверху, поле снизу» — для флажка это даёт
   большой пустой квадрат во всю ширину. Здесь они встают в строку, флажком вперёд. */
.input.input-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.input.input-check input[type='checkbox'] {
  order: -1;
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent, currentColor);
}

/* Переписка по заказу. Лента растёт вниз, как любой разговор, и ограничена по высоте:
   иначе сотня сообщений вытолкнула бы состав заказа за нижний край окна. Сообщение
   нельзя ни изменить, ни удалить — поэтому в ленте нет ни кнопок, ни меню. */
.comments .feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.feed-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feed-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.feed-author {
  font-weight: 600;
}

/* Время — справа и мелко: в разговоре важно, кто и что сказал, а не в какую минуту. */
.feed-time {
  margin-left: auto;
  white-space: nowrap;
}

/* Перенос по словам и сохранённые переводы строк: люди пишут списками и в столбик. */
.feed-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comments .form {
  margin-top: 10px;
}

/* Значок «по заказу идёт разговор» в строке списка: значок и число, без слов. */
.comments-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.comments-badge .icon {
  flex: 0 0 auto;
}

/* Строка разговора в списке: значок и последняя реплика.
   Текст обычного цвета, а не приглушённого: рядом в ячейке и без того хватает серых
   подробностей, а сообщение — то, ради чего строку читают. Три строки и многоточие:
   вопрос «на каком этапе? сроки горят» помещается целиком даже в узкой колонке, а
   длинный ответ не растягивает таблицу — его видно в подсказке и в карточке. */
.last-comment {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin-top: 5px;
  font-size: 13px;
  color: var(--text);
}

.last-comment .icon {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--accent);
}

.last-comment-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

/* Отметка ожидания в карточке заказа: метка и кнопка «Дождались» в одну строку. */
.mark-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.fold-block h4 {
  margin: 12px 0 6px;
}

/* ------------------------------------------------------------------ поддержка */

.card-body > .support-list,
.card-body > .support-key-state,
.card-body > .form-actions {
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.support-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.support-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--surface);
}

.support-item.support-new {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
}

.support-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.support-when {
  margin-left: auto;
}

.support-body {
  margin: 10px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.support-meta {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.support-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.support-thumb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
}

.support-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.support-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.support-full {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  margin: 0 auto;
  border-radius: var(--radius-sm);
}

.support-add {
  display: flex;
  align-items: center;
  gap: 10px;
}

.support-photos:empty {
  display: none;
}

.support-mine {
  display: flex;
  justify-content: flex-start;
  margin-left: -12px;
}

.support-answer {
  margin-top: 12px;
}

.support-reply {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  white-space: pre-wrap;
}

.support-key {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
}

.support-key-state {
  margin-bottom: 12px;
}

/* --------------------------------------------------------------- список заказов

   Строка-карточка вместо строки таблицы (web/order-list.js): кто · где сейчас · когда ·
   сколько · что сделать. Одна сетка на всех экранах; на телефоне те же места
   перестраиваются в три ряда. Общий вид для менеджера, производства, цеха, ОТК и склада. */

.olist-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px var(--pad) 14px;
}

.olist-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* `hidden` у элемента с display: flex сам не прячет — браузер уступает правилу выше. */
.olist-filters[hidden],
.olist-bar[hidden] {
  display: none;
}

.olist-chip {
  font: inherit;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 6px 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.olist-chip b {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.olist-chip:hover {
  border-color: var(--muted);
}

/* Непустое «Новые» и «Готовы к выдаче» — то, за чем экран открывают: число цветное. */
.olist-chip-accent b {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.olist-chip.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

.olist-chip.active b {
  background: color-mix(in srgb, var(--surface) 18%, transparent);
  border-color: transparent;
  color: var(--surface);
}

.olist-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
  flex: 0 1 320px;
  padding: 0 12px;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
}

.olist-search:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}

.olist-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 7px 0;
}

/* «Отбор» — кнопка рядом с поиском и панель под строкой фильтров (11.10.2026). */
.olist-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
}

.olist-refine-toggle {
  font: inherit;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.olist-refine-toggle:hover,
.olist-refine-toggle[aria-pressed='true'] {
  border-color: var(--muted);
}

.olist-refine-toggle b {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.olist-refine-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
}

.olist-refine {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: flex-end;
  margin: 0 var(--pad) 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.olist-refine-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.olist-refine-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.olist-refine-label {
  font-size: 13px;
  color: var(--muted);
}

.olist-refine .date-input {
  width: 150px;
}

.olist-qty .input {
  width: 84px;
}

.olist-refine .olist-pick {
  width: 220px;
}

.olist-refine-end > label.input {
  width: 250px;
}

.olist-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.olist-period {
  font: inherit;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.olist-period:hover {
  border-color: var(--muted);
}

.orows {
  border-top: 1px solid var(--line);
}

.orows > .empty {
  padding: 28px var(--pad);
}

.orow {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(220px, 1.6fr) 130px 140px 250px;
  grid-template-areas: 'who state when money actions';
  align-items: center;
  gap: 8px 20px;
  padding: 14px var(--pad);
  border-bottom: 1px solid var(--line);
}

.orow:last-child {
  border-bottom: 0;
}

.orow.clickable {
  cursor: pointer;
}

.orow.clickable:hover {
  background: var(--surface-2);
}

.orow-who {
  grid-area: who;
  min-width: 0;
}

.orow-client {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orow-preorder {
  color: var(--warn);
  font-weight: 500;
}

.orow-ids {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  margin-top: 2px;
}

.orow-state {
  grid-area: state;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.orow-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.orow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--muted);
}

.orow-ok .orow-dot { background: var(--ok); }
.orow-work .orow-dot { background: var(--work); }
.orow-wait .orow-dot { background: var(--warn); }
.orow-danger .orow-dot { background: var(--danger); }
.orow-muted { color: var(--muted); }

.orow-bar {
  height: 4px;
  max-width: 260px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.orow-bar > div {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}

.orow-detail {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orow-detail.orow-detail-wrap {
  white-space: normal;
  overflow-wrap: anywhere;
}

.orow-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.orow-state .last-comment {
  max-width: 100%;
}

.orow-when {
  grid-area: when;
  font-size: 13px;
  line-height: 1.45;
  white-space: nowrap;
}

.orow-label {
  color: var(--muted);
}

.orow-value {
  font-weight: 500;
}

.orow-money {
  grid-area: money;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
}

.orow-sum {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.orow-quiet {
  font-size: 12px;
  color: var(--muted);
}

.orow-actions {
  grid-area: actions;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.orow-actions .btn {
  white-space: nowrap;
}

/* Закрытый заказ — тише: он нужен для справки, а не для работы. */
.orow-closed .orow-client,
.orow-closed .orow-title {
  color: var(--muted);
}

/* Ноутбук поуже: «когда» уходит под метку, чтобы кнопка не уезжала за край. */
@media (max-width: 1180px) {
  .orow {
    grid-template-columns: minmax(170px, 1fr) minmax(200px, 1.5fr) 130px 230px;
    grid-template-areas:
      'who state money actions'
      'who when  money actions';
    row-gap: 2px;
  }
}

@media (max-width: 720px) {
  .olist-bar {
    padding: 0 16px 12px;
  }

  /* Фильтры листаются вбок одной полосой: пять кнопок в две строки съедали экран. */
  .olist-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -16px;
    padding: 0 16px 2px;
    scrollbar-width: none;
    width: calc(100% + 32px);
  }

  .olist-filters::-webkit-scrollbar {
    display: none;
  }

  .olist-search {
    flex: 1 1 auto;
    min-width: 0;
  }

  .olist-tools {
    flex: 1 1 100%;
  }

  .olist-refine {
    margin: 0 16px 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .olist-refine .date-input {
    flex: 1 1 130px;
    width: auto;
  }

  .olist-refine .olist-pick,
  .olist-refine-row > label.input {
    flex: 1 1 100%;
    max-width: none;
  }

  .olist-refine .olist-qty > .input {
    flex: 1 1 0;
    width: auto;
  }

  .olist-refine-end > label.input {
    width: auto;
  }

  .orow {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'who money'
      'state state'
      'when actions';
    gap: 8px 12px;
    padding: 14px 16px;
  }

  .orow-when {
    display: flex;
    flex-wrap: wrap;
    gap: 0 12px;
    white-space: normal;
  }

  .orow-bar {
    max-width: none;
  }
}

/* --------------------------------------------------------------- страница поверх экрана */

.overlay-page {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}

.page {
  background: var(--bg);
  width: min(1080px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.2);
  animation: page-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes page-in {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
}

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.page-back {
  padding: 6px;
  min-height: 36px;
  min-width: 36px;
}

.page-title {
  flex: 1;
  min-width: 0;
}

.page-title h2 {
  font-size: 18px;
  letter-spacing: -0.01em;
}

.page-subtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.page-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px;
}

.page-section {
  margin: 20px 0 8px;
  font-size: 15px;
}

.page-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px 20px;
  margin: 16px 0 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.page-body .orow-tags {
  margin-bottom: 12px;
}

/* Вкладка — белый лист, как карточка раздела на экране. */
.tab-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.tab-pane .fields {
  padding-top: 0;
}

.tab-pane .table-wrap {
  margin: 0 -16px;
}

.tab-pane > div > .note:first-child {
  margin-top: 0;
}

/* --------------------------------------------------------------- шаги пути заказа */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
}

.step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 0 4px;
}

/* Линия от шага к следующему — позади кружка. */
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 2px;
  background: var(--border);
}

.step-done:not(:last-child)::after {
  background: var(--accent);
}

.step-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.step-done .step-mark {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.step-done .step-mark .icon circle {
  display: none;
}

.step-now .step-mark {
  border-color: var(--work);
  color: var(--work);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--work) 15%, transparent);
}

.step-wait .step-mark {
  border-color: var(--warn);
  color: var(--warn);
}

.step-skip .step-mark {
  border-style: dashed;
}

.step-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.step-title {
  font-size: 13px;
  font-weight: 500;
}

.step-todo .step-title,
.step-skip .step-title {
  color: var(--muted);
}

.step-meta {
  font-size: 12px;
  color: var(--muted);
}

/* --------------------------------------------------------------- вкладки */

.tab-list {
  display: flex;
  gap: 4px;
  margin: 8px 0 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-button {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.tab-button:hover {
  color: var(--text);
}

.tab-button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-count {
  font-size: 12px;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

@media (max-width: 720px) {
  .page {
    width: 100%;
    box-shadow: none;
  }

  .page-head {
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    flex-wrap: wrap;
  }

  .page-actions-wide {
    width: 100%;
    order: 3;
  }

  .page-facts {
    grid-template-columns: 1fr 1fr;
  }

  .tab-button {
    padding: 10px 10px;
  }

  .page-actions .btn:not(.btn-icon) {
    flex: 1;
  }

  .page-body {
    padding: 14px 12px calc(40px + env(safe-area-inset-bottom));
  }

  /* Шесть шагов в ширину телефона не лезут — две строки по три. */
  .steps {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 14px;
  }

  .step:nth-child(3n)::after {
    display: none;
  }

  .tab-pane {
    padding: 12px;
  }

  .tab-pane .table-wrap {
    margin: 0 -12px;
  }
}

/* --------------------------------------------------------------- карточка клиента */

/* Разделы длинной формы клиента: «Организация», «Банк», «Контактные лица». */
.form-section {
  margin: 8px 0 -4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Поле с кнопкой справа: «ИНН [Заполнить по ИНН]», «БИК [Найти банк]». На телефоне
   кнопка уходит под поле во всю ширину. */
.input-with-button {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.input-with-button > .input {
  flex: 1 1 auto;
  min-width: 0;
}

.input-with-button > .btn {
  flex: 0 0 auto;
  min-height: 38px;
}

@media (max-width: 560px) {
  .input-with-button {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Выбор получателя письма: адреса клиента кнопками над полем «Кому». */
.recipient-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* КП заказа во вкладке «Деньги»: номер, состояние, сумма и кнопки под ними. */
.offers-block {
  margin-top: 8px;
}

.offer-item {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.offer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}

.offer-total {
  margin-left: auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.offer-meta {
  margin: 4px 0 8px;
  font-size: 13px;
}

/* Логотип, подпись и печать в настройках: три плитки с картинкой. */
.company-images {
  padding: 4px var(--pad) var(--pad);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.company-image {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.company-image-box {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 96px;
  margin-bottom: 4px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.company-image-box img {
  max-width: 90%;
  max-height: 80px;
  object-fit: contain;
}

/* Показ загрузки прайса: «было → стало, %» строками. */
.price-changes {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.price-change {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

/* Под ценой в окне КП — откуда она: договорная, прайс со скидкой, прошлое КП. */
.price-source {
  font-size: 12px;
  margin-top: -4px;
}

/* --------------------------------------------------------------- поиск заказа (⌘K) */

/* Окно стоит сверху, а не по центру: список под строкой растёт вниз и не прыгает. */
.qs-overlay {
  align-items: flex-start;
  padding-top: 12vh;
}

.qs {
  width: min(640px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: rise 0.14s ease-out;
}

.qs-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

.qs-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  padding: 16px 0;
}

.qs-input::-webkit-search-cancel-button {
  display: none;
}

.qs-esc {
  font-size: 11px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
}

.qs-results {
  overflow-y: auto;
  padding: 6px;
}

.qs-caption {
  padding: 8px 10px 4px;
  font-size: 12px;
  color: var(--muted);
}

.qs-empty {
  padding: 22px 12px;
  text-align: center;
  color: var(--muted);
}

.qs-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.qs-item.active {
  background: var(--accent-soft);
}

.qs-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qs-client,
.qs-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qs-sub {
  font-size: 13px;
  color: var(--muted);
}

.qs-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.qs-when {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 720px) {
  /* На телефоне окно — во всю ширину сверху: клавиатура занимает низ экрана. */
  .qs-overlay {
    padding: calc(8px + env(safe-area-inset-top)) 8px 8px;
  }

  .qs {
    max-height: 60vh;
  }

  .qs-esc {
    display: none;
  }

  .qs-input {
    font-size: 16px;
  }
}

/* `hidden` у позиции, которую не изготавливают: `display: grid` у раскрытого блока иначе
   перебил бы его. */
.finish-picker[hidden] {
  display: none;
}

/* Номера партии штуцеров — крупно: их выбивают по этой строке. */
.fitting-numbers {
  font-size: 20px;
  font-weight: 600;
  margin: 4px 0;
  overflow-wrap: anywhere;
}

/* Подсказка под группой отметок: что значит «ничего не отмечено». */
.finish-group-hint {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--muted);
}

/* --------------------------------------------------------------- почта */

.note-info {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text);
}

.mail-empty {
  max-width: 460px;
  margin: 12px auto 20px;
  text-align: center;
}

.mail-empty h3 {
  margin: 8px 0 6px;
}

.mail-empty p {
  margin: 6px 0 14px;
}

.mail-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.mail-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.mail-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  padding: 11px 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mail-row:hover,
.mail-row:focus-visible {
  background: var(--surface-2);
}

.mail-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
}

.mail-unread .mail-dot {
  background: var(--accent);
}

.mail-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.mail-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.mail-who,
.mail-subject,
.mail-snippet {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.mail-who {
  flex: 1;
}

.mail-subject {
  flex: 1;
}

.mail-unread .mail-who,
.mail-unread .mail-subject {
  font-weight: 650;
}

.mail-snippet {
  color: var(--muted);
  font-size: 13.5px;
}

.mail-when {
  flex: none;
  color: var(--muted);
  font-size: 13px;
}

.mail-client {
  flex: none;
  max-width: 40%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}

.mail-clip {
  flex: none;
  font-size: 13px;
}

.mail-checked {
  font-size: 12.5px;
}

.mail-reader {
  max-width: 900px;
}

.mail-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  word-break: break-word;
}

.mail-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.mail-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.mail-file:hover {
  border-color: var(--accent);
}

.mail-file-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mail-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.mail-frame {
  display: block;
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.mail-body-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.mail-compose textarea {
  min-height: 220px;
}

.mail-chosen {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mail-chip {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
}

.mail-staff {
  display: flex;
  flex-direction: column;
}

.mail-staff-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(160px, 1.5fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.mail-staff-who,
.mail-staff-box {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  min-width: 0;
  word-break: break-word;
}

.mail-staff-who {
  flex-direction: column;
  align-items: flex-start;
}

.mail-staff-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .mail-staff-row {
    grid-template-columns: 1fr;
  }

  .mail-staff-actions {
    justify-content: flex-start;
  }

  .mail-client {
    display: none;
  }
}

.pane-subtitle {
  margin: 18px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* «Приложить документы» в окне письма (web/views/documents.js): свёрнуто, внутри — галочки
   по разделам «Баллоны», «Самоспасатели». */
.doc-picker {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.doc-picker > summary {
  cursor: pointer;
  font-size: 14px;
  list-style: none;
}

.doc-picker > summary::-webkit-details-marker {
  display: none;
}

.doc-picker > summary::before {
  content: '▸';
  display: inline-block;
  width: 16px;
  color: var(--muted);
}

.doc-picker[open] > summary::before {
  content: '▾';
}

.doc-picker-group {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.doc-picker .check .badge {
  margin-left: 6px;
}

/* --------------------------------------------------------------- рекламации */

.recl-ok {
  color: var(--ok);
}

.recl-bad {
  color: var(--danger);
  font-weight: 500;
}

.recl-hints {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}

.recl-hint + .recl-hint {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

/* Заказ идёт частями: где сколько, метками по порядку маршрута (10.10.2026). */
.stage-parts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0;
}

.stage-parts-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.stage-parts-name {
  color: var(--muted);
  font-size: 0.9em;
}

/* ------------------------------------------------------------------ закупка (PROGRESS 100) */

/* «Ждём вентили» кнопкой: та же метка, но нажимается — окно «склад и закупка». */
button.badge-action {
  font: inherit;
  cursor: pointer;
  border: 0;
}

button.badge-action:hover {
  filter: brightness(0.95);
  text-decoration: underline;
}

.valves-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.valves-note .note {
  margin: 0;
}

/* Свёрнутая карточка склада: «Показать (N)» / «Свернуть» рядом с названием. */
.fold-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.fold-title h2 {
  margin: 0;
}

.fold-toggle {
  padding: 4px 12px;
  font-size: 13px;
  border-color: var(--border);
}

.fold-body[hidden] {
  display: none;
}

/* «Ниже минимума» на складе: строка «N позиций · Показать», список под ней свёрнут. */
.low-stock [hidden] {
  display: none;
}

.low-stock .valves-note {
  margin: 0 var(--pad) 8px;
}

.low-stock-head .linklike {
  color: inherit;
  font-weight: 600;
}

.supply-stock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.supply-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.supply-actions {
  margin-top: 6px;
}

.supply-price-at {
  align-self: end;
  margin: 0 0 10px;
}

@media (max-width: 640px) {
  .supply-stock {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ------------------------------------------------------------------ Папки (PROGRESS 102) */

.folders {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 8px var(--pad) 6px;
}

.folders .empty {
  padding-left: 0;
  padding-right: 0;
}

.folder-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.folder-search {
  width: 100%;
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.folder-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.folder-group {
  margin: 12px 0 4px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.folder-item:hover {
  background: var(--surface-2);
}

.folder-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.folder-item svg {
  flex: none;
}

.folder-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.folder-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-item-text .muted {
  font-size: 12px;
}

.folder-count {
  flex: none;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  text-align: center;
  color: var(--muted);
}

.folder-main {
  min-width: 0;
}

.folder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.folder-head h3 {
  margin: 0 0 2px;
}

.folder-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.folder-drop {
  border: 1px dashed transparent;
  border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
}

.folder-drop.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.folder-drop-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.folder-files {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.folder-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.folder-file + .folder-file {
  border-top: 1px solid var(--line);
}

.folder-file-main {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.folder-file-main > .linklike,
.folder-file-main > strong {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  text-align: left;
}

.folder-file-main > .linklike:hover {
  color: var(--accent);
  text-decoration: underline;
}

.folder-file-main .muted {
  font-size: 13px;
}

.file-kind {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

.file-kind-pdf {
  color: var(--danger);
}

.file-kind-xls {
  color: var(--ok);
}

.file-kind-doc {
  color: var(--work);
}

.file-kind-img {
  color: var(--warn);
}

.folder-versions {
  list-style: none;
  margin: 0;
  padding: 0;
}

.folder-versions li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.folder-versions li + li {
  border-top: 1px solid var(--line);
}

.folder-versions .badge {
  margin-left: 8px;
}

.folder-version-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.folder-pdf {
  display: block;
  width: 100%;
  height: calc(100vh - 140px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.folder-image {
  text-align: center;
}

.folder-image img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.xl-wrap {
  overflow: auto;
  max-height: calc(100vh - 180px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

table.xl-grid {
  width: auto;
  border-collapse: collapse;
  font-size: 13px;
}

/* Таблица Excel остаётся таблицей и на телефоне: общее правило «таблица — карточками»
   (раздел «таблицы как карточки») её бы рассыпало. Листается пальцем в рамке. */
@media (max-width: 720px) {
  table.xl-grid {
    display: table;
    width: auto;
  }

  table.xl-grid thead {
    display: table-header-group;
  }

  table.xl-grid tbody {
    display: table-row-group;
  }

  table.xl-grid tr {
    display: table-row;
    width: auto;
    padding: 0;
  }

  table.xl-grid td {
    display: table-cell;
    width: auto;
    text-align: left;
  }

  table.xl-grid td::before {
    content: none;
  }
}

table.xl-grid th,
table.xl-grid td {
  padding: 4px 8px;
  border: 1px solid var(--line);
  white-space: nowrap;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

table.xl-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}

table.xl-grid tbody th {
  position: sticky;
  left: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 400;
  text-align: right;
}

/* Правка таблицы в программе: клетка — по нажатию поле ввода; поменянные — жёлтым. */
table.xl-grid-editable td.cell-edit {
  cursor: text;
}

table.xl-grid-editable td.cell-edit:hover {
  background: var(--accent-soft);
}

table.xl-grid td.cell-changed {
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  font-weight: 600;
}

table.xl-grid td.cell-merged {
  background: var(--surface-2);
}

table.xl-grid td.cell-formula {
  color: var(--muted);
  font-style: italic;
}

table.xl-grid td:has(> .cell-input) {
  padding: 0;
  overflow: visible;
}

.cell-input {
  width: 100%;
  min-width: 140px;
  padding: 4px 8px;
  border: 2px solid var(--accent);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
}

.xl-more {
  margin-top: 8px;
}

@media (max-width: 760px) {
  .folders {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  /* Папки на телефоне — строкой ярлычков, листается вбок: файлы сразу под ней, а не
     после всего списка папок. */
  .folder-list {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    margin: 0 calc(-1 * var(--pad));
    padding: 0 var(--pad) 4px;
    scrollbar-width: none;
  }

  .folder-group,
  .folder-item-text .muted {
    display: none;
  }

  .folder-item {
    flex: none;
    width: auto;
    max-width: 240px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  .folder-item.active {
    border-color: transparent;
  }

  .folder-head {
    flex-direction: column;
  }

  .folder-head-actions {
    width: 100%;
  }

  .folder-head-actions .btn-primary {
    flex: 1;
  }

  .folder-drop-hint {
    display: none;
  }

  .folder-pdf {
    height: calc(100vh - 170px);
  }
}

/* «Другие наши юрлица» в «Реквизиты и почта» (10.10.2026). */
.entity-list {
  list-style: none;
  margin: 0;
  padding: 0 var(--pad) 8px;
}

.entity-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}

.entity-list li + li {
  border-top: 1px solid var(--line);
}

.entity-list .note {
  margin: 4px 0 0;
  padding: 0;
}

@media (max-width: 720px) {
  .entity-list li {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Обезжиривание: строки разных заказов галочками, число штук справа (10.10.2026). */
.degreasing-picks { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.degreasing-pick { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.degreasing-pick .check { flex: 1; min-width: 0; }
.degreasing-pick .degreasing-count { width: 88px; flex: none; }
@media (max-width: 560px) {
  .degreasing-pick { flex-direction: column; align-items: stretch; }
  .degreasing-pick .degreasing-count { width: 100%; }
}

/* Заказ на склад в карточке полуфабрикатов: номер, что в работе, «Исправить». */
.card-body .stock-orders { padding: 0 var(--pad); }
.card-body .stock-orders .note { padding: 0; margin-bottom: 4px; }
.stock-order-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 4px 0; }

/* Похожие позиции: группа дублей рамкой, «Слить в отмеченную» под ней (10.10.2026). */
.similar-groups { display: flex; flex-direction: column; gap: 12px; }
.similar-group { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.similar-group > .btn { align-self: flex-start; }

/* --------------------------------------------------------------- сервер и копии */

.server-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.server-head .badge {
  margin-right: auto;
}

.server-verdict {
  padding: 16px 20px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
}

.server-verdict strong {
  color: var(--ok);
}

.server-verdict p,
.server-verdict ul {
  margin: 8px 0 0;
}

.server-verdict ul {
  padding-left: 20px;
}

.server-verdict-warn {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
}

.server-verdict-warn strong {
  color: var(--warn);
}

.server-verdict-bad {
  background: color-mix(in srgb, var(--danger) 13%, transparent);
}

.server-verdict-bad strong {
  color: var(--danger);
}

.server-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
}

.server-row > span:last-child {
  text-align: right;
}

.server-meter .server-row {
  padding-bottom: 4px;
}

.server-bar {
  height: 6px;
  margin-bottom: 8px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.server-bar > div {
  height: 100%;
  border-radius: 3px;
  background: var(--ok);
}

.server-bar-warn > div {
  background: var(--warn);
}

.server-bar-danger > div {
  background: var(--danger);
}

.server-small {
  font-size: 13px;
}

.server-note {
  color: var(--warn);
}

.server-services {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.server-service-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.server-copy + .server-copy {
  margin-top: 8px;
}

.server-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 10px;
  flex-shrink: 0;
}

.server-all {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.server-all > summary {
  cursor: pointer;
  font-weight: 500;
  padding: 4px 0;
}

.server-all-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.server-all-actions .btn {
  width: auto;
  flex: 0 0 auto;
}

.server-copy-list {
  max-height: 420px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.server-copy-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  font-size: 14px;
  cursor: pointer;
}

.server-copy-row + .server-copy-row {
  border-top: 1px solid var(--line);
}

.server-copy-row input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.server-copy-list-readonly .server-copy-row {
  grid-template-columns: auto 1fr auto;
  cursor: default;
}

.server-copy-kept {
  cursor: default;
}

.server-copy-when {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.server-copy-row > .muted {
  text-align: right;
  white-space: nowrap;
}

.server-copy-size {
  min-width: 56px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.server-version {
  font-size: 16px;
}

.server-version code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  font-family: var(--mono);
}

.card-body > .server-pad {
  padding: 0 var(--pad) var(--pad);
}
