/* ============================================
   Onedayshop - Общий UI-кит
   Единые стили для всех страниц
   ============================================ */

/* Inter — единый шрифт сайта, подключается здесь (а не отдельным <link> на страницах),
   чтобы все страницы гарантированно его получали. Разрешено CSP style-src. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
    color-scheme: dark;
    /* Тёмная — нейтрально-чёрный фон, светлый текст, бирюзовый акцент */
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-card: #181818;
    --bg-card-hover: #242424;
    --bg-input: #141414;
    --text-primary: #ffffff;
    --text-secondary: #d4d4d4;
    --text-muted: #a3a3a3;
    --accent-primary: #2dd4bf;
    --accent-secondary: #5eead4;
    --accent: #2dd4bf;
    --accent-ink: #04211e;
    --accent-text: #2dd4bf;
    --success: #22c55e;
    --warning: #eab308;
    --error: #ef4444;
    --err: #ef4444;
    --info: #3b82f6;
    /* Фирменные цвета маркетплейсов — названия каналов в отчётах (DESIGN.md §4.4) */
    --mp-wb: #e04fc7;   /* было #c026b0 — 3.5:1 на тёмном */
    --mp-ozon: #3b82f6;
    --mp-kit: #fc3f1d;
    /* Честный Знак — жёлтый по умолчанию (решение 21.10.2026, DESIGN.md §4) */
    --chz-bg: #ffd60a;
    --chz-bg-hover: #f2c200;
    --chz-fg: #241a00;
    /* Кнопки — по функции, а не одним акцентом (20.10.2026) */
    --btn-primary-bg: #2563eb;
    --btn-primary-bg-hover: #1d4ed8;
    --btn-success-bg: #15803d;
    --btn-success-bg-hover: #166534;
    --btn-warning-bg: #f59e0b;
    --btn-warning-fg: #2b1a00;
    --btn-warning-bg-hover: #d97706;
    --btn-danger-bg: #dc2626;
    --btn-danger-bg-hover: #b91c1c;
    --btn-neutral-bg: #1f1f1f;
    --btn-neutral-fg: #e5e7eb;
    --btn-neutral-border: #3a3a3a;
    --btn-neutral-bg-hover: #2a2a2a;
    --btn-excel-bg: #107c41;
    --btn-excel-bg-hover: #0b5c30;
    --btn-attention-bg: #c2410c;
    --btn-attention-bg-hover: #9a3412;
    --border-color: #333333;
    --border-strong: #504945;
    --focus-ring: 0 0 0 3px rgba(45, 212, 191, 0.25);
    --bg-hover: rgba(235, 219, 178, 0.06);
    --border-radius-sm: 10px;
    --border-radius-md: 14px;
    --border-radius-lg: 18px;
    --border-radius-xl: 24px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.34);
    --shadow-lg: 0 14px 44px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.35);
    --row-even-bg: rgba(235, 219, 178, 0.03);
    --row-hover-bg: rgba(235, 219, 178, 0.06);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --nav-height: 56px;
    /* Границы контента — общие для навбара и страниц, чтобы края совпадали.
       --content-inner — колонка внутри отступов: кнопки навбара и текст страниц
       встают на одни вертикали на любой ширине экрана. */
    --content-max: 1400px;
    --content-pad: 24px;
    --content-inner: calc(var(--content-max) - 2 * var(--content-pad));
    /* Шкала для 2.0: один ритм отступов и три размера текста — новые компоненты
       берут только эти значения (DESIGN §2). Старые правила переводим постепенно. */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --fs-page: 22px;
    --fs-card: 15px;
    --fs-body: 13.5px;
    --fs-small: 12.5px;
    --fs-caption: 11px;
}

/* Светлая тема — холодный нейтральный холст + бирюзовый акцент (замена сиреневого, 21.10.2026).
   Референсы: Linear (light), GitHub Primer, Vercel Geist, Radix Colors.
   Правила: текст — почти чёрный, поверхности — лесенка белый → #f4f6f9,
   границы контролов отдельным токеном --border-strong, семантика затемнена до AA. */
[data-theme="light"] {
    color-scheme: light;
    --bg-primary: #f5f5f6;
    --bg-secondary: #ededef;
    --bg-card: #ffffff;
    --bg-card-hover: #f7f7f8;
    --bg-input: #ffffff;
    --text-primary: #0d1117;
    --text-secondary: #313846;
    --text-muted: #5b6472;
    --accent-primary: #2dd4bf;
    --accent-secondary: #0f766e;
    --accent: #2dd4bf;
    --accent-ink: #04211e;
    --accent-text: #0f766e;
    /* семантика затемнена по тону: яркие цвета тёмной темы на белом не проходят AA */
    --success: #067647;
    --warning: #b54708;
    --error: #b42318;
    --err: #b42318;
    --info: #175cd3;
    /* на белом фирменные цвета затемнены до AA */
    --mp-wb: #b5179e;
    --mp-ozon: #005bff;
    --mp-kit: #c23417;
    --chz-bg: #ffd60a;
    --chz-bg-hover: #f2c200;
    --chz-fg: #241a00;
    --btn-primary-bg: #1d4ed8;
    --btn-primary-bg-hover: #1e40af;
    --btn-success-bg: #15803d;
    --btn-success-bg-hover: #166534;
    --btn-warning-bg: #f5b301;
    --btn-warning-fg: #2b1a00;
    --btn-warning-bg-hover: #d99a00;
    --btn-danger-bg: #b42318;
    --btn-danger-bg-hover: #912018;
    --btn-neutral-bg: #ffffff;
    --btn-neutral-fg: #313846;
    --btn-neutral-border: #cfd6e0;
    --btn-neutral-bg-hover: #f3f5f9;
    --btn-excel-bg: #107c41;
    --btn-excel-bg-hover: #0b5c30;
    --btn-attention-bg: #b93815;
    --btn-attention-bg-hover: #9a2c10;
    --border-color: #e4e4e7;
    --border-strong: #d4d4d8;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 16px 44px rgba(16, 24, 40, 0.16);
    --shadow-hover: 0 4px 12px rgba(16, 24, 40, 0.08);
    --row-even-bg: #fbfbfc;
    --row-hover-bg: #f4f4f5;
    --bg-hover: #f4f4f5;
    --focus-ring: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

/* Кнопка «Назад» в навбаре (инжектится common.js на всех страницах, кроме главной).
   Ведёт на предыдущий уровень: data-nav-link на <body> или главную.
   Вид: пилюля «кружок со стрелкой + Назад», целиком на CSS/SVG, без картинок (владелец, 21.10.2026).
   Тёмная и светлая темы оформлены отдельно: тёмная — плашка на просвет, светлая — белая
   пилюля с тенью (по макету владельца); кружок со стрелкой темнее/светлее фона плашки. */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 4px 16px 4px 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 999px;
    box-shadow: 1px 1px 2px -1px rgba(0, 0, 0, 0.45);
    color: #f4f4f5;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.18);
}

.back-link:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

.back-link .back-arrow-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10);
    flex-shrink: 0;
}

.back-link .back-arrow { width: 18px; height: 18px; }

/* Светлая тема: белая пилюля, серая «таблетка» под стрелкой, тёмный текст */
[data-theme="light"] .back-link {
    background: #fff;
    border-color: #e4e4e7;
    box-shadow: 1px 1px 2px -1px rgba(16, 24, 40, 0.25);
    color: #18181b;
}

[data-theme="light"] .back-link:hover {
    background: #fff;
    border-color: #d4d4d8;
    box-shadow: 2px 2px 2px -2px rgba(16, 24, 40, 0.20);
}

[data-theme="light"] .back-link .back-arrow-box { background: #f1f1f3; }

@media (max-width: 560px) {
    .back-link { height: 36px; gap: 8px; padding: 3px 12px 3px 3px; font-size: 12px; }
    .back-link .back-arrow-box { width: 30px; height: 30px; }
    .back-link .back-arrow { width: 16px; height: 16px; }
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-y: auto;
    scrollbar-gutter: stable;
    color-scheme: dark;   /* нативные чекбоксы/селекты/календарь — в тон тёмной темы */
}

[data-theme="light"] { color-scheme: light; }

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Сброс браузерных обводок фокуса (кастомный фокус — у .back-link/.section-card через :focus-visible).
   НЕ глушим border/box-shadow на :hover/:focus — иначе у полей и карточек пропадает рамка
   при наведении/фокусе (см. docs/DESIGN.md §11.1). */
*:focus, *:hover, *:active {
    outline: none !important;
    outline-offset: 0 !important;
}
/* Видимый фокус клавиатуры — один на весь сайт (11.11.2026: !important на :focus-visible
   убивал и это правило, и локальные — Tab был невидим в тёмной теме). */
*:focus-visible {
    outline: 2px solid var(--accent-primary) !important;
    outline-offset: 2px !important;
}

* {
    -webkit-tap-highlight-color: transparent;
    transition: none !important;
}

.table, .table tr, .table td, .table th {
    outline: none !important;
    box-shadow: none !important;
}

/* Фон — ровный, без ambient-градиента (владелец: углы не должны светлеть). */

/* --- Navbar --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--nav-height);
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 var(--content-pad);
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: var(--content-inner);
    margin: 0 auto;
    gap: 24px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.navbar-logo {
    width: 32px;
    height: 32px;
    background: var(--accent-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-ink);
}

.navbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    flex: 1;
    justify-content: center;
}

.navbar-link {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.navbar-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.navbar-link.active {
    color: var(--text-primary);
    background: rgba(45, 212, 191, 0.12);
    box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.25);
}

[data-theme="light"] .navbar-link:hover { background: #f1f1f3; }

[data-theme="light"] .navbar-link.active {
    background: #e8faf6;
    box-shadow: inset 0 0 0 1px #b6e8dd;
}

.navbar-link-icon {
    font-size: 14px;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.navbar-date {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    box-shadow: 1px 1px 2px -1px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.15s;
}

.theme-btn:hover {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--text-muted);
    box-shadow: 3px 3px 3px -2px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .theme-btn {
    background: #fff;
    border-color: #e4e4e7;
    box-shadow: 1px 1px 2px -1px rgba(16, 24, 40, 0.25);
}

[data-theme="light"] .theme-btn:hover {
    border-color: #d4d4d8;
    box-shadow: 3px 3px 3px -2px rgba(16, 24, 40, 0.25);
}

.navbar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    box-shadow: 1px 1px 2px -1px rgba(0, 0, 0, 0.5);
}

.navbar-toggle:hover {
    background: var(--bg-input);
}

[data-theme="light"] .navbar-toggle {
    background: #fff;
    border-color: #e4e4e7;
    box-shadow: 3px 3px 3px -2px rgba(16, 24, 40, 0.25);
}

/* --- Container --- */
.container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--content-pad);
}

/* Единый каркас страницы (дизайн 2.0): заголовок + подпись + действия справа.
   Разметка: <div class="page-head"><div><h1>…</h1><p class="page-sub">…</p></div>
   <div class="page-head-actions">кнопки</div></div> */
.page-head {
    display: flex; align-items: flex-end; gap: var(--space-3);
    flex-wrap: wrap; margin: 0 0 var(--space-4);
}
.page-head h1 { margin: 0; }
.page-sub { margin: 0; font-size: var(--fs-small); color: var(--text-muted); line-height: 1.45; }
.page-head-actions {
    margin-left: auto; display: flex; align-items: center;
    gap: var(--space-2); flex-wrap: wrap;
}

/* Контент страниц, свёрстанных без .container (FBS): те же края, что у навбара */
.main {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 20px var(--content-pad);
}

/* --- Заголовок страницы (DESIGN §2.3: 22px / 700) ---
   До 29.10.2026 правила в ките НЕ было: `h1` брал браузерный дефолт 32px, а 11 страниц
   лечили отступы инлайном (`style="margin:0 0 4px"`). Свои размеры оставляют только
   `.section-header h1` (витрина разделов) и `.hdr h1` (FBS-шасси) — они специфичнее. */
h1 {
    font-size: var(--fs-page);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0 0 12px;
    color: var(--text-primary);
}

/* Заголовок без подписи под ним — отступ короче (был инлайн-хак `margin:0 0 4px`) */
h1 + p { margin-top: 0; }

.container-narrow {
    max-width: 800px;
}

/* --- Panel (универсальная карточка) ---
   До 12.10.2026 `.panel` был описан только в fbs.css: на остальных страницах (55 вхождений,
   в том числе почти все модалки — `/wh`, `/inventory`, `/kiz`, `/admin`, `/mp-stock`) у карточки
   не было фона, и она сливалась с затемнением backdrop. Перенёс в кит.
   Если панель лежит внутри `.modal-overlay` — это уже модалка: приподнятая карточка с тенью. */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-4);
    margin-bottom: 12px;
    color: var(--text-primary);
}

.panel h3 { font-size: var(--fs-card); margin-bottom: 8px; }
.panel .meta { font-size: 12px; color: var(--text-muted); }

.modal-overlay > .panel {
    margin-bottom: 0;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

/* --- Аккордеон (<details>) ---
   Штатный способ свернуть длинные списки (отчёты, группы позиций): работает без JS,
   клавиатурой и скринридером. Стрелка и hover — как у строк групп в таблицах. */
.acc {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
}

.acc > summary {
    cursor: pointer;
    padding: 10px 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    user-select: none;
}

.acc > summary::-webkit-details-marker { display: none; }

.acc > summary::before {
    content: "▸";
    color: var(--text-muted);
    transition: transform var(--transition-fast, 0.12s);
    display: inline-block;
}

.acc[open] > summary::before { content: "▾"; }
.acc > summary:hover { background: var(--bg-hover); }
.acc > .acc-body { padding: 0 12px 10px; }

/* --- Cards --- */
/* Модификаторы панели вместо локальных `.panel{...}` в страницах (§11.3). */
.panel-flush { padding: 0; }
.panel-tight { padding: 14px; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-4);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: rgba(45, 212, 191, 0.3);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}



.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
}

/* --- Buttons ---
   Форма у всех одна: пилюля «кружок с иконкой + подпись» (решение владельца 21.10.2026).
   Кружок наполняет common.js (`.btn-ico`): эмодзи из начала подписи или <img class="ch-ico">.
   Кнопка без иконки — пилюля без кружка; icon-only — круг того же размера. */
.btn {
    --btn-tone: 0, 0, 0;
    --btn-ico-bg: rgba(255, 255, 255, 0.12);
    --btn-ico-ring: rgba(255, 255, 255, 0.16);
    --btn-sh: 2px 2px 2px -2px rgba(var(--btn-tone), 0.60), 0 1px 1px rgba(0, 0, 0, 0.25);
    --btn-sh-h: 3px 3px 3px -2px rgba(var(--btn-tone), 0.65), 0 1px 1px rgba(0, 0, 0, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 40px;
    padding: 0 16px;
    background: var(--btn-neutral-bg);
    color: var(--btn-neutral-fg);
    border: 1px solid var(--btn-neutral-border);
    border-radius: 999px;
    box-shadow: var(--btn-sh);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover:not(:disabled) { box-shadow: var(--btn-sh-h); }

/* есть кружок — подпись стоит вплотную к нему; кнопка без подписи — круг */
.btn:has(> .btn-ico) { padding: 4px 16px 4px 4px; }
.btn.btn-only { width: 40px; padding: 4px; }
.btn-only .btn-ico { font-size: 17px; }

.btn-ico {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--btn-ico-bg);
    box-shadow: inset 0 0 0 1px var(--btn-ico-ring);
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
}

.btn-ico img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    border: 0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Цвет кнопки = функция: синий — основное действие, зелёный — сохранить/экспорт,
   жёлтый — сброс, оранжевый — «требует внимания», красный — удалить/отменить,
   серый — настройки/история/второстепенное. */
.btn-primary,
.btn-p {
    background: var(--btn-primary-bg);
    color: #fff;
    border-color: transparent;
}

.btn-primary:hover:not(:disabled),
.btn-p:hover:not(:disabled) {
    background: var(--btn-primary-bg-hover);
}

.btn-secondary,
.btn-s {
    background: var(--btn-neutral-bg);
    color: var(--btn-neutral-fg);
    border: 1px solid var(--btn-neutral-border);
}

.btn-secondary:hover:not(:disabled),
.btn-s:hover:not(:disabled) {
    background: var(--btn-neutral-bg-hover);
}

.btn-success,
.btn-g,
.btn-save {
    background: var(--btn-success-bg);
    color: #fff;
    border-color: transparent;
}

.btn-success:hover:not(:disabled),
.btn-g:hover:not(:disabled),
.btn-save:hover:not(:disabled) {
    background: var(--btn-success-bg-hover);
}

.btn-danger,
.btn-r,
.btn-cancel {
    background: var(--btn-danger-bg);
    color: #fff;
    border-color: transparent;
}

.btn-danger:hover:not(:disabled),
.btn-r:hover:not(:disabled),
.btn-cancel:hover:not(:disabled) {
    background: var(--btn-danger-bg-hover);
}

.btn-info {
    background: var(--btn-primary-bg);
    color: #fff;
    border-color: transparent;
}

.btn-info:hover:not(:disabled) {
    background: var(--btn-primary-bg-hover);
}

.btn-w {
    background: var(--btn-warning-bg);
    color: var(--btn-warning-fg);
    border-color: transparent;
}

.btn-w:hover:not(:disabled) {
    background: var(--btn-warning-bg-hover);
}

.btn-attention {
    background: var(--btn-attention-bg);
    color: #fff;
    border-color: transparent;
}

.btn-attention:hover:not(:disabled) {
    background: var(--btn-attention-bg-hover);
}

.btn-excel,
.btn-xlsx {
    background: var(--btn-excel-bg);
    color: #fff;
    border-color: transparent;
}

.btn-excel:hover:not(:disabled),
.btn-xlsx:hover:not(:disabled) {
    background: var(--btn-excel-bg-hover);
}

.btn-sm {
    height: 36px;
    padding: 0 14px;
    font-size: 12px;
}

.btn-sm:has(> .btn-ico) { padding: 3px 14px 3px 3px; }
.btn-sm.btn-only { width: 36px; padding: 3px; }
.btn-sm .btn-ico { width: 30px; height: 30px; font-size: 13px; }
.btn-sm .btn-ico img { width: 16px; height: 16px; }

.btn-lg {
    height: 48px;
    padding: 0 22px;
    font-size: 15px;
}

.btn-lg:has(> .btn-ico) { padding: 5px 22px 5px 5px; }
.btn-lg .btn-ico { width: 38px; height: 38px; font-size: 17px; }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
}

/* Кружок светлее фона кнопки + кольцо: на цветных кнопках он иначе сливается
   с фоном (жалоба владельца 21.10.2026 — зелёный Excel). */
.btn-primary, .btn-p, .btn-info,
.btn-success, .btn-g, .btn-save,
.btn-danger, .btn-r, .btn-cancel,
.btn-excel, .btn-xlsx, .btn-attention,
.btn-green, .btn-cyan, .btn-blue, .btn-teal, .btn-slate, .btn-red, .btn-amber {
    --btn-ico-bg: rgba(255, 255, 255, 0.34);
    --btn-ico-ring: rgba(255, 255, 255, 0.45);
}

.btn-w {
    --btn-ico-bg: rgba(0, 0, 0, 0.20);
    --btn-ico-ring: rgba(0, 0, 0, 0.22);
}

/* Тень — в тон кнопки (rgba(var(--btn-tone))); у нейтральной она чёрная */
.btn-p, .btn-primary, .btn-info { --btn-tone: 37, 99, 235; }
.btn-g, .btn-success, .btn-save { --btn-tone: 22, 163, 74; }
.btn-r, .btn-danger, .btn-cancel { --btn-tone: 220, 38, 38; }
.btn-w { --btn-tone: 245, 158, 11; }
.btn-excel, .btn-xlsx { --btn-tone: 16, 124, 65; }
.btn-attention { --btn-tone: 194, 65, 12; }


/* --- Inputs --- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Поля и селекты — «углублённые»: прямоугольник с мягким скруглением (12px), 38px и
   внутренняя тень. Форма и тень отличают их от кнопок-пилюль (жалоба владельца 21.10.2026). */
.form-input,
.form-select {
    width: 100%;
    height: 38px;
    padding: 0 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong, var(--border-color));
    border-radius: 12px;
    box-shadow: inset 1px 1px 2px -1px rgba(0, 0, 0, 0.45);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 400;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong, var(--border-color));
    border-radius: 12px;
    box-shadow: inset 1px 1px 2px -1px rgba(0, 0, 0, 0.45);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 13px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea {
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.08);
}

/* Селект — уже поля ввода (ширина по содержимому) и со своей стрелкой: по форме видно,
   что это выпадающий список, а не поле и не кнопка */
select,
select.form-input,
.form-select {
    width: auto;
    min-width: 120px;
    max-width: 240px;
    padding-right: 34px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    font-weight: 500;
}

select[style*="width"],
.form-select[style*="width"] { max-width: none; }

[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]),
[data-theme="light"] select,
[data-theme="light"] textarea {
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.08);
}

/* Поле поиска/фильтра — с лупой слева (класс ставит common.js по placeholder/id).
   !important: FBS-правило `input:not([type=…])` перебивает класс по специфичности и сбрасывает фон */
.has-lupa {
    padding-left: 38px !important;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b8b93' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.6-3.6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: left 14px center !important;
}

/* Чекбоксы и радиокнопки: цвет акцента, размер как у кнопок-иконок */
input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
    flex-shrink: 0;
    vertical-align: -3px;
}

/* Плейсхолдеры — цветом --text-muted (браузерный default в светлой теме слишком бледный) */
.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Обёртка таблиц с горизонтальной прокруткой на узких экранах.
   Имя .w — историческое (используется на FBS/ЧЗ-страницах).
   На FBS-страницах локальные правила добавляют рамку; здесь — обязательный скролл. */
.w {
    overflow-x: auto;
}

/* --- Tables --- */
/* Обёртка = «окно» таблицы: шапка липкая, тело скроллится в обоих направлениях.
   max-height не задаёт высоту, а ограничивает: короткая таблица выглядит как раньше. */
.table-wrapper {
    overflow: auto;
    max-height: calc(100vh - 240px);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}
.table-wrapper > table { margin: 0; }
.table-wrapper thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--bg-card);
    box-shadow: inset 0 -1px 0 var(--border-color);
}

/* Прокручиваемая область таблицы: шапка остаётся на месте, тело скроллится
   по вертикали и горизонтали. Для длинных списков (остатки — тысячи строк). */
.table-scroll {
    padding: 0;
    overflow: auto;
    max-height: calc(100vh - 240px);
}
.table-scroll table { margin: 0; }
.table-scroll thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--bg-card);
    box-shadow: inset 0 -1px 0 var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    background: var(--bg-secondary);
    padding: 10px 16px;
    text-align: left;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-fast);
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table th:hover,
.table th:active,
.table th:focus {
    color: var(--text-secondary) !important;
    background: var(--bg-secondary) !important;
    outline: none !important;
}

/* Индикатор направления сортировки. Три имени в ходу: `.sort-icon` и `.sort-ind` (страницы
   ЧЗ и склад — см. §5.4), `.si` (краткий, страницы с таблицами). Стилизованы одинаково;
   селектор — `.table` (кит) и `table` вообще: `/inventory` и FBS рисуют свои таблицы
   (`.wh-table`, голый `table`), и стрелки там тоже нужны.
   До 29.10.2026 `.sort-ind` не был определён вообще, а `.si` жил только в `fbs.css`
   (на `/inventory` стрелки не имели стилей). */
.table th .sort-icon,
.table th .sort-ind,
.table th .si,
.wh-table th .si,
th[data-sort] .si {
    margin-left: 6px;
    opacity: 0.4;
    font-size: 12px;
}

.table th.sorted .sort-icon,
.table th.sorted .sort-ind,
.table th .si:not(:empty),
.wh-table th .si:not(:empty),
th[data-sort] .si:not(:empty) {
    opacity: 1;
    color: var(--accent-text);
}

/* Строка-ссылка: клик по всей строке (раскрытие группы, переход в карточку). Класс ставит
   страница на <tr>; до 29.10.2026 жил только в локальных <style> отдельных страниц. */
.table tbody tr.rowlink { cursor: pointer; }

/* Столбец без сортировки: заголовок не реагирует на клик (кит красит все `th` как сортируемые) */
.table th.nosort { cursor: default; }

.table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tbody tr {
    transition: all 0.2s ease;
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
}

.table tbody tr:nth-child(even),
.table tbody tr:nth-child(odd) {
    background: transparent !important;
}

.table tbody tr:nth-child(even):hover,
.table tbody tr:nth-child(odd):hover {
    background: transparent !important;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: 1px 1px 2px -1px rgba(0, 0, 0, 0.45);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 3px 3px 3px -2px rgba(0, 0, 0, 0.5);
}

.pagination-btn.active {
    background: var(--btn-primary-bg);
    border-color: transparent;
    color: white;
    box-shadow: 2px 2px 2px -2px rgba(37, 99, 235, 0.55);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 12px;
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    top: calc(var(--nav-height) + 16px);
    right: 24px;
    z-index: 10001;   /* выше .modal-overlay (10000): тост скана не прячется за модалкой */
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 420px;
    pointer-events: auto;
    animation: toastSlideIn 0.2s ease;
    backdrop-filter: blur(16px);
}

.toast.toast-exit {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-close {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-success .toast-icon { color: var(--success); }

.toast.toast-error { border-left: 4px solid var(--error); }
.toast.toast-error .toast-icon { color: var(--error); }

.toast.toast-warning { border-left: 4px solid var(--warning); }
.toast.toast-warning .toast-icon { color: var(--warning); }

.toast.toast-info { border-left: 4px solid var(--info); }
.toast.toast-info .toast-icon { color: var(--info); }

/* --- Skeleton Loading --- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--border-radius-sm);
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 24px;
    width: 40%;
    margin-bottom: 16px;
}

.skeleton-table-row {
    height: 48px;
    margin-bottom: 1px;
}

.skeleton-card {
    height: 200px;
    border-radius: var(--border-radius-lg);
}

/* --- Status Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;   /* AA на тинте: #ef4444 давал 4.03 */
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;   /* AA на тинте: #3b82f6 давал 4.04 */
}

.badge-muted {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

/* Возраст заказа на FBS-страницах: плашка «цвет + тинт + рамка» вместо
   просто цветного текста — индикация читается с одного взгляда (19.10.2026). */
.ago {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 7px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ago-ok   { background: rgba(34, 197, 94, 0.16);  color: #4ade80; border-color: rgba(74, 222, 128, 0.35); }
.ago-warn { background: rgba(234, 179, 8, 0.16);  color: #facc15; border-color: rgba(250, 204, 21, 0.35); }
.ago-risk { background: rgba(249, 115, 22, 0.16); color: #fb923c; border-color: rgba(251, 146, 60, 0.38); }
.ago-late { background: rgba(239, 68, 68, 0.16);  color: #f87171; border-color: rgba(248, 113, 113, 0.38); }

/* --- Progress Bar --- */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 4px;
    transition: width var(--transition-normal);
}

/* --- Утилиты страниц (были копиями в <style> восьми страниц ЧЗ/ФБО с разным размером
       и палитрой — 12.10.2026 свёл в кит, см. docs/DESIGN.md §5.7) --- */
.mono {
    font-family: monospace;
    font-size: 12px;
    word-break: break-all;
}

.muted {
    color: var(--text-muted);
    font-size: 12px;
}

/* отрицательное/проблемное число в таблице */
.miss,
.neg {
    color: var(--error);
    font-weight: 600;
}

/* треугольник/шеврон раскрытия группы в таблице */
.caret {
    display: inline-block;
    width: 16px;
    color: var(--text-muted);
}

/* числа в таблице: по правому краю, моноширинные цифры, не переносим */
.table td.num,
.table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-4) var(--space-5);
}

/* Скелетон загрузки: пока данных нет — полосы-заглушки вместо «…» и пустых карточек */
.skeleton {
    position: relative; overflow: hidden;
    background: var(--bg-hover); border-radius: var(--border-radius-sm);
}
.skeleton::after {
    content: ''; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent);
    animation: skel 1.4s infinite;
}
@keyframes skel { 100% { transform: translateX(100%); } }
.sk-value { height: 24px; width: 60%; margin-bottom: 10px; }
.sk-label { height: 10px; width: 45%; }
/* Строки-заглушки в tbody, пока список грузится: JS заменяет их данными */
.skeleton-row td { padding: 11px 10px; }
.skeleton-row .skeleton { height: 12px; }
.skeleton-row:nth-child(even) .skeleton { width: 80%; }
@media (prefers-reduced-motion: reduce) {
    .skeleton::after { animation: none; }
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Компактный ряд KPI: 6+ баннеров в одну строку (12.10.2026, /chz-balance — семь карточек
   не влезали в 1400px и переносились на вторую строку). `flex:1 1 0` — все делят ширину
   поровну и переносятся только когда совсем узко. */
.stats-grid.kpi {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.stats-grid.kpi .stat-card {
    flex: 1 1 0;
    min-width: 108px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
}

.stats-grid.kpi .stat-value {
    font-size: 18px;
    margin-bottom: 0;
}

.stats-grid.kpi .stat-label {
    font-size: 10px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-change {
    font-size: 12px;
    margin-top: 8px;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--error); }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-desc {
    font-size: 14px;
}

/* --- Toolbar --- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar-spacer {
    flex: 1;
}

/* Полоса над пагинацией: «Показывать: 100 / 200 / Все» (сегменты размера страницы, §5.3).
   До 29.10.2026 класс использовался на 4 страницах, а определён был только в `<style>`
   двух из них (`mp-stock`, `unit-econ`) — на `prices`/`dims-report` полоса не имела стилей. */
.pager-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

.toolbar-search {
    position: relative;
    min-width: 240px;
}

.toolbar-search .form-input {
    padding-left: 36px;
}

.toolbar-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* --- Charts Container --- */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    height: 320px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
}

.chart-canvas {
    width: 100%;
    height: 240px;
    flex: 1;
}

/* --- Theme Toggle --- */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
}

.theme-toggle input {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 22px;
    background: var(--accent-primary);
    border-radius: 11px;
    position: relative;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-normal);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.theme-toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --nav-height: 56px;
        --content-pad: 16px;
    }

    .navbar-toggle {
        display: inline-flex;
    }

    .navbar-nav {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 12px;
        gap: 4px;
    }

    .navbar-nav.open {
        display: flex;
    }

    .navbar-link {
        padding: 12px 16px;
        width: 100%;
    }

    .container {
        padding: var(--content-pad);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pagination {
        flex-wrap: wrap;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-search {
        min-width: 100%;
    }

    .table {
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 8px 12px;
    }

    .toast {
        min-width: unset;
        max-width: calc(100vw - 48px);
    }

    .toast-container {
        right: 12px;
        left: 12px;
    }

    .navbar-date { display: none; }
    .navbar-inner { gap: 8px; }
    .navbar-brand { gap: 8px; }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* --- Print --- */
/* --- User Menu Dropdown --- */
.user-menu-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 4px 12px 4px 4px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: 1px 1px 2px -1px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    font-family: var(--font-family);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.user-menu-trigger:hover {
    border-color: var(--accent-primary);
    box-shadow: 3px 3px 3px -2px rgba(0, 0, 0, 0.5);
}
.user-menu-trigger .user-avatar {
    width: 30px;
    height: 30px;
    background: var(--accent-primary);
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.40);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-ink);
    flex-shrink: 0;
}

[data-theme="light"] .user-menu-trigger {
    background: #fff;
    border-color: #e4e4e7;
    box-shadow: 1px 1px 2px -1px rgba(16, 24, 40, 0.25);
}

[data-theme="light"] .user-menu-trigger:hover {
    border-color: #d4d4d8;
    box-shadow: 3px 3px 3px -2px rgba(16, 24, 40, 0.25);
}
.user-menu-trigger .user-name {
    font-weight: 500;
}
.user-menu-trigger .user-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}
.user-menu-trigger.open .user-arrow {
    transform: rotate(180deg);
}
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    z-index: 1001;
    animation: dropdownIn 0.15s ease;
}
.user-menu-dropdown.open {
    display: block;
}
@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition-fast);
    background: none;
    border: none;
    width: 100%;
    font-family: var(--font-family);
    text-align: left;
}
.user-menu-item:hover {
    background: var(--bg-input);
}
.user-menu-item-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.user-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 8px;
}
.user-menu-item.logout {
    color: var(--error);
}

/* --- Modal ---
   Канонический класс открытия — .on (см. docs/DESIGN.md §5.6).
   Исторические варианты .hidden (обратный) и .show сведены к .on. */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.on { display: flex; }

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 28px;
    width: 90%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

/* Широкая модалка (таблицы, длинные списки). До 29.10.2026 правило копировалось в <style>
   четырёх страниц ЧЗ с разной шириной (860/900/940) — теперь одна ширина по умолчанию,
   своя задаётся переменной: `<div class="modal-content wide" style="--modal-wide:940px">`. */
.modal-content.wide {
    max-width: var(--modal-wide, 900px);
    max-height: 88vh;
    overflow: auto;
}

@keyframes modalIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.login-modal {
    text-align: center;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: var(--accent-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: var(--accent-ink);
    margin: 0 auto 16px;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.login-form {
    text-align: left;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    margin-top: 8px;
}

.login-error {
    color: var(--error);
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--border-radius-sm);
    margin-bottom: 12px;
}

/* --- Footer --- */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 24px;
    text-align: center;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.footer-text {
    font-size: 13px;
    color: var(--text-muted);
}
.footer-text a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
.footer-text a:hover {
    color: var(--accent-text);
}

@media print {
    .navbar,
    .toast-container,
    .toolbar,
    .pagination {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* --- Сегментные переключатели (кнопки-фильтры: одна активная) -------------------------------
   Используются на страницах отчётов: «Остатки на МП» (/mp-stock), «Сравнение ТНВЭД».
   Разметка: <div class="filters"><span class="flt-cap">Подпись:</span><div class="seg">
   <button class="seg-btn" data-x="v">Текст</button>…</div></div>; активная — класс .active
   (переключается в JS). См. docs/DESIGN.md §«Сегментные переключатели». */
.filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.filters .flt-cap {
    font-size: 12px;
    color: var(--text-muted);
}

/* Название маркетплейса в фильтрах — фирменным цветом и жирным (DESIGN.md §4.4) */
.filters .flt-cap.mp-wb { color: var(--mp-wb); font-weight: 700; }
.filters .flt-cap.mp-ozon { color: var(--mp-ozon); font-weight: 700; }
.filters .flt-cap.mp-kit { color: var(--mp-kit); font-weight: 700; }

/* Сегменты-фильтры — те же пилюли, ниже и без кружка (текст-фильтр) */
.seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.seg-btn {
    height: 32px;
    padding: 0 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: 1px 1px 2px -1px rgba(0, 0, 0, 0.45);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.seg-btn:hover {
    background: var(--bg-hover, rgba(255, 255, 255, .06));
    color: var(--text-primary);
}

.seg-btn.active {
    background: var(--btn-primary-bg);
    border-color: transparent;
    color: #fff;
    box-shadow: 2px 2px 2px -2px rgba(37, 99, 235, 0.55);
}

.seg-btn.active:hover {
    background: var(--btn-primary-bg-hover);
    color: #fff;
}

/* ============================================
   Светлая тема — компоненты
   Токены мало: на белом нужны свои границы, тени, зебры и фокус.
   Референсы: Linear light (ring + lift вместо тяжёлой тени), Primer
   (border-strong для контролов, muted-фон шапок), Radix (AA-семантика).
   ============================================ */

[data-theme="light"] body {
    background-image: linear-gradient(180deg, #ffffff 0, rgba(255, 255, 255, 0) 280px);
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.88);
    border-bottom-color: var(--border-color);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

[data-theme="light"] .navbar-logo {
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.28);
}

/* Акцентная планка у заголовка страницы — верх полосы не выглядит пустым */
[data-theme="light"] .container > h1:first-child::before,
[data-theme="light"] .prod-head h1::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 0.9em;
    margin-right: 10px;
    border-radius: 4px;
    background: var(--fb, var(--accent-primary));
    vertical-align: -0.06em;
}

/* --- Карточки разделов (главная/витрины) --- */
[data-theme="light"] .section-card {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-color);
}

[data-theme="light"] .section-card:hover {
    border-color: rgba(13, 148, 136, 0.35);
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

[data-theme="light"] .section-card-icon,
[data-theme="light"] .card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 18px;
    font-size: 23px;
    border-radius: 14px;
    background: #f3efff;
    border: 1px solid #e3d8fc;
}

[data-theme="light"] .card-icon.labels {
    background: #eaf3ff;
    border-color: #d1e5ff;
}

[data-theme="light"] .section-card h2 {
    letter-spacing: -0.012em;
}

[data-theme="light"] .section-card p {
    color: var(--text-muted);
}

[data-theme="light"] .section-title,
[data-theme="light"] .section-card-action {
    color: #115e59;
}

[data-theme="light"] .section-card-action {
    font-weight: 700;
}

/* --- Панели, карточки, KPI --- */
[data-theme="light"] .panel,
[data-theme="light"] .card,
[data-theme="light"] .stat-card,
[data-theme="light"] .kpi {
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .card:hover {
    border-color: rgba(13, 148, 136, 0.3);
    box-shadow: var(--shadow-md);
}

[data-theme="light"] .stat-card,
[data-theme="light"] .kpi {
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .stat-card::before,
[data-theme="light"] .kpi::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--accent-primary);
    opacity: 0.45;
}

[data-theme="light"] .stat-card:hover::before,
[data-theme="light"] .kpi:hover::before {
    opacity: 1;
}

[data-theme="light"] .stat-value {
    font-weight: 800;
    letter-spacing: -0.03em;
}

[data-theme="light"] .stat-label,
[data-theme="light"] .kpi .l {
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

[data-theme="light"] .kpi .v {
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* --- Таблицы --- */
[data-theme="light"] .table-wrapper,
[data-theme="light"] .w,
[data-theme="light"] .panel[style*="overflow-x"] {
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .table th,
[data-theme="light"] table.mp th,
[data-theme="light"] table.pv th,
[data-theme="light"] table.wh-table th {
    background: #f7f7f8;
    color: #4b5563;
    font-weight: 600;
    border-bottom: 1px solid var(--border-strong);
}

[data-theme="light"] .table td,
[data-theme="light"] table.mp td,
[data-theme="light"] table.pv td {
    border-bottom: 1px solid #eeeef0;
}

[data-theme="light"] table.wh-table td {
    border-bottom-color: #eeeef0;
    border-right-color: #eeeef0;
}

/* Зебры кит гасит через !important — возвращаем только в светлой */
[data-theme="light"] .table tbody tr:nth-child(even),
[data-theme="light"] table.mp tbody tr:nth-child(even),
[data-theme="light"] table.pv tbody tr:nth-child(even) {
    background: var(--row-even-bg) !important;
}

[data-theme="light"] .table tbody tr:hover,
[data-theme="light"] .table tbody tr:nth-child(even):hover,
[data-theme="light"] table.mp tbody tr:hover,
[data-theme="light"] table.pv tbody tr:hover {
    background: var(--row-hover-bg) !important;
}

[data-theme="light"] table.wh-table tbody tr:nth-child(even) td {
    background: var(--row-even-bg);
}

[data-theme="light"] table.wh-table tbody tr:hover td,
[data-theme="light"] table.mp tbody tr:hover td,
[data-theme="light"] table.pv tbody tr:hover td {
    background: var(--row-hover-bg);
}

[data-theme="light"] td.nm,
[data-theme="light"] td.bc {
    color: var(--text-secondary);
}

/* --- Поля и кнопки --- */
[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea,
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: #fff;
    border-color: var(--border-strong);
}

[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] .form-textarea:focus,
[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

input:-webkit-autofill,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset;
    -webkit-text-fill-color: var(--text-primary);
    caret-color: var(--text-primary);
}

/* Chrome-автозаполнение рисовало голубой прямоугольник в поле токена */
[data-theme="light"] input:-webkit-autofill,
[data-theme="light"] input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    -webkit-text-fill-color: var(--text-primary);
    caret-color: var(--text-primary);
}

[data-theme="light"] .btn-primary,
[data-theme="light"] .btn-p {
    box-shadow: var(--btn-sh);
}

[data-theme="light"] .btn-secondary,
[data-theme="light"] .btn-s {
    background: var(--btn-neutral-bg);
    border-color: var(--btn-neutral-border);
    color: var(--btn-neutral-fg);
}

[data-theme="light"] .btn-secondary:hover:not(:disabled),
[data-theme="light"] .btn-s:hover:not(:disabled) {
    border-color: var(--btn-neutral-border);
    color: var(--btn-neutral-fg);
    background: var(--btn-neutral-bg-hover);
}

/* --- Сегментные переключатели --- */
[data-theme="light"] .seg-btn {
    background: #fff;
    border-color: #e4e4e7;
    color: #52525b;
    box-shadow: 1px 1px 2px -1px rgba(16, 24, 40, 0.25);
}

[data-theme="light"] .seg-btn:hover {
    background: #fff;
    border-color: #d4d4d8;
    color: var(--text-primary);
}

[data-theme="light"] .seg-btn.active {
    background: var(--btn-primary-bg);
    border-color: transparent;
    color: #fff;
    box-shadow: 2px 2px 2px -2px rgba(37, 99, 235, 0.35);
}

/* --- Бейджи: тёмный текст на светлом тинте --- */
[data-theme="light"] .badge-success { background: #ecfdf3; color: #067647; box-shadow: inset 0 0 0 1px #abefc6; }
[data-theme="light"] .badge-error { background: #fef3f2; color: #b42318; box-shadow: inset 0 0 0 1px #fecdca; }
[data-theme="light"] .badge-warning { background: #fffaeb; color: #b54708; box-shadow: inset 0 0 0 1px #fedf89; }
[data-theme="light"] .badge-info { background: #eff8ff; color: #175cd3; box-shadow: inset 0 0 0 1px #b2ddff; }
[data-theme="light"] .badge-muted { background: #f2f4f7; color: #475467; box-shadow: inset 0 0 0 1px #e4e7ec; }

/* Возраст заказа: на белом — сплошные светлые тинты с тёмным текстом */
[data-theme="light"] .ago-ok   { background: #ecfdf3; color: #067647; border-color: #abefc6; }
[data-theme="light"] .ago-warn { background: #fffaeb; color: #b54708; border-color: #fedf89; }
[data-theme="light"] .ago-risk { background: #fff4ed; color: #b93815; border-color: #f9dbaf; }
[data-theme="light"] .ago-late { background: #fef3f2; color: #b42318; border-color: #fecdca; }

/* --- Модалки и всплывающие слои --- */
[data-theme="light"] .modal,
[data-theme="light"] .modal-content,
[data-theme="light"] .user-menu-dropdown {
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
}

[data-theme="light"] .modal-overlay,
[data-theme="light"] .modal-overlay.on {
    background: rgba(16, 24, 40, 0.42);
}

/* --- FBS-направления: акцент задаёт страница (в светлой — свои AA-значения) --- */
[data-theme="light"] .si,
[data-theme="light"] .kt,
[data-theme="light"] .hdr h1 {
    color: var(--fb);
}

[data-theme="light"] .hdr h1 {
    -webkit-text-fill-color: currentColor;
    background: none;
}

/* Кнопки Production: пастельные фоны с белым текстом не проходили AA */
[data-theme="light"] .btn-green { background: #15803d; border-color: #15803d; }
[data-theme="light"] .btn-cyan { background: #0e7490; border-color: #0e7490; }
[data-theme="light"] .btn-blue { background: #1d4ed8; border-color: #1d4ed8; }
[data-theme="light"] .btn-teal { background: #0f766e; border-color: #0f766e; }
[data-theme="light"] .btn-slate { background: #475569; border-color: #475569; }
[data-theme="light"] .btn-red { background: #b42318; border-color: #b42318; }

/* --- Фокус и выделение --- */
[data-theme="light"] :focus-visible {
    outline: 2px solid var(--accent-primary) !important;
    outline-offset: 2px !important;
}

[data-theme="light"] ::selection {
    background: rgba(13, 148, 136, 0.16);
}

/* Плавный отклик только у интерактива: глобальный transition:none в ките остаётся */
[data-theme="light"] .btn,
[data-theme="light"] .btn-p,
[data-theme="light"] .btn-s,
[data-theme="light"] .section-card,
[data-theme="light"] .card,
[data-theme="light"] .stat-card,
[data-theme="light"] .seg-btn,
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] .form-input {
    transition: background-color .15s ease, border-color .15s ease, box-shadow .2s ease, transform .2s ease, color .15s ease !important;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ============================================
   Стенд «боковое меню» (html.side-layout)
   Включается ?layout=side, снимается ?layout=classic.
   Без класса все правила ниже не применяются — текущий вид не меняется.
   ============================================ */
/* Акцент стенда намеренно не переопределяется: страницы остаются в текущих
   токенах кит-акцента (бирюзовый), сайдбар берёт его же для активных пунктов. */
html.side-layout body { padding-left: 248px; }

.side-nav {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1100;
    width: 248px; display: flex; flex-direction: column;
    padding: 22px 14px 14px; overflow: hidden;
    background: #171b2b; color: #c9cfdf;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 12px; color: #fff; }
.side-brand-link { display: flex; align-items: center; gap: 11px; min-width: 0; text-decoration: none; color: inherit; }
.side-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-collapse-in {
    display: flex; align-items: center; gap: 8px;
    width: 100%; min-height: 36px; padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .14); border-radius: 10px;
    background: transparent; color: #c9cfdf; font: inherit;
    font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.side-collapse-in svg { width: 16px; height: 16px; flex: 0 0 auto; stroke: currentColor; opacity: .8; transition: transform .18s ease; }
.side-collapse-in:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-collapse-in:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
[data-theme="light"] .side-collapse-in { color: #3d4b63; border-color: var(--border-color); }
[data-theme="light"] .side-collapse-in:hover { background: #f1f3f8; color: #141a2e; }
.side-brand-mark {
    width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-primary);
}
.side-brand-mark svg { width: 21px; height: 21px; stroke: var(--accent-ink); }
.side-brand-text { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.side-brand-text small { display: block; margin-top: 3px; font-size: 9.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: #8c95b0; }

/* Меню скроллится внутри сайдбара, подвал всегда виден.
   Полосу прокрутки не показываем: она рвала вид, скролл остаётся колесом/свайпом. */
.side-menu {
    display: flex; flex-direction: column; gap: 1px;
    flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 2px;
    scrollbar-width: none; -ms-overflow-style: none;
}
.side-menu::-webkit-scrollbar { display: none; }
.side-link {
    display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 0 13px;
    border-radius: 11px; text-decoration: none; color: #c9cfdf;
    font-size: 13.5px; font-weight: 500; line-height: 1.3;
}
.side-link svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .85; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.is-active { background: var(--accent-primary); color: var(--accent-ink); font-weight: 600; }
.side-link.is-active svg { opacity: 1; }

.side-group > summary {
    display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 0 13px;
    border-radius: 11px; cursor: pointer; list-style: none;
    font-size: 13.5px; font-weight: 500;
}
.side-group > summary::-webkit-details-marker { display: none; }
.side-group > summary:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-group > summary svg.side-ico { width: 18px; height: 18px; flex: 0 0 auto; opacity: .85; }
.side-group[open] > summary { color: #fff; }
/* Открытая группа, внутри которой текущая страница */
.side-group.is-current > summary { color: #fff; background: rgba(255, 255, 255, .045); }
.side-chevron { width: 14px; height: 14px; margin-left: auto; opacity: .55; transition: transform .18s ease; }
.side-group > summary { position: relative; }
.side-badge {
    margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: #e5484d; color: #fff;
    font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center;
    flex: 0 0 auto;
}
.side-badge + .side-chevron { margin-left: 6px; }
/* Корпоративные цвета направлений: WB — маджента, Ozon — синий, KIT — оранжево-красный */
.side-badge--wb { background: #c026b0; }
.side-badge--ozon { background: #1d4ed8; }
.side-badge--kit { background: #c23417; }
.side-sub .side-badge { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 9.5px; line-height: 16px; }
html.side-collapsed .side-badge {
    position: absolute; top: 5px; right: 6px;
    min-width: 8px; width: 8px; height: 8px; padding: 0;
    border-radius: 50%; font-size: 0; line-height: 0;
}
.side-group[open] .side-chevron { transform: rotate(180deg); }

/* Клавиатура: видимый фокус (мышью рамки не появляются) */
.side-link:focus-visible,
.side-group > summary:focus-visible,
.side-brand:focus-visible,
.side-foot a:focus-visible,
.side-collapse:focus-visible,
.side-burger:focus-visible {
    outline: 2px solid var(--accent-primary); outline-offset: 2px;
}

.side-sub { display: flex; flex-direction: column; margin: 2px 0 4px; padding-left: 13px; }
.side-sub .side-link {
    min-height: 32px; padding: 0 12px 0 13px; border-radius: 0 9px 9px 0;
    border-left: 1px solid rgba(255, 255, 255, .09);
    color: #a9b2c9; font-size: 13px;
}
.side-sub .side-link.is-active {
    background: color-mix(in srgb, var(--accent-primary) 18%, transparent);
    border-left-color: var(--accent-primary); color: #fff;
}

.side-foot { flex: 0 0 auto; margin-top: 4px; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; flex-direction: column; gap: 12px; }
/* Иллюстрация только на высоких экранах: на 768–900 px она съедает место, из-за которого меню просило скролл */
.side-art { display: none; width: 100%; max-width: 168px; margin: 0 auto 4px; opacity: .45; }
@media (min-height: 900px) { .side-art { display: block; } }
.side-foot a { font-size: 11.5px; color: #8c95b0; text-decoration: none; }
.side-foot a:hover { color: #fff; }
.side-foot p { margin: 2px 0 0; font-size: 10.5px; line-height: 1.45; color: #6b7590; }

/* Невысокие экраны: оставляем только «Вернуть верхнее меню», иначе меню просит скролл */
@media (max-height: 880px) {
    .side-foot p { display: none; }
    .side-foot { padding-top: 6px; }
}

/* Светлая тема: сайдбар светлеет вместе с сайтом, активный пункт — тот же акцент */
[data-theme="light"] .side-nav {
    background: #ffffff; color: #3d4b63;
    border-right: 1px solid var(--border-color);
}
[data-theme="light"] .side-brand { color: #141a2e; }
[data-theme="light"] .side-brand-text small { color: #8b95a8; }
[data-theme="light"] .side-link { color: #3d4b63; }
[data-theme="light"] .side-link:hover { background: #f1f3f8; color: #141a2e; }
[data-theme="light"] .side-link.is-active { color: var(--accent-ink); }
[data-theme="light"] .side-group > summary:hover { background: #f1f3f8; color: #141a2e; }
[data-theme="light"] .side-group[open] > summary,
[data-theme="light"] .side-group.is-current > summary { color: #141a2e; background: #f1f3f8; }
[data-theme="light"] .side-sub .side-link { color: #5b6679; border-left-color: #e6e9f2; }
[data-theme="light"] .side-sub .side-link:hover { background: #f6f7fb; color: #141a2e; }
[data-theme="light"] .side-sub .side-link.is-active {
    background: color-mix(in srgb, var(--accent-primary) 16%, transparent);
    border-left-color: var(--accent-primary); color: #0f766e;
}
[data-theme="light"] .side-foot { border-top-color: var(--border-color); color: #8b95a8; }
[data-theme="light"] .side-foot a { color: #6b7590; }
[data-theme="light"] .side-foot a:hover { color: #141a2e; }
[data-theme="light"] .side-foot p { color: #9aa3b5; }
[data-theme="light"] .side-scrim { background: rgba(15, 23, 42, .35); }

@media (prefers-reduced-motion: reduce) {
    .side-nav, .side-chevron { transition: none; }
}

/* Топбар: остаются только действия, меню живёт слева */
html.side-layout .navbar { padding-left: 20px; }
html.side-layout .navbar-inner { max-width: none; gap: 16px; }
html.side-layout .navbar-brand,
html.side-layout .back-link,
html.side-layout .navbar-nav { display: none; }
html.side-layout .navbar-actions { margin-left: auto; }

.side-burger {
    display: none; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-primary);
}
.side-burger svg { width: 18px; height: 18px; stroke: currentColor; }
/* Страницы без шапки: бургер плавает в правом верхнем углу */
.side-burger--float { position: fixed; top: 10px; right: 12px; z-index: 1050; box-shadow: var(--shadow-md); }

/* Страница входа (гость на `/`): без шапки и контента — только форма логина */
html.login-only body > nav,
html.login-only body > main,
html.login-only body > .main,
html.login-only body > .container,
html.login-only body > .section-main { display: none !important; }
html.login-only body { min-height: 100vh; }

/* Свёрнутое меню — рейл из иконок (64 px): видно, что меню есть, и понятно, как вернуть */
.side-nav { transition: width .22s ease, padding .22s ease; }
html.side-collapsed body { padding-left: 64px; }
html.side-collapsed .side-nav { width: 64px; padding: 16px 8px 12px; }
html.side-collapsed .side-brand { padding: 0 0 10px; justify-content: center; }
html.side-collapsed .side-brand-link { justify-content: center; }
html.side-collapsed .side-brand-text,
html.side-collapsed .side-label,
html.side-collapsed .side-chevron,
html.side-collapsed .side-sub,
html.side-collapsed .side-art,
html.side-collapsed .side-foot > a { display: none; }
html.side-collapsed .side-link,
html.side-collapsed .side-group > summary { justify-content: center; padding: 0; gap: 0; }
/* В рейле видно, в каком разделе мы находимся */
html.side-collapsed .side-group.is-current > summary { background: var(--accent-primary); color: var(--accent-ink); }
html.side-collapsed .side-foot { padding: 10px 0 0; align-items: center; }
html.side-collapsed .navbar-actions { margin-left: auto; }
html.side-collapsed .side-collapse-in {
    width: 40px; min-height: 40px; padding: 0; justify-content: center;
    margin: 0 auto; border-color: transparent; background: rgba(255, 255, 255, .06);
}
html.side-collapsed .side-collapse-in svg { transform: rotate(180deg); }
[data-theme="light"] html.side-collapsed .side-collapse-in { background: #f1f3f8; }

@media (max-width: 1100px) {
    html.side-layout body { padding-left: 0; }
    html.side-collapsed body { padding-left: 0; }
    .side-nav { width: min(280px, 88vw); transform: translateX(-100%); visibility: hidden; box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
    .side-nav.is-open { transform: none; visibility: visible; }
    /* Свёрнутый рейл — только для десктопа: в шторке показываем полное меню */
    .side-collapse-in { display: none; }
    html.side-collapsed .side-nav { width: min(280px, 88vw); padding: 22px 14px 14px; }
    html.side-collapsed .side-brand { justify-content: flex-start; }
    html.side-collapsed .side-brand-link { justify-content: flex-start; }
    html.side-collapsed .side-brand-text,
    html.side-collapsed .side-label,
    html.side-collapsed .side-chevron { display: inline; }
    html.side-collapsed .side-group > .side-sub { display: flex; }
    html.side-collapsed .side-link,
    html.side-collapsed .side-group > summary { justify-content: flex-start; padding: 0 13px; gap: 11px; }
    html.side-collapsed .side-nav.is-open { transform: none; }
    .side-art { display: none; }
    html.side-layout .navbar { padding-left: var(--content-pad); }
    html.side-layout .navbar-brand { display: flex; }
    html.side-layout .back-link { display: flex; }
    .side-burger { display: inline-flex; }
    /* Плавающий бургер (страницы без шапки) не должен наезжать на заголовок */
    .side-burger--float ~ .v2-app .v2-main { padding-top: 56px; }
}

/* Бургер добавляет кнопку в топбар: на телефоне прячем подписи, иначе строка не влезает */
@media (max-width: 768px) {
    html.side-layout .navbar-actions { gap: 6px; }
    html.side-layout .user-menu-trigger .user-name,
    html.side-layout .user-menu-trigger .badge,
    html.side-layout .user-menu-trigger .user-arrow { display: none; }
}
.side-scrim { position: fixed; inset: 0; z-index: 1090; background: rgba(0, 0, 0, .45); }

@media print {
    .side-nav, .side-burger, .side-scrim, .side-collapse-in { display: none !important; }
    html.side-layout body { padding-left: 0; }
}

/* iOS/Safari: поле меньше 16px при фокусе зумит страницу (11.11.2026) */
@media (max-width: 768px) {
    .form-input, .form-select, input:not([type="checkbox"]):not([type="radio"]),
    select, textarea { font-size: 16px; }
}

/* Поле сканера: крупный моно (канон §9). Раньше на складе/инвентаризации было 13px form-input. */
.scan-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
              font-size: 19px; letter-spacing: 1px; height: 44px; }
