/* shop — стили каталога (modern refresh) */


:root {

    --bg: #f4f5f7;
    --panel: #ffffff;
    --panel-2: #f8f9fb;
    --border: #e4e7ec;
    --border-strong: #d0d5dd;
    --text: #101828;
    --text-2: #344054;
    --muted: #667085;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #eef4ff;
    --accent-ring: rgba(37, 99, 235, .18);
    --warm: #f97316;
    --content-width: 1400px;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 8px 24px -6px rgba(16, 24, 40, .12), 0 2px 6px -2px rgba(16, 24, 40, .06);

    --ease: cubic-bezier(.2, .7, .2, 1);
    --header-h: 64px;
    --rail-w: 280px;

    /* новые токены, вынесенные из захардкоженных значений */
    --header-bg: rgba(255, 255, 255, .82);
    --accent-tint: rgba(37, 99, 235, .12);
    --mark-bg: #fef08a;

    color-scheme: light;
}

/* --- тёмная тема: переопределяем только переменные --- */
:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0b0f17;
    --panel: #151b27;
    --panel-2: #1b2331;
    --border: #263042;
    --border-strong: #354258;
    --text: #e6e9f0;
    --text-2: #c3cad6;
    --muted: #8b95a7;
    --accent: #4f83ee;
    --accent-hover: #7aa3f5;
    --accent-soft: rgba(79, 131, 238, .15);
    --accent-ring: rgba(79, 131, 238, .30);
    

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .40);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .50), 0 1px 2px rgba(0, 0, 0, .30);
    --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, .60), 0 2px 6px -2px rgba(0, 0, 0, .40);

    --header-bg: rgba(21, 27, 39, .82);
    --accent-tint: rgba(79, 131, 238, .22);
    --mark-bg: #854d0e;
    --mark-text: #fef9c3;
}

/* hero и так тёмный — отделяем его от тёмного фона рамкой */
:root[data-theme="dark"] .hero { box-shadow: inset 0 0 0 1px var(--border); }

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


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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "tnum" 1, "cv11" 1;
}


[x-cloak] {
 display: none !important;
 }

.container { width: 100%; max-width: var(--content-width); margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* --- шапка --- */

.site-header {

    position: sticky; top: 0; z-index: 30;
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 16px; }

.logo {
 display: inline-flex; align-items: center; color: var(--text); }

.logo:hover {
 color: var(--text); }
.logo-img { display: block; height: 36px; width: auto; }

.main-nav {
 display: flex; gap: 4px; }
.main-nav a {
    padding: 8px 14px; border-radius: 999px; color: var(--text-2); font-weight: 500;
    transition: background .15s var(--ease), color .15s var(--ease);
}

.main-nav a:hover {
 background: var(--panel-2); color: var(--text); }

.main-nav a.active {
 background: var(--accent-soft); color: var(--accent); }

/* Скрываем кнопку "Главная" на десктопе */
@media (min-width: 901px) {
    .main-nav a[href="/"] {
        display: none;
    }
}


/* --- переключатель темы --- */
.theme-toggle {
    display: grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0;
    border: 1px solid var(--border); border-radius: 999px; background: var(--panel); color: var(--text-2);
    cursor: pointer; transition: border-color .15s var(--ease), color .15s var(--ease);
}
.theme-toggle:hover { border-color: var(--border-strong); color: var(--text); }

/* --- кнопка "Справочники" (десктоп) --- */
.catalogs-link {
    display: inline-flex; align-items: center; gap: 6px; flex: none;
    padding: 0 16px; height: 38px; font-size: 14px; white-space: nowrap;
}
.catalogs-link.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

main.container {
 flex: 1; padding-top: 24px; padding-bottom: 64px; }

/* десктоп: показ/скрытие между мобильным и десктопным маркапом (каскад) */
.desktop-only { display: none; }
/* !important — иначе .btn { display: inline-flex } (ниже по файлу, та же специфичность)
   перебивает скрытие, и кнопка «Справочники» остаётся видимой на мобильных */
@media (max-width: 900px) {
    .desktop-only { display: none !important; }
}
.cascade-rail,
.cascade-columns,
.cascade-placeholder { display: none; }

/* --- типографика --- */
h1 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.2; letter-spacing: -.02em; margin: 8px 0 12px; }

h2 {
 font-size: 18px; letter-spacing: -.01em; }

.section-title {
 margin: 40px 0 16px; font-size: 20px; }


.breadcrumbs {
 display: flex; flex-wrap: wrap; align-items: center; gap: 2px; color: var(--muted); font-size: 13px; margin: 0 0 8px; }

.breadcrumbs a {
 color: var(--muted); }

.breadcrumbs a:hover {
 color: var(--accent); }

.breadcrumbs .sep {
 margin: 0 6px; color: var(--border-strong); }
.breadcrumbs > span:last-child { color: var(--text-2); }


.lead {
 color: var(--muted); font-size: 16px; max-width: 760px; margin-top: 0; }

.help {
 color: var(--muted); }

.empty {

    padding: 48px 24px; text-align: center; color: var(--muted);
    background: var(--panel); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
}

.empty-icon {
 display: block; font-size: 32px; margin-bottom: 8px; opacity: .6; }


code {
 background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: .9em; }

/* --- кнопки --- */

.btn, .btn-primary {

    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: background .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease), border-color .15s var(--ease);
}
.btn-primary { background: #3B4951;
background: radial-gradient(circle farthest-corner at center center, #3B4951 0%, #000000 100%);; color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .1), inset 0 1px 0 rgba(255, 255, 255, .15); }

.btn-primary:hover {
 background: var(--accent-hover); color: #fff; box-shadow: 0 6px 16px -4px rgba(37, 99, 235, .5); }

.btn-primary:active {
 transform: translateY(1px); }

.btn-ghost {
 background: var(--panel); color: var(--text-2); border-color: var(--border); box-shadow: var(--shadow-xs); }

.btn-ghost:hover {
 border-color: var(--border-strong); color: var(--text); }

.btn-block {
 width: 100%; }

/* --- hero на главной --- */
.hero {
    position: relative; overflow: hidden;
    margin: 4px 0 32px; padding: clamp(28px, 5vw, 56px);
    border-radius: var(--radius-lg);
    background: #3B4951;
background: radial-gradient(circle farthest-corner at center center, #3B4951 0%, #000000 100%);
}

.hero h1 {
 color: #fff; font-size: clamp(28px, 4vw, 44px); margin: 0 0 12px; max-width: 720px; }

.hero h1.hero-logo {
 max-width: none; margin: 4px 0 18px; }

.hero-logo img {
 display: block; width: clamp(150px, 26vw, 340px); height: auto; }
.hero p { margin: 0 0 14px; font-size: 17px; color: #94a3b8; max-width: 620px; }
.hero-eyebrow {
    display: inline-block; margin-bottom: 12px; padding: 4px 12px; border-radius: 999px;
    background: #3B4951;
background: radial-gradient(circle farthest-corner at center center, #3B4951 0%, #000000 100%);
    font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #cbd5e1;
}

/* hero на десктопе: слоган крупно по центру колонки, мобильная раскладка не меняется */
@media (min-width: 901px) {
    .cascade-crumbs {
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
    margin-bottom: 6px; font-size: 12px; color: var(--muted);
    }
    .cascade-crumbs a { color: var(--muted); }
    .cascade-crumbs a:hover { color: var(--accent); }
    .cascade-crumbs .sep { margin: 0 4px; color: var(--border-strong); }

    .hero {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(260px, 430px);
        grid-template-areas:
            "eyebrow lead"
            "logo    lead"
            "cta     lead";
        align-items: start;
        column-gap: clamp(32px, 5vw, 80px);
    }
    .hero-eyebrow { grid-area: eyebrow; justify-self: start; }
    .hero-logo { grid-area: logo; }
    .hero p {
        grid-area: lead; align-self: center;
        margin: 0; max-width: none;
        font-size: clamp(1.25rem, 3.529vw - 0.985rem, 3rem); line-height: 1.2;
        text-align:right; color: #cbd5e1; text-wrap: balance;
    }
    .hero .btn { grid-area: cta; justify-self: start; }
}

/* === десктоп: левая колонка категорий и каскадная навигация (разделы 1-4 тз) === */
@media (min-width: 901px) {
    
.mobile-only {
 display: none; }
    .desktop-only { display: block; }
    .desktop-only.catalogs-link { display: inline-flex; }
    .desktop-hidden { display: none; }

    /* левая колонка на всю высоту окна, своя прокрутка, не часть document flow */
    
.cascade-rail {
        display: block;
        position: fixed; z-index: 20; top: var(--header-h); bottom: 0;
        left: max(0px, calc((100vw - var(--content-width)) / 2));
        width: var(--rail-w); overflow-y: auto; overscroll-behavior: contain;
        background: var(--panel); border-right: 1px solid var(--border);
        padding: 16px 12px; scrollbar-width: thin;
    }
    main.container--with-rail { padding-left: calc(var(--rail-w) + 24px); }

    
.cascade-root {
 display: flex; flex-direction: column; gap: 2px; }

    
.cascade-node {
 display: flex; flex-direction: column; }
    
.cascade-node-head {

        display: flex; align-items: center; justify-content: space-between; gap: 8px;
        width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius-sm);
        background: none; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 500;
        text-align: left; cursor: pointer;
        transition: background .15s var(--ease), color .15s var(--ease);
    }
    
.cascade-node-head:hover {
 background: var(--panel-2); color: var(--text); }
    
.cascade-node-head.is-active {
 background: var(--accent-soft); color: var(--accent); font-weight: 600; }
    .cascade-node-chev { color: var(--muted); font-size: 11px; transition: transform .2s var(--ease); }
    .cascade-node-head.is-active .cascade-node-chev, .cascade-node-head[aria-expanded="true"] .cascade-node-chev { transform: rotate(90deg); color: inherit; }

    /* дропдаун-аккордеон раскрывается под кнопкой узла, толкает содержимое вниз */
    
.cascade-dropdown[hidden] {
 display: none; }
    
    .cascade-dropdown-list {
 display: flex; flex-direction: column; gap: 3px; padding: 3px 0 8px 12px; }
    
.cascade-dropdown-item {

        display: block; padding: 7px 10px; border-left: 2px solid var(--border-strong);
        border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
        background: var(--panel-2); color: var(--text-2); font-size: 13px;
        transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
    }
    
    .cascade-dropdown-item:hover {
 background: var(--accent-soft); border-left-color: var(--accent); color: var(--accent); }
    
.cascade-dropdown-item.is-active {
 background: var(--accent-soft); border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
    
.cascade-empty {
 padding: 10px 12px; font-size: 13px; }

    /* колонки каскада справа от rail: горизонтальный скролл при нехватке места */
    
.cascade-columns {

        display: flex; align-items: stretch; gap: 16px;
        margin: 0 0 32px; padding-bottom: 4px;
        overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin;
    }
    .cascade-columns:empty { display: none; }
    
.cascade-column {

        flex: 0 0 300px; display: flex; flex-direction: column;
        max-height: calc(100vh - var(--header-h) - 48px);
        background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
        box-shadow: var(--shadow-xs); overflow: hidden;
        animation: cascade-col-in .18s var(--ease);
    }
    @keyframes cascade-col-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
    
.cascade-column-head {

        padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--panel-2);
    }
    
.cascade-column-title {
 font-size: 14px; font-weight: 600; color: var(--text); }
    
.cascade-column-body {
 flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px; scrollbar-width: thin; }
    
.cascade-children {
 display: flex; flex-direction: column; gap: 2px; }
    
.cascade-empty-products {
 margin: 8px; padding: 24px 16px; font-size: 13px; }
    .cascade-column .pagination { margin-top: 12px; }

    /* hero скрывается, как только пошёл поиск или раскрыт хотя бы один узел каскада */
    body.search-active .hero, body.cascade-active .hero { display: none; }
    body.cascade-active .cascade-placeholder { display: block; margin-top: 24px; }
    .cascade-placeholder { margin-top: 24px; }
    .search-reset { margin-top: 16px; }

    /* === переиспользуемый компонент строки-дропдауна (каскад листа + поиск) === */
    .prow-list { display: flex; flex-direction: column; gap: 6px; }
    .prow { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); overflow: hidden; }
    .prow-head {
        display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px;
        padding: 10px 12px; border: 0; background: none; cursor: pointer; text-align: left;
        font: inherit; color: var(--text);
        transition: background .15s var(--ease);
        
    }
    .prow-head:hover { background: var(--panel-2); }
    .prow[x-data] .prow-head[aria-expanded="true"] { background: var(--accent-soft); }
    .prow-path {
        flex: none; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        color: var(--muted); font-size: 12px;
    }
    .prow-main {
        flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 10px;
        overflow: hidden; white-space: nowrap;
    }
    .prow-main .product-brand { flex: none; }
    .prow-name { flex: 0 1 auto; min-width: 60px; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 500; }
    .prow-specs { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 12px; }
    .prow-spec { white-space: nowrap; }
    .prow-spec + .prow-spec::before { content: "·"; margin: 0 6px; color: var(--border-strong); }
    .prow-sku { flex: none; color: var(--muted); font-size: 12px; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
    .prow-price { flex: none; font-weight: 700; white-space: nowrap; }
    .prow-chev { flex: none; color: var(--muted); font-size: 12px; transition: transform .2s var(--ease); }
    .prow-head[aria-expanded="true"] .prow-chev { transform: rotate(180deg); }
    .prow-body { border-top: 1px solid var(--border); }
    .prow-body-inner { padding: 16px; }
    .prow-loading { margin: 0; color: var(--muted); font-size: 13px; }

    /* карточка товара внутри строки-дропдауна */
    .pcard { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: start; }
    .pcard-main { display: flex; gap: 16px; min-width: 0; }
    .pcard-photo {
        flex: none; display: block; width: 120px; height: 120px; padding: 0; cursor: zoom-in;
        background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
    }
    .pcard-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
    .pcard-body { min-width: 0; }
    .spec-table-compact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); }
    .spec-table-compact tbody, .spec-table-compact tr { display: contents; }
    .spec-table-compact th, .spec-table-compact td { background: var(--panel); border-bottom: 0; padding: 8px 12px; font-size: 13px; }
    .spec-table-compact th { width: auto; font-weight: 500; }
    .pcard-permalink { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 500; }
    .pcard-side {
        display: flex; flex-direction: column; gap: 10px; padding: 16px;
        background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    }
    .pcard-side .price-label { color: var(--muted); font-size: 12px; }
    .pcard-side .price { font-size: 22px; }
    .qty-stepper input:focus { outline: none; }
    .qty-stepper { display: flex; align-items: stretch; height: 36px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
    .qty-stepper button {
        flex: none; width: 32px; border: 0; background: var(--panel-2); color: var(--text-2);
        font-size: 16px; cursor: pointer; transition: background .15s var(--ease);
    }
    .qty-stepper button:hover { background: var(--border); }
    .qty-stepper input {
        flex: 1; min-width: 0; border: 0; text-align: center; font: inherit; font-size: 14px;
        background: var(--panel); color: var(--text);
    }
    .qty-stepper input:focus { outline: none; }
    .pcard-side .note { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
    
}

/* количество внутри кнопки (как у inpo.ru) */
.incart-btn { width: 100%; justify-content: space-between; padding: 6px 8px 6px 4px; gap: 6px; }
.incart-qty { display: inline-flex; align-items: center; gap: 0; min-width: 0; }
.incart-qty-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 6px; cursor: pointer; user-select: none;
    font-size: 15px; line-height: 1; color: rgba(255,255,255,.75); transition: background .15s var(--ease);
}
.incart-qty-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.incart-qty-input {
    width: 2.2em; min-width: 0; border: 0; padding: 2px; text-align: center;
    background: rgba(255,255,255,.12); border-radius: 6px;
    color: #fff; font: inherit; font-weight: 700; font-size: 14px;
    appearance: textfield; -moz-appearance: textfield;
}
.incart-qty-input::-webkit-outer-spin-button,
.incart-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.incart-qty-input:focus { outline: none; background: rgba(255,255,255,.22); }
.incart-sep { flex: none; width: 1px; align-self: stretch; background: rgba(255,255,255,.25); }
@media (max-width: 560px) {
    .incart-qty-btn { width: 32px; height: 32px; font-size: 17px; }
    .incart-qty-input { font-size: 15px; }
}

/* --- плитки категорий --- */
.category-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
    list-style: none; margin: 0; padding: 0;
}
.category-tile {
    position: relative; display: flex; flex-direction: column; gap: 6px;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 20px 18px; color: var(--text); box-shadow: var(--shadow-xs);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
a.category-tile:hover, .category-tile:has(> .category-tile-title:hover) {
    color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: transparent;
}
.category-tile h2, .category-tile-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--text); padding-right: 28px; }
.category-tile-title:hover { color: var(--accent); }
.category-tile .meta { color: var(--muted); font-size: 13px; }
.category-tile .arrow {
    position: absolute; top: 18px; right: 18px; width: 28px; height: 28px;
    display: grid; place-items: center; border-radius: 999px;
    background: var(--panel-2); color: var(--muted); font-size: 14px;
    transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
a.category-tile:hover .arrow { background: var(--accent); color: #fff; transform: translateX(2px); }
.category-children { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.category-children a {
    display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px;
    background: var(--panel-2); color: var(--text-2); border: 1px solid var(--border);
}
.category-children a:hover { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

.subcategories { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 24px; }
.subcategory {
    display: inline-flex; align-items: center; padding: 7px 14px; background: var(--panel);
    border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); font-weight: 500; font-size: 14px;
    box-shadow: var(--shadow-xs);
    transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.subcategory:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* --- раскладка категории --- */
.catalog-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }

/* --- фильтры --- */
.filters {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-xs);
    position: sticky; top: calc(var(--header-h) + 16px);
    max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin;
}
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.filters-head strong { font-size: 16px; }
.filters-head .reset { font-size: 13px; font-weight: 500; }
.filters-close { display: none; }
.filters-toggle { display: none; }

.facet { border-top: 1px solid var(--border); }
.facet-head {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    background: none; border: 0; padding: 12px 0; cursor: pointer;
    font: inherit; font-size: 14px; font-weight: 600; color: var(--text); text-align: left;
}
.facet-head:hover { color: var(--accent); }
.facet-head .chev { color: var(--muted); font-size: 12px; transition: transform .2s var(--ease); }
.facet-head .chev.up { transform: rotate(180deg); }
.facet-body { padding: 0 0 12px; }

.facet-opt {
    display: flex; align-items: center; gap: 10px; padding: 5px 6px; margin: 0 -6px;
    border-radius: 6px; cursor: pointer; font-size: 14px; transition: background .12s var(--ease);
}
.facet-opt:hover { background: var(--panel-2); }
.facet-opt input[type="checkbox"] { margin: 0; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.facet-opt:has(input:disabled) { cursor: default; }
.facet-opt:has(input:disabled):hover { background: none; }
.facet-opt input:disabled ~ .facet-label { color: var(--border-strong); }
.facet-opt input:disabled ~ .facet-count { opacity: .5; }
.facet-label { flex: 1; color: var(--text-2); }
.facet-opt input:checked ~ .facet-label { color: var(--text); font-weight: 500; }
.facet-count {
    min-width: 24px; padding: 0 6px; border-radius: 999px; text-align: center;
    background: var(--panel-2); color: var(--muted); font-size: 12px; line-height: 20px;
}

.facet-range { display: flex; align-items: center; gap: 8px; color: var(--muted); }

.field, .facet-range input, .sort-field select {
    width: 100%; min-width: 0; padding: 8px 10px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--panel);
    font: inherit; font-size: 14px; color: var(--text);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.facet-range input:hover, .sort-field select:hover { border-color: var(--border-strong); }
.facet-range input:focus, .sort-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }

.sort-field { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 2px; font-size: 14px; font-weight: 600; }
.sort-field select { cursor: pointer; font-weight: 400; }

/* --- результаты --- */
.results { position: relative; min-width: 0; }
.results-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 16px; min-height: 36px; }
.results-count { margin: 0; color: var(--muted); }
.results-count strong { color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--accent-soft); color: var(--accent);
    border: 1px solid transparent; border-radius: 999px; padding: 5px 8px 5px 12px; font-size: 13px; font-weight: 500;
    transition: background .15s var(--ease), border-color .15s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip-x {
    display: grid; place-items: center; width: 18px; height: 18px; border-radius: 999px;
    background: var(--accent-tint); font-weight: 700; font-size: 12px; line-height: 1;
}
.chip-reset { background: transparent; color: var(--muted); border-color: var(--border); padding-right: 12px; }
.chip-reset:hover { color: var(--text); border-color: var(--border-strong); }

/* индикатор загрузки htmx: тонкая полоса + приглушение результатов */
.loading {
    position: absolute; left: 0; right: 0; top: -10px; height: 3px; overflow: hidden; border-radius: 3px;
    background: var(--accent-soft);
}
.loading::after {
    content: ""; position: absolute; inset: 0; width: 40%;
    background: var(--accent); border-radius: 3px;
    animation: loading-bar 1s var(--ease) infinite;
}
@keyframes loading-bar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }
.catalog-layout.htmx-request .product-grid,
.catalog-layout:has(.htmx-request) .product-grid { opacity: .55; transition: opacity .2s var(--ease); pointer-events: none; }

/* --- карточки товаров --- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; transition: opacity .2s var(--ease); }
.product-card {
    position: relative; display: flex; flex-direction: column; background: var(--panel);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
    box-shadow: var(--shadow-xs);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}

.product-card:hover {
 transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: transparent; }

.product-card-link {
 color: var(--text); }

.product-card-link:hover {
 color: var(--accent); }
/* вся карточка кликабельна */
.product-card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
/* значок «есть фото» на карточке */
.photo-badge { display: inline-block; vertical-align: -2px; margin-left: 6px; color: var(--muted); }

/* небольшое фото на странице товара, по клику — модалка */

.product-photo {

    display: block; width: 200px; max-width: 100%; margin: 0 0 16px; padding: 0; cursor: zoom-in;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.product-photo img { display: block; width: 100%; height: auto; }

.product-photo:hover {
 border-color: var(--accent); }
.product-photo:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* модальное окно с изображением: 500px на десктопе, 300px на мобильных */
.image-modal {
    width: 500px; max-width: calc(100vw - 32px); padding: 0; border: 0;
    border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-md); overflow: visible;
}
.image-modal::backdrop { background: rgba(16, 24, 40, .6); }
.image-modal img { display: block; width: 100%; height: auto; max-height: 80vh; object-fit: contain; border-radius: inherit; }
.image-modal-close {
    position: absolute; top: -12px; right: -12px; width: 32px; height: 32px; padding: 0;
    border: 0; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 20px; line-height: 1; cursor: pointer;
}
.image-modal-close:hover { background: var(--accent); }
@media (max-width: 560px) {
    .image-modal { width: 300px; }
    .image-modal-close { top: -10px; right: -10px; }
}

.product-brand {
    display: inline-block; color: var(--muted); font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .08em;
}
.product-name {
    font-size: 15px; font-weight: 600; line-height: 1.35; margin: 6px 0 12px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.product-specs { margin: 0 0 16px; font-size: 13px; }
.product-specs div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.product-specs div:last-child { border-bottom: 0; }
.product-specs dt { color: var(--muted); margin: 0; }
.product-specs dd { margin: 0; text-align: right; color: var(--text-2); font-weight: 500; }
.product-foot {
    margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.sku { color: var(--muted); font-size: 12px; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.price { font-size: 17px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; color: var(--text); }

/* --- пагинация --- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 28px; }
.pagination a {
    padding: 8px 16px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border);
    color: var(--text-2); font-weight: 500; box-shadow: var(--shadow-xs);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.page-info { color: var(--muted); font-size: 13px; padding: 0 8px; }

/* --- страница товара --- */
.product-detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; margin-top: 8px; }

.product-detail-main h1 {
 margin-top: 6px; }
.product-detail-main .sku {
    display: inline-block; padding: 3px 10px; border-radius: 6px;
    background: var(--panel); border: 1px solid var(--border);
}
.product-detail-side { position: sticky; top: calc(var(--header-h) + 16px); }

.product-detail-side .price-box {

    background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg); padding: 22px; display: flex; flex-direction: column; gap: 14px;
}
.price-box .price-label { color: var(--muted); font-size: 13px; margin-bottom: -10px; }
.product-detail-side .price { font-size: 28px; }
.price-box .note { margin: 0; color: var(--muted); font-size: 13px; }
.description { color: var(--text-2); max-width: 760px; }


.spec-table {

    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow-xs); font-size: 14px;
}
.spec-table th, .spec-table td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: 0; }
.spec-table tr:nth-child(even) th, .spec-table tr:nth-child(even) td { background: var(--panel-2); }
.spec-table th { width: 40%; max-width: 320px; color: var(--muted); font-weight: 500; }
.spec-table td { color: var(--text); font-weight: 500; }

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

.site-footer {
 border-top: 1px solid var(--border); background: var(--panel); color: var(--muted); font-size: 13px; padding: 20px 0; }

.site-footer p {
 margin: 0; }

/* --- поиск в шапке --- */
.site-search { position: relative; flex: 1; max-width: 560px; margin: 0 8px; }

.site-search input {

    width: 100%; height: 42px; padding: 0 70px 0 42px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--panel-2);
    font: inherit; font-size: 14px; color: var(--text);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.site-search input::placeholder { color: var(--muted); }
.site-search input::-webkit-search-cancel-button { cursor: pointer; }
.site-search input:hover { border-color: var(--border-strong); }
.site-search input:focus { outline: none; background: var(--panel); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }

.site-search-icon {

    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    display: grid; color: var(--muted); pointer-events: none;
}
.site-search-kbd {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    min-width: 22px; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
    border-radius: 6px; background: var(--panel); color: var(--muted);
    font: 600 12px/18px ui-monospace, Consolas, monospace; text-align: center; pointer-events: none;
}
.site-search input:focus ~ .site-search-kbd { display: none; }
.site-search-spinner {
    position: absolute; right: 44px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
    border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%;
    opacity: 0; pointer-events: none;
}
.site-search.htmx-request .site-search-spinner { opacity: 1; animation: spin .7s linear infinite; }
.site-search.htmx-request input:focus ~ .site-search-spinner { right: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }


.search-panel {

    position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 60;
    max-height: min(70vh, 520px); overflow-y: auto; overscroll-behavior: contain;
    padding: 6px; background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 16px 40px -8px rgba(16, 24, 40, .22), 0 4px 10px -4px rgba(16, 24, 40, .08);
}

.search-panel:empty {
 display: none; }

.suggest-group + .suggest-group {
 margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }

.suggest-title {
 padding: 8px 10px 4px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.suggest-item {

    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
    color: var(--text); font-size: 14px; scroll-margin: 6px;
}

.suggest-item:hover, .suggest-item.is-active {
 background: var(--accent-soft); color: var(--text); }
.suggest-icon {
    display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px;
    background: var(--panel-2); color: var(--muted);
}
.suggest-item.is-active .suggest-icon, .suggest-item:hover .suggest-icon { background: var(--panel); color: var(--accent); }

.suggest-text {
 flex: 1; min-width: 0; display: flex; flex-direction: column; }

.suggest-name {
 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

.suggest-meta {
 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }

.suggest-price {
 flex: none; font-weight: 700; white-space: nowrap; }
.suggest-all {
    justify-content: center; gap: 6px; margin-top: 4px; border-top: 1px solid var(--border);
    border-radius: 0 0 8px 8px; color: var(--accent); font-weight: 600;
}
.suggest-all:hover, .suggest-all.is-active { color: var(--accent-hover); }

.suggest-count {
 padding: 0 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; line-height: 18px; }

.suggest-empty {
 padding: 18px 12px; text-align: center; color: var(--muted); font-size: 14px; }

mark { background: var(--mark-bg); color: var(--mark-text, inherit); border-radius: 3px; padding: 0 1px; }
.product-category { display: block; margin-bottom: 4px; color: var(--accent); font-size: 12px; font-weight: 500; }

/* Скрытые колонки слева от «предыдущей» */
.cascade-column.is-collapsed { display: none; }

/* Левая панель основных категорий в режиме листа */
body.cascade-leaf .cascade-root { display: none; }

/* Колонка с товарами занимает всё оставшееся место */
#cascade-columns.has-leaf .cascade-column[data-leaf="1"] {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: none;
}

    /* === режим листа: колонка с товарами занимает всё место === */

    /* колонки левее «предыдущей» скрыты (остаются в DOM, чтобы pruneBelow работал как раньше) */
    .cascade-column.is-collapsed { display: none; }

    /* колонка с товарами растягивается на всю свободную ширину */
    .cascade-columns.has-leaf .cascade-column[data-leaf="1"] {
        flex: 1 1 0;
        min-width: 0;
    }

 

    /* колонка листа выше: больше строк товаров на экране */
    .cascade-columns.has-leaf .cascade-column[data-leaf="1"] {
        max-height: calc(100vh - var(--header-h) - 32px);
    }

/* --- адаптив --- */

@media (max-width: 900px) {

    .catalog-layout { grid-template-columns: 1fr; }

    .filters-toggle { display: inline-flex; }
    .filters-backdrop {
        position: fixed; inset: 0; z-index: 40; background: rgba(15, 23, 42, .45);
        backdrop-filter: blur(2px);
    }
    .filters {
        position: fixed; z-index: 50; top: 0; bottom: 0; left: 0;
        width: min(340px, 88vw); max-height: none;
        border-radius: 0 var(--radius-lg) var(--radius-lg) 0; border: 0;
        box-shadow: var(--shadow-md);
        transform: translateX(-105%); transition: transform .25s var(--ease);
    }
    .filters.is-open { transform: none; }
    .filters-close {
        display: grid; place-items: center; width: 32px; height: 32px; border-radius: 999px;
        border: 0; background: var(--panel-2); color: var(--text-2); font-size: 18px; cursor: pointer;
    }
    .filters-head { gap: 12px; }
    .filters-head strong { flex: 1; }

    .product-detail { grid-template-columns: 1fr; gap: 20px; }
    .product-detail-side { position: static; }
}


@media (max-width: 760px) {

    .header-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; row-gap: 10px; }
    .site-search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
    .site-search-kbd { display: none; }
}

@media (max-width: 560px) {
    .container { padding: 0 14px; }
    .main-nav a { padding: 8px 10px; }
    .logo-img { height: 28px; }
    .product-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .product-card { padding: 12px; }
    .product-name { font-size: 14px; }
    .product-specs { display: none; }
    .product-foot { flex-direction: column; align-items: flex-start; gap: 2px; }
    .price { font-size: 15px; }
    .spec-table th { width: 45%; }
}


@media (prefers-reduced-motion: reduce) {

    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
