/* Общие стили кабинета. Основа — прототип «AI AGENT DESIGN/prototypes/cabinet/styles.css» (дизайн-система
   «Свет — это сигнал», правила — DESIGN.md); правишь систему — правь и прототип. Шрифты — static/fonts, без CDN. */

/* ==========================================================================
   Кабинет автопарка — прототип дизайн-системы «Свет — это сигнал»
   Мир: Cyberpunk 2077. Тёмная тема — ночь (по умолчанию), светлая — песок.
   Жёлтый — «вы и действие», голубой — линии данных, оранжевый — внимание.
   Срезанный угол каждой панели — лампа свежести её источника.
   ========================================================================== */

@property --hl { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  --f-display: "Tektur", "Sofia Sans Condensed", "Segoe UI", sans-serif;
  --f-ui: "Sofia Sans", "Segoe UI", system-ui, sans-serif;
  --f-cond: "Sofia Sans Condensed", "Sofia Sans", "Segoe UI", sans-serif;
  /* Коды, даты, счётчики: тот же Sofia Sans, цифры ровной ширины (tabular-nums) — без точки в нуле (R41). */
  --f-mono: "Sofia Sans", "Segoe UI", system-ui, sans-serif;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  --rail-w: 268px;
  --rail-w-collapsed: 76px;
  --topbar-h: 60px;
  --gap: 16px;
  --pad: clamp(16px, 2.4vw, 36px);
}

/* ---------- Тёмная: ночь ---------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080B11;
  --bg-grid: rgba(70, 150, 220, .055);
  --bg-glow: rgba(54, 194, 255, .075);
  --rail: #0A0E15;
  --sheet: #0B0F16;
  --panel: #0E131C;
  --panel-2: #131A26;
  --line: #1D2737;
  --line-2: #2C3B51;
  --ink: #EDF0F5;
  --ink-2: #AAB4C5;
  --ink-3: #808CA1;
  --signal: #FCEE0A;
  --on-signal: #0A0B0E;
  --volt: #36C2FF;
  --volt-2: #2F6BFF;
  --on-volt-2: #FFFFFF;
  --heat: #FF8A2A;
  --focus: #FCEE0A;
  --sel: rgba(54, 194, 255, .13);
  --max-edge: #FCEE0A;
  --scrim: rgba(2, 4, 8, .62);
  --st-ok: #3EE495;
  --st-part: #F5C542;
  --st-stale: #FF8A2A;
  --st-err: #FF5468;
  --st-check: #8FA9FF;
  --st-none: #808CA1;
  --glow: 1;
  --lift: 0 18px 40px -22px rgba(0, 0, 0, .8);
}

/* ---------- Светлая: песок ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #E6DCC5;
  --bg-grid: rgba(110, 85, 35, .075);
  --bg-glow: rgba(255, 200, 90, .22);
  --rail: #DCD0B4;
  --sheet: #F9F4EA;
  --panel: #F4EDDE;
  --panel-2: #ECE3CF;
  --line: #CEC0A1;
  --line-2: #AD9D7A;
  --ink: #15161B;
  --ink-2: #403E37;
  --ink-3: #5C5646;
  --signal: #F7E000;
  --on-signal: #121212;
  --volt: #0A54BE;
  --volt-2: #1D4ED8;
  --on-volt-2: #FFFFFF;
  --heat: #A84400;
  --focus: #0A54BE;
  --sel: rgba(10, 95, 208, .11);
  --max-edge: #15161B;
  --scrim: rgba(45, 34, 12, .38);
  --st-ok: #17784B;
  --st-part: #8A6400;
  --st-stale: #A84400;
  --st-err: #C21F38;
  --st-check: #3A50C9;
  --st-none: #5C5646;
  --glow: 0;
  --lift: 0 16px 30px -20px rgba(70, 50, 15, .5);
}

[data-st="ok"]     { --st: var(--st-ok); }
[data-st="part"]   { --st: var(--st-part); }
[data-st="stale"]  { --st: var(--st-stale); }
[data-st="err"]    { --st: var(--st-err); }
[data-st="check"]  { --st: var(--st-check); }
[data-st="none"]   { --st: var(--st-none); }
[data-st="signal"] { --st: var(--signal); }

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font: 400 15px/1.45 var(--f-ui);
  color: var(--ink);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Сетка и подсветка фона — отдельный неподвижный слой. Не background-attachment: fixed:
   он заставляет браузер перерисовывать весь экран со свечением на каждом кадре прокрутки
   (замер 11.10.2026: ~18–49 кадров/с вместо 60). */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1100px 520px at 78% -8%, var(--bg-glow), transparent 62%),
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
}
::selection { background: var(--signal); color: var(--on-signal); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input { caret-color: var(--signal); }
:root[data-theme="light"] input { caret-color: var(--volt); }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: .9em; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 200; padding: 10px 14px;
  background: var(--signal); color: var(--on-signal); font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ==========================================================================
   Панель со срезанным углом: рамка (::before) + заливка (::after).
   Блик по рамке за курсором — через --mx/--my и --hl.
   ========================================================================== */
.panel {
  --cut: 18px;
  --cut-s: 8px;
  --edge: var(--line);
  --fill: var(--panel);
  --surface: var(--panel);
  --hot: var(--volt);
  position: relative;
  isolation: isolate;
  transition: --hl .35s var(--ease-out), filter .3s var(--ease-out);
}
.panel::before,
.panel::after { content: ""; position: absolute; pointer-events: none; }
.panel::before {
  inset: 0;
  z-index: -2;
  background: var(--edge);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%,
                     var(--cut-s) 100%, 0 calc(100% - var(--cut-s)));
}
.panel::after {
  inset: 1px;
  z-index: -1;
  background: var(--fill);
  clip-path: polygon(0 0, calc(100% - var(--cut) + .59px) 0, 100% calc(var(--cut) - .59px), 100% 100%,
                     calc(var(--cut-s) - .59px) 100%, 0 calc(100% - var(--cut-s) + .59px));
}
.panel.is-link { cursor: pointer; }
.panel.is-link:hover,
.panel.is-link:focus-within { --hl: 1; }
.panel.is-link:hover::before {
  background:
    radial-gradient(260px circle at var(--mx, 50%) var(--my, -300px),
      color-mix(in srgb, var(--hot) calc(var(--hl) * 100%), transparent), transparent 70%),
    var(--edge);
}
.panel.is-link:hover::after {
  background:
    radial-gradient(420px circle at var(--mx, 50%) var(--my, -300px),
      color-mix(in srgb, var(--hot) calc(var(--hl) * 7%), transparent), transparent 70%),
    var(--fill);
}

/* Лампа в срезе угла: цвет — статус источника */
.notch {
  position: absolute; top: 0; right: 0;
  width: var(--cut); height: var(--cut);
  background: linear-gradient(to top right, transparent 62%, var(--st, var(--line-2)) 62%);
  filter: drop-shadow(0 0 calc(var(--glow) * 5px) var(--st, transparent));
  pointer-events: none;
  transition: filter .3s var(--ease-out);
}
.panel.is-link:hover .notch { filter: drop-shadow(0 0 calc(var(--glow) * 10px) var(--st, transparent)); }

/* Внимание: панель светится цветом статуса, сверху — полоса-предупреждение */
.panel.is-alert {
  --edge: color-mix(in srgb, var(--st) 60%, var(--line));
  --fill: color-mix(in srgb, var(--st) 5%, var(--panel));
  --hot: var(--st);
  filter: drop-shadow(0 0 calc(var(--glow) * 16px) color-mix(in srgb, var(--st) 26%, transparent));
}
:root[data-theme="light"] .panel.is-alert { --edge: var(--st); }
:root[data-theme="light"] .panel.is-alert[data-st="signal"] { --edge: var(--ink); }
.panel.is-alert::after {
  background:
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--st) 38%, transparent) 0 4px, transparent 4px 9px) top / 100% 5px no-repeat,
    var(--fill);
}
.panel.is-alert.is-link:hover::after {
  background:
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--st) 38%, transparent) 0 4px, transparent 4px 9px) top / 100% 5px no-repeat,
    radial-gradient(420px circle at var(--mx, 50%) var(--my, -300px),
      color-mix(in srgb, var(--hot) calc(var(--hl) * 9%), transparent), transparent 70%),
    var(--fill);
}

/* Уголки HUD (досье) */
.hud {
  --b: var(--volt);
  --l: 18px;
  --w: 2px;
  position: absolute; inset: -6px; pointer-events: none; z-index: 1;
  background:
    linear-gradient(var(--b) 0 0) top left / var(--l) var(--w),
    linear-gradient(var(--b) 0 0) top left / var(--w) var(--l),
    linear-gradient(var(--b) 0 0) top right / var(--l) var(--w),
    linear-gradient(var(--b) 0 0) top right / var(--w) var(--l),
    linear-gradient(var(--b) 0 0) bottom left / var(--l) var(--w),
    linear-gradient(var(--b) 0 0) bottom left / var(--w) var(--l),
    linear-gradient(var(--b) 0 0) bottom right / var(--l) var(--w),
    linear-gradient(var(--b) 0 0) bottom right / var(--w) var(--l);
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 calc(var(--glow) * 6px) var(--b));
}
.hud[data-st] { --b: var(--st); }

/* ==========================================================================
   Кнопки, плашки, переключатели
   ========================================================================== */
.btn {
  --cut: 9px;
  --btn-edge: var(--line-2);
  --btn-fill: var(--panel);
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 0; background: none; cursor: pointer;
  color: var(--ink); text-decoration: none; white-space: nowrap;
  font: 600 14.5px/1 var(--f-ui); letter-spacing: .01em;
  transition: transform .12s var(--ease-out), filter .2s var(--ease-out), color .15s;
}
.btn::before, .btn::after { content: ""; position: absolute; z-index: -1; transition: background-color .15s; }
.btn::before {
  inset: 0; z-index: -2; background: var(--btn-edge);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
}
.btn::after {
  inset: 1px; background: var(--btn-fill);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut) + .59px), calc(100% - var(--cut) + .59px) 100%, 0 100%);
}
.btn .i { width: 17px; height: 17px; }
.btn:hover { --btn-edge: var(--volt); }
.btn:active { transform: translateY(1px); }
/* Главная кнопка: заливка на самом элементе; срез угла продлён наружу, чтобы свечение и фокус не обрезались */
.btn-primary {
  --btn-fill: var(--signal);
  color: var(--on-signal); font-weight: 700;
  background-color: var(--btn-fill);
  clip-path: polygon(-30px -30px, calc(100% + 30px) -30px, calc(100% + 30px) calc(100% - var(--cut) - 30px),
                     calc(100% - var(--cut) - 30px) calc(100% + 30px), -30px calc(100% + 30px));
  transition: transform .12s var(--ease-out), filter .2s var(--ease-out), background-color .15s;
}
.btn-primary::before, .btn-primary::after { display: none; }
.btn-primary:hover {
  --btn-edge: var(--signal);
  --btn-fill: color-mix(in srgb, var(--signal) 82%, #fff);
  filter: drop-shadow(0 0 calc(var(--glow) * 14px) color-mix(in srgb, var(--signal) 50%, transparent));
}
:root[data-theme="light"] .btn-primary {
  box-shadow: inset 0 0 0 1px var(--ink);
  background-image: linear-gradient(315deg, transparent calc(var(--cut) * .7071 - 1.2px), var(--ink) calc(var(--cut) * .7071 - 1.2px),
                                    var(--ink) calc(var(--cut) * .7071), transparent calc(var(--cut) * .7071));
}
:root[data-theme="light"] .btn-primary:hover { --btn-fill: #FFEA3D; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; --cut: 7px; }
/* Кнопка только со значком (Р198, «Сохранить в архив»): квадрат в рамке .btn, подпись — в aria-label и title */
.btn-icon { width: 40px; padding: 0; flex: none; }
.btn-sm.btn-icon { width: 32px; }

.btn-group { display: inline-flex; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn:first-child::before { clip-path: none; }
.btn-group .btn:first-child::after { clip-path: none; }

.icon-btn {
  width: 36px; height: 36px; flex: none;
  display: inline-grid; place-items: center;
  border: 0; background: none; color: var(--ink-2); cursor: pointer;
  transition: color .15s, background-color .15s;
}
.icon-btn:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }

/* Без data-st — серая; со статусом цвет даёт [data-st] (у .chip нулевой вес, иначе он перебивает статус). */
:where(.chip:not([data-st])) { --st: var(--ink-3); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px 0 8px;
  color: var(--st); text-decoration: none; white-space: nowrap;
  font: 600 13px/1 var(--f-ui);
  background: color-mix(in srgb, var(--st) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st) 42%, transparent);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
}
.chip .i { width: 14px; height: 14px; stroke-width: 2; }
.chip b { font-weight: 700; color: var(--ink); letter-spacing: .02em; }
a.chip:hover { background: color-mix(in srgb, var(--st) 20%, transparent); }
.chip-sm { height: 22px; padding: 0 8px 0 6px; font-size: 12px; gap: 5px; }
.chip-sm .i { width: 13px; height: 13px; }

.firm {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  font: 700 12px/1 var(--f-cond); letter-spacing: .12em;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
}
.firm-head { background: var(--signal); color: var(--on-signal); }
.firm-hdlg { background: var(--volt-2); color: var(--on-volt-2); }

.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.seg > button {
  height: 34px; padding: 0 14px;
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  color: var(--ink-2); font: 600 14px/1 var(--f-ui);
  transition: color .15s, background-color .15s, box-shadow .15s;
}
.seg > button:hover { color: var(--ink); }
.seg > button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--sel);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--volt) 62%, transparent);
}
.seg-xs > button { height: 28px; padding: 0 9px; font: 600 12px/1 var(--f-cond); letter-spacing: .08em; }

.label {
  font: 600 12px/1.1 var(--f-cond);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3);
}
.src {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 12px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); white-space: nowrap;
}
.src .i { width: 13px; height: 13px; }
.src[data-st] { color: var(--st); }
.num {
  font: 600 40px/1 var(--f-display);
  letter-spacing: -.01em;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.unit { font: 500 15px/1 var(--f-ui); color: var(--ink-3); }
.card-action {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--volt); text-decoration: none;
  font: 700 14px/1 var(--f-ui);
}
button.card-action { padding: 0; border: 0; background: none; cursor: pointer; align-self: flex-start; }
.card-action .i { width: 16px; height: 16px; transition: transform .2s var(--ease-out); }
.panel.is-link .card-action::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.panel.is-link:hover .card-action .i { transform: translateX(3px); }
.over { position: relative; z-index: 3; }
.text-link { color: var(--volt); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
button.text-link { padding: 0; border: 0; background: none; cursor: pointer; }

/* ==========================================================================
   Каркас: меню слева + рабочая область
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns .28s var(--ease-out);
}

.rail {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 14px 12px;
  background: var(--rail);
  border-right: 1px solid var(--line);
  z-index: 40;
  min-width: 0;
}
.rail::after {
  content: ""; position: absolute; top: 0; right: -1px; width: 1px; height: 100%;
  background: linear-gradient(transparent 4%, var(--volt) 30%, transparent 62%);
  opacity: calc(var(--glow) * .55); pointer-events: none;
}

.rail-head { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; flex: none; overflow: visible; }
.bm-plate { fill: var(--signal); }
.bm-slash { fill: var(--on-signal); }
:root[data-theme="light"] .bm-plate { stroke: var(--ink); stroke-width: 1.2; }
.brand:hover .brand-mark { animation: glitch .42s steps(2, end); }
.brand-text { min-width: 0; }
.brand-text b { display: block; font: 600 16px/1.1 var(--f-display); font-stretch: 80%; white-space: nowrap; }
.rail-collapse { width: 32px; height: 32px; margin-right: -4px; }
.brand-text small { display: block; margin-top: 3px; font: 500 11.5px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); white-space: nowrap; }

.firm-switch { display: flex; }
.firm-switch > button { height: 30px; flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 8px; font: 700 12.5px/1 var(--f-cond); letter-spacing: .1em; }
.firm-dot { width: 8px; height: 8px; flex: none; transform: rotate(45deg); background: var(--fc); }
.firm-dot.both { background: linear-gradient(90deg, var(--signal) 50%, var(--volt-2) 50%); }

.search-btn {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px 0 12px;
  border: 0; cursor: pointer; text-align: left;
  color: var(--ink-3); background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  font: 500 14px/1 var(--f-ui);
  transition: box-shadow .15s, color .15s;
}
.search-btn:hover { color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.search-btn .search-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd {
  font: 500 11px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3);
  padding: 4px 5px; box-shadow: inset 0 0 0 1px var(--line-2); white-space: nowrap;
}

.rail-nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; margin: 0 -14px; padding: 2px 14px 8px; }
/* Список длиннее экрана: края затухают, флаги скрытых пунктов поднимаются на заголовок группы */
.rail-nav.more-below { -webkit-mask: linear-gradient(#000 calc(100% - 44px), transparent); mask: linear-gradient(#000 calc(100% - 44px), transparent); }
.rail-nav.more-above { -webkit-mask: linear-gradient(transparent, #000 36px); mask: linear-gradient(transparent, #000 36px); }
.rail-nav.more-above.more-below { -webkit-mask: linear-gradient(transparent, #000 36px, #000 calc(100% - 44px), transparent); mask: linear-gradient(transparent, #000 36px, #000 calc(100% - 44px), transparent); }
.group-flag { display: inline-flex; color: var(--st); }
.nav-group-head .group-flag .i { width: 14px; height: 14px; stroke-width: 2.2; transform: none !important; }
.nav-group-head[aria-expanded="false"] .group-flag { display: inline-flex !important; }
.nav-group { margin-top: 6px; }
.nav-group-head {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 30px;
  padding: 0 6px 0 12px; border: 0; background: none; cursor: pointer;
  color: var(--ink-3); font: 600 12px/1 var(--f-cond); letter-spacing: .14em; text-transform: uppercase;
}
.nav-group-head::after { content: ""; flex: 1; height: 1px; background: var(--line); order: 1; }
.nav-group-head .i { order: 2; width: 15px; height: 15px; transition: transform .22s var(--ease-out); }
.nav-group-head:hover { color: var(--ink-2); }
.nav-group-head[aria-expanded="false"] .i { transform: rotate(-90deg); }
.nav-list { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .28s var(--ease-out); }
.nav-group-head[aria-expanded="false"] + .nav-list { grid-template-rows: 0fr; }
.nav-list > ul { min-height: 0; overflow: hidden; list-style: none; margin: 0; padding: 2px 0 0; display: grid; gap: 2px; }

.nav-item {
  --cut: 10px;
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 35px; padding: 0 10px 0 12px;
  color: var(--ink-2); text-decoration: none; white-space: nowrap;
  font: 500 15px/1 var(--f-ui);
  transition: color .15s, background-color .15s;
}
.nav-item .i { width: 19px; height: 19px; }
.nav-item:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav-item:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.nav-item[aria-current="page"] {
  color: var(--on-signal); background: var(--signal); font-weight: 700;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
}
:root[data-theme="light"] .nav-item[aria-current="page"] { box-shadow: inset 0 0 0 1px var(--ink); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-meta { margin-left: auto; display: inline-flex; align-items: center; }
.nav-badge { font: 500 12px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); }
.nav-flag { color: var(--st); }
.nav-flag .i { width: 17px; height: 17px; stroke-width: 2; }
.nav-count {
  min-width: 22px; height: 20px; padding: 0 6px;
  display: inline-grid; place-items: center;
  font: 700 12px/1 var(--f-mono); font-variant-numeric: tabular-nums;
  background: var(--signal); color: var(--on-signal);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%);
}
.nav-item[aria-current="page"] .nav-badge,
.nav-item[aria-current="page"] .nav-flag { color: var(--on-signal); }
.nav-item[aria-current="page"] .nav-count { background: var(--on-signal); color: var(--signal); }

.rail-foot { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 6px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.avatar {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  font: 700 13px/1 var(--f-display); letter-spacing: .04em;
  color: var(--ink); background: color-mix(in srgb, var(--volt-2) 26%, var(--panel-2));
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}
.me-text { flex: 1; min-width: 0; }
.me-text b { display: block; font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.me-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 9px;
  height: 34px; padding: 0 10px 0 4px;
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  color: var(--ink-2); font: 600 13.5px/1 var(--f-ui);
}
.theme-toggle:hover { color: var(--ink); }
.tt-track {
  position: relative; width: 46px; height: 26px; flex: none;
  background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
}
.tt-thumb {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  display: grid; place-items: center;
  background: var(--signal); color: var(--on-signal);
  transition: transform .32s var(--ease-out);
}
.tt-thumb .i { width: 13px; height: 13px; stroke-width: 2.2; }
.tt-thumb .sun { display: none; }
:root[data-theme="light"] .tt-thumb { transform: translateX(20px); background: var(--ink); color: var(--signal); }
:root[data-theme="light"] .tt-thumb .sun { display: block; }
:root[data-theme="light"] .tt-thumb .moon { display: none; }

/* ---------- Меню свёрнуто в узкую полосу ---------- */
@media (min-width: 961px) {
  :root[data-rail="collapsed"] .app { grid-template-columns: var(--rail-w-collapsed) minmax(0, 1fr); }
  :root[data-rail="collapsed"] .rail { padding-inline: 12px; align-items: stretch; }
  :root[data-rail="collapsed"] .rail-head { flex-direction: column; gap: 10px; }
  :root[data-rail="collapsed"] .brand { justify-content: center; flex: none; }
  :root[data-rail="collapsed"] .brand-text,
  :root[data-rail="collapsed"] .search-label,
  :root[data-rail="collapsed"] kbd,
  :root[data-rail="collapsed"] .nav-label,
  :root[data-rail="collapsed"] .nav-badge,
  :root[data-rail="collapsed"] .nav-group-head .i,
  :root[data-rail="collapsed"] .me-text,
  :root[data-rail="collapsed"] .lang,
  :root[data-rail="collapsed"] .tt-label { display: none; }
  :root[data-rail="collapsed"] .rail-collapse .i { transform: rotate(180deg); }
  :root[data-rail="collapsed"] .firm-switch { flex-direction: column; }
  :root[data-rail="collapsed"] .firm-switch > button { height: 32px; padding: 0; gap: 5px; font-size: 11px; letter-spacing: .04em; }
  :root[data-rail="collapsed"] .firm-switch > button[aria-pressed="false"] { display: none; }
  :root[data-rail="collapsed"] .group-flag { display: none !important; }
  :root[data-rail="collapsed"] .rail { gap: 10px; }
  :root[data-rail="collapsed"] .nav-group { margin-top: 8px; }
  :root[data-rail="collapsed"] .nav-item { height: 38px; }
  :root[data-rail="collapsed"] .avatar { display: none; }
  :root[data-rail="collapsed"] .search-btn { justify-content: center; padding: 0; }
  :root[data-rail="collapsed"] .nav-group-head { padding: 0; height: 10px; font-size: 0; pointer-events: none; }
  :root[data-rail="collapsed"] .nav-group-head + .nav-list { grid-template-rows: 1fr; }
  :root[data-rail="collapsed"] .nav-item { justify-content: center; padding: 0; gap: 0; }
  :root[data-rail="collapsed"] .nav-meta { position: absolute; top: 4px; right: 4px; }
  :root[data-rail="collapsed"] .nav-count { min-width: 17px; height: 16px; padding: 0 3px; font-size: 11px; }
  :root[data-rail="collapsed"] .nav-flag .i { width: 12px; height: 12px; }
  :root[data-rail="collapsed"] .me { flex-direction: column; padding: 8px 0; gap: 6px; }
  :root[data-rail="collapsed"] .me-tools { justify-content: center; }
  :root[data-rail="collapsed"] .theme-toggle { padding: 0; }
}
.rail-collapse .i { transition: transform .28s var(--ease-out); }

.tip {
  position: fixed; z-index: 120; pointer-events: none;
  padding: 7px 10px; font: 600 13px/1.2 var(--f-ui);
  color: var(--ink); background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line-2), var(--lift);
  white-space: nowrap;
}

/* ---------- Верхняя полоса ---------- */
/* Рабочий лист (владелец, 26.10.2026, «текст не на клетке»): ниже шапки экрана — сплошной лист --sheet, клетка —
   только полосой шапки (.page-head::before). --surface — фон, на котором лежит элемент: лист или карточка; закреплённые
   колонки таблиц берут его, чтобы совпасть с тем, что под ними. */
.main { min-width: 0; display: flex; flex-direction: column; background: var(--sheet); --surface: var(--sheet); overflow-x: clip; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h); padding: 0 var(--pad);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.burger { display: none; margin-left: -8px; }
.crumbs ol { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; min-width: 0; }
.crumbs li { display: flex; align-items: center; gap: 8px; white-space: nowrap; font: 500 14.5px/1 var(--f-ui); color: var(--ink-3); }
.crumbs li + li::before { content: "/"; color: var(--line-2); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.topbar-ctx {
  display: flex; align-items: center; gap: 10px; margin-left: auto;
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity .2s var(--ease-out), transform .2s var(--ease-out);
}
.topbar[data-stuck] .topbar-ctx { opacity: 1; transform: none; pointer-events: auto; }
.topbar-ctx .btn { height: 34px; padding: 0 12px; font-size: 13.5px; --cut: 7px; }
.sync { display: inline-flex; align-items: center; gap: 8px; margin-left: 4px; font: 500 12.5px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); white-space: nowrap; }
.topbar:not([data-stuck]) .proto-tag { margin-left: auto; }
.proto-tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px; white-space: nowrap;
  font: 600 12px/1 var(--f-cond); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
}
.sync-dot { width: 8px; height: 8px; transform: rotate(45deg); background: var(--st-ok); box-shadow: 0 0 calc(var(--glow) * 8px) var(--st-ok); }

/* ---------- Рабочая область ---------- */
.view { container: view / inline-size; padding: 30px var(--pad) 72px; width: 100%; max-width: 1520px; outline: none; }

.page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px 32px; margin-bottom: 40px; position: relative; isolation: isolate; }
/* Полоса шапки: фон и клетка мира, к низу клетка гаснет — пояснение под заголовком ложится на ровный тон. Неподвижна
   вместе со страницей, не анимируется (DESIGN.md «Don't»). Вправо — до края окна (лишнее срезает .main). */
.view > .page-head::before, .view > :first-child > .page-head:first-child::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  top: -30px; bottom: -18px; left: calc(-1 * var(--pad)); right: -100vw;
  background: linear-gradient(var(--bg-grid) 1px, transparent 1px) 0 0 / 32px 32px,
              linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px) 0 0 / 32px 32px;
  -webkit-mask-image: linear-gradient(#000 0 110px, transparent 230px);
          mask-image: linear-gradient(#000 0 110px, transparent 230px);
}
.view > .page-head::after, .view > :first-child > .page-head:first-child::after {
  content: ""; position: absolute; z-index: -2; pointer-events: none;
  top: -30px; bottom: -18px; left: calc(-1 * var(--pad)); right: -100vw;
  background: var(--bg); box-shadow: 0 1px 0 var(--line);
}
.page-head > .page-meta { grid-column: 1 / -1; margin: 0; }
.page-title { min-width: 0; }
.page-head h1, .page-title h1 {
  margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  font: 600 clamp(28px, 2.5vw, 38px)/1.08 var(--f-display); letter-spacing: -.01em;
  text-wrap: balance;
}
.h-kind { color: var(--ink-3); font-weight: 500; }
.page-title h1 .h-tags { display: inline-flex; gap: 8px; align-items: center; }
.page-meta { margin: 12px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; color: var(--ink-2); font-size: 14.5px; }
.page-meta .sep { color: var(--ink-3); }
.page-meta .meta-num { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }

.meta-row { margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.meta-row > div { display: flex; align-items: baseline; gap: 8px; }
.meta-row dt { font: 600 12px/1 var(--f-cond); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.meta-row dd { margin: 0; font: 500 14px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink); }

.block { margin-top: 40px; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 14px; }
.block-head h2 { margin: 0; font: 600 20px/1.2 var(--f-display); }
.block-head h2 > .count { margin-left: 10px; }
.count { font: 600 13px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); }
.block-note { font: 500 13px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); }
.block-tools { margin-left: auto; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.link-more { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--volt); font: 600 14px/1 var(--f-ui); text-decoration: none; }
.link-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-more .i { width: 16px; height: 16px; }

/* ---------- Главная: внимание ---------- */
.alerts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.alert { display: flex; flex-direction: column; gap: 8px; padding: 20px 18px 16px; min-height: 184px; }
.alert-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.stamp { font: 500 12px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); white-space: nowrap; }
.alert h3 { margin: 6px 0 0; font: 600 18px/1.32 var(--f-display); }
.alert p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.alert .card-action { margin-top: auto; padding-top: 6px; }

/* ---------- Главная: модули ---------- */
.modules { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: dense; gap: var(--gap); }
.module { display: flex; flex-direction: column; gap: 14px; padding: 20px; min-height: 222px; }
.module-feature { grid-column: span 2; grid-row: span 2; padding: 24px; gap: 18px; }
/* Последние отчёты — список, а не показатель: на всю ширину под модулями (в 3 колонки — рядом с последним модулем). */
.module-wide { grid-column: 1 / -1; min-height: 0; }
.module-feature > .mod-foot { margin-top: auto; }
.mod-head { display: flex; align-items: center; gap: 12px; }
/* Переход в раздел — стрелка в углу: вся карточка и так ссылка (.card-action растянут на панель). */
.mod-go { margin-left: auto; align-self: flex-start; padding: 4px 2px; }
.mod-go .i { width: 18px; height: 18px; }
.mod-icon {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  color: var(--volt); background: color-mix(in srgb, var(--volt) 13%, transparent);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}
.mod-icon .i { width: 20px; height: 20px; }
.mod-head h3 { margin: 0; font: 600 18px/1.15 var(--f-display); }
.mod-val { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: auto; }
.mod-meta { margin: 0; font-size: 14px; color: var(--ink-2); }
.mod-meta b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.mod-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.feature-figs { display: flex; flex-wrap: wrap; gap: 12px 44px; align-items: flex-end; margin-top: 6px; }
.feature-figs .fig { display: flex; align-items: baseline; gap: 10px; }
.module-feature .num { font-size: 64px; }
.fleet { display: grid; gap: 10px; }
.fleet-bar { display: flex; gap: 3px; height: 12px; }
.fleet-bar span { min-width: 6px; background: var(--c); transition: flex-grow .6s var(--ease-out); }
.fleet-bar span:last-child { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%); }
.fleet-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--ink-2); }
/* Строка фирмы — текстом, а не flex: в узкой карточке переносится между парами «слово число», а не отрывает число. */
.fleet-legend li { display: block; line-height: 1.75; }
.fleet-legend .firm { margin-right: 7px; vertical-align: 1px; }
.fleet-legend .pair { white-space: nowrap; }
.fleet-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sw { width: 11px; height: 11px; background: var(--c); transform: skewX(-18deg); }
.c-run { --c: var(--volt); }
.c-fix { --c: var(--heat); }
.c-idle { --c: var(--st-none); }

.watch { margin: 0; padding: 0; list-style: none; display: grid; }
.watch li { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.watch li:last-child { border-bottom: 1px solid var(--line); }
.watch .code { font: 600 13.5px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.watch .what { color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch .more { color: var(--ink-3); font-size: 13.5px; }
.watch-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }

.recent { margin: 0; padding: 0; list-style: none; display: grid; }
.recent li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.recent .r-name { font-weight: 600; color: var(--ink); text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .r-name:hover { color: var(--volt); }
.recent .r-when { font: 500 12.5px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); white-space: nowrap; }
.recent .r-files { display: inline-flex; gap: 6px; }
.file-tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px;
  font: 600 12px/1 var(--f-cond); letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-2); text-decoration: none; box-shadow: inset 0 0 0 1px var(--line-2);
}
.file-tag:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--volt); }


/* ---------- Досье ---------- */
.period { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; min-width: 0; }
.period .seg .i { width: 15px; height: 15px; margin: -2px 7px 0 0; vertical-align: middle; }
.period-line { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.period-line .mono { font: 600 16px/1.2 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.period-days { font-size: 14px; color: var(--ink-3); }
.cmp-note { margin-left: auto; font: 500 12px/1.3 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); }

.hero {
  --cut: 24px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  margin: 8px 6px 0;
}
.hero-side {
  grid-row: 1 / 4;
  writing-mode: vertical-rl; transform: rotate(180deg);
  display: flex; align-items: center; justify-content: center;
  font: 600 11.5px/1 var(--f-cond); letter-spacing: .32em; text-transform: uppercase;
  color: var(--ink-3); border-left: 1px solid var(--line);
  user-select: none;
}
.hero-id {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 10px 40px;
  grid-template-areas: "title facts" "chips facts";
  padding: 24px 24px 20px; border-bottom: 1px solid var(--line); min-width: 0;
}
.hero-id > .hero-title { grid-area: title; align-self: end; }
.hero-id > .hero-chips { grid-area: chips; }
.hero-id > .hero-facts { grid-area: facts; margin: 0; align-self: center; }
.hero-title { margin: 0; font: 700 clamp(36px, 3.4vw, 50px)/1.1 var(--f-display); letter-spacing: -.01em; text-wrap: balance; }
/* Размеры в герое заданы явно (.44 и .5 от clamp заголовка), а не в em — так их видит и проверка дизайна. */
.hero-title .h-kind { display: block; font-size: clamp(16px, 1.5vw, 22px); letter-spacing: .02em; margin-bottom: 6px; }
.hero-title .make { font-size: clamp(18px, 1.7vw, 25px); }
/* Марка (производитель из ERP: DAF, MAN, VOLVO; у прицепов SCHMITZ, KRONE) — рядом с номером, тише его. */
.make { margin-left: .2em; font-size: .5em; font-weight: 600; letter-spacing: .08em; color: var(--ink-2); white-space: nowrap; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-facts { margin: auto 0 0; display: grid; gap: 8px; }
.hero-facts > div { display: flex; justify-content: space-between; gap: 12px; }
.hero-facts dt { font-size: 14px; color: var(--ink-3); }
.hero-facts dd { margin: 0; font: 500 14px/1.4 var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; }
.hero-facts dd .stamp { display: block; margin-top: 3px; font-size: 11.5px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-width: 0; }
.kpi { display: flex; flex-direction: column; gap: 12px; padding: 24px 20px 18px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-val { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; }
.kpi .num { font-size: clamp(32px, 2.6vw, 42px); }
.kpi-main .num { color: var(--volt); text-shadow: 0 0 calc(var(--glow) * 24px) color-mix(in srgb, var(--volt) 55%, transparent); }
.delta { display: inline-flex; align-items: center; gap: 4px; font: 600 12.5px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.delta .i { width: 14px; height: 14px; }
.delta[data-st] { color: var(--st); }
.kpi .src { margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line); }
.kpi-note { margin: 0; font-size: 13px; color: var(--st, var(--ink-3)); }
.kpi-note .i { width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; stroke-width: 2.2; }
/* Показатель-ссылка (простои → поездки с простоем): кнопка растянута на весь показатель. */
.kpi-link { position: relative; transition: background-color .15s; }
.kpi-link:hover { background: var(--sel); }
.kpi-go { align-self: flex-start; margin-top: -4px; display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0;
  background: none; cursor: pointer; color: var(--volt); font: 700 13.5px/1.3 var(--f-ui); }
.kpi-go::after { content: ""; position: absolute; inset: 0; }
.kpi-go .i { width: 15px; height: 15px; transition: transform .2s var(--ease-out); }
.kpi-link:hover .kpi-go .i { transform: translateX(3px); }

.days-wrap { grid-column: 2; padding: 16px 22px 20px 24px; border-top: 1px solid var(--line); }
.days-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-bottom: 12px; }
.days-head h2 { margin: 0; font: 600 15px/1 var(--f-display); }
.legend { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-3); }
.legend .sw { width: 12px; height: 12px; transform: none; }
.legend .sw.idle { background: repeating-linear-gradient(135deg, var(--heat) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--heat); }
.legend .sw.max { background: none; box-shadow: inset 0 0 0 1.5px var(--max-edge); }
.days { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.day {
  --v: .5;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  min-height: 66px; padding: 9px 9px 8px;
  background: color-mix(in srgb, var(--volt) calc(5% + var(--v) * 32%), var(--panel-2));
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%);
}
.day .d { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; font: 500 11.5px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.day .c { font: 600 11px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); }
.day .k { font: 600 17px/1 var(--f-display); font-feature-settings: "tnum"; }
.day .k.is-word { font: 700 13px/1 var(--f-ui); }
.day.is-idle { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--heat) 32%, transparent) 0 5px, transparent 5px 10px), var(--panel-2); }
.day.is-idle .k { font: 700 13px/1 var(--f-ui); color: var(--heat); }
.day.is-max { box-shadow: inset 0 0 0 1.5px var(--max-edge); }
/* Лента дней тягача: «нет данных» и «ещё не пришли» без заливки, дыра — тоном внимания со значком и словом. */
.day.is-none { background: var(--panel-2); }
.day.is-none .k { color: var(--ink-2); }
.day.is-pending { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.day.is-pending .k { color: var(--ink-3); }
.day[data-st] { background: color-mix(in srgb, var(--st) 14%, var(--panel-2)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--st) 70%, transparent); }
.day[data-st] .k { display: inline-flex; align-items: center; gap: 4px; color: var(--st); }
.day[data-st] .k .i { flex: none; width: 13px; height: 13px; stroke-width: 2.2; }
.day[tabindex] { position: relative; cursor: help; }
.day[tabindex]:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.day .why {
  position: absolute; inset: 0; padding: 7px 8px; overflow: hidden;
  font: 600 11px/1.25 var(--f-ui); color: var(--ink); background: var(--panel);
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.day[tabindex]:focus .why { opacity: 1; }
.days-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -4px 0 12px; }
.legend[data-st] { color: var(--st); }
.legend .i { width: 13px; height: 13px; stroke-width: 2.2; }
.legend .sw.volt { background: color-mix(in srgb, var(--volt) 30%, var(--panel-2)); }
.legend .sw.none { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.legend .sw.pending { background: none; box-shadow: inset 0 0 0 1px var(--line); }
.legend[data-st] .sw { background: color-mix(in srgb, var(--st) 14%, var(--panel-2)); box-shadow: inset 0 0 0 1.5px var(--st); }
.days-gaps { margin-left: auto; }

.objects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-top: 24px; }
.obj { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.obj-head { display: flex; align-items: center; gap: 10px; }
.obj-head .mod-icon { width: 34px; height: 34px; }
.obj-head .mod-icon .i { width: 18px; height: 18px; }
.obj-head .chip { margin-left: auto; }
.obj-code { margin: 0; font: 700 32px/1 var(--f-display); }
.obj-code .unit { font-size: 16px; }
.facts { margin: 0; display: grid; }
.facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 8px 0; border-top: 1px dashed var(--line); }
.facts dt { font-size: 14px; color: var(--ink-3); white-space: nowrap; }
.facts dd { margin: 0; font-size: 14.5px; text-align: right; font-variant-numeric: tabular-nums; }
.facts dd.muted { color: var(--ink-3); }
.facts dd[data-st] { color: var(--st); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.facts dd[data-st] .i { width: 15px; height: 15px; stroke-width: 2.2; }
.facts .mono { font-size: 13.5px; }
.lock { display: inline-flex; color: var(--ink-3); margin-left: auto; }
.lock .i { width: 16px; height: 16px; }
.obj .card-action { margin-top: auto; }


/* Поездки */
.trips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.trip { display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 16px; min-height: 172px; }
.trip-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.route { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font: 600 21px/1.15 var(--f-display); }
.route .i { width: 18px; height: 18px; color: var(--volt); stroke-width: 2.2; }
/* Где и почему стоял — в самой поездке (вместо отдельной карточки «Простои»). */
.trip-why { margin: -4px 0 0; display: flex; align-items: center; gap: 7px; font-size: 13.5px; line-height: 1.35; color: var(--ink-2); }
.trip-why .i { width: 15px; height: 15px; flex: none; color: var(--heat); stroke-width: 2.2; }
.trip-why b { color: var(--ink); font-weight: 600; }
.trip-facts { margin: auto 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.trip-facts dt { font: 600 11.5px/1 var(--f-cond); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.trip-facts dd { margin: 6px 0 0; font: 500 14px/1 var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.trip-more { align-items: center; justify-content: center; text-align: center; gap: 6px; }
.trip-more .num { color: var(--volt); font-size: 46px; }
.trip-more p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.trip-more .card-action { margin-top: 6px; }

.table-panel { padding: 0; --cut: 18px; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
/* Таблица «Рабочего листа» (26.10.2026): шапка — лентой panel-2, строки — мягкие линии и еле заметная зебра. Цвет
   строки — переменная --row, её берут и закреплённые колонки (поверх --surface). */
.data-table th {
  padding: 14px 16px 12px; text-align: left; white-space: nowrap;
  font: 600 12px/1 var(--f-cond); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2);
  background: var(--panel-2); border-bottom: 1px solid var(--line-2);
}
.data-table tbody tr:nth-child(even) { --row: color-mix(in srgb, var(--ink-2) 4%, transparent); }
.data-table tbody tr:hover { --row: var(--sel); }
.data-table tbody td { background-image: linear-gradient(var(--row, transparent), var(--row, transparent)); }
.data-table th.r, .data-table td.r { text-align: right; }
.data-table th button {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
}
.data-table th button:hover { color: var(--ink); }
.data-table th button .i { width: 13px; height: 13px; opacity: .45; transition: transform .2s; }
.data-table th[aria-sort] button { color: var(--ink); }
.data-table th[aria-sort] button .i { opacity: 1; color: var(--volt); }
.data-table th[aria-sort="descending"] button .i { transform: rotate(180deg); }
.data-table td { padding: 11px 16px; border-bottom: 1px solid color-mix(in srgb, var(--ink-3) 24%, transparent); white-space: nowrap; color: var(--ink); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .mono { font-size: 13.5px; color: var(--ink-2); }
.data-table td.r { font-family: var(--f-mono); font-size: 14px; font-variant-numeric: tabular-nums; }
.data-table td.route-c { font-weight: 600; }
.data-table tfoot td { border-top: 1px solid var(--line-2); border-bottom: 0; font-weight: 700; padding-top: 13px; padding-bottom: 14px; }

/* Источники досье — одна полоса: норма тихая (значок и время), отклонение — словом цвета статуса. */
.src-strip-panel { --cut: 14px; }
.src-strip { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.src-strip li { display: grid; gap: 7px; align-content: start; min-width: 0; padding: 14px 16px 13px; }
.src-strip li + li { border-left: 1px solid var(--line); }
.s-name { display: flex; align-items: center; gap: 7px; min-width: 0; font: 700 14.5px/1.3 var(--f-ui); color: var(--ink); }
.s-name .i { width: 15px; height: 15px; flex: none; color: var(--st); stroke-width: 2.2; }
.s-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding-left: 22px; }
.s-meta b { font: 600 13px/1 var(--f-ui); color: var(--st); }

/* Заглушка раздела */
.soon { --cut: 26px; max-width: 760px; padding: 40px 40px 36px; margin-top: 12px; display: grid; gap: 16px; }
.soon-head { display: flex; align-items: center; gap: 16px; }
.soon .mod-icon { width: 48px; height: 48px; }
.soon .mod-icon .i { width: 24px; height: 24px; }
.soon h1 { margin: 0; font: 600 32px/1.1 var(--f-display); }
.soon .lead { margin: 0; font-size: 17px; color: var(--ink-2); max-width: 60ch; }
.soon p { margin: 0; color: var(--ink-3); max-width: 62ch; }
.soon .page-actions { margin-top: 8px; }

/* ---------- Поиск (Ctrl K) ---------- */
.palette { width: min(640px, calc(100vw - 32px)); max-width: none; margin: 12vh auto auto; padding: 0; border: 0; background: none; color: var(--ink); overflow: visible; }
.palette::backdrop { background: var(--scrim); }
.palette[open] { animation: pop .2s var(--ease-out); }
.palette-box { --cut: 20px; --edge: var(--line-2); filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .45)); }
.palette-field { position: relative; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.palette-field .i { position: absolute; left: 18px; color: var(--ink-3); width: 20px; height: 20px; }
.palette-field input { flex: 1; height: 58px; padding: 0 18px 0 50px; border: 0; background: none; outline: none; font: 500 17px/1 var(--f-ui); }
.palette-field input::placeholder { color: var(--ink-3); }
.palette-field kbd { margin-right: 14px; }
.palette ul { margin: 0; padding: 8px; list-style: none; max-height: min(52vh, 420px); overflow-y: auto; }
.palette li a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; color: var(--ink-2); text-decoration: none; font-size: 15px; }
.palette li a .i { color: var(--ink-3); }
.palette li a .hint { margin-left: auto; font: 500 12px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); }
.palette li a[aria-selected="true"] { color: var(--ink); background: var(--sel); box-shadow: inset 2px 0 0 var(--volt); }
.palette li a[aria-selected="true"] .i { color: var(--volt); }
.palette .empty { padding: 18px 14px; color: var(--ink-3); font-size: 14.5px; }

/* ---------- Уведомления ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 150; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
.toast { --cut: 12px; --edge: var(--line-2); display: flex; gap: 10px; align-items: flex-start; max-width: 380px; padding: 13px 16px 13px 14px; font-size: 14.5px; animation: toast-in .3s var(--ease-out); filter: drop-shadow(0 16px 26px rgba(0, 0, 0, .35)); pointer-events: auto; }
.toast .i { color: var(--volt); margin-top: 1px; }
.toast.out { animation: toast-out .2s ease-in forwards; }

/* ==========================================================================
   Движение. Фокус: скан-линия проходит экран, панели проявляются под ней,
   цифры «расшифровываются». Только прозрачность и сдвиг: их дорисовывает видеокарта,
   и они не тормозят даже без неё (удалённый рабочий стол). Замер 11.10.2026: обрезка
   clip-path, вспышка filter и View Transitions давали кадры по 50–150 мс.
   ========================================================================== */
.scanline {
  position: fixed; left: 0; right: 0; top: 0; z-index: 25; height: 2px;
  background: var(--volt);
  box-shadow: 0 0 calc(var(--glow) * 8px) var(--volt);
  opacity: 0; pointer-events: none; will-change: transform, opacity;
}
.scanline.run { animation: scan var(--scan-dur, 760ms) var(--ease-in-out) forwards; }
@keyframes scan {
  0%   { transform: translateY(var(--scan-from, 60px)); opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translateY(100vh); opacity: 0; }
}
.screen.is-entering [data-reveal].in { animation: reveal .5s var(--ease-out) backwards; animation-delay: var(--d, 0ms); }
@keyframes reveal { from { opacity: 0; transform: translateY(12px); } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@keyframes glitch {
  0%   { transform: translate(0); filter: none; }
  25%  { transform: translate(-2px, 1px); filter: drop-shadow(-2px 0 #FF2A6D) drop-shadow(2px 0 var(--volt)); }
  50%  { transform: translate(2px, -1px); filter: drop-shadow(2px 0 #FF2A6D) drop-shadow(-2px 0 var(--volt)); }
  75%  { transform: translate(-1px, 0); filter: drop-shadow(-1px 0 #FF2A6D); }
  100% { transform: translate(0); filter: none; }
}
.trips-body.swap { animation: swap .32s var(--ease-out); }
@keyframes swap { from { opacity: 0; transform: translateY(6px); } }


@media (prefers-reduced-motion: reduce) {
  .scanline { display: none; }
  .screen.is-entering [data-reveal].in { animation: fade .2s ease-out backwards !important; }
  .brand:hover .brand-mark { animation: none; }
  .app, .nav-list, .tt-thumb, .rail-collapse .i, .nav-group-head .i, .fleet-bar span { transition: none; }
}
@keyframes fade { from { opacity: 0; } }

/* ==========================================================================
   Ширины: рабочая область (container) и экран (media)
   ========================================================================== */
@container view (max-width: 1180px) {
  .modules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Техника — во всю ширину: цифры и парк слева, «стоят и в ремонте» справа; иначе 2×2 оставляет дыру в сетке. */
  .module-feature { grid-column: 1 / -1; grid-row: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; align-content: start; }
  .module-feature > .feature-watch { grid-column: 2; grid-row: 1 / span 3; }
  .module-feature > .mod-foot { grid-column: 1 / -1; }
  .module-wide { grid-column: span 2; }
}
@container view (max-width: 1000px) {
  .alerts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .src-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .src-strip li:nth-child(3n + 1) { border-left: 0; }
  .src-strip li:nth-child(n + 4) { border-top: 1px solid var(--line); }
}
@container view (max-width: 900px) {
  .objects { grid-template-columns: minmax(0, 1fr); }
  .trips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container view (max-width: 760px) {
  .alerts { grid-template-columns: minmax(0, 1fr); }
  .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-feature { display: flex; grid-row: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .days { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .hero-id { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "chips" "facts"; }
}
@container view (max-width: 560px) {
  .page-meta .sep { display: none; }
  .modules, .trips { grid-template-columns: minmax(0, 1fr); }
  .module-feature, .module-wide { grid-column: auto; }
  .module-feature .num { font-size: 52px; }
  .src-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .src-strip li:nth-child(3n + 1) { border-left: 1px solid var(--line); }
  .src-strip li:nth-child(odd) { border-left: 0; }
  .src-strip li:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .hero { grid-template-columns: minmax(0, 1fr); margin-inline: 4px; }
  .hero-side { display: none; }
  .days-wrap { grid-column: 1; padding-inline: 16px; }
  .day { padding: 8px 7px 7px; }
  .day .k { font-size: 15px; }
  .hero-id { padding: 20px 18px 18px; }
  .kpi { padding: 18px 16px 16px; }
  .kpi .num { font-size: 28px; }
  .watch li { grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; }
  .watch .what { white-space: normal; }
  .recent li { grid-template-columns: minmax(0, 1fr) auto; }
  .recent .r-name { white-space: normal; }
  .recent .r-files { grid-column: 1 / -1; }
  .soon { padding: 28px 22px 26px; }
}

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw);
    transform: translateX(-102%); visibility: hidden;
    transition: transform .3s var(--ease-out), visibility 0s .3s;
  }
  :root[data-drawer="open"] .rail { transform: none; visibility: visible; transition: transform .3s var(--ease-out); box-shadow: 30px 0 60px -30px rgba(0, 0, 0, .6); }
  .rail-collapse { display: none; }
  .scrim { position: fixed; inset: 0; z-index: 35; background: var(--scrim); animation: fade .2s ease-out; }
  .burger { display: inline-grid; }
  .sync-text { display: none; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .topbar-ctx { display: none; }
  .crumbs li:not(:last-child) { display: none; }
  .page-actions { width: 100%; }
  .page-actions > .btn-primary { flex: 1; }
  .page-head { grid-template-columns: minmax(0, 1fr); }
  .page-actions { justify-content: stretch; }
  .period, .period .seg { width: 100%; }
  .period .seg { display: grid; grid-template-columns: 1fr 1fr; }
  .period .seg > button { padding: 0 10px; }
  .proto-long { display: none; }
  .cmp-note { margin-left: 0; width: 100%; }
  .block-tools { margin-left: 0; width: 100%; }
  .toasts { left: 16px; right: 16px; bottom: 16px; justify-items: stretch; }
  .toast { max-width: none; }
}

/* ==========================================================================
   Кабинет (Django): чего нет в прототипе — фирмы без переключателя, формы, сообщения,
   таблицы старых экранов, вход без меню. Цвета — только токены выше.
   ========================================================================== */
.firm-static { cursor: default; }
.firm-pill {
  flex: 1; height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 8px;
  font: 700 12.5px/1 var(--f-cond); letter-spacing: .1em; color: var(--ink);
}
@media (min-width: 961px) {
  :root[data-rail="collapsed"] .firm-pill { height: 26px; padding: 0; gap: 5px; font-size: 11px; letter-spacing: .04em; }
}
/* Р163: кнопки фирм — клавиши. Включённая залита цветом фирмы и стоит на твёрдом бортике (тень без размытия),
   выключенная — вдавлена в полосу, текст и ромб гаснут. Анимируется только transform. */
.firm-toggle { margin: 0; gap: 6px; padding: 4px 4px 7px; }
.firm-toggle > button {
  --fc-on: var(--signal); --fc-ink: var(--on-signal);
  position: relative; height: 30px;
  color: var(--ink-3);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--ink) 14%, transparent), inset 0 0 0 1px var(--line);
  transition: transform .1s var(--ease-out), color .15s;
}
.firm-toggle > button.is-hdlg { --fc-on: var(--volt-2); --fc-ink: var(--on-volt-2); }
.firm-toggle > button[aria-pressed="false"] .firm-dot { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.firm-toggle > button[aria-pressed="false"]:hover { color: var(--ink); }
.firm-toggle > button[aria-pressed="true"] {
  color: var(--fc-ink); background: var(--fc-on);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--fc-on) 55%, #000), inset 0 1px 0 color-mix(in srgb, #fff 45%, transparent);
  transform: translateY(-2px);
}
.firm-toggle > button[aria-pressed="true"] .firm-dot { background: var(--fc-ink); }
.firm-toggle > button[aria-pressed="true"]:not([aria-disabled="true"]):active { transform: translateY(0); }
.firm-toggle > button[aria-disabled="true"] { cursor: default; }
.firm-toggle > button:focus-visible { outline: 2px solid var(--volt); outline-offset: 2px; }
@media (min-width: 961px) {
  /* Свёрнутое меню: обе клавиши видны столбиком, чтобы выключенную можно было вернуть. */
  :root[data-rail="collapsed"] .firm-toggle > button[aria-pressed="false"] { display: inline-flex; }
}
.nav-item.is-off { opacity: .5; cursor: not-allowed; }
.nav-item.is-off:hover { background: none; color: var(--ink-2); }
.logout-form { margin: 0; display: flex; }
.palette-hint { margin: 0; padding: 10px 18px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.palette li a .code { font: 500 12px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-3); }

/* ---------- Текст экранов ---------- */
.screen > h1, .view h1:not([class]) {
  margin: 0 0 14px; font: 600 clamp(28px, 2.5vw, 38px)/1.08 var(--f-display); letter-spacing: -.01em; text-wrap: balance;
}
.view h2:not([class]) { margin: 28px 0 12px; font: 600 20px/1.2 var(--f-display); }
.lead { max-width: 72ch; margin: 0 0 24px; font-size: 16px; color: var(--ink-2); }
.muted { color: var(--ink-3); font-size: 14px; }
.view a:not([class]) { color: var(--volt); text-underline-offset: 3px; }
.view a:not([class]):hover { text-decoration-thickness: 2px; }
code { font: 500 .88em/1.4 var(--f-mono); font-variant-numeric: tabular-nums; padding: 1px 6px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Формы ---------- */
label { display: block; margin: 0 0 7px; font: 600 12px/1.2 var(--f-cond); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="month"], input[type="number"],
input[type="search"], input:not([type]), select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 0; border-radius: 0; color: var(--ink); background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  font: 500 15px/1.3 var(--f-ui);
  transition: box-shadow .15s;
}
input[type="date"], input[type="month"] { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 14.5px; }
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator { filter: invert(.8); }
input:hover, select:hover, textarea:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
input[type="radio"], input[type="checkbox"] { width: 17px; height: 17px; margin: 0 8px 0 0; accent-color: var(--signal); flex: none; }
:root[data-theme="light"] input[type="radio"], :root[data-theme="light"] input[type="checkbox"] { accent-color: var(--volt); }
.field { margin: 0 0 18px; }
.errorlist { list-style: none; margin: 7px 0 0; padding: 0; color: var(--st-err); font-size: 14px; font-weight: 600; }
.errorlist.nonfield { margin: 0 0 16px; }

/* Кнопки без класса и старые primary/secondary — тот же вид, что .btn */
.view button:not([class]), .view button.primary, .view button.secondary, a.button {
  --cut: 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border: 0; cursor: pointer; white-space: nowrap; text-decoration: none;
  color: var(--ink); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-2);
  font: 600 14.5px/1 var(--f-ui);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
  transition: box-shadow .15s, transform .12s var(--ease-out), background-color .15s;
}
.view button:not([class]):hover, .view button.secondary:hover, a.button:hover { box-shadow: inset 0 0 0 1px var(--volt); }
.view button:active, a.button:active { transform: translateY(1px); }
.view button.primary, a.button.primary {
  color: var(--on-signal); background: var(--signal); box-shadow: none; font-weight: 700;
}
.view button.primary:hover { background: color-mix(in srgb, var(--signal) 82%, #fff); filter: drop-shadow(0 0 calc(var(--glow) * 12px) color-mix(in srgb, var(--signal) 45%, transparent)); }
:root[data-theme="light"] .view button.primary { box-shadow: inset 0 0 0 1px var(--ink); }

/* ---------- Сообщения ---------- */
.notice {
  --st: var(--volt);
  position: relative; margin: 0 0 16px; padding: 12px 16px 12px 18px;
  color: var(--ink-2); font-size: 14.5px;
  background: color-mix(in srgb, var(--st) 7%, var(--panel));
  box-shadow: inset 3px 0 0 var(--st), inset 0 0 0 1px color-mix(in srgb, var(--st) 30%, var(--line));
}
.notice strong { color: var(--ink); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice.warning { --st: var(--st-stale); }
.notice.error { --st: var(--st-err); }

/* ---------- Панель с содержимым и таблицы старых экранов ---------- */
.panel.pad, .analysis-block { padding: 24px; }
.view table:not([class]), table.plain { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.view table:not([class]) th, table.plain th {
  padding: 12px 14px 10px; text-align: left; white-space: nowrap;
  font: 600 12px/1 var(--f-cond); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
  border-bottom: 1px solid var(--line-2);
}
.view table:not([class]) td, table.plain td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.view table:not([class]) tbody tr:hover, table.plain tbody tr:hover { background: var(--sel); }

/* ---------- Вход: без меню, одна панель по центру ---------- */
.is-bare .bare { min-height: 100vh; display: flex; flex-direction: column; }
.bare-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px var(--pad); }
.bare-head .brand { flex: none; }
.is-bare .view { max-width: 468px; margin: 6vh auto 0; padding-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Вход, второй шаг и установка пароля — одна карточка: значок, заголовок, поле, жёлтая кнопка, тихий низ */
.auth { --cut: 22px; padding: 36px 34px 24px; display: grid; text-align: center; }
.auth-badge {
  justify-self: center; display: grid; place-items: center; width: 54px; height: 54px; margin: 0 0 18px;
  color: var(--volt); background: color-mix(in srgb, var(--volt) 9%, var(--panel-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--volt) 38%, var(--line-2));
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
}
.auth-badge .i { width: 24px; height: 24px; }
.auth-badge.is-err { color: var(--st-err); background: color-mix(in srgb, var(--st-err) 9%, var(--panel-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-err) 38%, var(--line-2)); }
.auth h1 { margin: 0 0 10px; font: 600 clamp(26px, 4vw, 32px)/1.1 var(--f-display); letter-spacing: -.01em; }
.auth-sub { margin: 0 0 24px; color: var(--ink-2); font-size: 15px; }
.auth-sub[hidden] { display: none; }
.auth-addr { color: var(--ink); font-weight: 700; white-space: nowrap; }
.auth-alert { display: flex; gap: 10px; align-items: flex-start; text-align: left; color: var(--ink); }
.auth-alert .i { width: 18px; height: 18px; margin-top: 1px; flex: none; color: var(--st-err); }
.auth-alert .errorlist { margin: 0; color: inherit; }
.auth-form { display: grid; text-align: left; }
.auth-form .field { margin: 0 0 16px; }
.auth-go { width: 100%; min-height: 46px; margin-top: 4px; font-size: 15.5px !important; }
.auth-hint { margin: 10px 0 0; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.auth-form .auth-hint + .auth-go { margin-top: 18px; }
.auth-check {
  display: flex; align-items: center; justify-content: center; margin: 18px 0 16px; cursor: pointer;
  text-transform: none; letter-spacing: 0; font: 500 14.5px/1.3 var(--f-ui); color: var(--ink-2);
}
.auth-rule { height: 1px; margin: 24px 0 18px; background: var(--line); }

/* Поле кода: шесть клеток под одним настоящим полем (вставка и автоподстановка кода работают как обычно) */
.code-cells {
  --cell: 50px; --gap: 9px; --pitch: calc(var(--cell) + var(--gap));
  position: relative; justify-self: center; display: flex; gap: var(--gap);
  width: calc(6 * var(--pitch) - var(--gap)); max-width: 100%; height: 62px; overflow: hidden;
}
.code-cells .cell {
  flex: 0 0 var(--cell); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  transition: box-shadow .15s;
}
.code-cells:hover .cell { box-shadow: inset 0 0 0 1px var(--ink-3); }
.code-cells .cell.is-filled { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--volt) 55%, var(--line-2)); }
.code-cells:focus-within .cell.is-active { box-shadow: inset 0 0 0 2px var(--focus); }
.code-cells input,
.code-cells input:hover,
.code-cells input:focus-visible {
  position: absolute; inset: 0; width: calc(100% + 2 * var(--pitch)); height: 100%; min-height: 0;
  padding: 0 0 0 calc((var(--cell) - 1ch) / 2); background: transparent; box-shadow: none;
  font: 600 28px/1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: calc(var(--pitch) - 1ch);
  color: var(--ink); caret-color: var(--signal);
}
.code-cells.is-free { width: 100%; height: auto; overflow: visible; }
.code-cells.is-free .cell { display: none; }
.code-cells.is-free input,
.code-cells.is-free input:hover { position: static; width: 100%; height: auto; min-height: 46px; padding: 9px 14px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); font: 500 17px/1.3 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: .08em; text-align: center; }
.code-cells.is-free input:focus-visible { position: static; width: 100%; height: auto; min-height: 46px; padding: 9px 14px; background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--focus); font: 500 17px/1.3 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: .08em; text-align: center; }
@media (max-width: 440px) {
  .auth { padding: 30px 20px 22px; }
  .code-cells { --cell: 42px; --gap: 6px; height: 56px; }
  .code-cells input { font-size: 25px; }
}

.auth-resend { display: grid; justify-items: center; gap: 6px; color: var(--ink-3); font-size: 14.5px; }
.auth-resend-row { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 8px; }
.view .auth-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 2px; border: 0; background: none; cursor: pointer;
  color: var(--volt); font: 600 14.5px/1.2 var(--f-ui); text-underline-offset: 3px;
}
.view .auth-link:hover { text-decoration: underline; }
.view .auth-link:disabled { color: var(--ink-3); cursor: default; text-decoration: none; }
.auth-link .i { width: 15px; height: 15px; }
.auth-wait { font-variant-numeric: tabular-nums; color: var(--ink-3); }
.auth-wait[hidden] { display: none; }

.auth-more { margin: 16px 0 0; }
.auth-more summary {
  display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer;
  color: var(--ink-2); font: 600 14px/1.2 var(--f-ui);
}
.auth-more summary::-webkit-details-marker { display: none; }
.auth-more summary::before,
.auth-more summary::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-more summary::after { order: 2; }
.auth-more summary .i { order: 1; width: 15px; height: 15px; margin-left: -4px; transition: transform .15s; }
.auth-more[open] summary .i { transform: rotate(180deg); }
.auth-more summary:hover { color: var(--ink); }
.auth-ways { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; border: 0; text-align: left; }
.auth-ways label {
  display: flex; align-items: center; margin: 0; padding: 11px 14px; cursor: pointer;
  background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2);
  text-transform: none; letter-spacing: 0; font: 500 14.5px/1.3 var(--f-ui); color: var(--ink);
}
.auth-ways label:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }
.auth-ways label:has(:checked) { background: var(--sel); box-shadow: inset 0 0 0 1px var(--volt); }

.auth-foot { margin: 20px 0 0; color: var(--ink-3); font-size: 13.5px; line-height: 1.5; text-wrap: balance; }
.auth-rule + .auth-foot { margin-top: 0; }
.auth-foot .i { width: 15px; height: 15px; margin-right: 7px; vertical-align: -3px; }
.auth-foot a { color: var(--volt); text-underline-offset: 3px; }

/* ---------- Главная кабинета: карточки модулей по содержимому ---------- */
.module:not(.module-feature):not(.module-wide) { min-height: 0; }
.module-feature.is-flat { grid-row: auto; grid-column: 1 / -1; min-height: 0; }
@container view (max-width: 1180px) {
  .module-feature.is-flat { display: flex; }
}
.module-feature.is-flat .fleet-legend { gap: 8px 24px; }
.module-feature.is-flat .fleet-legend .firm { margin-right: 11px; }
/* «Техника» и «Водители» — две плитки в одном ряду (по две колонки из четырёх); уже рабочей области — друг под другом. */
@container view (min-width: 1181px) {
  .module-feature.is-flat.is-half { grid-column: span 2; }
  .module-feature.is-flat.is-half .num { font-size: 48px; }
  .module-feature.is-flat.is-half .feature-figs { gap: 12px 28px; }
}
.alert .alert-data { font-size: 13.5px; color: var(--ink-3); }
.mod-note { color: var(--ink-3); }
.home-extra { margin: 28px 0 0; }
@media (max-width: 640px) {
  .crumbs li:last-child::before { content: none; }
}
