/* Токены — те же, что в CTS Partners (app.css): новая CRM должна
   ощущаться родственной. Добавлен только цвет Авито. */
:root {
  color-scheme: light;
  --bg: #f2f3f6; --card: #ffffff; --sunken: #f2f3f6; --hover: #e8eaef; --raised: #ffffff;
  --seg-page: #e4e6eb;
  --ink: #0f1217; --ink-soft: #5a616d; --ink-faint: #8d94a0; --line: #e9ebef;
  --accent: #2f6bff; --accent-hover: #1d5af2; --accent-tint: #eaf0ff;
  --accent-tint-hover: #dce6ff; --accent-tint-ink: #1f57eb;
  --ok: #0d9a56; --ok-tint: #e5f6ec;
  --danger: #e3383b; --danger-tint: #fdeced;
  --warn: #d98200; --warn-tint: #fff2da;
  --avito: #00a3ff; --avito-tint: #e2f4ff; --avito-ink: #0079c1;
  --rail: #121419; --rail-ink: #9ba2ae;
  --r-sm: 12px; --r: 16px; --r-lg: 20px;
  --shadow: 0 1px 2px rgba(15, 18, 23, .05);
  --shadow-hover: 0 8px 24px rgba(15, 18, 23, .09);
  --ring: 0 0 0 4px rgba(47, 107, 255, .16);
  --ease: cubic-bezier(.2, .7, .3, 1); --fast: .12s; --base: .18s;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c0d10; --card: #16171b; --sunken: #1f2126; --hover: #26282e; --raised: #2c2e35;
    --seg-page: #1a1b20;
    --ink: #f0f1f3; --ink-soft: #a6acb6; --ink-faint: #6f7580; --line: #25272d;
    --accent: #4d80ff; --accent-hover: #6792ff; --accent-tint: #19233d;
    --accent-tint-hover: #202c4d; --accent-tint-ink: #9db9ff;
    --ok: #37c77c; --ok-tint: #12281c; --danger: #ff625c; --danger-tint: #33191a;
    --warn: #ffb443; --warn-tint: #30240e;
    --avito: #33b5ff; --avito-tint: #0d2330; --avito-ink: #6cc8ff;
    --rail: #08090b;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .025);
    --shadow-hover: 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 30px rgba(0, 0, 0, .4);
    --ring: 0 0 0 4px rgba(77, 128, 255, .22);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0d10; --card: #16171b; --sunken: #1f2126; --hover: #26282e; --raised: #2c2e35;
  --seg-page: #1a1b20;
  --ink: #f0f1f3; --ink-soft: #a6acb6; --ink-faint: #6f7580; --line: #25272d;
  --accent: #4d80ff; --accent-hover: #6792ff; --accent-tint: #19233d;
  --accent-tint-hover: #202c4d; --accent-tint-ink: #9db9ff;
  --ok: #37c77c; --ok-tint: #12281c; --danger: #ff625c; --danger-tint: #33191a;
  --warn: #ffb443; --warn-tint: #30240e;
  --avito: #33b5ff; --avito-tint: #0d2330; --avito-ink: #6cc8ff;
  --rail: #08090b;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .025);
  --shadow-hover: 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 30px rgba(0, 0, 0, .4);
  --ring: 0 0 0 4px rgba(77, 128, 255, .22);
}

* { box-sizing: border-box; }
/* Без этого правила атрибут hidden не работает на блоках, которым задан
   display: grid или flex — класс перебивает стиль браузера. */
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: Onest, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
button { font: inherit; }
a { color: var(--accent-tint-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--ring); }
.ico { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor;
       stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }

/* ── Каркас ─────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--rail); color: var(--rail-ink);
  display: flex; flex-direction: column; gap: 2px; padding: 18px 12px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent);
              display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.brand-mark .ico { width: 20px; height: 20px; stroke-width: 2; }
.brand-name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -.01em; line-height: 1.2; }
.brand-sub { font-size: 12px; color: #6e7581; }
.nav-cap { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
           color: #555c67; padding: 16px 12px 6px; }
.nav {
  display: flex; align-items: center; gap: 12px; width: 100%;
  height: 40px; padding: 0 12px; border-radius: 12px; border: 0; background: transparent;
  color: var(--rail-ink); font-size: 14px; font-weight: 500; text-align: left; cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav .ico { width: 20px; height: 20px; stroke-width: 1.7; }
.nav:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav.on { background: rgba(255, 255, 255, .11); color: #fff; font-weight: 600; }
.nav .n { margin-left: auto; font-size: 12px; color: #6e7581; font-weight: 500; font-variant-numeric: tabular-nums; }
.nav.on .n { color: #aab1bc; }
.nav .badge-n { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
                background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
                display: grid; place-items: center; }
.side .spacer { flex: 1; min-height: 16px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px;
      background: rgba(255, 255, 255, .045); }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
          background: linear-gradient(135deg, #2f6bff, #00a3ff); color: #fff;
          font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.me b { display: block; color: #fff; font-size: 13px; font-weight: 600; line-height: 1.25; }
.me span { font-size: 12px; color: #767d89; }
.theme-btn { margin-left: auto; width: 32px; height: 32px; border-radius: 10px; border: 0;
             background: transparent; color: #8a919c; display: grid; place-items: center; cursor: pointer; }
.theme-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.main { min-width: 0; padding: 26px 36px 96px; }
.mock-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
             margin-bottom: 22px; font-size: 13px; color: var(--ink-soft); }
.mock-note .pill { flex-shrink: 0; }
.screen { max-width: 1240px; }
.screen.enter { animation: rise var(--base) var(--ease); }
@keyframes rise { from { transform: translateY(6px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen.enter { animation: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between;
             gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { font-size: 30px; line-height: 1.12; font-weight: 700; letter-spacing: -.025em; margin: 0; text-wrap: balance; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; margin: 0; }
h3 { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
     color: var(--ink-faint); margin: 0 0 12px; }
.page-sub { color: var(--ink-soft); margin-top: 8px; }
.page-sub b { color: var(--ink); font-weight: 600; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-soft); border: 0;
        background: none; padding: 0; font-size: 14px; font-weight: 500; margin: 0 0 12px -4px; cursor: pointer; }
.back:hover { color: var(--ink); }

/* ── Кнопки, чипы, метки ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
       height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 0;
       background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
       white-space: nowrap; cursor: pointer;
       transition: background var(--fast) var(--ease), transform var(--fast) var(--ease); }
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn.tint { background: var(--accent-tint); color: var(--accent-tint-ink); }
.btn.tint:hover { background: var(--accent-tint-hover); }
.btn.plain { background: var(--sunken); color: var(--ink); }
.btn.plain:hover { background: var(--hover); }
.btn.page { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.btn.page:hover { background: var(--hover); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.lg { height: 52px; font-size: 15px; border-radius: 14px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
        border-radius: 999px; border: 0; background: var(--card); color: var(--ink);
        box-shadow: var(--shadow); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
        transition: background var(--fast) var(--ease), color var(--fast) var(--ease); }
.chip:hover { background: var(--hover); }
.chip .c { color: var(--ink-faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.chip.on { background: var(--ink); color: var(--card); }
.chip.on .c { color: inherit; opacity: .6; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
        border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
        background: var(--sunken); color: var(--ink-soft); }
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill .ico { width: 14px; height: 14px; stroke-width: 2; }
.pill.blue { background: var(--accent-tint); color: var(--accent-tint-ink); }
.pill.green { background: var(--ok-tint); color: var(--ok); }
.pill.red { background: var(--danger-tint); color: var(--danger); }
.pill.amber { background: var(--warn-tint); color: var(--warn); }
.pill.avito { background: var(--avito-tint); color: var(--avito-ink); }
.pill.lg { height: 30px; padding: 0 12px; font-size: 13px; }

/* Бирка двигателя. У каждого контрактного двигателя код выбит на блоке —
   в интерфейсе он выглядит как металлическая табличка на двух заклёпках,
   чтобы глаз находил двигатель в списке по коду, а не по марке. */
.eng { position: relative; display: inline-flex; align-items: center; height: 24px;
       padding: 0 14px; border-radius: 6px; border: 1.5px solid var(--ink);
       background: var(--card); color: var(--ink);
       font-family: var(--mono); font-size: 12.5px; font-weight: 600; letter-spacing: .04em;
       white-space: nowrap; }
.eng::before, .eng::after { content: ""; position: absolute; top: 50%; width: 4px; height: 4px;
       margin-top: -2px; border-radius: 50%; background: var(--ink); opacity: .55; }
.eng::before { left: 5px; }
.eng::after { right: 5px; }
.eng.lg { height: 38px; padding: 0 22px; font-size: 20px; border-width: 2px; border-radius: 8px; }
.eng.lg::before, .eng.lg::after { width: 6px; height: 6px; margin-top: -3px; }
.eng.lg::before { left: 7px; }
.eng.lg::after { right: 7px; }

.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

/* ── Склад ──────────────────────────────────────────────────────────── */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; margin-bottom: 18px; }
.summary > div { padding: 18px 20px; }
.summary > div + div { box-shadow: inset 1px 0 0 var(--line); }
.summary .k { font-size: 13px; color: var(--ink-soft); }
.summary .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.summary .v small { font-size: 14px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; }
.summary .s { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search .ico { position: absolute; left: 14px; top: 50%; margin-top: -9px; color: var(--ink-faint); }
.input { width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-sm);
         border: 1.5px solid transparent; background: var(--sunken); color: var(--ink);
         font: inherit; font-size: 14px;
         transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease); }
.input::placeholder { color: var(--ink-faint); }
.input:hover { background: var(--hover); }
.input:focus { outline: none; background: var(--card); border-color: var(--accent); box-shadow: var(--ring); }
.search .input { padding-left: 42px; background: var(--card); box-shadow: var(--shadow); }

.table-wrap { overflow-x: auto; padding: 6px 8px; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-faint);
     padding: 10px 12px; white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th.r, td.r { text-align: right; }
tbody tr { cursor: pointer; transition: background var(--fast) var(--ease); }
tbody tr:hover td { background: var(--sunken); }
tbody tr td:first-child { border-radius: 12px 0 0 12px; }
tbody tr td:last-child { border-radius: 0 12px 12px 0; }
.thumb { position: relative; width: 56px; height: 44px; border-radius: 10px; background: var(--sunken);
         color: var(--ink-faint); display: grid; place-items: center; overflow: hidden; flex: none; }
/* Снимок заполняет плитку и не растягивает строку: вертикальное фото
   раньше вылезало за её край и наезжало на соседний товар. */
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb .ico { width: 26px; height: 26px; stroke-width: 1.4; }
.thumb .cnt { position: absolute; right: 3px; bottom: 3px; z-index: 1; padding: 1px 5px;
              border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff;
              font-size: 10px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.thumb.empty { background: var(--danger-tint); color: var(--danger); }
.m-line { display: flex; align-items: center; gap: 10px; }
.m-sub { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.place { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.age-old { color: var(--warn); font-weight: 600; }
.price { font-weight: 700; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px;
              padding: 12px 12px 6px; font-size: 13px; color: var(--ink-soft); flex-wrap: wrap; }

/* ── Карточка товара ────────────────────────────────────────────────── */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }
.aside { position: sticky; top: 20px; }
.gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; height: 300px; }
.ph { border-radius: 14px; background: var(--sunken); color: var(--ink-faint);
      display: grid; place-items: center; position: relative; overflow: hidden; }
/* Раньше первая плитка растягивалась на две строки (так было в макете
   галереи) — в сетке фотографий из-за этого появлялась дыра в начале
   второго ряда. Все снимки одинаковые, крупным делаем только просмотр. */
.ph .ico { width: 44px; height: 44px; stroke-width: 1.2; }
.ph .tagline { position: absolute; left: 10px; bottom: 10px; font-size: 12px; font-weight: 600;
               color: var(--ink-soft); background: var(--card); padding: 3px 9px; border-radius: 999px; }
.ph.more { font-weight: 600; color: var(--ink-soft); font-size: 15px; }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.kv div { min-width: 0; }
.kv dt { font-size: 12px; color: var(--ink-faint); }
.kv dd { margin: 3px 0 0; font-weight: 500; overflow-wrap: anywhere; }

.cyl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cyl div { background: var(--sunken); border-radius: 14px; padding: 12px 10px 10px; text-align: center; }
.cyl .ring { width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 50%;
             border: 3px solid var(--ok); display: grid; place-items: center;
             font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.cyl b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.cyl span { font-size: 11px; color: var(--ink-faint); }
.check-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--ink-soft); flex-wrap: wrap; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 92px 16px minmax(0, 1fr); gap: 12px; }
.timeline .when { font-size: 12px; color: var(--ink-faint); padding-top: 1px; font-variant-numeric: tabular-nums; text-align: right; }
.timeline .rail { position: relative; }
.timeline .rail::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: -4px; width: 2px; background: var(--line); }
.timeline li:last-child .rail::before { display: none; }
.timeline .rail::after { content: ""; position: absolute; left: 3px; top: 4px; width: 10px; height: 10px;
                         border-radius: 50%; background: var(--card); box-shadow: inset 0 0 0 2.5px var(--ink-faint); }
.timeline li.av .rail::after { box-shadow: inset 0 0 0 2.5px var(--avito); }
.timeline .what { padding-bottom: 16px; }
.timeline .what small { display: block; color: var(--ink-faint); font-size: 12px; margin-top: 1px; }

.price-big { font-size: 34px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.price-rows { display: grid; gap: 8px; margin: 14px 0 18px; padding: 14px 0 0; box-shadow: inset 0 1px 0 var(--line); }
.price-rows div { display: flex; justify-content: space-between; gap: 12px; }
.price-rows span { color: var(--ink-soft); }
.plus { color: var(--ok); font-weight: 700; }
.btn-col { display: grid; gap: 8px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.avito-box { background: var(--avito-tint); border-radius: var(--r-lg); padding: 18px; }
.avito-box .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.avito-logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--avito-ink); }
.avito-dots { display: inline-grid; grid-template-columns: 7px 7px; gap: 2px; }
.avito-dots i { width: 7px; height: 7px; border-radius: 50%; }
.avito-dots i:nth-child(1) { background: #00aaff; } .avito-dots i:nth-child(2) { background: #a169f7; }
.avito-dots i:nth-child(3) { background: #04e061; } .avito-dots i:nth-child(4) { background: #ff4053; }
.listing { background: var(--card); border-radius: 14px; padding: 14px; }
.listing .t { font-weight: 600; line-height: 1.3; }
.listing .p { font-size: 18px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.listing .d { font-size: 12px; color: var(--ink-soft); margin-top: 6px; line-height: 1.45; }
.avito-meta { display: grid; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--ink-soft); }
.avito-meta div { display: flex; justify-content: space-between; gap: 10px; }
.avito-meta b { color: var(--ink); font-weight: 500; }

/* ── Приёмка ────────────────────────────────────────────────────────── */
.intake { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.lbl { display: block; font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-bottom: 7px; }
.field { min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
.hint { font-size: 12px; color: var(--ink-faint); margin-top: 7px; }
.hint.ok { color: var(--ok); font-weight: 500; }
.suffix { position: relative; }
.suffix > span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.suffix > .input { padding-right: 40px; }
.input.code { font-family: var(--mono); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.found { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px;
         border-radius: 12px; background: var(--ok-tint); color: var(--ok); font-size: 13px; font-weight: 500; }
.found b { color: var(--ink); font-weight: 600; }
.section-gap { margin-top: 22px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photos .ph { height: 80px; }
.photos .ph .ico { width: 30px; height: 30px; }
.drop { height: 80px; border-radius: 14px; border: 1.5px dashed var(--ink-faint); color: var(--ink-soft);
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
        font-size: 12px; font-weight: 500; background: transparent; cursor: pointer; }
.drop:hover { border-color: var(--accent); color: var(--accent-tint-ink); }
details.more { margin-top: 22px; border-radius: 14px; background: var(--sunken); }
details.more summary { cursor: pointer; padding: 14px 16px; font-weight: 600; list-style: none;
                       display: flex; align-items: center; gap: 10px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary .faint { font-weight: 400; }
details.more summary .ico { margin-left: auto; transition: transform var(--fast) var(--ease); }
details.more[open] summary .ico { transform: rotate(180deg); }
details.more .inner { padding: 0 16px 16px; }
details.more .input { background: var(--card); }
.switch-row { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 14px 16px;
              border-radius: 14px; background: var(--avito-tint); }
.switch-row b { display: block; }
.switch-row span { font-size: 13px; color: var(--ink-soft); }
.switch { margin-left: auto; width: 46px; height: 28px; border-radius: 999px; border: 0; padding: 3px;
          background: var(--ink-faint); cursor: pointer; flex-shrink: 0; transition: background var(--fast) var(--ease); }
.switch i { display: block; width: 22px; height: 22px; border-radius: 50%; background: #fff;
            transition: transform var(--base) var(--ease); }
.switch[aria-checked="true"] { background: var(--avito); }
.switch[aria-checked="true"] i { transform: translateX(18px); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* ── Приёмка партии с телефона ──────────────────────────────────────── */
.batch { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
.phone { background: var(--rail); border-radius: 40px; padding: 10px; box-shadow: var(--shadow-hover); }
.phone-in { background: var(--bg); border-radius: 32px; padding: 14px 12px 16px; display: grid; gap: 12px; }
.phone-bar { display: flex; align-items: center; justify-content: space-between;
             color: var(--ink-faint); font-size: 11px; padding: 2px 8px 0; font-variant-numeric: tabular-nums; }
.phone-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px; }
.phone-head b { font-size: 17px; letter-spacing: -.02em; }
.step { background: var(--card); border-radius: 16px; padding: 12px 14px; }
.step .lbl { margin-bottom: 6px; }
.step .input { background: var(--sunken); }
.step .input.big-code { height: 52px; font-size: 22px; }
.sugg { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.sugg .chip { height: 32px; padding: 0 12px; font-size: 13px; background: var(--sunken); box-shadow: none; }
.sugg .chip:hover { background: var(--hover); }
.sugg .chip.on { background: var(--ink); color: var(--card); }
.scan { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; margin-top: 10px;
        border: 0; border-radius: 10px; background: var(--accent-tint); color: var(--accent-tint-ink);
        font-size: 13px; font-weight: 600; cursor: pointer; }
.scan:hover { background: var(--accent-tint-hover); }
.money-sugg { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.money-sugg b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.shot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.shot { height: 74px; border: 0; border-radius: 14px; background: var(--sunken); color: var(--ink-soft);
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
        font-size: 11.5px; font-weight: 500; text-align: center; cursor: pointer; }
.shot .ico { width: 20px; height: 20px; }
.shot.done { background: var(--ok-tint); color: var(--ok); }
.shot.wait { border: 1.5px dashed var(--ink-faint); background: transparent; }

.progress { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; margin: 14px 0 10px; }
.progress i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.pace { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.pace div { background: var(--sunken); border-radius: 14px; padding: 12px; }
.pace .v { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pace .k { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; gap: 10px; padding: 10px 0; box-shadow: inset 0 1px 0 var(--line); }
.recent li:first-child { box-shadow: none; padding-top: 0; }
.recent .t { margin-left: auto; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.recent .undo { border: 0; background: transparent; color: var(--ink-faint); cursor: pointer;
                width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.recent .undo:hover { background: var(--sunken); color: var(--ink); }
@media (max-width: 1100px) { .batch { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) { .phone { border-radius: 28px; } .pace { grid-template-columns: minmax(0, 1fr); } }

/* ── Сделки ─────────────────────────────────────────────────────────── */
/* Этапов стало пять («Ждём поставку» для заказов), и жёсткие четыре
   колонки заворачивали последнюю на вторую строку. Считаем колонки по
   числу этапов: на узком экране доска прокручивается вбок, как раньше. */
.board { display: grid; grid-auto-flow: column;
         grid-auto-columns: minmax(230px, 1fr); gap: 14px;
         overflow-x: auto; padding-bottom: 6px; align-items: start; }
/* min-width: 0 обязателен: без него колонка растягивается под самую
   длинную карточку («Бобков Алексей Александрович» плюс метка) и лезет
   на соседний этап. Длинное имя обрезаем многоточием. */
.lane { background: var(--seg-page); border-radius: var(--r-lg); padding: 12px; display: grid;
        gap: 8px; min-width: 0; }
.lane > * { min-width: 0; }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 6px; font-weight: 600; }
.lane-head .c { color: var(--ink-faint); font-weight: 500; font-variant-numeric: tabular-nums; }
.lane-head .sum { margin-left: auto; font-size: 12px; color: var(--ink-soft); font-weight: 500; font-variant-numeric: tabular-nums; }
.dcard { background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow);
         display: grid; gap: 8px; cursor: pointer; transition: box-shadow var(--base) var(--ease); }
.dcard:hover { box-shadow: var(--shadow-hover); }
.dcard .row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
              min-width: 0; }
.dcard .row .pill { flex: none; }
.dcard .who { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcard .car { font-size: 12px; color: var(--ink-soft); }
.dcard .money { font-weight: 700; font-variant-numeric: tabular-nums; }
.dcard .note { font-size: 12px; color: var(--ink-soft); background: var(--sunken); border-radius: 8px; padding: 6px 8px; }
.dcard .meta { font-size: 12px; color: var(--ink-faint); overflow-wrap: anywhere; }
.lane .more-link { text-align: center; font-size: 13px; color: var(--ink-soft); padding: 6px; }

/* ── Роли. Что скрыто от менеджера и от сотрудника ──────────────────── */
[data-role="manager"] [data-owner-only],
[data-role="manager"] [data-owner-admin],
[data-role="staff"] [data-owner-admin] { display: none !important; }
/* Закупка — седьмая колонка в списке товаров */
[data-role="manager"] #t-stock th:nth-child(6),
[data-role="manager"] #t-stock td:nth-child(6) { display: none; }
.role-pick { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.role-pick select { height: 32px; border: 0; border-radius: 10px; background: var(--card);
                    color: var(--ink); box-shadow: var(--shadow); font: inherit; font-size: 13px;
                    font-weight: 600; padding: 0 10px; cursor: pointer; }
.rights { width: 100%; min-width: 520px; border-collapse: collapse; }
.rights th { font-size: 12px; color: var(--ink-faint); font-weight: 500; padding: 10px 12px; text-align: center; }
.rights th:first-child { text-align: left; }
.rights td { padding: 11px 12px; border-top: 1px solid var(--line); text-align: center; }
.rights td:first-child { text-align: left; font-weight: 500; }
.rights .yes { color: var(--ok); }
.rights .no { color: var(--ink-faint); }
.rights .ico { width: 17px; height: 17px; stroke-width: 2.2; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 0; box-shadow: inset 0 1px 0 var(--line); }
.person:first-of-type { box-shadow: none; padding-top: 0; }
.person .avatar { width: 38px; height: 38px; }
.person b { display: block; }
.person .who2 { font-size: 12px; color: var(--ink-soft); }
.person .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ── Вкладки внутри раздела ─────────────────────────────────────────── */
.tabs { display: inline-flex; gap: 2px; padding: 4px; border-radius: 14px; background: var(--seg-page); margin-bottom: 18px; }
.tabs button { height: 36px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent;
               color: var(--ink-soft); font-size: 14px; font-weight: 500; cursor: pointer;
               transition: background var(--fast) var(--ease), color var(--fast) var(--ease); }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 18, 23, .1); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
.calc { display: grid; gap: 8px; }
.calc div { display: flex; justify-content: space-between; gap: 12px; }
.calc div span { color: var(--ink-soft); }
.calc .total { padding-top: 10px; box-shadow: inset 0 1px 0 var(--line); font-weight: 700; }
.docs { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Авито ──────────────────────────────────────────────────────────── */
.feed-status { display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); padding: 0; margin-bottom: 18px; }
.feed-status > div { padding: 18px 20px; }
.feed-status > div + div { box-shadow: inset 1px 0 0 var(--line); }
.feed-status .k { font-size: 13px; color: var(--ink-soft); }
.feed-status .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.feed-status .s { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.feed-status .v.red { color: var(--danger); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.err { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
       padding: 12px 0; box-shadow: inset 0 1px 0 var(--line); }
.err:first-of-type { box-shadow: none; padding-top: 0; }
.err .ico-bubble { width: 36px; height: 36px; border-radius: 50%; background: var(--danger-tint); color: var(--danger);
                   display: grid; place-items: center; }
.err .why { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.url-row { display: flex; gap: 8px; align-items: center; }
.url-row code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: var(--sunken);
                border-radius: 12px; padding: 12px 14px; font-size: 13px; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rules li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; color: var(--ink-soft); }
.rules li .ico { color: var(--ok); margin-top: 1px; }
.rules li.off .ico { color: var(--ink-faint); }
.rules b { color: var(--ink); font-weight: 600; }
.tpl { font-family: var(--mono); font-size: 13px; background: var(--sunken); border-radius: 12px; padding: 12px 14px; line-height: 1.6; overflow-wrap: anywhere; }
.tpl .ph-var { color: var(--accent-tint-ink); background: var(--accent-tint); border-radius: 5px; padding: 0 4px; }
.xml { font-family: var(--mono); font-size: 12.5px; line-height: 1.65; background: var(--sunken);
       border-radius: 12px; padding: 14px 16px; overflow-x: auto; white-space: pre; margin: 0; color: var(--ink-soft); }
.xml .tg { color: var(--avito-ink); }
.xml .vl { color: var(--ink); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0;
         background: var(--ink); color: var(--card); padding: 12px 18px; border-radius: 12px; font-weight: 500;
         pointer-events: none; transition: opacity var(--base) var(--ease), transform var(--base) var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Узкие экраны ───────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .detail, .intake, .two { grid-template-columns: minmax(0, 1fr); }
  .aside { position: static; }
  .summary, .feed-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary > div:nth-child(3), .feed-status > div:nth-child(3) { box-shadow: inset 0 1px 0 var(--line); }
  .summary > div:nth-child(4), .feed-status > div:nth-child(4) { box-shadow: inset 1px 0 0 var(--line), inset 0 1px 0 var(--line); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px; }
  .brand { padding: 2px 8px 2px 2px; }
  .brand-sub, .nav-cap, .side .spacer, .me > div { display: none; }
  .nav { width: auto; height: 36px; }
  .me { margin-left: auto; padding: 0; background: none; }
  .me .avatar { display: none; }
  .main { padding: 20px 16px 80px; }
  .grid2, .grid3, .kv { grid-template-columns: minmax(0, 1fr); }
  .gallery { height: 220px; }
  .timeline li { grid-template-columns: 72px 16px minmax(0, 1fr); }
}


/* ═══ Телефон: нижнее меню и склад карточками ═══════════════════════════
   На складе человек стоит с телефоном в одной руке. Двенадцать пунктов в
   горизонтальной ленте там не работают: нужны четыре крупные кнопки внизу
   и список, который листается вертикально. */
.topbar { display: none; }
.bottombar { display: none; }
.stock-cards { display: none; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 40; height: 100dvh;
          flex-direction: column; transform: translateX(-100%);
          transition: transform var(--base) var(--ease); overflow-y: auto; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
  .side .brand-sub, .side .nav-cap, .side .spacer, .side .me > div { display: revert; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 39; }

  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
            padding: 8px 12px; background: var(--bg); }
  .topbar .burger { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--sunken);
                    color: var(--ink); display: grid; place-items: center; }
  .topbar .title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
  .topbar form { flex: 1; }
  .topbar .input { height: 40px; background: var(--card); box-shadow: var(--shadow); }

  .main { padding: 14px 14px 88px; }
  h1 { font-size: 23px; }
  .page-head { margin-bottom: 16px; }

  .bottombar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px;
               position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
               background: var(--card); box-shadow: 0 -1px 0 var(--line), 0 -8px 24px rgba(15, 18, 23, .06);
               padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .bottombar a { display: grid; justify-items: center; gap: 3px; padding: 8px 2px; border-radius: 12px;
                 color: var(--ink-faint); text-decoration: none; font-size: 11px; font-weight: 600; }
  .bottombar a.on { color: var(--accent); background: var(--accent-tint); }
  .bottombar .ico { width: 22px; height: 22px; }

  /* Таблицу склада подменяем списком карточек */
  .table-wrap.stock-table { display: none; }
  .stock-cards { display: grid; gap: 10px; }
  .scard { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 12px;
           background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
           color: inherit; text-decoration: none; }
  .scard .thumb { width: 76px; height: 76px; }
  .scard .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .scard .price { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .scard .line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px;
                 font-size: 13px; color: var(--ink-soft); }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr; }
  .toolbar .chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
}

/* Всплывающая подпись о сохранении */
.flash { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 14px); opacity: 0;
         z-index: 60; padding: 12px 18px; border-radius: 12px; font-weight: 500;
         background: var(--ink); color: var(--card); box-shadow: var(--shadow-pop, 0 16px 40px rgba(0,0,0,.25));
         animation: flash-in var(--base) var(--ease) forwards, flash-out .3s var(--ease) 3.2s forwards; }
.flash.bad { background: var(--danger); color: #fff; }
@keyframes flash-in { to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes flash-out { to { opacity: 0; transform: translate(-50%, 14px); } }
@media (max-width: 820px) { .flash { bottom: 84px; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; opacity: 1; transform: translate(-50%, 0); } }

/* Сортировка: заголовок-кнопка */
th a.sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
th a.sort:hover { color: var(--ink); }
th a.sort .mark { color: var(--accent); font-size: 10px; }


/* Разделы, которые открывают раз в месяц: реквизиты, доступ, справочник.
   Им незачем занимать столько же места, сколько складу. */
.rare { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 12px 6px; }
.rare a { color: #6e7581; font-size: 12.5px; text-decoration: none; }
.rare a:hover { color: #fff; }

.tabs a.btn { text-decoration: none; }
.tabs a.btn.on { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 18, 23, .1); }
.tabs a.btn.plain { background: transparent; color: var(--ink-soft); }
.tabs a.btn.plain:hover { color: var(--ink); }


/* ═══ Кнопки: единые правила ════════════════════════════════════════════
   Раньше часть кнопок собиралась инлайн-стилями и разъезжалась: в кассе
   «×» растягивался на всю ширину, суффикс ₽ уезжал от поля. Здесь всё
   собрано в одном месте. */

/* Квадратная кнопка со значком — для «убрать», «скопировать», «печать». */
.btn.sq { width: 44px; padding: 0; }
.btn.sm.sq { width: 36px; }
.btn.lg.sq { width: 52px; }
.btn.sq .ico { width: 18px; height: 18px; }

/* Выбор файла выглядит как обычная кнопка: браузерный «Обзор…» не
   поддаётся стилизации, поэтому прячем поле внутрь подписи. */
label.btn { display: inline-flex; }
label.btn input[type="file"] { display: none; }

/* Кнопка-иконка без фона: удаление в углу фотографии, крестик в списке. */
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border: 0; border-radius: 10px; background: var(--sunken); color: var(--ink-soft);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 0;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.icon-btn:hover { background: var(--danger-tint); color: var(--danger); }
.icon-btn.sm { width: 28px; height: 28px; font-size: 15px; }
.icon-btn.on-photo { background: rgba(0, 0, 0, .55); color: #fff; }
.icon-btn.on-photo:hover { background: rgba(0, 0, 0, .78); color: #fff; }

/* Поле с единицей измерения: работает и в строке, и в колонке. */
.suffix { position: relative; display: block; }
.suffix.inline { display: inline-block; }
.suffix > span { right: 14px; }

/* Ряд кнопок под формой: одинаковые отступы и перенос на узком экране. */
.btn-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn-line.end { justify-content: flex-end; }

/* Вкладки-переключатели занимают всю ширину там, где это форма выбора. */
.tabs.full { display: flex; }
.tabs.full button { flex: 1; }


/* ═══ Свёрнутое меню ════════════════════════════════════════════════════
   Правила, к которым пришли за три подхода:
   1. Строки меню сохраняют высоту и скругление — подсветка выбранного
      выглядит одинаково в обоих состояниях.
   2. Значки стоят на одном месте: слева, с тем же отступом.
   3. Логотип и поиск остаются, а не исчезают: у панели должна быть шапка.
   4. Подписи растворяются, а ширина панели едет плавно и коротко. */
.me { text-decoration: none; color: inherit; transition: background var(--fast) var(--ease); }
.me:hover { background: rgba(255, 255, 255, .09); }

.rail-search {
  display: flex; align-items: center; gap: 12px; height: 38px; margin-bottom: 10px;
  padding: 0 12px; border-radius: 12px; background: rgba(255, 255, 255, .07);
  color: var(--rail-ink); overflow: hidden;
}
.rail-search .ico { width: 18px; height: 18px; flex-shrink: 0; }
.rail-search input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none;
  color: #fff; font: inherit; font-size: 14px;
  transition: opacity var(--base) var(--ease);
}
.rail-search input::placeholder { color: #6e7581; }

/* Переключатель складов — такая же строка со значком, как поиск: в узком
   меню от родного выпадающего списка оставались обрезанная буква и стрелка. */
.rail-pick {
  display: flex; align-items: center; gap: 12px; height: 38px; margin-bottom: 8px;
  padding: 0 12px; border-radius: 12px; background: rgba(255, 255, 255, .07);
  color: var(--rail-ink); overflow: hidden;
}
.rail-pick .ico { width: 18px; height: 18px; flex-shrink: 0; }
.rail-pick select {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: none; cursor: pointer;
  background: transparent; color: #fff; font: inherit; font-size: 13.5px;
  appearance: none; -webkit-appearance: none;
  transition: opacity var(--base) var(--ease);
}
.rail-pick select option { background: var(--rail); color: #fff; }

.rail-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 6px;
  height: 36px; padding: 0 12px; border: 0; border-radius: 12px;
  background: transparent; color: #6e7581; font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; overflow: hidden; white-space: nowrap;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.rail-toggle:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.rail-toggle .ico { width: 18px; height: 18px; flex-shrink: 0;
                    transition: transform var(--base) var(--ease); }

@media (min-width: 821px) {
  /* Плавно, но коротко: длинная анимация превращается в «катание» страницы. */
  .shell { transition: grid-template-columns .16s var(--ease); }
  .side, .nav, .brand-name, .brand-sub, .rail-search input, .rail-pick select,
  .me > div:last-child, .rail-toggle span, .nav .n { transition: all .16s var(--ease); }

  .rail-collapsed .shell { grid-template-columns: 72px minmax(0, 1fr); }
  .rail-collapsed .side { padding: 18px 12px 14px; overflow-x: hidden; }

  /* Шапка остаётся: значок бренда и поиск никуда не деваются. */
  .rail-collapsed .brand { padding: 2px 8px 16px; }
  .rail-collapsed .brand-name, .rail-collapsed .brand-sub {
    opacity: 0; max-width: 0; overflow: hidden; white-space: nowrap;
  }
  .rail-collapsed .rail-search, .rail-collapsed .rail-pick { cursor: pointer; }
  .rail-collapsed .rail-search input,
  .rail-collapsed .rail-pick select { flex: 0; width: 0; opacity: 0; padding: 0; }

  /* Строки — той же высоты и формы, меняется только видимость подписи. */
  .rail-collapsed .nav { font-size: 0; gap: 0; padding: 0 12px; overflow: hidden; }
  .rail-collapsed .nav .n { opacity: 0; }
  .rail-collapsed .nav .badge-n {
    position: absolute; top: 4px; right: 4px; margin: 0;
    min-width: 15px; height: 15px; padding: 0 4px; font-size: 9px;
  }
  .rail-collapsed .nav { position: relative; }

  /* Названия групп превращаются в тонкую черту. */
  .rail-collapsed .nav-cap {
    height: 1px; padding: 0; margin: 10px 4px; overflow: hidden;
    background: rgba(255, 255, 255, .09); color: transparent;
  }

  .rail-collapsed .me { padding: 10px; overflow: hidden; }
  .rail-collapsed .me > div:last-child { opacity: 0; max-width: 0; overflow: hidden; }
  .rail-collapsed .rail-toggle { font-size: 0; gap: 0; }
  .rail-collapsed .rail-toggle .ico { transform: rotate(180deg); }
}

/* Содержимое держим одной шириной и по центру доступного места. Правило
   одно и на всю область: когда центрировали каждый блок по отдельности,
   шапка и карточки выравнивались по-разному и шапка съезжала. */
@media (min-width: 821px) {
  .main { max-width: 1340px; margin: 0 auto; }
}

/* Просроченный заказ виден в списке сразу: срок — главное в этой таблице. */
.m-sub.danger { color: var(--danger); }

/* Перетаскивание фотографий. Плитка под пальцем приподнимается, соседние
   расступаются сами — порядок виден до того, как отпустили. */
[data-sort-id] { cursor: grab; touch-action: pan-y; }
/* Браузер умеет таскать картинки сам и перехватывает жест на полпути.
   Своё перетаскивание работает по плитке, поэтому снимок делаем «прозрачным»
   для указателя и запрещаем ему уезжать отдельно от плитки. */
[data-sort-id] img { -webkit-user-drag: none; user-select: none; pointer-events: none; }
[data-sort-id].dragging { cursor: grabbing; opacity: .75; transform: scale(1.04);
  box-shadow: var(--shadow-hover); z-index: 5; }
.photos > [data-sort-id] { transition: transform .12s ease; }

/* ── Сетка фотографий в карточке и в приёмке ─────────────────────────── */
.photos.big { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photos.big .ph { height: 150px; }
.ph .bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 4px;
           padding: 5px; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); }
.ph .bar .grow { margin-left: auto; }
.ph img { cursor: zoom-in; }

/* ── Просмотр снимка во весь экран ───────────────────────────────────── */
.viewer { position: fixed; inset: 0; z-index: 90; background: rgba(12, 14, 18, .92);
          display: none; place-items: center; }
.viewer.on { display: grid; }
.viewer img { max-width: 94vw; max-height: 88vh; border-radius: 12px; cursor: zoom-out; }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); border: 0;
               width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, .14);
               color: #fff; font-size: 26px; cursor: pointer; display: grid; place-items: center; }
.viewer .nav:hover { background: rgba(255, 255, 255, .26); }
.viewer .prev { left: 16px; } .viewer .next { right: 16px; }
.viewer .close { position: absolute; top: 16px; right: 18px; }
.viewer .count { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center;
                 color: rgba(255, 255, 255, .75); font-size: 13px; }
@media (max-width: 640px) { .viewer .nav { width: 44px; height: 44px; } }

/* Маленькая метка рядом с текстом: «само», «новое», «проверка», «2 шт.».
   Её не было в стилях вовсе, и метка сливалась с текстом — в кассе
   читалось «Предоплата само». */
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 4px;
       border-radius: 6px; background: var(--sunken); color: var(--ink-soft);
       font-size: 11px; font-weight: 600; line-height: 1; vertical-align: middle;
       white-space: nowrap; }

/* Колонки не растягиваются под длинное содержимое: образец XML на странице
   «Авито» раньше распирал правую половину за край экрана. */
.two > * { min-width: 0; }
.two .card { min-width: 0; }
.xml { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 520px; overflow: auto; }

/* ── Статьи кассы ─────────────────────────────────────────────────────── */
.articles { list-style: none; margin: 0; padding: 0; }
.articles li { display: flex; align-items: center; gap: 10px; padding: 8px 0;
               border-bottom: 1px solid var(--line); }
.articles li:last-child { border-bottom: 0; }
.articles li.off .name b, .articles li.off .name input { opacity: .5; }
.articles .moves { display: flex; flex-direction: column; gap: 2px; }
.articles .moves .icon-btn { width: 24px; height: 20px; font-size: 12px; }
.articles .moves .icon-btn:disabled { opacity: .25; cursor: default; }
.articles .name { flex: 1; min-width: 0; }
.articles .name .input { height: 36px; }
.articles .acts { display: flex; align-items: center; gap: 4px; flex: none; }
