/* Inventory — Thermal Shipping Label
   Мир: этикетка на термобумаге. Бумага-подложка (bench) и этикетки (paper), чёрная лента-чернила,
   один оранжевый стикер только для «требует внимания». Иерархия строится контрастом масштаба:
   огромный номер против крошечных подписей. Никакого внешнего CSS, шрифтов и скриптов. */

@font-face {
  font-family: "Roboto Flex";
  src: url("fonts/roboto-flex-latin-standard-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-stretch: 25% 151%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Roboto Flex";
  src: url("fonts/roboto-flex-cyrillic-standard-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-stretch: 25% 151%;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* ---------- Токены ---------- */
:root {
  color-scheme: light;
  --bench: #e3e3dc;        /* подложка (liner) */
  --paper: #fbfbf7;        /* этикеточная бумага */
  --paper-2: #f1f1ea;      /* полоса, наведение */
  --ink: #0c0c0d;          /* чернила ленты */
  --ink-2: #45453f;        /* вторичный текст */
  --ink-3: #6a6a63;        /* подписи на бумаге */
  --rule: #c8c8bf;         /* перфорация и линейки */
  --field: #85857d;        /* граница полей: ≥3:1 к бумаге */
  --sticker: #ff4f1a;      /* оранжевый стикер: только внимание */
  --sticker-ink: #0c0c0d;
  --focus: #0c0c0d;
  --shadow: 0 1px 0 rgb(0 0 0 / .05), 0 10px 18px -12px rgb(0 0 0 / .45);

  --rail-bg: #0c0c0d;
  --rail-ink: #f3f3ee;
  --rail-ink-2: #a9a9a1;
  --rail-rule: #3a3a36;

  --font: "Roboto Flex", system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 6px;
  --liner: rgb(0 0 0 / .022);   /* борозды силиконовой подложки */
  --gap: 16px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bench: #0a0a0b;
  --paper: #18181a;
  --paper-2: #212124;
  --ink: #f3f3ee;
  --ink-2: #b9b9b1;
  --ink-3: #8d8d86;
  --rule: #34342f;
  --field: #77776f;
  --sticker: #ff6a3a;
  --focus: #f3f3ee;
  --shadow: 0 1px 0 rgb(255 255 255 / .04), 0 10px 18px -12px rgb(0 0 0 / .9);
  --rail-bg: #000;
  --rail-rule: #2c2c29;
  --liner: rgb(255 255 255 / .022);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bench: #0a0a0b;
    --paper: #18181a;
    --paper-2: #212124;
    --ink: #f3f3ee;
    --ink-2: #b9b9b1;
    --ink-3: #8d8d86;
    --rule: #34342f;
    --field: #77776f;
    --sticker: #ff6a3a;
    --focus: #f3f3ee;
    --shadow: 0 1px 0 rgb(255 255 255 / .04), 0 10px 18px -12px rgb(0 0 0 / .9);
    --rail-bg: #000;
    --rail-rule: #2c2c29;
    --liner: rgb(255 255 255 / .022);
  }
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--ink-3) transparent; }
body {
  margin: 0;
  background-color: var(--bench);
  background-image: repeating-linear-gradient(90deg, transparent 0 6px, var(--liner) 6px 7px);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--ink); color: var(--paper); }
input, textarea { caret-color: var(--ink); }
::placeholder { color: var(--ink-3); opacity: 1; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { display: block; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.js .no-js { display: none !important; }
.change svg { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin: 0 2px; }

.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.num { font-weight: 700; }
.cap {
  font-size: 12px; line-height: 1.2; font-weight: 650; font-stretch: 88%;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3);
}
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100; padding: 8px 12px;
  background: var(--ink); color: var(--paper); border-radius: 4px;
}
.skip:focus { top: 12px; }

/* ---------- Каркас ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.rail {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  background: var(--rail-bg); color: var(--rail-ink); padding: 20px 14px 14px;
  border-right: 1px solid var(--rail-rule);
}
.rail :focus-visible { outline-color: var(--rail-ink); }
.rail__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 2px 6px 14px; }
.brand:hover { text-decoration: none; }
.brand__mark { width: 28px; height: 28px; flex: none; color: var(--rail-ink); }
.brand__name { font-size: 24px; font-weight: 800; font-stretch: 68%; letter-spacing: 0; line-height: 1; }
.brand__org { display: block; font-size: 12px; color: var(--rail-ink-2); font-weight: 500; margin-top: 3px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__nav { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.nav a {
  display: flex; align-items: center; min-height: 38px; padding: 6px 10px; border-radius: 4px;
  text-decoration: none; font-size: 15px; font-weight: 500; color: var(--rail-ink);
}
.nav a:hover { background: rgb(255 255 255 / .09); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--rail-ink); color: #0c0c0d; font-weight: 700; }
.nav__rule { border: 0; border-top: 1px dashed var(--rail-rule); margin: 10px 4px; }
.rail__foot { border-top: 1px dashed var(--rail-rule); padding-top: 12px; display: grid; gap: 10px; }
.who { padding: 0 6px; font-size: 13px; line-height: 1.3; }
.who strong { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { color: var(--rail-ink-2); }
.who .who__demo {
  display: inline-block; margin-top: 6px; padding: 0 6px; border: 1.5px dashed var(--rail-rule); border-radius: 3px;
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--rail-ink);
}
.rail__row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 0 2px; }
.seg { display: inline-flex; border: 1px solid var(--rail-rule); border-radius: 4px; overflow: hidden; }
.seg a {
  min-height: 30px; padding: 3px 9px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-decoration: none; color: var(--rail-ink-2); display: inline-flex; align-items: center;
}
.seg a[aria-current="true"] { background: var(--rail-ink); color: #0c0c0d; }
.rail-btn {
  min-height: 30px; padding: 3px 10px; border: 1px solid var(--rail-rule); border-radius: 4px; background: none;
  color: var(--rail-ink); font-size: 13px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.rail-btn:hover { background: rgb(255 255 255 / .09); text-decoration: none; }
.rail-btn svg { width: 15px; height: 15px; }
.rail-btn.nav-toggle { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; gap: 12px; align-items: center; padding: 14px clamp(16px, 3vw, 32px);
  position: sticky; top: 0; z-index: 20; background: var(--bench); border-bottom: 1px dashed var(--rule);
}
.scan { flex: 1; display: flex; align-items: center; gap: 10px; max-width: 640px; position: relative; }
.scan svg { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--ink-2); pointer-events: none; }
.scan input::placeholder { font-stretch: 86%; }
.scan input {
  width: 100%; height: 44px; padding: 0 44px 0 40px; border: 1.5px solid var(--ink); border-radius: 6px;
  background: var(--paper); font-size: 15px;
}
.kbd {
  position: absolute; right: 10px; min-width: 22px; height: 22px; padding: 0 6px; border: 1px solid var(--field);
  border-radius: 4px; font: 600 12px/20px var(--font-mono); color: var(--ink-2); text-align: center; pointer-events: none;
}
main { padding: clamp(18px, 3vw, 32px); padding-top: clamp(18px, 2.4vw, 28px); flex: 1; width: 100%; max-width: 1280px; }
.flash {
  margin: 14px clamp(16px, 3vw, 32px) 0; padding: 10px 14px; border-radius: 6px; font-weight: 600; font-size: 14px;
  background: var(--ink); color: var(--bench); max-width: 1280px;
}
.flash--error { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }

/* ---------- Заголовок страницы ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title {
  font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; font-stretch: 68%; line-height: 1.02; letter-spacing: 0;
  text-wrap: balance; overflow-wrap: anywhere;
}
.page-sub { color: var(--ink-2); margin-top: 6px; max-width: 62ch; }
.page-sub a { font-weight: 600; }
.count { font-family: var(--font-mono); font-weight: 500; font-size: .5em; color: var(--ink-2); vertical-align: .55em; margin-left: 8px; letter-spacing: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-decoration: none; margin-bottom: 10px; }
.back svg { width: 14px; height: 14px; transform: rotate(180deg); }
.back:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Этикетка (панель) ---------- */
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel + .panel, .panel--gap { margin-top: var(--gap); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px dashed var(--rule); flex-wrap: wrap; }
.panel__title { font-size: 20px; font-weight: 750; font-stretch: 75%; line-height: 1.15; }
.panel__title .count { font-size: .7em; vertical-align: baseline; }
.panel__body { padding: 16px 18px; }
.panel__foot { padding: 12px 18px; border-top: 1px dashed var(--rule); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.perf { border: 0; border-top: 1px dashed var(--rule); margin: 0; }
/* Вырезы на концах перфорации листа, как у высечки этикетки. */
.sheet .perf { position: relative; height: 0; overflow: visible; }
.sheet .perf::before, .sheet .perf::after { content: ""; position: absolute; top: -8px; width: 16px; height: 16px; border-radius: 50%; background: var(--bench); }
.sheet .perf::before { left: -9px; }
.sheet .perf::after { right: -9px; }
.cols { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.cols--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack > * + * { margin-top: var(--gap); }

/* Линия отрыва под заголовком каждой панели: вырезы по краям, как у перфорации этикетки. */
.panel__head, .auth__brand { position: relative; }
.panel__head::before, .panel__head::after, .auth__brand::before, .auth__brand::after {
  content: ""; position: absolute; bottom: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--bench); z-index: 1;
}
.panel__head::before, .auth__brand::before { left: -8px; }
.panel__head::after, .auth__brand::after { right: -8px; }
/* Зубчатый нижний край — «подача» этикетки; у листа устройства, входа и страниц ошибок. */
.panel--edge { border-bottom: 0; }
.panel--edge::after { content: ""; display: block; height: 7px; background: radial-gradient(circle at 5px 100%, var(--bench) 3.4px, transparent 3.8px) 0 0 / 10px 7px repeat-x; }
.brand-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; font-stretch: 68%; }
.brand-inline svg { width: 22px; height: 22px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border: 1.5px solid var(--ink); border-radius: 6px; background: var(--paper); color: var(--ink);
  font-weight: 650; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--paper-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--ink-2); }
.btn--danger { border-style: double; border-width: 4px; padding: 0 13px; }
.btn--danger:hover { background: var(--ink); color: var(--paper); }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn--quiet { border-color: transparent; background: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; font-weight: 600; }

/* ---------- Формы ---------- */
.form { display: grid; gap: 18px; max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .wide { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field > label, .legend { font-size: 13px; font-weight: 650; }
.opt { font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea, .inline-select, .add-row select {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1.5px solid var(--field); border-radius: 6px; background: var(--paper);
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink-2); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); }
.field--error input, .field--error select, .field--error textarea { border-color: var(--ink); border-width: 2px; }
.field-error { color: var(--ink); font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.field-error::before { content: ""; flex: none; width: 10px; height: 9px; background: currentColor; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.hint { color: var(--ink-3); font-size: 13px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px !important;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.check { display: flex; align-items: center; gap: 10px; min-height: 42px; font-weight: 500; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-top: 4px; }
.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; }
.form-alert { padding: 10px 14px; border-radius: 6px; background: var(--paper-2); border: 2px solid var(--ink); color: var(--ink); font-weight: 600; font-size: 14px; }

/* ---------- Фильтры ---------- */
.filters { display: grid; gap: 10px; padding: 14px 18px; border-bottom: 1px dashed var(--rule); }
.fold > summary { display: none; align-items: center; gap: 8px; min-height: 44px; font-weight: 650; cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ""; margin-left: auto; width: 10px; height: 6px; background: currentColor; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.fold[open] > summary::after { transform: rotate(180deg); }
.fold:not([open]) > summary { display: flex; }
.count-chip { display: inline-flex; min-width: 22px; height: 22px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 4px; background: var(--ink); color: var(--paper); font: 700 12px/1 var(--font-mono); }
.field--actions { display: flex; gap: 8px; align-items: end; flex-direction: row; }
.filters__row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters .field { flex: 1 1 150px; }
.filters .field--actions { flex: 0 0 auto; }
.filters .field--search { flex: 2 1 240px; }
.filters label { font-size: 12px; }

/* ---------- Таблица-спецификация ---------- */
.table-wrap { overflow-x: auto; }
.spec { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec th {
  text-align: left; padding: 10px 14px; white-space: nowrap; background: var(--paper);
  font-size: 11px; font-weight: 650; font-stretch: 88%; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3);
  border-bottom: 1.5px solid var(--ink);
}
.spec th a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.spec th a:hover { color: var(--ink); text-decoration: underline; }
.spec th[aria-sort] a { color: var(--ink); }
.spec th[aria-sort="ascending"] a::after, .spec th[aria-sort="descending"] a::after {
  content: ""; border: 4px solid transparent; margin-top: -1px;
}
.spec th[aria-sort="ascending"] a::after { border-bottom: 5px solid currentColor; border-top: 0; }
.spec th[aria-sort="descending"] a::after { border-top: 5px solid currentColor; border-bottom: 0; }
.spec td { padding: 11px 14px; border-bottom: 1px dashed var(--rule); vertical-align: middle; }
.spec tbody tr:hover td { background: var(--paper-2); }
.spec tbody tr:last-child td { border-bottom: 0; }
.spec .right { text-align: right; }
.spec .nowrap { white-space: nowrap; }
.cell-main { font-weight: 600; }
a.cell-main { text-decoration: none; }
a.cell-main:hover { text-decoration: underline; }
.cell-sub { display: block; color: var(--ink-3); font-size: 13px; font-weight: 400; }
.spec td.stub { border-right: 1px dashed var(--rule); padding-right: 16px; }
.tag-num--lg { font-size: 20px !important; font-weight: 800 !important; }
.tag-num--xl { font-size: 26px !important; font-weight: 800 !important; letter-spacing: -.03em; }
.tag-num { font-family: var(--font-mono); font-weight: 700; font-size: 14px; letter-spacing: -.01em; text-decoration: none; white-space: nowrap; }
.tag-num:hover { text-decoration: underline; }
.dash { color: var(--ink-3); }
.sep { color: var(--ink-3); margin: 0 2px; }
.m-only { display: none; }

/* ---------- Штамп статуса и стикер ---------- */
.stamp {
  display: inline-flex; align-items: center; padding: 1px 7px; border: 1.5px solid var(--ink); border-radius: 3px;
  font: 700 12px/18px var(--font); font-stretch: 88%; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; color: var(--ink);
}
.stamp--in_stock { border-style: dashed; }
.stamp--repair { border-style: double; border-width: 4px; padding: 0 6px; }
.stamp--retired { border-style: dotted; color: var(--ink-3); border-color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.sticker {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 3px; background: var(--sticker); color: var(--sticker-ink);
  font: 700 12px/18px var(--font); white-space: nowrap;
}
/* Серьёзность: сплошной стикер — просрочено и ремонт; контурный — скоро, нет ответственного или помещения. */
.sticker--warranty_soon, .sticker--no_owner, .sticker--no_location { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--sticker); }
.sticker--sm { padding: 0 6px; margin-left: 6px; vertical-align: 1px; }

/* ---------- Сводка ---------- */
.summary-line { display: flex; gap: 6px 18px; flex-wrap: wrap; color: var(--ink-2); font-size: 14px; }
.summary-line a { text-decoration: none; }
.summary-line a:hover { text-decoration: underline; }
.summary-line strong { font-family: var(--font-mono); color: var(--ink); font-weight: 700; margin-right: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px dashed var(--rule); }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 10px; border: 1px solid var(--field); border-radius: 4px;
  font-size: 13px; font-weight: 600; text-decoration: none; background: var(--paper);
}
.chip:hover { border-color: var(--ink); text-decoration: none; }
.chip[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip b { font-family: var(--font-mono); font-weight: 700; }
.att { display: grid; grid-template-columns: minmax(170px, 230px) minmax(0, 1fr) auto 18px; gap: 4px 14px; align-items: center; padding: 0 18px 0 0; text-decoration: none; border-bottom: 1px dashed var(--rule); }
.att__num { align-self: stretch; display: flex; align-items: center; padding: 14px 14px 14px 18px; border-right: 1px dashed var(--rule); }
.att:last-child { border-bottom: 0; }
.att:hover { background: var(--paper-2); text-decoration: none; }
.att__main { min-width: 0; padding: 12px 0; }
.att__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.att svg { width: 16px; height: 16px; color: var(--ink-3); }
.ok-note { padding: 28px 18px; display: grid; gap: 4px; }
.ok-note strong { font-size: 18px; font-weight: 700; font-stretch: 80%; }
.manifest-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 10px 18px; text-decoration: none; }
a.manifest-row:hover { background: var(--paper-2); text-decoration: none; }
.manifest-row .num { font-size: 24px; font-weight: 800; }
.bar { grid-column: 1 / -1; width: 100%; height: 6px; color: var(--ink); }
.bar rect:first-child { fill: var(--rule); }
.bar rect:last-child { fill: currentColor; }
.manifest-title { padding: 12px 18px 4px; }
.log { font-size: 13px; }
.log li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 2px 12px; padding: 9px 18px; border-bottom: 1px dashed var(--rule); }
.log li:last-child { border-bottom: 0; }
.log time { font-family: var(--font-mono); color: var(--ink-3); font-size: 12px; white-space: nowrap; }

/* ---------- Лист устройства (сигнатура) ---------- */
.sheet__print { padding: 18px 22px 16px; }
.sheet__flags { display: grid; gap: 8px; justify-items: end; }
.sheet__top .stamp { font-size: 16px; line-height: 26px; padding: 2px 12px; }
.sheet__top .stamp--repair { padding: 0 10px; }
.sheet__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.device-num {
  font-family: var(--font-mono); font-weight: 800; font-size: clamp(38px, 7vw, 84px); line-height: 1; letter-spacing: -.035em;
  overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.device-name { font-size: 20px; font-weight: 650; font-stretch: 90%; margin-top: 10px; line-height: 1.25; }
.device-sub { color: var(--ink-2); font-size: 15px; margin-top: 2px; }
/* ---------- Окно QR: код, ссылка, сохранение и печать этикетки ---------- */
.js-only { display: inline-flex; }
html:not(.js) .js-only { display: none; }
.qr-dialog { width: min(400px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.qr-dialog::backdrop { background: rgb(0 0 0 / .6); }
.qr-dialog__body { display: grid; gap: 14px; justify-items: center; padding: 22px; }
.qr-dialog__head { justify-self: stretch; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.qr-dialog__close { flex: none; min-width: 32px; padding: 0 8px; margin: -6px -8px 0 0; }
.qr-dialog__num { font-family: var(--font-mono); font-weight: 800; font-size: 32px; line-height: 1; letter-spacing: -.03em; overflow-wrap: anywhere; }
.qr-dialog__name { margin-top: 6px; font-weight: 650; overflow-wrap: anywhere; }
.qr-dialog__actions { justify-self: stretch; display: flex; gap: 8px; flex-wrap: wrap; }
.qr-dialog__actions .btn { flex: 1 1 auto; }
.qr-link { justify-self: stretch; font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; user-select: all; }
.qr-note { justify-self: stretch; margin: 0; font-size: 13px; color: var(--ink-2); }
/* QR всегда тёмный на светлой плашке в обеих темах; тихая зона (4 модуля) нарисована внутри SVG. */
.qr-plate { margin: 0; padding: 0 0 8px; background: #fbfbf7; color: #0c0c0d; border-radius: 4px; max-width: 100%; }
.qr { display: block; max-width: 100%; height: auto; color: #0c0c0d; shape-rendering: crispEdges; }
.qr path { fill: currentColor; }
.qr-cap { padding: 0 8px; text-align: center; font-family: var(--font-mono); font-size: 11px; color: #45453f; letter-spacing: .04em; text-transform: uppercase; }
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.sheet .cells { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.sheet .cell:nth-child(5n), .sheet .cell--wide { border-right: 0; }
.cell { padding: 12px 22px 14px; border-right: 1px dashed var(--rule); border-bottom: 1px dashed var(--rule); min-width: 0; }
.cell__val { margin-top: 5px; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.cell__val.mono { font-weight: 500; font-size: 15px; }
.cell--wide { grid-column: 1 / -1; }
.cell .cap { display: block; }
.inline-select { min-height: 38px !important; font-size: 15px; font-weight: 600; margin-top: 4px; padding: 4px 30px 4px 8px !important; border-color: var(--rule) !important; background-color: transparent !important; }
.inline-select:hover { border-color: var(--ink) !important; }
.warranty--soon, .warranty--expired { font-weight: 800; }
.sw-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px dashed var(--rule); }
.sw-list li:last-child { border-bottom: 0; }
.sw-list form { display: contents; }
.add-row { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px dashed var(--rule); }
.move-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 22px; background: var(--ink); color: var(--paper); font-weight: 650; }
.move-bar span { margin-right: auto; }
.move-bar .btn { border-color: var(--paper); color: var(--paper); background: transparent; }
.move-bar .btn--primary { background: var(--paper); color: var(--ink); }
.add-row select { flex: 1; min-width: 0; }
.history li { padding: 10px 18px; border-bottom: 1px dashed var(--rule); font-size: 14px; }
.history li:last-child { border-bottom: 0; }
.history__meta { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.history__meta time { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.change { display: block; font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.change s { color: var(--ink-3); }
.change b { color: var(--ink); font-weight: 650; }
.danger { border: 1.5px dashed var(--field); border-radius: var(--radius); background: var(--paper); }
.danger summary { cursor: pointer; padding: 12px 18px; font-weight: 650; font-size: 14px; list-style: none; }
.danger summary::-webkit-details-marker { display: none; }
.danger summary::after { content: ""; float: right; margin-top: 8px; width: 8px; height: 5px; background: currentColor; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.danger[open] summary { border-bottom: 1px dashed var(--rule); }
.danger__body { padding: 14px 18px; display: grid; gap: 12px; max-width: 62ch; }

/* ---------- Справочники ---------- */
.ref-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 10px; align-items: end; padding: 14px 18px; border-bottom: 1px dashed var(--rule); }
.ref-row { padding: 0 18px; border-bottom: 1px dashed var(--rule); }
.ref-row:last-child { border-bottom: 0; }
.ref-row__line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 0; }
.ref-row__name { font-weight: 650; font-size: 16px; display: block; }
summary.ref-row__line { cursor: pointer; list-style: none; }
summary.ref-row__line::-webkit-details-marker { display: none; }
details.ref-row[open] { background: var(--paper-2); }
.ref-panel { display: grid; gap: 12px; padding: 4px 0 16px; }
.ref-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px 14px; }
.ref-edit .actions { grid-column: 1 / -1; }

/* ---------- Роли и журнал ---------- */
.panel--form { max-width: 820px; }
.js-only { display: none; }
.js .js-only { display: inline-flex; }
.perm-set { border: 0; padding: 0; margin: 0; display: grid; gap: 0; min-width: 0; }
.perm-set legend { padding: 0 0 8px; }
.perm-group { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 6px 16px; padding: 10px 0; border-top: 1px dashed var(--rule); align-items: center; }
.perm-group__title { font-weight: 650; }
.perm-group__items { display: flex; gap: 4px 24px; flex-wrap: wrap; }
.perm-set[disabled] { opacity: .8; }
.log--wide li { grid-template-columns: 148px minmax(0, 1fr); }
.error-shell { max-width: 640px; }
.panel .cells { border-bottom: 0; }

/* ---------- Пагинация и пустые состояния ---------- */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager a, .pager span.pg {
  min-width: 34px; height: 34px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--rule);
  border-radius: 4px; text-decoration: none; font-family: var(--font-mono); font-size: 13px; font-weight: 600; background: var(--paper);
}
.pager a:hover { border-color: var(--ink); text-decoration: none; }
.pager [aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pager .off { opacity: .4; pointer-events: none; }
.pager__info { color: var(--ink-2); font-size: 13px; }
.empty { padding: 40px 22px; display: grid; gap: 8px; justify-items: start; max-width: 62ch; }
.empty h2 { font-size: 22px; font-weight: 750; font-stretch: 75%; }
.empty p { color: var(--ink-2); }
.empty .actions { padding-top: 8px; }

/* ---------- Вход и ошибки ---------- */
.bare-main { max-width: none; padding: 0; display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.auth { width: min(440px, 100%); }
.auth .panel__body { padding: 22px; }
.auth__brand { display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-bottom: 1px dashed var(--rule); }
.auth__brand svg { width: 30px; height: 30px; }
.auth__brand span { font-size: 26px; font-weight: 800; font-stretch: 68%; }
.auth h1 { font-size: 30px; font-weight: 800; font-stretch: 68%; line-height: 1.05; margin-bottom: 16px; }
.auth__guest { display: grid; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--rule); }
.auth__guest .actions { padding-top: 0; }
.auth__lang { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.auth__lang .seg { border-color: var(--field); }
.auth__lang .seg a { color: var(--ink-2); }
.auth__lang .seg a[aria-current="true"] { background: var(--ink); color: var(--paper); }
.err-code { font-family: var(--font-mono); font-weight: 800; font-size: clamp(64px, 14vw, 120px); line-height: 1; letter-spacing: -.04em; }
.notice { padding: 12px 14px; border-radius: 6px; background: var(--paper-2); border: 1px dashed var(--field); font-size: 14px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1080px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; padding: 10px 14px; flex-direction: column; }
  .rail__top { width: 100%; }
  .brand { padding: 0; }
  .rail-btn.nav-toggle { display: inline-flex; }
  .js .rail__nav, .js .rail__foot { display: none; }
  .js .rail.open .rail__nav, .js .rail.open .rail__foot { display: block; }
  .js .rail.open .rail__foot { display: grid; margin-top: 10px; }
  .rail__nav { margin: 10px -6px 0; }
  .topbar { position: static; }
}
@media (max-width: 960px) {
  .sheet .cells { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet .cell:nth-child(5n) { border-right: 1px dashed var(--rule); }
  .sheet .cell:nth-child(2n), .sheet .cell--wide { border-right: 0; }
}
@media (max-width: 720px) {
  .kbd { display: none; }
  .scan input { padding-right: 12px; }
  .fold > summary { display: flex; }
  .fold:not([open]) > .filters__row { display: none; }
  .att { grid-template-columns: minmax(0, 1fr) auto; padding-right: 18px; }
  .att__num { grid-column: 1; border-right: 0; padding: 12px 0 0 18px; }
  .att .sticker { grid-column: 2; grid-row: 1; margin-top: 12px; }
  .att__main { grid-column: 1 / -1; padding: 0 0 12px 18px; }
  .spec--devices thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .spec--devices, .spec--devices tbody { display: block; }
  .spec--devices tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 16px; border-bottom: 1px dashed var(--rule); }
  .spec--devices td { display: block; padding: 0; border: 0; }
  .spec--devices td.stub { grid-column: 1; grid-row: 1; border-right: 0; padding: 0; }
  .spec--devices td.d-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .spec--devices td.d-name { grid-column: 1 / -1; grid-row: 2; }
  .spec--devices td.m-only { display: block; grid-column: 1 / -1; grid-row: 3; color: var(--ink-3); font-size: 13px; }
  .spec--devices .d-only { display: none; }
  .spec--devices tbody tr:hover td { background: none; }
  .filters__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .field--search { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .perm-group { grid-template-columns: minmax(0, 1fr); }
  .log--wide li { grid-template-columns: minmax(0, 1fr); }
  .ref-add, .ref-edit { grid-template-columns: minmax(0, 1fr); }
  .ref-row__line { grid-template-columns: minmax(0, 1fr) auto; }
  .att { grid-template-columns: minmax(0, 1fr) auto; }
  .att svg { display: none; }
  .att__num { grid-column: 1; }
  .att .sticker { grid-column: 2; grid-row: 1; }
  .att__main { grid-column: 1 / -1; }
  .cell { padding: 10px 14px 12px; }
  .sheet__print { padding: 14px; }
  .spec--stack thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .spec--stack, .spec--stack tbody, .spec--stack tr, .spec--stack td { display: block; }
  .spec--stack tr { padding: 12px 16px; border-bottom: 1px dashed var(--rule); }
  .spec--stack tr:last-child { border-bottom: 0; }
  .spec--stack td { padding: 2px 0; border: 0; }
  .spec--stack td[data-label]::before { content: attr(data-label) ": "; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
  .spec--stack td:empty { display: none; }
  .spec--stack tbody tr:hover td { background: none; }
}
@media (max-width: 560px) {
  .topbar { gap: 8px; padding-inline: 14px; }
  .topbar .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .topbar .btn { padding: 0 12px; }
}
@media (pointer: coarse) {
  .chip, .seg a, .rail-btn { min-height: 40px; }
  .pager a, .pager span.pg { min-width: 40px; height: 40px; }
  .kbd { display: none; }
  .scan input { padding-right: 12px; }
  .btn, .field input:not([type="checkbox"]), .field select, .inline-select, .add-row select { min-height: 46px; }
  .nav a { min-height: 44px; }
  .btn--sm { min-height: 40px; }
}

/* ---------- Движение: одна авторская сцена — лист «печатается» ---------- */
@keyframes feed { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.sheet__print { animation: feed .5s steps(14, end) both; }
.flash ~ main .sheet__print { animation: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Печать этикетки ---------- */
@media print {
  @page { size: 100mm 50mm; margin: 3mm; }
  body { background: #fff; color: #000; font-size: 9pt; }
  .rail, .topbar, .flash, .skip, .page-head, .back, .head-actions, .cells, .cols, .danger, .sheet__actions, main > :not(.sheet-only) { display: none !important; }
  main { padding: 0; max-width: none; }
  .sheet-only { display: block !important; }
  .panel { border: 0; box-shadow: none; background: #fff; }
  .sheet__print { animation: none; padding: 0; }
  .device-num { font-size: 26pt; color: #000; }
  .device-name { font-size: 10pt; margin-top: 2mm; }
  .sheet .perf { display: none; }
  /* Печать из окна QR: на этикетке номер, название и код; остальное окно и страница скрыты. */
  .sheet:has(dialog[open]) .sheet__print { display: none; }
  .qr-dialog[open] { position: fixed; inset: 0 auto auto 0; width: 100%; height: auto; max-height: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: #fff; color: #000; }
  .qr-dialog::backdrop { background: none; }
  .qr-dialog__body { display: flex; align-items: center; justify-content: space-between; gap: 3mm; padding: 0; }
  .qr-dialog__num { font-size: 26pt; color: #000; }
  .qr-dialog__name { font-size: 10pt; margin-top: 2mm; }
  .qr-link, .qr-note, .qr-dialog__actions, .qr-dialog__close { display: none !important; }
  .qr-plate { padding: 0; background: none; }
  .qr { width: 30mm; height: 30mm; color: #000; }
  .qr-cap { padding: 0; font-size: 5.5pt; color: #000; }
}
