/* B2B K.SPACE — новый интерфейс (FRONTEND_UI=new). Mobile-first, без сборщиков.
   Правила стиля — docs/DESIGN.md (основа — Wise, в цветах K.SPACE). */

@font-face {
    font-family: "Inter Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(fonts/inter-cyrillic.woff2) format("woff2-variations"), url(fonts/inter-cyrillic.woff2) format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Inter Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(fonts/inter-latin.woff2) format("woff2-variations"), url(fonts/inter-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 {
    --brand: #d40000;
    --brand-dark: #b00000;
    --brand-pale: #fdeaea;
    --ink: #171717;
    --ink-2: #4a4a47;
    --ink-3: #86857f;
    --line: #e2e1dd;
    --line-strong: #c8c7c1;
    --bg: #eeeeeb;      /* серые заливки: переключатели, мягкие кнопки, фон выдвижных панелей */
    --page: #ffffff;    /* фон страницы */
    --card: #ffffff;
    --head: #262626;
    --ok: #1f8a3d;
    --ok-deep: #0d5c27;
    --ok-bg: #e4f3e7;
    --warn: #5c4400;
    --warn-bg: #fff4d1;
    --err: #9e1620;
    --err-bg: #fbe8e8;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;
    --r-pill: 9999px;
    --radius: var(--r-lg);
    --radius-sm: var(--r-sm);
    --shadow-float: 0 8px 32px rgba(23, 23, 23, .18);
    --focus: 0 0 0 2px var(--card), 0 0 0 4px var(--ink);
    --nav-h: 64px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --font: "Inter Variable", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.ui {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font: 15px/1.45 var(--font);
    font-feature-settings: "cv11", "calt";
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(var(--nav-h) + var(--safe-b));
    overflow-wrap: anywhere;
}

body.ui.no-nav { padding-bottom: 0; }
body.ui.sheet-open { overflow: hidden; }

.ui a { color: inherit; }
.ui img { max-width: 100%; }
.ui h1, .ui h2, .ui h3 { margin: 0; line-height: 1.2; }
:where(.ui) :where(button, input, select, textarea) { font: inherit; color: inherit; } /* :where — нулевая специфичность, классы кнопок не перебиваются */
.ui [hidden] { display: none !important; }
.ui :focus-visible { outline: none; box-shadow: var(--focus); }

.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 18px; height: 18px; }

/* Моноширинные цифры для денег, остатков, количеств */
.num, .price, .stock, .stepper input, .cart-totals, .cart-line__sum, .fin-card, .kv dd, .result__numbers, .badge, .pager__info {
    font-variant-numeric: tabular-nums;
}
.num { text-align: right; white-space: nowrap; }

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

.app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--head);
    color: #fff;
    padding: 8px 16px 12px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
}

.app-header__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-height: 44px; }
.app-header__logo { display: block; flex: none; line-height: 0; color: #fff; }
.app-header__logo .logo { display: block; width: 176px; height: 17px; } /* логотип K.SPACE — inline SVG (layouts/_logo.php), размер как у прежнего растра */
.app-header__spacer { flex: 1; }

.header-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-width: 44px; height: 44px; padding: 0 12px;
    border: 0; border-radius: var(--r-pill);
    background: transparent; color: #fff; text-decoration: none; cursor: pointer;
    font-weight: 500;
    flex: none; white-space: nowrap; /* кнопки шапки не сжимаются и не переносят текст — ужимается только поиск */
}
.header-btn:hover { background: rgba(255, 255, 255, .1); }
.header-btn .badge { position: static; }
.header-cart__icon, .header-icon-badge { position: relative; display: inline-flex; }
.header-btn .header-cart__icon .badge, .header-btn .header-icon-badge .badge { position: absolute; top: -7px; right: -10px; box-shadow: 0 0 0 2px var(--head); }

.search {
    order: 10; flex: 1 0 100%;
    display: flex; align-items: center;
    background: #fff; border-radius: var(--r-pill); overflow: hidden;
    padding-left: 6px;
}
.search input {
    flex: 1; min-width: 0; height: 44px; padding: 0 12px;
    border: 0; outline: none; background: transparent; color: var(--ink);
    font-size: 16px; /* без автозума на iOS */
}
.search input::placeholder { color: var(--ink-3); }
.search button {
    width: 48px; height: 44px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.search:focus-within { box-shadow: 0 0 0 2px var(--brand); }
.ui .search input:focus-visible { box-shadow: none; } /* фокус — красное кольцо всей плашки, без второй рамки на поле */
/* очистка поля: вместо синего крестика браузера — серый, в цвет подсказки */
.search input::-webkit-search-cancel-button {
    -webkit-appearance: none; appearance: none; width: 16px; height: 16px; cursor: pointer;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4l8 8M12 4l-8 8' stroke='%2386857f' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}
/* подсказки моделей под поиском (Підбір за пристроєм) */
.search[data-device-suggest] { position: relative; overflow: visible; }
.search-suggest {
    position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0;
    padding: 6px; border-radius: var(--r-lg); background: var(--card); box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.ui .search-suggest a {
    display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px;
    color: var(--ink); font-size: 14.5px; text-decoration: none;
}
.ui .search-suggest a:hover, .ui .search-suggest a.is-active { background: var(--bg); }
.search-suggest__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-suggest__count { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.header-cart, .header-cabinet, .header-favorite { display: none; }

/* курс USD+ и менеджер в шапке; на телефоне — в первой строке справа от логотипа */
.header-rate { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; white-space: nowrap; font-variant-numeric: tabular-nums; }
.header-rate__label { font-size: 11px; font-weight: 700; letter-spacing: .03em; color: rgba(255, 255, 255, .85); }
.header-rate b { font-size: 14px; }
.header-manager { position: relative; }
.header-manager__text { display: none; flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.header-manager__text small { font-size: 10px; font-weight: 600; letter-spacing: .02em; color: rgba(255, 255, 255, .6); }
.header-manager__text b { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.popover {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; min-width: 260px; max-width: calc(100vw - 32px);
    padding: 14px 8px 8px; border-radius: var(--r-lg); background: #fff; color: var(--ink); box-shadow: var(--shadow-float);
    animation: busy-fade .12s ease-out;
}
.popover__title { padding: 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.popover__name { padding: 2px 10px 8px; font-weight: 700; }
.ui .popover__row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: var(--r-md); color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; }
.ui .popover__row:hover { background: var(--bg); }
.popover__row .icon { width: 18px; height: 18px; color: var(--ink-3); }
.header-cart__sum { display: flex; flex-direction: column; font-size: 12px; font-weight: 600; line-height: 1.2; text-align: left; font-variant-numeric: tabular-nums; }
.header-cart__sum:empty, .header-cart__sum span:empty { display: none; }
.header-cart__sum { margin-left: 12px; } /* место под счётчик, выступающий из угла иконки */
.header-cart__sum [data-cart-usd] { font-size: 13px; font-weight: 700; }
.header-cart__sum [data-cart-uah] { color: rgba(255, 255, 255, .72); }
.header-cart__cur { margin-right: 1px; color: #ff4d4d; font-weight: 800; text-shadow: 0 0 8px rgba(255, 77, 77, .55); }
.header-desktop-nav { display: none; }

.badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: var(--r-pill); background: var(--brand); color: #fff;
    font-size: 11px; font-weight: 700; line-height: 1;
}
.badge:empty, .badge[data-count="0"] { display: none; }

.pill-ok, .pill-muted {
    display: inline-flex; align-items: center; gap: 4px;
    height: 22px; padding: 0 10px; border-radius: var(--r-pill);
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill-ok { background: var(--ok-bg); color: var(--ok-deep); }
.pill-muted { background: var(--bg); color: var(--ink-2); }

/* ---------- Нижняя навигация ---------- */

.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex;
    height: calc(var(--nav-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: #fff; border-top: 1px solid var(--line);
}
.ui .bottom-nav__item {
    position: relative; flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: transparent; color: var(--ink-3);
    font-size: 11px; font-weight: 500; text-decoration: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.ui .bottom-nav__item.is-active { color: var(--ink); font-weight: 700; }
.bottom-nav__item.is-active::before {
    content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 3px; margin-left: -14px;
    border-radius: 0 0 3px 3px; background: var(--brand);
}
.bottom-nav__item .badge { position: absolute; top: 7px; left: 50%; margin-left: 6px; }

/* ---------- Каркас страницы ---------- */

.page { max-width: 1280px; margin: 0 auto; padding: 16px 16px 28px; }
.page--wide { max-width: 1920px; } /* главная — той же ширины, что каталог */

/* белый фон страницы: белые карточки отделяются тонкой рамкой (в выдвижных панелях фон серый — там без рамки) */
.page :is(.card, .p-card, .products.is-compact, .empty-state, .menu, .news-card, .row-card, .table,
    .pd-buy, .props, .description, .cart-line, .tile, .fin-card, .news-item, .result, .banner),
.login__box, .sheet--inline .sheet__panel { box-shadow: inset 0 0 0 1px var(--line); }
.page .products.is-compact .p-card { box-shadow: none; }
.page__title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 4px 0 14px; }
.page__sub { color: var(--ink-2); font-size: 13px; margin: 6px 0 14px; }

.layout-main { min-width: 0; }
.layout-side { display: none; }

.card {
    background: var(--card); border-radius: var(--r-lg);
    padding: 16px;
}
.card + .card, .section + .section { margin-top: 12px; }
.section__title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; margin: 24px 0 12px; }
/* секции главной: иначе общее .ui h2 { margin: 0 } снимает отступы и заголовок прилипает к блоку выше */
.ui h2.section__title { margin: 28px 0 12px; }

.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.red { color: var(--brand); }

/* ---------- Кнопки, поля ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 0 22px;
    border: 1px solid transparent; border-radius: var(--r-pill);
    background: var(--brand); color: #fff;
    font-size: 15px; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .15s, transform .1s;
}
.ui .btn { color: #fff; }
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn.is-loading { opacity: .55; cursor: default; transform: none; }
.btn--block { display: flex; width: 100%; }
.ui .btn--ghost { background: var(--card); color: var(--ink); border-color: var(--ink); }
.btn--ghost:hover { background: var(--bg); }
.ui .btn--soft { background: var(--bg); color: var(--ink); }
.btn--soft:hover { background: var(--line); }
.btn--dark { background: var(--head); }
.btn--dark:hover { background: #000; }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 14px; }

.field { display: block; margin-bottom: 16px; }
.field__label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field__label sup { color: var(--brand); }
.input, .select, .textarea {
    display: block; width: 100%; min-height: 48px; padding: 10px 14px;
    border: 1px solid var(--line-strong); border-radius: var(--r-md); background: #fff;
    font-size: 16px; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.input.is-invalid { border-color: var(--err); box-shadow: 0 0 0 1px var(--err); background: var(--err-bg); }

.alert { padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; margin-bottom: 12px; border-left: 4px solid transparent; }
.alert--error { background: var(--err-bg); color: var(--err); border-left-color: var(--err); font-weight: 500; }
.alert--warn { background: var(--warn-bg); color: var(--warn); border-left-color: #f2b705; }
.alert--ok { background: var(--ok-bg); color: var(--ok-deep); border-left-color: var(--ok); }
/* «Обмін з 1С» (кабинет, только для CATALOG_SYNC_ADMINS) */
.sync-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-bottom: 8px; }
.sync-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--card); }
.sync-card__label { color: var(--ink-3); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.sync-card b { font-size: 20px; }
.sync-ok { color: var(--ok-deep); }
.sync-bad { color: var(--err); }
.sync .table-wrap { overflow-x: auto; }
.sync-log tr.is-bad td { background: var(--err-bg); }
.sync-errors td { padding-top: 0; border-top: 0; font-size: 13px; }
.sync-errors ul { margin: 6px 0 0; padding-left: 18px; }
.sync-errors summary { cursor: pointer; color: var(--err); font-weight: 600; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: none; display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px; border-radius: var(--r-pill);
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .badge { background: var(--ink-3); }
.chip.is-active .badge { background: #fff; color: var(--ink); }
/* все чипы видны сразу (страница ярлыка: категорий может быть десятки) */
.chips--wrap { flex-wrap: wrap; overflow: visible; }

/* ---------- Каталог: панель инструментов ---------- */

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .select { min-height: 40px; height: 40px; padding: 0 12px; font-size: 14px; width: auto; flex: 1; min-width: 0; border-radius: var(--r-pill); border-color: var(--line); }
.toolbar .btn { min-height: 40px; }
.ui .toolbar .btn--ghost { border-color: var(--line); }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.view-toggle { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--bg); }
.ui .view-toggle__btn { width: 36px; height: 30px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ui .view-toggle__btn.is-active { background: var(--ink); color: #fff; }

/* ---------- Карточка товара в списке ---------- */

.products { display: grid; gap: 8px; }

.p-card {
    display: grid;
    grid-template-columns: 76px 1fr;
    grid-template-areas: "img info" "buy buy";
    gap: 10px 12px;
    background: var(--card); border-radius: var(--r-lg);
    padding: 12px;
    box-shadow: inset 0 0 0 2px transparent;
    transition: box-shadow .15s;
}
.p-card.in-cart { box-shadow: inset 0 0 0 2px var(--ok); }

.p-card__img-wrap { grid-area: img; position: relative; width: 76px; height: 76px; }
.p-card__img {
    width: 100%; height: 100%; border-radius: var(--r-md);
    background: #fff; border: 1px solid var(--line); overflow: hidden;
    display: flex; align-items: center; justify-content: center; padding: 2px; cursor: pointer;
}
.p-card__img img { width: 100%; height: 100%; object-fit: contain; }
.p-card__fav {
    position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%;
    border: 1px solid var(--line); background: #fff; color: var(--ink-3);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12); -webkit-tap-highlight-color: transparent;
}
.p-card__fav .icon { width: 15px; height: 15px; }
.p-card__fav.is-active { color: #e0294b; border-color: #f6c3cd; }
.p-card__fav.is-active .icon { fill: currentColor; }
.p-card__info { grid-area: info; min-width: 0; }
.p-card__name {
    display: block; padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
    font-weight: 600; font-size: 15px; line-height: 1.3; color: var(--ink);
}
.p-card__name:hover { text-decoration: underline; }
.p-card__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 12px; color: var(--ink-3); }
/* клікабельний код товару — копіювання в буфер (app.js, [data-copy]) */
.copyable { cursor: pointer; border-bottom: 1px dotted currentColor; }
.copyable:hover, .copyable:active { color: var(--ink); }
/* підтвердження — галочка поруч із кодом, зникає сама (замість тоста на весь екран) */
.copyable.is-copied { color: var(--ok-deep); border-bottom-color: transparent; }
.copyable.is-copied::after { content: " ✓"; font-weight: 700; }
.p-card__labels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.label { display: inline-block; padding: 2px 9px; border-radius: var(--r-pill); background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .01em; }

.p-card__buy {
    grid-area: buy;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding-top: 10px; border-top: 1px solid var(--line);
}
.p-card__extra { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-2); margin-top: 6px; }

/* Вид «Список»: без фото, товар в одну строку (как корзина) */
.products.is-compact { gap: 0; background: var(--card); border-radius: var(--r-lg); overflow: hidden; }
.products.is-compact .p-card {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info buy";
    align-items: center; gap: 0 10px; padding: 10px 10px 10px 12px; border-radius: 0;
}
.products.is-compact .p-card + .p-card { border-top: 1px solid var(--line); }
.products.is-compact .p-card.in-cart { box-shadow: inset 3px 0 0 var(--ok); }
.products.is-compact .p-card__img-wrap, .products.is-compact .p-card__labels { display: none; }
.products.is-compact .p-card__name { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.products.is-compact .p-card__meta { margin-top: 2px; font-size: 11px; }
.products.is-compact .p-card__extra { margin-top: 2px; font-size: 11px; gap: 2px 10px; }
.products.is-compact .p-card__buy { flex-direction: column; align-items: flex-end; gap: 6px; padding: 0; border: 0; }
.products.is-compact .price { align-items: flex-end; text-align: right; }
.products.is-compact .price__main { font-size: 15px; }
.products.is-compact .stepper button { width: 30px; height: 30px; font-size: 18px; }
.products.is-compact .stepper input { width: 34px; height: 30px; font-size: 15px; }

.price { display: flex; flex-direction: column; line-height: 1.15; }
.price__main { font-size: 18px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.price__main.is-promo { color: var(--brand); }
.price__main.is-highlight { background: #fff3a8; border-radius: 6px; padding: 0 5px; margin-left: -5px; }
.price__old { font-size: 12px; color: var(--ink-3); text-decoration: line-through; white-space: nowrap; }
.price__hint { font-size: 11px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.price__none { color: var(--ink-3); }

.stock { display: inline-flex; gap: 10px; font-size: 12px; color: var(--ink-2); }
.stock b { color: var(--ok-deep); font-weight: 700; }
.stock .is-zero b { color: var(--ink-3); font-weight: 400; }

/* ---------- Степпер количества ---------- */

.stepper {
    display: inline-flex; align-items: center; flex: none;
    border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: #fff; overflow: hidden;
    transition: background-color .15s, border-color .15s;
}
.stepper button {
    width: 44px; height: 42px; border: 0; background: transparent; cursor: pointer;
    font-size: 20px; font-weight: 500; line-height: 1; color: var(--ink);
    -webkit-tap-highlight-color: transparent;
}
.stepper button:active { background: var(--bg); }
.stepper input {
    width: 46px; height: 42px; border: 0;
    text-align: center; font-size: 16px; font-weight: 700; outline: none; background: transparent;
    -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.is-saving { opacity: .6; }
.stepper.is-active { border-color: var(--ok); background: var(--ok-bg); }
.stepper.is-active input { color: var(--ok-deep); }

/* ---------- Пагинация ---------- */

.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 0 4px; }
.pager__info { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.pager .btn { min-height: 44px; }
.pager .btn[aria-disabled="true"] { visibility: hidden; }

.empty-state { text-align: center; padding: 40px 16px; color: var(--ink-2); background: var(--card); border-radius: var(--r-lg); }
.empty-state .icon { width: 48px; height: 48px; color: var(--ink-3); margin-bottom: 8px; }

/* ---------- Нижний лист (sheet) ---------- */

.sheet { position: fixed; inset: 0; z-index: 60; display: none; }
.sheet.is-open { display: block; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(23, 23, 23, .5); }
.sheet__panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column;
    max-height: 92vh; max-height: 92dvh;
    background: var(--bg); border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding-bottom: var(--safe-b);
    box-shadow: var(--shadow-float);
    animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1);
}
.sheet--full .sheet__panel { height: 92vh; height: 92dvh; }
@keyframes sheet-up { from { transform: translateY(32px); opacity: .5; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet__panel { animation: none; } }

.sheet__head {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    padding: 18px 8px 10px 20px; background: #fff; border-radius: var(--r-xl) var(--r-xl) 0 0; border-bottom: 1px solid var(--line);
}
.sheet__head::before { /* «ручка» листа */
    content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px;
    border-radius: 2px; background: var(--line-strong);
}
.sheet__title { flex: 1; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.sheet__close {
    width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--bg); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
}
.sheet__body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 16px; }
.sheet__foot { background: #fff; border-top: 1px solid var(--line); padding: 12px 16px; }

/* Збільшене зображення товару: картинка на весь екран, без «шапки» листа */
.sheet--image .sheet__backdrop { background: rgba(23, 23, 23, .88); }
/* width/transform — скидання десктопного правила .sheet__panel (min(720px,94vw) + translate(-50%,-50%)) */
.sheet--image .sheet__panel {
    top: 16px; right: 16px; bottom: 16px; left: 16px;
    width: auto; height: auto; max-height: none; transform: none; padding-bottom: 0;
    align-items: center; justify-content: center;
    background: transparent; box-shadow: none; border-radius: 0; overflow: visible;
}
.sheet--image img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--r-md); cursor: zoom-out; }
.sheet--image .sheet__close { position: absolute; top: 0; right: 0; background: #fff; }
.ui .sheet--image .gallery-nav { width: 44px; height: 44px; }
.sheet--image .gallery-nav--prev { left: 0; }
.sheet--image .gallery-nav--next { right: 0; }
.zoom-count {
    position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 1;
    padding: 4px 12px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .92); color: var(--ink);
    font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none;
}

.loader { display: flex; justify-content: center; padding: 32px 0; }
.loader::after {
    content: ""; width: 28px; height: 28px; border-radius: 50%;
    border: 3px solid var(--line); border-top-color: var(--brand);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Мега-меню каталога (лист «Каталог»): телефон — плитки с переходом вглубь, десктоп — панель под шапкой ---------- */

.mega { position: relative; }
.mega__roots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mega__root {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
    min-height: 100px; padding: 12px 6px 10px; border-radius: var(--r-lg); background: #fff;
    color: var(--ink); text-decoration: none; text-align: center; font-size: 12.5px; font-weight: 600; line-height: 1.25;
}
.mega__root:active { background: #f5f5f2; }
.mega__root.is-current { box-shadow: inset 0 0 0 2px var(--brand); }
/* иконки категорий в 1С — миниатюры 25×25: выводятся ровно 25px (любое масштабирование размывает); поля сохраняют высоту плитки */
.mega__icon { width: 25px; height: 25px; margin: 7px 0 8px; object-fit: contain; flex: none; }
.mega__noimg { display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-md); background: var(--bg); color: var(--ink-3); }
.mega__icon.mega__noimg { width: 40px; height: 40px; margin: 0; } /* векторная иконка вместо картинки — не размывается, прежний размер */
.mega__name { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.mega__chev { position: absolute; top: 6px; right: 9px; color: var(--ink-3); font-size: 18px; line-height: 1; }

/* панели подкатегорий: на телефоне — второй экран поверх плиток */
.mega__pane { display: none; }
.mega.is-drill .mega__roots { display: none; }
.mega.is-drill .mega__pane.is-active { display: block; animation: mega-in .18s ease-out; }
@keyframes mega-in { from { opacity: 0; transform: translateX(16px); } }
@media (prefers-reduced-motion: reduce) { .mega.is-drill .mega__pane.is-active { animation: none; } }
.mega__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 12px; }
.mega__back {
    width: 40px; height: 40px; border: 0; border-radius: 50%; background: #fff; color: var(--ink); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.mega__title { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.ui .mega__all {
    flex: 1 0 100%; display: flex; align-items: center; justify-content: center; height: 44px; border-radius: var(--r-pill);
    background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; text-decoration: none;
}
.mega__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.mega__tile { display: flex; flex-direction: column; border-radius: var(--r-lg); background: #fff; overflow: hidden; }
.mega__tile.is-current { box-shadow: inset 0 0 0 2px var(--brand); }
.mega__tile-link {
    display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 12px;
    color: var(--ink); text-decoration: none; font-size: 13.5px; font-weight: 600; line-height: 1.25;
}
.mega__tile-link:hover .mega__tile-name { color: var(--brand); }
.mega__pic { width: 40px; height: 40px; object-fit: contain; flex: none; }
.mega__sub { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 12px 62px; }
.ui .mega__sub a { padding: 3px 10px; border-radius: var(--r-pill); background: var(--bg); color: var(--ink-2); font-size: 12px; text-decoration: none; }
.ui .mega__sub a:hover, .ui .mega__sub a.is-current { background: var(--brand-pale); color: var(--brand-dark); }
.mega__single {
    display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 16px; border-radius: var(--r-lg);
    background: #fff; color: var(--ink); text-decoration: none; text-align: center; font-weight: 600;
}
.mega__single .mega__pic { width: 40px; height: 40px; }
.megamap { display: none; }
/* ярлыки (ХІТ, Sale…) над каталогом — цвета из 1С, как бейдж на карточке товара */
/* телефон: низ панели (.mega-foot) поднимается над плитками, подпись и прайс там не нужны (прайс есть среди плиток) */
.sheet--mega .sheet__body { display: flex; flex-direction: column; }
.sheet--mega .sheet__body > * { flex: none; }
.mega-foot { order: -1; }
.mega-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.mega-labels__title, .mega-foot__price { display: none; }
.ui .mega-label {
    display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 14px; border-radius: var(--r-pill);
    background: var(--label-bg, var(--brand)); color: var(--label-color, #fff);
    font-size: 13.5px; font-weight: 700; text-decoration: none; white-space: nowrap; transition: filter .15s;
}
.ui .mega-label:hover { filter: brightness(.92); }
.ui .mega-label.is-current { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--label-bg, var(--brand)); }
.mega-label__count { min-width: 22px; padding: 2px 7px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .25); font-size: 12px; text-align: center; }
/* За пристроєм в каталоге (телефон): плитки брендов после категорий, бренд — второй экран со списком моделей */
.mega__roots-title { margin: 18px 0 8px; color: var(--ink-3); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.mega.is-drill .mega__roots-title { display: none; }
.mega__root--device { min-height: 64px; justify-content: center; font-size: 14px; }
.mega__models { color: var(--ink-3); font-size: 11.5px; font-weight: 500; }
.mega__device-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ui .mega__device-list a {
    display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border-radius: var(--r-md); background: #fff;
    color: var(--ink); font-size: 13.5px; font-weight: 600; line-height: 1.25; text-decoration: none;
}
.mega__device-list a > span:first-child { flex: 1; min-width: 0; }
/* За пристроєм слева под категориями (компьютер) */
.side-devices { margin-top: 16px; }
.ui .side-devices__title { display: block; margin: 0 4px 8px; color: var(--ink-3); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-decoration: none; }
.ui .side-devices__title:hover { color: var(--brand); }
.side-devices .is-current > a { color: var(--brand); font-weight: 600; }
.ui .side-devices__all { color: var(--brand); font-size: 13px; font-weight: 600; }

/* ---------- Підбір за пристроєм ---------- */
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ui .section__link { color: var(--brand); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
/* главная: популярные пристрої одной строкой (телефон — прокрутка, компьютер — сколько влезает) */
.home-devices { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.home-devices::-webkit-scrollbar { display: none; }
.ui .home-device {
    flex: 0 0 132px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px 12px;
    border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); color: var(--ink);
    text-align: center; text-decoration: none; transition: box-shadow .15s;
}
.ui .home-device:hover { box-shadow: 0 0 0 2px var(--brand); }
.home-device__pic { display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; margin-bottom: 6px; color: var(--ink-3); }
.home-device__pic img { max-width: 100%; max-height: 100%; object-fit: contain; }
.home-device__brand { color: var(--ink-3); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.home-device__name {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.5em; font-size: 13.5px; font-weight: 700; line-height: 1.25;
}
.home-device__count { color: var(--ink-3); font-size: 12px; }
/* страница «Підбір за пристроєм»: те же плитки сеткой (на телефоне — по 2–3 в ряд) */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.device-grid .home-device { min-width: 0; }
.device-grid .home-device[hidden] { display: none; }
.device-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; min-width: 0; }
.device-search { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: var(--r-pill); background: var(--card); color: var(--ink-3); }
.device-search .input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; padding: 0; font-size: 16px; outline: none; }
.device-search:focus-within { box-shadow: 0 0 0 2px var(--brand); }
.device-brand { scroll-margin-top: 90px; }
.device-crumbs { display: flex; gap: 6px; color: var(--ink-3); font-size: 13px; }
.ui .device-crumbs a { color: var(--ink-2); text-decoration: none; }
.ui .device-crumbs a:hover { color: var(--brand); }
.device-go { margin: 0 0 12px; }
.device-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r-lg); background: var(--card); }
.device-hint__title { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.pd-devices { display: flex; flex-wrap: wrap; gap: 4px; }
.ui .pd-device { padding: 2px 9px; border-radius: var(--r-pill); background: var(--bg); color: var(--ink); font-size: 12.5px; text-decoration: none; }
.ui a.pd-device { color: var(--brand); font-weight: 600; }
.ui a.pd-device:hover { background: var(--brand); color: #fff; }

/* ---------- Меню / списки ссылок ---------- */

.menu { list-style: none; margin: 0; padding: 0; background: #fff; border-radius: var(--r-lg); overflow: hidden; }
.menu li + li { border-top: 1px solid var(--line); }
.menu a, .menu summary {
    display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px;
    font-weight: 500; text-decoration: none; cursor: pointer; list-style: none;
}
.menu a:hover, .menu summary:hover { background: #fafaf8; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: "›"; margin-left: auto; color: var(--ink-3); font-size: 20px; transition: transform .15s; }
.menu details[open] > summary::after { transform: rotate(90deg); }
.menu details .menu { border-radius: 0; background: #fafaf8; }
.menu details .menu a { padding-left: 28px; font-weight: 400; }
.menu details .menu details .menu a { padding-left: 40px; }
.menu .is-current > a, .menu .is-current > details > summary { color: var(--brand); font-weight: 700; box-shadow: inset 3px 0 0 var(--brand); }
.menu .cat-icon { width: 25px; height: 25px; object-fit: contain; flex: none; }
.menu__note { margin-left: auto; color: var(--ink-3); font-size: 13px; }

.ui .menu-title { margin: 20px 4px 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.ui .sheet .menu-title { margin-top: 16px; }

/* ---------- Кабинет: списки, статусы, разворачиваемые карточки ---------- */

.pill-warn, .pill-err, .pill-dark {
    display: inline-flex; align-items: center; gap: 4px;
    height: 22px; padding: 0 10px; border-radius: var(--r-pill);
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-err { background: var(--err-bg); color: var(--err); }
.pill-dark { background: var(--ink); color: #fff; }

.narrow { max-width: 560px; }
.icon-xs { width: 14px; height: 14px; }
.page--banner { padding-bottom: 0; }
.banner-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; }
.banner-alert span { flex: 1 1 200px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--ink-2); font-weight: 600; text-decoration: none; }
.article { padding: 20px; }
.article .page__title { margin: 4px 0 16px; }
.rte { font-size: 15px; line-height: 1.6; }
.rte img { max-width: 100%; height: auto; border-radius: var(--r-md); }
.rte a { color: var(--brand); }
.news-grid { display: grid; gap: 10px; }
.news-card { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 10px; background: var(--card); border-radius: var(--r-lg); text-decoration: none; color: var(--ink); }
.news-card img { width: 112px; height: 84px; object-fit: cover; border-radius: var(--r-md); background: var(--bg); }
.news-card--noimg { grid-template-columns: 1fr; }
.news-card__title { font-weight: 700; line-height: 1.3; }
.news-card__text { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.narrow-lg { max-width: 720px; }
.narrow-xl { max-width: 880px; margin: 0 auto; }
.segmented { display: flex; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: var(--r-pill); background: var(--bg); }
.ui .segmented__item {
    flex: 1; min-height: 40px; padding: 4px 12px; border: 0; border-radius: var(--r-pill); font-size: 14px; line-height: 1.2;
    background: transparent; color: var(--ink-2); font-weight: 600; cursor: pointer;
}
.ui .segmented__item.is-active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(23, 23, 23, .12); }
.found { margin: 4px 0 16px; padding: 14px; border-radius: var(--r-md); background: var(--ok-bg); }
.found .kv dt { color: var(--ok-deep); }
.row-card__product { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.input--filter { min-height: 40px; margin-bottom: 8px; border-radius: var(--r-pill); font-size: 15px; }
.toolbar--wrap { flex-wrap: wrap; }
.toolbar .input--sm, .input--sm { min-height: 40px; height: 40px; border-radius: var(--r-pill); border-color: var(--line); font-size: 15px; flex: 1 1 220px; }
.ui .small-title { font-size: 14px; margin: 0 0 4px; }
.fin-form { margin-top: 16px; }
.fin-row { border: 0; margin: 0 0 12px; padding: 14px; border-radius: var(--r-md); background: #f6f6f4; }
.fin-row__title { float: left; width: 100%; padding: 0; margin-bottom: 4px; font-weight: 700; font-size: 14px; }
.fin-row__title + * { clear: both; }
.toolbar--wrap .select { flex: 1 1 180px; }
.fin-row__checks { display: flex; flex-wrap: wrap; gap: 0 18px; margin-bottom: 6px; }
.fin-row .field { margin-bottom: 6px; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.input-row .btn { min-height: 48px; flex: none; }
.check--sm { min-height: 32px; font-size: 13px; color: var(--ink-2); }
.form-grid { display: grid; gap: 0 12px; }
.dl-org-toggle, .dl-org { grid-column: 1 / -1; }
.dl-org { display: grid; gap: 0 12px; padding: 12px 12px 0; margin-bottom: 12px; border-radius: var(--r-sm); background: var(--bg); }
.dl-org__name { grid-column: 1 / -1; }
.dl-org-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--brand-pale); color: var(--brand-dark); font-size: 12px; font-weight: 700; vertical-align: 1px; }
@media (min-width: 768px) { .dl-org { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.card__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.contact-card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.contact-card__who { flex: 1; min-width: 0; }
.avatar {
    flex: none; width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-pale); color: var(--brand); font-weight: 800; font-size: 18px;
}
.grid-2 { display: grid; gap: 12px; align-items: start; }
.grid-2 > .card + .card, .list > .card + .card { margin-top: 0; }
.card__title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 12px; }
.ui .card__title { margin: 0 0 12px; }
.kv a { color: var(--ink); text-underline-offset: 3px; }
.list { display: grid; gap: 8px; }
.row-card { background: var(--card); border-radius: var(--r-lg); }
.row-card > summary, .row-card__head {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
    padding: 14px 16px; list-style: none; cursor: pointer;
}
.row-card > summary::-webkit-details-marker { display: none; }
.row-card__title { font-weight: 700; }
.row-card__sub { font-size: 13px; color: var(--ink-3); }
.row-card__side { display: grid; justify-items: end; gap: 4px; text-align: right; }
.row-card__chev { grid-column: 1 / -1; justify-self: center; width: 18px; height: 18px; color: var(--ink-3); transition: transform .15s; margin: -2px 0 -6px; }
.row-card[open] .row-card__chev { transform: rotate(180deg); }
.row-card__body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.row-card__body > :first-child { margin-top: 14px; }
.row-card.is-muted .row-card__title { color: var(--ink-3); text-decoration: line-through; }

.lines { list-style: none; margin: 12px 0 0; padding: 0; }
.lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.lines li:first-child { border-top: 0; }
.lines__meta { font-size: 12px; color: var(--ink-3); }
.lines__sum { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lines__total { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 2px solid var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.page-head .page__title { margin: 4px 0 0; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

/* ---------- Таблицы (десктоп; на телефоне — карточки) ---------- */

.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--r-lg); overflow: hidden; font-size: 14px; }
.table th { background: #f6f6f4; color: var(--ink-2); font-size: 12px; font-weight: 600; text-align: left; padding: 10px 14px; }
.table td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.table th.num, .table td.num { text-align: right; }

/* ---------- Портал розробника (apihtml/_doc.php) ---------- */
.api-section { margin-top: 12px; scroll-margin-top: calc(var(--head-h, 64px) + 12px); }
.api-section.is-focus { box-shadow: inset 0 0 0 2px var(--brand-pale); }
.api-section__title { margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.api-section__title code { margin-left: 4px; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.api-section__sub { margin: 18px 0 8px; font-size: 15px; font-weight: 700; }
.api-section form { margin: 4px 0 0; }
.api-copy { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 8px 8px 8px 12px; border-radius: var(--r-md); background: #f6f6f4; }
.api-copy code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.api-copy .btn { flex: none; }
.api-method { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.api-method code { overflow-wrap: anywhere; font-size: 14px; }
.api-verb { padding: 2px 8px; border-radius: var(--r-pill); background: var(--ok-bg); color: var(--ok-deep); font-size: 12px; font-weight: 700; }
.api-table { margin-bottom: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.api-table td:first-child { white-space: nowrap; }
.api-code { margin: 0 0 8px; padding: 12px 14px; border-radius: var(--r-md); background: #1f1f1f; color: #e8e8e3; font-size: 12.5px; line-height: 1.5; overflow-x: auto; }
@media (max-width: 599px) { .api-table td:first-child { white-space: normal; } }

/* ---------- Фильтры ---------- */

.filter-group { background: #fff; border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 10px; }
.filter-group__title { font-weight: 700; margin-bottom: 8px; }

/* группы фильтров — сворачиваются; в заголовке — сколько выбрано */
.filter-acc > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; user-select: none; }
.filter-acc > summary::-webkit-details-marker { display: none; }
.filter-acc > summary::after { content: "›"; margin-left: auto; color: var(--ink-3); font-size: 20px; line-height: 1; transform: rotate(90deg); transition: transform .15s; }
.filter-acc:not([open]) > summary { margin-bottom: 0; }
.filter-acc:not([open]) > summary::after { transform: none; }
.filter-search { height: 38px; margin: 2px 0 6px; font-size: 14px; }
.filter-values.is-collapsed:not(.is-searching) [data-filter-extra] { display: none; }
.ui .filter-more { margin: 4px 0 0; padding: 4px 0; border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 14px; cursor: pointer; }
.ui .filter-more:hover { text-decoration: underline; }
.filter-values.is-searching + .filter-more { display: none; }
.filter-empty { padding: 6px 0; color: var(--ink-3); font-size: 13px; }

/* «Хіт», «Знову в продажу» — чипы-переключатели */
.filter-group--chips { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip { position: relative; cursor: pointer; }
.check-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-chip span {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r-pill);
    border: 1px solid var(--line-strong); background: #fff; font-size: 14px; font-weight: 600; color: var(--ink);
}
.check-chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.check-chip input:checked + span::before { content: "✓"; font-weight: 800; }
.check-chip input:focus-visible + span { box-shadow: var(--focus); }

/* «Знайдено: N · Показати» рядом с изменённым фильтром */
.filter-bubble {
    position: fixed; z-index: 70; display: flex; align-items: center; gap: 10px;
    padding: 8px 8px 8px 14px; border-radius: var(--r-pill); background: var(--ink); color: #fff;
    font-size: 14px; white-space: nowrap; box-shadow: var(--shadow-float); animation: busy-fade .15s ease-out;
}
.filter-bubble__text b { font-variant-numeric: tabular-nums; }
.ui .filter-bubble__go { height: 32px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: var(--brand); color: #fff; font-weight: 700; cursor: pointer; }
.ui .filter-bubble__go:hover { background: var(--brand-dark); }
.filter-bubble.is-side::after { /* хвостик к колонке фильтров */
    content: ""; position: absolute; right: -6px; top: 50%; margin-top: -6px;
    border: 6px solid transparent; border-right: 0; border-left-color: var(--ink);
}

/* активные фильтры над товарами */
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.ui .chip--remove { gap: 6px; background: var(--ink); border-color: var(--ink); color: #fff; text-decoration: none; }
.ui .chip--remove span { font-size: 16px; line-height: 1; opacity: .75; }
.ui .chip--remove:hover span { opacity: 1; }
.ui .active-filters__reset { margin-left: 4px; color: var(--brand); font-size: 14px; font-weight: 600; }
.filter-row { display: flex; gap: 10px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
/* счётчики фильтра: число товаров у значения при текущем отборе; без товаров — неактивно */
.facet-n { margin-left: auto; color: var(--ink-3); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.check.is-off, .check-chip.is-off { cursor: default; }
.check.is-off span, .check.is-off .facet-n { color: var(--ink-3); opacity: .55; }
.check.is-off input { opacity: .45; }
.check-chip .facet-n { margin-left: 4px; color: inherit; opacity: .6; }
.check-chip.is-off span { opacity: .4; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }

/* ---------- Детальная карточка ---------- */

.gallery-box { position: relative; margin: -16px -16px 12px; }
/* гортання — стрілками (полосу прокрутки ховаємо, свайп лишається) */
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 16px; background: #fff; scrollbar-width: none; -ms-overflow-style: none; }
.gallery::-webkit-scrollbar { width: 0; height: 0; }
.ui .gallery-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
    width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 50%;
    background: rgba(255, 255, 255, .92); color: var(--ink); cursor: pointer;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(23, 23, 23, .14);
}
.ui .gallery-nav:hover { background: #fff; }
.gallery-nav--prev { left: 10px; }
.gallery-nav--next { right: 10px; }
.gallery-nav--next .icon { transform: rotate(180deg); }
.gallery img { flex: none; width: 100%; height: 280px; object-fit: contain; scroll-snap-align: center; cursor: zoom-in; }
.pd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pd-name { font-size: 19px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; margin-bottom: 6px; }
.pd-fav {
    flex: none; width: 34px; height: 34px; border-radius: 50%; margin-top: 2px;
    border: 1px solid var(--line); background: #fff; color: var(--ink-3);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.pd-fav .icon { width: 18px; height: 18px; }
.pd-fav.is-active { color: #e0294b; border-color: #f6c3cd; }
.pd-fav.is-active .icon { fill: currentColor; }
.pd-buy { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border-radius: var(--r-lg); padding: 14px 16px; margin: 12px 0; }
.props { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border-radius: var(--r-lg); overflow: hidden; }
.props td { padding: 9px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.props tr:first-child td { border-top: 0; }
.props td:first-child { color: var(--ink-2); width: 45%; }
.props .props__group td { background: #f6f6f4; font-weight: 700; color: var(--ink); }
.props .icon { width: 16px; height: 16px; }
.description { background: #fff; border-radius: var(--r-lg); padding: 14px 16px; font-size: 14px; }
.description img { height: auto; }
.description table { max-width: 100%; display: block; overflow-x: auto; }

/* ---------- Корзина ---------- */

.cart-line { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 12px; background: #fff; border-radius: var(--r-lg); padding: 12px 12px 12px 16px; }
.cart-line + .cart-line { margin-top: 8px; }
.cart-line.is-unavailable { opacity: .55; }
.cart-line.is-unselected { opacity: .55; }
.cart-line__select { display: flex; align-items: center; }
.cart-line__select input { width: 20px; height: 20px; accent-color: var(--brand); cursor: pointer; }
.cart-line__name { font-weight: 600; line-height: 1.3; }
.cart-line__del { width: 40px; height: 40px; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.cart-line__del:hover { color: var(--err); background: var(--err-bg); }
.cart-line__row { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cart-line__sum { text-align: right; font-weight: 700; }
.cart-totals { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.cart-totals__val { font-size: 20px; font-weight: 800; letter-spacing: -.01em; text-align: right; }
/* Доставка в корзине (Новая почта) */
.delivery { margin: 4px 0 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.delivery .segmented { margin-bottom: 12px; }
.delivery .field { margin-bottom: 12px; }
.dl-ac { position: relative; }
.dl-list {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin-top: 4px;
    max-height: 280px; overflow-y: auto; overscroll-behavior: contain;
    background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-float);
}
.dl-list .loader { padding: 16px 0; }
.ui .dl-item {
    display: block; width: 100%; padding: 10px 12px; border: 0; border-top: 1px solid var(--line);
    background: transparent; text-align: left; font-size: 14px; line-height: 1.3; cursor: pointer; color: var(--ink);
}
.ui .dl-item:first-child { border-top: 0; }
.ui .dl-item:hover, .ui .dl-item:focus-visible { background: var(--bg); }
.dl-item span { display: block; font-size: 12px; color: var(--ink-3); }
.dl-empty { padding: 12px; font-size: 14px; color: var(--ink-3); }
.dl-recent { margin-bottom: 12px; }
.dl-options { display: grid; gap: 6px; margin: 6px 0 4px; }
.ui .dl-option {
    display: block; width: 100%; padding: 10px 12px; text-align: left; cursor: pointer;
    background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-md); font-size: 14px; color: var(--ink);
}
.dl-option span { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-2); }
.ui .dl-option.is-active { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); background: var(--ok-bg); }
[data-dl-summary] { margin: 4px 0 0; }

.cart-actions { display: grid; gap: 8px; }
/* Корзина — компактный список: каждый товар в одну строку (товар | количество | сумма | удалить) */
#sheet-cart .sheet__body { padding: 10px 8px; }
#sheet-cart .card { padding: 14px 12px; }
#sheet-cart .cart-list { background: var(--card); border-radius: var(--r-lg); overflow: hidden; }
#sheet-cart .cart-line {
    grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 0 8px;
    padding: 10px 6px 10px 12px; border-radius: 0; background: transparent;
}
#sheet-cart .cart-line + .cart-line { margin-top: 0; border-top: 1px solid var(--line); }
#sheet-cart .cart-line__select { grid-column: 1; grid-row: 1; }
#sheet-cart .cart-line__info { grid-column: 2; grid-row: 1; min-width: 0; }
#sheet-cart .cart-line.is-unavailable .cart-line__info { grid-column: 1 / span 2; }
#sheet-cart .cart-line__row { grid-column: 3; grid-row: 1; gap: 8px; justify-content: flex-end; }
#sheet-cart .cart-line__del { grid-column: 4; grid-row: 1; width: 32px; height: 32px; }
#sheet-cart .cart-line__del .icon { width: 18px; height: 18px; }
#sheet-cart .cart-line .p-card__name {
    font-size: 14px; line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
#sheet-cart .cart-line .p-card__meta { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; font-size: 11px; margin-top: 2px; }
#sheet-cart .cart-line .stepper button { width: 30px; height: 32px; font-size: 18px; }
#sheet-cart .cart-line .stepper input { width: 34px; height: 32px; font-size: 15px; }
#sheet-cart .cart-line__sum { min-width: 62px; }
#sheet-cart .cart-line__sum .price__main { font-size: 15px; }
#sheet-cart .cart-line__sum .price__hint { display: none; }
#sheet-cart .cart-line.is-unavailable .cart-line__row { font-size: 12px; }

/* ---------- Главная ---------- */

.carousel { position: relative; margin-bottom: 4px; }
.banners {
    position: relative; display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding-inline: 16px; scroll-behavior: smooth;
    margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none;
}
.banners::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: reduce) { .banners { scroll-behavior: auto; } }
.banner { flex: none; width: 88%; scroll-snap-align: start; border: 0; padding: 0; background: #fff; border-radius: var(--r-lg); overflow: hidden; cursor: pointer; }
.carousel__nav {
    position: absolute; top: calc(50% - 14px); z-index: 2; transform: translateY(-50%);
    display: none; align-items: center; justify-content: center;
    width: 44px; height: 44px; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .92); color: var(--ink); box-shadow: 0 2px 10px rgba(23, 23, 23, .2); cursor: pointer;
}
.carousel__nav:hover { background: #fff; }
.carousel__nav--prev { left: -10px; }
.carousel__nav--next { right: -10px; }
.carousel__nav--next .icon { transform: rotate(180deg); }
.carousel__dots { display: flex; justify-content: center; gap: 6px; padding: 8px 0 2px; }
.ui .carousel__dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: var(--r-pill); background: var(--line-strong); cursor: pointer; transition: width .2s, background-color .2s; }
.ui .carousel__dot.is-active { width: 22px; background: var(--brand); }
.banner img { display: block; width: 100%; height: auto; aspect-ratio: 875 / 335; object-fit: cover; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    min-height: 88px; padding: 12px 6px; border: 0;
    background: #fff; border-radius: var(--r-lg);
    text-align: center; font-size: 13px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; color: var(--ink);
    transition: transform .1s;
}
.tile:active { transform: scale(.97); }

/* добірки на главной: карточка в бледном цвете ярлыка (бейдж — как на карточке товара); телефон — прокрутка вбок */
.collections { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.collections::-webkit-scrollbar { display: none; }
.ui .collection {
    flex: none; width: 190px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px;
    border-radius: var(--r-lg); background: #f5f5f2; background: color-mix(in srgb, var(--label-bg, var(--brand)) 10%, #fff);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--label-bg, var(--brand)) 18%, transparent);
    color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.ui .collection:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--label-bg, var(--brand)) 45%, transparent), 0 6px 18px rgba(23, 23, 23, .08); transform: translateY(-1px); }
.collection__head { display: flex; align-items: center; justify-content: space-between; align-self: stretch; }
.collection__count { margin-top: 4px; font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.collection__count small { margin-left: 2px; color: var(--ink-2); font-size: 14px; font-weight: 600; letter-spacing: 0; }
/* категории подборки: до трёх самых крупных и «і ще N» */
.collection__cats {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    margin-bottom: 4px; color: var(--ink-2); font-size: 12px; line-height: 1.35;
}
.collection__more { color: var(--ink-3); white-space: nowrap; }
.collection__arrow { color: var(--label-bg, var(--brand)); font-size: 18px; font-weight: 700; transition: transform .15s; }
.ui .collection:hover .collection__arrow { transform: translateX(3px); }
.tile .icon {
    box-sizing: content-box; width: 22px; height: 22px; padding: 9px;
    border-radius: 50%; background: var(--brand-pale); color: var(--brand);
}

.fin-head { align-items: center; margin: 28px 0 12px; }
.ui .fin-head .section__title { margin: 0; }
.fin-flag { flex: none; padding: 4px 10px; border-radius: var(--r-pill); background: var(--err-bg); color: var(--err); font-size: 13px; font-weight: 700; }
.fin-card { background: #fff; border-radius: var(--r-lg); padding: 16px; }
.fin-card + .fin-card { margin-top: 10px; }
.fin-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.fin-card__cur { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.fin-card__note { font-size: 13px; color: var(--ink-3); }
/* три главные цифры: на телефоне — по две в ряд, на широком экране — три */
.fin-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px 16px; }
.fin-metric { min-width: 0; }
.fin-metric__label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 2px; }
.fin-metric__value { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-metric__value.red { color: var(--brand); }
.fin-metric__hint { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.fin-schedule { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.fin-schedule__label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.fin-days { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fin-day { min-width: 0; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 6px; text-align: center; }
.fin-day__date { display: block; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-day__date .red { color: var(--brand); font-weight: 600; }
.fin-day b { display: block; margin-top: 4px; font-size: 14px; font-weight: 700; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-day.is-due { background: var(--bg); border-color: transparent; }
.fin-day.is-due b { color: var(--ink); }

.news-list { display: grid; gap: 8px; }
.news-item { display: grid; grid-template-columns: 96px 1fr; gap: 12px; background: #fff; border-radius: var(--r-lg); padding: 10px; text-decoration: none; }
.news-item img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--r-md); background: var(--bg); }
.news-item__title { font-weight: 600; line-height: 1.3; }
.news-item__date { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }

/* ---------- Результат заказа ---------- */

.result { max-width: 560px; margin: 24px auto; text-align: center; background: var(--card); border-radius: var(--r-xl); padding: 28px 20px; }
.result__icon { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.result__icon .icon { width: 38px; height: 38px; stroke-width: 2.5; }
.result--ok .result__icon { background: var(--ok-bg); color: var(--ok); }
.result--err .result__icon { background: var(--err-bg); color: var(--err); }
.result__title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.result__numbers { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0 20px; }
.result__numbers span { background: var(--bg); border-radius: var(--r-pill); padding: 6px 14px; font-weight: 700; }
.result__actions { display: grid; gap: 8px; margin-top: 20px; }
.result .lines { text-align: left; margin: 12px 0; }

/* ---------- Вход ---------- */

.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 16px; background: var(--head); }
.login__box { width: 100%; max-width: 400px; margin: 0 auto; background: #fff; border-radius: var(--r-xl); padding: 28px 20px 24px; }
.login__logo { display: block; margin: 0 auto 24px; background: var(--head); color: #fff; border-radius: var(--r-lg); padding: 14px; text-align: center; line-height: 0; }
.login__logo .logo { height: 17px; width: 176px; margin: 0 auto; display: block; }
.login__title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; text-align: center; margin-bottom: 18px; }
.login__alt { text-align: center; margin-top: 16px; }
.link-btn { border: 0; background: none; padding: 8px; color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.toast {
    position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 80;
    max-width: 480px; margin: 0 auto; padding: 14px 18px; border-radius: var(--r-lg);
    background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-float);
}
body.no-nav .toast { bottom: calc(16px + var(--safe-b)); }

.overlay-busy {
    position: fixed; inset: 0; z-index: 90; padding: 16px;
    background: rgba(238, 238, 235, .8); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    animation: busy-fade .2s ease-out;
}
.busy-card {
    width: 100%; max-width: 360px; padding: 28px 24px 24px; text-align: center;
    background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-float);
    animation: sheet-up .3s ease-out;
}
.busy-card__title { margin-top: 14px; font-size: 18px; font-weight: 700; }
.busy-timer { margin-top: 6px; font-size: 15px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.busy-doc { width: 56px; height: 64px; overflow: visible; }
.busy-doc__sheet { fill: var(--brand-pale); stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; }
.busy-doc__fold { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; }
.busy-doc__line {
    fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round;
    stroke-dasharray: 24; stroke-dashoffset: 24; animation: busy-write 2.4s ease-in-out infinite;
}
.busy-doc__line:nth-of-type(4) { animation-delay: .25s; }
.busy-doc__line:nth-of-type(5) { animation-delay: .5s; }
.busy-doc__stamp { fill: var(--brand); transform-origin: 36px 44px; transform: scale(0); animation: busy-stamp 2.4s ease-in-out infinite; }
.busy-doc__tick { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; animation: busy-tick 2.4s ease-in-out infinite; }
.busy-steps { list-style: none; margin: 18px 0 0; padding: 0; text-align: left; display: grid; gap: 10px; }
.busy-steps__item { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-3); transition: color .2s; }
.busy-steps__dot {
    flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line);
    display: inline-flex; align-items: center; justify-content: center; transition: background .2s, border-color .2s;
}
.busy-steps__item.is-active { color: var(--ink); font-weight: 700; }
.busy-steps__item.is-active .busy-steps__dot { border-color: var(--brand); border-top-color: transparent; animation: spin .8s linear infinite; }
.busy-steps__item.is-done { color: var(--ink-2); }
.busy-steps__item.is-done .busy-steps__dot { background: var(--brand); border-color: var(--brand); }
.busy-steps__item.is-done .busy-steps__dot::after {
    content: ""; width: 7px; height: 4px; margin-top: -2px;
    border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg);
}
.busy-bar { position: relative; height: 4px; margin-top: 20px; border-radius: 2px; background: var(--brand-pale); overflow: hidden; }
.busy-bar span { position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 2px; background: var(--brand); animation: busy-bar 1.4s ease-in-out infinite; }
@keyframes busy-fade { from { opacity: 0; } }
@keyframes busy-write { 0% { stroke-dashoffset: 24; } 35%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes busy-stamp { 0%, 45% { transform: scale(0); } 55% { transform: scale(1.2); } 62%, 90% { transform: scale(1); } 100% { transform: scale(1); opacity: 0; } }
@keyframes busy-tick { 0%, 55% { opacity: 0; } 62%, 90% { opacity: 1; } 100% { opacity: 0; } }
@keyframes busy-bar { 0% { left: -40%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
    .busy-doc__line, .busy-doc__stamp, .busy-doc__tick { animation: none; stroke-dashoffset: 0; transform: none; opacity: 1; }
    .busy-bar span { animation-duration: 3s; }
}

/* ---------- Планшет и десктоп ---------- */

@media (min-width: 600px) {
    .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .news-card { grid-template-columns: 1fr; padding: 0; overflow: hidden; }
    .news-card img { width: 100%; height: 180px; border-radius: 0; }
    .news-card__body { padding: 0 14px 14px; }
    .news-card--noimg .news-card__body { padding-top: 14px; }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .list--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .products { grid-template-columns: repeat(2, 1fr); }
    .tiles { grid-template-columns: repeat(6, 1fr); }
    /* auto-fit: карточки растягиваются на всю ширину, как плитки «Швидких дій» */
    .collections { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 0; padding: 0; overflow: visible; }
    /* пристрої: одна строка — колонки по ширине, лишние плитки уходят в скрытые ряды нулевой высоты */
    .home-devices { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); grid-template-rows: auto; grid-auto-rows: 0; row-gap: 0; margin: -2px -2px 0; padding: 2px 2px 0; overflow: hidden; }
    .ui .home-device { min-width: 0; }
    .ui .collection { width: auto; }
    .banner { width: calc(50% - 5px); }
    .fin-days { grid-template-columns: repeat(6, 1fr); }
    .fin-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .fin-metric__value { font-size: 26px; }
}

@media (min-width: 960px) {
    body.ui { padding-bottom: 0; }
    .bottom-nav { display: none; }
    .toast { bottom: 24px; }

    .app-header { padding: 10px 24px; }
    .app-header__row { gap: 12px; }
    .app-header__row { flex-wrap: nowrap; }
    /* шапка — завжди однієї ширини, незалежно від сторінки (раніше залежало від .page--wide на ній, і вузькі
       сторінки, які забули цей клас, ламали перенос тексту в шапці) */
    .app-header__row { max-width: 1872px; margin: 0 auto; }
    .app-header .search { margin-right: auto; } /* курс, менеджер, кабинет и корзина — к правому краю контента */
    .app-header .search { order: 0; flex: 1 1 200px; min-width: 120px; max-width: 560px; }
    .header-rate, .header-manager, .header-cart__sum { flex: none; }
    /* Шапка на средних экранах: 960–1199px — меню только иконками, курс без подписи, менеджер и имя в кабинете скрыты;
       1200–1439px — подписи меню и курс видны, менеджер и имя ещё скрыты; от 1440px — всё. Иначе кнопки сжимались
       в столбик по букве, а правый край шапки уезжал за окно */
    .header-btn__label, .header-rate__label { display: none; }
    .header-rate b { font-size: 15px; }
    .app-header__spacer { display: none; }
    .header-cart, .header-cabinet, .header-favorite, .header-desktop-nav { display: flex; align-items: center; gap: 4px; }
    .header-manager__btn { gap: 8px; }
    .header-cabinet .small { display: none; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .header-desktop-nav .header-btn { font-size: 14px; }

    .page { padding: 24px 24px 48px; }
    .carousel__nav { display: flex; }
    .banners { margin: 0; padding: 0 0 4px; scroll-padding-inline: 0; }
    .page__title { font-size: 30px; }
    .page--with-side { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
    .layout-side { display: block; position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow-y: auto; border-radius: var(--r-lg); }
    .js-open-categories { display: none; }

    .products { grid-template-columns: 1fr; gap: 6px; }
    .p-card {
        grid-template-columns: 64px minmax(0, 1fr) auto;
        grid-template-areas: "img info buy";
        align-items: center;
        padding: 10px 14px;
    }
    .p-card__img-wrap { width: 64px; height: 64px; }
    .p-card__buy { padding-top: 0; border-top: 0; justify-content: flex-end; gap: 20px; }
    .p-card__buy .price { min-width: 120px; text-align: right; align-items: flex-end; }
    .products.is-compact .p-card { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info buy"; padding: 8px 12px 8px 16px; }
    .products.is-compact .p-card__name { -webkit-line-clamp: 1; font-size: 15px; }
    .products.is-compact .p-card__buy { flex-direction: row; align-items: center; gap: 20px; }
    .products.is-compact .stepper button { width: 34px; height: 34px; }
    .products.is-compact .stepper input { width: 42px; height: 34px; }

    .sheet__panel {
        left: 50%; right: auto; top: 50%; bottom: auto; width: min(720px, 94vw);
        transform: translate(-50%, -50%); border-radius: var(--r-xl); max-height: 88vh;
        animation: none; overflow: hidden;
    }
    .sheet__head { padding-top: 14px; }
    .sheet__head::before { display: none; }
    .sheet--full .sheet__panel { height: 88vh; }
    .sheet--side .sheet__panel { left: auto; right: 0; top: 0; bottom: 0; transform: none; width: 440px; height: 100vh; max-height: none; border-radius: var(--r-xl) 0 0 var(--r-xl); }
    .sheet--side .sheet__head { border-radius: 0; }

    /* мега-меню: выпадающая панель под шапкой по ширине контента; заголовок листа не нужен */
    /* лист начинается под шапкой: шапка остаётся кликабельной (повторный клик «Каталог» закрывает меню) */
    .sheet--mega { top: var(--head-h, 64px); }
    .sheet--mega .sheet__backdrop { background: rgba(23, 23, 23, .35); }
    .sheet--mega .sheet__panel {
        top: 0; left: 50%; bottom: auto; transform: translateX(-50%);
        width: min(1872px, calc(100vw - 48px)); height: auto; max-height: calc(100vh - var(--head-h, 64px) - 16px);
        border-radius: 0 0 var(--r-xl) var(--r-xl); background: #fff; animation: mega-drop .16s ease-out;
    }
    @keyframes mega-drop { from { opacity: 0; transform: translate(-50%, -8px); } }
    .sheet--mega .sheet__head { display: none; }
    .sheet--mega .sheet__body { padding: 20px 24px 24px; overflow-y: auto; overscroll-behavior: contain; }
    /* десктоп: весь каталог одним экраном — категории колонками сверху вниз (группа не рвётся между колонками) */
    .mega { display: none; }
    .megamap { display: block; column-width: 220px; column-gap: 24px; }
    .megamap__group { break-inside: avoid; padding-bottom: 14px; }
    .ui .megamap__root {
        display: flex; align-items: center; gap: 10px; padding: 5px 8px; margin: 0 -8px; border-radius: var(--r-md);
        color: var(--ink); font-size: 14px; font-weight: 700; line-height: 1.25; text-decoration: none;
    }
    .ui .megamap__root:hover { background: #f5f5f2; color: var(--brand); }
    .ui .megamap__root.is-current { color: var(--brand); }
    .megamap__icon { width: 25px; height: 25px; margin: 0; object-fit: contain; flex: none; }
    .megamap__icon.mega__noimg .icon { width: 16px; height: 16px; }
    .megamap__subs, .megamap__subs ul { margin: 0; padding: 0; list-style: none; }
    /* подкатегории с иконкой 25px (как у категории) — иконки стоят ровно под иконкой категории */
    .megamap__subs { padding-left: 0; }
    .megamap__subs ul { padding-left: 28px; }
    .ui .megamap__subs a { display: flex; align-items: center; gap: 14px; padding: 3px 0; color: var(--ink-2); font-size: 13px; line-height: 1.3; text-decoration: none; }
    .megamap__subicon { width: 25px; height: 25px; object-fit: contain; flex: none; }
    .ui .megamap__subs a:hover { color: var(--brand); }
    .ui .megamap__subs a.is-current { color: var(--brand); font-weight: 600; }
    /* низ панели: подборки по ярлыкам слева, прайс справа */
    .mega-foot { order: 0; display: flex; align-items: center; gap: 16px; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
    .mega-labels { flex: 1; margin: 0; }
    .mega-labels__title { display: inline; margin-right: 4px; color: var(--ink-3); font-size: 13px; font-weight: 600; }
    /* за пристроєм — колонки брендов под картой каталога */
    .megamap--devices { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
    .ui .megamap__heading { column-span: all; display: block; margin-bottom: 10px; color: var(--ink-3); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-decoration: none; }
    .ui .megamap__heading:hover { color: var(--brand); }
    .ui .megamap__subs a.megamap__more { color: var(--brand); font-weight: 600; }
    .ui .mega-foot__price {
        display: inline-flex; align-items: center; gap: 6px; flex: none;
        color: var(--ink-2); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
    }
    .ui .mega-foot__price:hover { color: var(--brand); }

    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* корзина на десктопе — широкая панель, строки просторнее */
    #sheet-cart .sheet__panel { width: min(860px, 92vw); }
    #sheet-cart .sheet__body { padding: 16px; }
    #sheet-cart .card { padding: 16px; }
    #sheet-cart .cart-line { gap: 0 16px; padding: 10px 10px 10px 16px; }
    #sheet-cart .cart-line__row { gap: 16px; }
    #sheet-cart .cart-line .p-card__name { font-size: 15px; -webkit-line-clamp: 1; }
    #sheet-cart .cart-line .p-card__meta { font-size: 12px; }
    #sheet-cart .cart-line .stepper button { width: 36px; height: 36px; }
    #sheet-cart .cart-line .stepper input { width: 44px; height: 36px; }
    #sheet-cart .cart-line__sum { min-width: 110px; }
    #sheet-cart .cart-line__sum .price__main { font-size: 17px; }
    #sheet-cart .cart-line__sum .price__hint { display: block; }
    #sheet-cart .cart-totals { align-items: center; }
    .cart-actions { grid-template-columns: 1fr 1fr; }
    .cart-actions .btn:only-child { grid-column: 1 / -1; }
}

/* Широкий экран: каталог на всю ширину — категории | товары | фильтры (лист фильтров становится колонкой) */
@media (min-width: 1200px) {
    .header-btn__label, .header-rate__label { display: inline; }
    .header-rate b { font-size: 14px; }

    .page--with-side { max-width: 1920px; grid-template-columns: 260px minmax(0, 1fr); }
    .page--with-filters { grid-template-columns: 260px minmax(0, 1fr) 300px; }
    .page--with-filters .js-open-filters { display: none; }
    .toolbar .select { flex: 0 1 280px; margin-left: auto; }

    /* колонка фильтров — во всю длину групп (прокручивается вместе со страницей), кнопки прилипают к низу экрана */
    .sheet--inline {
        display: block; position: static; inset: auto; z-index: auto;
    }
    .sheet--inline .sheet__backdrop, .sheet--inline .sheet__close { display: none; }
    .sheet--inline .sheet__panel {
        position: static; transform: none; width: auto; height: auto; max-height: none;
        background: var(--card); border-radius: var(--r-lg); box-shadow: none; overflow: visible;
    }
    .sheet--inline .sheet__head { border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 14px 16px 10px; }
    .sheet--inline .sheet__title { font-size: 17px; }
    .sheet--inline .sheet__body { padding: 0; background: var(--card); overflow: visible; flex: none; }
    .ui .sheet--inline .filter-group { margin: 0 !important; padding: 12px 16px; border-radius: 0; border-top: 1px solid var(--line) !important; }
    .ui .sheet--inline .sheet__body > div.filter-group { border-top: 0 !important; } /* цена — первая группа */
    .sheet--inline .filter-group__title { font-size: 14px; }
    .sheet--inline .check { min-height: 32px; font-size: 14px; gap: 10px; }
    .sheet--inline .filter-acc > summary { margin-bottom: 6px; }
    .sheet--inline .check input { width: 18px; height: 18px; }
    .sheet--inline .sheet__foot {
        position: sticky; bottom: 0; z-index: 2; padding: 12px 16px;
        border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: 0 -6px 16px rgba(23, 23, 23, .06);
    }
}

@media (min-width: 1440px) {
    .app-header__row { gap: 16px; }
    .header-manager__text { display: flex; }
    .header-cabinet .small { display: inline; }
}

@media print {
    .app-header, .bottom-nav, .sheet { display: none !important; }
    body.ui { background: #fff; }
}
