/* Onest — variable woff2, self-hosted (SIL OFL 1.1). Один шрифт на весь сайт. */
@font-face {
    font-family: 'Onest';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/onest-cyrillic-ext.woff2') format('woff2');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
    font-family: 'Onest';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/onest-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Onest';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/onest-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Onest';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/onest-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* Первичные токены — дизайн-система "Polka" (нейтральный чёрно-серый,
       акцент — лайм). Старая navy-шкала (#1B2340 и т.п.) убрана полностью —
       синего в интерфейсе больше нигде быть не должно. */
    --color-bg: #EEEEEC;
    --color-canvas: #F8F8F6;
    --color-surface: #ffffff;
    --color-surface-sidebar: #111111;
    --color-surface-sunken: #F4F4F2;
    --color-border: #E4E4E1;
    --color-border-strong: #CFCFCB;
    --ink-900: #111111;
    --ink-700: #4A4A4F;
    --ink-500: #77777F;
    --ink-400: #9A9AA0;
    --ink-300: #C4C4C8;
    --ink-200: #E3E3E1;
    --ink-100: #F0F0ED;
    --coral: #E8734A;
    --chip: var(--color-surface-sunken);
    --mocha-100: #ECEBFA;
    --mocha-300: #C9C4F0;
    --mocha-500: #7C6FCF;
    --mocha-600: #6C5FBE;
    --mocha-700: #5A4EAA;
    --green-600: #2F9E6E;
    --green-100: #E3F5EC;
    --red-600: #D0523A;
    --red-100: #FBEAE6;

    /* Семантические алиасы — то, чем реально пользуются компоненты ниже. */
    --bg: var(--color-bg);
    --canvas: var(--color-canvas);
    --surface: var(--color-surface);
    --surface-sunken: var(--color-surface-sunken);
    --text-primary: var(--ink-900);
    --text-secondary: var(--ink-700);
    --text-muted: var(--ink-500);
    --border: var(--color-border);
    --border-strong: var(--color-border-strong);
    --brand: var(--mocha-500);
    --brand-dark: var(--mocha-700);
    --accent: var(--mocha-700);
    --shadow-soft: 0 1px 2px rgba(17, 17, 17, 0.05);
    --shadow-hover: 0 8px 24px rgba(17, 17, 17, 0.12);
    --total-row-bg: var(--mocha-300);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;
    --ease-standard: cubic-bezier(.4, 0, .2, 1);
    /* Сильные варианты стандартных кривых (emil-design-eng): встроенные
       ease-out/ease-in-out CSS слишком слабые, не дают ощущения "отклика". */
    --ease-out-strong: cubic-bezier(.23, 1, .32, 1);
    --ease-in-out-strong: cubic-bezier(.77, 0, .175, 1);
    /* Категориальные цвета — заказы/продажи (используются только в overview.html).
       Продажи — единый фирменный лайм (--ov-accent), тот же токен, что и
       везде на странице (навбар, KPI-полоска) — см. §19/20 брифа. */
    --series-orders: #111111;
    --series-sales: var(--ov-accent);
    --series-sales-text: #7EB600;

    /* Локальная палитра страницы «Обзор» (не используется вне .ov-* правил,
       чтобы не менять фирменный фиолетовый на остальных страницах). */
    --ov-ink: #111111;
    --ov-text-secondary: #77777F;
    --ov-text-muted: #A2A2A8;
    --ov-border: rgba(0, 0, 0, .055);
    --ov-icon-bg: #F0F0ED;
    --ov-accent: #B9FF20;
    --ov-accent-hover: #A8EC15;
    --ov-accent-soft: rgba(183, 240, 0, .12);
    --ov-success: #20A66A;
    --ov-danger: #FF3B30;

    /* --- Юнит-экономика по артикулам: цветовые зоны таблицы --- */
    --unit-product-bg: #ffffff;
    --unit-expenses-bg: #f5f7fa;
    --unit-result-bg: #f8fbef;
    --unit-product-bg-hover: #F4F4F2;
    --unit-expenses-bg-hover: #eef1f5;
    --unit-result-bg-hover: #eef6df;
    --unit-border: rgba(20, 24, 32, 0.08);
    --unit-text-secondary: rgba(20, 24, 32, 0.56);
    --ov-neutral-2: #707070;
    --ov-neutral-3: #A0A0A0;
    --ov-neutral-4: #C8C8C8;
    --ov-track: #EEEEEC;
    /* Статусная палитра — риск/норма/избыток. */
    --status-good: var(--green-600);
    --status-warning: #E8734A;
    --status-critical: var(--red-600);
    --status-muted: var(--ink-400);
}

* { box-sizing: border-box; }

/* Место под полосу прокрутки резервируется всегда: иначе на длинных
   страницах она появляется и сдвигает весь контент влево (например, при
   переключении вкладок «Кабинета»). */
html { scrollbar-gutter: stable; }

/* Дефолт для ссылок без своего класса (согласие на обработку данных,
   текст внутри страниц) — иначе браузер подставляет синий, чужеродный
   тёплой палитре Polka. */
a { color: var(--brand-dark); }
a:hover { color: var(--ink-900); }

body {
    margin: 0;
    /* Polka — плоский фон без градиентов/паттернов/прозрачности. */
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

:root {
    --font-sans: 'Golos Text', 'Onest', -apple-system, "Segoe UI", sans-serif;
    /* Один шрифт на весь сайт: заголовки и текст не должны расходиться. */
    --font-display: var(--font-sans);
}

h1, h2, h3, .display {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0;
    margin: 0;
}

::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

/* --- App shell: сайдбар-рейл + основная панель ---
   Рейл всегда узкий (76px, иконки без подписей) — вместо раскрытия всей
   капсулы по наведению у каждого пункта своя всплывающая подпись-плашка
   справа от иконки. Анимация — только opacity/transform (композитор),
   никакого width/max-width. .main резервирует отступ слева под рейл через
   padding на .app-shell. */
.app-shell {
    min-height: 100vh;
    padding: 14px 14px 14px calc(76px + 14px + 14px);
}

.sidebar {
    width: 76px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    position: fixed;
    left: 14px;
    top: 14px;
    bottom: 14px;
    z-index: 20;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none;
    margin-bottom: 4px;
    /* Лого (68px) в сайдбаре и заголовок/пилюли в топбаре центрируются
       каждые в своей независимой колонке (сайдбар — fixed-позиционирован,
       топбар — обычный flex-ряд в .main), поэтому их центры расходятся
       на глаз. Сдвигаем лого вверх ровно на разницу центров, чтобы всё
       легло на одну линию. */
    transform: translateY(-20px);
}

.sidebar .brand-mark { flex-shrink: 0; }

.sidebar .brand .nav-icon-wrap {
    width: 68px;
    height: 68px;
    /* Тот же светлый фон-плашка, что у остальных иконок навбара и
       переключателей в топбаре — единый стиль. */
    background: rgba(255, 255, 255, .75);
    border: 1px solid rgba(0, 0, 0, .05);
    box-shadow: none;
    color: var(--ink-900);
}

.sidebar .brand .brand-mark { width: 40px; height: 40px; }

.sidebar .brand:hover .nav-icon-wrap { transform: none; }

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    margin-bottom: auto;
}

.sidebar nav a,
.sidebar .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, .3);
    outline: none;
}

.sidebar nav a:focus-visible .nav-icon-wrap,
.sidebar .brand:focus-visible .nav-icon-wrap {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* Каждый пункт — самостоятельная rounded-square иконка-кнопка (без общей
   плашки рейла под ними): у логотипа и каждого пункта меню свой фон. */
.nav-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, .75);
    border: 1px solid rgba(0, 0, 0, .05);
    color: rgba(0, 0, 0, .78);
    transition: background .15s ease, color .2s ease, transform .15s ease, border-color .15s ease;
}

.sidebar nav a:hover .nav-icon-wrap,
.sidebar .brand:hover .nav-icon-wrap {
    background: #ffffff;
    color: #000;
    transform: translateY(-1px);
}

/* Активный пункт — не заливка, а тонкая фирменная лаймовая рамка на белом
   (§4 брифа): иначе лайм на каждой навигации спорил бы с его дозированным
   использованием на самой странице. */
.sidebar nav a.active .nav-icon-wrap {
    background: #ffffff;
    border: 1.5px solid var(--ov-accent);
    color: #111111;
}

/* Пункт "в разработке" — иконка та же, что у обычного пункта, но плашка
   получает едва заметную диагональную штриховку («здесь идут работы»);
   некликабельным (.nav-disabled) он становится только у не-владельца
   аккаунта, см. base.html. Подсказка раскрывается вниз от иконки (а не
   вбок, как у остальных пунктов) — так она читается отдельно от обычной
   навигации. */
.sidebar nav a.nav-wip .nav-icon-wrap {
    background-image: repeating-linear-gradient(-45deg, rgba(0, 0, 0, .05) 0 3px, transparent 3px 9px);
}
.sidebar nav a.nav-wip .nav-label {
    left: 50%;
    top: 100%;
    margin-left: 0;
    margin-top: 8px;
    background: rgba(17, 17, 17, .92);
    transform-origin: top center;
    transform: translateX(-50%) scale(.3);
}
.sidebar nav a.nav-wip:hover .nav-label {
    transform: translateX(-50%) scale(1);
}

.sidebar nav a.nav-disabled { cursor: not-allowed; }
.sidebar nav a.nav-disabled .nav-icon-wrap { opacity: .45; }
.sidebar nav a.nav-disabled:hover .nav-icon-wrap { background: rgba(255, 255, 255, .75); color: rgba(0, 0, 0, .78); transform: none; }

/* Разделы аналитики и ФБС — плитки «подпись внутри»: иконка сверху,
   короткая подпись снизу; полное название — во всплывающей .nav-label.
   Фиксированная высота, чтобы двухстрочные подписи не ломали ритм. */
.sidebar nav:has(.nav-tile) { gap: 7px; }
.sidebar nav a.nav-wip { margin-top: 3px; }

.sidebar nav a.nav-tile {
    flex-direction: column;
    gap: 4px;
    width: 72px;
    height: 58px;
    padding: 0 4px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .75);
    border: 1.5px solid rgba(0, 0, 0, .05);
    color: rgba(0, 0, 0, .78);
    transition: background .15s ease, color .2s ease, border-color .15s ease;
}
.sidebar nav a.nav-tile .nav-icon { width: 19px; height: 19px; }
.nav-caption {
    font-family: var(--font-sans);
    font-size: 10px;
    line-height: 11px;
    font-weight: 500;
    letter-spacing: -0.01em;
    text-align: center;
    color: inherit;
}
/* Раздел «в доработке»: штриховка «ремонтной ленты», подпись и крутящаяся
   шестерёнка в углу — плитка выделяется среди рабочих. */
.sidebar nav a.nav-tile.nav-tile-wip {
    height: 66px;
    gap: 3px;
    border-style: dashed;
    border-color: rgba(214, 140, 0, .55);
    background-image: repeating-linear-gradient(-45deg, rgba(245, 166, 35, .10) 0 4px, transparent 4px 10px);
}
.sidebar nav a.nav-tile.nav-tile-wip:hover { border-color: rgba(214, 140, 0, .9); }
.nav-note {
    padding: 1px 5px;
    border-radius: 6px;
    background: rgba(245, 166, 35, .18);
    font-family: var(--font-sans);
    font-size: 9px;
    line-height: 11px;
    font-weight: 600;
    white-space: nowrap;
    color: #9a5b00;
}
.nav-wip-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f5a623;
    color: #fff;
    box-shadow: 0 0 0 2px #fff;
}
.nav-wip-badge svg {
    width: 12px;
    height: 12px;
    animation: nav-wip-spin 4s linear infinite;
}
.sidebar nav a.nav-tile-wip:hover .nav-wip-badge svg { animation-duration: 1.2s; }
@keyframes nav-wip-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .nav-wip-badge svg { animation: none; }
}
.sidebar nav a.nav-tile:hover {
    background: #ffffff;
    border-color: rgba(0, 0, 0, .14);
    color: #000;
}
.sidebar nav a.nav-tile:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}
.sidebar nav a.nav-tile.active {
    background: #ffffff;
    border-color: var(--ov-accent);
    color: #111111;
}

/* Разделитель группы ФБС: линия — «ФБС» — линия. */
.nav-divider {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 72px;
    margin: 3px 0;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    color: #9A9AA0;
}
.nav-divider::before,
.nav-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(0, 0, 0, .12);
}

/* Невысокие окна: ужимаем плитки, чтобы меню влезало по высоте. */
@media (min-width: 641px) and (max-height: 820px) {
    .sidebar nav:has(.nav-tile) { gap: 4px; }
    .sidebar nav a.nav-tile { height: 52px; gap: 3px; }
    .sidebar nav a.nav-tile .nav-icon { width: 17px; height: 17px; }
    .nav-divider { margin: 0; }
}

/* Подпись "выползает"/зарождается из круглой иконки: growth-origin у левого
   края плашки, вплотную к иконке, полупрозрачный фон, scale вместо
   width/max-width — анимация только opacity/transform (композитор). */
.nav-label {
    position: absolute;
    left: 100%;
    top: 50%;
    margin-left: 2px;
    background: rgba(17, 17, 17, .92);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    opacity: 0;
    pointer-events: none;
    transform-origin: left center;
    transform: translateY(-50%) scale(.3);
    transition: opacity .16s ease, transform .22s cubic-bezier(.16, 1, .3, 1);
}

.brand .nav-label { font-weight: 800; letter-spacing: -0.02em; }

.sidebar nav a:hover .nav-label,
.sidebar nav a:focus-visible .nav-label,
.sidebar .brand:hover .nav-label {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

/* Иконка раздела: один размер и вес у всех пунктов, цвет наследуется от
   текста (currentColor). */
.nav-icon { flex-shrink: 0; }

/* Утверждённая концепция (§2/§24 брифа): никакого общего контейнера/фона
   ни у шапки, ни у сайдбара — все элементы лежат прямо на фоне страницы,
   выделяются только сами белые карточки контента. */
.main {
    background: transparent;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 32px 10px 24px;
}

.topbar-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.topbar-title h1 {
    font-size: 26px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    white-space: nowrap;
}

.topbar-title .page-subtitle {
    margin: 0;
    font-size: 14px;
    color: #8A8A92;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Контролы страницы (например, выбор периода на Обзоре) — правее заголовка,
   но левее магазина/пользователя. Пустой на страницах, где блок не заполнен
   (topbar_controls), поэтому не мешает исходной раскладке. */
.topbar-controls:not(:empty) {
    display: flex;
    align-items: center;
    margin-left: auto;
}

/* Правая группа (переключатель магазина + меню пользователя) прижата к
   краю через margin-left: auto — так изменение ширины названия магазина
   при переключении не сдвигает пункты меню слева. Если перед ней уже стоит
   .topbar-controls, эта margin-left не даёт эффекта (места слева не
   осталось) — группы просто идут подряд с обычным gap между собой. */
.navbar-actions,
.topbar-actions {
    display: flex;
    align-items: center;
    margin-left: auto;
}

@media (max-width: 900px) {
    .app-shell { padding: 8px 8px 8px calc(76px + 8px + 8px); }
    .topbar { padding: 14px 18px; }
}

/* Ниже 640px рейл-сайдбар вертикально съедал бы ~90px из ~360px экрана —
   на телефоне он ложится в нижнюю панель иконок без раскрытия по hover
   (наведения нет на touch), подписи и брендовая шапка скрываются, чтобы не
   дублировать то, что уже доступно через меню пользователя в topbar. */
@media (max-width: 640px) {
    .app-shell { padding: 0 0 64px; }

    /* Гостю (лендинг, вход/регистрация) реально доступна только "Главная" —
       плавающая нижняя панель ради одной иконки только мешает: перекрывает
       карточку входа, когда та оказывается у нижнего края экрана. */
    .app-shell:has(.sidebar-guest) { padding-bottom: 0; }
    .sidebar-guest { display: none; }

    .sidebar {
        left: 8px;
        right: 8px;
        bottom: 8px;
        top: auto;
        width: auto;
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        padding: 6px;
        z-index: 30;
    }
    .sidebar .brand { display: none; }
    .sidebar nav { flex-direction: row; justify-content: space-around; gap: 0; width: 100%; }
    .sidebar nav:has(.nav-tile) { gap: 0; }
    .sidebar nav a.nav-tile { width: 40px; height: 40px; border-radius: 12px; }
    .sidebar nav a.nav-tile .nav-icon { width: 18px; height: 18px; }
    .sidebar nav a.nav-wip { margin-top: 0; }
    .sidebar nav a.nav-tile.nav-tile-wip { height: 40px; }
    .nav-wip-badge { top: -4px; right: -4px; width: 14px; height: 14px; }
    .nav-wip-badge svg { width: 10px; height: 10px; }
    .nav-caption, .nav-note, .nav-divider { display: none; }

    .main { border-radius: var(--radius-lg); }
    .topbar { padding: 12px 16px; flex-wrap: wrap; row-gap: 10px; }
    .page { padding: 16px 16px 24px; }

    /* Título + переключатель/юзер помещаются в первую строку, а контролы
       страницы (например, дата-чип Обзора) переносятся на вторую — иначе
       на узком экране три группы сплющивают друг друга и чип ломает строку
       пополам (см. .topbar-controls). */
    .topbar-title .page-subtitle { display: none; }
    .topbar-controls:not(:empty) {
        flex: 1 1 100%;
        order: 3;
        margin-left: 0;
    }
}

/* --- User menu (аватар + выпадающая панель) --- */
.user-menu {
    position: relative;
    flex-shrink: 0;
    margin-left: 16px;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    /* Тот же фон, что у иконок навбара (.nav-icon-wrap) и переключателя
       магазина — единый стиль "плашек" по всему топбару. */
    border: 1px solid rgba(0, 0, 0, .05);
    background: rgba(255, 255, 255, .75);
    padding: 6px 12px 6px 6px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    transition: background var(--ease-standard) .15s;
}

.user-menu-trigger:hover { background: #ffffff; }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ov-ink);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chevron {
    color: #000;
    flex: 0 0 auto;
    display: flex;
}

.user-menu-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hover);
    padding: 8px;
    flex-direction: column;
    gap: 2px;
    z-index: 30;
}

.user-menu-panel.open { display: flex; }

.user-menu-panel a,
.user-menu-panel .user-menu-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    text-decoration: none;
    color: var(--text-primary);
    font-family: var(--font-sans), sans-serif;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background var(--ease-standard) .15s;
}

.user-menu-panel a:hover,
.user-menu-panel .user-menu-logout:hover { background: var(--color-surface-sunken); }

.user-menu-panel a.active { background: var(--ov-icon-bg); }

.user-menu-panel .user-menu-logout { color: var(--status-critical); }

/* --- Плашка первичной загрузки магазина (Личный кабинет) --- */
.sync-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--color-surface-sunken);
}

.sync-banner strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
}

.sync-banner p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.sync-banner-error {
    border-color: var(--status-critical);
    background: transparent;
}

.sync-spinner {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--mocha-500);
    border-radius: 50%;
    animation: sync-spin 0.8s linear infinite;
}

@keyframes sync-spin {
    to { transform: rotate(360deg); }
}

/* --- Переключатель «площадка | магазин» (навбар) --- */
.mpshop {
    --mp-accent: #7B2FF7;
    --mp-accent-soft: #F3ECFF;
    --mp-accent-line: #C9AEFB;
    position: relative;
    flex-shrink: 1;
    min-width: 0;
    margin-left: 16px;
}

.mpshop-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    border: 1px solid rgba(0, 0, 0, .06);
    background: #ffffff;
    padding: 6px 14px 6px 6px;
    min-height: 46px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color var(--ease-standard) .15s, box-shadow var(--ease-standard) .15s;
}

.mpshop-trigger:hover { border-color: rgba(0, 0, 0, .12); }
.mpshop-trigger:focus-visible,
.user-menu-trigger:focus-visible {
    outline: 2px solid var(--mp-accent, var(--ink-900));
    outline-offset: 2px;
}
.mpshop-trigger[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--mp-accent-soft); }

.mpshop-mp { white-space: nowrap; }

.mpshop-sep {
    width: 1px;
    height: 18px;
    background: var(--border-strong, rgba(0, 0, 0, .15));
    flex-shrink: 0;
}

.mpshop-name {
    min-width: 0;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mpshop-chevron { transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.mpshop-trigger[aria-expanded="true"] .mpshop-chevron { transform: rotate(180deg); }
.mpshop.is-switching .mpshop-trigger { cursor: progress; }

/* Значок площадки: буквы + цвет, чтобы площадку можно было узнать не
   только по цвету. */
.mp-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .02em;
    color: #fff;
}
.mp-icon-wb { background: #7B2FF7; }
.mp-icon-ozon { background: #005BFF; }

.mpshop-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(352px, calc(100vw - 16px));
    transform: translateX(var(--mpshop-shift, 0px)) translateY(-6px);
    opacity: 0;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 40px -12px rgba(20, 20, 30, .18), 0 2px 6px rgba(20, 20, 30, .05);
    padding: 16px;
    z-index: 40;
    transition: opacity .14s ease-in, transform .14s ease-in;
}
.mpshop-panel.is-open {
    opacity: 1;
    transform: translateX(var(--mpshop-shift, 0px)) translateY(0);
    transition: opacity .2s cubic-bezier(.2, .8, .2, 1), transform .2s cubic-bezier(.2, .8, .2, 1);
}
.mpshop-panel[hidden] { display: none; }

.mpshop[data-active-mp="ozon"],
.mpshop-panel[data-mp="ozon"] {
    --mp-accent: #005BFF;
    --mp-accent-soft: #E8F0FF;
    --mp-accent-line: #A9C4FF;
}

.mpshop-panel[data-mp="wb"] {
    --mp-accent: #7B2FF7;
    --mp-accent-soft: #F3ECFF;
    --mp-accent-line: #C9AEFB;
}

.mpshop-heading {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px;
}

.mpshop-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 18px;
}

.mpshop-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--color-surface-sunken, #f6f6f6);
    color: var(--text-muted);
    font-family: var(--font-sans), sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.mpshop-tab .mp-icon { width: 24px; height: 24px; border-radius: 7px; font-size: 9px; }
.mpshop-tab:hover { color: var(--text-primary); }
.mpshop-tab-wb[aria-selected="true"] { background: #F3ECFF; border-color: #A97BF9; color: #6a22e0; }
.mpshop-tab-ozon[aria-selected="true"] { background: #E8F0FF; border-color: #7FA8FF; color: #004de0; }
.mpshop-tab:focus-visible,
.mpshop-option:focus-visible,
.mpshop-empty a:focus-visible {
    outline: 2px solid var(--mp-accent);
    outline-offset: 2px;
}

.mpshop-list {
    list-style: none;
    margin: 0;
    padding: 2px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(296px, 45vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mpshop-option {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 56px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary);
    font-family: var(--font-sans), sans-serif;
    font-weight: 600;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}
.mpshop-option:hover:not(:disabled) { background: var(--color-surface-sunken, #f6f6f6); }
.mpshop-option:disabled { cursor: not-allowed; color: var(--text-muted); }
.mpshop-option.is-current { background: var(--mp-accent-soft); border-color: var(--mp-accent-line); }
.mpshop-option.is-current:hover { background: var(--mp-accent-soft); }
.mpshop-store { flex-shrink: 0; color: var(--text-primary); }
.mpshop-option-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpshop-option-note { font-size: 12px; font-weight: 500; color: var(--text-muted); }

.mpshop-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--mp-accent);
    color: #fff;
    opacity: 0;
    transform: scale(.8);
    transition: opacity .18s ease, transform .18s ease;
}
.mpshop-option.is-current .mpshop-check { opacity: 1; transform: scale(1); }
/* Магазин выбран, идёт загрузка — вместо галочки крутится индикатор. */
.mpshop-option.is-loading .mpshop-check {
    opacity: 1;
    transform: none;
    background: transparent;
    border: 2px solid var(--mp-accent-line);
    border-top-color: var(--mp-accent);
    animation: sync-spin .8s linear infinite;
}
.mpshop-option.is-loading .mpshop-check svg { display: none; }

.mpshop-empty {
    padding: 18px 14px;
    border: 1px dashed var(--border-strong, rgba(0, 0, 0, .15));
    border-radius: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}
.mpshop-empty p { margin: 0 0 6px; }
.mpshop-empty a { color: var(--mp-accent); font-weight: 600; text-decoration: none; }

.mpshop-hint {
    margin: 14px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

/* Смена контекста: пока грузится новый магазин, старые цифры приглушены и
   недоступны для кликов. */
.page.is-context-loading {
    opacity: .55;
    pointer-events: none;
    /* Быстрый переход успевает до затемнения — без лишнего мигания. */
    transition: opacity .2s ease .35s;
}

@media (max-width: 640px) {
    .mpshop { margin-left: 8px; }
    .mpshop-mp, .mpshop-sep { display: none; }
    .mpshop-trigger { gap: 8px; padding-right: 10px; }
    .mpshop-name { max-width: 120px; }
}

@media (prefers-reduced-motion: reduce) {
    .mpshop-panel,
    .mpshop-panel.is-open {
        transform: translateX(var(--mpshop-shift, 0px));
        transition: opacity .08s linear;
    }
    .mpshop-chevron, .mpshop-tab, .mpshop-option, .mpshop-check { transition-duration: .01s; }
}

/* --- Page layout --- */
/* Контент на всю ширину .main и с теми же боковыми отступами, что у Обзора,
   — левый край карточек совпадает с заголовком в топбаре на всех вкладках
   (раньше max-width 1520px + margin auto уводил контент вправо от заголовка
   на широких экранах). */
.page {
    padding: 28px 28px 40px;
}

.page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.page-header h1 { font-size: 28px; color: var(--text-primary); }

.page-header-actions { display: flex; align-items: center; gap: 10px; }

.page-subtitle {
    /* Единая подпись под заголовком на всех страницах. */
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 14px;
}

/* Обзор — свободнее по ширине и чуть компактнее по вертикальным отступам,
   чем остальные страницы (см. .page выше); задеваем только эту страницу
   через :has(), не трогая max-width/padding остальных разделов. */
.page:has(.overview-page) {
    max-width: none;
    padding: 24px 28px 36px;
}

/* =========================================================================
   Страница «Обзор» — premium SaaS dashboard: серый фон приложения, светлый
   canvas (.main), белые карточки, чёрная типографика, дозированный лайм.
   Классы с префиксом .ov- локальны для этой страницы, чтобы не задевать
   .kpi-grid/.kpi-card/.card, которыми пользуются другие страницы, и не
   переопределять фирменный фиолетовый (--mocha-*) за её пределами.
   ========================================================================= */
.overview-page { display: flex; flex-direction: column; gap: 16px; }

/* Ряд 1 — Чистая прибыль (5 колонок) + waterfall (7 колонок), §5 брифа
   редизайна "Финансовый пульс". Ряд 3 — тот же принцип 5/3/4. */
.ov-row-hero { display: grid; grid-template-columns: 5fr 7fr; gap: 16px; align-items: stretch; }
.ov-row-bottom { display: grid; grid-template-columns: 5fr 3fr 4fr; gap: 16px; align-items: stretch; }
.ov-row-hero > *, .ov-row-bottom > * { min-width: 0; }

/* Входная анимация: карточки проявляются снизу-вверх с лёгким сдвигом,
   каскадом (emil-design-eng: stagger 30-80ms, никогда не блокирует
   интеракцию — только opacity/transform, оба на композиторе). */
@media (prefers-reduced-motion: no-preference) {
    .ov-controls, .ov-card, .ov-kpi-panel {
        /* backwards, не both: оставленный после анимации transform делал
           .ov-controls отдельным слоем, и следующие карточки перекрывали
           панель выбора периода — клики по датам уходили в страницу. */
        animation: ov-rise .5s var(--ease-out-strong) backwards;
    }
    .ov-controls { animation-delay: 0ms; }
    .ov-row-hero > *:nth-child(1) { animation-delay: 40ms; }
    .ov-row-hero > *:nth-child(2) { animation-delay: 80ms; }
    .ov-kpi-panel { animation-delay: 120ms; }
    .ov-trend-card { animation-delay: 160ms; }
}

@keyframes ov-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Глобальный выбор периода — в шапке (topbar_controls), см. §4 брифа. */
.ov-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.daterange-trigger {
    transition: transform 120ms var(--ease-out-strong), background 150ms ease, border-color 150ms ease;
}
.daterange-trigger:active { transform: scale(.97); }

.ov-card {
    background: var(--surface);
    border: 1px solid var(--ov-border);
    border-radius: 22px;
    box-shadow: 0 12px 32px rgba(20, 20, 20, .04), 0 2px 8px rgba(20, 20, 20, .025);
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
}

@media (hover: hover) and (pointer: fine) {
    .ov-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 20px 48px rgba(20, 20, 20, .07), 0 4px 12px rgba(20, 20, 20, .035);
    }
}

.ov-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 16px;
}

.ov-card-title { font-size: 14px; font-weight: 500; letter-spacing: -0.01em; margin: 0; display: flex; align-items: center; gap: 6px; color: var(--ov-ink); }
.ov-card-subtitle { font-size: 12.5px; color: var(--ov-text-muted); margin: 3px 0 0; }

/* --- Карточка «Чистая прибыль» (§6) --- */
.ov-profit-value {
    font-size: clamp(30px, 4.4cqw, 46px);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--ov-ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.ov-profit-value.is-neg { color: var(--ov-danger); }
.ov-profit-delta-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--ov-text-muted); }
.ov-profit-excluded { margin: 6px 0 0; font-size: 12px; color: var(--ov-text-muted); }
.ov-profit-metrics { display: flex; align-items: center; gap: 20px; margin: 22px 0 6px; padding-top: 18px; border-top: 1px solid var(--ov-border); }
.ov-profit-metric { display: flex; flex-direction: column; gap: 4px; }
.ov-profit-metric-label { font-size: 12.5px; color: var(--ov-text-muted); }
.ov-profit-metric-value { font-size: 19px; font-weight: 650; color: var(--ov-ink); font-variant-numeric: tabular-nums; }
.ov-profit-metric-divider { width: 1px; align-self: stretch; background: var(--ov-border); }

.ov-sparkline-wrap {
    position: relative;
    flex: 1;
    min-height: 90px;
    margin-top: 16px;
}
.ov-sparkline-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ov-sparkline-line { fill: none; stroke: #111111; stroke-width: 2; }
.ov-sparkline-dot { fill: #111111; }
.ov-sparkline-dot.is-last { fill: #ffffff; stroke: var(--ov-accent); stroke-width: 3; }
.ov-sparkline-hit { fill: transparent; cursor: pointer; }
.ov-sparkline-value { font-size: 10.5px; font-weight: 600; fill: var(--ov-text-secondary); font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--surface, #ffffff); stroke-width: 4px; stroke-linejoin: round; }
.ov-sparkline-value.is-last { font-size: 11px; font-weight: 700; fill: var(--ov-ink); }
.ov-sparkline-date { font-size: 10px; font-weight: 500; fill: var(--ov-text-secondary); opacity: .7; font-variant-numeric: tabular-nums; }
.ov-sparkline-tooltip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    background: #111111;
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: 10px;
    transform: translate(-50%, -100%);
    white-space: nowrap;
}
.ov-sparkline-tooltip b { font-variant-numeric: tabular-nums; }

/* --- «Структура продаж и прибыли»: кольцо + ключевые показатели (вариант №4) --- */
.ov-donut-card { container-type: inline-size; }
.ov-donut-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 24px; align-items: start; }
.ov-donut-col { display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 0; }
.ov-donut { position: relative; width: 100%; max-width: 340px; aspect-ratio: 1; }
.ov-donut-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ov-donut-seg { cursor: pointer; transition: opacity 150ms ease; }
.ov-donut-seg.is-dim { opacity: .35; }
.ov-donut-label { font-size: 12px; font-weight: 650; text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; pointer-events: none; }
.ov-donut-label.is-outside { font-size: 11px; font-weight: 600; fill: var(--ov-text-secondary); }
.ov-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.ov-donut-total { font-size: 32px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.05; color: var(--ov-ink); font-variant-numeric: tabular-nums; }
.ov-donut-unit { font-size: 14px; font-weight: 600; color: var(--ov-ink); margin-top: 2px; }
.ov-donut-caption { font-size: 12.5px; color: var(--ov-text-muted); margin-top: 4px; line-height: 1.25; }
.ov-donut-tooltip { position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, -100%); background: #111111; color: #ffffff; font-size: 12px; line-height: 1.45; padding: 8px 12px; border-radius: 10px; min-width: 180px; max-width: 260px; }
.ov-donut-tt-title { font-weight: 650; margin-bottom: 2px; }
.ov-donut-tt-row { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.ov-donut-tt-row span { color: rgba(255, 255, 255, .65); }
.ov-donut-tt-part { display: flex; justify-content: space-between; gap: 12px; color: rgba(255, 255, 255, .65); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ov-donut-legend { list-style: none; margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid var(--ov-border); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 32px; }
.ov-donut-legend-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: baseline; gap: 10px; font-size: 13px; color: var(--ov-ink); border-radius: 6px; }
.ov-donut-legend-item.is-active .ov-donut-legend-name { font-weight: 600; }
.ov-donut-dot { width: 10px; height: 10px; border-radius: 50%; align-self: center; }
.ov-donut-legend-name { min-width: 0; overflow-wrap: anywhere; }
.ov-donut-legend-sub { display: block; font-size: 11.5px; color: #B45309; }
.ov-donut-legend-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ov-donut-legend-item.is-neg .ov-donut-legend-value { color: var(--ov-danger); }

.ov-fin-kpis { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ov-fin-kpi { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--ov-border); background: #FAFAF9; }
.ov-fin-kpi-icon { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; color: #4B4F57; }
.ov-fin-kpi-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ov-fin-kpi-label { font-size: 12.5px; color: var(--ov-text-secondary); }
.ov-fin-kpi-value { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--ov-ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-fin-kpi-side { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; }
.ov-fin-kpi-pct { font-size: 15px; font-weight: 650; color: var(--ov-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ov-fin-kpi-note { font-size: 11.5px; color: var(--ov-text-muted); white-space: nowrap; }
.ov-fin-kpi-dash { font-size: 15px; color: var(--ov-text-muted); }
.ov-fin-kpi.is-profit { background: #F1FAE3; border-color: #DCEFC2; }
.ov-fin-kpi.is-profit .ov-fin-kpi-icon { color: #3E9A12; }
.ov-fin-kpi.is-profit .ov-fin-kpi-value { color: #2F7D0B; font-size: 22px; }
.ov-fin-kpi.is-profit.is-neg { background: #FDEFEE; border-color: #F6D3D0; }
.ov-fin-kpi.is-profit.is-neg .ov-fin-kpi-icon, .ov-fin-kpi.is-profit.is-neg .ov-fin-kpi-value { color: var(--ov-danger); }

.ov-fin-notes { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.ov-fin-notes:empty { display: none; }
.ov-fin-warning { margin: 0 0 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid #D97706; background: #FFF7ED; color: #7C2D12; font-size: 12.5px; line-height: 1.4; }
.ov-fin-note { margin: 0; font-size: 12px; color: var(--ov-text-muted); }
.ov-nowrap { white-space: nowrap; }
.ov-fin-note.is-warn { color: #92400E; }
.ov-fin-note.is-neg { color: var(--ov-danger); }
/* Озон: детализация и состояния прибыли (build_ozon_profit_breakdown). */
.ov-donut-tooltip.is-wide { min-width: 240px; max-width: 360px; }
.ov-donut-tooltip.is-wide.is-below { transform: translate(-50%, 0); }
.ov-donut-tooltip.is-wide .ov-donut-tt-part span:last-child { white-space: nowrap; }
.ov-donut-tt-part.is-sub { padding-left: 10px; font-size: 11px; color: rgba(255, 255, 255, .5); }
/* Состав «Прочих расходов» — всплывает при наведении на строку легенды или на сегмент кольца (is-active). */
.ov-donut-legend.is-ozon .ov-donut-legend-item { position: relative; }
.ov-donut-legend-details { display: none; position: absolute; bottom: calc(100% + 4px); left: 20px; z-index: 5;
    padding: 8px 10px; background: #FFFFFF; border: 1px solid var(--ov-border); border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .08); white-space: nowrap; font-weight: 400; }
.ov-donut-legend-item:hover .ov-donut-legend-details,
.ov-donut-legend-item.is-active .ov-donut-legend-details { display: block; }
.ov-donut-legend-detail { display: block; font-size: 11.5px; line-height: 1.5; color: var(--ov-text-secondary); }
.ov-donut-dot.is-income { background: transparent; border: 2px solid #3E9A12; box-sizing: border-box; }
.ov-donut-legend-item.is-income .ov-donut-legend-value { color: #2F7D0B; }
.ov-donut-legend-value.is-missing { font-weight: 500; color: #B45309; }
.ov-fin-kpi-sub { font-size: 11.5px; color: var(--ov-text-muted); line-height: 1.35; }
.ov-donut-legend.is-ozon { align-items: start; }
.ov-donut-legend.is-ozon .ov-donut-legend-item { align-items: start; }
.ov-donut-legend.is-ozon .ov-donut-dot { align-self: start; margin-top: 4px; }
.ov-fin-kpi.is-profit.is-precost { background: #F3F4F6; border-color: #D9DCE1; }
.ov-fin-kpi.is-profit.is-precost .ov-fin-kpi-icon, .ov-fin-kpi.is-profit.is-precost .ov-fin-kpi-value { color: #4B4F57; }
.ov-fin-warning.is-strong { border-width: 2px; font-size: 13px; }
.ov-fin-warning a { color: inherit; font-weight: 600; }

@container (max-width: 620px) {
    .ov-donut-layout { grid-template-columns: 1fr; }
    .ov-donut { max-width: 300px; }
    .ov-donut-legend { grid-template-columns: 1fr; }
}
.ov-waterfall-empty, .ov-empty-note { font-size: 13px; color: var(--ov-text-muted); padding: 24px 0; text-align: center; }

/* --- Горизонтальная KPI-панель (§8) --- */
.ov-kpi-panel {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    background: var(--ov-border);
    border: 1px solid var(--ov-border);
    border-radius: 22px;
    box-shadow: 0 12px 32px rgba(20, 20, 20, .04), 0 2px 8px rgba(20, 20, 20, .025);
    overflow: hidden;
}
.ov-kpi-item { background: var(--surface); padding: 18px 22px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ov-kpi-item-label { font-size: 12px; font-weight: 500; color: var(--ov-text-secondary); }
.ov-kpi-item-value { font-size: clamp(16px, 2.4cqw, 21px); font-weight: 650; letter-spacing: -0.02em; color: var(--ov-ink); font-variant-numeric: tabular-nums; }
.ov-kpi-item-foot { display: flex; align-items: center; gap: 6px; font-size: 12.5px; flex-wrap: wrap; }
.ov-delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ov-delta.up { color: var(--ov-success); }
.ov-delta.down { color: var(--ov-danger); }
.ov-delta.neutral { color: var(--ov-text-muted); }
.ov-kpi-item-note { color: #96969E; }

/* Прогресс-бары — процент выкупа (§11): нейтральная чёрно-серая шкала. */
/* --- «Заказы и продажи» (вернули по просьбе — прежний график до
   редизайна, просто в нижнем ряду страницы вместо верхнего). --- */
.ov-trend-card { min-height: 380px; }
.ov-legend { display: flex; gap: 4px; }
.ov-legend button {
    display: flex;
    align-items: center;
    gap: 7px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--ov-text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 9px;
    border-radius: 9px;
    transition: background 150ms ease, color 150ms ease, transform 120ms var(--ease-out-strong), opacity 150ms ease;
}
.ov-legend button:hover { background: var(--ov-icon-bg); color: var(--ov-ink); }
.ov-legend button:active { transform: scale(.96); }
.ov-legend button[aria-pressed="false"] { opacity: .4; }
.ov-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.ov-chart-wrap {
    position: relative;
    height: 340px;
    max-width: 100%;
    margin: 0 -16px;
    flex: 1;
    transition: height 320ms var(--ease-in-out-strong);
}
.ov-chart-wrap canvas { max-width: 100%; }

@media (prefers-reduced-motion: reduce) {
    .ov-controls, .ov-card, .ov-kpi-panel { animation: none; }
    .ov-card:hover { transform: none; }
    .ov-chart-wrap { transition: none; }
}

@media (max-width: 1024px) {
    .ov-row-hero { grid-template-columns: 1fr; }
    .ov-kpi-panel { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .ov-kpi-panel { grid-template-columns: 1fr; }
    .ov-profit-metrics { gap: 16px; }
    .ov-chart-wrap { height: 260px; }
}

/* --- Главная (лендинг) --- */
.landing-hero {
    display: grid;
    grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
    align-items: center;
    gap: 28px;
    padding: 28px 16px 32px;
    max-width: 1520px;
    margin: 0 auto;
}

.hero-label {
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.hero-title {
    font-size: 36px;
    line-height: 1.18;
    color: var(--text-primary);
    margin: 0 0 14px;
}

.hero-subtitle {
    max-width: 560px;
    margin: 0 0 22px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

/* Три преимущества с круглыми иконками — левая колонка героя. */
.pitch-benefits {
    list-style: none;
    margin: 0 0 26px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.pitch-benefits li {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.pitch-benefits strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.pitch-benefits li > span:last-child {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.pitch-benefit-icon {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--mocha-100);
    color: var(--mocha-700);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pitch-benefit-icon svg { width: 19px; height: 19px; }

.pitch-cta {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--mocha-100);
    border: 1px solid var(--mocha-300);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
}

.pitch-cta-icon {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    color: var(--mocha-700);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pitch-cta-icon svg { width: 22px; height: 22px; }

.pitch-cta strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.pitch-cta > span:last-child {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-secondary);
}

/* Сцена: скриншот сдвинут вправо, карточка авторизации лежит поверх его
   левого края (как в референсе). На узких экранах оба становятся в поток. */
.landing-stage { position: relative; }

.landing-stage .auth-panel {
    position: absolute;
    left: 0;
    /* Процент, а не пиксели: сцена масштабируется вместе со скриншотом, и
       карточка должна оставаться ниже заголовка «Прибыль по SKU», но выше
       строки итога — иначе крупная цифра оказывается разрезанной. */
    top: 19.5%;
    width: 340px;
    z-index: 2;
    box-shadow: 0 18px 50px rgba(31, 26, 21, .14);
}

.hero-cta {
    display: inline-block;
    text-decoration: none;
    background: var(--ink-900);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    padding: 13px 30px;
    border-radius: var(--radius-pill);
    transition: opacity var(--ease-standard) .15s;
}

.hero-cta:hover { opacity: .85; }

/* --- Правая колонка лендинга: текст + настоящий скриншот дашборда --- */
.landing-pitch { padding-top: 0; }

.hero-shot {
    margin: 0 0 0 148px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    background: var(--surface);
}

.hero-shot img {
    display: block;
    width: 100%;
    height: auto;
}

/* --- Карточка авторизации на лендинге --- */
.auth-panel { padding: 24px; }

/* Скрытая вкладка — это <form hidden>, а не удалённый узел, поэтому селектор
   `.auth-card form + form { margin-top: 12px }` дал бы отступ сверху у второй
   формы. Внутри панели он не нужен: формы никогда не видны одновременно. */
.auth-panel form + form { margin-top: 0; }
.auth-panel form[hidden] { display: none; }

.auth-tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.auth-tab {
    border: none;
    background: none;
    padding: 0 0 12px;
    margin-bottom: -1px;
    font-family: var(--font-sans), sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color var(--ease-standard) .15s;
}

.auth-tab:hover { color: var(--text-primary); }

.auth-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--ink-900);
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: -4px;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}

.auth-remember input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--ink-900);
    cursor: pointer;
}

.auth-forgot {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-dark);
    text-decoration: none;
    white-space: nowrap;
}

.auth-forgot:hover { text-decoration: underline; }

.auth-note {
    margin: -4px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
}

.auth-secure {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
}

.auth-secure svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: var(--mocha-700);
}

.site-footer {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 24px 16px 32px;
    font-size: 13px;
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

.auth-panel-signed .hero-cta { margin-top: 4px; }

.section-label {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 24px 0 14px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.feature-grid-lead { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.feature-card-accent {
    background: var(--mocha-100);
    border-color: var(--mocha-300);
}

.feature-card-accent .feature-icon {
    background: var(--ink-900);
    color: #fff;
}

.feature-card-accent h3 { font-size: 18px; }
.feature-card-accent p { font-size: 14px; }

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 16px 18px 18px;
}

.feature-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: var(--mocha-100);
    color: var(--mocha-700);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.feature-icon svg { width: 18px; height: 18px; }

.feature-card h3 {
    font-family: var(--font-display), sans-serif;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
}

@media (max-width: 1180px) {
    .landing-hero { grid-template-columns: 1fr; gap: 28px; padding-top: 24px; }
    .landing-stage .auth-panel {
        position: static;
        transform: none;
        width: 100%;
        max-width: 420px;
        margin: 0 auto 24px;
    }
    .hero-shot { margin: 0; }
    .hero-title { font-size: 30px; }
    .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .feature-grid-lead { grid-template-columns: 1fr; }
}

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

/* --- Controls card --- */
.controls {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 18px 24px;
    margin-bottom: 24px;
}

.controls form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.controls input[type="date"],
.controls input[type="number"] {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 7px 10px;
    font-family: var(--font-sans), sans-serif;
    color: var(--text-primary);
    background: var(--surface);
}

.controls input[type="number"] { width: 70px; }

.controls button.apply {
    border: none;
    background: var(--ink-900);
    color: #fff;
    font-weight: 600;
    padding: 9px 20px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    transition: opacity var(--ease-standard) .15s;
}

.controls button.apply:hover { opacity: .85; }

/* --- Фильтр по складам (Остатки) --- */
.wh-filter { position: relative; }

.wh-filter-toggle {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
}

.wh-filter-toggle:hover { background: var(--color-surface-sunken); }

.wh-filter-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    width: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 10px;
}

.wh-filter-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.wh-filter-actions button {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
}

.wh-filter-actions button:hover { background: var(--color-surface-sunken); }

.wh-filter-list {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wh-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-primary);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.wh-filter-item:hover { background: var(--color-surface-sunken); }

/* --- Режим редактирования порядка строк (drag-and-drop) --- */
.order-edit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-edit-toggle,
.order-edit-save {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    transition: background var(--ease-standard) .15s, opacity var(--ease-standard) .15s;
}

.order-edit-toggle:hover { background: var(--color-surface-sunken); }

.order-edit-toggle.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.order-edit-save {
    background: var(--ink-900);
    color: #fff;
    border-color: var(--ink-900);
}

.order-edit-save:disabled { opacity: .4; cursor: not-allowed; }
.order-edit-extra:disabled { opacity: .4; cursor: not-allowed; }
/* display: inline-flex у .sm-pill-btn перебивал атрибут hidden — кнопки
   «Скрыть выбранные» / «Скрытые товары» были видны и вне режима
   редактирования, а на узком экране сдвигали страницу при появлении. */
.order-edit-extra[hidden] { display: none; }

/* Окно «Скрытые товары» в режиме редактирования. */
.sku-hidden-dialog { width: 560px; }
.sku-hidden-list { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.sku-hidden-model {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
}
.sku-hidden-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.sku-hidden-head .thumb { width: 32px; height: 32px; border-radius: 8px; flex: none; }
.sku-hidden-name { font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sku-hidden-why { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.sku-hidden-sizes { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0 26px; }
.sku-hidden-size {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 13px;
    cursor: pointer;
}
.sku-hidden-size:has(input:checked) { border-color: var(--brand); }
.sku-hidden-footer {
    position: sticky;
    bottom: -24px;
    display: flex;
    justify-content: flex-end;
    margin: 16px -24px -24px;
    padding: 12px 24px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

table.order-editing tbody tr[data-nm-id] { cursor: grab; }
table.order-editing tbody tr[data-nm-id].dragging { opacity: .4; }

/* Редактируемая себестоимость и подсветка строк без данных живут только
   на /profit — их оформление целиком в блоке ".profit-page" внизу файла. */
.cost-input { font-family: var(--font-sans), sans-serif; }

.coverage-warning {
    max-width: 1520px;
    margin: 0 auto 16px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    background: var(--mocha-100);
    border: 1px solid var(--mocha-300);
    color: var(--text-primary);
    font-size: 14px;
}

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

.controls-search-edit { justify-content: space-between; }
.controls-search-edit .search-input { margin-left: 0; }

.search-input {
    margin-left: auto;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    font-family: var(--font-sans), sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
    width: 220px;
}

.search-input:focus {
    outline: none;
    border-color: var(--brand);
}

/* --- Metric toggle (сегментированный переключатель, две half-pill плашки) --- */
.toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
    background: var(--surface);
}

.toggle a {
    flex: 1 1 0%;
    text-align: center;
    text-decoration: none;
    padding: 11px 22px;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    color: var(--text-secondary);
    background: var(--surface);
    transition: background var(--ease-standard) .2s, color var(--ease-standard) .2s;
}

.toggle a:first-child { border-right: 1px solid var(--border); }

.toggle a:hover:not(.active) { color: var(--text-primary); }

.toggle a.active {
    background: var(--mocha-300);
    color: var(--ink-900);
    font-weight: 700;
}

/* --- Chart card --- */
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.chart-title {
    font-family: var(--font-display), sans-serif;
    font-size: 17px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.section-title {
    font-family: var(--font-display), sans-serif;
    font-size: 17px;
    color: var(--text-primary);
    margin: 24px 0 10px;
}

.chart-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.chart-legend span { display: flex; align-items: center; gap: 6px; }

.chart-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* --- Table card --- */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.table-scroll {
    overflow-x: auto;
    max-width: 100%;
}

table.grid {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-size: 14px;
}

table.grid th, table.grid td {
    padding: 10px 14px;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

table.grid thead th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 5;
}

table.grid td.photo-col, table.grid th.photo-col {
    position: sticky;
    left: 0;
    z-index: 6;
    background: var(--surface);
    text-align: left;
}

table.grid td.article-col, table.grid th.article-col {
    position: sticky;
    left: 56px;
    z-index: 6;
    background: var(--surface);
    text-align: left;
    font-weight: 700;
    border-right: 1px solid var(--border);
}

table.grid thead th.photo-col, table.grid thead th.article-col { z-index: 7; }

table.grid tbody tr:hover td:not(.photo-col):not(.article-col) {
    filter: brightness(0.98);
}

table.grid tr.total-row td {
    background: var(--total-row-bg) !important;
    font-weight: 700;
    color: var(--ink-900) !important;
}

table.grid tr.total-row td.photo-col,
table.grid tr.total-row td.article-col {
    background: var(--total-row-bg) !important;
}

.thumb {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    display: block;
}

/* Карточка есть в cards, но WB ещё не отдал обработанное фото (photo_url
   NULL/'') — товар всё равно виден в dashboard, просто с нейтральной
   заглушкой вместо реального изображения. */
.thumb-placeholder {
    background: var(--surface-sunken);
}

.drr-cell .spend { font-weight: 600; }
.drr-cell .pct {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

/* =========================================================================
   /orders/fbs делит .sku-matrix-page с «Заказы по SKU», но ещё не переехал
   на новую дизайн-систему — старые классы (.control-card/.kpi-card/...)
   оставлены как есть именно для неё. Новая /orders ниже использует только
   свои sm-* классы и .ov-card, с этим блоком не пересекается.
   ========================================================================= */
.sku-matrix-page .page-header { align-items: flex-start; }

.sku-matrix-page .control-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    padding: 24px;
    margin-bottom: 24px;
}

.sku-matrix-page .controls {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 20px;
    gap: 12px;
}

.sku-matrix-page .controls:last-child { margin-bottom: 0; }

.sku-matrix-page .search-input { margin-left: 0; width: 260px; }
.sku-matrix-page .drr-search { margin-left: auto; }

.sku-matrix-page .order-edit-toggle {
    padding: 9px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sku-matrix-page .order-edit-save { padding: 9px 16px; }

.sku-matrix-page .reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    padding: 9px 14px;
    border-radius: var(--radius-pill);
    transition: background var(--ease-standard) .15s;
}

.sku-matrix-page .reset-btn:hover { background: var(--color-surface-sunken); }

.sku-matrix-page .kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* FBS: пять KPI-карточек в один ряд (не влезают в общий .kpi-row из 4). */
.sku-matrix-page .kpi-row-5 { grid-template-columns: repeat(5, 1fr); }

@media (max-width: 1100px) {
    .sku-matrix-page .kpi-row-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .sku-matrix-page .kpi-row-5 { grid-template-columns: repeat(2, 1fr); }
}

.sku-matrix-page .kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.sku-matrix-page .kpi-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--mocha-100);
    color: var(--mocha-700);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sku-matrix-page .kpi-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.sku-matrix-page .kpi-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

.sku-matrix-page .kpi-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sku-matrix-page .kpi-value-sm { font-size: 17px; }

.sku-matrix-page .kpi-sub { font-size: 12px; color: var(--text-muted); }
.sku-matrix-page .table-card { border-radius: 18px; }

@media (max-width: 1200px) {
    .sku-matrix-page .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .sku-matrix-page .kpi-row { grid-template-columns: 1fr; }
}

/* =========================================================================
   Страница "Заказы по SKU" (Заказы / Продажи) — на дизайн-системе «Обзора»:
   те же .ov-card/.ov-controls/.daterange-trigger, лаймовый акцент только на
   KPI-иконках, чёрный — для активных состояний переключателей.
   ========================================================================= */
.sku-matrix-page { display: flex; flex-direction: column; gap: 16px; }

/* Данные тут разглядывают, а не "заходят" как в KPI-ссылки на Обзоре —
   плавающий hover на каждой карточке будет только мешать сканировать
   таблицу и контролы. */
.sku-matrix-page .ov-card:hover { transform: none; box-shadow: 0 12px 32px rgba(20, 20, 20, .04), 0 2px 8px rgba(20, 20, 20, .025); }

.sm-control-card { padding: 16px 20px; margin-bottom: 20px; }

.sm-controls-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* --- Сегментированный переключатель Заказы/Продажи --- */
.sm-toggle {
    display: inline-flex;
    background: var(--ov-icon-bg);
    border-radius: var(--radius-pill);
    padding: 3px;
    flex: 0 0 auto;
}

.sm-toggle a {
    text-decoration: none;
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 14px;
    color: var(--ov-text-secondary);
    transition: background 150ms ease, color 150ms ease;
}

.sm-toggle a:hover:not(.active) { color: var(--ov-ink); }
.sm-toggle a.active { background: #111111; color: #fff; }
.sm-toggle--scheme a.active { background: var(--ov-accent); color: var(--ov-ink); }

.sm-stock-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.sm-stock-number {
    font: inherit; color: inherit; background: none; border: 0; cursor: help;
    padding: 4px 6px; text-decoration: underline dotted; text-underline-offset: 4px;
    text-decoration-color: var(--ov-text-muted);
}
.sm-stock-number:hover, .sm-stock-number:focus-visible { text-decoration-style: solid; }
.sm-stock-tip {
    position: fixed; z-index: 1200; box-sizing: border-box; width: max-content; max-width: calc(100vw - 16px);
    overflow: auto; overscroll-behavior: contain; padding: 6px 12px;
    background: var(--surface); color: var(--ov-ink); border: 1px solid var(--ov-border);
    border-radius: 12px; box-shadow: 0 8px 32px rgb(0 0 0 / 16%); font-size: 14px;
    overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.sm-stock-tip[hidden] { display: none; }
.sm-stock-tip-size { display: flex; justify-content: space-between; gap: 20px; padding: 4px 0; }
.sm-stock-tip-size + .sm-stock-tip-size { border-top: 1px solid var(--ov-border); }
.sm-stock-tip-size span:last-child { font-weight: 600; }
.sm-stock-sort { display: inline-flex; align-items: center; justify-content: center; gap: 3px; color: inherit; text-decoration: none; }
.sm-stock-sort:hover, .sm-stock-sort:focus-visible { text-decoration: underline; }
.sm-stock-filter input[type="number"] {
    width: 5.5em; padding: 8px 10px; border: 1px solid var(--ov-border);
    border-radius: 8px; background: var(--surface); color: var(--ov-ink); font: inherit;
}

.sm-search-input {
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    font-family: var(--font-sans), sans-serif;
    font-size: 14px;
    color: var(--ov-ink);
    background: var(--ov-icon-bg);
    width: 220px;
    transition: background 150ms ease, border-color 150ms ease;
}
.sm-search-input:focus { outline: none; background: #fff; border-color: rgba(0, 0, 0, .16); }

.sm-pill-btn {
    border: 1px solid rgba(0, 0, 0, .08);
    background: var(--ov-icon-bg);
    color: var(--ov-ink);
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 150ms ease, transform 120ms var(--ease-out-strong);
}
.sm-pill-btn:hover { background: #fff; }
.sm-pill-btn:active { transform: scale(.97); }
.sm-pill-btn.active { background: var(--ov-accent); border-color: var(--ov-accent); color: #111111; }
.sm-pill-btn--dark { background: #111111; color: #fff; border-color: #111111; }
.sm-pill-btn--dark:hover { background: #2a2a2a; }
.sm-pill-btn:disabled { opacity: .4; cursor: not-allowed; }
.sku-matrix-page .order-edit-save[hidden] { display: none; }

.sku-matrix-page .quick-periods {
    display: inline-flex;
    gap: 2px;
    background: var(--ov-icon-bg);
    border-radius: var(--radius-pill);
    padding: 3px;
    margin-left: auto;
}

.sku-matrix-page .quick-period {
    text-decoration: none;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 13px;
    color: var(--ov-text-secondary);
    transition: background 150ms ease, color 150ms ease;
}
.sku-matrix-page .quick-period:hover:not(.active) { color: var(--ov-ink); }
.sku-matrix-page .quick-period.active { background: #111111; color: #fff; }

.sm-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--ov-text-secondary);
    font-weight: 600;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    transition: background 150ms ease, color 150ms ease;
}
.sm-reset-btn:hover { background: var(--ov-icon-bg); color: var(--ov-ink); }

/* --- KPI-ряд: та же карточка, что на Обзоре (лаймовая полоска + иконка),
   но без ссылки-шеврона — тут некуда переходить, это просто сводка. --- */
.sm-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.sm-kpi {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding-left: 28px;
    overflow: hidden;
}
.sm-kpi::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--ov-accent);
}

.sm-kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: var(--ov-accent-soft);
    color: var(--ov-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.sm-kpi-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sm-kpi-label { font-size: 13px; font-weight: 500; color: var(--ov-text-secondary); }
.sm-kpi-value {
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--ov-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sm-kpi-value--sm { font-size: 18px; }
.sm-kpi-note { font-size: 12.5px; color: var(--ov-text-muted); font-variant-numeric: tabular-nums; }

.sm-table-card { padding: 0; overflow: hidden; }

.sku-matrix-page table.grid thead th {
    background: var(--ov-icon-bg);
    padding: 9px 12px;
    color: var(--ov-text-secondary);
    font-weight: 600;
    font-size: 12.5px;
}

.sku-matrix-page table.grid td { padding: 5px 12px; font-size: 12.5px; }
.sku-matrix-page table.grid tbody tr[data-nm-id] td { height: 34px; box-sizing: content-box; padding-top: 4px; padding-bottom: 4px; }

/* --- ДРР-таблица: чуть шире ячейки дат (по просьбе пользователя, только эта страница) --- */
.drr-matrix table.grid thead th { padding: 13px 22px; }
.drr-matrix table.grid td { padding: 9px 22px; }

.drr-matrix table.grid th:not(.photo-col):not(.article-col),
.drr-matrix table.grid td:not(.photo-col):not(.article-col) {
    min-width: 108px;
}

.sku-matrix-page table.grid td.photo-col,
.sku-matrix-page table.grid th.photo-col,
.sku-matrix-page table.grid td.article-col,
.sku-matrix-page table.grid th.article-col {
    background: var(--surface);
}

.sku-matrix-page table.grid thead th.photo-col,
.sku-matrix-page table.grid thead th.article-col {
    background: var(--ov-icon-bg);
}

.sku-matrix-page table.grid td.article-col,
.sku-matrix-page table.grid th.article-col {
    box-shadow: 2px 0 4px -2px rgba(20, 21, 26, .1);
}

.sku-matrix-page table.grid tr.total-row td { background: var(--ov-icon-bg) !important; font-weight: 650; }
.sku-matrix-page table.grid tr.total-row td.photo-col,
.sku-matrix-page table.grid tr.total-row td.article-col { background: var(--ov-icon-bg) !important; }

.sku-matrix-page .thumb { width: 26px; height: 26px; border-radius: 7px; border: none; }

/* --- Колонка "Тренд" — идея 4: спарклайн по строке вместо/вместе с
   heatmap-заливкой, прибита к правому краю, чтобы форма графика была видна
   и при горизонтальном скролле по датам. --- */
.sku-matrix-page table.grid td.trend-col,
.sku-matrix-page table.grid th.trend-col {
    position: sticky;
    right: 0;
    z-index: 6;
    background: var(--surface);
    border-left: 1px solid var(--border);
    text-align: center;
    padding: 4px 8px;
    min-width: 84px;
}
.sku-matrix-page table.grid thead th.trend-col { z-index: 7; background: var(--ov-icon-bg); }
.sku-matrix-page table.grid tr.total-row td.trend-col { background: var(--ov-icon-bg) !important; }
.sm-sparkline { display: block; margin: 0 auto; overflow: visible; }

.sm-kpi-row--5 { grid-template-columns: repeat(5, 1fr); }
.sm-kpi-row--2 { grid-template-columns: repeat(2, 1fr); max-width: 640px; }

@media (max-width: 1200px) {
    .sm-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .sm-kpi-row--5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
    .sm-kpi-row { grid-template-columns: 1fr; }
    .sm-kpi-row--5 { grid-template-columns: 1fr; }
    .sm-kpi-row--2 { grid-template-columns: 1fr; }
    .quick-periods { margin-left: 0; }
    .sm-controls-row { gap: 10px; }
}

/* =========================================================================
   FBS-заказы (/orders/fbs): компактная строка общей статистики над
   таблицей и нижняя выдвижная панель "Склады FBS" вместо большой карточки
   над матрицей — см. build_fbs_orders_grid в data_layer.py (kpis/
   status_summary/warehouse_summary).
   ========================================================================= */
.sm-note {
    margin: -8px 4px 0;
    font-size: 12.5px;
    color: var(--ov-text-secondary);
}

.sm-stat-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 30px;
    padding: 0 4px;
    font-size: 13px;
    color: var(--ov-text-secondary);
    font-variant-numeric: tabular-nums;
}
.sm-stat-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ov-accent);
    flex: 0 0 auto;
}
.sm-stat-item b { color: var(--ov-ink); font-weight: 700; }
.sm-stat-item--warn b { color: var(--red-600); }
.sm-stat-sep { color: var(--border); }

.sm-empty-row td { text-align: center; color: var(--ov-text-secondary); padding: 32px 12px; }
.sm-empty-note { padding: 20px; margin: 0; color: var(--ov-text-secondary); font-size: 13px; }

/* --- Баннер "% выкупа по складам FBS": мозаика плиток, цвет плитки —
   выкуп относительно среднего. Свёрнут (по умолчанию) — одна строка
   плиток, кнопка "Раскрыть ещё N" в шапке (data-state="expanded"). --- */
.sm-wh-banner { padding: 16px 20px; }

.sm-wh-banner-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sm-wh-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--ov-icon-bg);
    color: var(--ov-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.sm-wh-title { font-weight: 700; font-size: 14px; color: var(--ov-ink); flex: 0 0 auto; }

.sm-wh-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 13px;
    color: var(--ov-text-secondary);
}
.sm-wh-stat b { color: var(--ov-ink); font-weight: 700; }
.sm-wh-dot { color: var(--border); }

.sm-wh-c.sm-wh-heading { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sm-wh-banner-head { flex-wrap: wrap; row-gap: 10px; }
.sm-wh-banner .sm-wh-title { font-size: 15px; }


.sm-wh-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 9px 14px 9px 16px;
    border: 0;
    border-radius: var(--radius-pill);
    background: #111111;
    color: #fff;
    font-family: var(--font-sans), sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms ease;
}
.sm-wh-heading + .sm-wh-toggle-btn { margin-left: auto; }
.sm-wh-toggle-btn:hover { background: #2A2A2E; }
.sm-wh-toggle-btn:focus-visible { outline: 2px solid var(--ov-accent); outline-offset: 2px; }
.sm-wh-toggle-btn .sm-wh-chevron { color: var(--ov-accent); transition: transform 200ms ease; }
.sm-wh-banner[data-state="expanded"] .sm-wh-chevron { transform: rotate(180deg); }
.sm-wh-chevron { flex: 0 0 auto; }

/* Высота плитки фиксирована — свёрнутое состояние = ровно одна строка. */
.sm-wh-mosaic {
    --wh-tile-h: 66px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    grid-auto-rows: var(--wh-tile-h);
    gap: 6px;
    margin-top: 14px;
    max-height: var(--wh-tile-h);
    overflow: hidden;
}
.sm-wh-banner[data-state="expanded"] .sm-wh-mosaic { max-height: none; }

.sm-wh-tile {
    border-radius: 12px;
    padding: 8px 11px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-width: 0;
    background: var(--ov-icon-bg);
    color: var(--ov-ink);
    cursor: default;
}
.sm-wh-tile-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-wh-tile-pct { font-size: 18px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.sm-wh-tile-orders { font-size: 11px; color: var(--ov-text-secondary); font-variant-numeric: tabular-nums; }

.sm-wh-tile--good { background: rgba(32, 166, 106, .13); }
.sm-wh-tile--warn { background: rgba(217, 131, 0, .15); }
.sm-wh-tile--bad { background: rgba(229, 55, 43, .13); }
.sm-wh-tile--bad .sm-wh-tile-pct { color: #B3261E; }
.sm-wh-tile--none { opacity: .6; }
.sm-wh-tile:hover, .sm-wh-tile:focus-visible { outline: 2px solid var(--ov-ink); outline-offset: -2px; }

.sm-wh-tip {
    position: fixed;
    z-index: 1000;
    min-width: 200px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #111111;
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    pointer-events: none;
}
.sm-wh-tip-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.sm-wh-tip-row { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.sm-wh-tip-row span:first-child { color: rgba(255, 255, 255, .6); }
.sm-wh-tip-row b { color: var(--ov-accent); }
   Страница "Остатки" — на дизайн-системе «Обзора»: те же .ov-card/sm-*
   контролы, что на /orders, но таблица остаётся table.simple (не .grid) —
   тут нет heatmap-ячеек, только строки с разворачиваемой детализацией.
   ========================================================================= */
.stock-page { display: flex; flex-direction: column; gap: 16px; }
.stock-page .ov-card:hover { transform: none; box-shadow: 0 12px 32px rgba(20, 20, 20, .04), 0 2px 8px rgba(20, 20, 20, .025); }

.stock-page table.simple thead th {
    background: var(--ov-icon-bg);
    color: var(--ov-text-secondary);
    padding: 13px 16px;
}
.stock-page table.simple td { padding: 12px 16px; }
.stock-page table.simple tbody tr:hover { background: var(--ov-icon-bg); }

.stock-page .badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
}
.stock-page .badge-risk { background: color-mix(in srgb, var(--status-critical) 12%, white); }
.stock-page .badge-normal { background: color-mix(in srgb, var(--status-good) 12%, white); }
.stock-page .badge-high { background: color-mix(in srgb, var(--status-warning) 12%, white); }
.stock-page .badge-muted { background: var(--ov-icon-bg); }

.stock-page .wh-filter-toggle { font-weight: 600; }

/* =========================================================================
   Страница "Пополнение" — та же дизайн-система, что и "Остатки": .ov-card/
   sm-* контролы + table.simple со скругленными pill-бейджами статусов.
   ========================================================================= */
.reorder-page { display: flex; flex-direction: column; gap: 16px; }
.reorder-page .ov-card:hover { transform: none; box-shadow: 0 12px 32px rgba(20, 20, 20, .04), 0 2px 8px rgba(20, 20, 20, .025); }

.reorder-page table.simple thead th {
    background: var(--ov-icon-bg);
    color: var(--ov-text-secondary);
    padding: 13px 16px;
}
.reorder-page table.simple td { padding: 12px 16px; }
.reorder-page table.simple tbody tr:hover { background: var(--ov-icon-bg); }

.reorder-page .badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
}
.reorder-page .badge-risk { background: color-mix(in srgb, var(--status-critical) 12%, white); }
.reorder-page .badge-normal { background: color-mix(in srgb, var(--status-good) 12%, white); }
.reorder-page .badge-high { background: color-mix(in srgb, var(--status-warning) 12%, white); }
.reorder-page .badge-muted { background: var(--ov-icon-bg); }

.reorder-page input[type="number"] {
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: var(--radius-pill);
    padding: 8px 14px;
    font-family: var(--font-sans), sans-serif;
    color: var(--ov-ink);
    background: var(--ov-icon-bg);
    width: 76px;
}
.reorder-page input[type="number"]:focus { outline: none; background: #fff; border-color: rgba(0, 0, 0, .16); }

/* Оборачиваемость: три сопоставимых окна спроса и явный план поставки. */
.turnover-settings { padding: 24px; }
.turnover-form { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 20px 28px; }
.turnover-field { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.turnover-field > label, .turnover-field legend { font-size: 13px; font-weight: 600; color: var(--ov-ink); }
.turnover-field legend { padding: 0; margin-bottom: 10px; }
.turnover-field small, .turnover-note { color: var(--ov-text-secondary); font-size: 11px; line-height: 1.5; }
.turnover-note { display: block; margin-top: 5px; font-weight: 400; }
.reorder-page .turnover-field input[type="number"] { width: 100px; height: 40px; box-sizing: border-box; font-size: 15px; font-variant-numeric: tabular-nums; }
.turnover-segments { display: flex; padding: 3px; gap: 3px; border-radius: var(--radius-pill); background: var(--ov-icon-bg); }
.turnover-segments label { position: relative; cursor: pointer; }
.turnover-segments input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.turnover-segments span { display: block; padding: 7px 17px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 500; white-space: nowrap; }
.turnover-segments input:checked + span { background: var(--ov-ink); color: #fff; }
.turnover-recalculate { margin-top: 27px; height: 40px; }
.reorder-page :is(input, button, summary, .table-scroll):focus-visible,
.turnover-segments input:focus-visible + span { outline: 2px solid var(--ov-ink); outline-offset: 3px; }
.turnover-mode { flex-basis: 100%; align-items: flex-start; }
.turnover-mode .turnover-segments { display: grid; grid-template-columns: repeat(2, 1fr); position: relative; gap: 0; text-align: center; }
.turnover-mode .turnover-segments::before { content: ""; position: absolute; inset: 3px auto 3px 3px; width: calc(50% - 3px); background: var(--ov-ink); border-radius: inherit; }
.turnover-mode .turnover-segments:has(input[value="buyout"]:checked)::before { transform: translateX(100%); }
.turnover-mode .turnover-segments input:checked + span { background: transparent; }
@media (prefers-reduced-motion: no-preference) {
    .turnover-mode .turnover-segments::before { transition: transform 150ms ease-out; }
}
.turnover-arrival { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-light, #e8e8e6); font-size: 12px; color: var(--ov-text-secondary); }
.turnover-arrival strong { color: var(--ov-ink); margin-left: 4px; }
.turnover-critical { color: var(--status-critical); }
.reorder-page .turnover-snapshot { font-size: 21px; }
.turnover-warning { padding: 14px 20px; border: 1px solid color-mix(in srgb, var(--status-warning) 35%, white); background: color-mix(in srgb, var(--status-warning) 8%, white); border-radius: 16px; font-size: 13px; line-height: 1.6; }
.turnover-table-top { padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.turnover-table-top h2 { margin: 0; font-size: 16px; font-weight: 600; }
.turnover-table-top p { margin: 7px 0 0; color: var(--ov-text-secondary); font-size: 12px; }
.turnover-table { min-width: 1180px; font-variant-numeric: tabular-nums; }
.reorder-page .turnover-table thead th { font-size: 11px; letter-spacing: .025em; vertical-align: top; white-space: nowrap; }
.turnover-table thead th span { display: block; font-size: 10px; text-transform: none; letter-spacing: 0; font-weight: 400; margin-top: 6px; }
.reorder-page .turnover-table td { font-size: 13px; vertical-align: middle; }
.turnover-table .turnover-window { min-width: 145px; }
.turnover-window strong, .turnover-quantity > strong, .turnover-stock { font-size: 18px; font-weight: 600; }
.turnover-day-unit { font-size: 12px; font-weight: 400; }
.turnover-selected { background: #f3f5f2; box-shadow: inset 1px 0 #e5e9e3, inset -1px 0 #e5e9e3; }
.reorder-page .turnover-table thead .turnover-selected { background: #e9eee6; color: var(--ov-ink); }
.turnover-article { font-weight: 500; }
.turnover-status { min-width: 180px; }
.turnover-status .badge { white-space: nowrap; font-size: 11px; }
.reorder-page .order-edit [hidden] { display: none !important; }
.turnover-muted { color: var(--ov-text-secondary); }
.turnover-explanation { padding: 18px 24px; border-top: 1px solid var(--border-light, #e8e8e6); font-size: 12px; color: var(--ov-text-secondary); }
.turnover-explanation summary { cursor: pointer; color: var(--ov-ink); font-weight: 500; }
.turnover-explanation p { max-width: 1000px; line-height: 1.7; margin: 12px 0 0; }
.turnover-empty { padding: 32px !important; text-align: center; color: var(--ov-text-secondary); }
@media (max-width: 700px) {
    body:has(.reorder-page) .site-footer { flex-wrap: wrap; gap: 12px 20px; }
    .turnover-settings { padding: 18px; }
    .turnover-form { gap: 18px; }
    .turnover-field { flex: 1 1 140px; }
    .turnover-field > label { min-height: 32px; }
    .turnover-period, .turnover-mode { flex-basis: 100%; }
    .turnover-recalculate { margin-top: 0; width: 100%; }
    .turnover-table-top { padding: 18px; }
    .turnover-arrival { line-height: 1.7; }
    .turnover-explanation { padding: 18px; }
}

/* =========================================================================
   Страница "ДРР по SKU" — редизайн по референсу (premium clean analytics).
   Только оформление: разметка обработчиков (поиск, режим редактирования,
   выбор периода) и расчёты не менялись.
   ========================================================================= */
.drr-matrix { --drr-card-shadow: 0 1px 2px rgba(20, 20, 20, .02), 0 6px 18px rgba(20, 20, 20, .025); }

/* --- KPI --- */
.drr-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.drr-kpi-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--drr-card-shadow);
    padding: 16px 20px;
}

.drr-kpi-icon {
    flex-shrink: 0;
    width: 68px;
    height: 68px;
    border-radius: 15px;
    background: var(--ov-accent-soft);
    color: var(--ov-ink);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drr-kpi-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.drr-kpi-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-500);
}

.info-dot { display: inline-flex; color: var(--ink-300); cursor: help; }

.drr-kpi-value {
    font-size: 25px;
    font-weight: 800;
    line-height: 1.15;
    color: var(--ink-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drr-kpi-sub { font-size: 12.5px; color: var(--ink-400); }
.drr-kpi-sub.is-good { color: var(--green-600); }
.drr-kpi-sub.is-bad { color: var(--red-600); }

/* --- Таблица: единая карточка (фото + артикул + итого + дни) без
   промежуточного жёлоба — фото/артикул/итого закреплены слева при
   горизонтальном скролле, шапка закреплена при вертикальном.
   Ширины колонок фиксированные (table-layout: fixed + colgroup) — иначе
   закреплённые колонки не совпадут по смещению со скроллящейся частью. */

/* --- Внутренняя панель управления таблицей (переключатель/цель/легенда слева,
   столбцы/экспорт справа) --- */
.drr-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}
.drr-toolbar-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.drr-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    position: relative;
}

.drr-view-toggle {
    display: inline-flex;
    background: var(--ov-icon-bg);
    border-radius: var(--radius-pill);
    padding: 3px;
    flex: 0 0 auto;
}
.drr-view-btn {
    border: none;
    background: none;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-family: var(--font-sans), sans-serif;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--ov-text-secondary);
    transition: background 150ms ease, color 150ms ease;
}
.drr-view-btn:hover:not(.active) { color: var(--ov-ink); }
.drr-view-btn.active { background: #111111; color: #fff; }
.drr-view-btn:focus-visible { outline: 2px solid var(--ov-ink); outline-offset: 2px; }

.drr-legend-marker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ov-text-secondary);
}
.drr-legend-marker i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--coral);
    flex: 0 0 auto;
}

.drr-columns-menu-wrap { position: relative; }
.drr-columns-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    padding: 8px;
    min-width: 190px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.drr-columns-menu[hidden] { display: none; }
.drr-columns-menu label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--ov-ink);
    cursor: pointer;
}
.drr-columns-menu label:hover { background: var(--ov-icon-bg); }
.drr-columns-menu input[type="checkbox"] { accent-color: #111111; width: 15px; height: 15px; }

.drr-table-wrap { position: relative; }

.drr-table-wrap .table-card {
    border-radius: 18px;
}

.drr-matrix table.grid {
    font-size: 14px;
    table-layout: fixed;
    width: calc(374px + var(--drr-cols) * 118px);
    min-width: 100%;
}

.drr-matrix col.col-photo { width: 60px; }
.drr-matrix col.col-article { width: 174px; }
.drr-matrix col.col-sum { width: 140px; }
.drr-matrix col.col-date { width: 118px; }

/* Хвостовая колонка добирает свободную ширину, если период короткий. */
.drr-matrix table.grid .filler-col {
    padding: 0;
    background: transparent !important;
    border-bottom: none;
    box-shadow: none;
}

.drr-matrix table.grid thead th {
    background: var(--ov-icon-bg);
    color: var(--ink-400);
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
}

.drr-matrix table.grid thead th.date-col,
.drr-matrix table.grid thead th.sum-col { padding: 9px 16px; }
.drr-matrix .date-col-day { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink-900); }
.drr-matrix .date-col-wd { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; color: var(--ink-400); }
.drr-matrix table.grid thead th.sum-col .date-col-wd { font-weight: 600; white-space: nowrap; }
.drr-matrix table.grid .drr-hide-weekday .date-col-wd,
.drr-matrix table.grid.drr-hide-weekday .date-col-wd { display: none; }

/* --- Закреплённый блок слева: Фото + Артикул + Итого --- */
.drr-matrix table.grid td.photo-col,
.drr-matrix table.grid th.photo-col {
    padding: 8px 0 8px 16px;
    background: var(--surface);
}

.drr-matrix table.grid td.article-col,
.drr-matrix table.grid th.article-col {
    left: 60px;
    padding: 8px 10px;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    background: var(--surface);
    border-right: none;
    box-shadow: none;
}

.drr-article-cell { display: flex; align-items: center; gap: 8px; min-width: 0; height: 100%; }
/* flex: 1 1 auto растягивает текстовый блок на всю доступную ширину колонки
   независимо от длины названия — индикатор справа от него всегда стоит на
   фиксированном месте у края колонки "Артикул", а не сразу после текста. */
.drr-article-text { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; flex: 1 1 auto; }
.drr-article-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.drr-size-row .drr-article-name { padding-left: 4px; font-weight: 600; text-transform: uppercase; }

/* Озон: раскрытие подстрок ОЗЗ / ОЗК под строкой товара. */
.drr-expand-btn {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: var(--ov-icon-bg);
    color: var(--ink-900);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.drr-expand-btn:hover { background: var(--ink-200); }
.drr-expand-btn:focus-visible { outline: 2px solid var(--ov-ink); outline-offset: 2px; }
.drr-expand-btn svg { transition: transform 160ms var(--ease-standard); }
.drr-expand-btn[aria-expanded="true"] svg { transform: rotate(90deg); }

.drr-matrix table.grid tbody tr.drr-sub-row td {
    height: 46px;
    box-sizing: border-box;
    padding-top: 4px;
    padding-bottom: 4px;
    background: var(--color-canvas);
}
.drr-matrix table.grid tbody tr.drr-sub-row td.sum-col { background: var(--surface-sunken); }
.drr-matrix table.grid tr.drr-sub-row .drr-cell .spend { font-size: 13px; font-weight: 600; }
.drr-matrix table.grid tr.drr-sub-row .drr-cell.is-over::before { inset: 3px 6px; }
.drr-sub-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-left: 36px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-700);
}
.drr-sub-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.drr-sub-dot--cpo { background: var(--mocha-700); }
.drr-sub-dot--cpc { background: var(--mocha-300); }
.drr-sub-dot--other { background: var(--ink-400); }

/* Перетаскивание двигает только строки товаров — подстроки на это время
   прячем (после сохранения страница всё равно перезагружается). */
table.grid.order-editing tr.drr-sub-row { display: none; }
table.grid.order-editing .drr-expand-btn { visibility: hidden; }

/* Модель с размерами: одна строка-сумма, размеры раскрываются под ней. */
.drr-group-sizes { font-size: 11px; font-weight: 600; color: var(--ink-500); white-space: nowrap; }
.drr-matrix table.grid tbody tr.drr-size-row td { background: var(--color-canvas); }
.drr-matrix table.grid tbody tr.drr-size-row td.sum-col { background: var(--surface-sunken); }
.drr-matrix table.grid tbody tr.drr-size-row td.photo-col { padding-left: 18px; }
.drr-matrix table.grid tbody tr.drr-size-row .thumb { transform: scale(.82); }
table.grid.order-editing .drr-group-btn { visibility: visible; }

.drr-matrix table.grid thead th.photo-col,
.drr-matrix table.grid thead th.article-col {
    background: var(--ov-icon-bg);
    border-top: 1px solid var(--border);
}

.drr-matrix table.grid thead th.photo-col { border-top-left-radius: 18px; }
.drr-matrix table.grid tbody tr:last-child td.photo-col { border-bottom-left-radius: 18px; }

/* --- Итого + матрица дат --- */
.drr-matrix table.grid .sum-col {
    position: sticky;
    left: 234px;
    z-index: 6;
    background: var(--surface-sunken);
    font-weight: 700;
    border-right: 1px solid var(--border);
}
.drr-matrix table.grid thead th.sum-col { z-index: 7; }

.drr-matrix table.grid thead th.sum-col,
.drr-matrix table.grid thead th.date-col {
    background: var(--ov-icon-bg);
    border-top: 1px solid var(--border);
}

.drr-matrix table.grid .last-date { border-right: 1px solid var(--border); }
.drr-matrix table.grid thead th.last-date { border-top-right-radius: 18px; }
.drr-matrix table.grid tbody tr:last-child td.last-date { border-bottom-right-radius: 18px; }

.drr-matrix table.grid td.drr-cell { padding: 8px 16px; }

/* box-sizing здесь ДОЛЖЕН остаться border-box (глобальный дефолт сайта) —
   иначе вертикальный padding добавляется поверх ширины <col>, ячейки данных
   становятся на 32px шире объявленной колонки (content-box), и закреплённые
   Фото/Артикул/Итого перестают совпадать по смещению со скроллящейся частью:
   из-под них вылезают обрезанные фрагменты соседней коралловой ячейки. */
.drr-matrix table.grid tbody tr[data-nm-id] td {
    height: 68px;
    box-sizing: border-box;
    padding-top: 8px;
    padding-bottom: 8px;
}

.drr-matrix .drr-cell .spend {
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-900);
}
.drr-matrix .drr-cell .pct {
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--ink-700);
    font-variant-numeric: tabular-nums;
}
.drr-matrix table.grid.drr-hide-spend .drr-cell .pct { display: none; }

/* Превышение цели — единственная подсветка ячейки: коралловая подложка со
   скруглением и небольшим отступом от границ ячейки, коралловое значение,
   суммы остаются серыми и читаемыми. */
.drr-matrix .drr-cell.is-over {
    position: relative;
}
.drr-matrix .drr-cell.is-over::before {
    content: '';
    position: absolute;
    inset: 9px 6px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--coral) 12%, var(--surface));
    z-index: 0;
}
.drr-matrix .drr-cell.is-over.sum-col::before { background: color-mix(in srgb, var(--coral) 14%, var(--surface-sunken)); }
.drr-matrix .drr-cell.is-over > * { position: relative; z-index: 1; }
.drr-matrix .drr-cell.is-over .spend { color: var(--coral); }

/* Строка общих итогов — компактная подсветка: только коралловый цвет
   значения, без подложки, чтобы не утяжелять уже серую строку. */
.drr-matrix table.grid tr.total-row td.drr-cell.is-over-total .spend { color: var(--coral); }

.drr-matrix table.grid tr.total-row td {
    background: var(--ov-icon-bg) !important;
    font-weight: 700;
    color: var(--ink-900) !important;
}

.drr-matrix table.grid tr.total-row td.sum-col { background: #e7e7e3 !important; }

.drr-matrix table.grid tr.total-row td.photo-col,
.drr-matrix table.grid tr.total-row td.article-col { background: var(--surface) !important; }

.drr-matrix table.grid tr.total-row td.filler-col { background: transparent !important; }

.drr-matrix .thumb { width: 38px; height: 38px; border-radius: 8px; }

.drr-state-row td {
    height: auto;
    padding: 20px 16px;
    text-align: left;
    color: var(--text-muted);
    font-size: 13.5px;
    background: var(--surface);
    position: static;
}

.drr-table-caption { margin: 10px 2px 0; font-size: 12px; color: var(--text-muted); }

@media (max-width: 720px) {
    .drr-toolbar { align-items: flex-start; }
    .drr-toolbar-right { margin-left: 0; width: 100%; justify-content: flex-end; }
}

@media (max-width: 1400px) {
    .drr-kpi-row { gap: 14px; }
    .drr-kpi-icon { width: 58px; height: 58px; }
    .drr-kpi-value { font-size: 22px; }
}

@media (max-width: 1100px) {
    .drr-kpi-row { grid-template-columns: 1fr; }
}

.empty-note {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 20px 24px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* --- KPI cards (аналог StatCard) --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 18px 20px;
}

.kpi-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.kpi-value {
    font-family: var(--font-display), sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.kpi-sub {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* --- Status badges (Остатки) — Polka: цветной текст, без пилюли/точки --- */
.badge {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.badge i { display: none; }

.badge-risk { color: var(--status-critical); }
.badge-normal { color: var(--status-good); }
.badge-high { color: var(--status-warning); }
.badge-muted { color: var(--status-muted); }

/* --- Simple (non-grid) data table, used on Остатки/Воронка --- */
table.simple {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-size: 14px;
}

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

table.simple thead th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

table.simple tbody tr:hover { background: var(--color-surface-sunken); }
table.simple tbody tr.profit-row-missing:hover { background: var(--red-100); }

/* Админка: ячейка "Продавец", объединённая rowspan-ом на несколько
   магазинов одного логина — центрируем по вертикали и слегка выделяем
   левым краем, чтобы было видно, что строки ниже относятся к ней же. */
.admin-section-title { font-size: 16px; margin: 0; padding: 18px 16px 6px; }
.table-card + .table-card { margin-top: 20px; }

.admin-billing-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    font-size: 13px;
}

.admin-billing-form label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.admin-billing-form input[type="number"] { width: 64px; }
.admin-billing-form input[type="text"] { width: 110px; }
.admin-billing-form input:not([type="checkbox"]) {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
}

.admin-owner-cell {
    vertical-align: middle;
    border-left: 2px solid var(--border);
}

/* --- Разворачиваемые строки (Воронка, Остатки) --- */
.funnel-row { cursor: pointer; }

.expand-arrow {
    display: inline-block;
    width: 14px;
    color: var(--brand-dark);
    font-size: 15px;
    font-weight: 700;
}

.detail-row td {
    background: var(--color-surface-sunken);
    padding: 12px 16px 16px 40px;
}

.detail-table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.detail-table th, .detail-table td {
    padding: 8px 14px;
    font-size: 13px;
}

/* --- Воронка продаж: тулбар, KPI магазина, аккордеон по SKU --- */
.topbar-title h1 { display: flex; align-items: center; gap: 10px; }

.info-icon {
    border: none;
    background: none;
    padding: 0;
    width: 20px;
    height: 20px;
    line-height: 20px;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 15px;
    cursor: help;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.info-icon:hover { color: var(--ov-ink); background: var(--ov-icon-bg); }

/* Тулбар: период, подпись сравниваемого периода и поиск — один визуальный
   язык (одинаковая высота 42px, радиус 12px, светлые границы). */
.funnel-toolbar { justify-content: flex-start; align-items: center; gap: 12px; }

.fn-compare-chip {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 0 16px;
    border-radius: var(--radius-pill);
    background: var(--ov-icon-bg);
    color: var(--ov-text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
}

/* Дизайн-система «Обзора» на "Воронке": лаймовая иконка вместо фиолетовой,
   сама fn-kpi/funnel-table структура (карточка-аккордеон, кольцо % выкупа)
   не переделывается — она специфична для этой страницы. */
.funnel-page .fn-kpi-icon { background: var(--ov-accent-soft); color: var(--ov-ink); }
.funnel-page .order-edit-save[hidden] { display: none; }

.fn-search {
    margin-left: auto;
    position: relative;
    display: flex;
    align-items: center;
    width: 320px;
}
.fn-search svg { position: absolute; left: 14px; color: var(--ink-400); pointer-events: none; }
.fn-search .funnel-search { width: 100%; padding-left: 38px; }

/* --- KPI по всему магазину: пять карточек в одну строку --- */
.fn-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.fn-kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 16px 18px 15px;
    min-width: 0;
}

.fn-kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.fn-kpi-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.25;
}

.fn-kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: var(--radius-sm);
    background: var(--color-surface-sunken);
    color: var(--mocha-700);
}

.fn-kpi-value {
    margin-top: 10px;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    white-space: nowrap;
}

.fn-kpi-foot {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 8px;
    min-height: 18px;
}

.fn-kpi-foot .fn-delta { font-size: 13px; font-weight: 600; }
.fn-kpi-vs { font-size: 12.5px; color: var(--ink-400); white-space: nowrap; }

/* Дельты к предыдущему периоду — приглушённые, без ярких цветов. */
.fn-delta { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.fn-delta.is-up { color: var(--green-600); }
.fn-delta.is-down { color: var(--red-600); }
.fn-delta.is-flat { color: var(--ink-400); }

/* --- Список артикулов. Каждый артикул: одна <tr> с одной <td>, внутри
   которой div.funnel-card. Строка-сводка (.funnel-summary) — самоописанные
   блоки «метрика + дельта» в ряд, разделённые стрелкой с % конверсии между
   этапами; кольцо % выкупа WB — отдельный акцент справа. Структура таблицы
   сохранена: поиск и режим редактирования порядка из base.html работают
   по tbody tr[data-nm-id] и .article-col. Раскрытие анимируется через
   grid-template-rows 0fr → 1fr — без сторонних библиотек. */
.funnel-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.funnel-table thead, .funnel-table tbody, .funnel-table tr, .funnel-table td, .funnel-table th { display: block; }

.funnel-table tbody tr.funnel-row { margin-bottom: 8px; }
.funnel-table tbody tr.funnel-row:last-child { margin-bottom: 0; }

.funnel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    transition: box-shadow 150ms ease-out, border-color 150ms ease-out, background 130ms ease-out;
    overflow: hidden;
}
.funnel-card.is-open {
    background: var(--surface);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-hover);
}

.funnel-summary {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 14px 20px;
    cursor: pointer;
}
.order-editing .funnel-summary { cursor: grab; }

.fn-thumb { display: flex; align-items: center; gap: 8px; flex: none; }
.fn-article { text-align: left; display: flex; flex-direction: column; gap: 2px; overflow: hidden; min-width: 0; width: 150px; flex: none; }

.fn-metrics { display: flex; align-items: center; flex: 1; min-width: 0; }
.fn-metric { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.fn-metric-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.fn-metric-value {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.fn-sep {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 0 14px;
    color: var(--ink-300);
}
.fn-sep-pct {
    font-size: 13px;
    font-weight: 700;
    color: var(--series-sales-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fn-ring-slot {
    flex: none;
    width: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fn-ring {
    position: relative;
    width: 42px;
    height: 42px;
    flex: none;
}

/* При раскрытии карточки метрики и кольцо в свёрнутой строке быстро
   растворяются — те же значения появляются ниже, в этапах воронки; фото
   и артикул остаются, чтобы не терять идентификацию товара. */
.fn-metrics, .fn-ring-slot {
    transition: opacity 160ms ease-out;
}
.funnel-card.is-open .fn-metrics,
.funnel-card.is-open .fn-ring-slot {
    opacity: 0;
    transition: opacity 120ms ease-in;
}

.funnel-table .expand-arrow {
    display: inline-block;
    width: 12px;
    flex: none;
    color: var(--ink-300);
    font-size: 17px;
    line-height: 1;
    transition: transform 180ms ease, color 150ms ease;
}
.funnel-card.is-open .expand-arrow { transform: rotate(90deg); color: var(--ov-ink); }

.article-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
}
.article-nm { font-size: 12px; color: var(--ink-400); }
.fn-dash { color: var(--ink-300); }

.funnel-table .thumb {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    flex: none;
}
.funnel-table .thumb.thumb-placeholder {
    background: var(--color-surface-sunken);
}

/* Раскрытие: контейнер растёт по grid-template-rows (0fr → 1fr), содержимое
   отдельно проявляется через opacity/translateY. Открытие 220ms, закрытие
   180ms — по ощущению «быстро и плавно», без bounce. */
.funnel-detail-anim {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.funnel-card.is-open .funnel-detail-anim {
    grid-template-rows: 1fr;
    transition-duration: 220ms;
}

.funnel-detail-inner {
    overflow: hidden;
    min-height: 0;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 140ms ease-out, transform 140ms ease-out;
    padding: 0 16px;
}
.funnel-card.is-open .funnel-detail-inner {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 200ms ease-out 40ms, transform 200ms ease-out 40ms;
    padding: 0 16px 16px;
}

/* Раскрытая карточка: этапы (фикс. ширина) и таблица по дням (растягивается)
   стоят рядом, в одну область — без заголовков-разделителей и без повтора
   фото/артикула (они уже есть в свёрнутой строке выше). */
.fn-open-flex {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.fn-stages {
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
}
.fn-stage {
    background: var(--color-surface-sunken);
    border-radius: var(--radius-md);
    padding: 13px 15px;
}
.fn-stage-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}
.fn-stage-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.fn-stage-value {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Связка-конверсия между этапами: короткая строка вместо стрелки+chip. */
.fn-conv-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 0 8px 20px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--brand-dark);
    white-space: nowrap;
}
.fn-conv-link::before {
    content: '';
    width: 1px;
    height: 12px;
    background: var(--border-strong);
    margin-left: 6px;
}

/* --- Данные по датам --- */
.fn-days-block { flex: 1; min-width: 320px; }
.fn-days-scroll { overflow: auto; max-height: 430px; overscroll-behavior: contain; }
.fn-days-head { position: sticky; top: 0; z-index: 1; background: var(--surface); }

.fn-days-cols {
    display: grid;
    grid-template-columns: 76px repeat(7, minmax(84px, 1fr));
}
.fn-days-cols.has-impr {
    grid-template-columns: 76px repeat(9, minmax(84px, 1fr));
    align-items: center;
    column-gap: 8px;
    min-width: 700px;
    padding: 0 14px;
}

.fn-days-head { padding-top: 8px; padding-bottom: 10px; }
.fn-days-th {
    text-align: center;
}
.fn-days-head .fn-days-th:first-child {
    text-align: left;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.fn-day-row {
    min-height: 42px;
    border-top: 1px solid var(--border);
    transition: background 130ms ease;
}
.fn-day-row:hover { background: var(--ov-icon-bg); }

.fn-day-cell {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    min-width: 0;
}
.fn-day-val {
    font-size: 13.5px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.fn-day-cell-date {
    /* Колонка «Дата» — по левому краю, как и её заголовок. */
    justify-content: flex-start;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Кольцо % выкупа WB — акцентный лайм, единственная официальная метрика
   Wildberries в строке (не расчётная конверсия, поэтому вынесена отдельно
   от .fn-sep-pct). */
.funnel-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(var(--ov-accent) calc(var(--pct) * 1%), var(--ov-icon-bg) 0);
}
.funnel-ring::after {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: var(--surface);
}
.funnel-ring-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Узкие десктопы: KPI остаются одной ровной строкой, воронка убирает лишние отступы. */
@media (max-width: 1500px) {
    .fn-kpi-value { font-size: 27px; }
    .fn-stage-value { font-size: 19px; }
    .fn-stages { flex-basis: 220px; }
}

@media (max-width: 1320px) {
    /* 5 карточек в один ряд без «рваного» второго ряда из двух штук. */
    .fn-kpis { gap: 12px; }
    .fn-kpi-value { font-size: 23px; }
    .fn-kpi-vs { display: none; }
    .fn-search { width: 240px; }
}

@media (max-width: 820px) {
    .fn-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    .funnel-detail-anim, .funnel-detail-inner, .funnel-table .expand-arrow,
    .fn-metrics, .fn-ring-slot { transition: none; }
    .profit-page .pp-detail-inner, .profit-page .pp-arrow-btn svg { transition: none; }
}

/* --- Флеш-сообщения (логин/регистрация/админка) --- */
.flash {
    max-width: 1520px;
    margin: 16px auto 0;
    padding: 0 32px;
}

.flash-message {
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-size: 14px;
    margin-bottom: 8px;
}

.flash-error {
    background: var(--red-100);
    color: var(--status-critical);
}

.flash-info {
    background: var(--ov-icon-bg);
    color: var(--ov-text-secondary);
}

.flash-success {
    background: var(--green-100);
    color: var(--status-good);
}

/* --- Плашка тарифа: подписка заканчивается / не оплачена --- */
.billing-banner {
    max-width: 1520px;
    margin: 16px auto 0;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-sizing: border-box;
    width: calc(100% - 64px);
}

.billing-banner-warn {
    background: color-mix(in srgb, var(--status-warning) 12%, white);
    color: var(--text-primary);
}

.billing-banner-error {
    background: var(--red-100);
    color: var(--status-critical);
}

.billing-banner-link {
    flex: none;
    font-weight: 600;
    color: inherit;
    text-decoration: underline;
}

@media (max-width: 640px) {
    .billing-banner { width: calc(100% - 32px); flex-direction: column; align-items: flex-start; }
}

/* --- Баннер имперсонации (админ "вошёл как") --- */
.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--mocha-100);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 24px;
    text-align: center;
}

.impersonation-banner form { display: inline; }

.impersonation-banner button {
    border: none;
    background: var(--ink-900);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
}

/* --- Формы логина/регистрации/редактирования ключа --- */
.auth-wrap {
    max-width: 420px;
    margin: 64px auto;
    padding: 0 16px;
}

/* Вход / Регистрация / Восстановление пароля: карточка формы + брендовая
   панель слева (см. _auth_brand.html) вместо голой карточки посреди пустого
   фона — так эти страницы держат ту же планку, что и лендинг. */
.auth-split {
    display: grid;
    grid-template-columns: minmax(300px, 400px) minmax(320px, 420px);
    align-items: center;
    justify-content: center;
    gap: 64px;
    max-width: 960px;
    min-height: calc(100dvh - 320px);
    margin: 0 auto;
    padding: 40px 16px;
    animation: auth-rise .5s var(--ease-standard) both;
}

@keyframes auth-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-split { animation: none; }
}

.auth-brand-mark {
    display: inline-flex;
    color: var(--mocha-700);
    margin-bottom: 22px;
}

.auth-brand-title {
    font-size: 25px;
    line-height: 1.25;
    color: var(--text-primary);
    margin: 0 0 26px;
    max-width: 380px;
}

.auth-brand .pitch-benefits { margin-bottom: 0; }

@media (max-width: 860px) {
    .auth-split {
        grid-template-columns: 1fr;
        max-width: 420px;
        min-height: 0;
        gap: 0;
        margin: 48px auto;
    }
    .auth-brand { display: none; }
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 32px;
}

.auth-card + .auth-card { margin-top: 24px; }

.auth-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.auth-card .page-subtitle { margin-bottom: 24px; }

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-card form + form { margin-top: 12px; }

.auth-card label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}

.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-family: var(--font-sans), sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
}

.auth-card input:focus { outline: none; border-color: var(--brand); }

.auth-card .checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-card .checkbox-row label { margin: 0; }

/* «Запомнить меня»: .auth-card label задаёт display:block — возвращаем flex,
   иначе чекбокс и подпись не выровнены по центру. */
.auth-card label.auth-remember { display: flex; align-items: center; }

.auth-card button.submit {
    border: none;
    background: var(--ink-900);
    color: #fff;
    font-weight: 600;
    padding: 11px 20px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    transition: opacity var(--ease-standard) .15s;
}

.auth-card button.submit:hover { opacity: .85; }

.auth-card .auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-card .auth-switch a { color: var(--brand-dark); font-weight: 600; }

/* --- Личный кабинет ---
   Лаймовый акцент здесь — тот же тон, что на Обзоре/Воронке/Прибыли
   (var(--ov-accent), см. его определение выше) — переиспользуем токен, а
   не заводим второй с тем же значением. Фирменный --brand/--accent сейчас
   фиолетовый (--mocha-500) и в рамках этой страницы не трогается —
   смена сайтового акцента отдельная задача. */

.account-tabs {
    display: flex;
    gap: 4px;
    height: 48px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
}

.account-tab {
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: var(--font-sans), sans-serif;
    font-size: 15px;
    font-weight: 500;
    padding: 0 4px;
    margin-right: 24px;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color var(--ease-standard) .18s;
}

.account-tab::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--ov-accent);
    transform: scaleX(0);
    transition: transform var(--ease-standard) .2s;
}

.account-tab:hover { color: var(--text-primary); }

.account-tab.is-active {
    color: var(--text-primary);
    font-weight: 600;
}

.account-tab.is-active::after { transform: scaleX(1); }

.account-panel[hidden] { display: none; }

.account-panel {
    animation: acctPanelIn .2s var(--ease-standard);
}

@keyframes acctPanelIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .account-panel { animation: none; }
}

/* Вкладка «Магазины»: список слева, настройки выбранного магазина справа. */
.account-workspace {
    display: grid;
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}

@media (max-width: 1279px) and (min-width: 900px) {
    .account-workspace { grid-template-columns: 280px minmax(0, 1fr); }
}

@media (max-width: 899px) {
    .account-workspace { grid-template-columns: 1fr; }
}

.account-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 20px;
}

.account-section-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.account-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--ink-100);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.account-icon svg { width: 22px; height: 22px; }

.account-section-head h2 { font-size: 17px; margin: 0 0 4px; }
.account-section-head p { font-size: 13px; color: var(--text-muted); margin: 0; }

.account-divider {
    height: 1px;
    background: var(--border);
    margin: 28px 0;
}

.account-card form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-card > form + form { margin-top: 12px; }

/* Аккаунт: «Личные данные» и «Безопасность» рядом. */
.account-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

@media (max-width: 899px) {
    .account-info-grid { grid-template-columns: 1fr; }
}

/* Вкладка «Команда»: тот же двухпанельный каркас, что и «Магазины»
   (.team-workspace зеркалит .account-workspace, .team-list-panel/.team-card
   переиспользуют .store-card, .team-detail-panel — .store-detail-panel),
   чтобы не заводить второй визуальный язык внутри одного личного кабинета. */
.team-workspace {
    display: grid;
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}

/* Ниже 1100px список сотрудников не сужается до нечитаемой колонки, а
   становится горизонтальной лентой (см. .team-list ниже) — карточкам нужна
   полная ширина для аватара, имени, роли и бейджа владельца. */
@media (max-width: 1099px) {
    .team-workspace { grid-template-columns: 1fr; }
}

.team-list-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    /* Грид-ячейка иначе не сжимается уже своего контента: в ленточном режиме
       .team-list это раздувает всю страницу вширь вместо прокрутки внутри
       самой ленты (overflow-x: auto на .team-list ниже). */
    min-width: 0;
}

.team-list-head { margin-bottom: 14px; }
.team-list-head h2 { font-size: 17px; margin: 0 0 2px; }
.team-list-head p { font-size: 13px; color: var(--text-muted); margin: 0; }

.team-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 1099px) {
    .team-list { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
    /* width, а не только min-width: у вложенного flex (.store-card-main
       внутри карточки — flex:1) авто-базис в горизонтальной ленте иначе
       считается по «предпочтительной» ширине контента и раздувает карточку
       далеко за 220px вместо аккуратной колонки-строки. */
    .team-list .team-card { flex: none; width: 240px; min-width: 240px; }
}

.team-card { position: relative; }

.team-card .store-card-main { flex: 1; min-width: 0; }

.team-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--ink-100);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex: none;
}

.team-card-owner {
    cursor: default;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 6px;
}

.team-card-owner:hover { border-color: var(--border); background: var(--surface); }

.team-owner-badge {
    flex: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--ink-100);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
}

/* Точка-индикатор у активного сотрудника — лаймовая, как status-ok у
   магазинов; здесь она не про статус синхронизации, а про то, что карточка
   сейчас выбрана и панель справа показывает именно её. */
.team-card[data-team-select].is-active .store-card-status::before {
    background: var(--ov-accent-hover);
}

.team-detail-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 6px 0 4px;
}

.team-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.team-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ov-accent-hover);
    flex: none;
}

.team-detail-panel { display: flex; flex-direction: column; }

.team-panel-content[hidden] { display: none; }

.team-panel-content {
    animation: acctPanelIn .18s var(--ease-standard);
}

@media (prefers-reduced-motion: reduce) {
    .team-panel-content { animation: none; }
}

.team-member-email {
    font-size: 14px;
    color: var(--text-primary);
    margin: 4px 0 0;
    font-weight: 500;
}

.team-detail-panel .setting-card { margin-top: 16px; }
.team-detail-panel .setting-card:first-of-type { margin-top: 20px; }

/* Блок «Роль сотрудника» — единственная карточка команды, где описание и
   поле стоят в один ряд (слева пояснение, справа select ~45% ширины), а не
   друг под другом, как в остальных .setting-card на этой странице. */
/* .setting-card.team-field-card (не просто .team-field-card): .setting-card
   задаёт flex-direction: column и стоит в файле ниже — при равной
   специфичности победил бы порядок объявления, а не смысл. Двойной класс
   поднимает специфичность и гарантирует ряд независимо от порядка. */
.setting-card.team-field-card {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px 24px;
}

.team-field-info {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex: 1 1 260px;
    min-width: 0;
}

.team-field-control {
    flex: 0 0 45%;
    max-width: 45%;
}

@media (max-width: 799px) {
    .setting-card.team-field-card { flex-direction: column; align-items: stretch; }
    .team-field-control { flex: 1 1 auto; max-width: none; }
}

.team-shop-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 640px) {
    .team-shop-grid { grid-template-columns: 1fr; }
}

.team-shop-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 400;
    transition: border-color var(--ease-standard) .15s, background-color var(--ease-standard) .15s;
}

.team-shop-card:hover { border-color: var(--ink-400); background: var(--surface-sunken); }

.team-shop-card.is-checked {
    border-color: var(--ov-accent-hover);
    background: var(--surface);
}

.team-shop-card input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: none;
    accent-color: var(--ov-accent-hover);
    transition: transform var(--ease-standard) .12s;
}

.team-shop-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-shop-section { display: flex; flex-direction: column; gap: 10px; }
.team-shop-section > label { font-size: 13px; font-weight: 600; color: var(--text-muted); }

.team-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.team-revoke-btn {
    border: none;
    background: none;
    color: var(--red-600);
    padding: 11px 4px;
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    font-size: 14px;
    font-weight: 600;
    transition: opacity var(--ease-standard) .15s;
}

.team-revoke-btn:hover { opacity: .75; }

.team-save-btn {
    min-width: 280px;
    height: 46px;
}

.team-save-btn:disabled { opacity: .6; cursor: default; }

@media (max-width: 799px) {
    .team-actions-row { flex-direction: column-reverse; align-items: stretch; }
    .team-revoke-btn { text-align: center; }
    .team-save-btn { width: 100%; min-width: 0; }
}

.team-cancel-btn {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-primary);
    padding: 11px 20px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    font-size: 14px;
    font-weight: 600;
}

.team-cancel-btn:hover { background: var(--surface-sunken); }

.team-form { display: flex; flex-direction: column; gap: 16px; }

.team-save-status {
    font-size: 13px;
    margin: 10px 0 0;
    min-height: 16px;
}

.team-save-status.is-error { color: var(--coral); }
.team-save-status.is-success { color: var(--text-muted); }

.team-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 400; }

.account-card label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}

.account-card input[type="text"],
.account-card input[type="password"],
.account-card input[type="number"],
.account-card select {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-family: var(--font-sans), sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
}

.account-card input:focus, .account-card select:focus { outline: none; border-color: var(--ov-accent); }

.account-card button.submit {
    border: none;
    background: var(--ink-900);
    color: #fff;
    font-weight: 600;
    padding: 11px 20px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    transition: opacity var(--ease-standard) .15s;
    white-space: nowrap;
}

.account-card button.submit:hover { opacity: .85; }

.password-field { position: relative; }
.password-field input { padding-right: 40px; }
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    padding: 2px;
}
.password-toggle svg { width: 18px; height: 18px; }
.password-toggle:hover { color: var(--text-primary); }

/* Левая панель «Мои магазины» */
.store-list-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.store-list-panel h2 { font-size: 17px; margin: 0 0 14px; }

.store-add-btn {
    width: 100%;
    height: 44px;
    border: none;
    background: var(--ink-900);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity var(--ease-standard) .15s;
}

.store-add-btn:hover { opacity: .85; }
a.store-add-btn { text-decoration: none; box-sizing: border-box; }

.billing-summary {
    border: 1px solid var(--border, rgba(0,0,0,.08));
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 12px;
    display: grid;
    gap: 6px;
}

.billing-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.billing-summary-row strong { color: var(--text-primary); font-weight: 600; }
.billing-summary-row .billing-status-expiring { color: var(--status-warning); }
.billing-summary-row .billing-status-expired { color: var(--status-critical); }
.store-add-btn svg { width: 16px; height: 16px; flex: none; }

/* Модалка «Добавить магазин» — поверх всей страницы (position: fixed
   относительно viewport), а не всплывающая панель внутри узкой левой
   колонки: та обрезалась и перекрывала карточки списка. */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
}

.modal-overlay[hidden] { display: none; }

.modal-dialog {
    position: relative;
    width: 500px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-hover);
    animation: modalIn .18s var(--ease-standard);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .modal-dialog { animation: none; }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover { background: var(--surface-sunken); color: var(--text-primary); }
.modal-close svg { width: 18px; height: 18px; }

.modal-title { font-size: 18px; margin: 0 0 4px; padding-right: 32px; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin: 0 0 20px; }

.modal-error-banner {
    background: var(--red-100);
    color: var(--red-600);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    margin: 0 0 16px;
}

.modal-error-banner[hidden] { display: none; }

.modal-field { margin-bottom: 16px; }

.modal-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}

.modal-field input[type="text"],
.modal-field input[type="password"],
.modal-field input[type="number"],
.modal-field input[type="date"] {
    box-sizing: border-box;
    width: 100%;
    height: 41px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 0 12px;
    font-family: var(--font-sans), sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
}

.modal-field select {
    box-sizing: border-box;
    width: 100%;
    height: 41px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 0 12px;
    font-family: var(--font-sans), sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
}
.modal-field input:focus, .modal-field select:focus { outline: none; border-color: var(--ov-accent); }
.modal-field.has-error input { border-color: var(--coral); }

.modal-field-error {
    font-size: 12px;
    color: var(--coral);
    margin: 6px 0 0;
}

.modal-field-error:empty { display: none; }

/* Окошко смены себестоимости на «Прибыли» */
.cost-dialog { width: 400px; }
.cost-dialog-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    margin: -4px 0 4px;
}
.cost-dialog-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink-900); }
.cost-dialog-hint { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; }
.modal-field input:disabled { opacity: .45; }

.modal-actions { display: flex; gap: 12px; margin-top: 20px; }

.modal-cancel {
    flex: none;
    height: 41px;
    padding: 0 20px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    transition: border-color var(--ease-standard) .15s;
}

.modal-cancel:hover { border-color: var(--ink-900); }

.modal-submit {
    flex: 1;
    box-sizing: border-box;
    height: 41px;
    border: none;
    background: var(--ink-900);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--ease-standard) .15s;
}

.modal-submit:disabled { opacity: .45; cursor: default; }
.modal-submit:not(:disabled):hover { opacity: .85; }

.modal-close:focus-visible,
.modal-cancel:focus-visible,
.modal-submit:focus-visible { outline: 2px solid var(--ink-900); outline-offset: 2px; }

@media (max-width: 899px) {
    .modal-dialog { width: 100%; }
}

.store-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.store-list-empty { font-size: 13px; color: var(--text-muted); margin: 8px 0 0; }

.store-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    transition: border-color var(--ease-standard) .15s, background-color var(--ease-standard) .15s;
}

.store-card:hover { border-color: var(--border-strong); background: var(--surface-sunken); }

.store-card.is-active {
    background: var(--surface);
    border: 1px solid var(--ink-900);
}

.store-card-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.store-card-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.store-card.is-active .store-card-name { font-weight: 700; }

.store-card-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.store-card-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-400);
    flex: none;
}

.store-card-status.status-ok::before { background: var(--ov-accent-hover); }
.store-card-status.status-warn::before { background: var(--coral); }

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

/* Видна только менеджеру/кладовщику — на каком доступе он в этом магазине
   (владельцу не показываем, у него везде 'owner', см. server.py). */
.store-card-role { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

.store-card-arrow {
    flex: none;
    width: 18px;
    height: 18px;
    color: var(--ink-400);
}

.store-card.is-active .store-card-arrow { color: var(--ink-900); }

/* Правая панель — настройки выбранного магазина */
.store-detail-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    min-width: 0;
}

.store-detail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px 16px;
    margin-bottom: 4px;
}

.store-detail-head h2 { font-size: 20px; margin: 0; }

.store-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1;
}

.store-status-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-400);
    flex: none;
}

.store-status-pill.status-ok::before { background: var(--ov-accent-hover); }
.store-status-pill.status-warn { color: var(--coral); }
.store-status-pill.status-warn::before { background: var(--coral); }

.store-detail-subtitle { font-size: 13px; color: var(--text-muted); margin: 0 0 24px; }

.store-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 1279px) {
    .store-settings-grid { grid-template-columns: 1fr; }
}

.setting-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
}

.setting-card[hidden] { display: none; }

.setting-card-danger { border-color: var(--red-600); }
.setting-card-danger .setting-card-icon { background: color-mix(in srgb, var(--red-600) 12%, transparent); color: var(--red-600); }

.shop-remove-options { display: flex; flex-direction: column; gap: 14px; }

.shop-remove-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.shop-remove-option:first-child { padding-top: 0; border-top: none; }
.shop-remove-option strong { font-size: 14px; }
.shop-remove-option p { font-size: 13px; color: var(--text-muted); margin: 2px 0 0; line-height: 1.5; }
.shop-remove-option .team-revoke-btn { flex: none; white-space: nowrap; }
.shop-purge-btn { color: #fff; background: var(--red-600); border-radius: var(--radius-sm, 8px); padding: 10px 16px; }
.shop-purge-btn:hover { opacity: .85; }

@media (max-width: 599px) {
    .shop-remove-option { flex-direction: column; align-items: stretch; }
}

.setting-card-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.setting-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--ink-100);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.setting-card-icon svg { width: 20px; height: 20px; }

.setting-card-head h3 { font-size: 15px; margin: 0 0 4px; }
.setting-card-head p { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.5; }

.setting-card-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 14px;
}

.setting-card-row.wrap { flex-wrap: wrap; }

.setting-card-row > div { flex: 1 1 auto; min-width: 0; }
.setting-card-row .password-field { flex: 1 1 auto; min-width: 0; }
.setting-card-row input,
.setting-card-row select { width: 100%; }

/* Налог/НДС — два отдельных <form> (два разных backend-эндпоинта), но
   визуально и по кнопке — своя сетка с одним «Сохранить» (см. data-dual-save
   в base.html): display:contents отдаёт поля форм прямо в grid, сама форма
   остаётся обычной единицей отправки. */
.tax-controls {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) minmax(110px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-top: auto;
    padding-top: 14px;
}

.tax-controls form { display: contents; }
.tax-controls input { width: 100%; }
.tax-controls button.submit { white-space: nowrap; }

@media (max-width: 899px) {
    .tax-controls { grid-template-columns: 1fr 1fr; }
    .tax-controls button.submit { grid-column: 1 / -1; justify-self: end; width: auto; }
}

/* Налоговые периоды Озона (личный кабинет → магазин → Налогообложение). */
.tax-periods { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.tax-periods [hidden] { display: none !important; }
.tax-periods-note { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.5; }
.tax-periods-current { font-size: 14px; margin: 0; }
.tax-periods-current.is-warn { color: #B45309; }
.tax-periods-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tax-periods-table th { text-align: left; font-weight: 600; color: var(--text-muted); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); }
.tax-periods-table td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.tax-periods-table td:nth-child(2), .tax-periods-table td:nth-child(3) { white-space: nowrap; }
.tax-periods-table tr.is-current td { font-weight: 600; }
.tax-periods-badge { font-size: 11px; font-weight: 600; color: #B45309; }
.tax-periods-actions { margin-top: 4px; display: flex; gap: 12px; }
.tax-periods .link-btn { background: none; border: 0; box-shadow: none; border-radius: 0; padding: 0; margin: 0; height: auto;
    min-height: 0; width: auto; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary);
    text-decoration: underline; cursor: pointer; }
.tax-periods .link-btn.is-danger { color: #B91C1C; }
.tax-period-form { display: flex; flex-direction: column; gap: 12px; }
.tax-period-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.tax-period-fields input, .tax-period-fields select { width: 100%; }
.tax-period-preview { font-size: 13px; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.tax-period-preview p { margin: 0 0 4px; }
.tax-period-preview p:last-child { margin-bottom: 0; }
.tax-period-preview .is-error { color: #B91C1C; }
.tax-period-buttons { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; }

.store-detail-panel label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}

.store-detail-panel input[type="text"],
.store-detail-panel input[type="password"],
.store-detail-panel input[type="number"],
.store-detail-panel input[type="date"],
.store-detail-panel select {
    box-sizing: border-box;
    width: 100%;
    height: 41px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 0 12px;
    font-family: var(--font-sans), sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
}

/* Специфичность выше общего правила выше — иначе поле пароля теряет
   правый отступ под иконку-глаз (см. .password-field выше). */
.store-detail-panel .password-field input { padding-right: 40px; }

.store-detail-panel input:focus,
.store-detail-panel select:focus { outline: none; border-color: var(--ov-accent); }

.store-detail-panel button.submit {
    flex: none;
    box-sizing: border-box;
    height: 41px;
    border: none;
    background: var(--ink-900);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    padding: 0 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--ease-standard) .15s;
}

.store-detail-panel button.submit:hover { opacity: .85; }

.store-detail-panel button.submit:disabled,
.account-card button.submit:disabled { opacity: .6; cursor: default; }

.store-detail-empty {
    font-size: 13px;
    color: var(--text-muted);
    padding: 12px 0;
}

@media (max-width: 899px) {
    .store-detail-panel { padding: 20px; }
    .setting-card-row { flex-wrap: wrap; }
    .setting-card-row button.submit { width: 100%; }
}

.account-tab:focus-visible,
.store-card:focus-visible,
.store-add-btn:focus-visible,
.password-toggle:focus-visible {
    outline: 2px solid var(--ink-900);
    outline-offset: 2px;
}

/* --- Админка --- */
.admin-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-actions form { display: inline; }

.link-btn {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    text-decoration: none;
    display: inline-block;
}

.link-btn:hover { background: var(--color-surface-sunken); }

.store-chart.table-card {
    position: relative;
    margin-bottom: var(--pp-gap, 20px);
    padding: 24px 26px 20px;
    /* .table-card прячет overflow ради скруглённых углов таблиц — здесь же
       поверх карточки открывается абсолютно спозиционированный дропдаун
       календаря, который иначе обрезался бы по границе карточки. */
    overflow: visible;
}

/* --- Шапка карточки: заголовок/итог/дельта слева, выбор периода справа --- */
.store-chart-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.store-chart-heading h3 {
    margin: 0;
    font-family: var(--font-sans), sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.info-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    font-size: 10px;
    font-style: normal;
    color: var(--text-muted);
    cursor: help;
}

.store-chart-total {
    margin-top: 12px;
    font-family: var(--font-display), sans-serif;
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.05;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.store-chart-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.store-chart-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.store-chart-delta.is-up { background: var(--green-100); color: var(--green-600); }
.store-chart-delta.is-down { background: var(--red-100); color: var(--red-600); }
.store-chart-delta-arrow { font-size: 11px; line-height: 1; }
.store-chart-delta-label { font-size: 13px; font-weight: 400; color: var(--text-muted); }

.store-chart-toolbar-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.store-chart-toolbar-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Кнопка «Скачать финансовый отчёт» и фильтр периода — на одной линии */
.store-chart-toolbar-row .daterange-trigger { height: 42px; box-sizing: border-box; }

.daterange-download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    box-sizing: border-box;
    padding: 0 16px;
    border: 1px solid #078C48;
    border-radius: 11px;
    background: #078C48;
    color: #fff;
    font-family: var(--font-sans), sans-serif;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.daterange-download-btn:hover { background: #066F3A; border-color: #066F3A; }
.daterange-download-btn:active { transform: scale(.97); }

.daterange-download-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.quick-period-row {
    display: flex;
    gap: 2px;
    background: var(--color-surface-sunken);
    border-radius: var(--radius-pill);
    padding: 4px;
}

.quick-period-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--ease-standard) .15s, color var(--ease-standard) .15s;
}

.quick-period-btn:hover { background: rgba(20, 21, 26, .05); color: var(--text-primary); }
.quick-period-btn.active { background: var(--ink-900); color: #fff; box-shadow: 0 1px 3px rgba(20, 21, 26, .22); }
.quick-period-btn.active:hover { background: var(--ink-900); }

/* --- График --- */
.store-chart-body {
    display: flex;
    gap: 12px;
}
.store-chart-axis {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px 0 22px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.store-chart-plot {
    position: relative;
    flex: 1;
    min-width: 0;
}
.store-chart-svg {
    width: 100%;
    height: 232px;
    display: block;
    overflow: visible;
}
/* Компактный вариант для вкладки "ДРР" — график вспомогательный, идёт над
   KPI-карточками, ему не нужна высота как у ключевого графика "Прибыли". */
.drr-chart-compact .store-chart-svg { height: 160px; }
.drr-chart-compact { margin-bottom: 16px; }
.store-chart-gridline {
    stroke: var(--border);
    stroke-width: 1;
    stroke-dasharray: 2 5;
}
.store-chart-area {
    fill: url(#storeChartFill);
    stroke: none;
}
.store-chart-line {
    stroke: var(--ov-ink);
    stroke-width: 2.25;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.store-chart-point { cursor: pointer; }
.store-chart-hit { pointer-events: all; }
.store-chart-hover-line {
    stroke: var(--border-strong);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    opacity: 0;
    transition: opacity .1s ease;
}
.store-chart-halo {
    fill: var(--ov-accent);
    opacity: 0;
    transition: opacity .1s ease;
}
.store-chart-point-active .store-chart-hover-line,
.store-chart-point-active .store-chart-halo { opacity: .35; }
.store-chart-dot {
    r: 3px;
    fill: var(--ov-ink);
    stroke: var(--surface);
    stroke-width: 2.5px;
    transition: r .1s ease;
}
.store-chart-point-active .store-chart-dot { r: 5.5px; }
.store-chart-value-label {
    font: 700 11px var(--font-sans), sans-serif;
    fill: var(--ov-ink);
    text-anchor: middle;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.store-chart-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}
.store-chart-labels span.is-hidden { visibility: hidden; }
.store-chart-tooltip {
    position: absolute;
    background: var(--ink-900);
    color: #fff;
    box-shadow: 0 14px 34px rgba(20, 21, 26, .28);
    padding: 9px 13px;
    border-radius: 12px;
    font-family: var(--font-sans), sans-serif;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}
.store-chart-tooltip-date { font-size: 11px; color: rgba(255, 255, 255, .6); margin-bottom: 2px; }
.store-chart-tooltip-value { font-size: 15px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }

/* =====================================================================
   Страница «Прибыль» (/profit)
   Всё ниже скоупится классом .profit-page — обёрткой вокруг всего
   контента вкладки, поэтому переопределения общих компонентов
   (.store-chart-*, .search-input, table.simple, .badge) не задевают
   остальные страницы.
   ===================================================================== */
.profit-page { --pp-gap: 20px; }

/* --- Баннер "налоги не подтверждены" --- */
.pp-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: var(--pp-gap, 20px);
    padding: 14px 18px;
    border: 1px solid var(--mocha-300);
    border-radius: var(--radius-md);
    background: var(--mocha-100);
    color: var(--text-primary);
    font-size: 13.5px;
}

.pp-alert-icon {
    display: flex;
    margin-top: 1px;
    color: var(--mocha-700);
    flex-shrink: 0;
}

.pp-alert-body { margin: 0; line-height: 1.55; flex: 1; }
.pp-alert-body strong { font-weight: 700; }

.pp-alert-action {
    flex-shrink: 0;
    align-self: center;
    color: var(--ink-900);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid var(--mocha-500);
    padding-bottom: 1px;
    white-space: nowrap;
}

.pp-alert-action:hover { border-bottom-color: var(--ink-900); }

.profit-page a:focus-visible,
.profit-page button:focus-visible,
.profit-page input:focus-visible,
.profit-page [tabindex]:focus-visible {
    outline: 2px solid var(--brand-dark);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.pp-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* --- Полоса средних показателей --- */
.pp-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
    gap: 1px;
    margin-bottom: var(--pp-gap, 20px);
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.pp-metric {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 18px 20px 17px;
    background: var(--surface);
}

.pp-metric-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.pp-metric-value {
    font-family: var(--font-display), sans-serif;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.pp-metric-hint { font-size: 11.5px; line-height: 1.35; color: var(--unit-text-secondary); }
.pp-metric-hint.is-good { color: var(--green-600); }
.pp-metric-hint.is-bad { color: var(--red-600); }

/* --- Карточка таблицы --- */
.profit-page .pp-table-card {
    margin-bottom: 8px;
}

.pp-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 22px 24px 20px;
    border-bottom: 1px solid var(--border);
}

.pp-table-head h3 {
    font-family: var(--font-display), sans-serif;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.pp-table-hint { margin: 8px 0 0; font-size: 13.5px; color: var(--ink-400); }

.pp-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 7px;
    background: var(--color-surface-sunken);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pp-chip-warn { background: var(--red-100); color: var(--red-600); }

.pp-table-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.pp-search { position: relative; display: flex; align-items: center; }

.pp-search-icon {
    position: absolute;
    left: 13px;
    color: var(--ink-400);
    pointer-events: none;
}

.profit-page .search-input {
    width: 244px;
    margin-left: 0;
    padding: 9px 14px 9px 35px;
    border-color: var(--border);
    background: var(--color-surface-sunken);
    font-size: 13.5px;
    transition: background var(--ease-standard) .15s,
                border-color var(--ease-standard) .15s,
                box-shadow var(--ease-standard) .15s;
}

.profit-page .search-input::placeholder { color: var(--ink-400); }

.profit-page .search-input:focus {
    background: var(--surface);
    border-color: var(--mocha-500);
    box-shadow: 0 0 0 3px rgba(140, 122, 104, .14);
}

.profit-page .search-input:disabled { opacity: .5; cursor: not-allowed; }

.profit-page .order-edit-toggle,
.profit-page .order-edit-save {
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    border: 1px solid #111111;
    background: #111111;
    color: #fff;
    transition: background var(--ease-standard) .15s, transform 120ms var(--ease-standard);
}

.profit-page .order-edit-toggle:hover,
.profit-page .order-edit-save:hover { background: #2a2a2a; }
.profit-page .order-edit-toggle.active { background: var(--ov-ink); border-color: var(--ov-ink); }
.profit-page .order-edit-toggle:active,
.profit-page .order-edit-save:active { transform: scale(.985); }
.profit-page .order-edit-save:disabled { opacity: .4; cursor: not-allowed; }

/* --- Таблица --- */
/* Без вложенной вертикальной прокрутки — список артикулов теперь часть
   обычного скролла страницы. Горизонтальная прокрутка остаётся на
   случай нехватки ширины на узких экранах (см. media-запрос ниже).
   Боковые паддинги держат карточки на одной вертикальной оси с текстом
   шапки (.pp-table-head); верхний — те же 12px, что и между карточками. */
.profit-page .table-scroll { overflow-x: auto; overflow-y: visible; padding: 12px 24px 22px; }

.profit-page .pp-table,
.profit-page .detail-table { font-size: 13.5px; }

.profit-page .detail-table .col-center {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.profit-page .detail-table th.num,
.profit-page .detail-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Карточки артикулов — CSS Grid поверх реальных <table>/<tr>/<td>: теги
   не меняем (на них завязаны общий поиск и drag&drop-сортировка из
   base.html), только переопределяем display. Любой дочерний элемент
   grid-контейнера блокифицируется в grid-item независимо от
   исходного table-row/table-cell — это не absolute-позиционирование,
   раскладка колонок задаётся одной сеткой на все карточки. */
.profit-page .pp-table { display: block; width: 100%; }
.profit-page .pp-table > tbody { display: block; }

.profit-page #profitTable {
    --pp-grid: minmax(208px, 1.6fr) minmax(118px, .9fr) minmax(138px, 1fr)
               minmax(118px, .9fr) minmax(118px, .9fr) minmax(148px, 1fr)
               minmax(102px, .75fr) minmax(102px, .75fr) 48px;
}

.profit-page #profitTable > tbody > tr.funnel-row {
    display: grid;
    grid-template-columns: var(--pp-grid);
    align-items: stretch;
    column-gap: 6px;
    min-height: 84px;
    margin: 0 0 12px;
    background: var(--surface);
    border: 1px solid var(--unit-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background var(--ease-standard) .15s, border-color var(--ease-standard) .15s;
}

/* Пока раскрыта детализация, строка артикула — верхняя часть общего
   контейнера: без своего нижнего отступа и нижнего скругления, чтобы
   она визуально сливалась с блоком детализации в одну карточку. */
.profit-page #profitTable > tbody > tr.funnel-row.is-expanded {
    margin-bottom: 0;
    border-bottom-color: transparent;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.profit-page #profitTable > tbody > tr.funnel-row:hover {
    background: var(--color-surface-sunken);
    border-color: var(--border);
}

.profit-page #profitTable > tbody > tr.funnel-row:focus-visible,
.profit-page #profitTable > tbody > tr.funnel-row:has(.pp-arrow-btn:focus-visible) {
    outline: 2px solid var(--ov-ink);
    outline-offset: -2px;
    border-radius: var(--radius-lg);
}

.profit-page #profitTable > tbody > tr.profit-row-missing { background: #fdf5f4; border-left: 3px solid var(--red-600); }
.profit-page #profitTable > tbody > tr.profit-row-missing:hover { background: var(--red-100); }

/* Общие ячейки-метрики: подпись сверху (мелкая, серая, разрядка),
   значение снизу (крупнее, контрастнее) — растянуты на всю высоту
   карточки, поэтому подложка "Прибыли всего" ниже покрывает всю
   высоту строки, а не только текст. border:none перекрывает глобальный
   `table.simple th, table.simple td { border-bottom: 1px solid ... }`
   (webapp/static/css/style.css ~2596) — тот унаследованный бордер и
   дробил карточку короткими подчёркиваниями под каждой ячейкой. */
.profit-page #profitTable > tbody > tr.funnel-row > td {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 15px 8px;
    border: none;
    overflow: hidden;
}

.profit-page #profitTable > tbody > tr.funnel-row > td:first-child { padding-left: 20px; }
.profit-page #profitTable > tbody > tr.funnel-row > td:last-child { padding-right: 20px; }

.profit-page .pp-metric-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--unit-text-secondary);
}

.profit-page #profitTable .pp-metric-value {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Товар — фото + название в строку, единственная ячейка без подписи.
   Селектор специально повторяет цепочку общего правила ячеек-метрик
   выше (> tbody > tr.funnel-row > td) и добавляет класс — иначе при
   равном числе классов побеждает то правило с большим числом типов в
   селекторе (tbody+tr+td), и flex-direction:column от него оставался
   в силе поверх этого переопределения. */
.profit-page #profitTable > tbody > tr.funnel-row > td.product-col {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
}

.profit-page .thumb {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 11px;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Ячейки-метрики: подпись и значение по центру колонки. */
.profit-page #profitTable > tbody > tr.funnel-row > td:not(.product-col):not(.arrow-col) {
    align-items: center;
    text-align: center;
}
.profit-page .buyout-value,
.profit-page .cost-field { justify-content: center; }

/* Модель с размерами (Ozon): число размеров под названием, статичная
   себестоимость модели и плитки размеров в детализации. */
.profit-page .profit-group-sizes { display: block; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--ink-500); white-space: nowrap; }
.profit-page .profit-size-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.profit-page .profit-group-bar { margin-bottom: 0; }
.profit-page .profit-size-tile {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    flex: 0 0 136px; box-sizing: border-box; padding: 9px 12px;
    border: 1px solid rgba(0, 0, 0, .1); border-radius: 12px; background: #fff;
    color: var(--ink-900, #111); font-family: var(--font-sans), sans-serif; text-align: left; cursor: pointer;
}
.profit-page .profit-size-tile:hover { background: var(--color-surface-sunken); }
.profit-page .profit-size-tile.is-active { border-color: #111; box-shadow: inset 0 0 0 1px #111; }
.profit-page .profit-size-tile:focus-visible { outline: 2px solid #111; outline-offset: 2px; }
.profit-page .profit-size-name { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-500); }
.profit-page .profit-size-profit { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.profit-page .profit-size-profit.is-neg { color: var(--red-600); }
.profit-page .profit-size-margin { font-size: 11.5px; color: var(--ink-500); }
.profit-page .profit-size-panel[hidden] { display: none; }

/* Режим редактирования порядка: выбранные строки подсвечиваются. */
table.order-editing tbody tr.is-selected > td { background-color: #e6f0ff !important; }

.profit-page .pp-article-main {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -0.005em;
}

/* Стрелка раскрытия — компактная область у правого края строки: 36×36
   кликабельная зона вокруг более крупной (18px) и контрастной иконки. */
.profit-page #profitTable td.arrow-col {
    align-items: center;
    justify-content: center;
    padding: 6px;
    overflow: visible;
}

.profit-page .pp-arrow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--ink-700);
    cursor: pointer;
    transition: background var(--ease-standard) .15s, color var(--ease-standard) .15s;
}

.profit-page .pp-arrow-btn svg {
    transition: transform .2s var(--ease-standard);
}

.profit-page .pp-arrow-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

.profit-page .funnel-row:hover .pp-arrow-btn { background: var(--color-surface-sunken); }

.profit-page .pp-arrow-btn:hover,
.profit-page .pp-arrow-btn:focus-visible {
    background: var(--ink-200);
    color: var(--ink-900);
}

.profit-page .pp-arrow-btn:focus-visible { outline: 2px solid var(--ov-ink); outline-offset: 1px; }

.profit-page .badge {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 700;
    vertical-align: middle;
}

.profit-page .badge-risk { background: var(--red-100); color: var(--red-600); }
.profit-page .badge-high { background: var(--ov-accent-soft); color: var(--ov-ink); }

.profit-page .pp-cost { color: var(--unit-text-secondary); }
.profit-page #profitTable .pp-cost .pp-metric-value { color: var(--unit-text-secondary); font-weight: 500; }
.profit-page .pp-strong { font-weight: 600; color: var(--text-primary); }

/* «Прибыль всего» — единственная колонка с лёгкой лаймовой подложкой,
   растянутой на всю высоту и ширину своей ячейки, как на макете. */
.profit-page #profitTable td.profit-cell.is-total { background: var(--unit-result-bg); }
.profit-page #profitTable td.profit-cell.is-total .pp-metric-value { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.profit-page #profitTable > tbody > tr.funnel-row:hover td.profit-cell.is-total { background: var(--unit-result-bg-hover); }
.profit-page .is-neg { color: var(--red-600); }
.profit-page #profitTable td.profit-cell.is-total.is-neg .pp-metric-value { color: var(--red-600); }

/* Маржа — белая плашка с тонкой лаймовой обводкой; для отрицательной
   маржи рамка и текст красные вместо фирменного лайма. */
.profit-page .margin-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid var(--ov-accent);
    border-radius: var(--radius-pill);
    font-size: 13.5px;
    font-weight: 700;
    width: fit-content;
}
.profit-page .margin-chip.is-neg { border-color: var(--red-600); color: var(--red-600); }

/* Единый компонент "% выкупа" — процент и progress bar на одной
   горизонтальной линии (сначала число, потом бар), одинаково и в
   основной строке, и в детализации по дням. */
.profit-page .buyout-value {
    display: flex;
    align-items: center;
    gap: 10px;
}
.profit-page .buyout-pct {
    flex-shrink: 0;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.profit-page .buyout-bar {
    display: block;
    flex-shrink: 0;
    width: 56px;
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--ink-200);
    overflow: hidden;
}
.profit-page .buyout-bar-fill {
    display: block;
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--ov-accent);
}
/* Детализация по дням теснее основной строки — бар чуть уже, и весь
   компонент прижат вправо, как остальные числовые колонки таблицы. */
.profit-page .detail-table .buyout-value { justify-content: flex-end; }
.profit-page .detail-table .buyout-bar { width: 52px; }
.profit-page .detail-table .buyout-pct { font-size: 13px; font-weight: 500; }

/* Себестоимость — до клика читается как обычный текст (никакой
   рамки/подложки), карандаш проявляется только при наведении на
   карточку — иначе десятки одинаковых плашек-инпутов превращают список
   в частокол рамок вместо спокойных чисел. Рамка и фон появляются
   только в момент реального взаимодействия (:hover/:focus-within на
   самой ячейке), когда пользователь уже навёлся именно на неё. */
.profit-page #profitTable td.cost-cell { cursor: pointer; }
/* Себестоимость модели (Ozon) — ведёт себя как ячейка артикула. */
.profit-page #profitTable td.cost-group { cursor: pointer; }
.profit-page .funnel-row:hover td.cost-group .cost-field-icon,
.profit-page td.cost-group:hover .cost-field-icon,
.profit-page td.cost-group:focus-within .cost-field-icon {
    opacity: 1;
    transform: none;
}
.profit-page td.cost-group:hover .cost-field,
.profit-page td.cost-group:focus-within .cost-field {
    border-color: var(--border-strong);
    background: var(--color-surface-sunken);
}
.profit-page td.cost-group:hover .cost-field-icon,
.profit-page td.cost-group:focus-within .cost-field-icon { color: var(--ov-ink); }
.profit-page td.cost-group.cost-cell-error .cost-field {
    border-color: var(--red-600);
    background: var(--red-100);
    animation: ppNudge .28s var(--ease-standard);
}

.cost-field {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    max-width: 100%;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    transition: border-color var(--ease-standard) .15s,
                background var(--ease-standard) .15s,
                box-shadow var(--ease-standard) .15s;
}

.cost-field.is-empty .cost-field-value { color: var(--brand-dark); font-weight: 600; }

.cost-field-icon {
    color: var(--ink-400);
    flex-shrink: 0;
    opacity: 0;
    transform: translateX(-2px);
    transition: opacity var(--ease-standard) .15s, transform var(--ease-standard) .15s, color var(--ease-standard) .15s;
}

/* Пустая себестоимость ("Задать") — карандаш виден сразу: это не
   значение для чтения, а явный призыв к действию, скрывать его
   было бы контрпродуктивно. */
.cost-field.is-empty .cost-field-icon { opacity: 1; transform: none; }

.profit-page .funnel-row:hover td.cost-cell .cost-field-icon,
.profit-page td.cost-cell:hover .cost-field-icon,
.profit-page td.cost-cell:focus-within .cost-field-icon {
    opacity: 1;
    transform: none;
}

.profit-page td.cost-cell:hover .cost-field,
.profit-page td.cost-cell:focus-within .cost-field {
    border-color: var(--border-strong);
    background: var(--color-surface-sunken);
}

.profit-page td.cost-cell:hover .cost-field-icon,
.profit-page td.cost-cell:focus-within .cost-field-icon { color: var(--ov-ink); }

.profit-page td.cost-cell-error .cost-field {
    border-color: var(--red-600);
    background: var(--red-100);
    animation: ppNudge .28s var(--ease-standard);
}

.profit-page .cost-input {
    width: 100%;
    max-width: 120px;
    border: 1px solid var(--mocha-700);
    border-radius: 8px;
    padding: 6px 9px;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
    outline: none;
    box-shadow: 0 0 0 3px rgba(140, 122, 104, .16);
}

/* --- Детализация по дням --- */
/* Раскрытая карточка — единый контейнер: строка артикула (верх, обычная
   высота и белый фон, .is-expanded снимает ей нижнюю рамку/скругление
   выше) и детализация (низ) стыкуются без зазора и делят один внешний
   контур. td без паддингов — паддинг живёт на .pp-detail-content. */
.profit-page #profitTable > tbody > tr.detail-row {
    display: block;
    margin: 0 0 12px;
}

.profit-page #profitTable > tbody > tr.detail-row > td {
    display: block;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--unit-border);
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

/* Тонкий разделитель сразу под строкой артикула — верхняя грань
   собственно контента, не самой рамки, поэтому не задваивается с ней. */
.profit-page .pp-detail-content { border-top: 1px solid var(--unit-border); }

/* Анимация раскрытия — grid-template-rows 0fr → 1fr: единственный способ
   плавно анимировать высоту блока, чью итоговую высоту мы не знаем
   заранее (кол-во дней в детализации переменное), без замера в JS.
   .detail-row переключается display:none/block в JS, а класс is-open
   запускает сам переход. */
.profit-page .pp-detail-inner {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transform: translateY(-4px);
    transition: grid-template-rows .2s var(--ease-standard),
                opacity .2s var(--ease-standard),
                transform .2s var(--ease-standard);
}

.profit-page .detail-row.is-open .pp-detail-inner {
    grid-template-rows: 1fr;
    opacity: 1;
    transform: none;
}

.profit-page .pp-detail-content {
    min-height: 0;
    overflow: hidden;
    padding: 14px 22px 20px;
}

.pp-detail-title {
    margin: 0;
    padding: 0 0 10px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-primary);
}

/* Длинный период — окно примерно на 10 дней, остальные листаются внутри,
   шапка с названиями колонок закреплена. */
.profit-page .detail-table-scroll {
    overflow: auto;
    max-height: 520px;
    overscroll-behavior: contain;
}

.profit-page .detail-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface);
}

.profit-page .detail-table {
    border: none;
    border-radius: 0;
    box-shadow: none;
    /* общий overflow:hidden у таблиц сделал бы её саму контейнером для
       sticky-шапки, и та уезжала бы вместе со строками */
    overflow: visible;
    table-layout: fixed;
    width: 100%;
    min-width: 640px;
}

.profit-page .detail-table th {
    padding: 8px 10px;
    font-size: 10.5px;
    letter-spacing: 0.06em;
    color: var(--unit-text-secondary);
    border-bottom: 1px solid var(--unit-border);
    white-space: nowrap;
}

/* Разделители между днями — заметно светлее внешней рамки карточки:
   меньше визуальных линий "давит" на глаз в длинной детализации.
   background переопределяет унаследованный от глобального .detail-row td
   (используется ещё на Воронке/Остатках — тот селектор descendant, а не
   direct-child, поэтому дотягивается и до вложенной сюда таблицы дней).
   padding подобран под строку ~37px (13px текст + 2×12px). */
.profit-page .detail-table td {
    padding: 12px 10px;
    font-size: 13px;
    background: var(--surface);
    border-bottom: 1px solid rgba(20, 24, 32, .05);
}

/* Расходы в детализации — на тон контрастнее, чем в основной строке:
   мелкий текст на 13px читается хуже, если он совсем блёклый. */
.profit-page .detail-table .pp-cost { color: var(--ink-700); }

.profit-page .detail-table > tbody > tr:last-child td { border-bottom: none; }
.profit-page .detail-table > tbody > tr:hover > td { background: var(--color-surface-sunken); }

/* --- Пустое состояние --- */
.pp-empty { padding: 64px 24px 72px; text-align: center; }

.pp-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border-radius: 18px;
    background: var(--color-surface-sunken);
    color: var(--mocha-700);
}

.pp-empty h4 {
    margin: 0 0 8px;
    font-family: var(--font-display), sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.pp-empty p {
    margin: 0 auto;
    max-width: 48ch;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-muted);
}

/* --- Тост (ошибка сохранения себестоимости) --- */
.pp-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-pill);
    background: var(--ink-900);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 14px 34px rgba(20, 21, 26, .28);
    opacity: 0;
    transform: translate(-50%, 14px);
    pointer-events: none;
    transition: opacity var(--ease-standard) .2s, transform var(--ease-standard) .2s;
}

.pp-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* --- Появление блоков --- */
@keyframes ppRise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@keyframes ppNudge {
    0%, 100% { transform: translateX(0); }
    30% { transform: translateX(-3px); }
    70% { transform: translateX(3px); }
}

.profit-page .pp-alert,
.profit-page .store-chart,
.profit-page .pp-metrics,
.profit-page .pp-table-card { animation: ppRise .36s var(--ease-standard) both; }

.profit-page .pp-alert { animation-delay: .03s; }
.profit-page .store-chart { animation-delay: .06s; }
.profit-page .pp-metrics { animation-delay: .09s; }
.profit-page .pp-table-card { animation-delay: .12s; }

@media (max-width: 1000px) {
    .profit-page .store-chart.table-card { padding: 20px 18px 16px; }
    .store-chart-total { font-size: 32px; }
    .store-chart-toolbar-controls { align-items: flex-start; width: 100%; }
    .store-chart-toolbar-row { justify-content: flex-start; width: 100%; }
    .quick-period-row { flex-wrap: wrap; row-gap: 2px; max-width: 100%; }
    .pp-table-head { align-items: stretch; padding: 18px 18px 16px; }
    .pp-table-tools { justify-content: space-between; }
    .pp-search { flex: 1 1 220px; }
    .profit-page .search-input { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .profit-page *,
    .pp-toast {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* --- Единый выбор периода (date-range picker), два клика — интервал --- */
.daterange { position: relative; }

.daterange-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
}

.daterange-trigger:hover { background: var(--color-surface-sunken); }
.daterange-trigger-icon { color: var(--text-muted); display: flex; flex: none; }
.daterange-trigger-chevron { color: #000; flex: 0 0 auto; display: flex; transition: transform .15s var(--ease-standard); }
.daterange.open .daterange-trigger-chevron { transform: rotate(180deg); }

.daterange-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hover);
    overflow: hidden;
}

.daterange-panel.open { display: flex; }
.daterange-panel.align-right { left: auto; right: 0; }

/* Карточка с открытым попапом не должна его обрезать (overflow: hidden у
   .table-card) и должна лежать выше соседних анимированных карточек. */
.table-card:has(.daterange.open) { overflow: visible; position: relative; z-index: 40; }
.daterange-panel-top { display: flex; }

.daterange-presets {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 168px;
    flex: none;
    padding: 16px 12px;
    border-right: 1px solid var(--border);
    background: var(--color-surface-sunken);
}

.daterange-preset {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans), sans-serif;
    padding: 9px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
}

.daterange-preset:hover { background: var(--surface); }

.daterange-hint {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-top: 12px;
    padding: 10px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
}

.daterange-hint-icon {
    flex: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.daterange-body { padding: 16px 20px 12px; }

.daterange-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.daterange-nav {
    border: none;
    background: transparent;
    color: var(--text-primary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.daterange-nav:hover { background: var(--color-surface-sunken); }
.daterange-nav:disabled { opacity: .3; cursor: default; pointer-events: none; }

.daterange-cal-titles { display: flex; gap: 24px; }

.daterange-cal-title {
    font-family: var(--font-display), sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    width: 216px;
    text-align: center;
}

.daterange-grids { display: flex; gap: 24px; }

.daterange-grid { border-collapse: collapse; width: 216px; }

.daterange-grid th {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 0 8px;
}

.daterange-cell { text-align: center; padding: 0; }
.daterange-cell.in-range { background: var(--ov-icon-bg); }
.daterange-cell.range-start { border-radius: var(--radius-pill) 0 0 var(--radius-pill); background: var(--ov-icon-bg); }
.daterange-cell.range-end { border-radius: 0 var(--radius-pill) var(--radius-pill) 0; background: var(--ov-icon-bg); }
.daterange-cell.range-start.range-end { border-radius: var(--radius-pill); }

.daterange-day {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 50%;
    font-size: 13px;
    font-family: var(--font-sans), sans-serif;
    color: var(--text-primary);
    cursor: pointer;
}

.daterange-day:hover:not(:disabled) { background: var(--color-surface-sunken); }
.daterange-day.muted { color: var(--ink-300); }
.daterange-day.today { box-shadow: inset 0 0 0 1px var(--border-strong); }
.daterange-day.selected,
.daterange-day.selected:hover { background: var(--ink-900); color: #fff; }
.daterange-day:disabled { color: var(--ink-300); cursor: default; }

.daterange-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

.daterange-summary { font-size: 13px; color: var(--text-muted); font-weight: 600; }

.daterange-reset {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-primary);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
}

.daterange-reset:hover { background: var(--color-surface-sunken); }

.daterange-apply {
    border: none;
    background: var(--ink-900);
    color: #fff;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
}

.daterange-apply:hover { opacity: .85; }
.daterange-apply:disabled { opacity: .4; cursor: default; }

/* --- Вкладки "Быстрые периоды" / "Кастомный период" (страницы, где сервер
   передаёт quick_periods, сейчас — Прибыль) --- */
.daterange-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 12px 0;
}

.daterange-tab {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
    border-bottom: 2px solid transparent;
}

.daterange-tab:hover { color: var(--text-primary); }
.daterange-tab.active { color: var(--text-primary); border-bottom-color: var(--ink-900); }

.daterange-tab-panel { display: none; }
.daterange-tab-panel.active { display: block; }

.daterange-quick-list {
    display: flex;
    flex-direction: column;
    width: 320px;
    padding: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.daterange-quick-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
}

.daterange-quick-row:hover { background: var(--color-surface-sunken); }
.daterange-quick-row.active { background: var(--ov-icon-bg); font-weight: 600; }
.daterange-quick-label { flex: none; }
.daterange-quick-range { color: var(--text-muted); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.daterange-quick-row.active .daterange-quick-range { color: var(--text-secondary); }
.daterange-quick-check { color: var(--ink-900); font-weight: 700; }

/* Краткая подпись под заголовком на странице прибыли. */

/* ---------------------------------------------------------------------------
   Лист сборки FBS (/fbs/assembly). Страница рассчитана на склад: крупные
   цифры количества, читаемые с расстояния, и плотная таблица без лишнего
   декора — её печатают и держат в руках.
   --------------------------------------------------------------------------- */

.fa-toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    text-align: left;
}

.fa-updated { color: var(--text-muted); font-size: 13px; }

.fa-error p { margin: 6px 0 12px; color: var(--text-secondary); }
.fa-empty { padding: 24px; color: var(--text-muted); text-align: center; }

.fa-hub { padding: 0; margin-bottom: 20px; overflow: hidden; }

.fa-hub-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
}

.fa-hub-head > h2 { margin: 0; font-size: 17px; }
.fa-hub-count { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.fa-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fa-table th {
    padding: 9px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--color-border);
}
.fa-table td { padding: 10px 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.fa-table tbody > tr:last-child > td { border-bottom: none; }

.fa-col-photo { width: 48px; }
.fa-col-photo img { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius-sm); display: block; }

.fa-article { font-weight: 600; }
.fa-nm { margin-left: 8px; color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.fa-badge {
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--ov-icon-bg);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.fa-size { font-weight: 600; font-variant-numeric: tabular-nums; }
.fa-barcode { color: var(--text-secondary); font-variant-numeric: tabular-nums; }

.fa-col-qty { width: 76px; text-align: center; }
.fa-qty { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Именно inline-block, а не flex: display:flex на <td> выбивает ячейку из
   табличной раскладки, и нижняя граница строки обрывается по ширине текста. */
.fa-wh {
    display: inline-block;
    margin: 2px 4px 2px 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-surface-sunken);
    color: var(--text-secondary);
    font-size: 12px;
}
.fa-wh > b { margin-left: 5px; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* Матрица остатков ФБС: десятки складов в колонках, поэтому таблица
   прокручивается по горизонтали внутри карточки, а колонки товара и размера
   остаются на месте. По вертикали таблица идёт во всю длину страницы —
   без своего окна прокрутки. */
.fs-scroll { overflow-x: auto; }
/* Шапка со складами закреплена сверху при прокрутке страницы: сдвиг
   --fs-head-y считает скрипт в base.html. */
.fs-scroll > table > thead th { transform: translateY(var(--fs-head-y, 0px)); }
.fs-table thead th { position: sticky; top: 0; z-index: 2; background: var(--color-surface);
    box-shadow: inset 0 -2px 0 var(--color-border-strong); }
.fs-table { min-width: max-content; }
.fs-table th, .fs-table td { white-space: nowrap; }

.fs-sticky, .fs-sticky-size {
    position: sticky;
    background: var(--color-surface);
    z-index: 1;
}
.fs-sticky { left: 0; }
.fs-sticky-size { left: 190px; box-shadow: 1px 0 0 var(--color-border); }
.fs-table thead .fs-sticky, .fs-table thead .fs-sticky-size { z-index: 3; }
.fs-table thead .fs-sticky-size { box-shadow: 1px 0 0 var(--color-border), inset 0 -2px 0 var(--color-border-strong); }

/* Товар с фото на все свои размеры (rowspan) и рамка вокруг группы размеров. */
.fs-table tbody.fs-group { border-top: 2px solid var(--color-border-strong); border-bottom: 2px solid var(--color-border-strong); }
.fs-table td.fs-product { width: 190px; min-width: 190px; max-width: 190px; box-sizing: border-box;
    white-space: normal; vertical-align: top; padding: 8px 10px; }
.fs-product-inner { display: flex; gap: 10px; align-items: flex-start; }
.fs-thumb { width: 40px; height: 52px; flex: none; border-radius: 8px; object-fit: cover; display: block; }
.fs-product-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.fs-product-text .fa-article { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-product-nm, .fs-product-sum { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* «Итого» у Озона закреплено справа от размера: у размера фиксированная ширина,
   у закреплённой ячейки — непрозрачный фон (иначе под ней просвечивают склады). */
.fs-table .fs-sticky-size { width: 72px; min-width: 72px; max-width: 72px; box-sizing: border-box; }
.fs-table .fs-sticky-total { position: sticky; left: 262px; z-index: 1; background: var(--color-surface);
    border-right: 0; box-shadow: inset -2px 0 0 var(--color-border-strong); }
.fs-table thead .fs-sticky-total { z-index: 3; box-shadow: inset -2px 0 0 var(--color-border-strong), inset 0 -2px 0 var(--color-border-strong); }
.fs-table.fs-no-size .fs-sticky-total { left: 190px; }
.fs-table .fs-sticky-total.fs-zero { background: linear-gradient(rgba(180, 35, 24, 0.08), rgba(180, 35, 24, 0.08)), var(--color-surface); }
@media (max-width: 599px) {
    .fs-table td.fs-product, .fs-table th.fs-sticky { width: 140px; min-width: 140px; max-width: 140px; box-sizing: border-box; }
    .fs-table .fs-sticky-size { left: 140px; }
    .fs-table .fs-sticky-total { left: 212px; }
    .fs-table.fs-no-size .fs-sticky-total { left: 140px; }
    .fs-thumb { width: 32px; height: 42px; }
}
.fs-wh { font-size: 11px; }
.fs-hub-kazan { color: var(--text-secondary); }
.fs-hub-moscow { color: var(--text-secondary); }

.fs-cell { text-align: center; font-variant-numeric: tabular-nums; padding: 4px; }
.fs-zero { color: #b42318; font-weight: 700; background: rgba(180, 35, 24, 0.08); }
.fs-missing { color: var(--text-muted); }
.fs-total { font-weight: 700; border-left: 2px solid var(--border, #e5e5e5); }
.fs-total.fs-total-lead { border-left: 0; border-right: 2px solid var(--border, #e5e5e5); }

/* Страница «СПП / Соинвест» — матрица товар × день (spp.html). */
.spp-periods { display: flex; gap: 6px; flex-wrap: wrap; }
.spp-periods .sm-pill-btn { text-decoration: none; }
.spp-period-active { font-weight: 700; border-color: currentColor; }
.spp-product { display: flex; align-items: center; gap: 10px; }
/* contain, а не cover: у Озона фото бывают горизонтальными — обрезка
   квадратом срезала края товара. */
.spp-table .thumb { display: block; width: 44px; height: 44px; border-radius: 8px; flex: none; object-fit: contain; background: #fff; }
.spp-empty { background: rgba(0, 0, 0, 0.02); }
.spp-customer-price { color: var(--text-muted); font-size: 12px; white-space: nowrap; margin-top: 3px; }
.spp-shop-row td { font-weight: 700; border-bottom: 2px solid var(--border, #e5e5e5); }

.fs-open-modal-btn { font-weight: 600; flex-shrink: 0; }

/* Модалка «Изменить остатки»: выбор артикула из select тут же добавляет
   ВСЕ его размеры в список ниже (byArticle в скрипте) — так удобнее, чем
   искать каждый штрихкод отдельно, а лишние размеры убираются крестиком. */
.fs-modal-dialog { width: min(520px, 100%); }
.fs-modal-picker { display: flex; gap: 8px; margin-bottom: 12px; }
.fs-modal-picker select {
    flex: 1; padding: 9px 10px; border: 1px solid var(--color-border); border-radius: 8px;
    font-size: 14px; background: var(--color-surface); color: var(--text-primary);
}
.fs-modal-selected {
    list-style: none; margin: 0 0 16px; padding: 0; max-height: 260px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 6px;
}
.fs-modal-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 8px; background: var(--surface-sunken);
    font-size: 13px;
}
.fs-modal-chip > span { flex: 1; min-width: 0; }
.fs-modal-chip-qty {
    width: 72px; flex-shrink: 0; padding: 5px 8px; border: 1px solid var(--color-border);
    border-radius: 6px; font-size: 13px;
}
.fs-modal-chip-remove {
    border: none; background: none; color: var(--text-muted); font-size: 18px; line-height: 1;
    cursor: pointer; padding: 0 4px;
}
.fs-modal-chip-remove:hover { color: #b42318; }
.fs-modal-empty { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }
.fs-modal-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.fs-set-input { width: 84px; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 14px; }
.fs-set-btn, .fs-zero-btn { padding: 8px 14px; font-size: 13px; }
.fs-zero-btn, .fs-reset-btn { color: #b42318; border-color: rgba(180, 35, 24, 0.3); }
.fs-set-btn:disabled, .fs-zero-btn:disabled { opacity: .4; cursor: default; }

/* Модалка «Группы СЦ» — свои группы витринных складов (например, по
   ответственному человеку), выбираются в модалке «Изменить остатки» вместо
   всегда «на все склады». */
.fs-modal-field-hint { font-size: 13px; color: var(--text-muted); margin: 0 0 8px; }
.fs-group-list { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fs-group-item {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 10px; border-radius: 8px; background: var(--surface-sunken); font-size: 13px;
}
.fs-group-count { color: var(--text-muted); margin-left: 8px; }
.fs-group-form { border-top: 1px solid var(--color-border); padding-top: 16px; }
.fs-group-warehouse-picker {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
    max-height: 220px; overflow-y: auto; margin-bottom: 8px;
}
.fs-group-warehouse-option { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* Панель сканера на листе сборки. Липкая: сборщик прокручивает длинный
   список, но поле ввода должно оставаться под фокусом сканера. */
.fa-scanner {
    position: sticky;
    top: 8px;
    z-index: 5;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.fa-scan-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fa-scan-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

.fa-scan-input {
    flex: 1 1 320px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}
.fa-scan-input:focus { outline: 2px solid var(--ink-900); outline-offset: -1px; }

.fa-scan-hubs { display: flex; gap: 6px; }
.fa-scan-hub {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    font-size: 13px;
    cursor: pointer;
}
.fa-scan-hub.active { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }

.fa-scan-progress { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

.fa-scan-target { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--text-muted); }

.fa-scan-msg { margin: 8px 0 0; min-height: 18px; font-size: 13px; color: var(--text-muted); }
.fa-scan-msg--ok { color: #067647; }
.fa-scan-msg--done { color: #067647; font-weight: 600; }
.fa-scan-msg--warn { color: #b54708; }
.fa-scan-msg--error { color: #b42318; font-weight: 600; }

.fa-picked { font-size: 20px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.fa-row-done { background: rgba(6, 118, 71, 0.06); }

tr[data-pickable] { cursor: pointer; }
tr[data-pickable]:hover { background: rgba(17, 24, 39, 0.04); }
.fa-row-armed { background: rgba(17, 24, 39, 0.08) !important; outline: 2px solid var(--ink-900); outline-offset: -2px; }

.fa-sgtin-status-row { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.fa-sgtin-decision { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.fa-sgtin-decision--ok { background: rgba(6, 118, 71, 0.1); color: #067647; }
.fa-sgtin-decision--warn { background: rgba(181, 71, 8, 0.1); color: #b54708; }
.fa-sgtin-decision--error { background: rgba(180, 35, 24, 0.1); color: #b42318; font-weight: 600; }
.fa-sgtin-detach-form { display: inline; }
.fa-sgtin-detach {
    border: 1px solid var(--border-color, #d0d5dd); background: #fff; border-radius: 999px;
    width: 20px; height: 20px; line-height: 1; cursor: pointer; color: var(--text-muted);
}
.fa-sgtin-detach:hover { color: #b42318; border-color: #b42318; }
.fa-row-done .fa-picked { color: #067647; }
.fa-row-over .fa-picked { color: #b42318; }

/* Короткая вспышка на строке, в которую попал скан, — сборщик смотрит на
   товар в руках, а не в экран, и должен поймать подтверждение боковым зрением. */
@keyframes fa-hit { from { background: rgba(163, 230, 53, 0.55); } to { background: transparent; } }
.fa-row-hit { animation: fa-hit 900ms ease-out; }

/* Блок подтверждения привязки КИЗ. Появляется только после скана кода
   маркировки — пока идёт обкатка, отправка в WB не автоматическая. */
.fa-sgtin {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}
/* display:flex перебивает атрибут hidden — без этого блок привязки виден
   ещё до того, как что-либо отсканировали. */
.fa-sgtin[hidden] { display: none; }

.fa-sgtin-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.fa-sgtin-code {
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-sunken);
    font-size: 12px;
    word-break: break-all;
}
.fa-sgtin-result { font-size: 13px; color: var(--text-muted); }
.fa-sgtin-result--ok { color: #067647; font-weight: 600; }
.fa-sgtin-result--error { color: #b42318; font-weight: 600; }

/* Предупреждение перед необратимым действием (передача в доставку). */
.fa-warning {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-left: 3px solid #b54708;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Переключатель разделов ФБС. Крупные цели нажатия: страницей пользуются
   на планшете склада, часто в перчатках. */
.fbs-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
}

.fbs-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
}

.fbs-tab:hover { background: var(--color-surface-sunken); color: var(--text-primary); }
.fbs-tab.active { background: var(--ink-900); color: #fff; }

.fbs-tab-badge {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--color-surface-sunken);
    color: var(--text-secondary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.fbs-tab.active .fbs-tab-badge { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* Прочерк вместо цифры: величина не «ноль», а неизвестна (WB не отдаёт
   состав поставки, созданной вручную в кабинете). */
.fa-unknown { font-size: 20px; font-weight: 700; color: var(--text-muted); }

/* Индикатор привязки КИЗ: счётчик по строке, зелёная подсветка закрытой
   позиции, и журнал последних попыток (не перезатирается следующим сканом). */
.fa-sgtin-count { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fa-sgtin-count-sep { color: var(--text-muted); font-size: 12px; }
.fa-row-sgtin-done .fa-sgtin-count,
.fa-sgtin-count.fa-row-sgtin-done { color: #067647; }

.fa-sgtin-log {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    max-height: 160px;
    overflow-y: auto;
    border-top: 1px solid var(--color-border);
}
.fa-sgtin-log:empty { border-top: none; margin: 0; }

.fa-sgtin-log-item {
    display: flex;
    gap: 10px;
    padding: 5px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--color-border);
}
.fa-sgtin-log-item:last-child { border-bottom: none; }
.fa-sgtin-log-time { flex: none; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fa-sgtin-log-item--ok { color: #067647; }
.fa-sgtin-log-item--error { color: #b42318; }

/* Шапка карточки поставки на вкладке «Сборка»: счётчик и кнопка справа,
   не растягиваются на всю ширину как раньше в табличной строке. */
.fa-hub-head-right { display: flex; align-items: center; gap: 12px; }
.fa-hub-empty { padding: 14px 16px; color: var(--text-muted); font-size: 13px; }

.fa-toolbar-actions { display: flex; align-items: center; gap: 8px; }

/* --- Площадки WB / Ozon (Личный кабинет → Магазины) --- */
.mp-segment {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 12px;
    background: var(--color-surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.mp-segment-btn {
    height: 34px;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--text-muted);
    font-family: var(--font-sans), sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--ease-standard) .15s, color var(--ease-standard) .15s;
}

.mp-segment-btn:hover { color: var(--text-primary); }

.mp-segment-btn.is-active {
    background: var(--color-surface);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(17, 17, 17, .08);
}

.mp-segment-btn:focus-visible {
    outline: 2px solid var(--ink-900);
    outline-offset: 1px;
}

.mp-segment-modal { margin: 4px 0 16px; }

.mp-badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    margin-left: 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    vertical-align: 2px;
    color: #fff;
}

.mp-badge-wb { background: #7B2FF7; }
.mp-badge-ozon { background: #005BFF; }
.store-card[hidden],
.store-list-empty[hidden] { display: none; }

.ozon-key-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

.ozon-key-row > div:first-of-type { grid-column: 1 / -1; }
.ozon-key-row button.submit { white-space: nowrap; }

.modal-field-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.modal-field[hidden] { display: none; }

.user-menu-panel .user-menu-mp-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-family: var(--font-sans), sans-serif;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: none;
    background: none;
    cursor: pointer;
}

.user-menu-panel .user-menu-mp-switch:hover { background: var(--color-surface-sunken); }

.modal-section-label {
    margin: 18px 0 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-section-label span { font-weight: 500; color: var(--text-muted); }
.modal-section-label[hidden] { display: none; }

/* --- Общие расходы магазина (страница «Прибыль») --- */
.store-costs {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.store-costs summary {
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.store-costs summary::-webkit-details-marker { display: none; }
.store-costs summary::after { content: "▾"; font-size: 11px; }
.store-costs[open] summary::after { content: "▴"; }
.store-costs summary strong { color: var(--text-primary); font-weight: 600; }

.store-costs ul {
    list-style: none;
    margin: 8px 0 0;
    padding: 10px 12px;
    min-width: 320px;
    max-width: 420px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--color-surface-sunken);
}

.store-costs li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 3px 0;
    color: var(--text-primary);
}

.store-costs li span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.store-costs p { margin: 6px 0 0; font-size: 12px; max-width: 420px; }

/* ---- Мастер FBO-поставки Озона (ozon_supply.html / ozon_supplies.html) ---- */
.osw-muted { color: var(--ov-text-secondary); font-size: 13px; }
.osw-hint { margin: 4px 0 10px; }
.osw-back { color: var(--ov-text-secondary); text-decoration: none; }
.osw-back:hover { color: var(--ov-ink); }
.osw-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; margin-bottom: 14px; }
.osw-list { padding: 6px; }
.osw-list-row { display: grid; grid-template-columns: 56px 1fr auto 90px; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); color: var(--ov-ink); text-decoration: none; }
.osw-list-row:hover { background: var(--color-surface-sunken); }
.osw-list-row--wrap { display: flex; align-items: center; gap: 4px; padding: 0; }
.osw-list-row--wrap:hover { background: none; }
.osw-list-link { flex: 1; min-width: 0; display: grid; grid-template-columns: 56px 1fr auto 90px; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); color: var(--ov-ink); text-decoration: none; }
.osw-list-link:hover { background: var(--color-surface-sunken); }
.osw-list-delete { flex: 0 0 auto; padding-right: 8px; }
.osw-delete-btn { padding: 4px 10px; color: var(--ov-text-secondary); }
.osw-delete-btn:hover { color: var(--color-danger, #d33); }
.osw-list-id { font-weight: 600; }
.osw-list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.osw-list-title { font-weight: 500; }
.osw-list-date { text-align: right; }
.osw-chip { background: var(--ov-icon-bg); border-radius: var(--radius-pill); padding: 4px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
/* .ov-card сам по себе колонка — панели с переключателем и кнопкой нужна строка. */
.ov-card.osw-toolbar { flex-direction: row; flex-wrap: wrap; }
a.osw-seg-btn { display: inline-flex; align-items: center; text-decoration: none; }
a.osw-seg-btn.is-on { background: #1F6B45; color: #fff; }

/* Заявки из личного кабинета Ozon */
.osw-cab-filter { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.osw-cab-empty { padding: 20px; }
.ov-card.osw-cab-order { gap: 0; padding: 0; margin-bottom: 12px; }
.osw-cab-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--ov-border); }
.osw-cab-head a { color: inherit; }
.osw-cab-supplies { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; padding: 12px 16px; }
.osw-cab-supply { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--ov-border); border-radius: 12px; }
.osw-cab-cluster { font-size: 14px; font-weight: 600; }
.osw-cab-items { font-size: 13px; overflow-wrap: anywhere; }
.osw-cab-head-side { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.osw-cab-supply .sm-pill-btn, .osw-cab-head-side .sm-pill-btn { white-space: nowrap; }
@media (max-width: 640px) {
    .osw-cab-head { flex-direction: column; }
    .osw-cab-head-side { justify-content: flex-start; }
}

/* .ov-card сам по себе колонка — полосе этапов нужна строка. */
.ov-card.osw-steps { flex-direction: row; gap: 4px; list-style: none; margin: 0 0 14px; padding: 8px; overflow-x: auto; }
.osw-step { flex: 1 1 0; min-width: 120px; }
.osw-step > a, .osw-step > span { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ov-ink); text-decoration: none; font-size: 13px; font-weight: 500; }
.osw-step-num { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--ov-icon-bg); font-size: 12px; font-weight: 600; }
.osw-step--current > span { background: var(--ov-accent-soft); }
.osw-step--current .osw-step-num { background: var(--ov-accent); }
.osw-step--done .osw-step-num { background: var(--ov-ink); color: #fff; }
.osw-step--done > a:hover, .osw-step--open > a:hover { background: var(--color-surface-sunken); }
.osw-step--locked > span { color: var(--ov-text-muted); }

.osw-problems { border: 1px solid rgba(232, 115, 74, .45); background: #FFF6F1; padding: 14px 18px; margin-bottom: 14px; }
.osw-problems-title { font-weight: 600; margin-bottom: 6px; }
.osw-problems ul { margin: 0; padding-left: 18px; }
.osw-problems li { margin: 4px 0; }
.osw-problems a { color: var(--coral); font-weight: 600; margin-left: 6px; }

.osw-form { display: flex; flex-direction: column; gap: 14px; }
.osw-section { padding: 16px 18px; scroll-margin-top: 80px; }
.osw-section--bad { box-shadow: 0 0 0 2px var(--coral); }
.osw-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.osw-section-title { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
.osw-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.osw-options--inline { grid-template-columns: repeat(auto-fit, minmax(140px, 180px)); }
.osw-option { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 12px 40px; border: 1px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer; }
.osw-option input { position: absolute; left: 14px; top: 14px; accent-color: #111; }
.osw-option:has(input:checked) { border-color: var(--ov-ink); background: var(--ov-accent-soft); }
.osw-option-title { font-weight: 600; }
.osw-input { width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); font: inherit; background: #fff; }
.osw-results { list-style: none; margin: 6px 0 0; padding: 0; max-height: 320px; overflow-y: auto; }
.osw-result { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; cursor: pointer; font: inherit; }
.osw-result:hover { background: var(--color-surface-sunken); }
.osw-picked { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--ov-accent-soft); }
.osw-picked > span { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.osw-actions--left { justify-content: flex-start; margin-top: 12px; }
.osw-subtitle { margin: 18px 0 8px; font-size: 15px; }
.osw-saved { list-style: none; margin: 0; padding: 0; }
.osw-saved-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--color-border); }
/* «Куда поедет товар» — карточный дашборд (зелёный акцент, светлые плитки) */
.osw-dest { --dz: #1F6B45; --dz-soft: #EAF5EE; --dz-line: #BFE0CC; background: #FAFAF8; border-radius: 22px; padding: 22px; }
.osw-dest-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; margin-bottom: 18px; }
.osw-dest-titlebox { display: flex; align-items: center; gap: 16px; min-width: 0; }
.osw-dest-icon { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--dz-soft); color: var(--dz); }
.osw-dest-title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--ov-ink); }
.osw-dest-sub { margin: 4px 0 0; font-size: 14px; color: var(--ov-text-secondary); }
.osw-dest-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.osw-seg { display: inline-flex; padding: 4px; gap: 2px; border: 1px solid var(--ov-border); border-radius: 16px; background: #F3F3F0; }
.osw-seg-btn { border: 0; background: transparent; padding: 9px 16px; border-radius: 12px; font: inherit; font-size: 14px; color: var(--ov-text-secondary); cursor: pointer; }
.osw-seg-btn.is-on { background: var(--dz); color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(31, 107, 69, .28); }
.osw-cover { display: inline-flex; align-items: center; gap: 8px; color: var(--ov-text-secondary); font-size: 14px; }
.osw-cover input { width: 76px; padding: 9px 12px; border: 1px solid var(--ov-border); border-radius: 12px; font: inherit; font-weight: 600; background: #fff; color: var(--ov-ink); }
.osw-skus { display: flex; flex-wrap: wrap; gap: 8px; }
.osw-sku { padding: 9px 18px; border: 1px solid var(--ov-border); border-radius: 999px; background: #fff; font: inherit; font-size: 14px; color: var(--ov-text-secondary); cursor: pointer; }
.osw-sku.is-on { border-color: var(--dz); background: var(--dz-soft); color: var(--ov-ink); font-weight: 600; }
.osw-dest-search { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
.osw-search { flex: 1 1 280px; display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 48px; border: 1px solid var(--ov-border); border-radius: 16px; background: #fff; color: var(--ov-text-muted); }
.osw-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; color: var(--ov-ink); }
.osw-count { flex: none; padding: 0 16px; height: 48px; display: inline-flex; align-items: center; border: 1px solid var(--ov-border); border-radius: 16px; background: #fff; font-size: 14px; color: var(--ov-text-secondary); white-space: pre; }
.osw-count b { color: var(--ov-ink); margin: 0 4px; }
.osw-clusters { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 0; }
.osw-cluster { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--ov-border); border-radius: 20px; background: #fff; box-shadow: 0 1px 3px rgba(20, 20, 15, .04); cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.osw-cluster:hover { box-shadow: 0 6px 18px rgba(20, 20, 15, .08); }
.osw-cluster[hidden] { display: none; }
.osw-cluster.is-selected .osw-cluster-name, .osw-cluster.is-selected .osw-cluster-need { padding-left: 32px; }
.osw-cluster.is-selected { background: var(--dz-soft); border-color: var(--dz); box-shadow: 0 8px 22px rgba(31, 107, 69, .16); }
.osw-cluster-check { display: none; position: absolute; left: 14px; top: 16px; width: 24px; height: 24px; border-radius: 50%; background: var(--dz); color: #fff; place-items: center; }
.osw-cluster.is-selected .osw-cluster-check { display: grid; }
.osw-cluster-name { font-size: 16px; font-weight: 650; color: var(--ov-ink); }
.osw-cluster-need { font-size: 14px; color: var(--dz); font-weight: 600; }
.osw-cluster--art { padding-right: 72px; } /* место под декоративную иллюстрацию региона (справа снизу) */
.osw-cluster-stats { display: flex; flex-wrap: nowrap; gap: 10px 18px; margin-top: 4px; }
.osw-stat { display: inline-flex; align-items: center; gap: 8px; }
.osw-stat-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: #F3F3F0; color: var(--ov-text-secondary); }
.osw-stat b { display: block; font-size: 14px; font-weight: 650; color: var(--ov-ink); white-space: nowrap; }
.osw-stat small { display: block; font-size: 12px; color: var(--ov-text-muted); }
.osw-qty { margin-top: 6px; width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid var(--ov-border); border-radius: 12px; font: inherit; background: #fff; }
.osw-qty:focus { outline: 0; border-color: var(--dz); }
@media (max-width: 640px) {
    .osw-dest { padding: 16px; }
    .osw-dest-title { font-size: 20px; }
    .osw-dest-icon { width: 46px; height: 46px; }
    .osw-clusters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (max-width: 420px) { .osw-clusters { grid-template-columns: 1fr; } }
.osw-actions--split a, .osw-section-head a.sm-pill-btn { text-decoration: none; }
.osw-actions--split { justify-content: space-between; align-items: center; }
.osw-review-warn { margin: 0 0 8px; padding: 10px 14px; border-radius: 12px; background: #FFF6F1; border: 1px solid rgba(232, 115, 74, .45); font-size: 14px; }
.osw-review-group { margin-top: 14px; border: 1px solid var(--ov-border); border-radius: 16px; overflow: hidden; }
.osw-review-group[hidden], .osw-review-row[hidden] { display: none; }
.osw-review-head { display: flex; justify-content: space-between; padding: 10px 16px; background: #F6F6F3; }
.osw-review-head--bad { color: #C0392B; }
.osw-review-row { display: grid; grid-template-columns: 1fr 110px auto auto; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--ov-border); }
.osw-review-art { display: flex; flex-direction: column; font-weight: 600; min-width: 0; }
.osw-review-art small { font-weight: 400; color: var(--ov-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osw-review-qty { margin-top: 0; }
@media (max-width: 640px) { .osw-review-row { grid-template-columns: 1fr 90px auto; } .osw-review-row .osw-muted { display: none; } }
.osw-slot-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.osw-slot-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.osw-slot-tab { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 52px; padding: 6px 10px; border: 1px solid var(--ov-border); border-radius: 12px; background: #fff; font: inherit; cursor: pointer; }
.osw-slot-tab b { font-size: 14px; font-weight: 600; }
.osw-slot-tab span { font-size: 11px; color: var(--ov-text-muted); }
.osw-slot-tab:hover { border-color: #BFE0CC; }
.osw-slot-tab--active { border-color: #1F6B45; background: #1F6B45; }
.osw-slot-tab--active b, .osw-slot-tab--active span { color: #fff; }
.osw-slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.osw-slot { padding: 8px 10px; border: 1px solid var(--ov-border); border-radius: 10px; background: #fff; font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer; text-align: center; }
.osw-slot:hover { border-color: var(--dz, #1F6B45); background: #EAF5EE; }
.osw-cargo-cluster { padding: 10px 16px 0; font-size: 13px; font-weight: 600; color: var(--ov-text-secondary); }
.osw-cargo-row { grid-template-columns: minmax(140px, 1fr) auto minmax(120px, 2fr); }
.osw-cargo-cap { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ov-text-secondary); white-space: nowrap; }
.osw-cargo-cap .osw-qty { width: 90px; margin-top: 0; }
.osw-cargo-boxes { display: flex; flex-wrap: wrap; gap: 4px; }
.osw-box { padding: 3px 9px; border-radius: 8px; background: #F3F3F0; border: 1px solid var(--ov-border); font-size: 12px; font-variant-numeric: tabular-nums; }
.osw-cargo-state { padding: 10px 16px; border-top: 1px solid var(--ov-border); font-size: 14px; }
.osw-raw { max-height: 240px; overflow: auto; font-size: 12px; background: #F6F6F3; padding: 8px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; }
.osw-cargo-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--ov-border); }
.osw-cargo-all { justify-content: space-between; border-top: none; border-bottom: 1px solid var(--ov-border); background: #F6F6F3; }
.osw-confirm { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
@media (max-width: 640px) { .osw-cargo-row { grid-template-columns: 1fr; } }
.osw-pass-block { border-top: 1px solid var(--ov-border); }
.osw-pass-labels { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 14px; }
.osw-pass-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; padding: 10px 16px 0; }
.osw-pass-driver-pick { width: calc(100% - 32px); margin: 10px 16px 0; }
.osw-pass-raw { padding: 0 16px 12px; }
.osw-ship-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; }
.osw-switch { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.osw-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.osw-switch-track { flex: none; position: relative; width: 46px; height: 26px; border-radius: 999px; background: var(--color-border-strong); transition: background .15s; }
.osw-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.osw-switch input:checked + .osw-switch-track { background: #1F6B45; }
.osw-switch input:checked + .osw-switch-track::after { transform: translateX(20px); }
.osw-switch input:focus-visible + .osw-switch-track { outline: 2px solid #1F6B45; outline-offset: 2px; }
.osw-ship-hint { display: block; font-size: 13px; }
.osw-ship-dropoff { margin-top: 14px; }
.osw-seg-radio { display: inline-flex; align-items: center; }
.osw-seg-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.osw-seg-radio:has(input:checked) { background: #1F6B45; color: #fff; font-weight: 600; }
.osw-seg-radio:has(input:focus-visible) { outline: 2px solid #1F6B45; outline-offset: 2px; }
.osw-issues { margin: 10px 0 4px; padding: 10px 14px; border-radius: 12px; background: #FFF6F1; border: 1px solid rgba(232, 115, 74, .45); }
.osw-issues ul { margin: 6px 0 0; padding-left: 18px; }
.osw-review-row .sm-pill-btn { white-space: nowrap; }
.osw-review-row--pair { grid-template-columns: minmax(0, 1fr) auto; }
.osw-apply-all { padding: 0 16px 12px; }
.osw-diagnosis { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.osw-diagnosis-progress { font-size: 12px; }
.osw-diagnosis-list { margin: 0; padding-left: 18px; font-size: 13px; color: #A2492B; display: flex; flex-direction: column; gap: 6px; }
.osw-diagnosis-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.osw-diagnosis-item form { flex: none; }
.osw-diagnosis-cleared { margin: 0; font-size: 12px; color: var(--ov-text-secondary); }
.osw-diagnosis-form { display: flex; }
.osw-actions { display: flex; justify-content: flex-end; }
/* hidden должен побеждать display: flex у карточек и блоков мастера. */
.osw-form [hidden] { display: none !important; }
@media (max-width: 640px) {
    .osw-list-row, .osw-list-link { grid-template-columns: 44px 1fr; }
    .osw-list-row .osw-chip, .osw-list-link .osw-chip, .osw-list-date { grid-column: 2; justify-self: start; text-align: left; }
}

/* ---------- Реклама (Озон) ---------- */
.ad-section { padding: 18px 20px; margin-bottom: 16px; }
.ad-h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.ad-count { font-size: 12px; font-weight: 600; background: #f1f1f1; border-radius: 10px; padding: 1px 8px; }
.ad-hint { font-size: 12px; color: #777; margin: 0 0 12px; line-height: 1.45; max-width: 980px; }
.ad-metric-note { font-size: 11px; color: #888; }
.ad-in { color: #2e7d32; }
.ad-out { color: #c77700; }
.ad-bad { color: #c62828; }
.ad-muted td { color: #999; }
.ad-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.ad-corridor { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ad-corridor input { width: 44px; padding: 4px 6px; border: 1px solid #ddd; border-radius: 6px; text-align: center; font: inherit; }
.ad-advice { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ad-tip { border: 1px solid #eee; border-left: 4px solid #bbb; border-radius: 8px; padding: 10px 12px; }
.ad-tip--bad { border-left-color: #e53935; }
.ad-tip--warn { border-left-color: #f5a623; }
.ad-tip--good { border-left-color: #43a047; }
.ad-tip--info { border-left-color: #90a4ae; }
.ad-tip-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ad-tip-title { font-weight: 600; font-size: 14px; }
.ad-tip-action { font-size: 13px; margin-top: 4px; }
.ad-tip-why { font-size: 12px; color: #666; margin-top: 4px; line-height: 1.45; }
.ad-source { margin-left: auto; font-size: 11px; color: #888; border: 1px solid #e5e5e5; border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.ad-chip { display: inline-block; font-size: 11px; background: #f3f3f3; border-radius: 10px; padding: 1px 8px; margin: 1px 4px 1px 0; white-space: nowrap; }
.ad-chip--off { opacity: .5; }
.ad-table td, .ad-table th, .ad-monitor td, .ad-monitor th { white-space: nowrap; font-size: 12px; }
.ad-monitor td:first-child { text-align: left; color: #555; }
.ad-camps { white-space: normal !important; min-width: 160px; }
.ad-camp-title { display: block; font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ad-camp-type { font-size: 11px; color: #888; }
.ad-details { margin-top: 8px; }
.ad-details summary { cursor: pointer; font-size: 13px; padding: 6px 0; }
.ad-sub { margin: 6px 0 12px; }
.ad-apply-btn { margin-top: 8px; font-size: 12px; }
.ad-ai { border: 1px solid #d9e7c4; }
.ad-source--ai { border-color: #c5dca4; color: #4b7a1a; background: #f3f9ea; }
.ad-products-title { margin: 8px 4px 10px; }
.ad-product { padding: 14px 18px; }
.ad-product-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 10px; }
.ad-product-name { display: grid; min-width: 140px; }
.ad-product-article { font-weight: 600; font-size: 15px; }
.ad-product-kpi { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 0 auto; }
.ad-product-kpi div { display: grid; }
.ad-product-kpi dt { font-size: 11px; color: #888; }
.ad-product-kpi dd { margin: 0; font-size: 13px; font-weight: 600; }
.ad-product-ok { margin: 0; font-size: 13px; color: #2e7d32; }
.ad-passport { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 0 0 12px; }
.ad-pp-box { background: #f8f8f8; border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.6; }
.ad-pp-title { font-weight: 600; font-size: 12px; margin-bottom: 2px; }
.ad-pp-sub { margin-top: 6px; }
.ad-review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 4px; }
.ad-review-head .ad-h2 { flex: 1; margin-bottom: 0; }
.ad-review-head form { margin: 0; }
.ad-ai-meta { margin-left: auto; font-size: 12px; font-weight: 400; color: #888; }
.ad-ai-stale { font-size: 12px; color: #c77700; margin: 0 0 10px; }
.ad-ai-summary { font-size: 13px; line-height: 1.55; margin-bottom: 12px; max-width: 980px; }
.ad-ai-summary p { margin: 0 0 8px; }
.ad-wrap { white-space: normal !important; min-width: 160px; max-width: 260px; }
.ad-dialog { border: 0; border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.ad-dialog::backdrop { background: rgba(0,0,0,.35); }
.ad-dialog [hidden] { display: none !important; }
.ad-dialog-body { padding: 20px; display: grid; gap: 12px; }
.ad-dialog-title { margin: 0; font-size: 16px; }
.ad-dialog-edit { display: grid; gap: 8px; }
.ad-field { display: grid; gap: 4px; font-size: 13px; }
.ad-field input, .ad-field select { padding: 7px 9px; border: 1px solid #ddd; border-radius: 8px; font: inherit; }
.ad-dialog-preview { background: #f7f7f7; border-radius: 10px; padding: 10px 12px; font-size: 13px; display: grid; gap: 6px; }
.ad-pv-row { display: flex; justify-content: space-between; gap: 12px; }
.ad-pv-row span { color: #666; }
.ad-pv-ok { color: #2e7d32; }
.ad-dialog-error { margin: 0; color: #c62828; font-size: 13px; }
.ad-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 640px) {
    .ad-section { padding: 14px 16px; }
    .ad-source { margin-left: 0; }
}

/* Вкладка «Контроль» (control.html) */
.ct-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ct-shop { font-size: 12px; color: var(--text-muted, #777); }
.ct-crit { font-size: 11px; font-weight: 600; color: #fff; background: #e53935; border-radius: 10px; padding: 1px 8px; }
.ct-dl { display: grid; grid-template-columns: 170px 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 13px; line-height: 1.45; }
.ct-dl dt { color: var(--text-muted, #777); }
.ct-dl dd { margin: 0; }
.ct-related { font-size: 12px; color: #666; margin-top: 6px; }
.ct-ack { margin-top: 8px; }
.ct-more { margin-top: 12px; }
.ct-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.ct-warn { color: #a15c00; }
.ct-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ct-neg { color: #c62828; }
.ct-pos { color: #2e7d32; }
.ct-bridge { max-width: 640px; }
.ct-total td { font-weight: 600; border-top: 2px solid var(--color-border, #ddd); }
.ct-lines span { display: block; font-size: 12px; }
.ct-flag { font-size: 12px; color: #a15c00; }
.ct-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 12px; font-size: 13px; }
.ct-inline input { width: 70px; }
.ct-pools { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; margin-top: 8px; font-size: 13px; }
.ct-pools label { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ct-pools input { width: 140px; }
.ct-pools button { justify-self: start; }
.ct-action-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 10px 0 14px; font-size: 13px; }
.ct-action-form label { display: flex; flex-direction: column; gap: 3px; }
.ct-action-form select, .ct-action-form input { min-height: 32px; }
.ct-action-form .ct-wide { flex: 1 1 260px; }
.ct-unavail { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }
@media (max-width: 640px) {
    .ct-dl { grid-template-columns: 1fr; }
    .ct-dl dt { margin-top: 4px; }
}
.ct-note { font-size: 12px; font-weight: 600; color: #c62828; margin-top: 4px; }

/* «Контроль рекламных кампаний» Озона (ozon_ad_control.html). */
.ac-toolbar { flex-direction: row; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ac-field { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.ac-select { padding: 8px 12px; border: 1px solid var(--ov-border); border-radius: 10px; background: var(--surface); font: inherit; min-width: 240px; max-width: 100%; }
.ac-card { margin-bottom: 16px; }
.ac-product { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ac-product > div { display: flex; flex-direction: column; }
.ac-thumb { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--ov-border); }
.ac-muted { color: var(--text-muted, #8a8f98); font-size: 12px; display: block; }
.ac-table-wrap { overflow-x: auto; }
.ac-table td:not(:first-child), .ac-table th:not(:first-child) { text-align: right; white-space: nowrap; }
.ac-table a { color: inherit; text-decoration: none; font-weight: 600; }
.ac-table a:hover { text-decoration: underline; }
.ac-row-all td { border-bottom: 2px solid var(--ov-border); }
.ac-selected td { background: rgba(47, 140, 240, .08); }
.ac-selected td:first-child { box-shadow: inset 3px 0 0 #2f8cf0; }
.ac-off td { color: var(--text-muted, #8a8f98); }
.ac-state { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #f0f1f3; }
.ac-state-on { background: rgba(47, 140, 240, .12); color: #1d6fc4; }
.ac-chart-layout { display: grid; grid-template-columns: 280px 1fr; gap: 32px; }
.ac-h2 { font-size: 18px; margin: 0 0 12px; }
.ac-metric-list { display: flex; flex-direction: column; gap: 4px; }
.ac-metric { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.ac-metric input { width: 18px; height: 18px; accent-color: #2f8cf0; margin: 0; }
.ac-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ac-gran { display: inline-flex; border: 1px solid var(--ov-border); border-radius: 10px; padding: 2px; }
.ac-gran-btn { border: 1px solid transparent; background: none; padding: 5px 10px; border-radius: 8px; font: inherit; color: var(--text-muted, #8a8f98); cursor: pointer; }
.ac-gran-btn.active { border-color: #2f8cf0; color: inherit; }
.ac-gran-btn:disabled { opacity: .4; cursor: not-allowed; }
.ac-chart-title { color: var(--text-muted, #8a8f98); margin: 8px 0 4px; }
.ac-chart-wrap { position: relative; height: 280px; }
.ac-empty { color: var(--text-muted, #8a8f98); font-size: 13px; }
.ac-legend { display: grid; grid-template-columns: auto 22px auto; gap: 4px 10px; align-items: center; justify-content: start; margin-top: 12px; font-size: 13px; }
.ac-line { display: inline-block; width: 18px; border-top: 2px solid #2f8cf0; }
.ac-line-dash { border-top-style: dotted; }
@media (max-width: 760px) { .ac-chart-layout { grid-template-columns: 1fr; gap: 16px; } }
.ac-note { margin-top: 10px; }
@media (max-width: 760px) {
    .ac-field { flex-wrap: wrap; width: 100%; }
    .ac-select { min-width: 0; width: 100%; }
}
@media (max-width: 760px) { .topbar-title h1.ac-title { white-space: normal; font-size: 22px; } }
.ac-sizes { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 16px; }
.ac-size { padding: 6px 14px; border: 1px solid var(--ov-border); border-radius: 10px; color: inherit; text-decoration: none; font-weight: 600; min-width: 44px; text-align: center; }
.ac-size:hover { border-color: #2f8cf0; }
.ac-size.active { border-color: #2f8cf0; background: rgba(47, 140, 240, .08); color: #1d6fc4; }
.ac-size-noads { color: var(--text-muted, #8a8f98); font-weight: 400; }

/* =========================================================================
   «Заказы по SKU»: товары с размерами (строка товара + раскрываемые
   размеры), колонка «Остаток», пастельная шкала по строке.
   Ширины колонок фиксированы (table-layout: fixed + colgroup) — раскрытие
   размеров не двигает колонки.
   ========================================================================= */
/* Сводка: «Заказы за период» (≈2/3) + «Топ SKU» и «Пиковый день» (≈1/3)
   друг под другом; правая колонка растягивается по высоте левой. */
.sku-matrix-page .sm-control-card { margin-bottom: 0; padding: 12px 16px; }
.sm-summary {
    display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; align-items: stretch;
    font-variant-numeric: tabular-nums;
}
.sm-sum-side { display: grid; grid-template-rows: 1fr 1fr; gap: 14px; min-width: 0; }
.sm-summary .ov-card { padding: 20px 22px; min-width: 0; }
.sm-sum-title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; color: var(--ov-text, #111); }
.sm-sum-sub { margin: 2px 0 0; font-size: 13px; line-height: 1.35; color: var(--ov-text-secondary); }
.sm-sum-total { font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -.02em; margin: 14px 0 6px; }

.sm-sum-card { justify-content: space-between; gap: 12px; }
.sm-sum-body { display: flex; align-items: center; gap: 16px; min-width: 0; }
.sm-top-photo { width: 76px; height: 76px; flex: 0 0 76px; border-radius: 14px; object-fit: contain; background: #fff; border: 1px solid var(--ov-border); }
.sm-top-name { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.sm-top-article { font-size: 22px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.sm-peak-date { font-size: 24px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.sm-cal-icon {
    width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--ov-icon-bg); color: #111;
}
.sm-sum-figure { display: flex; flex-direction: column; align-items: flex-end; flex: 0 0 auto; margin-left: auto; }
.sm-sum-num { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.01em; }
.sm-sum-unit { font-size: 13px; color: var(--ov-text-secondary); margin-top: 4px; }
.sm-sum-empty { margin: 0; font-size: 15px; color: var(--ov-text-secondary); }

/* Диаграмма: столбец на день, высота от нуля, подписи значений над
   столбцами, даты под ними; на длинном периоде подписи прореживаются. */
.sm-chart {
    flex: 1 1 auto; min-height: 150px; display: grid; grid-template-columns: repeat(var(--sm-bars), minmax(0, 1fr));
    gap: 0 clamp(2px, 1.2vw, 14px); align-items: stretch; padding: 0 8px;
}
.sm-chart.is-dense { column-gap: clamp(1px, .4vw, 6px); }
.sm-bar-col { display: flex; flex-direction: column; min-width: 0; outline: none; cursor: default; border-radius: 8px; }
.sm-bar-col:focus-visible { box-shadow: 0 0 0 2px #111; }
.sm-bar-plot {
    flex: 1 1 auto; display: flex; flex-direction: column; justify-content: flex-end; padding-top: 26px;
    border-bottom: 1px solid var(--ov-border);
}
.sm-chart.has-tall-partial .sm-bar-plot { padding-top: 52px; }
.sm-bar { position: relative; border-radius: 7px 7px 0 0; transition: filter 150ms ease; }
.sm-bar.is-zero, .sm-bar.is-none { height: 0; }
.sm-bar-col:hover .sm-bar, .sm-bar-col:focus-visible .sm-bar { filter: brightness(.96) saturate(1.15); }
.sm-bar-val {
    position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 6px;
    display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
    font-size: 14px; font-weight: 600; color: #111; z-index: 1;
}
.sm-bar.is-none .sm-bar-val { color: var(--ov-text-secondary); font-weight: 500; }
.sm-bar-info {
    width: 13px; height: 13px; border-radius: 50%; background: #3a3a3f; color: #fff; font-style: normal;
    font-size: 9px; font-weight: 700; line-height: 13px; text-align: center; font-family: Georgia, serif;
}
.sm-bar-pill {
    position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 28px; white-space: nowrap;
    padding: 3px 7px; border-radius: 6px; background: #2b2b2f; color: #fff; font-size: 10.5px; font-weight: 500;
}
.sm-bar-date { margin-top: 8px; text-align: center; font-size: 12.5px; color: var(--ov-text-secondary); white-space: nowrap; }
.sm-chart.is-dense .sm-bar-col:not(.is-labeled) .sm-bar-date,
.sm-chart.is-dense .sm-bar-col:not(.is-labeled) .sm-bar-val { visibility: hidden; }
.sm-chart.is-dense .sm-bar-val { font-size: 12px; }
.sm-chart.is-dense .sm-bar-date { overflow: visible; }

.sm-tip {
    position: fixed; z-index: 1000; pointer-events: none; min-width: 150px; padding: 10px 12px; border-radius: 12px;
    background: #1b1b1e; color: #fff; font-size: 12.5px; box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
    font-variant-numeric: tabular-nums;
}
.sm-tip-date { font-weight: 600; margin-bottom: 6px; }
.sm-tip-row { display: flex; justify-content: space-between; gap: 16px; color: rgba(255, 255, 255, .7); }
.sm-tip-row b { color: #fff; font-weight: 600; }

@media (max-width: 1100px) {
    .sm-summary { grid-template-columns: minmax(0, 1fr); }
    .sm-sum-side { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; }
}
@media (max-width: 640px) {
    .sm-sum-side { grid-template-columns: minmax(0, 1fr); }
    .sm-sum-total { font-size: 44px; }
    .sm-chart { padding: 0; }
    .sm-bar-val { font-size: 11px; }
    .sm-bar-date { font-size: 11px; }
    /* 8–14 дней на телефоне — подписи через одну, точные значения в подсказке. */
    .sm-chart.is-many .sm-bar-col:nth-last-child(even) .sm-bar-date,
    .sm-chart.is-many .sm-bar-col:nth-last-child(even) .sm-bar-val { visibility: hidden; }
    .sm-chart.is-dense .sm-bar-val { visibility: hidden; }
}
.sm-bar-col:last-child .sm-bar-pill { left: auto; right: 0; transform: none; }
@media (prefers-reduced-motion: reduce) { .sm-bar { transition: none; } }

.sm-table-toolbar {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px;
    margin-bottom: -6px;
}
.sm-collapse-all { background: var(--surface); }
.sm-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--ov-text-secondary); }
.sm-legend-sw { display: inline-block; height: 12px; border-radius: 4px; }
.sm-legend-sw--low { width: 22px; background: rgb(246, 190, 186); }
.sm-legend-sw--grad { width: 64px; background: linear-gradient(90deg, rgb(249, 240, 180), rgb(164, 228, 166)); }

/* Прокрутка страницы общая: вложенная вертикальная прокрутка блока
   (ради закреплённой шапки) заметно роняла плавность. Когда таблица
   помещается по ширине, блок не создаёт своей прокрутки (.is-fit) и шапка
   закрепляется при прокрутке страницы; иначе — горизонтальная прокрутка. */
.sm-table-card.sm-orders-card { overflow: clip; }
.sm-orders-scroll.is-fit { overflow: visible; }

#ordersGrid {
    --sm-w-photo: 96px; --sm-w-article: 200px; --sm-w-stock: 92px;
    table-layout: fixed;
    width: 100%;
    min-width: calc(var(--sm-w-photo) + var(--sm-w-article) + var(--sm-w-stock) + var(--sm-days) * 72px + 108px);
}
@media (max-width: 900px) {
    #ordersGrid { --sm-w-photo: 84px; --sm-w-article: 128px; --sm-w-stock: 76px; }
    #ordersGrid td .thumb { width: 36px; height: 36px; }
}
#ordersGrid .sm-col-photo { width: var(--sm-w-photo); }
#ordersGrid .sm-col-article { width: var(--sm-w-article); }
#ordersGrid .sm-col-stock { width: var(--sm-w-stock); }
#ordersGrid .sm-col-trend { width: 108px; }
@media (max-width: 640px) {
    #ordersGrid .trend-col, #ordersFbsGrid .trend-col { right: auto; }
}

#ordersGrid th, #ordersGrid td { border-bottom: 1px solid var(--ov-border); }
#ordersGrid thead th {
    padding: 10px 8px; vertical-align: middle; line-height: 1.25;
    text-transform: none; letter-spacing: 0; font-size: 13px;
}
#ordersGrid thead th.photo-col { text-align: center; }
#ordersGrid thead th.photo-col, #ordersGrid thead th.article-col, #ordersGrid thead th.stock-col { z-index: 8; }
.sm-th-main { display: block; color: var(--ov-text-secondary); }
.sm-th-sub { display: block; font-size: 11px; font-weight: 500; color: var(--ov-text-muted); margin-top: 2px; }

/* Закреплённые слева: фото, артикул, остаток. */
#ordersGrid td.photo-col, #ordersGrid th.photo-col { left: 0; padding: 6px 8px 6px 10px; }
#ordersGrid td.article-col, #ordersGrid th.article-col {
    left: var(--sm-w-photo); padding: 6px 12px; box-shadow: none; border-right: 0; font-weight: 400;
    overflow: hidden; text-overflow: ellipsis;
}
#ordersGrid td.stock-col, #ordersGrid th.stock-col {
    position: sticky; left: calc(var(--sm-w-photo) + var(--sm-w-article)); z-index: 6; background: var(--surface);
    text-align: center; font-variant-numeric: tabular-nums;
    border-right: 1px solid var(--ov-border); box-shadow: none;
}
#ordersGrid thead th.stock-col { background: var(--ov-icon-bg); }
#ordersGrid tr.total-row td.stock-col { background: var(--ov-icon-bg) !important; }
#ordersGrid td.stock-col.is-strong { font-weight: 700; font-size: 14px; color: var(--ov-ink); }
.sm-stock-partial { color: var(--ov-text-muted); font-weight: 600; margin-left: 1px; }
.sm-stock-loading { color: var(--ov-text-muted); animation: sm-pulse 1.2s ease-in-out infinite; }
.sm-stock-error { color: var(--ov-danger); }
.sm-stock-warn { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ov-danger); vertical-align: middle; }
@keyframes sm-pulse { 50% { opacity: .35; } }

/* Строки товаров */
#ordersGrid tbody tr.sm-group-row td, #ordersGrid tbody tr.sm-sku-row td { height: 44px; padding-top: 6px; padding-bottom: 6px; }
#ordersGrid tbody tr.sm-group-row td.article-col, #ordersGrid tbody tr.sm-sku-row td.article-col { line-height: 1.25; }
#ordersGrid .thumb { width: 44px; height: 44px; border-radius: 10px; }
.sm-photo-cell { display: flex; align-items: center; gap: 6px; }
.sm-expand-btn, .sm-expand-spacer { flex: 0 0 24px; width: 24px; height: 24px; }
.sm-expand-btn {
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
    border: 0; border-radius: 7px; background: transparent; color: var(--ov-ink); cursor: pointer;
}
.sm-expand-btn:hover { background: var(--ov-icon-bg); }
.sm-expand-btn:focus-visible { outline: 2px solid var(--ov-ink); outline-offset: 1px; }
.sm-expand-btn svg { transition: transform 200ms var(--ease-out-strong, ease-out); }
tr.sm-group-row.is-open .sm-expand-btn svg { transform: rotate(90deg); }
.sm-name { display: block; font-weight: 700; font-size: 14px; color: var(--ov-ink); overflow: hidden; text-overflow: ellipsis; }
.sm-name[data-group-toggle] { cursor: pointer; }
.sm-sizes { display: block; font-size: 12px; color: var(--ov-text-muted); }
table.grid.order-editing .sm-expand-btn { visibility: hidden; }

/* Ячейки дней: сплошная заливка на всю ячейку, тонкий белый шов. */
#ordersGrid td.sm-day {
    padding: 0 4px; font-variant-numeric: tabular-nums; color: #14151a; font-weight: 500;
    border-right: 1px solid rgba(255, 255, 255, .7);
}
#ordersGrid tr.sm-group-row td.sm-day, #ordersGrid tr.sm-sku-row td.sm-day { font-weight: 650; font-size: 13.5px; }
#ordersGrid td.sm-day.is-empty { color: var(--ov-text-muted); }
#ordersGrid th.sm-day.is-partial .sm-th-sub { color: var(--ov-text-secondary); }
#ordersGrid tbody tr:hover td { filter: none; }
#ordersGrid tr.total-row td.sm-day { padding: 6px 4px; }

/* Размеры: раскрытие высотой через grid 0fr → 1fr, без смещения колонок. */
#ordersGrid tr.sm-child-row > td { padding: 0; height: auto; border-bottom-width: 0; }
#ordersGrid tr.sm-child-row.is-open > td { border-bottom-width: 1px; }
.sm-cw { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 200ms var(--ease-out-strong, ease-out); }
tr.sm-child-row.is-open .sm-cw { grid-template-rows: 1fr; }
.sm-ci { overflow: hidden; min-height: 0; }
.sm-cp { padding: 8px 4px; line-height: 18px; }
#ordersGrid tr.sm-child-row td.photo-col .sm-cp { padding-left: 40px; }
#ordersGrid tr.sm-child-row td.article-col .sm-cp { padding-left: 12px; padding-right: 12px; overflow: hidden; text-overflow: ellipsis; }
.sm-size { font-weight: 700; color: var(--ov-ink); font-size: 13px; }
.sm-child-article { color: var(--ov-text-secondary); font-size: 13px; }
#ordersGrid tr.sm-child-row td.stock-col { font-weight: 400; }
#ordersGrid tr.sm-child-row td.trend-col .sm-cp { padding: 6px 0; }
#ordersGrid tr.sm-child-row td.trend-col { padding: 0 8px; }

@media (prefers-reduced-motion: reduce) {
    .sm-cw, .sm-expand-btn svg { transition: none; }
    .sm-stock-loading { animation: none; }
}

/* --- Плавные переходы между страницами (cross-document View Transitions) ---
   Браузер держит старую страницу, пока не готова новая, и плавно меняет
   содержимое: сайдбар стоит на месте, шапка и контент перетекают. Без
   поддержки (Firefox) — обычный переход. Перезагрузка (reload) не
   анимируется по спецификации. */
@view-transition { navigation: auto; }

/* Имена слоёв ставятся только на время перехода (класс vt-on из скрипта в
   <head> base.html) — иначе .page стала бы отдельным слоем поверх
   выпадающих панелей шапки, а модалки внутри неё — под шапкой. */
html.vt-on .sidebar { view-transition-name: sidebar; }
html.vt-on .topbar { view-transition-name: topbar; }
html.vt-on .page { view-transition-name: page; }

::view-transition-group(*) { animation-duration: .2s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(page) { animation: vt-fade-out .12s ease-in both; }
::view-transition-new(page) { animation: vt-fade-in .22s cubic-bezier(.2, .8, .2, 1) both; }
/* Сайдбар одинаковый на всех страницах — без перекрёстного мерцания. */
::view-transition-old(sidebar) { animation: none; opacity: 0; }
::view-transition-new(sidebar) { animation: none; }

@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; transform: translateY(6px); } }

/* Тонкая полоска загрузки сверху: появляется с задержкой, чтобы на быстрых
   переходах не мелькать. */
.nav-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transform-origin: 0 50%;
    transform: scaleX(0);
    background: var(--ov-ink, #111);
}
.nav-progress.is-active {
    opacity: 1;
    transition: opacity .15s ease .12s;
    animation: nav-progress-run 8s cubic-bezier(.1, .7, .2, 1) .12s forwards;
}
@keyframes nav-progress-run {
    0% { transform: scaleX(0); }
    15% { transform: scaleX(.35); }
    100% { transform: scaleX(.92); }
}

/* При выборе раздела проявляется только содержимое уже загруженной страницы. */
@media (prefers-reduced-motion: no-preference) {
    html.nav-from-section .page { animation: section-appear 220ms ease-out; }
    @keyframes section-appear { from { opacity: .86; } to { opacity: 1; } }
}

@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    .nav-progress.is-active { animation: none; transform: scaleX(.6); }
}

/* --- «Автоматизация» (automation.html) --- */
.auto-tabs a.account-tab { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.auto-tabs a.auto-tab-wip { color: var(--ov-text-secondary); }
.auto-wip-badge {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f5a623;
    color: #fff;
    flex: 0 0 auto;
}
.auto-wip-badge svg { width: 12px; height: 12px; animation: nav-wip-spin 4s linear infinite; }
.auto-tabs a.auto-tab-wip:hover .auto-wip-badge svg { animation-duration: 1.2s; }
@media (prefers-reduced-motion: reduce) { .auto-wip-badge svg { animation: none; } }
.visually-hidden-auto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.auto-note b { color: var(--ov-ink); }
.auto-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.auto-card h2, .auto-log h2, .auto-wip h2 { font-size: 17px; font-weight: 700; margin: 0; }
.auto-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auto-status { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-pill); }
.auto-status.is-on { background: var(--ov-accent); color: var(--ov-ink); }
.auto-status.is-off { background: var(--ov-icon-bg); color: var(--ov-text-secondary); }
.auto-hint { color: var(--ov-text-secondary); font-size: 14px; line-height: 1.5; margin: 10px 0 18px; }
.auto-hint b { color: var(--ov-ink); }
.auto-form { display: flex; flex-direction: column; gap: 16px; max-width: 460px; }
.auto-articles { border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 12px; margin: 0; min-width: 0; }
.auto-articles legend { font-size: 14px; font-weight: 600; padding: 0 4px; }
.auto-articles .auto-field { margin-top: 12px; }
.auto-article-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.auto-article-actions button { background: none; border: none; padding: 4px 0; color: var(--text-primary); text-decoration: underline; font: inherit; font-size: 12px; cursor: pointer; }
.auto-article-list { max-height: 280px; overflow-y: auto; margin-top: 8px; }
.auto-article-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 4px; cursor: pointer; font-size: 13px; }
.auto-article-row[hidden] { display: none; }
.auto-article-row input { margin-top: 3px; flex-shrink: 0; accent-color: var(--ov-ink); }
.auto-article-row span { min-width: 0; overflow-wrap: anywhere; }
.auto-article-row small { display: block; color: var(--ov-text-secondary); margin-top: 3px; }
.auto-articles:disabled { opacity: .65; }
.auto-field > label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.auto-field > input,
.auto-field > select {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-family: var(--font-sans), sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
}
.auto-field > input:focus,
.auto-field > select:focus { outline: none; border-color: var(--ov-accent); }
.auto-field > input#auto-pct { max-width: 120px; }
.auto-note { font-size: 12px; color: var(--ov-text-secondary); margin: 6px 0 0; line-height: 1.4; }
.auto-switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; cursor: pointer; }
.auto-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.auto-switch-track {
    width: 40px;
    height: 24px;
    border-radius: 12px;
    background: #D9D9D4;
    position: relative;
    flex: 0 0 auto;
    transition: background .18s ease;
}
.auto-switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: transform .18s ease;
}
.auto-switch input:checked + .auto-switch-track { background: var(--ov-ink); }
.auto-switch input:checked + .auto-switch-track::after { transform: translateX(16px); background: var(--ov-accent); }
.auto-switch input:focus-visible + .auto-switch-track { outline: 2px solid var(--ov-accent); outline-offset: 2px; }
.auto-switch input:disabled + .auto-switch-track { opacity: .5; }
.auto-submit {
    align-self: flex-start;
    border: none;
    background: var(--ink-900);
    color: #fff;
    font-weight: 600;
    padding: 11px 22px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-sans), sans-serif;
}
.auto-submit:hover { opacity: .85; }
.auto-stats { gap: 22px; }
.auto-log td:first-child { white-space: nowrap; }
.auto-stat { display: flex; flex-direction: column; gap: 2px; }
.auto-stat-value { font-size: 34px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.auto-stat-label { font-size: 13px; color: var(--ov-text-secondary); }
.auto-log h2 { margin-bottom: 12px; }
.auto-log-scroll { overflow-x: auto; }
.auto-log .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.auto-ok { color: var(--green-600); font-weight: 600; }
.auto-err { color: var(--red-600); font-weight: 600; cursor: help; }
.auto-wip { align-items: flex-start; gap: 10px; padding: 32px; }
.auto-wip p { color: var(--ov-text-secondary); margin: 0; }
.auto-wip-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--ov-icon-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
@media (max-width: 900px) {
    .auto-grid { grid-template-columns: 1fr; }
    .auto-stats { flex-direction: row; gap: 40px; }
}

/* Остатки WB: отдельная карточка артикула с размерным рядом. */
.wb-stock-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}
.wb-stock-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--color-border-strong);
    border-radius: 18px;
    background: var(--color-surface);
}
.wb-stock-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.wb-stock-photo {
    display: block;
    flex: 0 0 64px;
    width: 64px;
    height: 84px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--color-surface-sunken);
}
.wb-stock-photo-empty { display: grid; place-items: center; font-size: 15px; color: var(--text-muted); }
.wb-stock-product { flex: 1; min-width: 0; }
.wb-stock-product h2 {
    margin: 0 0 6px;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 650;
    overflow-wrap: anywhere;
}
.wb-stock-product p { margin: 0; font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
.wb-stock-total {
    flex: 0 0 auto;
    max-width: 42%;
    padding-left: 16px;
    border-left: 1px solid var(--color-border);
    text-align: right;
}
.wb-stock-total span { display: block; font-size: 12px; color: var(--text-secondary); }
.wb-stock-total strong { display: block; margin-top: 4px; font-size: 30px; line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; }
.wb-stock-sizes { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.wb-stock-size {
    flex: 1 0 52px;
    min-width: min-content;
    max-width: 160px;
    padding: 10px 5px;
    border-radius: 6px;
    background: var(--color-surface-sunken);
    text-align: center;
}
.wb-stock-size dt { margin: 0 0 8px; font-size: 13px; line-height: 1.3; color: var(--text-secondary); overflow-wrap: anywhere; }
.wb-stock-size dd { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wb-stock-size-zero { background: #fbecec; }
.wb-stock-size-zero dd { color: #b42318; }
.wb-stock-missing { margin: 12px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 1100px) {
    .wb-stock-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
    .wb-stock-grid { gap: 14px; }
    .wb-stock-card { padding: 14px; border-radius: 14px; }
    .wb-stock-card-header { gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
    .wb-stock-photo { flex-basis: 48px; width: 48px; height: 64px; }
    .wb-stock-product { flex-basis: calc(100% - 58px); }
    .wb-stock-product h2 { font-size: 16px; }
    .wb-stock-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; max-width: none; padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--color-border); }
    .wb-stock-total strong { margin: 0; font-size: 26px; }
    .wb-stock-size dd { font-size: 20px; }
}



.site-footer { flex-wrap: wrap; row-gap: 8px; }
.nav-more, .profit-expand { display: none; }

@media (max-width: 640px) {
    .sidebar nav:has(.nav-more) { align-items: center; }
    .sidebar nav:has(.nav-more) a.nav-tile:not(.nav-primary) { display: none; }
    .sidebar nav:has(.nav-more) a.nav-tile, .nav-more {
        width: auto; min-width: 50px; height: 46px; gap: 1px; padding: 3px;
    }
    .nav-more {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        background: transparent; color: inherit; border: 0; cursor: pointer; line-height: 1.1;
        font-family: inherit; font-size: 11px;
    }
    .nav-more > span { font-size: 14px; line-height: 18px; }
    .sidebar nav:has(.nav-more) .nav-caption { display: block; font-size: 10px; line-height: 1.05; }
    .sidebar nav .nav-label { display: none; }
    .sidebar nav.nav-expanded:has(.nav-more) {
        display: grid; grid-template-columns: repeat(3, minmax(0,1fr));
        gap: 8px; padding: 8px; max-height: 66vh; overflow-y: auto;
    }
    .sidebar nav.nav-expanded:has(.nav-more) a.nav-tile:not(.nav-primary),
    .sidebar nav.nav-expanded:has(.nav-more) a.nav-tile { display: flex; width: 100%; height: 52px; }
}

@media (max-width: 760px) {
    .profit-page .profit-expand {
        display: block; background: transparent; color: var(--text-secondary); border: 0;
        text-align: left; font: inherit; font-size: 14px; padding: 10px 4px; cursor: pointer;
    }
    .profit-expand::after { content: ' ▾'; }
    .profit-expand[aria-expanded="true"]::after { content: ' ▴'; }
    .profit-expand[aria-expanded="false"] + #profit-averages,
    .profit-expand[aria-expanded="false"] + #profit-trend { display: none; }
    .profit-page .pp-table-hint { display: none; }
    .profit-page .store-chart-toolbar { gap: 10px; }
    .profit-page .pp-alert { padding: 10px 12px; }
    .profit-page .store-chart-toolbar-row { flex-wrap: wrap; gap: 8px; }

}

@media (max-width: 760px) {
    .profit-page .daterange-download-btn { color: var(--text-primary); background: var(--surface); border: 1px solid var(--border); }
    .profit-page .store-chart-toolbar-row > .daterange:first-child { order: 1; }
}

@media (max-width: 760px) {
    .profit-page .pp-table-head { padding: 14px; gap: 9px; }
    .profit-page .pp-table-head h3 { font-size: 19px; }
    .profit-page .store-chart-toolbar-row .daterange-download-btn { width: 42px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
    .profit-page .store-chart-toolbar-row { align-items: center; gap: 5px; }
    .profit-page .store-chart-toolbar-row .daterange-trigger { min-width: 0; padding-inline: 9px; font-size: 13px; }
    .profit-page .pp-table-card .table-scroll { padding: 8px; }
    .profit-page #profitTable { min-width: 0; }
    .profit-page #profitTable > tbody > tr.funnel-row {
        grid-template-columns: repeat(2,minmax(0,1fr)); position: relative; gap: 0; padding: 4px;
    }
    .profit-page #profitTable > tbody > tr.funnel-row > td { padding: 9px; }
    .profit-page #profitTable > tbody > tr.funnel-row > td.product-col {
        grid-column: span 2; padding: 8px 40px 8px 9px; gap: 8px;
    }
    .profit-page #profitTable .thumb { width: 32px; height: 32px; }
    .profit-page #profitTable > tbody > tr.funnel-row > td.arrow-col {
        position: absolute; right: 0; top: 0; padding: 6px;
    }
    .profit-page #profitTable > tbody > tr.funnel-row:not(.is-expanded) > td:not(.product-col,.arrow-col,.cost-cell,.cost-group,.profit-cell) { display: none; }
    .profit-page #profitTable .profit-cell { grid-column: 2; grid-row: 2; border-radius: 8px; }
    .profit-page #profitTable > tbody > tr.detail-row > td { min-width: 0; width: 100%; }
}

.brand-name { display: none; }
@media (min-width: 641px) {
    .sidebar:not(.sidebar-guest) { padding: 0; gap: 0; }
    .sidebar:not(.sidebar-guest) .brand { width: 62px; height: 72px; margin: 0; transform: none; flex-direction: column; gap: 1px; }
    .sidebar:not(.sidebar-guest) .brand .nav-icon-wrap { width: 34px; height: 34px; background: transparent; border: 0; }
    .sidebar:not(.sidebar-guest) .brand .brand-mark { width: 34px; height: 34px; }
    .sidebar:not(.sidebar-guest) .brand-name { display: block; font-size: 16px; line-height: 19px; font-weight: 800; letter-spacing: -.8px; color: #242824; }
    .sidebar:not(.sidebar-guest) .brand .nav-label { display: none; }
    .sidebar:not(.sidebar-guest) nav:has(.nav-group) { flex: 0 0 auto; align-items: center; gap: 3px; margin: 17px 0 0; padding: 8px; background: #fff; border: 1px solid #e4e7df; border-radius: 30px; box-shadow: 0 10px 25px #22220c0a; }
    .sidebar .nav-group { display: flex; flex-direction: column; align-items: center; gap: 3px; }
    .sidebar .nav-group + .nav-group::before { content: ''; width: 25px; height: 1px; background: #e4e9df; margin: 5px 0; }
    .sidebar nav .nav-group a.nav-tile { width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #6f756e; }
    .sidebar nav .nav-group a.nav-tile .nav-icon { width: 18px; height: 18px; }
    .sidebar nav .nav-group a.nav-tile:hover { background: #f0f3eb; color: #20251f; }
    .sidebar nav .nav-group a.nav-tile.active { background: #b9ff20; color: #1e2715; }
    .sidebar nav .nav-group .nav-caption { display: none; }
    .sidebar nav .nav-group .nav-label { left: calc(100% + 15px); margin: 0; padding: 8px 11px; border-radius: 9px; font-size: 12px; font-weight: 500; background: #252a24; transform: translateY(-50%) translateX(-4px); }
    .sidebar nav .nav-group a:hover .nav-label, .sidebar nav .nav-group a:focus-visible .nav-label { transform: translateY(-50%); }
}
@media (min-width: 641px) and (max-height: 760px) {
    .sidebar:not(.sidebar-guest) nav:has(.nav-group) { gap: 1px; padding: 6px; }
    .sidebar .nav-group { gap: 1px; }
    .sidebar .nav-group + .nav-group::before { margin: 3px 0; }
    .sidebar nav .nav-group a.nav-tile { width: 34px; height: 34px; min-height: 34px; }
}
@media (min-width: 641px) and (max-height: 520px) {
    .sidebar:not(.sidebar-guest) nav:has(.nav-group) { overflow-y: auto; max-height: calc(100vh - 112px); }
}
@media (max-width: 640px) {
    .sidebar:not(.sidebar-guest) nav:has(.nav-group) { justify-content: flex-start; gap: 0; overflow-x: auto; overflow-y: hidden; margin: 0; padding: 4px; background: #fff; border: 1px solid #e4e7df; border-radius: 24px; scrollbar-width: none; }
    .sidebar nav::-webkit-scrollbar { display: none; }
    .sidebar .nav-group { display: contents; }
    .sidebar nav .nav-group a.nav-tile { flex: 0 0 40px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; }
    .sidebar nav .nav-group a.nav-tile.active { background: #b9ff20; }
    .sidebar nav .nav-group .nav-label { display: none; }
}
@media (max-width: 640px) { .sidebar:not(.sidebar-guest) nav:has(.nav-group) a.nav-tile:not(.nav-primary) { display: flex; } .sidebar nav .nav-more { display: none; } }
