/* ==========================================================================
   ТОиР — оформление в духе Windows 11 (Fluent)

   Три слоя поверхности, как в системе: фон окна (подложка), карточка на нём и
   «дымка» внутри карточки. Границы — волосяные, тени — почти незаметные:
   глубину держит разница поверхностей, а не размытие. Скругления 6 px у
   органов управления и 8–12 px у карточек и окон.

   Все страницы собраны из этих классов, поэтому правки цвета и размеров
   делаются здесь, а не в разметке.
   ========================================================================== */

:root {
  /* --- акцент: системный синий --- */
  --accent: #0f6cbd;
  --accent-hover: #115ea3;
  --accent-press: #0c4d85;
  --accent-soft: #eff6fc;
  --accent-soft-2: #dcecfa;
  --accent-text: #0f5aa0;
  --accent-line: #a9cdf0;
  --accent-fg: #ffffff;                      /* текст и значки на акценте */
  --accent-shadow: rgba(15,108,189,.22);

  /* --- смысловые цвета: те же, что у системных состояний Windows --- */
  --ok: #0f7b0f;      --ok-soft: #eaf6ea;
  --warn: #9d5d00;    --warn-soft: #fdf6e3;
  --danger: #c42b1c;  --danger-soft: #fdf0ef;
  --info: #0f6cbd;    --info-soft: #eff6fc;

  /* --- поверхности --- */
  --bg: #f3f3f3;                             /* подложка окна */
  --surface: #ffffff;                        /* карточка */
  --surface-2: #f7f7f7;                      /* дымка внутри карточки */
  --surface-3: #fbfbfb;                      /* поле ввода, кнопка по умолчанию */
  --overlay: rgba(255,255,255,.72);          /* лёгкая полупрозрачность панелей */

  /* --- панель навигации --- */
  --sidebar: #f3f3f3;
  --sidebar-text: #1b1b1b;
  --sidebar-title: #6e6e6e;
  --sidebar-hover: rgba(0,0,0,.037);
  --sidebar-press: rgba(0,0,0,.024);
  --sidebar-active-bg: #ffffff;
  --sidebar-active-fg: #1b1b1b;
  --sidebar-border: #e2e2e2;
  --brand-fg: #1b1b1b;

  /* --- текст и линии --- */
  --text: #1b1b1b;
  --text-dim: #5d5d5d;
  --text-faint: #8a8a8a;
  --border: #e6e6e6;                         /* контур карточки */
  --border-strong: #d2d2d2;                  /* контур органа управления */
  --control-edge: rgba(0,0,0,.055);          /* нижняя грань кнопки и поля */
  --chip-tint: rgba(0,0,0,.05);
  --track: #ededed;
  --track-item: #ffffff;
  --scroll-thumb: rgba(0,0,0,.2);            /* ползунок полосы прокрутки */
  --scroll-thumb-hover: rgba(0,0,0,.36);

  /* --- размеры --- */
  --radius: 8px;                             /* карточка */
  --radius-lg: 12px;                         /* окно, крупный блок */
  --radius-sm: 6px;                          /* кнопка, поле, пункт меню */
  --control-h: 32px;                         /* высота органа управления */
  --sidebar-w: 260px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 6px rgba(0,0,0,.045);
  --shadow-card: 0 1px 3px rgba(0,0,0,.055);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.08);
  --focus: #1b1b1b;                          /* обводка фокуса с клавиатуры */

  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable Text", "Segoe UI", var(--font);
  --mono: "Cascadia Mono", ui-monospace, Consolas, monospace;
}

html[data-theme="dark"] {
  --accent: #60cdff;
  --accent-hover: #83d8ff;
  --accent-press: #3aa0d1;
  --accent-soft: #10303f;
  --accent-soft-2: #16404f;
  --accent-text: #8fd9ff;
  --accent-line: #24576e;
  --accent-fg: #00243b;
  --accent-shadow: rgba(0,0,0,.4);

  --ok: #6ccb5f;      --ok-soft: #16261a;
  --warn: #fce100;    --warn-soft: #2b2611;
  --danger: #ff99a4;  --danger-soft: #2d1a1c;
  --info: #60cdff;    --info-soft: #10303f;

  --bg: #202020;
  --surface: #2b2b2b;
  --surface-2: #323232;
  --surface-3: #2f2f2f;
  --overlay: rgba(43,43,43,.76);

  --sidebar: #202020;
  --sidebar-text: #f0f0f0;
  --sidebar-title: #9a9a9a;
  --sidebar-hover: rgba(255,255,255,.055);
  --sidebar-press: rgba(255,255,255,.032);
  --sidebar-active-bg: #2f2f2f;
  --sidebar-active-fg: #ffffff;
  --sidebar-border: #2e2e2e;
  --brand-fg: #ffffff;

  --text: #f4f4f4;
  --text-dim: #c4c4c4;
  --text-faint: #9a9a9a;
  --border: #383838;
  --border-strong: #4a4a4a;
  --control-edge: rgba(255,255,255,.07);
  --chip-tint: rgba(255,255,255,.07);
  --track: #2a2a2a;
  --track-item: #3a3a3a;
  --scroll-thumb: rgba(255,255,255,.18);
  --scroll-thumb-hover: rgba(255,255,255,.32);

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.3);
  --shadow-card: 0 1px 3px rgba(0,0,0,.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.55), 0 2px 8px rgba(0,0,0,.4);
  --focus: #ffffff;
}

* { box-sizing: border-box; }

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

.hidden { display: none !important; }

/* ================= Заставка =================
   Знак по центру на секунду при открытии. Фон — фон приложения, поэтому в
   тёмной теме заставка тёмная (тему заранее ставит boot.js). Знак мягко
   проявляется, заставка уходит плавно — без резкой смены кадра. */
.splash {
  position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center;
  background: var(--bg); transition: opacity .3s ease, visibility .3s;
  /* Страховка: если скрипт приложения не загрузился, заставка всё равно уйдёт
     сама и не закроет собой сообщение об ошибке */
  animation: splash-gone .3s ease 4s forwards;
}
@keyframes splash-gone { to { opacity: 0; visibility: hidden; } }
.splash img {
  width: clamp(96px, 16vmin, 144px); height: auto;
  filter: drop-shadow(0 10px 28px rgba(15,108,189,.30));
  animation: splash-in .5s cubic-bezier(.2,.8,.2,1) both;
}
.splash.out { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes splash-in { from { opacity: 0; transform: scale(.88); } }
@media (prefers-reduced-motion: reduce) {
  .splash { transition: none; }
  .splash img { animation: none; }
}

/* ================= Полосы прокрутки =================
   Тонкий скруглённый ползунок без дорожки и без стрелок — как в окне Claude.
   Ширина полосы 10 px — столько ловит мышь, а видно 6: прозрачная рамка
   ужимает заливку. При наведении ползунок темнеет.
   Стандартные scrollbar-width/scrollbar-color тут нельзя: Chromium, увидев
   их, выключает ::-webkit-scrollbar и снова рисует стрелки. Поэтому они
   только для Firefox, где ::-webkit-scrollbar нет. */
::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb); background-clip: padding-box;
  border: 2px solid transparent; border-radius: 999px; min-height: 36px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
::-webkit-scrollbar-thumb:active { background-color: var(--scroll-thumb-hover); }
/* Панель навигации бывает тёмной и в светлой теме: ползунок берём от её текста */
.nav::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--sidebar-text) 24%, transparent); }
.nav::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--sidebar-text) 40%, transparent); }
@supports not selector(::-webkit-scrollbar) {
  html, .nav, .modal-body, .table-wrap, .imp-rows, .tree-wrap, .login-screen {
    scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent;
  }
}

/* Шкала заголовков: Title / Subtitle / Body strong — как в системных окнах */
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: 0; }
h1 { font-size: 28px; line-height: 1.25; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

/* Обводка фокуса с клавиатуры — двойная, как системная: тёмный контур на
   светлом подбое, поэтому видна на любом фоне. */
:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 1px;
  border-radius: var(--radius-sm);
}
button:focus:not(:focus-visible), a:focus:not(:focus-visible) { outline: none; }

/* ================= Вход =================
   Карточка на затемнённой подложке. Форма регистрации выше экрана телефона,
   поэтому центрируется через margin: auto — сеткой обрезало бы верх. */
.login-screen {
  position: fixed; inset: 0; display: flex; overflow-y: auto; overscroll-behavior: contain;
  padding: 20px max(20px, env(safe-area-inset-left)) calc(20px + env(safe-area-inset-bottom));
  background:
    radial-gradient(900px 600px at 18% -10%, rgba(15,108,189,.30), transparent 60%),
    radial-gradient(760px 520px at 88% 8%, rgba(0,120,212,.18), transparent 62%),
    linear-gradient(160deg, #1f2a36 0%, #171d25 58%, #12161c 100%);
}
.login-card {
  width: min(400px, 100%); margin: auto; flex: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 32px 32px 26px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 2px;
}
.login-logo { display: flex; justify-content: center; }
.login-logo img { display: block; filter: drop-shadow(0 4px 12px rgba(15,108,189,.25)); }
.login-card h1 { text-align: center; font-size: 24px; margin-top: 12px; }
.login-sub { text-align: center; color: var(--text-dim); margin: 4px 0 22px; font-size: 13px; }
.login-card label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 14px;
}
.login-card input { margin-top: 5px; }
.login-card select { margin-top: 5px; width: 100%; }
.login-error {
  display: flex; gap: 8px; border-left: 3px solid var(--danger); background: var(--danger-soft);
  color: var(--danger); border-radius: var(--radius-sm); padding: 9px 12px;
  font-size: 13px; margin-bottom: 12px;
}
.login-ok {
  border-left: 3px solid var(--ok); background: var(--ok-soft); color: var(--ok);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 12px;
}
.login-hint { text-align: center; color: var(--text-faint); font-size: 12px; margin: 16px 0 0; }
.link-btn {
  background: none; border: none; padding: 0; font: inherit; cursor: pointer;
  color: var(--accent-text); font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }

/* ================= Каркас окна =================
   Слева — панель навигации, справа — рабочая область: заголовок страницы,
   полоса действий и содержимое. Панель липкая, содержимое прокручивается
   под ней. */
.app { display: flex; min-height: 100vh; background: var(--bg); }

.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--sidebar-border);
}
/* Свёрнутая панель уходит из раскладки совсем: через width: 0 не выходит —
   панель флекс-элемент, и её ширину держит содержимое. Только на широком
   экране: на телефоне меню выезжает поверх страницы, и display: none
   заблокировал бы его насовсем. */
@media (min-width: 901px) {
  .app.collapsed > .sidebar { display: none; }
}

.brand {
  display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 48px; flex: none;
  color: var(--brand-fg); font-weight: 600; font-size: 14px;
}
.brand-mark { display: flex; flex: none; }
.brand-mark img { display: block; }
.brand-text { font-family: var(--font-display); }

.nav { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.nav-group-title {
  font-size: 12px; color: var(--sidebar-title); padding: 14px 12px 4px; font-weight: 600;
}
/* Пункт меню: 36 px, значок слева, у выбранного — вертикальная метка акцента */
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 36px;
  margin-bottom: 2px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); text-decoration: none; font-size: 14px; font-weight: 400;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left; position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); }
.nav-item:active { background: var(--sidebar-press); }
.nav-item.active {
  background: var(--sidebar-active-bg); color: var(--sidebar-active-fg); font-weight: 600;
  box-shadow: var(--shadow-card);
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 2px; background: var(--accent);
}
.nav-icon { width: 20px; height: 20px; display: grid; place-items: center; flex: none; color: var(--text-dim); }
.nav-item.active .nav-icon { color: var(--accent-text); }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px; min-width: 20px; text-align: center;
}
.sidebar-foot {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-top: 1px solid var(--sidebar-border); font-size: 12px; color: var(--sidebar-title);
}
.sidebar-foot .icon-btn { color: var(--sidebar-text); }
.version { margin-left: auto; font-variant-numeric: tabular-nums; }

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

/* Полоса заголовка и действий. Стоит на подложке, а не на белом: так она
   читается как часть окна, а не как ещё одна карточка. */
.topbar {
  height: 56px; flex: none; display: flex; align-items: center; flex-wrap: nowrap;
  gap: 8px; padding: 10px 20px 10px 12px;
  background: var(--bg); position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid transparent;
}
.topbar h1 {
  font-size: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 0 1 auto; min-width: 0; margin-left: 4px;
}
.topbar-actions {
  margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; flex: none;
}
.topbar-main { display: flex; gap: 8px; align-items: center; margin-left: auto; flex: none; }
.topbar-main:empty { display: none; }
.topbar-main + .topbar-actions { margin-left: 8px; }
.topbar .btn { white-space: nowrap; }
.menu-btn { display: grid; flex: none; }
/* Специфичность нарочно выше, чем у .icon-btn ниже по файлу: иначе «⋯»
   вылезает и на компьютере, где все кнопки и так на виду. */
.topbar .actions-btn { display: none; }

.user-chip {
  display: flex; align-items: center; gap: 10px; cursor: pointer; flex: none;
  height: 36px; padding: 0 10px 0 4px; border-radius: var(--radius-sm);
}
.user-chip:hover { background: var(--sidebar-hover); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta b { font-size: 13px; font-weight: 600; }
.user-meta small { font-size: 11.5px; color: var(--text-faint); }

/* Полоса действий укладывается в одну строку на любой ширине: сначала
   ужимается заголовок, потом уходят имя и роль, потом кнопки компактнее. */
@media (max-width: 1400px) { .user-meta { display: none; } }
@media (max-width: 1150px) {
  .topbar { gap: 6px; padding: 10px 14px 10px 8px; }
  .topbar .btn { padding: 0 10px; font-size: 13px; }
  .topbar .btn .ic { width: 15px; height: 15px; }
  .topbar h1 { font-size: 18px; }
}

.content { padding: 4px 20px 24px; flex: 1; }

/* ============ Состояние связи ============ */
.net-state {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 28px; padding: 0 10px; border-radius: 999px; font: inherit; font-size: 12px;
  font-weight: 600; border: 1px solid transparent; cursor: pointer; white-space: nowrap;
}
.net-state.offline { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.net-state.waiting { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.net-state .ic { width: 14px; height: 14px; flex: none; }
@media (max-width: 720px) {
  .net-state span { display: none; }
  .net-state { padding: 0 7px; }
}

/* ================= Поля ввода =================
   Поле Fluent: светлая заливка, тонкий контур и подчёркивание снизу. В фокусе
   подчёркивание становится акцентным и в два раза толще — по нему видно,
   куда попадает набор, даже боковым зрением. */
input, select, textarea {
  width: 100%; min-height: var(--control-h); padding: 5px 10px;
  border: 1px solid var(--border-strong); border-bottom-color: var(--text-faint);
  border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--text); font: inherit; font-size: 14px; outline: none;
  transition: background .1s, border-color .1s;
}
input:hover, select:hover, textarea:hover { background: var(--surface-2); }
input:focus, select:focus, textarea:focus {
  background: var(--surface); border-color: var(--border-strong);
  border-bottom: 2px solid var(--accent); padding-bottom: 4px;
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-2); color: var(--text-faint); border-bottom-color: var(--border-strong);
  cursor: not-allowed;
}
input[type="checkbox"] {
  width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--accent);
  border-radius: 4px; cursor: pointer;
}
input[type="color"] { padding: 2px; cursor: pointer; }
textarea { resize: vertical; min-height: 76px; line-height: 1.5; padding-top: 7px; }
select { cursor: pointer; }

label.field { display: block; margin-bottom: 2px; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.field-hint {
  display: block; margin-top: 5px; font-size: 12px; line-height: 1.4;
  color: var(--text-faint); font-weight: 400;
}
label.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; padding-top: 20px; }
label.check input { margin: 0; flex: none; }

/* Поле пароля с кнопкой «показать»: кнопка лежит поверх правого края,
   поэтому тексту оставлено место под неё. */
.pw-field { position: relative; display: block; }
label.field > span.pw-field { font-size: inherit; font-weight: 400; color: inherit; margin-bottom: 0; }
.pw-field input { padding-right: 38px; }
.pw-eye {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: none; border-radius: var(--radius-sm);
  background: none; color: var(--text-dim); cursor: pointer;
}
.pw-eye:hover { color: var(--text); background: var(--chip-tint); }
.pw-eye.on { color: var(--accent-text); }
.login-card .pw-field { margin-top: 5px; }
.login-card .pw-field input { margin-top: 0; }

/* ================= Кнопки =================
   Обычная кнопка — светлая заливка с чуть более тёмной нижней гранью:
   она и создаёт ощущение физической клавиши без тени. Нажатие «проваливает»
   заливку, а не сдвигает кнопку. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); border-bottom-color: var(--control-edge);
  background: var(--surface-3); color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .1s, border-color .1s, color .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { background: var(--track); color: var(--text-dim); }
.btn:disabled { background: var(--surface-2); color: var(--text-faint); border-color: var(--border); cursor: not-allowed; }

.btn-primary {
  background: var(--accent); border-color: var(--accent); border-bottom-color: rgba(0,0,0,.14);
  color: var(--accent-fg);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active { background: var(--accent-press); border-color: var(--accent-press); color: var(--accent-fg); opacity: .9; }
.btn-primary:disabled { background: var(--border); border-color: var(--border); color: var(--text-faint); }

.btn-danger { background: var(--danger); border-color: var(--danger); border-bottom-color: rgba(0,0,0,.14); color: #fff; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); filter: brightness(1.1); }
.btn-danger:active { filter: brightness(.92); color: #fff; }

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--chip-tint); }
.btn-ghost:active { background: var(--chip-tint); opacity: .8; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 40px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; margin-top: 8px; height: 36px; }
.btn.full { width: 100%; justify-content: center; }

/* Кнопка-значок: квадрат под палец, подсветка только при наведении */
.icon-btn {
  border: none; background: none; color: var(--text-dim); cursor: pointer;
  width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center; flex: none;
  transition: background .1s, color .1s;
}
.icon-btn:hover { background: var(--chip-tint); color: var(--text); }
.icon-btn:active { opacity: .7; }
.icon-btn:disabled { color: var(--text-faint); cursor: not-allowed; background: none; }
.ic { display: block; flex: none; }
.icon-btn .ic { width: 18px; height: 18px; }
.btn .ic { margin-left: -2px; }

/* ================= Карточки и сетки ================= */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); margin-bottom: 14px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap;
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 16px; }

.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 14px; }
/* Плитка показателя: крупное число, подпись сверху, значение состояния —
   цветной точкой слева, а не заливкой всей плитки. */
.kpi {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px 14px 18px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 2px; cursor: default; overflow: hidden;
}
.kpi::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 2px 2px 0; background: var(--accent);
}
.kpi.clickable { cursor: pointer; transition: background .1s, border-color .1s; }
.kpi.clickable:hover { background: var(--surface-2); border-color: var(--border-strong); }
.kpi-label { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.kpi-value { font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.2; }
.kpi-note { font-size: 12px; color: var(--text-faint); }
.kpi.danger::before { background: var(--danger); } .kpi.danger .kpi-value { color: var(--danger); }
.kpi.warn::before { background: var(--warn); }     .kpi.warn .kpi-value { color: var(--warn); }
.kpi.ok::before { background: var(--ok); }         .kpi.ok .kpi-value { color: var(--ok); }

.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section-title {
  grid-column: 1 / -1; font-family: var(--font-display); font-size: 14px; font-weight: 600;
  color: var(--text); padding-bottom: 6px; margin-top: 10px;
  border-bottom: 1px solid var(--border);
}

/* ================= Таблицы =================
   Список записей: шапка на дымке, строки разделены волосяной линией,
   наведение подсвечивает всю строку целиком. */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 12px; color: var(--text-dim); font-weight: 600;
  padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; white-space: nowrap; z-index: 2;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--accent-text); }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { transition: background .08s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.row-click { cursor: pointer; }
table.data tbody tr.row-click:active { background: var(--track); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions { text-align: right; white-space: nowrap; width: 1%; }
table.data td.actions .icon-btn { width: 28px; height: 28px; }
table.data td.actions .icon-btn .ic { width: 16px; height: 16px; }
table.data tr.is-overdue td:first-child { box-shadow: inset 3px 0 var(--danger); }
table.data tr.is-soon td:first-child { box-shadow: inset 3px 0 var(--warn); }

/* Реестр: одна единица — одна строка ровно в 50 px. Ячейка не переносится,
   длинное значение обрезается многоточием, полное видно подсказкой. */
table.data.eq-list td { height: 50px; padding: 0 12px; }
table.data.eq-list td .cell {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Колонки делят ширину экрана, а не растягиваются по содержимому: иначе
   таблица выходит шире окна и справа прячутся «Состояние» и срок ТО.
   Узкие колонки — долями ширины, «Состояние» и срок — по своему содержимому,
   остаток — наименованию. Уже 960 px таблица листается вбок, а на телефоне
   превращается в карточки (см. ниже). */
table.data.eq-list { table-layout: fixed; min-width: 960px; }
table.data.eq-list th { overflow: hidden; text-overflow: ellipsis; }
table.data.eq-list .c-kind { width: 14%; }
table.data.eq-list .c-model,
table.data.eq-list .c-area,
table.data.eq-list .c-loc,
table.data.eq-list .c-attr { width: 9%; }
table.data.eq-list .c-comp { width: 8%; }
table.data.eq-list .c-status { width: 120px; }
table.data.eq-list .c-due { width: 220px; }

.code { font-family: var(--mono); font-size: 12.5px; color: var(--accent-text); font-weight: 600; }
.muted { color: var(--text-faint); }
.empty { text-align: center; padding: 48px 20px; color: var(--text-faint); font-size: 14px; }
.empty-icon { display: flex; justify-content: center; margin-bottom: 14px; color: var(--text-faint); opacity: .7; }
.more-row { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--border); }

/* Значок состояния: заливка по смыслу, без рамки */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); white-space: nowrap;
}
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.tag.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

/* ================= Вкладки ================= */
/* Черта под вкладками нарисована тенью внутри строки, а подчёркивание
   активной стоит на ней, не ниже: иначе оно на пиксель вылезает за край, и
   строка вкладок заводит собственную вертикальную полосу прокрутки. Вбок
   строка листается пальцем или колесом — полосы у неё нет. */
.tabs {
  display: flex; align-items: flex-end; gap: 4px; margin-bottom: 14px;
  padding: 0 5px;                            /* текст первой вкладки — по краю текста карточки ниже */
  box-shadow: inset 0 -1px 0 var(--border);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; padding: 9px 12px; border: none; background: none; font: inherit; font-size: 14px;
  font-weight: 600; color: var(--text-dim); cursor: pointer; white-space: nowrap; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab:hover { color: var(--text); background: var(--chip-tint); }
.tab.active { color: var(--text); background: none; }
/* Подчёркивание короче самой вкладки — как у системного «пивота» */
.tab.active::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2.5px;
  border-radius: 2px; background: var(--accent);
}

/* ================= Переключатель разделов =================
   Сегментированная дорожка: выбранный раздел приподнят карточкой. */
.section-bar { display: flex; margin-bottom: 14px; }
.section-track {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 4px;
  background: var(--track); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.section-sep { flex: none; width: 1px; height: 20px; margin: 0 5px; background: var(--border-strong); }
.section-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 8px;
  border: 1px solid transparent; border-radius: var(--radius); background: none;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text-dim);
  cursor: pointer; white-space: nowrap; transition: background .1s, color .1s;
}
.section-btn .ic-wrap {
  display: grid; place-items: center; width: 24px; height: 24px; flex: none;
  border-radius: var(--radius-sm); color: var(--text-dim); transition: background .1s, color .1s;
}
.section-btn .cnt {
  min-width: 20px; padding: 1px 7px; border-radius: 999px; text-align: center;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--chip-tint); color: var(--text-dim);
}
.section-btn:hover { background: var(--track-item); color: var(--text); }
.section-btn.active {
  background: var(--surface); border-color: var(--border); color: var(--text);
  box-shadow: var(--shadow-card);
}
.section-btn.active .ic-wrap { background: var(--accent); color: var(--accent-fg); }
.section-btn.active .cnt { background: var(--accent-soft); color: var(--accent-text); }

/* ================= Панель фильтров (общая) ================= */
.filters {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 12px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.filters .field-inline { display: flex; flex-direction: column; gap: 4px; }
.filters .field-inline > span { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.filters input, .filters select { min-width: 140px; }
.filters input[type="checkbox"] { min-width: 0; }
.filters label.check { padding-top: 0; align-self: center; white-space: nowrap; }
.filters .search { min-width: 240px; }
.filters .spacer { margin-left: auto; }
.filters-toggle {
  display: none; align-items: center; gap: 8px; margin: 12px 16px; width: calc(100% - 32px);
  justify-content: center;
}
.filters-toggle.active { border-color: var(--accent); color: var(--accent-text); }
.filters-toggle .cnt {
  min-width: 20px; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--accent); color: var(--accent-fg);
}
.filters .field-inline.range > div { display: flex; gap: 6px; }
.filters .mini { min-width: 90px; }
.filters .field-inline.range input[type="date"] { min-width: 136px; }

/* ================= Строка реестра: поиск и фильтры ================= */
.eq-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.eq-search {
  display: flex; align-items: center; gap: 8px; flex: 0 1 320px; min-width: 200px;
  height: var(--control-h); padding: 0 10px;
  border: 1px solid var(--border-strong); border-bottom-color: var(--text-faint);
  border-radius: var(--radius-sm); background: var(--surface-3); color: var(--text-dim);
}
.eq-search:focus-within {
  background: var(--surface); border-bottom: 2px solid var(--accent); padding-bottom: 0;
}
.eq-search input {
  flex: 1; min-width: 0; height: 100%; min-height: 0; border: 0; background: none; padding: 0;
  color: var(--text); font-size: 14px;
}
.eq-search input:hover, .eq-search input:focus { background: none; border: 0; padding: 0; }
.eq-search-x {
  display: flex; border: 0; background: none; padding: 2px; cursor: pointer;
  color: var(--text-dim); border-radius: 4px;
}
.eq-search-x:hover { background: var(--chip-tint); color: var(--text); }
.eq-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: 1 1 auto; position: relative; }
.eq-filter-btn { display: inline-flex; align-items: center; gap: 8px; }
.eq-filter-btn.active { border-color: var(--accent); color: var(--accent-text); }
.eq-filter-btn .cnt {
  min-width: 20px; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--accent); color: var(--accent-fg);
}
/* Пилюля выбранного значения: снимается нажатием */
.eq-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 999px; border: 1px solid var(--accent-line); background: var(--accent-soft);
  color: var(--accent-text); font-size: 13px; font-weight: 600; cursor: pointer;
  max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eq-chip:hover { background: var(--accent-soft-2); }
.eq-chip:active { opacity: .75; }
.eq-chip svg { flex: none; opacity: .65; }
.eq-tools .spacer { margin-left: auto; }

/* Кнопка порядка списка: поле и направление подписаны прямо на ней */
.eq-sort-btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.eq-sort-btn i { font-style: normal; font-weight: 400; color: var(--text-dim); }

/* Выпадающее меню: пункты списком, выбранный отмечен галочкой */
.menu-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; min-width: 270px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.menu-pop button {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 34px; padding: 0 10px;
  border: 0; background: none; font: inherit; font-size: 14px; color: var(--text);
  cursor: pointer; border-radius: var(--radius-sm); text-align: left;
}
.menu-pop button:hover { background: var(--chip-tint); }
.menu-pop button.active { font-weight: 600; }
.menu-pop button .ic { color: var(--accent-text); }
.menu-pop .pt { width: 15px; flex: none; }
.menu-pop button i { margin-left: auto; font-style: normal; font-size: 12.5px; color: var(--text-dim); }
.menu-pop .sep { height: 1px; margin: 4px 8px; background: var(--border); }

.fm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.fm-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px;
  border-radius: 999px; border: 1px solid var(--accent-line); background: var(--accent-soft);
  color: var(--accent-text); font-size: 12.5px; font-weight: 600; cursor: pointer;
  max-width: 100%; white-space: nowrap; overflow: hidden;
}
.fm-chip:hover { background: var(--accent-soft-2); }
.fm-chip svg { flex: none; opacity: .65; }

/* ================= Диалоги =================
   Окно содержимого: скругление 12 px, светлая подложка под затемнением,
   нижняя полоса с кнопками — главная справа. */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 24px; z-index: 100;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: min(880px, 100%); max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal.narrow { width: min(480px, 100%); }
.modal.wide { width: min(1120px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 8px; }
.modal-head h2 { font-family: var(--font-display); font-size: 20px; font-weight: 600; flex: 1; }
.modal-body { padding: 12px 24px 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end; padding: 16px 24px;
  border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap;
}
.modal-foot .left { margin-right: auto; }

/* ================= Уведомления ================= */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  background: var(--surface); border: 1px solid var(--border-strong); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-lg); font-size: 14px;
  max-width: 380px; animation: slide-in .18s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--ok); }
@keyframes slide-in { from { opacity: 0; transform: translateY(10px); } }

/* ================= Строки-параметры =================
   Пары «подпись — значение» в паспорте установки: подпись мелкая и серая,
   значение крупнее и чёрное, как в системных свойствах. */
.info-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 24px; }
.info-item { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.info-item span { font-size: 12px; color: var(--text-dim); font-weight: 400; }
.info-item b { font-size: 14px; font-weight: 600; word-break: break-word; }

/* ================= Выбор оформления ================= */
.look-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.look-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
  transition: background .1s, border-color .1s;
}
.look-card:hover { background: var(--surface-2); }
.look-card.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.look-card b { font-size: 14px; font-weight: 600; }
.look-card small { font-size: 12.5px; line-height: 1.4; color: var(--text-dim); }
.look-dots { display: flex; gap: 5px; margin-bottom: 4px; }
.look-dots i { width: 22px; height: 22px; border-radius: 50%; display: block; border: 1px solid rgba(0,0,0,.12); }
.look-pick { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; }
.look-color { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.look-color input[type="color"] { width: 84px; height: 36px; border-radius: var(--radius-sm); }
.look-color span { font-weight: 400; font-size: 12px; }
.look-preview {
  display: flex; margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; min-height: 96px; background: var(--bg);
}
.look-prev-side { width: 74px; background: var(--sidebar); border-right: 1px solid var(--sidebar-border); }
.look-prev-main { flex: 1; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.look-prev-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.look-prev-btns { display: flex; gap: 8px; }

/* ================= Доступ из интернета ================= */
.ext-box {
  margin: 16px 0 4px; padding: 14px 16px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2);
}
.ext-box.on { border-color: var(--accent); }
.ext-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ext-head .ic { color: var(--text-dim); }
.ext-box.on .ext-head .ic { color: var(--accent-text); }
.ext-warn {
  display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px;
  padding: 11px 13px; border-radius: var(--radius-sm); border-left: 3px solid var(--danger);
  background: var(--danger-soft); color: var(--danger); font-size: 13px; line-height: 1.5;
}
.ext-warn .ic { flex: none; margin-top: 2px; }
.ext-warn code { color: inherit; }
.ext-steps { margin: 8px 0 10px; padding-left: 22px; font-size: 14px; line-height: 1.7; color: var(--text-dim); }
.ext-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ext-stat { margin: 12px 0 0; font-size: 12.5px; line-height: 1.6; }

/* ================= Подразделы реестра ================= */
.folder-rows { display: flex; flex-direction: column; gap: 4px; }
.folder-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: 14px;
}
.folder-row:hover { background: var(--chip-tint); }
.folder-row .fr-ic { display: flex; color: var(--accent-text); flex: none; }
.folder-row .fr-name { flex: 1; min-width: 0; font-weight: 600; }
.folder-row .fr-meta { font-size: 12.5px; color: var(--text-faint); }
.folder-row .icon-btn { width: 28px; height: 28px; }

/* ================= Паспорт установки ================= */
.qr-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.qr-box {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); text-align: center;
}
.qr-box img { display: block; border-radius: 4px; background: #fff; }
.qr-box .muted { font-size: 11.5px; line-height: 1.35; }

.eq-photo {
  display: block; width: 168px; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--surface-2); flex: none;
}
.eq-photo img { display: block; width: 100%; height: 132px; object-fit: contain; }
.photo-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.photo-tile {
  position: relative; width: 150px; height: 118px; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; background: var(--surface-2);
}
.photo-tile img { width: 100%; height: 100%; object-fit: contain; }
.photo-tile:hover { border-color: var(--accent); }
.photo-tile .icon-btn {
  position: absolute; top: 4px; right: 4px; background: var(--surface); border-radius: var(--radius-sm);
  opacity: 0; transition: opacity .1s; box-shadow: var(--shadow);
}
.photo-tile:hover .icon-btn { opacity: 1; }

/* Вложение: строка со значком, подписью и размером */
.file-list { display: flex; flex-wrap: wrap; gap: 8px; }
.file-item {
  display: flex; align-items: center; gap: 9px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; background: var(--surface-2);
}
.file-item:hover { background: var(--chip-tint); }
.file-item a { color: var(--accent-text); text-decoration: none; font-weight: 600; }
.file-item .src-link { color: var(--text-faint); font-weight: 400; font-size: 12px; }
.file-item a:hover { text-decoration: underline; }

/* ================= Настройки сети ================= */
.net-box {
  margin-top: 18px; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2);
}
.net-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.net-head .ic { color: var(--accent-text); }
.net-box .muted { margin: 0 0 10px; font-size: 13px; line-height: 1.5; }
.net-box code { padding: 1px 5px; border-radius: 4px; background: var(--chip-tint); font-family: var(--mono); font-size: 12.5px; }
.net-addrs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.net-qr {
  display: flex; gap: 14px; align-items: center; margin-bottom: 12px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.net-qr img { flex: none; background: #fff; border-radius: 6px; padding: 5px; }
.net-qr b { font-size: 14px; font-weight: 600; }
.net-qr .muted { margin: 4px 0 0; }
.net-addr {
  height: var(--control-h); padding: 0 12px; border: 1px solid var(--border-strong);
  border-bottom-color: var(--control-edge); border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--text); cursor: pointer;
  font: inherit; font-size: 13px; font-family: var(--mono);
}
.net-addr:hover { background: var(--surface-2); }
.net-addr.active {
  background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); font-weight: 600;
}

/* ================= Чек-листы ================= */
.checklist-editor { display: flex; flex-direction: column; gap: 6px; }
.checklist-editor .check-row {
  display: grid; grid-template-columns: 26px 1fr 180px; gap: 10px; align-items: center;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.checklist-editor .check-row.done { border-color: var(--ok); background: var(--ok-soft); }
.checklist-editor .check-row .ctext { font-size: 14px; }
.checklist-editor .check-row input[type="text"] { min-height: 28px; font-size: 13px; }

label.check.full { grid-column: 1 / -1; padding-top: 6px; }
.check-measure { min-width: 940px; }
.check-measure th { font-size: 11px; padding: 8px 6px; }
.check-measure td { padding: 5px 6px; }
.check-measure td.ctext { min-width: 250px; font-size: 13px; }
.check-measure td.mid { text-align: center; }
.check-measure input { min-height: 28px; padding: 3px 7px; font-size: 13px; min-width: 76px; }
.check-measure input[type="checkbox"] { min-width: 0; }
.check-measure tr.done td.ctext { color: var(--text-dim); }
.check-measure tr.done td.mid { background: var(--ok-soft); }

/* ================= Расход материалов ================= */
.part-rows { display: flex; flex-direction: column; gap: 8px; }
.part-row { display: grid; grid-template-columns: 1fr 92px 106px 92px 32px; gap: 8px; align-items: center; }
.part-row .total { font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-dim); }

/* Полоса заполнения: остаток на складе, ход выполнения */
.bar { height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.low > i { background: var(--danger); }
.status-bars { display: flex; flex-direction: column; gap: 10px; }
.status-line { display: grid; grid-template-columns: 130px 1fr 42px; gap: 12px; align-items: center; font-size: 13.5px; }
.status-line .bar { height: 8px; }

/* ================= Голосовой ввод ================= */
.voice-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px;
  margin-bottom: 6px; border: 1px solid var(--border-strong); border-bottom-color: var(--control-edge);
  border-radius: 999px; background: var(--surface-3); color: var(--text-dim);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.voice-btn:hover { background: var(--surface-2); color: var(--text); }
.voice-btn .ic { color: var(--accent-text); }
/* Идёт запись: кнопка «горит», значок пульсирует — видно, что микрофон открыт */
.voice-btn.on { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.voice-btn.on .ic { color: var(--danger); animation: mic-pulse 1.1s ease-in-out infinite; }
.voice-btn.off { color: var(--text-faint); }
.voice-btn.off .ic { color: var(--text-faint); }
@keyframes mic-pulse { 50% { opacity: .35; } }

/* ================= Сменный журнал ================= */
.log-text { white-space: pre-wrap; max-width: 520px; line-height: 1.45; }
.log-text.warn { color: var(--warn); }

/* ================= Отчёты ================= */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.report-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface);
  display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-card);
}
.report-card h3 { font-size: 15px; font-weight: 600; }
.report-card p { margin: 0; font-size: 13px; color: var(--text-dim); flex: 1; }
.report-icon { color: var(--accent-text); display: flex; }

/* ================= Обходной лист ================= */
.shops { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); margin-bottom: 14px; }
.shop-card {
  display: flex; flex-direction: column; gap: 12px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card); cursor: pointer; transition: background .1s, border-color .1s;
}
.shop-card:hover { background: var(--surface-2); border-color: var(--border-strong); }
.shop-top { display: flex; gap: 12px; align-items: center; }
.shop-top b { display: block; font-size: 15px; font-weight: 600; }
.shop-top small { display: block; color: var(--text-dim); font-size: 12.5px; }
.shop-ic {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text);
}
.shop-last { font-size: 13px; color: var(--text-dim); line-height: 1.5; min-height: 34px; }
.shop-acts { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }

.round-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.round-bar .spacer { margin-left: auto; }
.round-bar #r-sum { display: flex; gap: 6px; flex-wrap: wrap; }
.locked-note {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 16px;
  background: var(--ok-soft); color: var(--text-dim); font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.locked-note .ic { flex: none; color: var(--ok); margin-top: 1px; }

/* Отметка: две крупные кнопки — по ним попадают пальцем, не глядя */
.state-pick { display: inline-flex; gap: 6px; }
.sp {
  border: 1px solid var(--border-strong); border-bottom-color: var(--control-edge);
  background: var(--surface-3); color: var(--text-dim);
  border-radius: var(--radius-sm); height: 30px; padding: 0 12px; font: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .1s, color .1s;
}
.sp:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.sp:disabled { opacity: .5; cursor: default; }
.sp.ok.active { background: var(--ok); border-color: var(--ok); color: #fff; }
.sp.issue.active { background: var(--danger); border-color: var(--danger); color: #fff; }
.sp.na { padding: 0 10px; }
.sp.na.active { background: var(--text-faint); border-color: var(--text-faint); color: #fff; }

.round-table td { vertical-align: middle; padding: 9px 12px; }
.round-table .r-note { width: 100%; min-width: 150px; margin-top: 6px; }
.round-row.ok { background: var(--ok-soft); }
.round-row.issue { background: var(--danger-soft); }
.round-table td.r-nm { width: 100%; }
.round-table td.r-act { width: 1%; white-space: nowrap; text-align: right; }
.round-table tr[data-eq] { cursor: pointer; }
.round-table tr[data-eq]:hover td.r-nm { color: var(--accent-text); }
.r-pos { display: inline-block; font-weight: 600; color: inherit; }
.r-sub { display: block; font-size: 12px; color: var(--text-faint); margin-top: 1px; }
.round-row.seen td.r-nm { box-shadow: inset 3px 0 var(--accent); }

/* Заголовок участка: стрелка в одной строке с названием */
.r-fold { display: flex; align-items: center; gap: 8px; }
.r-fold .ic { flex: none; transition: transform .12s; color: var(--text-dim); }
.r-area td {
  cursor: pointer; background: var(--surface-2); font-size: 13px; color: var(--text-dim);
  border-bottom: 1px solid var(--border-strong); padding: 7px 12px;
}
.r-area td:hover { background: var(--chip-tint); }
.r-area b { color: var(--text); font-weight: 600; }
.r-area:not(.closed) .ic { transform: rotate(90deg); }
.r-area-done { font-size: 12px; }
.r-more td {
  cursor: pointer; background: var(--surface-2); font-weight: 600; font-size: 13px;
  color: var(--text-dim); border-bottom: 1px solid var(--border-strong); padding: 7px 12px;
}
.r-more.open .ic { transform: rotate(90deg); }
.r-more .muted { font-weight: 400; }

/* Свёртка: заголовок листа, подробности опросника */
.r-head-box > summary {
  padding: 11px 16px; cursor: pointer; font-size: 14px; font-weight: 600;
  color: var(--text-dim); border-bottom: 1px solid var(--border); list-style: none;
}
.r-head-box > summary::-webkit-details-marker { display: none; }
.r-head-box > summary::before { content: '\203A '; color: var(--text-faint); display: inline-block; transition: transform .12s; }
.r-head-box[open] > summary::before { transform: rotate(90deg); }
.r-head-box > summary:hover { color: var(--text); background: var(--surface-2); }

.rf-note { white-space: pre-wrap; }
.rf-box { margin-top: 4px; }
.rf-box > summary { cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.rf-box > summary::-webkit-details-marker { display: none; }
.rf-box > summary::before { content: '\203A '; color: var(--text-faint); display: inline-block; transition: transform .12s; }
.rf-box[open] > summary::before { transform: rotate(90deg); }
.rf-box > summary:hover { color: var(--text); }
.rf-table {
  width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden;
}
.rf-table th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-dim);
  padding: 7px 10px; border-bottom: 1px solid var(--border);
}
.rf-table td { padding: 7px 10px; border-top: 1px solid var(--border); vertical-align: top; }
.rf-table tbody tr:first-child td { border-top: 0; }
.rf-table td:first-child { color: var(--text-dim); }
.rf-table td:nth-child(2), .rf-table td:nth-child(3) { white-space: nowrap; }
.rf-table tr.bad td:first-child { color: var(--text); box-shadow: inset 2px 0 var(--danger); }

/* ================= Проверка по QR-коду ================= */
.chk-head .chk-title { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.chk-code {
  flex: none; padding: 7px 12px; border-radius: var(--radius-sm); background: var(--accent-soft);
  color: var(--accent-text); font: 600 15px/1 var(--mono);
}
.chk-title b { display: block; font-size: 15px; font-weight: 600; }
.chk-title small { display: block; color: var(--text-dim); font-size: 12.5px; }
.chk-last, .chk-plan {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px;
}
.chk-last .ic, .chk-plan .ic { flex: none; }
.chk-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.chk-foot .spacer { margin-left: auto; }

.q-list { border-top: 1px solid var(--border); }
.q-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
}
.q-row.ok { background: var(--ok-soft); }
.q-row.issue { background: var(--danger-soft); }
.q-row.na { opacity: .6; }
.q-text { font-size: 14px; }
.q-value { display: inline-flex; gap: 8px; align-items: center; }
.q-value .q-input { width: 130px; }
.q-value select.q-input { width: auto; min-width: 165px; }
.q-unit { font-size: 12.5px; color: var(--text-dim); }
.q-note { grid-column: 1 / -1; width: 100%; }

.shots { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.shot { display: block; width: 92px; height: 92px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hint-box {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13px; color: var(--text-dim); line-height: 1.6;
}
.hint-box ul { margin: 6px 0 0; padding-left: 18px; }
.hint-box code { font-size: 12.5px; }

/* Удаление учётной записи: сначала факты, потом вопрос */
.kill-note { font-size: 14px; line-height: 1.55; }
.kill-note p { margin: 0 0 8px; }
.kill-list {
  margin: 0 0 10px; padding: 10px 12px 10px 28px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--text);
}
.kill-list li { margin: 2px 0; }

/* ================= Графики =================
   Палитра серий проверена на разделимость при дальтонизме отдельно для
   светлой и тёмной темы. Порядок слотов менять нельзя: он и обеспечивает
   различимость соседних. */
:root {
  --s1: #0f6cbd;  --s2: #eb6834;  --s3: #107c41;
  --s4: #c19c00;  --s5: #c239b3;  --s6: #008272;
  --chart-surface: #ffffff;
  --chart-grid: #ececec;
  --chart-axis: #d2d2d2;
  --chart-muted: #6e6e6e;
  --chart-trend: #bdbdbd;
}
html[data-theme="dark"] {
  --s1: #60cdff;  --s2: #f7955b;  --s3: #6ccb5f;
  --s4: #ffd966;  --s5: #d980d0;  --s6: #4cc2c2;
  --chart-surface: #2b2b2b;
  --chart-grid: #3a3a3a;
  --chart-axis: #4a4a4a;
  --chart-muted: #a0a0a0;
  --chart-trend: #555555;
}

.chart { display: block; width: 100%; height: auto; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-axis { stroke: var(--chart-axis); stroke-width: 1; }
.chart-rule { stroke: var(--chart-axis); stroke-width: 1; }
.chart-trend { stroke: var(--chart-trend); stroke-width: 1.5; }
.chart-tick { fill: var(--chart-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-unit, .chart-axtitle { fill: var(--chart-muted); font-size: 11px; }
.chart-value { fill: var(--text-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-endlabel { font-size: 11.5px; font-weight: 600; }
.chart-mark { cursor: pointer; }
.chart-mark:hover { opacity: .82; }
.chart-empty { padding: 34px 16px; text-align: center; color: var(--text-faint); font-size: 14px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px 2px; }
.chart-legend .item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.chart-legend i { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.chart-tip {
  position: fixed; z-index: 200; display: none; pointer-events: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 12.5px;
  max-width: 280px;
}
.chart-tip .head { font-weight: 600; margin-bottom: 5px; }
.chart-tip .row { display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.chart-tip .row i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.chart-tip .row span { color: var(--text-dim); }
.chart-tip .row b { margin-left: auto; font-variant-numeric: tabular-nums; }
.chart-card .card-body { padding-top: 6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; padding: 12px 16px 2px; }
.chip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; }
.chip:not(.active) { color: var(--text-faint); }
.chip.active { border-color: var(--accent); color: var(--text); }
.chart-note { font-size: 12.5px; color: var(--text-dim); margin: 0; padding: 0 16px 12px; }
.chart-hero { display: flex; gap: 26px; flex-wrap: wrap; padding: 4px 16px 14px; }
.chart-hero div { display: flex; flex-direction: column; gap: 2px; }
.chart-hero span { font-size: 12px; color: var(--text-dim); font-weight: 400; }
.chart-hero b { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.corr {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px;
  border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; color: var(--text-dim);
}
.corr b { color: var(--text); font-variant-numeric: tabular-nums; }

/* Переключатель вида внутри панели: два-три взаимоисключающих режима */
.seg {
  display: inline-flex; align-self: flex-end; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-3);
}
.seg button {
  height: 30px; padding: 0 14px; border: none; background: none; font: inherit; font-size: 13.5px;
  font-weight: 600; color: var(--text-dim); cursor: pointer; white-space: nowrap;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--surface-2); color: var(--text); }
.seg button.active { background: var(--accent); color: var(--accent-fg); }

/* ================= Сканирование наклейки ================= */
.scan-box { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 4 / 3; margin-bottom: 12px; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18% 22%; border: 2px solid var(--accent); border-radius: var(--radius); box-shadow: 0 0 0 9999px rgba(0,0,0,.4); }
.scan-manual { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.scan-manual input { width: 100%; }
#scan-hits { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.scan-hit {
  display: flex; flex-direction: column; gap: 1px; text-align: left; width: 100%;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer;
}
.scan-hit:hover { border-color: var(--accent); background: var(--surface-2); }
.scan-hit small { font-size: 12px; }

/* ================= Склад ================= */
.stock-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.stock-bar .spacer { margin-left: auto; }
.stock-tree td.nm { width: 100%; }
.stock-tree th.num, .stock-tree td.num { width: 1%; white-space: nowrap; }
.stock-tree td.actions .acts { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.stock-tree .pad { display: inline-block; width: calc(var(--d) * 18px); }
.stock-tree tr.grp { cursor: pointer; background: var(--surface-2); }
.stock-tree tr.grp:hover { background: var(--chip-tint); }
.stock-tree tr.grp td { border-bottom: 1px solid var(--border-strong); font-weight: 600; }
.stock-tree tr.grp .caret { display: inline-block; width: 16px; color: var(--text-faint); vertical-align: -2px; }
.stock-tree tr.grp .caret .ic { transform: rotate(90deg); transition: transform .12s; }
.stock-tree tr.grp.closed .caret .ic { transform: none; }
.stock-tree tr.grp .muted { font-size: 12px; font-weight: 400; }
.stock-tree tfoot td { padding: 11px 12px; border-top: 2px solid var(--border-strong); background: var(--surface-2); font-weight: 600; }
.stock-tree td .code { font-size: 12px; color: var(--text-faint); }

/* Предпросмотр загрузки из 1С */
.imp-head {
  display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 12px 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.imp-head > div { display: flex; flex-direction: column; gap: 2px; }
.imp-head span { font-size: 12px; color: var(--text-dim); }
.imp-rows { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.imp-rows .table-wrap { border: 0; }
.imp-rows thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }

/* ================= Планшет ================= */
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 60; transform: translateX(-100%); transition: transform .18s ease; }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app.nav-open::before { content: ''; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.45); }
  .content { padding: 4px 14px 20px; }
  .user-meta { display: none; }
  .topbar h1 { font-size: 17px; }
  .part-row { grid-template-columns: 1fr 1fr; }
  .check-row { grid-template-columns: 26px 1fr; }
  .check-row input[type="text"] { grid-column: 2; }
}

/* ================= Телефон =================
   Узкий экран — это работа в цехе: одна рука, перчатка, солнце. Таблицы
   разворачиваются в карточки, кнопки шапки прячутся под «⋯», поля крупнее. */
@media (max-width: 720px) {
  .content { padding: 4px 10px calc(24px + env(safe-area-inset-bottom)); }
  .topbar { padding-left: calc(8px + env(safe-area-inset-left)); }
  .modal-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

  .topbar { height: 52px; padding: 8px 12px 8px 6px; gap: 6px; flex-wrap: nowrap; }
  .topbar h1 { font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .topbar .actions-btn { display: grid; }
  .topbar-actions {
    display: none; position: absolute; top: 100%; right: 8px; left: 8px;
    flex-direction: column; align-items: stretch; gap: 4px; margin: 0; padding: 6px;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 40;
  }
  .topbar.actions-open .topbar-actions { display: flex; }
  .topbar-main { margin-left: auto; }
  .topbar-main .btn { padding: 0 12px; white-space: nowrap; }
  .topbar.has-main h1 { display: none; }
  /* Список действий — пункты меню: выравнивание по левому краю, во всю ширину */
  .topbar-actions .btn {
    width: 100%; justify-content: flex-start; height: 40px; padding: 0 12px;
    border-color: transparent; background: none; font-weight: 400;
  }
  .topbar-actions .btn:hover { background: var(--chip-tint); }
  .topbar-actions .btn-primary { background: var(--accent); border-color: var(--accent); font-weight: 600; }
  .user-chip { padding-left: 4px; }

  .filters-toggle { display: flex; }
  .filters { display: none; }
  .filters.open { display: flex; }
  .filters .field-inline, .filters .search, .filters input, .filters select { width: 100%; min-width: 0; }
  .filters .field-inline { flex: 1 1 100%; }
  .filters .spacer { display: none; }
  .filters .field-inline.range > div { display: flex; gap: 8px; }
  .filters .field-inline.range input { flex: 1; }

  /* 16px — порог, ниже которого Safari на iOS увеличивает страницу при фокусе */
  input, select, textarea { font-size: 16px; min-height: 40px; }
  .btn { height: 38px; padding: 0 14px; }
  .btn-sm { height: 32px; }
  .icon-btn { width: 40px; height: 40px; }

  /* Таблица — в карточки: заголовки не помещаются, но подписи нужны */
  .table-wrap { overflow: visible; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: auto; }
  table.data thead { display: none; }
  table.data tr {
    position: relative; margin-bottom: 10px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--shadow-card);
  }
  table.data tbody tr:hover { background: var(--surface); }
  table.data td { border: none; padding: 3px 0; display: flex; gap: 10px; align-items: baseline; }
  table.data td::before {
    content: attr(data-label); flex: none; width: 40%; max-width: 140px;
    font-size: 12px; font-weight: 600; color: var(--text-faint);
  }
  table.data td > .cell { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  table.data td .tag { white-space: normal; }
  table.data td.is-blank { display: none; }
  table.data td[data-label=""]::before { display: none; }
  table.data td.actions {
    width: auto; white-space: normal; padding-top: 12px; margin-top: 6px;
    border-top: 1px solid var(--border);
  }
  table.data td.actions > .cell { display: flex; gap: 8px; justify-content: flex-end; }
  table.data td.actions .btn { flex: 1; }
  table.data td.actions .icon-btn { width: 40px; height: 40px; }
  table.data td.actions .icon-btn .ic { width: 18px; height: 18px; }
  table.data td.num { justify-content: flex-start; text-align: left; }

  table.data.eq-list { table-layout: auto; min-width: 0; }
  /* В карточке каждое поле — на всю ширину: доли колонок здесь ни к чему */
  table.data.eq-list .c-kind, table.data.eq-list .c-model, table.data.eq-list .c-area,
  table.data.eq-list .c-loc, table.data.eq-list .c-attr, table.data.eq-list .c-comp,
  table.data.eq-list .c-status, table.data.eq-list .c-due { width: auto; }
  table.data.eq-list td { height: auto; padding: 3px 0; max-width: none; }
  table.data.eq-list td .cell { white-space: normal; }
  .eq-search { flex: 1 1 100%; height: 40px; }
  .eq-filter-btn { flex: 1 1 auto; justify-content: center; }
  .eq-tools .spacer { display: none; }
  .eq-tools #eq-count { margin-left: auto; }
  .eq-chip { max-width: 100%; height: 32px; }

  /* Диалог — снизу во весь экран, как системный лист */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal, .modal.narrow, .modal.wide {
    width: 100%; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0;
  }
  .modal-head { padding: 18px 18px 6px; }
  .modal-body { padding: 10px 18px 18px; }
  .modal-foot { position: sticky; bottom: 0; padding: 14px 18px; }
  .modal-foot .btn { flex: 1; }

  .q-row { grid-template-columns: 1fr; gap: 9px; padding: 12px; }
  .q-value { width: 100%; }
  .q-value .q-input, .q-value select.q-input { flex: 1; width: auto; min-width: 0; }
  .q-row .state-pick { width: 100%; }
  .q-row .sp { flex: 1; height: 40px; padding: 0 6px; }
  .q-row .sp.na { flex: 0 0 58px; }
  .chk-foot {
    position: sticky; bottom: 0; margin: 0 -10px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    background: var(--bg); border-top: 1px solid var(--border);
  }
  .chk-foot .btn-lg { flex: 1; }
  .chk-foot .spacer { display: none; }

  .chart-legend { padding: 10px 12px 2px; gap: 6px 12px; }
  .chart-hero { gap: 16px; padding: 4px 12px 12px; }
  .chart-hero b { font-size: 19px; }
  .chart-tip { max-width: calc(100vw - 24px); }
  .check-measure { min-width: 0; }
  .check-measure td.ctext { font-weight: 600; font-size: 15px; padding-bottom: 8px; }
  .check-measure td.num { display: none; }
  .check-measure td input { width: 100%; }
  .check-measure td.mid input[type="checkbox"] { width: 24px; height: 24px; }
  .check-measure tr.done { border-color: var(--ok); }

  .section-track { width: 100%; }
  .section-btn { flex: 1 1 auto; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .qr-row { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .tabs { gap: 0; }
  .tab { padding: 10px 12px; font-size: 13.5px; }

  /* Лист обхода остаётся таблицей: две колонки помещаются, а карточка из
     подписанных полей растянула бы каждую единицу на пол-экрана. */
  .round-wrap { overflow: visible; }
  table.data.round-table { display: table; width: 100%; }
  table.data.round-table thead { display: none; }
  table.data.round-table tbody { display: table-row-group; }
  table.data.round-table tr { display: table-row; border: none; padding: 0; background: none; box-shadow: none; }
  table.data.round-table tr.round-row.ok { background: var(--ok-soft); }
  table.data.round-table tr.round-row.issue { background: var(--danger-soft); }
  table.data.round-table td { display: table-cell; width: auto; padding: 9px 10px; border-bottom: 1px solid var(--border); }
  table.data.round-table td::before { display: none; }
  table.data.round-table td.is-blank { display: table-cell; }
  table.data.round-table td.r-nm { width: 100%; }
  table.data.round-table td.r-act { width: 1%; white-space: nowrap; text-align: right; }
  .r-pos { font-size: 14.5px; }
  .round-table .sp { padding: 0 10px; height: 38px; font-size: 13px; min-width: 62px; }
  .round-table .state-pick { flex-direction: column; gap: 5px; }
  .round-table .r-note { min-width: 0; }

  /* Дерево склада не разворачиваем в карточки: без отступов оно теряет смысл.
     Таблица остаётся таблицей и прокручивается вбок. */
  .tree-wrap { overflow-x: auto; }
  table.data.stock-tree { display: table; min-width: 620px; }
  table.data.stock-tree thead { display: table-header-group; }
  table.data.stock-tree tbody { display: table-row-group; }
  table.data.stock-tree tfoot { display: table-footer-group; }
  table.data.stock-tree tr { display: table-row; border: none; padding: 0; background: none; box-shadow: none; }
  table.data.stock-tree td {
    display: table-cell; width: auto; padding: 7px 8px; font-size: 13px;
    border-bottom: 1px solid var(--border); vertical-align: middle;
  }
  table.data.stock-tree td::before { display: none; }
  table.data.stock-tree td.is-blank { display: table-cell; }
  table.data.stock-tree td.num { text-align: right; }
  table.data.stock-tree td.actions { position: static; width: 1%; white-space: nowrap; }
  table.data.stock-tree td.actions .btn { flex: none; height: 30px; padding: 0 10px; }
  table.data.stock-tree td.actions .icon-btn { width: 30px; height: 30px; }
  table.data.stock-tree td.actions .icon-btn .ic { width: 16px; height: 16px; }
  table.data.stock-tree td.nm { min-width: 230px; }
  table.data.stock-tree .pad { width: calc(var(--d) * 12px); }
  .seg { align-self: center; }
}
