/* =========================================================
   TELEGRAM MOBILE SAFE AREA
   Единый мобильный слой поверх существующей вёрстки.
   В fullscreen Telegram оставляет служебные области, которые
   нельзя перекрывать обычным position: fixed интерфейсом.
   ========================================================= */

:root {
    --app-telegram-top-extra: 28px;
    --app-telegram-bottom-extra: 8px;
    --app-bottom-navigation-height: 70px;
}

@media (max-width: 699px) {

    html,
    body {
        width: 100%;
        min-height: 100%;
    }

    /* ---------- ВЕРХ ---------- */

    .header {
        padding-top: calc(
            16px + var(--app-telegram-top-extra) +
            var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px))
        ) !important;
    }

    .favorites-header,
    .profile-header,
    .admin-header,
    .cart-page,
    .order-page {
        padding-top: calc(
            16px + var(--app-telegram-top-extra) +
            var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px))
        ) !important;
    }

    
    .product-header {
        min-height: calc(
            72px +
            var(--app-telegram-top-extra) +
            var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px))
        ) !important;

        padding-top: calc(
            24px +
            var(--app-telegram-top-extra) +
            var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px))
        ) !important;

        box-sizing: border-box !important;
    }


    /* Страницы со своими заголовками */
    .orders-header {
        padding-top: calc(
            16px + var(--app-telegram-top-extra) +
            var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px))
        ) !important;
    }

    /* ---------- НИЗ ---------- */

    .bottom-navigation {
        bottom: 8px !important;
        height: var(--app-bottom-navigation-height) !important;
    }

    body {
        padding-bottom: calc(
            var(--app-bottom-navigation-height) +
            var(--app-telegram-bottom-extra) +
            24px +
            var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))
        ) !important;
    }

    .catalog,
    .favorites-page,
    .profile-page,
    .orders-page,
    .order-page,
    .cart-page {
        padding-bottom: calc(
            var(--app-bottom-navigation-height) +
            var(--app-telegram-bottom-extra) +
            28px +
            var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))
        ) !important;
    }

    /* Страница товара: фиксированная кнопка тоже выше служебной зоны. */
    .bottom-cart {
        bottom: 8px !important;
    }

    /* Чтобы контент товара не уходил под нижнюю кнопку. */
    .product-page {
        padding-bottom: calc(
            100px + var(--app-telegram-bottom-extra) +
            var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))
        ) !important;
    }
}


/* =========================================================
   VISUAL REFRESH — neutral warm palette + compact navigation
   ========================================================= */
:root {
    --app-accent: #72383D;
    --app-ink: #322D29;
    --app-background: #D9D9D9;
    --app-surface: #FFFFFF;
    --app-muted: #BDBDBD;
}

html, body {
    font-family: "Plus Jakarta Sans", Arial, sans-serif;
}

body {
    background: var(--app-background);
    color: var(--app-ink);
}

.header {
    background: var(--app-background);
    border-bottom-color: rgba(50, 45, 41, 0.12);
}

.header h1,
.favorites-header h1,
.profile-header h1,
.orders-header h1 {
    color: var(--app-ink);
    letter-spacing: -0.035em;
    font-weight: 700;
}

.filters-section {
    background: var(--app-background);
    border-bottom-color: rgba(50, 45, 41, 0.14);
}

.filters-container {
    padding-top: 10px;
    padding-bottom: 10px;
}

.filter-button {
    color: var(--app-ink) !important;
    border-color: rgba(50, 45, 41, 0.25);
    background: rgba(255, 255, 255, 0.78);
    border-radius: 10px;
    font-weight: 500;
    box-shadow: none;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.filter-button:hover,
.filter-button:focus-visible,
.filter-button[aria-expanded="true"] {
    color: var(--app-accent) !important;
    border-color: var(--app-accent);
    background: #FFFFFF;
    outline: none;
}



.filter-dropdown {
    border-color: rgba(50, 45, 41, 0.14);
    border-radius: 12px;
}

.filter-search:focus {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 2px rgba(114, 56, 61, .12);
}

.filter-option:has(input:checked) {
    background: rgba(114, 56, 61, .09);
    color: var(--app-accent);
}

.reset-button {
    background: var(--app-ink);
    color: #FFFFFF;
    border-radius: 10px;
    font-weight: 600;
}

.reset-button:hover,
.reset-button:focus-visible {
    background: var(--app-accent);
}

.gender-buttons {
    gap: 6px;
    margin-top: 12px;
}

.gender-button {
    background: #C8C8C8;
    color: var(--app-ink);
    border-radius: 10px;
    font-family: inherit;
    font-weight: 600;
}

.gender-button:hover {
    background: #BEBEBE;
}

.gender-button.selected {
    background: var(--app-accent);
    color: #FFFFFF;
    box-shadow: 0 3px 10px rgba(114, 56, 61, .18);
}

.bottom-navigation {
    height: 64px;
    bottom: 8px !important;
    padding: 4px 8px;
    background: rgba(255, 255, 255, .97);
    border: 1px solid rgba(50, 45, 41, .12);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -5px 22px rgba(50, 45, 41, .08);
    justify-content: space-around;
    gap: 4px;
}

.bottom-nav-button {
    height: 52px;
    min-width: 0;
    flex: 1 1 0;
    flex-direction: row;
    border-radius: 13px;
    color: var(--app-ink);
    background: transparent;
    opacity: .68;
    transition: background-color .18s ease, color .18s ease, opacity .18s ease, transform .1s ease;
}

.bottom-nav-button:hover {
    background: rgba(114, 56, 61, .08);
    color: var(--app-accent);
    opacity: 1;
}

.bottom-nav-button:active {
    transform: scale(.94);
}

.bottom-nav-button.active,
.bottom-nav-button.current {
    color: var(--app-accent) !important;
    background: rgba(114, 56, 61, .12) !important;
    opacity: 1 !important;
}

.bottom-nav-button.current {
    pointer-events: none;
    cursor: default;
}

.bottom-nav-icon {
    display: none !important;
}

.bottom-nav-text {
    display: none !important;
}

.bottom-nav-lucide {
    display: inline-flex;
    width: 25px;
    height: 25px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.bottom-nav-lucide svg {
    display: block;
    width: 24px;
    height: 24px;
    stroke-width: 1.8;
}

.products-grid {
    gap: 10px;
}

.product-card {
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(50, 45, 41, .035);
}

/* MOBILE NAVIGATION — единственный управляющий блок */
@media (max-width: 699px) {
    :root {
        --app-bottom-navigation-height: 62px;
    }

    .bottom-navigation {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;

        height: calc(
            var(--app-bottom-navigation-height) +
            var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))
        ) !important;

        padding: 4px 10px calc(
            12px +
            var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))
        ) !important;

        box-sizing: border-box !important;
        margin: 0 !important;
        z-index: 1000 !important;

        background: #FFFFFF !important;
        border-radius: 16px 16px 0 0 !important;
    }

    .bottom-nav-button {
        display: flex !important;
        flex: 1 1 0;
        min-width: 0;
        height: 48px !important;

        align-items: center;
        justify-content: center;
    }

    .bottom-nav-icon,
    .bottom-nav-text {
        display: none !important;
    }

    .bottom-nav-lucide {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    body {
        padding-bottom: calc(
            var(--app-bottom-navigation-height) +
            var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) +
            16px
        ) !important;
    }

    .catalog,
    .favorites-page,
    .profile-page,
    .orders-page,
    .order-page,
    .cart-page {
        padding-bottom: calc(
            var(--app-bottom-navigation-height) +
            var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) +
            24px
        ) !important;
    }
}


/* V3: nav reaches the screen edge; no strip of catalog visible below it. */
.bottom-navigation { z-index: 1000; }
.bottom-nav-button { display:flex; align-items:center; justify-content:center; text-decoration:none; }
.bottom-nav-button > svg, .bottom-nav-button > i, .bottom-nav-button svg { width:24px; height:24px; }
.bottom-nav-button.active, .bottom-nav-button.current { pointer-events:none; }
@media (max-width: 699px) {
  :root { --app-telegram-top-extra: 6px; --app-telegram-bottom-extra: 0px; --app-bottom-navigation-height: 62px; }
  .header { padding-top: calc(8px + var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px))) !important; padding-bottom: 10px !important; }
  .header h1 { display:none !important; }
  .bottom-navigation { position:fixed !important; left:0 !important; right:0 !important; bottom:0 !important; height:calc(var(--app-bottom-navigation-height) + var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))) !important; padding:4px 10px calc(4px + var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))) !important; border-radius:16px 16px 0 0 !important; margin:0 !important; box-sizing:border-box !important; background:#fff !important; }
  body { padding-bottom:calc(var(--app-bottom-navigation-height) + var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))) !important; }
  .catalog, .favorites-page, .profile-page, .orders-page, .order-page, .cart-page { padding-bottom:calc(var(--app-bottom-navigation-height) + var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + 12px) !important; }
}

@media (max-width: 699px) {
    .header {
        padding-top: calc(
            8px +
            var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px))
        ) !important;
    }

    .gender-buttons {
    position: relative;
    z-index: 1;

    margin-top: 40px !important;
    margin-bottom: 8px !important;
    }

    .gender-button {
        min-height: 48px;
    }
}

@media (max-width: 699px) {
    .bottom-navigation > .bottom-nav-button {
        position: relative;
        top: -7px;
    }
}

/* =========================================================
   ФИЛЬТРЫ КАТАЛОГА — MINIMAL FASHION
   ========================================================= */

.filter-button {
    min-height: 40px;
    padding: 9px 12px;

    color: #322D29 !important;
    background: #FFFFFF !important;
    border: 1px solid #E3DEDA !important;
    border-radius: 10px !important;

    font-size: 13px;
    font-weight: 500;

    box-shadow: none !important;
    transition:
        background-color .18s ease,
        border-color .18s ease,
        color .18s ease;
}

.filter-button:hover,
.filter-button:focus-visible,
.filter-button[aria-expanded="true"] {
    color: #72383D !important;
    background: #F7F0F0 !important;
    border-color: #72383D !important;
    outline: none;
}



/* Выпадающее окно */
.filter-dropdown {
    padding: 8px;
    background: #FFFFFF !important;

    border: 1px solid #E8E2DE !important;
    border-radius: 14px !important;

    box-shadow: 0 10px 30px rgba(50, 45, 41, 0.10) !important;
}

/* Пункты списка */
.filter-option {
    min-height: 40px;
    padding: 10px 9px;

    border-radius: 8px;
    color: #322D29;
    font-size: 13px;

    transition:
        background-color .15s ease,
        color .15s ease;
}

.filter-option:hover {
    background: #F7F4F2 !important;
}

/* Выбранный пункт */
.filter-option:has(input:checked) {
    background: #F7F0F0 !important;
    color: #72383D !important;
}

/* Чекбоксы */
.filter-option input {
    accent-color: #72383D;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Поиск внутри фильтра */
.filter-search {
    border: 1px solid #E3DEDA;
    border-radius: 8px;
    background: #FAF9F8;
    color: #322D29;
}

.filter-search:focus {
    border-color: #72383D;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(114, 56, 61, 0.08);
}

/* Мобильный экран */
@media (max-width: 699px) {
    .filter-button {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 12px;
        border-radius: 9px !important;
    }

    .filter-dropdown {
        border-radius: 12px !important;
    }
}

/* Исправление синего текста внутри фильтров */
.filter-dropdown,
.filter-dropdown button,
.filter-dropdown a,
.filter-dropdown label,
.filter-dropdown span,
.filter-dropdown div {
    color: #322D29;
}

/* Наведение и раскрытый пункт */
.filter-dropdown button:hover,
.filter-dropdown a:hover {
    color: #72383D;
}

/* Выбранные пункты с чекбоксами */
.filter-dropdown .filter-option:has(input:checked),
.filter-dropdown .filter-option:has(input:checked) span,
.filter-dropdown .filter-option:has(input:checked) label {
    color: #72383D !important;
}

/* Убираем стандартный синий цвет ссылок */
.filter-dropdown a,
.filter-dropdown a:visited,
.filter-dropdown a:active {
    color: #322D29 !important;
    text-decoration: none;
}

/* Кнопки вложенных типов */
.filter-dropdown button {
    font-family: inherit;
    font-weight: 500;
    -webkit-appearance: none;
    appearance: none;
}


/* =========================================================
   ОБНОВЛЕНИЕ ФИЛЬТРОВ КАТАЛОГА
   ========================================================= */

:root {
    --filter-background: #E5E5E5;
    --filter-border: #BDBDBD;
    --filter-text: #322D29;
    --filter-accent: #72383D;
    --filter-accent-hover: #5D2C31;
}

/* 1. Кнопки фильтров */
.filter-button {
    color: var(--filter-text) !important;
    background: var(--filter-background) !important;
    border: 1px solid var(--filter-border) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
}

/* Активный фильтр */
.filter-button:hover,
.filter-button:focus-visible,
.filter-button[aria-expanded="true"] {
    color: var(--filter-accent) !important;
    background: #DADADA !important;
    border-color: var(--filter-accent) !important;
}

/* 2. Выпадающие панели фильтров */
.filter-dropdown {
    background: var(--filter-background) !important;
    border: 1px solid var(--filter-border) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 22px rgba(50, 45, 41, 0.10) !important;
}

/* 3. Пункты внутри фильтров */
.filter-option {
    color: var(--filter-text) !important;
    border-radius: 8px;
}

.filter-option:hover {
    background: #DADADA !important;
}

.filter-option:has(input:checked) {
    color: var(--filter-accent) !important;
    background: #F0E5E5 !important;
}

/* 4. Поля поиска внутри фильтров */
.filter-search {
    color: var(--filter-text) !important;
    background: #F1F1F1 !important;
    border: 1px solid var(--filter-border) !important;
    border-radius: 8px !important;
}

.filter-search:focus {
    background: #FFFFFF !important;
    border-color: var(--filter-accent) !important;
    outline: none;
    box-shadow: 0 0 0 2px rgba(114, 56, 61, 0.10) !important;
}

/* 5. Кнопка «Сбросить» */
.filter-reset,
.reset-filters,
button[aria-label="Сбросить"],
button[title="Сбросить"] {
    color: #FFFFFF !important;
    background: var(--filter-accent) !important;
    border: 1px solid var(--filter-accent) !important;
    border-radius: 9px !important;
    font-weight: 500;
    box-shadow: none !important;
}

.filter-reset:hover,
.reset-filters:hover,
button[aria-label="Сбросить"]:hover,
button[title="Сбросить"]:hover {
    color: #FFFFFF !important;
    background: var(--filter-accent-hover) !important;
    border-color: var(--filter-accent-hover) !important;
}

/* 6. Цветовые образцы — скруглённые квадраты */
.color-swatch,
.color-option,
.color-circle,
.color-filter-item .color,
.color-filter-option .color {
    border-radius: 6px !important;
    border: 1px solid #AFAFAF !important;
    box-shadow: none !important;
}

/* Граница выбранного цвета */
.color-swatch:has(input:checked),
.color-option:has(input:checked),
.color-filter-item:has(input:checked) .color,
.color-filter-option:has(input:checked) .color {
    outline: 2px solid var(--filter-accent) !important;
    outline-offset: 2px;
}

/* Сохраняем размер образцов цвета */
.color-swatch,
.color-option,
.color-circle {
    flex-shrink: 0;
}

/* Полотно фильтра цветов */
#color-filter {
    width: 220px !important;
    max-width: calc(100vw - 32px);
    padding: 12px !important;
    box-sizing: border-box;

    background: #E5E5E5 !important;
    border: 1px solid #BDBDBD !important;
    border-radius: 12px !important;

    box-shadow: 0 8px 24px rgba(50, 45, 41, 0.14) !important;
}


/* =========================================================
   ЕДИНЫЙ ВЕРХНИЙ ОТСТУП ДЛЯ КНОПОК И ШАПОК
   ========================================================= */

:root {
    --app-catalog-top-spacing: 40px;
    --app-product-top-spacing: 15px;
}

@media (max-width: 699px) {
    .gender-buttons {
        margin-top: var(--app-catalog-top-spacing) !important;
    }

    .product-header .header-button {
        transform: translateY(var(--app-product-top-spacing)) !important;
    }
}

/* =========================================================
   ИЗБРАННОЕ — ИСПРАВЛЕНИЯ ДЛЯ ТЕЛЕФОНА
   ========================================================= */

@media (max-width: 699px) {

    /* Заголовок — бордовый */
    .favorites-header h1 {
        color: #72383D !important;
    }

    /* Убираем лишнее расстояние перед карточками */
    .favorites-page {
        padding-top: 4px !important;
    }

    .favorites-list {
        margin-top: 0 !important;
        row-gap: 12px;
    }

    /* Текст и цены */
    .favorite-card-name,
    .favorite-card-color,
    .favorite-card-size,
    .favorite-card-price,
    .favorites-section h2,
    .empty-favorites {
        color: #322D29 !important;
    }

    /* Кнопка корзины */
    .favorite-card-cart-button:not(:disabled) {
        background: #72383D !important;
        color: #FFFFFF !important;
        border-color: #72383D !important;
    }

    /* Сердце */
    .favorite-card-button {
        color: #72383D !important;
    }
}


/* =========================================================
   КОРЗИНА — МОБИЛЬНАЯ АДАПТАЦИЯ
   ========================================================= */

@media (max-width: 699px) {
    .cart-page {
        padding-top: calc(
            16px +
            var(--app-telegram-top-extra, 6px) +
            var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px))
        ) !important;
    }

    .cart-header {
        margin-top: 24px !important;
        margin-bottom: 14px !important;
    }

    .cart-header h1 {
        color: #72383D !important;
    }
}

/* =========================================================
   Страница заказов — МОБИЛЬНАЯ АДАПТАЦИЯ
   ========================================================= */

@media (max-width: 699px) {
    .orders-page {
        padding-top: calc(
            16px +
            var(--app-telegram-top-extra, 6px) +
            var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px))
        ) !important;
    }

    .orders-header {
        margin-top: -48px !important;
        margin-bottom: 24px !important;
    }

    .orders-header h1 {
        color: #322D29 !important;
        margin: 0 !important;
        line-height: 1.3 !important;
    }
}

/* =========================================================
   Страница заказа — МОБИЛЬНАЯ АДАПТАЦИЯ
   ========================================================= */

@media (max-width: 699px) {
    .order-page {
        padding-top: calc(
            16px +
            var(--app-telegram-top-extra, 6px) +
            var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px))
        ) !important;
    }

    .order-header {
        margin-top: 36px !important;
        margin-bottom: 24px !important;
    }

    .order-header h1 {
        color: #322D29 !important;
        margin: 0 !important;
        line-height: 1.3 !important;
    }
}

/* =========================================================
   ФИНАЛЬНАЯ НАСТРОЙКА ФИЛЬТРОВ КАТАЛОГА
   ========================================================= */

/* Бренд, Тип и Цвет имеют одинаковую ширину и одинаковую
   максимальную высоту. Размер сохраняет текущую ширину. */
#brand-filter,
#type-filter,
#color-filter {
    width: 220px !important;
    min-width: 220px !important;
    max-width: calc(100vw - 32px) !important;
    max-height: min(60vh, 360px) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* У фильтра размера сохраняем ширину, которая задаётся
   относительно кнопки «Размер», но ограничиваем высоту. */
#size-filter {
    max-height: min(60vh, 360px) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* Списки прокручиваются внутри полотна, а не растягивают его. */
#brand-options,
#type-options,
#size-options {
    min-height: 0 !important;
    max-height: 280px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #72383D #e8e4e2;
}

/* В фильтре цветов прокручивается сетка образцов. */
#color-options .color-options {
    max-height: 280px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #72383D #e8e4e2;
}

/* Единый вид полос прокрутки. */
#brand-options::-webkit-scrollbar,
#type-options::-webkit-scrollbar,
#size-options::-webkit-scrollbar,
#color-options .color-options::-webkit-scrollbar {
    width: 6px;
}

#brand-options::-webkit-scrollbar-thumb,
#type-options::-webkit-scrollbar-thumb,
#size-options::-webkit-scrollbar-thumb,
#color-options .color-options::-webkit-scrollbar-thumb {
    background: #72383D;
    border-radius: 8px;
}

/* Стрелки фильтров — на одной линии с подписью и бордовые. */
.filter-button {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px;
}

.filter-button .arrow {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: center !important;
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 0 !important;
    color: #72383D !important;
    font-size: 18px !important;
    line-height: 1 !important;
    transform: translateY(-1px);
}

/* В списке типов: «Одежда» — бордовым,
   «Поло и футболки» и сами типы — тёмным. */
#type-options .type-category-button,
#type-options .type-category-button > span:first-child {
    color: #72383D !important;
}

#type-options .type-subcategory-button,
#type-options .type-subcategory-button > span:first-child,
#type-options .type-items,
#type-options .type-items .filter-option,
#type-options .type-items .filter-option span {
    color: #322D29 !important;
}

/* Стрелки раскрытия внутри списка типов тоже бордовые. */
#type-options .type-arrow {
    color: #72383D !important;
    align-self: center;
    line-height: 1;
}


/* =========================================================
   HOTFIX V2 — ПРИОРИТЕТНЫЕ СТИЛИ МОБИЛЬНЫХ ФИЛЬТРОВ
   Добавлены в конец файла, чтобы перебить прежние правила.
   ========================================================= */

/* Стрелки в кнопках фильтров: единая линия, размер и цвет. */
.filters-section .filters-container > .filter > button.filter-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 7px !important;
}

.filters-section .filters-container > .filter > button.filter-button > span.arrow {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 12px !important;
    height: 16px !important;
    flex: 0 0 12px !important;
    margin: 0 0 0 2px !important;
    padding: 0 !important;
    color: #72383D !important;
    font-family: Arial, sans-serif !important;
    font-size: 21px !important;
    font-weight: 400 !important;
    line-height: 16px !important;
    text-align: center !important;
    position: relative !important;
    top: -1px !important;
    transform: none !important;
}

/* «Одежда» (категория) — бордовая. */
#type-filter #type-options .type-category-button,
#type-filter #type-options .type-category-button > span:first-child {
    color: #72383D !important;
}

/* «Поло и футболки» (подкатегория) — чёрная; названия типов — тоже. */
#type-filter #type-options .type-subcategory-button,
#type-filter #type-options .type-subcategory-button > span:first-child,
#type-filter #type-options .type-items,
#type-filter #type-options .type-items .filter-option,
#type-filter #type-options .type-items .filter-option > span {
    color: #322D29 !important;
}

/* Стрелки раскрытия категории и подкатегории. */
#type-filter #type-options .type-category-button > .type-arrow,
#type-filter #type-options .type-subcategory-button > .type-arrow {
    color: #72383D !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
}

#brand-filter,
#type-filter,
#color-filter {
    width: 220px !important;
    min-width: 220px !important;
    max-width: 220px !important;
    box-sizing: border-box !important;
}

/* =========================================================
   ЕДИНАЯ МАКСИМАЛЬНАЯ ВЫСОТА ПРОКРУЧИВАЕМЫХ СПИСКОВ
   Списки растут по содержимому, но не выше заданного лимита.
   У Brand лимит списка меньше на высоту строки поиска.
   ========================================================= */

:root {
    --filter-list-max-height: 280px;
    --brand-search-row-height: 44px;
}

/* Внешние полотна не прокручиваются сами. */
#brand-filter,
#type-filter,
#color-filter,
#size-filter {
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* Типы и размеры: естественная высота до общего максимума. */
#type-options,
#size-options {
    height: auto !important;
    max-height: var(--filter-list-max-height) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #72383D #e8e4e2;
}

/* Brand: список короче на высоту строки поиска.
   Это ограничение максимума, а не фиксированная высота. */
#brand-options {
    height: auto !important;
    max-height: calc(var(--filter-list-max-height) - var(--brand-search-row-height)) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex: 0 1 auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #72383D #e8e4e2;
}

/* Строка поиска имеет предсказуемую высоту, чтобы расчёт
   списка Brand не зависел от старых CSS-правил. */
#brand-search {
    flex: 0 0 var(--brand-search-row-height) !important;
    height: var(--brand-search-row-height) !important;
    min-height: var(--brand-search-row-height) !important;
    box-sizing: border-box !important;
}

/* В фильтре цвета прокручивается внутренняя сетка образцов,
   а не внешний #color-options. */
#color-options {
    height: auto !important;
    max-height: var(--filter-list-max-height) !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

#color-options .color-options {
    height: auto !important;
    max-height: var(--filter-list-max-height) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #72383D #e8e4e2;
}

/* Единый скроллбар для всех списков. */
#brand-options::-webkit-scrollbar,
#type-options::-webkit-scrollbar,
#size-options::-webkit-scrollbar,
#color-options .color-options::-webkit-scrollbar {
    width: 6px;
}

#brand-options::-webkit-scrollbar-thumb,
#type-options::-webkit-scrollbar-thumb,
#size-options::-webkit-scrollbar-thumb,
#color-options .color-options::-webkit-scrollbar-thumb {
    background: #72383D;
    border-radius: 8px;
}

/* Выравнивание стрелок фильтров по центру надписей */
.filters-section .filters-container > .filter > button.filter-button > span.arrow {
    position: static !important;
    align-self: center !important;
    transform: none !important;
    margin: 0 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Выравниваем текст фильтра и стрелку по вертикали */
.filter-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

/* Стрелка рядом с названием фильтра */
.filter-button .arrow {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: static !important;
    transform: none !important;
    margin: 0 0 0 8px !important;
    padding: 0 !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    color: #72383D !important;
}