:root {
    --brand: #eb261f;
    --brand-dark: #c81f19;
    --ink: #2a2a2a;
    --gray: #4b4b4b;
    --muted: #8a8a8a;
    --bg: #f5f5f4;
    --surface: #ffffff;
    --border: #e4e4e2;
    --ok: #2e7d32;
    --radius: 10px;

    /* Высота куки-баннера: на неё поднимаются футер и виджет поддержки, пока
       баннер не приняли. На узких экранах кнопка «Принять» во всю ширину — выше. */
    --cookie-h: 88px;

    /* ── Слои (единая иерархия, снизу вверх) ─────────────────────────────────
       Меняя z-index, правьте ЗДЕСЬ, а не в отдельных правилах.               */
    --z-header: 100;          /* липкая шапка                                 */
    --z-support-fab: 1000;    /* плавающая кнопка поддержки                   */
    --z-support-panel: 1010;  /* открытая панель поддержки                    */
    --z-mini-cart: 1050;      /* всплывающая мини-корзина                     */
    --z-cookie: 1100;         /* куки-баннер — ВСЕГДА поверх виджета          */
    --z-drawer-overlay: 1190; /* затемнение под моб. шторкой категорий        */
    --z-drawer: 1200;         /* моб. шторка категорий                        */
    --z-loader: 2000;         /* сплэш-лоадер (pointer-events: none)          */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Onest', sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    /* Sticky footer: column layout so .main can grow and pin the footer down */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER */
.header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: var(--z-header); }
.header-inner { max-width: 1280px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; gap: 24px; }
.logo { display: inline-flex; align-items: center; gap: 8px; height: 40px; overflow: visible; text-decoration: none; flex-shrink: 0; }
.logo-emblem { height: 36px; width: auto; display: inline-block; }
.logo-text { height: 24px; width: auto; display: inline-block; }
@keyframes logo-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Global loading overlay — spinning emblem over a translucent scrim. Driven by
   htmx during requests (htmx-indicator → opacity) and shown on first paint via
   .is-loading (removed on window load by base.html). */
.loader-overlay { position: fixed; inset: 0; z-index: var(--z-loader); display: flex; align-items: center; justify-content: center; background: rgba(245, 245, 244, 0.6); pointer-events: none; }
.loader-overlay.is-loading { opacity: 1; }
.loader-emblem { height: 64px; width: auto; animation: logo-spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .loader-emblem { animation: none; } }
.search { flex: 1; max-width: 520px; display: flex; }
.search input { flex: 1; border: 1px solid var(--border); border-right: none; border-radius: 8px 0 0 8px; padding: 9px 14px; font-family: inherit; font-size: 14px; outline: none; }
.search input:focus { border-color: var(--gray); }
.search button { background: var(--gray); color: #fff; border: none; border-radius: 0 8px 8px 0; padding: 0 16px; font-size: 18px; cursor: pointer; }
.search button:hover { background: var(--ink); }
.header-actions { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.header-link { display: inline-flex; align-items: center; gap: 6px; color: var(--gray); text-decoration: none; font-weight: 500; }
.header-link:hover { color: var(--brand); }
.cart-link { color: var(--gray); text-decoration: none; font-weight: 600; position: relative; display: inline-flex; align-items: center; gap: 6px; }
.cart-link:hover { color: var(--brand); }
.cart-badge { background: var(--brand); color: #fff; border-radius: 10px; min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; padding: 0 6px; }
.cart-badge[hidden] { display: none; }

/* LAYOUT */
/* flex:1 0 auto → main grows to fill the viewport on short pages, pushing the
   footer to the bottom; width:100% keeps margin:0 auto centering inside the
   flex column (max-width caps it, auto margins center the slack). */
.main { max-width: 1280px; width: 100%; margin: 0 auto; padding: 24px 20px; flex: 1 0 auto; }
.catalog { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }

/* SIDEBAR */
.sidebar { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 104px); overflow-y: auto; padding-right: 4px; }
.sidebar-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 12px; }
.cat-list { list-style: none; }
.cat-list li a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.cat-list li a:hover { background: var(--surface); }
.cat-list li a.active { background: var(--gray); color: #fff; font-weight: 500; }
.cat-name { min-width: 0; overflow-wrap: anywhere; }
.cat-thumb { width: 22px; height: 22px; border-radius: 5px; object-fit: cover; flex-shrink: 0; background: var(--bg); }
.cat-thumb-fallback { display: inline-flex; align-items: center; justify-content: center; }
.cat-thumb-fallback::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.cat-list li a.active .cat-thumb-fallback::before { background: #fff; }

/* CATEGORY TREE — recursive sidebar (main → subcategories → leaves) */
[x-cloak] { display: none !important; }
.cat-tree, .cat-tree ul { list-style: none; }
.cat-tree .cat-row { display: flex; align-items: center; gap: 2px; border-radius: 7px; }
.cat-tree .cat-row:hover { background: var(--surface); }
.cat-tree .cat-link { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.cat-tree .cat-link:hover { background: transparent; }
.cat-tree .cat-row.active { background: var(--gray); }
.cat-tree .cat-row.active > .cat-link { color: #fff; font-weight: 500; }
.cat-tree .cat-row.active .cat-thumb-fallback::before { background: #fff; }
.cat-tree .cat-row.on-path > .cat-link { color: var(--brand); font-weight: 500; }
.cat-tree .cat-toggle { flex: 0 0 auto; width: 30px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: none; background: none; color: var(--muted); cursor: pointer; border-radius: 7px; }
.cat-tree .cat-toggle:hover { color: var(--ink); background: var(--bg); }
.cat-tree .cat-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.18s ease; }
.cat-tree .cat-toggle.open svg { transform: rotate(90deg); }
.cat-tree .cat-row.active .cat-toggle { color: rgba(255, 255, 255, 0.85); }
.cat-tree .cat-row.active .cat-toggle:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.cat-tree .cat-children { margin: 1px 0 1px 13px; padding-left: 11px; border-left: 1px solid var(--border); }

/* TOOLBAR */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; margin-left: auto; }
.filters select { border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; font-family: inherit; font-size: 13px; background: var(--surface); cursor: pointer; outline: none; }.count { color: var(--muted); font-size: 13px; }
.view-toggle { display: flex; gap: 4px; }
.view-toggle button { width: 34px; height: 34px; border: 1px solid var(--border); background: var(--surface); border-radius: 7px; cursor: pointer; font-size: 16px; color: var(--muted); }
.view-toggle button.active { background: var(--gray); color: #fff; border-color: var(--gray); }

/* GRID */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.products-list { display: flex; flex-direction: column; gap: 10px; }

/* CARD */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow 0.15s, transform 0.15s; }
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); transform: translateY(-2px); }
.card-img { aspect-ratio: 1 / 1; background: var(--bg); display: flex; align-items: center; justify-content: center; position: relative; }
.img-placeholder { font-size: 32px; font-weight: 700; color: var(--border); letter-spacing: 1px; }
.badge { position: absolute; top: 8px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; color: #fff; }
.badge-sale { left: 8px; background: var(--brand); }
.badge-urgent { right: 8px; background: #e8850c; }
.card-body { padding: 12px; display: flex; flex-direction: column; flex: 1; }
.card-brand { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); margin-bottom: 3px; }
.card-name { font-size: 14px; font-weight: 600; line-height: 1.35; margin-bottom: 4px; }
.card-sku { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.card-stock { margin-bottom: 10px; }
.stock-ok { font-size: 12px; color: var(--ok); font-weight: 500; }
.stock-out { font-size: 12px; color: var(--muted); }
.stock-expiry { display: block; font-size: 11px; color: #b06a00; margin-top: 2px; }
.card-footer { margin-top: auto; }
.price-box { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.price { font-size: 18px; font-weight: 700; color: var(--ink); }
.price-old { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.price-na { font-size: 13px; color: var(--muted); font-style: italic; }
.price-unit { font-size: 12px; font-weight: 500; color: var(--muted); }

/* ADD / STEPPER */
.add-box { display: flex; gap: 8px; }
.stepper { display: flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.stepper button { width: 30px; border: none; background: var(--bg); cursor: pointer; font-size: 16px; color: var(--gray); }
.stepper button:hover { background: var(--border); }
.stepper input { width: 44px; border: none; text-align: center; font-family: inherit; font-size: 13px; font-weight: 600; outline: none; }
.btn-add { flex: 1; background: var(--brand); color: #fff; border: none; border-radius: 7px; padding: 8px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn-add:hover { background: var(--brand-dark); }

/* LIST VIEW */
.products-list .card { flex-direction: row; }
.products-list .card-img { width: 120px; min-height: 110px; height: auto; flex-shrink: 0; }
.products-list .card-body { flex-direction: row; align-items: center; gap: 20px; flex-wrap: wrap; }
.products-list .card-name { flex: 1; min-width: 220px; margin: 0; }
.products-list .card-brand, .products-list .card-sku, .products-list .card-stock { margin: 0; }
.products-list .card-footer { margin: 0; display: flex; align-items: center; gap: 16px; }
.products-list .price-box { margin: 0; }

/* BRANDS PAGE */
.brands-title { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 20px; }
.brands-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.brand-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); transition: box-shadow 0.15s, transform 0.15s; }
.brand-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); transform: translateY(-2px); }
.brand-media { height: 80px; width: 100%; display: flex; align-items: center; justify-content: center; }
.brand-logo { max-height: 80px; max-width: 100%; object-fit: contain; }
.brand-placeholder { font-size: 30px; font-weight: 700; color: var(--border); letter-spacing: 1px; }
.brand-name { font-size: 13.5px; font-weight: 600; text-align: center; line-height: 1.3; overflow-wrap: anywhere; }

/* CART */
.cart-page { max-width: 980px; margin: 0 auto; }
.cart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.cart-title { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.cart-back { color: var(--gray); text-decoration: none; font-size: 13.5px; font-weight: 500; }
.cart-back:hover { color: var(--brand); }

.cart-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.cart-items { display: flex; flex-direction: column; gap: 10px; }
.cart-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: grid; grid-template-columns: 56px 1fr auto auto 28px; align-items: center; gap: 14px; }
.cart-row-img { width: 56px; height: 56px; background: var(--bg); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cart-row-img .img-placeholder { font-size: 18px; }
.cart-row-info { min-width: 0; }
.cart-row-name { font-size: 14px; font-weight: 600; line-height: 1.35; margin: 2px 0; }
.cart-row-qty { display: flex; justify-content: center; }
.cart-row-price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 92px; }
.cart-unit { font-size: 12px; color: var(--muted); }
.cart-line { font-size: 15px; font-weight: 700; color: var(--ink); }
.cart-remove { width: 28px; height: 28px; border: 1px solid var(--border); background: var(--surface); border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1; }
.cart-remove:hover { border-color: var(--brand); color: var(--brand); }

.cart-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: sticky; top: 88px; display: flex; flex-direction: column; gap: 10px; }
.cart-gifts { background: var(--bg); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.cart-gifts-title { font-size: 13px; font-weight: 600; color: var(--ok); margin-bottom: 4px; }
.cart-gifts ul { list-style: none; }
.cart-gifts li { font-size: 12.5px; color: var(--gray); }
.gift-benefit { color: var(--ok); font-weight: 600; }
.cart-gift-hint { font-size: 12px; color: var(--brand); line-height: 1.35; }

/* Single-product bulk price badge / next-tier hint on a cart row */
.cart-bulk-badge { font-size: 11px; font-weight: 600; color: var(--ok); }
.cart-bulk-hint { font-size: 11px; color: var(--brand); line-height: 1.3; text-align: right; }

/* Supplier-contract transparency block in the cart summary */
.cart-contracts { background: var(--bg); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.cart-contracts-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.cart-contract { display: flex; flex-direction: column; gap: 3px; }
.cart-contract-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.cart-contract-head .cc-vendor { color: var(--gray); font-weight: 600; }
.cart-contract-head .cc-sum { color: var(--ink); white-space: nowrap; }
.cart-contract-hint { font-size: 12px; color: var(--brand); line-height: 1.35; }
.summary-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--gray); }
.summary-discount { color: var(--brand); font-weight: 500; }
.summary-total { font-size: 17px; font-weight: 700; color: var(--ink); border-top: 1px solid var(--border); padding-top: 12px; margin-top: 2px; }
.cart-checkout { text-align: center; text-decoration: none; margin-top: 6px; }
/* Block 4: below-minimum order — warning + disabled checkout button. */
.cart-min-warning { font-size: 13px; line-height: 1.4; color: var(--brand-dark); background: #fdeceb; border: 1px solid #f6c9c6; border-radius: 8px; padding: 9px 12px; margin-top: 4px; }
.cart-checkout-off { background: #cfcfcd; cursor: not-allowed; pointer-events: none; }
.cart-checkout-off:hover { background: #cfcfcd; }

.cart-empty { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 48px 20px; text-align: center; color: var(--muted); }
.cart-empty p { margin-bottom: 16px; font-size: 15px; }
.cart-empty-btn { display: inline-block; text-decoration: none; padding: 9px 24px; flex: none; }

/* MINI-CART (popup on add) */
.mini-cart { position: fixed; top: 80px; right: 20px; width: 320px; z-index: var(--z-mini-cart); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,0.16); padding: 16px; opacity: 0; transform: translateX(24px); pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease; }
.mini-cart.show { opacity: 1; transform: none; pointer-events: auto; }
.mini-cart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.mini-cart-title { font-size: 13.5px; font-weight: 700; color: var(--ok); }
.mini-cart-close { width: 24px; height: 24px; border: none; background: var(--bg); border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 12px; line-height: 1; }
.mini-cart-close:hover { color: var(--brand); }
.mini-cart-item { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.mini-cart-name { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.mini-cart-qty { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mini-cart-summary { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.mini-cart-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--gray); }
.mini-cart-discount { color: var(--brand); font-weight: 500; }
.mini-cart-total { font-size: 15px; font-weight: 700; color: var(--ink); }
.mini-cart-link { display: block; text-align: center; text-decoration: none; }

/* PAGINATION */
.pager { display: flex; justify-content: center; margin-top: 24px; }
.btn-load { background: var(--surface); border: 1px solid var(--border); color: var(--gray); border-radius: 8px; padding: 11px 30px; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-load:hover { border-color: var(--gray); color: var(--ink); }
.empty { color: var(--muted); padding: 40px; text-align: center; }

/* MESSAGES */
.messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.msg { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; border: 1px solid var(--border); background: var(--surface); }
.msg-success { border-color: var(--ok); color: var(--ok); background: #f1f8f1; }
.msg-error { border-color: var(--brand); color: var(--brand); background: #fdf1f1; }

/* AUTH FORMS */
.auth-page { max-width: 440px; margin: 0 auto; }
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 20px; }
.auth-form, .addr-form { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 12.5px; font-weight: 600; color: var(--gray); }
.form-field input, .form-field textarea, .form-field select { border: 1px solid var(--border); border-radius: 7px; padding: 9px 12px; font-family: inherit; font-size: 14px; outline: none; background: #fff; }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: var(--gray); }

/* Пароль + глазок. Кнопка лежит поверх правого края поля, поле резервирует под
   неё место через padding-right (иначе текст уезжает под иконку). */
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; min-width: 0; padding-right: 44px; }
.pw-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: none; background: none; padding: 0; color: var(--muted); cursor: pointer; border-radius: 6px; }
.pw-toggle:hover { color: var(--ink); background: var(--bg); }
.pw-ic { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.field-error { font-size: 12px; color: var(--brand); }
.form-errors { font-size: 13px; color: var(--brand); background: #fdf1f1; border: 1px solid var(--brand); border-radius: 7px; padding: 9px 12px; }
.auth-submit { margin-top: 4px; }
.auth-alt { text-align: center; margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.auth-alt a { color: var(--brand); text-decoration: none; font-weight: 600; }

/* ACCOUNT */
.account-page { max-width: 820px; margin: 0 auto; }
.account-title { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 22px; }
.account-section { margin-bottom: 28px; }
.account-h2 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.account-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; }
.account-row { display: flex; justify-content: space-between; gap: 16px; font-size: 13.5px; color: var(--gray); }
.account-row strong { color: var(--ink); }
.badge-verify { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.badge-verify.ok { background: #f1f8f1; color: var(--ok); }
.badge-verify.pending { background: #fff6e9; color: #b9750c; }
.account-empty { color: var(--muted); font-size: 13.5px; padding: 6px 0; }

.addr-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.addr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.addr-info { font-size: 13.5px; color: var(--gray); }
.addr-info strong { display: block; color: var(--ink); margin-bottom: 2px; }
.addr-notes { font-size: 12px; color: var(--muted); margin-top: 2px; }
.addr-del { width: 26px; height: 26px; border: 1px solid var(--border); background: var(--surface); border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.addr-del:hover { border-color: var(--brand); color: var(--brand); }

.orders-list { display: flex; flex-direction: column; gap: 8px; }
.order-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; text-decoration: none; color: var(--gray); font-size: 13.5px; }
.order-row:hover { border-color: var(--gray); }
.order-num { font-weight: 600; color: var(--ink); }
.order-total { font-weight: 700; color: var(--ink); text-align: right; }
.order-status { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.o-badge { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 20px; background: #eef1ec; color: var(--ink); white-space: nowrap; }
.o-badge.status-new { background: #fff6e9; color: #b9750c; }
.o-badge.status-confirmed { background: #eef4fb; color: #2b6cb0; }
.o-badge.status-packed { background: #eef4fb; color: #2b6cb0; }
.o-badge.status-shipped { background: #edf3ff; color: #3454b4; }
.o-badge.status-delivered { background: #f1f8f1; color: var(--ok); }
.o-badge.status-cancelled { background: #fdecea; color: #b6603f; }
.o-sub { font-size: 11.5px; color: var(--muted); }
.req { color: #b6603f; }

/* CHECKOUT */
.checkout-page { max-width: 980px; margin: 0 auto; }
.checkout-title { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 20px; }
.checkout-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.checkout-main { display: flex; flex-direction: column; gap: 18px; }
.checkout-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.checkout-h2 { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.checkout-note { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.addr-choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.addr-choice, .pay-choice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--gray); }
.addr-choice:hover, .pay-choice:hover { border-color: var(--gray); }
.addr-choice input, .pay-choice input { margin-top: 2px; }
.addr-new summary { font-size: 13px; color: var(--brand); cursor: pointer; font-weight: 600; }
.addr-new-fields { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.checkout-block .form-field { margin-bottom: 12px; }
.checkout-block .form-field:last-child { margin-bottom: 0; }
.checkout-block input[type=date], .checkout-block input[type=text], .checkout-block select, .checkout-block textarea { width: 100%; border: 1px solid var(--border); border-radius: 7px; padding: 9px 12px; font-family: inherit; font-size: 14px; outline: none; }
.pay-choices { display: flex; flex-direction: column; gap: 8px; }

.checkout-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: sticky; top: 88px; display: flex; flex-direction: column; gap: 10px; }
.checkout-items { display: flex; flex-direction: column; gap: 8px; }
.checkout-item { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--gray); }
.checkout-item.gift { color: var(--ok); }
.ci-name em { color: var(--muted); font-style: normal; }
.ci-price { white-space: nowrap; font-weight: 600; color: var(--ink); }
.checkout-gifts { background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; color: var(--ok); }
.checkout-submit { margin-top: 6px; }

/* ORDER CONFIRMATION */
.order-page { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.order-success { font-size: 20px; font-weight: 700; color: var(--ok); }
.order-msg { color: var(--gray); font-size: 14px; margin-top: -8px; }
.order-page .checkout-block .summary-row { margin-top: 10px; }
.pay-instr p { font-size: 13.5px; color: var(--gray); }
.order-back { align-self: flex-start; text-decoration: none; padding: 9px 24px; flex: none; }

/* CARD IMAGE / LINKS (catalog cards link to the product page) */
.card-img-photo { width: 100%; height: 100%; object-fit: contain; display: block; }
a.card-img { text-decoration: none; }
a.card-name { color: var(--ink); text-decoration: none; display: block; }
a.card-name:hover { color: var(--brand); }
.products-list .card-img-photo { height: 100%; }

/* PRODUCT DETAIL */
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.breadcrumbs a { color: var(--gray); text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand); }
.bc-sep { color: var(--border); }
.bc-current { color: var(--ink); }

.pd { display: grid; grid-template-columns: minmax(0, 460px) 1fr; gap: 32px; align-items: start; }

.pd-gallery { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 12px; }
.pd-main-img { width: 100%; aspect-ratio: 1 / 1; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pd-main-img img { width: 100%; height: 100%; object-fit: contain; }
.pd-main-img.pd-placeholder .img-placeholder { font-size: 80px; color: var(--border); }
.pd-thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.pd-thumb { width: 68px; height: 68px; padding: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; cursor: pointer; transition: border-color 0.15s; }
.pd-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pd-thumb:hover { border-color: var(--muted); }
.pd-thumb.active { border-color: var(--brand); }

.pd-info { min-width: 0; }
.pd-brand { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 6px; }
.pd-title { font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: -0.5px; margin-bottom: 6px; }
.pd-fullname { font-size: 14px; color: var(--gray); margin-bottom: 4px; }
.pd-badges { display: flex; gap: 8px; margin: 14px 0; }
.badge-inline { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; color: #fff; position: static; }
.badge-inline.badge-sale { background: var(--brand); }
.badge-inline.badge-urgent { background: #e8850c; }
.pd-price-row { display: flex; align-items: baseline; gap: 12px; margin: 16px 0 10px; }
.pd-price { font-size: 28px; font-weight: 700; color: var(--ink); }
.pd-stock { margin-bottom: 18px; }
.pd-add { max-width: 320px; margin-bottom: 24px; }

/* Allowed markups (R3) — muted, sits under the price, never competes with it */
.pd-markups { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0 0 18px; }
.pd-markups-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 6px; }
.pd-markups-list { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.pd-markup { font-size: 12.5px; color: var(--gray); display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.pd-markup-name { color: var(--muted); }
.pd-markup-value { font-weight: 600; color: var(--ink); }
.pd-markup-limit .pd-markup-value { color: var(--brand); }
.pd-markup-note { flex-basis: 100%; font-size: 11px; color: var(--muted); line-height: 1.35; }
/* Markups on the catalog card (regulated products): small labelled rows, each a
   caption line + value/range line, muted so they don't compete with the price. */
.card-markups { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.card-markups .cm-row { display: flex; flex-direction: column; line-height: 1.25; }
/* Имя правила может быть длинным автоименем — режем многоточием, полное в title. */
.card-markups .cm-label { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-markups .cm-value { font-size: 11px; font-weight: 600; color: var(--gray); }
.card-markups .cm-row-limit .cm-value { color: var(--brand); }
.pd-section { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 18px; }
.pd-section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 12px; }
.pd-desc { font-size: 14px; color: var(--gray); line-height: 1.6; }
.pd-specs { display: flex; flex-direction: column; }
.pd-spec { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.pd-spec:last-child { border-bottom: none; }
.pd-spec dt { color: var(--muted); }
.pd-spec dd { color: var(--ink); font-weight: 500; text-align: right; }

/* HEADER ICONS / MOBILE NAV — nav icons show on desktop AND mobile; the
   search-toggle + burger + drawer stay desktop-hidden (revealed ≤768). */
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; flex-shrink: 0; }
.icon-btn { display: none; align-items: center; justify-content: center; background: none; border: none; padding: 0; cursor: pointer; color: var(--gray); }
.icon-btn:hover { color: var(--brand); }
/* Burger lives in the header (left corner), catalog page only, ≤768 only */
.burger { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -6px; padding: 0; background: none; border: none; font-size: 24px; line-height: 1; color: var(--gray); cursor: pointer; }
.burger:hover { color: var(--brand); }
.drawer-overlay { display: none; }
.drawer-head { display: none; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.drawer-title { font-size: 15px; font-weight: 700; }
.drawer-close { width: 44px; height: 44px; border: none; background: var(--bg); border-radius: 7px; font-size: 15px; color: var(--muted); cursor: pointer; }
.drawer-close:hover { color: var(--brand); }
/* «Акции» entry at the top of the category drawer — mobile only (≤768) */
.drawer-promo { display: none; }
.drawer-link { display: none; }

/* LONG-CONTENT SAFETY — keep long names / codes / emails from forcing h-scroll */
.card-name, .cart-row-name, .pd-title, .pd-fullname, .bc-current { overflow-wrap: break-word; }
.pd-spec dt { flex-shrink: 0; padding-right: 12px; }
.pd-spec dd { overflow-wrap: anywhere; }
.account-row { flex-wrap: wrap; }
.account-row span, .account-row strong { overflow-wrap: anywhere; min-width: 0; }

/* FOOTER */
.footer { border-top: 1px solid var(--border); margin-top: 40px; background: var(--surface); }
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 28px 20px; }
.footer-cols { display: flex; flex-wrap: wrap; gap: 24px 48px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col.footer-brand { flex: 1 1 240px; }
.footer-brand-name { font-weight: 700; color: var(--gray); font-size: 14px; }
.footer-col-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 2px; }
.footer-col a { color: var(--gray); text-decoration: none; font-size: 13.5px; width: fit-content; }
.footer-col a:hover { color: var(--brand); }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }

/* PAYMENT ICONS (partial: footer, product page, cart) */
.payment-icons { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.payment-icons img { height: 24px; width: auto; display: block; border-radius: 4px; border: 1px solid var(--border); background: #fff; }
/* Валюта расчётов названа явно (требование банка-эквайра). */
.price-currency-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 6px 0 0; }
.price-currency-note a { color: var(--brand); text-decoration: none; }
.price-currency-note a:hover { text-decoration: underline; }
.catalog-currency-note { margin: 0 0 12px; }

.pay-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.pay-row-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.cart-summary .pay-row { margin-bottom: 0; }

/* PROMO NAV LINK ("Акции") */
.promo-link { color: var(--brand); }
.promo-link:hover { color: var(--brand-dark); }

/* STATIC / TEXT PAGES (about, contacts, faq, offer, privacy) */
.static-page { max-width: 760px; margin: 0 auto; }
.static-title { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 16px; }
.static-body { color: var(--gray); font-size: 15px; line-height: 1.7; }
.static-body p { margin-bottom: 12px; }
.static-lead { color: var(--muted); }
.static-section { margin: 20px 0; }
.static-h2 { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.static-placeholder { color: var(--muted); }
.pay-row-center { align-items: flex-start; margin-top: 14px; }

/* COMPANY REQUISITES — compact block in the footer, on every page */
.footer-requisites { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.freq-line { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.freq-strong { color: var(--gray); font-weight: 600; }
.freq-sep { margin: 0 6px; opacity: 0.55; }
.footer-requisites a { color: var(--brand); text-decoration: none; }
.footer-requisites a:hover { text-decoration: underline; }
/* Контакты — единственная строка футера, по которой звонят: крупнее и жирнее
   остального мелкого юр. текста, номера/почта — тап-цели (min 44px по высоте). */
.freq-contacts { margin-top: 8px; font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.7; }
.freq-contacts .freq-phone, .freq-contacts .freq-mail { display: inline-block; padding: 3px 0; font-weight: 700; }
@media (max-width: 640px) {
    .freq-contacts { font-size: 16px; }
    .freq-contacts .freq-phone, .freq-contacts .freq-mail { padding: 8px 0; }
}

/* COMPANY REQUISITES — full definition list on /company-info/ */
.requisites { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.requisites-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 10px; }
.requisites-list { display: grid; grid-template-columns: 1fr; gap: 6px 24px; }
.req-row { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; line-height: 1.5; }
.req-row dt { color: var(--muted); min-width: 220px; flex: 0 0 auto; }
.req-row dd { color: var(--gray); margin: 0; overflow-wrap: anywhere; }
.req-row dd a { color: var(--brand); text-decoration: none; }
.static-body .requisites { border-top: none; padding-top: 0; margin-top: 0; }
.static-body .requisites-list { gap: 10px 24px; }
.static-body .req-row { font-size: 14px; }
@media (min-width: 760px) {
    .requisites-list { grid-template-columns: 1fr 1fr; }
}

/* WHOLESALE DISCOUNTS PAGE */
.wholesale-list { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.wholesale-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.wholesale-vendor { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.wholesale-tiers { width: 100%; border-collapse: collapse; }
.wholesale-tiers th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); font-weight: 600; padding: 4px 0; border-bottom: 1px solid var(--border); }
.wholesale-tiers td { font-size: 14px; color: var(--gray); padding: 6px 0; border-bottom: 1px solid var(--border); }
.wholesale-tiers tr:last-child td { border-bottom: none; }
.wholesale-tiers .wholesale-pct { color: var(--brand); font-weight: 700; text-align: right; }
.wholesale-tiers th:last-child { text-align: right; }
.wholesale-muted { color: var(--muted); }
.wholesale-excl { margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.wholesale-excl-label { font-weight: 600; color: var(--gray); }
/* FAQ page (вопросы из админки, те же что в виджете поддержки) */
.faq-list { display: flex; flex-direction: column; gap: 14px; }
.faq-item { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-weight: 600; color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.faq-a { margin: 0; color: var(--gray); font-size: 14px; line-height: 1.6; }
.faq-a a { color: var(--brand); text-decoration: none; }
.faq-a a:hover { text-decoration: underline; }

.static-stub { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px 28px; text-align: center; color: var(--muted); font-size: 15px; }

/* NARROW DESKTOP — when icon+label nav doesn't fit, collapse to icons only */
@media (min-width: 769px) and (max-width: 1000px) {
    .header-actions { gap: 10px; }
    .hl-label, .cart-link-label { display: none; }
    .header-link, .cart-link { width: 40px; height: 40px; justify-content: center; }
}

/* ============ TABLET / PHONE ≤768px ============ */
@media (max-width: 768px) {
    .main { padding: 16px; }

    /* HEADER → logo + icon actions; search drops to a full-width row on toggle */
    .header-inner { height: auto; min-height: 56px; flex-wrap: wrap; padding: 8px 16px; gap: 10px; }
    /* Logo compacts; may shrink/clip as a last resort so the icon row never wraps */
    .logo { height: 32px; flex-shrink: 1; min-width: 0; overflow: hidden; }
    .logo-emblem { height: 26px; }
    .logo-text { height: 18px; }
    /* «Акции» leaves the header on mobile → moved into the category drawer.
       Two-class selector so it beats the later `.header-link { display:flex }`. */
    .header-link.promo-link, .header-link.brands-link { display: none; }
    .header-actions { margin-left: auto; gap: 4px; flex-shrink: 0; }
    .icon-btn, .search-toggle { display: inline-flex; }
    .header-link, .cart-link, .search-toggle { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; }
    .hl-label, .cart-link-label { display: none; }
    .cart-link { position: relative; }
    .cart-link .cart-badge { position: absolute; top: 2px; right: 0; }
    .search { order: 3; display: none; flex: 1 1 100%; max-width: none; margin: 0; }
    .header.search-open .search { display: flex; }
    .search input { font-size: 16px; padding: 11px 14px; }

    /* Form inputs: 16px stops iOS focus-zoom; comfortable tap height */
    .form-field input, .form-field select, .form-field textarea,
    .checkout-block input, .checkout-block select, .checkout-block textarea,
    .stepper input, .search input { font-size: 16px; }

    /* STEPPER / BUTTONS — touch sizes (≥44px) */
    .stepper button { width: 42px; height: 44px; font-size: 18px; }
    .stepper input { width: 50px; height: 44px; }
    .btn-add { min-height: 44px; padding: 11px 14px; }

    /* CATALOG → off-canvas categories drawer (burger lives in the header) */
    .catalog { display: block; }
    .burger { display: inline-flex; }
    .sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: var(--z-drawer); width: 280px; max-width: 85vw; margin: 0; padding: 16px; max-height: 100vh; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border-right: 1px solid var(--border); transform: translateX(-100%); transition: transform 0.25s ease; }
    .catalog.cats-open .sidebar { transform: none; }
    .sidebar .sidebar-title { display: none; }
    .drawer-head { display: flex; }
    .drawer-promo { display: flex; align-items: center; gap: 10px; padding: 12px 10px; margin-bottom: 8px; border-radius: 7px; background: rgba(235, 38, 31, 0.09); color: var(--brand); font-weight: 700; font-size: 14px; text-decoration: none; }
    .drawer-promo:hover { background: rgba(235, 38, 31, 0.15); }
    .drawer-promo .ic { width: 20px; height: 20px; }
    .drawer-link { display: flex; align-items: center; gap: 10px; padding: 12px 10px; margin-bottom: 8px; border-radius: 7px; color: var(--gray); font-weight: 600; font-size: 14px; text-decoration: none; }
    .drawer-link:hover { background: var(--bg); color: var(--brand); }
    .drawer-link .ic { width: 20px; height: 20px; }
    .cat-list li a { padding: 11px 10px; }
    .cat-tree .cat-link { padding: 11px 10px; }
    .cat-tree .cat-toggle { width: 44px; height: 44px; }
    .cat-tree .cat-toggle svg { width: 17px; height: 17px; }
    .drawer-overlay { display: block; position: fixed; inset: 0; z-index: var(--z-drawer-overlay); background: rgba(0,0,0,0.45); opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
    .catalog.cats-open .drawer-overlay { opacity: 1; pointer-events: auto; }

    /* TOOLBAR → count + view-toggle on one row, filters full-width below */
    .toolbar { gap: 10px 12px; }
    .toolbar .count { order: 0; }
    .view-toggle { order: 1; margin-left: auto; }
    .view-toggle button { width: 44px; height: 44px; }
    .filters { order: 3; width: 100%; margin-left: 0; }
    .filters select { flex: 1; min-width: 0; min-height: 44px; }

    /* GRID → 2 columns; card add-box stacks so the button never overflows */
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .products-grid .add-box { flex-direction: column; gap: 8px; }
    .products-grid .add-box .stepper { width: 100%; }
    .products-grid .add-box .stepper input { flex: 1; width: auto; }

    /* LIST VIEW → image + vertically stacked body, no overlaps */
    .products-list .card-img { width: 96px; min-height: 96px; }
    .products-list .card-img-photo { height: 100%; }
    .products-list .card-body { flex-direction: column; align-items: stretch; gap: 6px; }
    .products-list .card-name { min-width: 0; flex: none; }
    .products-list .card-footer { flex-direction: column; align-items: stretch; gap: 8px; }

    /* PRODUCT DETAIL → full-width gallery, thumbnails scroll in a row */
    .pd { grid-template-columns: 1fr; gap: 18px; }
    .pd-gallery { position: static; }
    .pd-thumbs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
    .pd-thumb { flex: 0 0 auto; }
    .pd-add { max-width: none; }

    /* CART → row reflows to two lines; summary full-width below the list */
    .cart-grid { grid-template-columns: 1fr; }
    .cart-summary { position: static; }
    .cart-row { grid-template-columns: 56px 1fr auto; grid-template-areas: "img info remove" "qty qty price"; gap: 10px 12px; }
    .cart-row-img { grid-area: img; }
    .cart-row-info { grid-area: info; }
    .cart-remove { grid-area: remove; align-self: start; width: 40px; height: 40px; }
    .cart-row-qty { grid-area: qty; justify-content: flex-start; }
    .cart-row-price { grid-area: price; align-self: center; }

    /* CHECKOUT → single column */
    .checkout-grid { grid-template-columns: 1fr; }
    .checkout-summary { position: static; }
    .addr-choice, .pay-choice { padding: 12px; min-height: 44px; align-items: center; }

    /* ACCOUNT */
    .addr-del { width: 40px; height: 40px; }

    /* FOOTER → tighter columns, centered bottom row */
    .footer-inner { padding: 22px 16px; }
    .footer-cols { gap: 20px 32px; }
    .footer-bottom { justify-content: center; text-align: center; }
}

/* ============ PHONE ≤480px ============ */
@media (max-width: 480px) {
    .products-grid { gap: 10px; }

    /* Compact in-grid stepper: full-width row OVER the «В корзину» button,
       number centered and flexible, −/+ keys fixed width, no h-overflow in
       the 2-column grid. */
    .products-grid .add-box { flex-direction: column; gap: 6px; }
    .products-grid .add-box .stepper { display: flex; width: 100%; }
    .products-grid .add-box .stepper button { flex: 0 0 40px; width: 40px; }
    .products-grid .add-box .stepper input { flex: 1 1 auto; width: auto; min-width: 0; text-align: center; }
    .products-grid .add-box .btn-add { width: 100%; }
    .cart-title, .checkout-title, .account-title { font-size: 20px; }
    .pd-title { font-size: 21px; }
    .pd-price { font-size: 24px; }

    /* Order history rows → 2×2 block */
    .order-row { grid-template-columns: 1fr auto; grid-template-areas: "num total" "date status"; gap: 4px 12px; }
    .order-num { grid-area: num; }
    .order-total { grid-area: total; }
    .order-date { grid-area: date; }
    .order-status { grid-area: status; }

    /* Mini-cart → full-width bottom sheet, never clipped */
    .mini-cart { top: auto; bottom: 0; left: 0; right: 0; width: auto; border-radius: var(--radius) var(--radius) 0 0; transform: translateY(110%); }
    .mini-cart.show { transform: none; }
}

/* ── «Без НДС» note · regulated badges · price-range filter ─────────────────── */
.price-novat { font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; }

.reg { font-size: 11px; font-weight: 600; line-height: 1.5; padding: 2px 8px; border-radius: 20px; display: inline-block; }
.reg-on { background: #fff6e9; color: #b9750c; }   /* regulated → amber, signals «attention» */
.reg-off { background: #f0f0ef; color: var(--muted); }  /* not regulated → neutral grey */
.card-reg { margin-bottom: 8px; }
.products-list .card-reg { margin: 0; }
.pd-reg { margin-bottom: 18px; }

.pd-disclaimer { font-size: 12px; line-height: 1.5; color: var(--muted); margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

.filters { flex-wrap: wrap; align-items: center; }
.price-filter { display: flex; align-items: center; gap: 6px; }
.price-filter input { width: 68px; border: 1px solid var(--border); border-radius: 7px; padding: 7px 8px; font-family: inherit; font-size: 13px; background: var(--surface); outline: none; }
.price-filter input::-webkit-outer-spin-button, .price-filter input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-filter input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.price-filter-sep { color: var(--muted); }
.price-filter-go { border: 1px solid var(--border); background: var(--bg); border-radius: 7px; padding: 7px 12px; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--gray); cursor: pointer; }
.price-filter-go:hover { background: var(--border); }

@media (max-width: 768px) {
    .price-filter { width: 100%; }
    .price-filter input { flex: 1; min-width: 0; min-height: 44px; }
    .price-filter-go { min-height: 44px; }
}

/* ── Promo code (cart / checkout) ──────────────────────────────────────────── */
.cart-promo { margin: 14px 0; padding-top: 14px; border-top: 1px solid var(--border); }
.cart-promo-form { display: flex; gap: 8px; }
.cart-promo-form input { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 7px; padding: 9px 10px; font-family: inherit; font-size: 13px; outline: none; }
.cart-promo-form input:focus { border-color: var(--brand); }
.cart-promo-apply { border: none; background: var(--ink); color: #fff; border-radius: 7px; padding: 9px 14px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.cart-promo-apply:hover { background: #000; }
.cart-promo-applied { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #f1f8f1; border: 1px solid #cfe6cf; border-radius: 7px; padding: 8px 10px; font-size: 13px; color: var(--ok); }
.cart-promo-remove, .cart-promo-clear { border: none; background: transparent; color: var(--muted); font-family: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0; white-space: nowrap; }
.cart-promo-remove:hover, .cart-promo-clear:hover { color: var(--brand); }
.cart-promo-note { margin-top: 6px; font-size: 11px; color: var(--muted); }
.cart-promo-error { margin-top: 6px; font-size: 12px; color: var(--brand); }
.cart-promo-ok { margin-top: 6px; font-size: 12px; color: var(--ok); }

/* ───────────── Cookie consent banner (Block 5) ───────────── */
.cookie-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-cookie); display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0,0,0,0.07); padding: 12px 20px; }
.cookie-banner-text { font-size: 13px; line-height: 1.45; color: var(--gray); max-width: 780px; }
.cookie-banner-text a { color: var(--brand); }
.cookie-banner-text a:hover { color: var(--brand-dark); }
.cookie-banner-accept { flex-shrink: 0; background: var(--brand); color: #fff; border: none; border-radius: 7px; padding: 9px 24px; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.cookie-banner-accept:hover { background: var(--brand-dark); }
@media (max-width: 640px) { .cookie-banner { gap: 10px; padding: 12px 14px; } .cookie-banner-accept { width: 100%; } }

/* ───────────── B2B registration flow ───────────── */
.auth-page-wide { max-width: 720px; }
.auth-lead { color: var(--muted); font-size: 13.5px; line-height: 1.5; margin: -8px 0 18px; }
.form-check { display: flex; align-items: flex-start; gap: 9px; }
.form-check input { margin-top: 2px; flex-shrink: 0; width: 16px; height: 16px; }
.form-check label { font-size: 13px; color: var(--gray); font-weight: 500; line-height: 1.4; }
.details-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.details-form .auth-submit { grid-column: 1 / -1; }
/* Колонка грида по умолчанию не уже min-content своего содержимого, а у Textarea
   это cols=40 — на телефоне форма вылезала за карточку. Разрешаем колонке сжиматься. */
.details-form .form-field { min-width: 0; }
.details-form .form-field input, .details-form .form-field textarea,
.details-form .form-field select { width: 100%; max-width: 100%; }
@media (max-width: 560px) { .details-form { grid-template-columns: 1fr; } }

/* «У меня уже есть договор» — во всю ширину сетки, прямо над кнопкой отправки. */
.skip-contract { grid-column: 1 / -1; background: #f7f5ef; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.skip-contract label { font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.skip-contract-note { font-size: 12.5px; line-height: 1.45; color: var(--gray); margin-top: 4px; }
.badge-contract-skip { display: inline-block; margin-bottom: 14px; padding: 5px 12px; border-radius: 12px; background: #fff4e5; color: #8a5a00; border: 1px solid #f0d3a0; font-size: 12.5px; font-weight: 600; }
.btn-ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-ghost:hover { background: #fdeceb; }
.contract-dl { display: inline-block; margin-bottom: 14px; }

.reg-status-line { font-size: 14px; color: var(--gray); margin-bottom: 14px; }
.reg-steps { list-style: none; display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; padding: 0; }
.reg-steps li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.reg-steps li.done, .reg-steps li.current { color: var(--ink); }
.reg-steps li.current { font-weight: 600; }
.reg-dot { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: #ececea; color: var(--muted); }
.reg-steps li.done .reg-dot { background: #e5f0dd; color: #4b7a2b; }
.reg-steps li.current .reg-dot { background: var(--brand); color: #fff; }
.reg-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.reg-actions .btn-add { flex: 0 0 auto; }
.reg-edit-link { font-size: 13px; color: var(--muted); text-decoration: underline; }
.reg-edit-link:hover { color: var(--brand); }
.reg-note { font-size: 13px; line-height: 1.45; color: var(--gray); background: #f7f5ef; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.reg-note-ok { background: #f1f8f1; border-color: #cfe6cf; color: #3f7a3f; }

.cart-verify-notice { font-size: 13px; line-height: 1.45; color: var(--gray); background: #f7f5ef; border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; margin-top: 4px; }
.cart-verify-notice a { color: var(--brand); }

/* ───────────── Support widget (FAQ bot + mailto) ───────────── */
/* FAB sits bottom-right; the mini-cart is top-right on desktop, so they never
   overlap. While the cookie bar is shown, the FAB/panel lift above it (:has).
   Слои — из переменных :root; куки-баннер всегда выше виджета (и кнопки, и панели).

   ТАПЫ. Обёртка #support-widget не должна ловить события: pointer-events:none на
   ней, auto — только на кнопке и ОТКРЫТОЙ панели. Отдельно нужен [hidden]:
   правило .support-panel{display:flex} — авторский стиль и перебивает
   [hidden]{display:none} из UA-таблицы, поэтому закрытая панель оставалась в
   потоке. На мобильном она растянута на всю ширину (left:0;right:0;bottom:0) и,
   невидимая (opacity:0), перехватывала тапы по странице и по куки-баннеру. */
.support-widget { pointer-events: none; }
.support-panel[hidden] { display: none; }
.support-fab { position: fixed; bottom: 20px; right: 20px; z-index: var(--z-support-fab); pointer-events: auto; width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--brand); color: #fff; cursor: pointer; box-shadow: 0 6px 20px rgba(235,38,31,0.35); display: flex; align-items: center; justify-content: center; transition: background 0.15s, transform 0.15s; }
.support-fab:hover { background: var(--brand-dark); transform: translateY(-1px); }
.support-fab-ic { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.support-fab-x { display: none; font-size: 20px; line-height: 1; }
.support-widget.is-open .support-fab-ic { display: none; }
.support-widget.is-open .support-fab-x { display: block; }

.support-panel { position: fixed; bottom: 88px; right: 20px; z-index: var(--z-support-panel); pointer-events: none; width: 360px; max-width: calc(100vw - 32px); max-height: min(72vh, 560px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 44px rgba(0,0,0,0.22); display: flex; flex-direction: column; overflow: hidden; opacity: 0; transform: translateY(12px) scale(0.98); transform-origin: bottom right; transition: opacity 0.18s ease, transform 0.18s ease; }
.support-widget.is-open .support-panel { opacity: 1; transform: none; pointer-events: auto; }
/* Пока баннер не приняли — кнопка и панель стоят НАД ним (не перекрываются им и
   не перекрывают его). z-index страхует: баннер выше виджета в любом состоянии. */
body:has(.cookie-banner) .support-fab { bottom: calc(var(--cookie-h) + 12px); }
body:has(.cookie-banner) .support-panel { bottom: calc(var(--cookie-h) + 80px); }
/* The consent bar is position:fixed at the bottom; pad the footer so it never
   overlaps the footer links/requisites until the visitor dismisses it. */
body:has(.cookie-banner) .footer { padding-bottom: calc(var(--cookie-h) + 8px); }

.support-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--brand); color: #fff; }
.support-title { font-size: 15px; font-weight: 700; }
.support-close { border: none; background: rgba(255,255,255,0.18); color: #fff; width: 26px; height: 26px; border-radius: 7px; cursor: pointer; font-size: 13px; line-height: 1; }
.support-close:hover { background: rgba(255,255,255,0.32); }

.support-search { padding: 12px 14px 6px; }
.support-search input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-family: inherit; font-size: 13.5px; outline: none; }
.support-search input:focus { border-color: var(--brand); }

.support-body { flex: 1; overflow-y: auto; padding: 6px 14px 12px; }
.support-cat { margin-top: 10px; }
.support-cat-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); margin: 6px 2px; }
.support-faq { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 7px; overflow: hidden; background: #fff; }
.support-q { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; border: none; background: none; padding: 10px 12px; font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.support-q:hover { color: var(--brand); }
.support-chevron { flex-shrink: 0; color: var(--muted); transition: transform 0.18s; font-size: 14px; }
.support-faq.open .support-chevron { transform: rotate(180deg); }
.support-a { display: none; padding: 0 12px 12px; font-size: 13px; line-height: 1.5; color: var(--gray); }
.support-a a { color: var(--brand); }
.support-faq.open .support-a { display: block; }
.support-noresults, .support-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 18px 8px; }

.support-contact { border-top: 1px solid var(--border); padding: 12px 16px; background: var(--bg); }
.support-contact-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.support-mail { display: inline-flex; align-items: center; gap: 6px; background: var(--brand); color: #fff; text-decoration: none; border-radius: 8px; padding: 9px 16px; font-size: 13.5px; font-weight: 600; }
.support-mail:hover { background: var(--brand-dark); }
.support-phones { font-size: 12.5px; color: var(--gray); margin-top: 8px; }
.support-phones span { color: var(--ink); font-weight: 600; }

/* Мобильный: кнопка прижата к нижнему правому углу с поправкой на home-bar iOS;
   панель — шторка снизу. Мини-корзина (--z-mini-cart) на телефоне тоже занимает
   низ экрана и на своё время просто накрывает кнопку — конфликта тапов нет. */
@media (max-width: 768px) {
    .support-fab { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
    .support-panel { right: 0; left: 0; bottom: 0; width: auto; max-width: none; max-height: 82vh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
    .support-widget.is-open .support-panel { transform: none; }
    body:has(.cookie-banner) .support-fab { bottom: calc(var(--cookie-h) + 12px + env(safe-area-inset-bottom)); }
    body:has(.cookie-banner) .support-panel { bottom: calc(var(--cookie-h) + env(safe-area-inset-bottom)); }
}
/* Consent bar is taller on mobile (full-width button) — everything that lifts
   above it reads --cookie-h, so one override is enough. */
@media (max-width: 640px) {
    :root { --cookie-h: 132px; }
}