:root {
    --im-layer-header-open: 2147483647;
    --im-layer-bottom-nav: 2147483647;
    --im-layer-overlay: 2147483645;
}

.im-header__logo--main svg {
    width: 220px;
    height: auto;
}

.im-header__logo--top svg {
    width: 204px;
    height: auto;
}

.im-header__logo--mobile {
    max-width: 236px;
}

@media (max-width: 600px) {
    .im-header__logo svg {
        width: 160px;
        height: auto;
    }
}

@media (max-width: 390px) {
    .im-header__logo--top svg {
        width: 156px;
        height: auto;
    }
}

.im-get-kp {
    height: 48px;
    background: var(--brand-600);
    color: var(--neutral-100);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: var(--font-sm-size);
    font-weight: 500;
    line-height: 150%;
    text-decoration: none;
    transition: all var(--transition-normal);
}
.im-goods__name {
    cursor: pointer;
}

.im-header__action-icon {
    position: relative;
}

.im-cart-count {
    position: absolute;
    top: -8px;
    right: -17px;
    z-index: 1;
    display: flex;
    width: 24px;
    min-width: 24px;
    height: 24px;
    padding: 2px 4px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-radius: var(--04, 6px);
    background: #FFDADA;
    color: #600;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    pointer-events: none;
}

.im-bottom-nav__badge.im-cart-count {
    top: -4px;
    right: -10px;
}

.im-cart-count--wide {
    width: auto;
    min-width: 28px;
}

.im-ready-solutions-page .im-goods__favorite .im-goods__favorite-fill {
    fill: transparent !important;
}

.im-ready-solutions-page .im-goods__favorite.is-active {
    background: var(--neutral-100) !important;
}

.im-ready-solutions-page .im-goods__favorite.is-active .im-goods__favorite-fill {
    fill: var(--brand-600) !important;
}

.im-ready-solutions-page .im-goods__favorite.is-active svg path:not(.im-goods__favorite-fill) {
    fill: var(--brand-600) !important;
}

.im-ready-solutions-page .im-goods__favorite.is-active:hover,
.im-ready-solutions-page .im-goods__favorite.is-active:focus-visible {
    background: var(--brand-110) !important;
}

.im-ready-solutions-page .im-goods__compare-top.is-active,
.im-ready-solutions-page .im-goods__compare-top.is-active:hover,
.im-ready-solutions-page .im-goods__compare-top.is-active:focus-visible {
    background: var(--neutral-100) !important;
}

.im-ready-solutions-page .im-goods__compare-top.is-active .im-compare-ring,
.im-ready-solutions-page .im-goods__compare-top.is-active:hover .im-compare-ring,
.im-ready-solutions-page .im-goods__compare-top.is-active:focus-visible .im-compare-ring {
    fill: none !important;
    stroke: var(--brand-500) !important;
}

@media (hover: hover) {
    .im-ready-solutions-page .im-goods__compare-top:hover {
        transform: scale(1.1) !important;
    }
}

.im-header__search .im-header__search-input.live-search-input {
    width: auto;
    min-width: 0;
    height: auto;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
}

.im-header__search .im-header__search-input.live-search-input::-webkit-search-cancel-button,
.im-header__search .im-header__search-input.live-search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

body.im-desktop-catalog-open .im-header,
body:has(.im-desktop-catalog.is-open) .im-header {
    z-index: var(--im-layer-header-open, 2147483647) !important;
}

.im-desktop-catalog__dropdown {
    z-index: var(--im-layer-overlay, 2147483645) !important;
}

@media (max-width: 1200px) {
    body.im-desktop-catalog-open .im-header,
    body.im-mobile-menu-open .im-header,
    body.im-mobile-catalog-open .im-header,
    body.im-catalog-modal-open .im-header,
    body.fv-im-filters-open .im-header,
    body:has(.im-desktop-catalog.is-open) .im-header,
    body:has(.im-header__mobile-overlay.is-open) .im-header,
    body:has(.im-mobile-catalog.is-open) .im-header,
    body:has(.im-catalog-modal.is-open) .im-header,
    .page:has(.im-ready-solutions-page.is-filters-open) .im-header,
    .page:has(.im-catalog-page.is-filters-open) .im-header {
        z-index: var(--im-layer-header-open, 2147483647) !important;
    }

    body.fv-im-filters-open .im-bottom-nav {
        display: none !important;
        pointer-events: none !important;
    }

    .im-bottom-nav {
        display: block !important;
        z-index: var(--im-layer-bottom-nav, 2147483647) !important;
    }

    body.im-mobile-menu-open .im-bottom-nav,
    body.im-mobile-catalog-open .im-bottom-nav,
    body.im-catalog-modal-open .im-bottom-nav,
    body:has(.im-header__mobile-overlay.is-open) .im-bottom-nav,
    body:has(.im-mobile-catalog.is-open) .im-bottom-nav,
    body:has(.im-catalog-modal.is-open) .im-bottom-nav {
        z-index: var(--im-layer-bottom-nav, 2147483647) !important;
        pointer-events: auto !important;
    }

    .im-mobile-catalog,
    .im-catalog-modal,
    .im-desktop-catalog__dropdown {
        z-index: var(--im-layer-overlay, 2147483645) !important;
    }

    .im-mobile-catalog,
    .im-catalog-modal {
        top: var(--im-header-mobile-offset, 48px) !important;
    }

    .im-header__catalog--mobile {
        display: inline-flex !important;
    }

    .im-ready-solutions-page.is-filters-open .im-catalog-sidebar,
    .im-catalog-page.is-filters-open .im-catalog-sidebar,
    body.fv-im-filters-open .im-ready-solutions-page.is-filters-open .im-catalog-sidebar,
    body.fv-im-filters-open .im-catalog-page.is-filters-open .im-catalog-sidebar,
    #fv_module.fv-mobile {
        z-index: var(--im-layer-overlay, 2147483645) !important;
    }

    body.fv-im-filters-open .im-ready-solutions-page.is-filters-open .im-catalog-sidebar,
    body.fv-im-filters-open .im-catalog-page.is-filters-open .im-catalog-sidebar,
    body.fv-im-filters-open #fv_module.fv-mobile {
        top: var(--im-header-mobile-offset, 48px) !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        height: calc(100dvh - var(--im-header-mobile-offset, 48px)) !important;
        max-height: calc(100dvh - var(--im-header-mobile-offset, 48px)) !important;
    }
}

@media (max-width: 1000px) {
    .im-header__catalog--mobile {
        display: none !important;
    }

    .im-bottom-nav {
        z-index: var(--im-layer-bottom-nav, 2147483647) !important;
    }

    body.im-mobile-menu-open .im-bottom-nav,
    body.im-mobile-catalog-open .im-bottom-nav,
    body.im-catalog-modal-open .im-bottom-nav,
    body:has(.im-header__mobile-overlay.is-open) .im-bottom-nav,
    body:has(.im-mobile-catalog.is-open) .im-bottom-nav,
    body:has(.im-catalog-modal.is-open) .im-bottom-nav {
        display: block !important;
        pointer-events: auto !important;
    }
}

/* catalog-card-name-3lines:start */
/* Каталог/поиск: название карточки в 3 строки + меньше шрифт.
   Scoped на сетку каталога ([data-catalog-products-grid] — только category/search),
   специфичность выше базового .im-goods__name из бандла → перекрывает clamp/шрифт. */
[data-catalog-products-grid] .im-goods__name {
    font-size: 14px;
    line-height: 140%;
    -webkit-line-clamp: 3;
}
/* catalog-card-name-3lines:end */

/* catalog-desktop-subcategories-grid:start */
/* Дропдаун «Каталог» (ПК): подкатегории ровной сеткой в порядке следования (row-major),
   карточки друг за другом слева-направо, ряды выровнены сверху. Было masonry
   (column-count) → «волна» + прыгающий порядок чтения.
   ДВА варианта разметки (гридим РЕАЛЬНЫЙ контейнер карточек в каждом):
   - главная (home.twig): контейнер = .im-desktop-catalog__subgrid (был column-count:3);
   - модуль mega_menu (прочие страницы): карточки лежат прямо в .im-desktop-catalog__subpanel.
   Фиксированные 3 колонки (дропдаун content-sized → auto-fill схлопнулся бы в 1). Десктоп-
   каталог показывается только >1200px (где 3×260 влезают); ≤1200px — мобильный каталог. */
.im-desktop-catalog__subgrid,
.im-desktop-catalog__subpanel:has(> .im-desktop-catalog__subcard) {
    display: grid;
    grid-template-columns: repeat(3, 260px);
    gap: 16px;
    column-gap: 16px;
    align-content: start;
    justify-content: start;
}
.im-desktop-catalog__subcategories .im-desktop-catalog__subcard {
    width: 100%;
    margin-bottom: 0;
}
/* catalog-desktop-subcategories-grid:end */
/* pro-badges: bottom-right + unified pills (2026-07-11-badges)
   Полный набор стилей здесь, т.к. не все page-бандлы содержат .im-goods__pro-badge*.
   global.css грузится на каждой странице → единый вид везде. */
.im-goods__pro-badges {
  position: absolute;
  top: auto;
  left: auto;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  max-width: calc(100% - 24px);
  pointer-events: none;
}
.im-goods__pro-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  border-radius: 999px;
  background: var(--neutral-black);
  color: var(--neutral-100);
  font-family: var(--font-family);
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--neutral-black) 12%, transparent);
}
.im-goods__pro-badge--line {
  min-height: 24px;
  padding: 4px 11px;
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
}
.im-goods__image--has-pro-badges .im-goods__badge {
  top: 12px;
  bottom: auto;
}
.im-goods__pro-badge--warranty {
  flex-direction: column;
  min-width: 78px;
  min-height: 34px;
  padding: 4px 12px 5px;
}
.im-goods__pro-badge-value {
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
}
.im-goods__pro-badge-label {
  margin-top: 1px;
  font-weight: 400;
  font-size: 10px;
  line-height: 1;
}
/* pro-badges: раскладка по углам + шилд «В наличии» (2026-07-15-instock)
   База выше (bottom-right) остаётся у гарантии; модификаторы уводят стопку
   «В наличии»/«Хит продаж» в левый верх, «Ironmebel ПРО» — в левый низ. */
.im-goods__pro-badges--top-left {
  top: 12px;
  bottom: auto;
  left: 12px;
  right: auto;
  align-items: flex-start;
}
.im-goods__pro-badges--bottom-left {
  left: 12px;
  right: auto;
  align-items: flex-start;
}
/* Цвета и скругление шилдов (2026-07-15-tags-color, по референсу заказчика).
   Селекторы с контейнером (0,2,0) — намеренно: в page-бандлах (page-ready-solutions,
   page-sklad, page-news*) лежат старые правила .im-goods__pro-badge--line (0,1,0),
   которые грузятся ПОСЛЕ global.css и ужимают только --line на мобиле. Через
   контейнер global.css становится единственным источником размера всех пилюль,
   иначе «Хит»/«В наличии»/«ПРО» снова разъедутся между собой. */

/* Скругление как у кнопки «Войти» (.im-header__login), а не пилюля */
.im-goods__pro-badges .im-goods__pro-badge {
  border-radius: 8px;
}

/* Пилюли: единый размер на всех страницах */
.im-goods__pro-badges .im-goods__pro-badge--stock,
.im-goods__pro-badges .im-goods__pro-badge--hit,
.im-goods__pro-badges .im-goods__pro-badge--line {
  min-height: 24px;
  padding: 4px 11px;
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
}
@media (max-width: 600px) {
  .im-goods__pro-badges .im-goods__pro-badge--stock,
  .im-goods__pro-badges .im-goods__pro-badge--hit,
  .im-goods__pro-badges .im-goods__pro-badge--line {
    min-height: 20px;
    padding: 3px 7px;
    font-size: 10px;
  }
}

/* Цвета пилюль */
.im-goods__pro-badges .im-goods__pro-badge--stock {
  background: var(--green-300);
  color: var(--green-800);
}
.im-goods__pro-badges .im-goods__pro-badge--hit {
  background: var(--blue-300);
  color: var(--blue-900);
}
.im-goods__pro-badges .im-goods__pro-badge--line {
  background: var(--blue-900);
  color: var(--neutral-100);
}

/* Гарантия: обе строки одной ширины и по центру (align-items базы — center,
   из-за него строки жались по контенту и визуально не совпадали) */
.im-goods__pro-badges .im-goods__pro-badge--warranty {
  align-items: stretch;
  justify-content: center;
  gap: 2px;
}
.im-goods__pro-badges .im-goods__pro-badge--warranty-red {
  background: var(--brand-600);
}
.im-goods__pro-badges .im-goods__pro-badge--warranty-navy {
  background: var(--blue-900);
}

/* Узкие карточки (мобильные 2 колонки, ~168-176px): «Ironmebel ПРО» слева и гарантия
   справа не помещаются на одной линии — поднимаем ПРО над гарантией. */
@media (max-width: 600px) {
  .im-goods__image:has(.im-goods__pro-badge--warranty) .im-goods__pro-badges--bottom-left {
    bottom: 56px;
  }
}
