:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --border: #d8dee6;
    --text: #1b2430;
    --muted: #5f6d7e;
    --accent: #1f6feb;
    --accent-dark: #1757b8;
    --danger: #c8342c;
    --ok: #1c7c46;
    --warn: #9a6400;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

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

/* --- Шапка --- */

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar__brand {
    font-weight: 600;
    font-size: 18px;
    color: var(--text);
    text-decoration: none;
}

.topbar__nav { display: flex; gap: 16px; }

.topbar__user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    color: var(--muted);
    font-size: 14px;
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 64px;
}

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 19px; margin: 28px 0 12px; }

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

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

.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    margin: 0 0 16px;
}

.alert--ok { border-color: #b6ddc6; background: #eef8f2; color: var(--ok); }
.alert--error { border-color: #f0c2bf; background: #fdf0ef; color: var(--danger); }
.alert--warn { border-color: #efdcae; background: #fdf7e8; color: var(--warn); }

/* --- Формы --- */

.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.form--narrow { max-width: 420px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 14px; color: var(--muted); }
.field__error { font-size: 13px; color: var(--danger); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select {
    padding: 9px 11px;
    font-size: 16px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

input:focus, select:focus, button:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.button {
    display: inline-block;
    padding: 9px 16px;
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
}

.button:hover { background: var(--accent-dark); }
.button--small { padding: 5px 10px; font-size: 13px; }
.button--danger { background: var(--danger); border-color: var(--danger); }

.link-button {
    padding: 0;
    font: inherit;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}

.inline-form { display: inline; }

/* --- Плитки рабочего стола --- */

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
}

.tile:hover { border-color: var(--accent); }
.tile__title { font-weight: 600; }
.tile__hint { font-size: 13px; color: var(--muted); }

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

.filters { display: flex; gap: 14px; margin-bottom: 14px; font-size: 14px; }
.filters .is-active { font-weight: 600; color: var(--text); text-decoration: none; }

/* Широкие таблицы прокручиваются внутри себя, а не растягивают страницу. */
.table-scroll { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

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

.table th { font-weight: 600; color: var(--muted); background: #fafbfc; }
.table tr:last-child td { border-bottom: none; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.activate-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.empty { color: var(--muted); text-align: center; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
}

.badge--active { border-color: #b6ddc6; background: #eef8f2; color: var(--ok); }
.badge--pending { border-color: #efdcae; background: #fdf7e8; color: var(--warn); }
.badge--blocked { border-color: #f0c2bf; background: #fdf0ef; color: var(--danger); }

.trace {
    overflow-x: auto;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

/* --- Экран сборки --- */

.is-hidden { display: none !important; }

.panel {
    padding: 18px 20px;
    margin-bottom: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.panel h2:first-child { margin-top: 0; }

.form--row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 0;
    background: none;
    border: none;
}

.field--grow { flex: 1 1 260px; }
.field--narrow { flex: 0 0 140px; }

/* Поля сканирования крупнее обычных: за столом на них смотрят мельком,
   часто в перчатках и под углом. */
#cargo-barcode, #product-barcode {
    font-size: 20px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    letter-spacing: 0.02em;
    padding: 12px;
}

.session-head {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.session-head__label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.session-head strong { font-size: 18px; }

.timer {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* Заметная вспышка на ошибке скана: звук на складе не слышно. */
#packing.is-error .panel { border-color: var(--danger); }

.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.operations { display: flex; flex-wrap: wrap; gap: 8px; }

.button--ghost {
    color: var(--accent);
    background: var(--surface);
    border-color: var(--border);
}

.button--ghost:hover { background: #eef4fd; }

.button:disabled { opacity: 0.5; cursor: default; }

.operations-list {
    margin: 10px 0 0;
    padding-left: 18px;
    font-size: 14px;
    color: var(--muted);
}

textarea {
    padding: 9px 11px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    resize: vertical;
}

/* Поле засчитанного количества узкое и выровнено по правому краю:
   контролёр читает столбец чисел сверху вниз. */
.qty-input {
    width: 80px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.total-line {
    font-size: 18px;
    margin: 16px 0;
}

.total-line strong { font-variant-numeric: tabular-nums; }

.barcode-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.barcode-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.barcode-list code {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 14px;
}

/* Поля внутри таблиц компактнее обычных: строк много, места мало. */
.table input[type="text"],
.table input[type="number"],
.table select {
    padding: 5px 8px;
    font-size: 14px;
}

/* --- Карточки заявок ------------------------------------------------------
   Упаковщик выбирает заявку по составу и таймслоту, а не по номеру, поэтому
   карточка показывает всё сразу, а срочность видна цветом до чтения текста. */
.order-list { display: grid; gap: 12px; }

.order-card {
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
}

.order-card--idle { background: #fafafa; }
.order-card--now { border-left-color: var(--danger); }
.order-card--soon { border-left-color: var(--warn); }
.order-card--overdue { border-left-color: var(--danger); background: #fdf0ef; }
.order-card--spare, .order-card--none { border-left-color: var(--border); }

.order-card__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-card__head strong { font-size: 16px; }
.order-card__pick { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.order-card__pick input { width: 18px; height: 18px; }

.order-card__facts { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 10px 0 0; }
.order-card__facts div { min-width: 150px; }
.order-card__facts dt { font-size: 12px; color: var(--muted); }
.order-card__facts dd { margin: 0; }

.slot--now, .slot--overdue { color: var(--danger); font-weight: 600; }
.slot--soon { color: var(--warn); }

.badge--work { border-color: #b6ddc6; background: #eef8f2; color: var(--ok); }
.badge--shipped { border-color: #c9d6e8; background: #eff4fb; }
.badge--settlement { border-color: #efdcae; background: #fdf7e8; color: var(--warn); }

.table--tight { margin-top: 10px; font-size: 13px; }
.table--tight td, .table--tight th { padding: 4px 8px; }

/* --- Этикетки товара ------------------------------------------------------
   Вид повторяет наклейку из кабинета: код сверху, штрихкод, артикул и название
   под ним. На печати остаются только наклейки — по одной на страницу. */
.label {
    width: 90mm;
    padding: 4mm;
    margin: 0 0 6mm;
    border: 1px solid var(--border);
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    break-inside: avoid;
}

.label__code { font-size: 22px; letter-spacing: 0.5px; }
.label__bars svg { display: block; width: 100%; height: auto; }
.label__sku { font-size: 15px; margin-top: 2mm; }
.label__name { font-size: 13px; line-height: 1.25; }

/* Печать документов.

   Отчёт по сборке носят на разбирательство: его печатают и подшивают к спору.
   Значит с бумаги надо убрать всё, по чему нельзя нажать, и оставить документ.

   Правила наклеек здесь намеренно отсутствуют: размер страницы `@page`
   действует на весь документ, и лист 58×40 мм достался бы каждой печатаемой
   странице. Они живут в label-print.css и подключаются только на своём экране. */
@media print {
    @page { size: A4 portrait; margin: 12mm; }

    .no-print, header, nav, footer { display: none !important; }

    body { background: #fff; color: #000; font-size: 10.5pt; }
    .page { margin: 0; padding: 0; max-width: none; }

    /* Рамки и заливки на бумаге только съедают краску: на листе разделы
       и так разделены заголовками. */
    .panel {
        border: 0;
        box-shadow: none;
        padding: 0;
        margin: 0 0 6mm;
        break-inside: auto;
    }

    h1 { font-size: 15pt; margin: 0 0 3mm; }
    h2 { font-size: 12pt; margin: 0 0 2mm; }

    /* Заголовки таблицы повторяются на каждой странице: сканы занимают
       не один лист, и на втором без них непонятно, что за столбцы. */
    thead { display: table-header-group; }
    tr { break-inside: avoid; }

    .table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
    .table th, .table td { border-bottom: 1px solid #ccc; padding: 1mm 2mm; }

    a { color: inherit; text-decoration: none; }

    .label {
        border: 0;
        margin: 0;
        page-break-after: always;
    }
}

/* Карточка этикетки: слева наклейка как она есть, справа — что с ней делать. */
.label-card { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.label-card__actions { flex: 1; min-width: 260px; }
.label--preview { flex: 0 0 auto; }

/* Правила печати наклейки живут в label-print.css: размер страницы `@page`
   действует на весь документ, и отсюда он достался бы каждому печатаемому
   экрану — включая отчёт по сборке. */

/* Итог по товарам: нехватку видно цветом до чтения чисел. */
#summary .is-short { background: #fffaf0; }
#summary .is-short [data-testid="summary-remaining"] { color: var(--warn); font-weight: 600; }
#summary .is-complete [data-testid="summary-remaining"] { color: var(--ok); }
#summary .is-unexpected { background: #fdf0ef; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Количество операции правится прямо в строке: сто нажатий заменяет одно число. */
.operations-list li { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.operation-qty { width: 90px; padding: 4px 8px; font-size: 14px; }

/* Отчёт по сборке: документ для спора — читается сверху вниз и печатается. */
.report .facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 24px; margin: 0; }
.report .facts div { display: flex; gap: 8px; }
.report .facts dt { color: var(--muted); min-width: 190px; }
.report .facts dd { margin: 0; }

/* Выбор камер: их несколько, и отмечают все, что видят эту работу.
   Список в строку — камер на складе единицы, и колонка съедала бы высоту
   строки заявки, которую и без того просили сделать ниже. */
.camera-picker { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.camera-picker__item { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; font-size: 13px; }

/* Доступы сотрудника: роли, склады, поклажедатели и точки отгрузки правятся
   вместе. Свёрнуты по умолчанию — в списке пользователей главное не они,
   а кто ждёт подтверждения. */
.access { display: inline-block; }
.access > summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.access__form { display: flex; flex-direction: column; gap: 10px; padding: 12px 0 0; }
.access__group { display: flex; flex-direction: column; gap: 4px; }

/* Проверка сканера и поиск по коду: находка описывается по строкам
   «что это — откуда — где должно быть», и разметке хватает акцента на изъяне. */
.is-error { color: var(--danger, #b91c1c); font-weight: 600; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 12px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.history { list-style: none; padding: 0; margin: 8px 0; }
.history li { padding: 3px 0; border-bottom: 1px solid var(--line, #e4e7eb); }

/* ==========================================================================
   Главная страница

   У неё другая задача, чем у рабочих экранов: её читает клиент, который ещё
   ничего не выбрал. Поэтому разделы идут полосами во всю ширину окна, а не
   в колонке на 1100 пикселей — колонка живёт внутри полосы, а не наоборот.
   ========================================================================== */

.landing { padding: 0; }

/* Сообщения на главной всё же в колонке: во всю ширину они потеряли бы
   связь с содержимым. */
.landing > .alert { max-width: 1100px; margin: 16px auto; }

.hero {
    background: linear-gradient(180deg, #eef4fd 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}

.hero__inner,
.band__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 56px 20px;
}

.hero__inner {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 40px;
    align-items: start;
}

.hero__eyebrow {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}

.hero h1 { font-size: 34px; line-height: 1.2; margin: 0 0 16px; }
.hero__lead { font-size: 18px; color: var(--muted); margin: 0 0 24px; max-width: 40em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }

.button--large { padding: 12px 22px; font-size: 16px; }

.hero__card {
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.hero__card h2 { margin: 0 0 12px; font-size: 17px; }
.hero__card .facts { margin: 0; }

/* --- Полосы разделов --- */

.band { border-bottom: 1px solid var(--border); background: var(--bg); }
.band--accent { background: #eef4fd; }
.band--muted { background: var(--surface); }
.band__inner > h2 { margin-top: 0; font-size: 26px; }
.band__lead { color: var(--muted); max-width: 46em; margin: 0 0 24px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.split--reverse .figure { order: -1; }
.split h2 { margin-top: 0; }

/* --- Путь товара --- */

/* Шагов шесть, поэтому колонок три: при четырёх последний ряд остаётся
   наполовину пустым и выглядит как незаконченная вёрстка. */
.steps {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
}

.step {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
}

.step h3 { margin: 0 0 6px; font-size: 16px; }
.step p { margin: 0; font-size: 14px; color: var(--muted); }

/* --- Карточки услуг и кабинета --- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}

.cards--tight { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

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

.card h3 { margin: 0 0 4px; font-size: 16px; }
.card p { margin: 0; font-size: 14px; color: var(--muted); }

.card__unit {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

/* --- Схемы ---------------------------------------------------------------
   Рисуются разметкой, а не картинкой: подписи в них ищут поиском по странице,
   читают с экрана чтения и переводят вместе с остальным текстом. */

.figure { width: 100%; height: auto; color: var(--muted); }
.figure__box rect { fill: var(--surface); stroke: var(--border); stroke-width: 1; }
.figure__box text { fill: var(--text); font-size: 14px; font-weight: 600; text-anchor: middle; }
.figure__box--strong rect { fill: #eef4fd; stroke: var(--accent); }
.figure__box text.figure__small { fill: var(--muted); font-size: 11px; font-weight: 400; }
.figure__link { fill: none; stroke: var(--muted); stroke-width: 1.5; }

.storage { margin: 28px 0 0; }
.storage figcaption { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.storage svg { width: 100%; max-width: 460px; height: auto; }
.storage text { text-anchor: middle; font-size: 13px; fill: var(--text); }
.storage__free rect { fill: #eef8f2; stroke: #b6ddc6; }
.storage__paid rect { fill: var(--surface); stroke: var(--border); }
.storage text.storage__label { font-size: 11px; fill: var(--muted); }
.storage text.storage__label--free { fill: var(--ok); font-weight: 600; }

.facts--large dd { font-size: 17px; }

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

.footer { background: var(--surface); border-top: 1px solid var(--border); }

.footer__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: space-between;
}

.footer__inner p { margin: 4px 0 0; }

.footer__contacts {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-style: normal;
    font-size: 14px;
    color: var(--muted);
    text-align: right;
}

.topbar__phone { font-weight: 600; text-decoration: none; }

/* ==========================================================================
   Адаптивность

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

img, svg { max-width: 100%; }

@media (max-width: 900px) {
    .hero__inner { grid-template-columns: 1fr; gap: 28px; }
    .split { grid-template-columns: 1fr; gap: 24px; }
    /* Схема встаёт под текст всегда: обратный порядок имеет смысл только рядом. */
    .split--reverse .figure { order: 0; }
    .figure { max-width: 420px; }
    .hero h1 { font-size: 28px; }
    .hero__inner, .band__inner { padding: 40px 18px; }
}

@media (max-width: 640px) {
    .topbar { gap: 10px 14px; padding: 10px 14px; }
    .topbar__brand { font-size: 16px; }
    .topbar__nav { gap: 12px; font-size: 14px; }
    .topbar__user { gap: 10px; flex-wrap: wrap; }

    .page { padding: 18px 14px 44px; }
    .hero__inner, .band__inner { padding: 32px 14px; }

    h1, .hero h1 { font-size: 22px; }
    h2, .band__inner > h2 { font-size: 18px; }
    .hero__lead { font-size: 16px; }

    /* Кнопка во всю ширину: пальцем в неё попадают, не целясь. */
    .hero__actions { flex-direction: column; align-items: stretch; }
    .hero__actions .button { text-align: center; }

    /* Широкая таблица прокручивается внутри себя, а не растягивает страницу
       вместе со всем остальным. */
    .table { display: block; overflow-x: auto; }

    /* Ряд полей в строку не помещается — ставим их друг под друга. */
    .form--row { flex-direction: column; align-items: stretch; }
    .field--narrow, .field--grow { flex: 1 1 auto; }
    .form { padding: 16px; }

    .facts { grid-template-columns: 1fr; gap: 2px 0; }
    .facts dt { margin-top: 8px; }

    .session-head { gap: 12px 20px; }
    .session-head strong { font-size: 16px; }

    .tiles { grid-template-columns: 1fr; }
    .steps, .cards, .cards--tight { grid-template-columns: 1fr; }

    .order-card__facts { gap: 6px 16px; }
    .order-card__facts div { min-width: 120px; }

    .footer__inner { flex-direction: column; gap: 16px; }
    .footer__contacts { text-align: left; }

    .filters { flex-wrap: wrap; gap: 8px 14px; }
    .barcode-list { gap: 6px; }
}

/* Совсем узкие экраны: поля сканирования крупные нарочно, но на 320 пикселях
   они вылезали за край вместе с формой. */
@media (max-width: 380px) {
    #cargo-barcode, #product-barcode { font-size: 17px; padding: 10px; }
    .button { padding: 8px 12px; font-size: 14px; }
    .table { font-size: 13px; }
}

/* ==========================================================================
   Сканирование камерой телефона

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

.button--camera { margin-top: 6px; align-self: flex-start; }

/* На широком экране камеры обычно нет, а место она занимает. Показываем её
   там, где ей и место, — на телефоне и планшете. */
@media (min-width: 901px) {
    .button--camera { display: none; }
}

.button--install { white-space: nowrap; }

.scanner {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    background: rgba(12, 18, 26, 0.94);
    color: #fff;
}

.scanner__box {
    position: relative;
    width: min(92vw, 520px);
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: var(--radius);
    background: #000;
}

.scanner__video { width: 100%; height: 100%; object-fit: cover; }

/* Рамка показывает, куда наводить: без неё код ловят серединой экрана
   и промахиваются. */
.scanner__frame {
    position: absolute;
    inset: 18% 12%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
}

.scanner__hint { margin: 0; font-size: 15px; text-align: center; max-width: 34em; }
.scanner .button { background: rgba(255, 255, 255, 0.14); color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.scanner .button:hover { background: rgba(255, 255, 255, 0.24); }

/* Кнопка камеры, когда камеры нет.
   Выглядит неактивной, но нажимается: по нажатию она объясняет причину.
   Настоящий disabled на телефоне молчал бы — подсказки при наведении там нет. */
.button--idle {
    color: var(--muted);
    background: var(--surface);
    border-color: var(--border);
    border-style: dashed;
}

.button--idle:hover { background: var(--surface); }

.scan-note { margin: 8px 0 0; font-size: 14px; }

/* Кнопки под видоискателем: «Повторить» появляется только после отказа. */
.scanner__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* Строка с ответом браузера: мелкая и приглушённая — она для разбора,
   а не для чтения у стеллажа. */
.scanner__debug {
    margin: 0;
    font-size: 12px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    color: rgba(255, 255, 255, 0.65);
    text-align: center;
}
