/* DeStyle Sofa Configurator - Frontend Styles */

.destyle-configurator {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: relative;
    background-color: #fff;
}

.configurator-fullscreen-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, gap 0.2s ease, padding 0.2s ease;
    z-index: 1100000;
}

.configurator-fullscreen-toggle:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.configurator-fullscreen-toggle:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: translateY(-1px);
}

.configurator-fullscreen-toggle.is-visible {
    display: inline-flex;
}

.configurator-fullscreen-toggle.is-active {
    background: rgba(0, 0, 0, 0.55);
    gap: 0;
    padding: 8px;
}

.configurator-fullscreen-toggle[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

.fullscreen-toggle__icon {
    position: relative;
    width: 12px;
    height: 12px;
}

.fullscreen-toggle__icon::before,
.fullscreen-toggle__icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid currentColor;
    border-radius: 3px;
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

.fullscreen-toggle__icon::before {
    top: 0;
    left: 0;
    transform: translate(0, 0);
}

.fullscreen-toggle__icon::after {
    bottom: 0;
    right: 0;
    transform: translate(0, 0);
}

.configurator-fullscreen-toggle.is-active .fullscreen-toggle__icon::before {
    transform: translate(2px, 2px);
}

.configurator-fullscreen-toggle.is-active .fullscreen-toggle__icon::after {
    transform: translate(-2px, -2px);
}

.fullscreen-toggle__text {
    white-space: nowrap;
}

.configurator-fullscreen-toggle .fullscreen-toggle__text-exit {
    display: none;
}

.configurator-fullscreen-toggle.is-active .fullscreen-toggle__text-enter,
.configurator-fullscreen-toggle.is-active .fullscreen-toggle__text-exit {
    display: none;
}

/* Полноэкранный режим */
.destyle-configurator.fullscreen {
    --fullscreen-scene-height: 20vh;
    --fullscreen-scene-min-height: 200px;
    --fullscreen-scene-padding-bottom: 32px;

    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 100%;
    width: 100%;
    height: 100vh;
    z-index: 999999;
    background: white;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Карусель моделей */
.models-carousel {
    position: relative;
    background: transparent;
    border-radius: 0;
    padding: 6px 12px;
    margin-bottom: 6px;
    box-shadow: none;
    max-height: 15vh;
    min-height: auto;
    overflow: hidden;
    display: flex;
    align-items: center;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    box-sizing: border-box;
}

.scene-container .brand-logo-link {
    position: absolute;
    top: clamp(8px, 2vh, 24px);
    right: clamp(8px, 2vh, 24px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border-radius: 0;
    width: min(20%, 200px);
    max-height: 15%;
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 20;
}

.scene-container .brand-logo-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 4px;
}

.scene-container .brand-logo-link:hover,
.scene-container .brand-logo-link:focus-visible {
    opacity: 1;
    transform: translateY(-2px);
}

.scene-container .brand-logo-link img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.destyle-configurator.fullscreen .models-carousel {
    margin: 0 0 6px 0;
    border-radius: 0;
    padding: 6px 12px;
}

@media (orientation: portrait) {
    .models-carousel {
        max-height: 10vh;
        padding: 10px 12px;
    }

    .destyle-configurator.fullscreen .models-carousel {
        padding: 10px 12px;
    }

    .scene-container .brand-logo-link {
        width: min(10%, 120px);
        max-height: 12%;
    }

    .destyle-configurator.fullscreen .configurator-main {
        display: flex;
        flex-direction: column;
        gap: 12px;
        height: auto;
        flex: 1 1 auto;
    }

    .destyle-configurator.fullscreen .left-panel,
    .destyle-configurator.fullscreen .right-panel {
        width: 100%;
    }

    .destyle-configurator.fullscreen.is-portrait-mode {
        --portrait-scene-height: 30vh;
        --portrait-dimensions-height: 10vh;
        --portrait-catalog-height: 50vh;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .left-panel {
        height: auto;
        flex: 0 0 auto;
        overflow: visible;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .right-panel {
        height: var(--portrait-catalog-height);
        flex: 0 0 var(--portrait-catalog-height);
        max-height: var(--portrait-catalog-height);
        min-height: 0;
        overflow-y: auto;
    }

    .destyle-configurator.fullscreen .scene-wrapper {
        flex-direction: column;
        gap: 5px; /* Сокращаем вертикальный интервал между элементами сцены в полноэкранном режиме */
    }

    .destyle-configurator.fullscreen .scene-container {
        order: -1;
        width: 100%;
        height: var(--fullscreen-scene-height, 20vh);
        min-height: var(--fullscreen-scene-min-height, 200px);
        padding-bottom: var(--fullscreen-scene-padding-bottom, 32px);
        box-sizing: border-box;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .scene-container {
        height: var(--portrait-scene-height);
        min-height: 0;
        flex: 0 0 var(--portrait-scene-height);
        padding-bottom: 0;
    }

    .destyle-configurator.fullscreen .dimensions-info {
        order: 0;
        width: 100%;
        height: auto;
        padding: 8px 10px;
        gap: 8px;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .dimensions-info {
        height: var(--portrait-dimensions-height);
        min-height: 0;
        flex: 0 0 var(--portrait-dimensions-height);
        overflow: visible;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .dimensions-grid {
        max-height: 100%;
        overflow-y: auto;
    }

    .destyle-configurator.fullscreen .dimensions-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: stretch;
        justify-content: space-between;
        gap: 0; /* Сохраняем единый визуальный ритм и линии разделения в полноэкранном режиме */
        width: 100%;
    }

    .destyle-configurator.fullscreen .dimensions-grid .dimensions-row,
    .destyle-configurator.fullscreen .dimension-height-group,
    .destyle-configurator.fullscreen .dimension-height-columns {
        display: contents;
    }

    .destyle-configurator.fullscreen .dimension-item,
    .destyle-configurator.fullscreen .dimension-subitem {
        flex: 1 1 0;
        min-width: 0;
    }

    .destyle-configurator.fullscreen .dimension-item {
        gap: 1px;
        align-items: center;
    }

    .destyle-configurator.fullscreen .dimension-subitem {
        align-items: center;
    }

    .destyle-configurator.fullscreen .dimension-item .dimension-value,
    .destyle-configurator.fullscreen .dimension-item .dimension-label,
    .destyle-configurator.fullscreen .dimension-subitem .dimension-value,
    .destyle-configurator.fullscreen .dimension-subitem .dimension-label {
        text-align: center;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    .destyle-configurator.fullscreen .dimension-value {
        font-size: 14px;
        gap: 2px;
    }

    .destyle-configurator.fullscreen .dimension-label {
        font-size: 9px;
        letter-spacing: 0.3px;
    }

    .destyle-configurator.fullscreen .dimension-unit {
        font-size: 10px;
    }

    .destyle-configurator.fullscreen .dimension-height-group {
        gap: 4px;
    }

    .destyle-configurator.fullscreen .dimension-height-columns {
        gap: 0; /* Обеспечиваем совпадение разделительных линий во всех режимах */
        width: 100%;
    }

    .destyle-configurator.fullscreen .dimension-controls {
        display: flex;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 6px;
        width: 100%;
        margin-top: 0;
        padding-top: 4px;
    }

    .destyle-configurator.fullscreen .dimension-controls__row {
        display: contents;
    }

    .destyle-configurator.fullscreen .dimension-controls .btn,
    .destyle-configurator.fullscreen .dimension-controls .download-dropdown {
        flex: 1 1 0;
        min-width: 0;
    }

    .destyle-configurator.fullscreen .dimension-controls__row > .download-dropdown,
    .destyle-configurator.fullscreen .dimension-controls__row > #btn-share-config {
        flex: 1 1 calc(50% - 3px); /* Комментарий: в полноэкранном режиме делим строку с двумя кнопками строго пополам. */
        max-width: calc(50% - 3px); /* Комментарий: ограничиваем ширину, чтобы элементы не занимали больше половины. */
    }

    .destyle-configurator.fullscreen .dimension-controls .btn {
        min-height: 48px;
        padding: 10px;
        font-size: 0;
        gap: 0;
    }

    .destyle-configurator.fullscreen .dimension-controls .btn .dashicons {
        font-size: 20px;
        width: 20px;
        height: 20px;
    }

    .destyle-configurator.fullscreen .dimension-controls .download-dropdown {
        display: flex;
    }

    .destyle-configurator.fullscreen .download-dropdown__toggle {
        width: 100%;
        min-height: 48px;
        padding: 10px;
        font-size: 0;
        gap: 0;
    }

    .destyle-configurator.fullscreen .download-dropdown__toggle .dashicons {
        font-size: 22px;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .dimensions-grid {
        order: 0;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .dimension-controls {
        order: 1;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        align-items: stretch;
        justify-items: stretch;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .dimension-controls__row {
        display: contents;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .dimension-controls .btn,
    .destyle-configurator.fullscreen.is-portrait-mode .dimension-controls .download-dropdown {
        width: 100%;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .dimension-controls__row > .download-dropdown,
    .destyle-configurator.fullscreen.is-portrait-mode .dimension-controls__row > #btn-share-config {
        width: 100%; /* Комментарий: растягиваем блоки скачивания и копирования ссылки во всю ширину их ячеек. */
        max-width: none; /* Комментарий: убираем ограничение по максимальной ширине, чтобы элементы не сжимались. */
        justify-self: stretch; /* Комментарий: просим CSS Grid растягивать элементы на всю доступную ширину колонки. */
    }

    .destyle-configurator.fullscreen.is-portrait-mode .dimension-controls #btn-share-config {
        width: 100%; /* Комментарий: гарантируем, что сама кнопка копирования ссылки тоже занимает всю ширину. */
    }

    .destyle-configurator.fullscreen.is-portrait-mode .dimension-controls .download-dropdown {
        display: flex;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .download-dropdown__toggle {
        width: 100%;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .dimension-controls__row--spec-toggle {
        display: contents;
    }

    .destyle-configurator.fullscreen.is-portrait-mode:not(.is-specification-visible) .selected-modules {
        display: none;
    }

    .destyle-configurator.fullscreen.is-portrait-mode.is-specification-visible .scene-container {
        display: none;
    }

    .destyle-configurator.fullscreen.is-portrait-mode .dimensions-info {
        height: auto;
    }

    .destyle-configurator.fullscreen.is-portrait-mode.is-specification-visible .selected-modules--portrait {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-height: 0;
        background: #ffffff;
        border-radius: 12px;
        padding: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        gap: 8px;
        order: -1;
        height: var(--fullscreen-scene-height, 20vh);
        min-height: var(--fullscreen-scene-min-height, 200px);
        box-sizing: border-box;
    }

    .destyle-configurator.fullscreen.is-portrait-mode.is-specification-visible .selected-modules--portrait {
        height: var(--portrait-scene-height);
        min-height: 0;
        flex: 0 0 var(--portrait-scene-height);
    }

    .destyle-configurator.fullscreen.is-portrait-mode.is-specification-visible .selected-modules--portrait h3 {
        margin-bottom: 0;
    }

    .destyle-configurator.fullscreen.is-portrait-mode.is-specification-visible .selected-modules--portrait .modules-list {
        flex: 1 1 auto;
        height: 100%;
    }
}

.models-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    width: 100%;
    height: 100%;
    align-items: center;
    padding: 5px 12px;
    box-sizing: border-box;
    touch-action: pan-x;
    cursor: grab;
    flex: 1 1 auto;
}

.models-container.has-horizontal-scroll {
    padding-bottom: 15px;
    cursor: url('../images/cursors/hand-cursor.svg') 0 0, grab; /* Комментарий: фиксируем горячую точку пользовательского курсора руки в левом верхнем углу, чтобы кончик совпадал с реальным указателем. */
}

.models-container.is-dragging {
    cursor: grabbing;
}

.models-container.is-dragging,
.models-container.is-dragging * {
    user-select: none;
    -webkit-user-select: none;
}

.models-container.is-dragging .model-card {
    cursor: grabbing;
}

/* Кастомный скроллбар для карусели */
.models-container::-webkit-scrollbar {
    height: 6px;
}

.models-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.models-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.models-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.model-card {
    flex-shrink: 0;
    flex-grow: 1;
    width: calc((15vh - 50px) * 1.33); /* 4:3 aspect ratio */
    height: calc(15vh - 50px);
    min-width: 106px;
    min-height: 80px;
    max-width: clamp(180px, 24vw, 280px);
    max-height: 120px;
    background: white;
    border: 2px solid transparent; /* Комментарий: резервируем место под рамку, чтобы при наведении карточка не дёргалась. */
    border-radius: 8px;
    padding: 0; /* Комментарий: сбрасываем внутренние отступы, чтобы карточка занимала всю ширину без боковых полей. */
    padding-bottom: 10px; /* Комментарий: оставляем только нижний отступ для аккуратного отступа от подписи модели. */
    padding-left: 3px; /* Комментарий: добавляем небольшой левый отступ, чтобы содержимое карточки не прилипало к краю. */
    padding-right: 3px; /* Комментарий: добавляем такой же правый отступ для симметрии и лёгкого дыхания макета. */
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Разрешаем всплывающим подсказкам выходить за пределы карточки. */
    overflow: visible;
    position: relative;
}

/* Комментарий: отдельная карточка запуска поиска выделяем спокойным фоном и вертикальным выравниванием. */
.model-card--search {
    background: #f5f5f7;
    border-style: dashed;
    border-color: rgba(0, 0, 0, 0.15);
    justify-content: center;
    gap: 10px;
    padding: 14px 10px;
}

/* Комментарий: при наведении подчёркиваем интерактивность карточки поиска. */
.model-card--search:hover,
.model-card--search:focus-visible {
    border-color: #007aff;
    transform: translateY(-2px);
    background: #ffffff;
}

/* Комментарий: делаем иконку поиска максимально лёгкой без дополнительных эффектов. */
.model-card__icon {
    display: flex; /* Комментарий: сохраняем выравнивание иконки по центру контейнера. */
    align-items: center; /* Комментарий: вертикально центрируем иконку внутри блока. */
    justify-content: center; /* Комментарий: горизонтально центрируем иконку. */
    color: #747474; /* Комментарий: задаём требуемый светло-серый цвет иконке. */
}

.model-card__icon .dashicons {
    font-size: 48px; /* Комментарий: увеличиваем размер иконки на 50% (с 32px до 48px). */
    width: 1em; /* Комментарий: убираем фиксированную ширину 20px у dashicons, чтобы иконка не смещалась. */
    height: 1em; /* Комментарий: синхронизируем высоту с новым размером иконки для корректного центрирования. */
    line-height: 1; /* Комментарий: избавляемся от лишнего вертикального отступа вокруг иконки. */
}

/* Комментарий: стилизация горизонтального ярлыка с особым статусом модели. */
.model-card__badge {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 80%;
    height: 16px; /* Комментарий: фиксируем высоту ярлыка по требованию заказчика. */
    padding: 0; /* Комментарий: убираем внутренние отступы, чтобы текст располагался по центру нового прямоугольника. */
    background-color: #b64450;
    color: #ffffff;
    font-size: 9px; /* Комментарий: уменьшаем размер текста, чтобы он комфортно помещался в ярлык высотой 16 пикселей. */
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.08em;
    border-radius: 8px; /* Комментарий: превращаем ярлык в компактный прямоугольник со скруглёнными углами. */
    line-height: 16px; /* Комментарий: выравниваем текст по вертикали внутри прямоугольного ярлыка. */
    transform: translate(-50%, 50%);
    box-shadow: 0 3px 6px rgba(182, 68, 80, 0.2); /* Комментарий: делаем тень аккуратнее для маленького ярлыка. */
    pointer-events: none;
    z-index: 1;
}

/* Комментарий: настраиваем индивидуальный цвет и тень для ярлыка "Новинка" (стандартный вариант). */
.model-card__badge--new {
    background-color: #b64450;
    box-shadow: 0 3px 6px rgba(182, 68, 80, 0.2);
}

/* Комментарий: делаем фон и тень синего цвета для ярлыка "Хит". */
.model-card__badge--hit {
    background-color: #536DFE;
    box-shadow: 0 3px 6px rgba(83, 109, 254, 0.25);
}

/* Комментарий: для ярлыка "Акция" используем жёлтый фон и мягкую тень. */
.model-card__badge--sale {
    background-color: #FBC02D;
    box-shadow: 0 3px 6px rgba(251, 192, 45, 0.3);
    text-transform: none;
    letter-spacing: 0.04em;
}

.model-card:hover {
    border-color: #d0d0d0; /* Комментарий: используем тёмно-серый цвет рамки, как у карточек модулей. */
    transform: translateY(-2px);
    box-shadow: none; /* Комментарий: полностью отключаем тень, чтобы оставить только рамку. */
}

/* Комментарий: контейнер изображения модели работает как кнопка предпросмотра. */
.model-card-image {
    position: relative;
    height: calc(100% - 20px);
    border-radius: 4px;
    overflow: hidden;
    /* Комментарий: подключаем кастомную лупу для предпросмотра модели с горячей точкой в левом верхнем углу. */
    cursor: url('../images/cursors/preview-cursor.svg') 0 0, zoom-in; /* Комментарий: смещаем горячую точку лупы в левый верхний угол, чтобы курсор ощущался естественно. */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

/* Комментарий: для карточек без изображения возвращаем стандартный курсор. */
.model-card-image--placeholder {
    cursor: default;
}

/* Комментарий: подсвечиваем интерактивный контейнер изображения при навигации с клавиатуры. */
.model-card-image:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.model-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1.15); /* Комментарий: уменьшаем масштаб текущих изображений на 30%, оставляя их лишь немного крупнее оригинала. */
    transform-origin: center; /* Комментарий: фиксируем масштабирование относительно центра изображения. */
}

/* Кнопка предпросмотра для карточек ножек */
/* Комментарий: делаем контейнер изображения ножек интерактивным для запуска предпросмотра. */
.leg-card-image {
    /* Комментарий: используем кастомную лупу для предпросмотра варианта ножек и выравниваем горячую точку по левому верхнему углу. */
    cursor: url('../images/cursors/preview-cursor.svg') 0 0, zoom-in; /* Комментарий: фиксируем горячую точку кастомной лупы в левом верхнем углу для точного наведения. */
}

/* Комментарий: выделяем изображение ножек при управлении с клавиатуры. */
.leg-card-image:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.model-card.active {
    border-color: #007AFF; /* Комментарий: сохраняем визуальный акцент на активной карточке за счёт синей рамки. */
    background: white; /* Комментарий: убираем подсветку фона, чтобы выделение происходило только через заголовок. */
}

.model-card.active h3 {
    font-size: 12px; /* Комментарий: делаем подпись выбранной модели немного крупнее. */
    font-weight: 700; /* Комментарий: выделяем название активной модели полужирным начертанием. */
    color: #007AFF; /* Комментарий: окрашиваем название активной модели фирменным синим цветом. */
}

.model-placeholder {
    width: 100%;
    height: 100%;
    background: #f5f5f7;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #86868b;
}

.model-placeholder .dashicons {
    font-size: 24px;
}

.model-card h3 {
    font-size: 11px;
    color: #1d1d1f;
    margin: 0 0 0; /* Комментарий: убираем нижний отступ согласно ТЗ. */
    padding: 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 14px; /* Комментарий: подстраиваем межстрочное расстояние под уменьшенную высоту. */
    height: 14px; /* Комментарий: уменьшаем высоту заголовка до 14 пикселей по требованию заказчика. */
    flex-shrink: 0;
}

/* Комментарий: модальное окно поиска моделей скрывается по умолчанию и плавно появляется с затемнением фона. */
.model-search-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1200000;
}

/* Комментарий: при активации делаем модальное окно доступным, кликабельным и включаем размытие фона. */
.model-search-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Комментарий: фон под модалкой реагирует на клики для закрытия. */
.model-search-overlay__backdrop {
    position: absolute;
    inset: 0;
}

/* Комментарий: растягиваем окно поиска почти на весь экран, чтобы задействовать 94% ширины и высоты. */
.model-search-overlay__dialog {
    position: relative;
    width: 94vw;
    max-width: 94vw;
    height: 94vh;
    max-height: 94vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Комментарий: выравниваем заголовок и кнопку закрытия по стилю окна настроек. */
.model-search-overlay__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 24px;
}

.model-search-overlay__title {
    margin: 0;
    font-size: 24px;
    line-height: 1.3;
    color: #1c1c1e;
}

/* Комментарий: копируем стили кнопки закрытия из окна настроек конфигуратора. */
.model-search-overlay__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #d1d1d6;
    background: #f5f5f7;
    color: #1c1c1e;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.model-search-overlay__close:hover,
.model-search-overlay__close:focus {
    color: #ff3b30;
    border-color: #ff3b30;
    background: rgba(255, 59, 48, 0.1);
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.25);
}

.model-search-overlay__close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.35);
}

/* Комментарий: делим контент окна на две колонки, фиксируя ширину блока фильтров на 30% модального окна. */
.model-search-overlay__body {
    flex: 1 1 auto;
    padding: 0 24px 24px;
    display: grid;
    grid-template-columns: 30% 1fr;
    gap: 24px;
    align-items: stretch;
    overflow: hidden;
}

/* Комментарий: делаем колонку с фильтрами тянущейся, скрываем вспомогательные полосы прокрутки и уменьшаем внутренние отступы.
   Дополнительно разрешаем блоку сжиматься по ширине, чтобы избежать горизонтальной прокрутки на узких экранах. */
.model-search-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 100%;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: none;
}

/* Комментарий: отключаем отображение полос прокрутки в браузерах на движке WebKit. */
.model-search-form::-webkit-scrollbar {
    display: none;
}

/* Комментарий: оформляем верхний блок текстового поиска с минимальными отступами и растягиваем его на всю ширину колонки. */
.model-search-form__search {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 12px;
    background: #f5f5f7;
}

/* Комментарий: выстраиваем строку текстового поиска с полем и кнопкой. */
.model-search-form__search-controls {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

/* Комментарий: делаем поле ввода удобным для работы и адаптивным по ширине. */
.model-search-form__search-input {
    display: block;
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid #d2d2d7;
    background: #ffffff;
    font-size: 15px;
    line-height: 1.4;
    color: #1c1c1e;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Комментарий: подсвечиваем поле при фокусе для лучшей доступности. */
.model-search-form__search-input:focus-visible {
    border-color: #0a84ff;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
    outline: none;
}

/* Комментарий: кнопка запуска текстового поиска повторяет стиль основных кнопок формы. */
.model-search-form__search-button {
    flex: 0 0 auto;
    border: none;
    border-radius: 10px;
    background: #007aff;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

/* Комментарий: слегка затемняем кнопку при наведении и фокусе. */
.model-search-form__search-button:hover,
.model-search-form__search-button:focus-visible {
    background: #005ecb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 94, 203, 0.25);
}

/* Комментарий: делаем группы опций компактными за счёт одинаковых промежутков и минимальных внутренних отступов,
   одновременно позволяя им подстраиваться под доступную ширину. */
.model-search-form__fieldset {
    margin: 0;
    padding: 6px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 12px;
    background: #f5f5f7;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.model-search-form__legend {
    font-size: 13px;
    font-weight: 700;
    color: #1c1c1e;
    padding: 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Комментарий: визуально выделяем блок выбора функций модулей. */
.model-search-form__fieldset--functions .model-search-functions {
    display: block;
}

.model-search-functions.is-loading {
    opacity: 0.6;
}

.model-search-functions__empty {
    font-size: 13px;
    color: #6e6e73;
    margin: 0;
}

/* Комментарий: строим список функций сеткой, позволяющей выводить до двух карточек в строке при достаточной ширине. */
.model-search-functions__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 6px;
}

/* Комментарий: карточка функции ведёт себя как компактная кнопка с иконкой. */
.model-search-function {
    position: relative;
    display: block;
    cursor: pointer;
    text-align: left;
    height: 100%;
}

.model-search-function input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

/* Комментарий: делаем карточки функций максимально компактными, центрируем содержимое по высоте и оставляем единые отступы. */
.model-search-function__frame {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
    min-height: 80px;
    height: 100%;
}

.model-search-function__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 1px solid #d2d2d7;
    background: #f5f5f7;
    overflow: hidden;
    flex-shrink: 0;
    padding: 6px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.model-search-function__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.model-search-function__icon:focus-visible {
    outline: none;
    border-color: #027ffa;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.35);
    background: #ffffff;
}

.model-search-function__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.model-search-function__name {
    font-weight: 600;
    font-size: 14px;
    color: #1d1d1f;
}

.model-search-function__description {
    font-size: 12px;
    line-height: 1.4;
    color: #515154;
}

.model-search-function input:checked ~ .model-search-function__frame {
    border-color: #027ffa;
    background: #edf5ff;
    box-shadow: 0 10px 24px rgba(2, 127, 250, 0.18);
    transform: translateY(-1px);
}

.model-search-function input:focus-visible ~ .model-search-function__frame {
    outline: none;
    border-color: #027ffa;
    box-shadow: 0 0 0 3px rgba(2, 127, 250, 0.35);
}

.model-search-function__frame:hover {
    border-color: #027ffa;
    box-shadow: 0 8px 20px rgba(2, 127, 250, 0.12);
    transform: translateY(-1px);
}

/* Комментарий: включаем горизонтальную сетку с переносами, чтобы карточки фильтров выстраивались в ряд,
   и позволяем контейнеру занимать всю доступную ширину без появления горизонтальной прокрутки. */
.model-search-form__options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    width: 100%;
    min-width: 0;
}

/* Комментарий: превращаем плитки выбора в горизонтальные карточки с иконкой и подписью, задаём им половину строки
   и разрешаем им сжиматься при недостатке места, чтобы форма оставалась адаптивной. */
.model-search-seat-type {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 clamp(160px, calc(50% - 12px), 220px);
    min-width: clamp(160px, 100%, 220px);
    padding: 10px 12px;
    border: 1px solid #d1d1d6;
    border-radius: 14px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

/* Комментарий: при очень узких экранах выкладываем карточки типа сиденья в одну колонку, чтобы текст не сжимался чрезмерно. */
@media (max-width: 900px) {
    .model-search-seat-type {
        flex-basis: 100%;
    }
}

.model-search-seat-type input {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

/* Комментарий: уменьшаем контейнер иконки и оставляем лёгкую тень для визуальной иерархии. */
.model-search-seat-type__visual {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    border: 1px solid #d1d1d6;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.model-search-seat-type__visual img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.model-search-seat-type__fallback {
    font-size: 11px;
    font-weight: 600;
    color: #1c1c1e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Комментарий: отображаем подпись рядом с иконкой и задаём читаемую типографику. */
.model-search-seat-type__label {
    font-size: 15px;
    font-weight: 600;
    color: #1c1c1e;
    line-height: 1.4;
}

/* Комментарий: подсвечиваем карточку при наведении для визуальной обратной связи. */
.model-search-seat-type:hover {
    border-color: #027ffa;
    box-shadow: 0 6px 18px rgba(0, 122, 255, 0.12);
    transform: translateY(-1px);
}

/* Комментарий: сохраняем подсветку иконки выбранного варианта. */
.model-search-seat-type input:checked + .model-search-seat-type__visual {
    border-color: #027ffa;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
    transform: translateY(-1px);
}

/* Комментарий: подсвечиваем всю карточку при фокусе по табуляции для лучшей доступности. */
.model-search-seat-type input:focus-visible + .model-search-seat-type__visual {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.35);
}

/* Комментарий: меняем цвет текста выбранного типа сиденья для наглядности. */
.model-search-seat-type input:checked + .model-search-seat-type__visual + .model-search-seat-type__label {
    color: #027ffa;
}

.model-search-form__empty {
    margin: 12px 0 0;
    font-size: 13px;
    color: #6e6e73;
}

.model-search-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

/* Комментарий: делаем кнопки компактными и с мягким скруглением, чтобы они сочетались с остальными элементами формы. */
.model-search-form__button {
    border-radius: 10px;
    padding: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

/* Комментарий: при выполнении поиска делаем кнопку менее яркой. */
.model-search-form__button.is-loading {
    opacity: 0.7;
    cursor: progress;
}

.model-search-form__button--secondary {
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

.model-search-form__button--secondary:hover,
.model-search-form__button--secondary:focus-visible {
    background: rgba(0, 0, 0, 0.1);
    outline: none;
}

.model-search-form__button--primary {
    background: #007aff;
    color: #ffffff;
}

.model-search-form__button--primary:hover,
.model-search-form__button--primary:focus-visible {
    background: #005ecb;
    outline: none;
}

/* Комментарий: используем всю высоту правой колонки под список результатов. */
.model-search-overlay__results-wrapper {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.model-search-overlay__summary {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
}

/* Комментарий: делаем блок с карточками прокручиваемым без видимых полос прокрутки и добавляем дополнительный отступ сверху. */
.model-search-overlay__results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 8px;
    padding-top: 10px;
    scrollbar-width: none;
}

/* Комментарий: скрываем системные полосы прокрутки в Chrome/Safari. */
.model-search-overlay__results::-webkit-scrollbar {
    display: none;
}

.model-search-overlay__results .model-card {
    max-width: none;
    height: auto;
    width: 100%;
    padding: 16px 14px 20px;
}

.model-search-overlay__results .model-card-image {
    height: 190px;
}

/* Комментарий: предотвращаем прокрутку страницы под модальным окном поиска. */
body.destyle-model-search-open {
    overflow: hidden;
}

@media (max-width: 640px) {
    /* Комментарий: на маленьких экранах модальное окно растягиваем почти на всю ширину. */
    .model-search-overlay__dialog {
        border-radius: 12px;
        width: calc(100vw - 24px);
        max-width: none;
        height: calc(100vh - 24px);
        max-height: none;
    }

    /* Комментарий: переводим макет в одну колонку, чтобы элементы не ужимались. */
    .model-search-overlay__body {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(0, 1fr);
    }

    .model-search-form,
    .model-search-overlay__results-wrapper {
        height: auto;
        max-height: none;
    }

    .model-search-form__range {
        grid-template-columns: 1fr;
    }
}

@media (orientation: portrait) {
    .models-carousel {
        padding: 10px 12px;
    }

    .destyle-configurator.fullscreen .models-carousel {
        padding: 10px 12px;
    }

    .models-container {
        padding: 6px 10px 0;
        align-items: stretch;
        gap: 6px;
    }

    .models-container.has-horizontal-scroll {
        padding-bottom: 10px;
    }

    .models-container .model-card {
        aspect-ratio: 4 / 3;
        width: auto;
        min-width: unset;
        min-height: unset;
        height: 100%;
        max-height: 100%;
    }
}

/* Основной контейнер */
.configurator-main {
    display: grid;
    grid-template-columns: 40% 1fr;
    gap: 20px;
    height: calc(100vh - 200px);
    min-height: 500px;
}

/* Комментарий: оформление оверлея, который блокирует конфигуратор до выбора модели */
.configurator-selection-overlay {
    /* Комментарий: сохраняем значение горизонтальных отступов в переменной, чтобы использовать его для выравнивания лоадера */
    --selection-overlay-padding: 30px;
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--selection-overlay-padding);
    color: #1a1a1a;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.3;
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    z-index: 5;
    pointer-events: none;
}

/* Комментарий: размещаем контент оверлея в колонку, чтобы текст и статистика были визуально связаны. */
.configurator-selection-overlay__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
}

/* Комментарий: уточняем оформление текста подсказки, чтобы он корректно масштабировался на мобильных */
.configurator-selection-overlay__text {
    display: inline-block;
    /* Комментарий: сохраняем подсказку в одну строку, пока экран позволяет, чтобы текст было легче считывать. */
    max-width: 100%;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .configurator-selection-overlay__text {
        /* Комментарий: на очень узких экранах разрешаем перенос, чтобы текст оставался читаемым. */
        white-space: normal;
    }
}

/* Комментарий: подзаголовок объясняет, что показывают карточки статистики, и отделяется небольшим отступом. */
.configurator-selection-overlay__subtitle {
    font-size: 18px;
    font-weight: 500;
    color: #4a4a4a;
    text-align: center;
}

/* Комментарий: карточки статистики выравниваем сеткой, чтобы они выглядели аккуратно на любых разрешениях. */
.configurator-selection-overlay__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    width: 100%;
    max-width: 680px;
    font-size: 16px;
    font-weight: 500;
    pointer-events: none;
}

.configurator-selection-overlay__loader {
    /* Комментарий: тянем контейнер анимации на всю ширину экрана и компенсируем отступы оверлея, чтобы левый край совпал с экраном */
    width: calc(100vw + var(--selection-overlay-padding) + var(--selection-overlay-padding));
    margin-left: calc(50% - 50vw - var(--selection-overlay-padding));
    display: flex;
    justify-content: flex-start;
}

.loading-modules--overlay {
    /* Комментарий: на стартовом экране убираем абсолютное позиционирование и прижимаем анимацию к левому краю */
    position: static;
    inset: auto;
    width: 100%;
    max-width: 420px;
    margin: 0;
    /* Комментарий: убираем внутренние отступы и выравниваем содержимое по левому краю, чтобы анимация упиралась в край экрана */
    padding: 0;
    align-items: flex-start;
    text-align: left;
    gap: 0;
}

.loading-modules--overlay .loader-animation {
    /* Комментарий: фиксируем высоту анимации, чтобы она не сжималась в колонке */
    max-width: 100%;
}

.configurator-selection-overlay__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.75);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.configurator-selection-overlay__stat-value {
    font-size: 32px;
    font-weight: 700;
    /* Комментарий: добавляем верхний отступ, потому что подпись теперь расположена над числом. */
    margin-top: 8px;
    color: #111;
}

.configurator-selection-overlay__stat-label {
    display: block;
    color: #333;
    line-height: 1.4;
    /* Комментарий: создаём нижний отступ, чтобы отделить подпись от числового значения. */
    margin-bottom: 4px;
}

/* Комментарий: включаем оверлей и размытие основных блоков, пока модель не выбрана */
.destyle-configurator.configurator-awaits-model .configurator-main {
    position: relative;
}

.destyle-configurator.configurator-awaits-model .configurator-main > :not(.configurator-selection-overlay) {
    filter: blur(6px);
    pointer-events: none;
}

.destyle-configurator.configurator-awaits-model .configurator-selection-overlay {
    display: flex;
}

@media (max-width: 768px) {
    /* Комментарий: уменьшаем размеры шрифта подсказки на узких экранах */
    .configurator-selection-overlay {
        font-size: 22px;
        /* Комментарий: на узких экранах уменьшаем отступы и автоматически обновляем позицию анимации */
        --selection-overlay-padding: 20px;
        padding: var(--selection-overlay-padding);
    }

    /* Комментарий: на маленьких экранах уплотняем сетку статистики. */
    .configurator-selection-overlay__content {
        gap: 18px;
    }

    .configurator-selection-overlay__stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .configurator-selection-overlay__stat {
        padding: 12px;
    }

    .configurator-selection-overlay__stat-value {
        font-size: 26px;
    }
}

.destyle-configurator.fullscreen .configurator-main {
    height: 85vh;
    gap: 5px;
}

/* Левая панель */
.left-panel {
    background: white;
    border-radius: 12px;
    padding-top: 5px;
    padding-right: 5px;
    padding-bottom: 0px;
    padding-left: 5px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Этапы сборки */
.assembly-stage {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: #f5f5f7;
    border-radius: 8px;
    gap: 8px;
}

.stage-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px; /* Поддерживаем равномерный отступ между кнопками по требованию */
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Контейнер переключателя "Показать все модули" с общей рамкой и иконкой */
.stage-control-toggle-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid #d1d1d6;
    background: #ffffff;
    color: #027ffa;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

/* Подсветка рамки при наведении и фокусе внутри для лучшей отзывчивости */
.stage-control-toggle-wrapper:hover,
.stage-control-toggle-wrapper:focus-within {
    border-color: #027ffa;
    color: #005177;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.15);
}

/* Иконка глаза внутри рамки */
.stage-control-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.stage-control-toggle-icon .dashicons {
    font-size: 18px;
    line-height: 1;
    color: currentColor;
}

.stage-control-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: inherit;
    cursor: pointer;
    user-select: none;
}

.stage-control-toggle-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.stage-control-toggle-visual {
    position: relative;
    width: 38px;
    height: 20px;
    border-radius: 999px;
    background: #d1d1d6;
    transition: background 0.2s ease;
}

.stage-control-toggle-visual::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.stage-control-toggle-input:checked + .stage-control-toggle-visual {
    background: #027ffa;
}

.stage-control-toggle-input:checked + .stage-control-toggle-visual::after {
    transform: translateX(18px);
}

.stage-control-toggle-input:focus-visible + .stage-control-toggle-visual {
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.35);
}

.stage-control-toggle-text {
    color: #3a3a3c;
    font-weight: 500;
}

.stage-help-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #d1d1d6;
    background: #ffffff;
    color: #027ffa;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    /* Убираем внешние отступы, чтобы кнопка "Справка" не смещалась относительно соседних элементов */
    margin: 0;
    /* Мягкое мерцание обводки делает кнопку заметнее для пользователя */
    animation: stage-help-glow 1.6s ease-in-out infinite;
}

.stage-help-button .dashicons {
    font-size: 18px;
    line-height: 1;
}

@keyframes stage-help-glow {
    0% {
        border-color: #d1d1d6;
        box-shadow: 0 0 0 0 rgba(2, 127, 250, 0.1);
    }
    50% {
        border-color: #027ffa;
        box-shadow: 0 0 0 4px rgba(2, 127, 250, 0.15);
    }
    100% {
        border-color: #d1d1d6;
        box-shadow: 0 0 0 0 rgba(2, 127, 250, 0.1);
    }
}

/* Контейнер управления ценами: общий стиль продолговатой кнопки */
.stage-price-button {
    display: inline-flex;
    align-items: stretch;
    justify-content: center;
    height: 36px;
    border: 1px solid #d1d1d6;
    border-radius: 999px;
    background: #ffffff;
    color: #027ffa;
    font-size: 16px;
    margin-left: 6px;
    overflow: hidden;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

/* Прячем кнопку управления ценами, когда её скрывает управляющая учётка */
.stage-price-button.stage-price-button--hidden-by-manager {
    display: none;
}

/* Отдельный сегмент (левая или правая часть продолговатой кнопки) */
.stage-price-button__segment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

/* Отделяем визуально сегменты друг от друга */
.stage-price-button__segment + .stage-price-button__segment {
    border-left: 1px solid #d1d1d6;
}

/* Иконки в сегментах управления ценами */
.stage-price-button__icon {
    font-size: 18px;
    line-height: 1;
}

/* Подсвечиваем активный показ цен */
.stage-price-button.is-active .stage-price-button__segment--toggle {
    background: #f0f8ff;
    color: #005177;
    font-weight: 700;
}

/* Отдельно подсвечиваем необходимость обновления цен */
.stage-price-button.has-stale-prices .stage-price-button__segment--refresh {
    background: #fff7e6;
    color: #a66300;
    font-weight: 700;
}

/* Визуально блокируем правый сегмент, когда он отключен */
.stage-price-button__segment.is-disabled,
.stage-price-button__segment:disabled {
    background: #f5f6f8;
    color: #9d9da3;
    cursor: not-allowed;
}

/* Эффект наведения и фокуса для каждого сегмента */
.stage-price-button__segment:hover,
.stage-price-button__segment:focus {
    background: #f0f8ff;
    color: #005177;
}

/* Сброс стандартного outline и подсветка при клавиатурной навигации */
.stage-price-button__segment:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(0, 115, 170, 0.35);
    border-radius: 999px;
}

/* Показываем состояние загрузки всей группы */
.stage-price-button.is-loading {
    opacity: 0.8;
}

/* Кнопка открытия окна параметров конфигуратора */
.stage-settings-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #d1d1d6;
    background: #ffffff;
    color: #027ffa;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    margin-left: auto;
}

.stage-settings-button .dashicons {
    font-size: 18px;
    line-height: 1;
}

.stage-engineering-button {
    /* Кнопка инженерного меню повторяет стиль остальных круглых контролов */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #d1d1d6;
    background: #ffffff;
    color: #a50064;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.stage-engineering-button .dashicons {
    /* Увеличиваем иконку, чтобы она соответствовала соседним кнопкам */
    font-size: 18px;
    line-height: 1;
}

.stage-engineering-button:hover,
.stage-engineering-button:focus {
    /* Подсветка при наведении и фокусе помогает заметить кнопку инженера */
    color: #7a0046;
    border-color: #7a0046;
    background: #fff0f7;
    box-shadow: 0 2px 8px rgba(165, 0, 100, 0.25);
}

.stage-engineering-button:focus-visible {
    /* Явный контур фокуса для клавиатурной навигации */
    outline: none;
    box-shadow: 0 0 0 2px rgba(165, 0, 100, 0.35);
}

.stage-settings-button:hover,
.stage-settings-button:focus {
    color: #005177;
    border-color: #005177;
    background: #f0f8ff;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.25);
}

.stage-settings-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.35);
}

/* Сохраняем кнопку помощи без смещения относительно соседних контролов */
.stage-controls .stage-help-button {
    margin-left: 0;
}

.stage-help-button:hover,
.stage-help-button:focus {
    color: #005177;
    border-color: #005177;
    background: #f0f8ff;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.25);
    /* Останавливаем мерцание, чтобы не отвлекало во время взаимодействия */
    animation-play-state: paused;
}

.stage-help-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.35);
}


/* Обёртка инженерного меню располагаем поверх каталога */
.engineering-panel-wrapper {
    /* Фиксируем контейнер панели поверх остального интерфейса и не перекрываем клики */
    position: fixed;
    inset: 0;
    padding: 16px;
    pointer-events: none;
    z-index: 1000;
}

.engineering-panel {
    /* Панель инженерного меню делаем плавающим окном с возможностью перетаскивания */
    position: fixed;
    top: 24px;
    right: 24px;
    left: auto;
    width: min(380px, calc(100% - 48px));
    max-height: calc(100vh - 48px);
    padding: 16px;
    border: 1px solid rgba(209, 209, 214, 0.8);
    border-radius: 12px;
    background: #ffffff;
    color: #1d1d1f;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    overflow-y: auto;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1001;
}

.engineering-panel.is-hidden {
    /* Сохраняем класс для обратной совместимости: панель скрыта */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.engineering-panel.is-visible {
    /* Показываем панель, не влияя на поток документа */
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.engineering-panel__header {
    /* Шапка панели: размещаем заголовок и кнопку закрытия по краям */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: grab;
    user-select: none;
    touch-action: none; /* Блокируем жесты прокрутки, чтобы перетаскивание работало на тач-экранах */
}

.engineering-panel__close {
    /* Кнопка закрытия: делаем компактной и заметной */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: -8px -8px -8px auto;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #1d1d1f;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.engineering-panel__close:focus-visible {
    /* Подсвечиваем кнопку при фокусе для клавиатурной навигации */
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

.engineering-panel__close:hover {
    /* При наведении слегка изменяем фон */
    background: rgba(60, 60, 67, 0.1);
}

.engineering-panel.is-dragging .engineering-panel__header {
    /* Пока пользователь тянет окно, показываем соответствующий курсор */
    cursor: grabbing;
}

.engineering-panel__close-icon {
    /* Символ крестика центрируем и увеличиваем */
    display: block;
    font-size: 20px;
    line-height: 1;
}

.engineering-panel__close {
    /* Кнопка закрытия: делаем компактной и заметной */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: -8px -8px -8px auto;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #1d1d1f;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.engineering-panel__close:focus-visible {
    /* Подсвечиваем кнопку при фокусе для клавиатурной навигации */
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

.engineering-panel__close:hover {
    /* При наведении слегка изменяем фон */
    background: rgba(60, 60, 67, 0.1);
}

.engineering-panel__close-icon {
    /* Символ крестика центрируем и увеличиваем */
    display: block;
    font-size: 20px;
    line-height: 1;
}

.engineering-panel__content {
    /* Разбиваем контент на адаптивную сетку карточек */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.engineering-panel__section {
    /* Каждая секция ведёт себя как карточка с данными */
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: 10px;
    background-color: #f5f6f8;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.engineering-panel__section-title {
    /* Заголовок секции делаем более выразительным */
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
}

.engineering-panel__list {
    /* Список параметров отображаем компактно и без стандартных отступов */
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 8px;
    row-gap: 4px;
    margin: 0;
    padding: 0;
}

.engineering-panel__item-label {
    /* Названия параметров выделяем более тёмным цветом */
    margin: 0;
    font-weight: 500;
    color: #3a3a3c;
}

.engineering-panel__item-value {
    /* Значения оставляем в обычном начертании */
    margin: 0;
    color: #1d1d1f;
    word-break: break-word;
}

.engineering-panel__placeholder {
    /* Текст-заглушка располагаем с небольшими отступами */
    margin: 0;
    padding: 12px;
    border-radius: 10px;
    background-color: #f5f6f8;
    color: #3a3a3c;
}

/* Акцентируем рамку при наведении и фокусе внутри группы */
.stage-price-button:hover,
.stage-price-button:focus-within {
    border-color: #005177;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.25);
}

/* Уточняем рамку, когда цены включены */
.stage-price-button.is-active {
    border-color: #005177;
}

/* Уточняем рамку, когда требуется обновление цен */
.stage-price-button.has-stale-prices {
    border-color: #a66300;
    /* Сбрасываем внешний отступ, чтобы кнопка без смещения примыкала к другим элементам панели */
    margin: 0;
}

@media (max-width: 1024px) {
    .stage-controls {
        width: 100%;
        justify-content: space-between;
    }

    .stage-help-button {
        margin-left: 0;
    }

    .stage-price-button {
        margin-left: 4px;
    }
}

@media (max-width: 768px) {
    /* На планшетах и телефонах панель растягивается почти на всю ширину */
    .engineering-panel-wrapper {
        padding: 12px;
    }

    .engineering-panel {
        left: 16px;
        right: auto;
        width: calc(100% - 32px);
        max-width: none;
        max-height: calc(100vh - 32px);
    }
}

@media (max-width: 600px) {
    .engineering-panel__content {
        /* На узких экранах переходим в одну колонку */
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .engineering-panel__content {
        /* На узких экранах переходим в одну колонку */
        grid-template-columns: 1fr;
    }
}

.stage-indicator {
    flex: 1;
    text-align: center;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
    opacity: 0.6;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.stage-indicator.active {
    opacity: 1;
    transform: scale(1.05);
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.stage-indicator.stage-start {
    background: #ffebee;
    color: #c62828;
}

.stage-indicator.stage-middle {
    background: #e3f2fd;
    color: #1565c0;
}

.stage-indicator.stage-end {
    background: #e8f5e9;
    color: #2e7d32;
}

.stage-indicator.stage-start.active {
    background: #c62828;
    color: #ffffff;
}

.stage-indicator.stage-middle.active {
    background: #1565c0;
    color: #ffffff;
}

.stage-indicator.stage-end.active {
    background: #2e7d32;
    color: #ffffff;
}

.stage-number {
    font-size: 14px;
    font-weight: bold;
}

.stage-name {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Сцена сборки */
.scene-wrapper {
    display: flex;
    gap: 5px; /* Сокращаем расстояние между сценой и доп. блоками */
    width: 100%;
    /* Комментарий: убираем нижний отступ, чтобы блок не давал лишнюю высоту. */
    margin-bottom: 0;

    align-items: stretch;
}

.scene-container {
    flex: 1 1 auto;
    height: 40vh;
    min-height: 250px;
    background: linear-gradient(45deg, #fafafa 25%, transparent 25%),
                linear-gradient(-45deg, #fafafa 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #fafafa 75%),
                linear-gradient(-45deg, transparent 75%, #fafafa 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scene-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Комментарий: когда доступно перемещение сцены, показываем пользователю курсор "ладонь". */
.scene-canvas.is-pan-enabled {
    cursor: grab;
}

/* Комментарий: во время активного перемещения используем курсор "захват". */
.scene-canvas.is-pan-enabled.is-pan-active {
    cursor: grabbing;
}

/* Комментарий: синхронизируем курсор холста с контейнером, чтобы жесты были предсказуемыми. */
.scene-canvas.is-pan-enabled canvas {
    cursor: inherit;
}

/* Скрываем элементы управления сценой до взаимодействия пользователя */
.scene-container [data-scene-control] {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Показываем элементы управления при наведении или фокусе внутри сцены */
.scene-container:hover [data-scene-control],
.scene-container:focus-within [data-scene-control] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.scene-canvas canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.scene-controls {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(4px);
    z-index: 12;
}

.scene-pillow-align {
    position: absolute;
    right: 12px;
    bottom: 56px;
    z-index: 12;
    display: flex;
}

.scene-pillow-align-btn {
    position: relative;
}

.scene-pillow-align-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}

.scene-pillow-align-btn.is-mode-vertical::before {
    background-image: url('../images/pillow-align-vertical.svg');
}

.scene-pillow-align-btn.is-mode-horizontal::before {
    background-image: url('../images/pillow-align-horizontal.svg');
}

.scene-pillow-align-btn.is-mode-free::before {
    background-image: url('../images/pillow-align-free.svg');
}

.scene-pillow-align-btn[disabled]::before {
    opacity: 0.65;
}

.scene-module-dimensions {
    position: absolute;
    right: 12px;
    bottom: 100px;
    z-index: 12;
    display: flex;
}

.scene-module-dimensions-btn {
    position: relative;
}

.scene-module-dimensions-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
    background: url('../images/icon-dimensions.svg') no-repeat center;
    background-size: contain;
}

.scene-module-dimensions-btn.is-active {
    background: #546e7a;
}

.scene-module-dimensions-btn[disabled]::before {
    opacity: 0.65;
}

.scene-fabric-toggle {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 12;
    display: flex;
}

.scene-fabric-toggle-btn {
    position: relative;
}

.scene-fabric-toggle-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ffab91, #4dd0e1);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.scene-fabric-toggle-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    transform: translate(-50%, -50%) rotate(45deg);
}

.scene-fabric-toggle-btn.is-inactive::before {
    background: linear-gradient(135deg, #b0bec5, #90a4ae);
}

.scene-fabric-toggle-btn.is-inactive::after {
    background: rgba(255, 255, 255, 0.8);
}

.scene-fabric-toggle-btn[disabled]::before {
    background: linear-gradient(135deg, #cfd8dc, #b0bec5);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.scene-fabric-toggle-btn[disabled]::after {
    background: rgba(255, 255, 255, 0.6);
}

.scene-scale-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #607d8b;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

/* Комментарий: выравниваем пиктограмму поворота в новой кнопке вращения сцены. */
.scene-rotate-btn .dashicons {
    font-size: 16px;
    line-height: 1;
    /* Комментарий: растягиваем контейнер иконки на всю кнопку, чтобы центрировать символ. */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.scene-scale-btn:hover,
.scene-scale-btn:focus {
    background: #455a64;
    transform: scale(1.05);
    outline: none;
}

.scene-scale-btn:active {
    transform: scale(0.95);
}

.scene-scale-btn[disabled] {
    background: #b0bec5;
    cursor: default;
    transform: none;
}

.scene-scale-value {
    font-weight: 600;
    font-size: 14px;
    color: #37474f;
    min-width: 48px;
    text-align: center;
    cursor: pointer; /* Комментарий: подсказка пользователю, что значение масштаба теперь кликабельно. */
}

.scene-options-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 13; /* Комментарий: держим слой опций выше standalone-оверлеев, чтобы перетаскивание опции не перехватывалось креслом под ней. */
}

.scene-option {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    transform-origin: center center;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
}

.scene-option.is-dragging {
    box-shadow: none;
}

.scene-option-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scene-option-image {
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
}

.scene-option-placeholder {
    font-size: 24px;
    font-weight: 700;
    color: #546e7a;
    text-transform: uppercase;
}

.scene-option-caption {
    width: 100%;
    font-size: 12px;
    line-height: 1.2;
    color: #37474f;
    text-align: center;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.85);
    border-top: 1px solid rgba(96, 125, 139, 0.2);
    pointer-events: none;
}

.scene-option-rotate {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(96, 125, 139, 0.9);
    color: #fff;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translate(-50%, -50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.scene-option:hover > .scene-option-rotate,
.scene-option:focus-within > .scene-option-rotate,
.scene-option-rotate:hover,
.scene-option-rotate:focus {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.scene-option-rotate:hover,
.scene-option-rotate:focus {
    background: rgba(69, 90, 100, 0.95);
    transform: translate(-50%, -50%) scale(1.05);
    outline: none;
}

.scene-option-rotate:active {
    transform: translate(-50%, -50%) scale(0.9);
}

#destyle-configurator:not(.is-options-tab-active) .scene-option-rotate {
    display: none;
}

.scene-standalone-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 12;
}

.standalone-module-overlay {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: center center;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    border: none !important;
    background: transparent;
}

.standalone-module-overlay.is-dragging {
    border: none !important;
}

.standalone-module-rotate {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(94, 53, 177, 0.9);
    color: #fff;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translate(-50%, -50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.standalone-module-overlay:hover > .standalone-module-rotate,
.standalone-module-overlay:focus-within > .standalone-module-rotate,
.standalone-module-rotate:hover,
.standalone-module-rotate:focus {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.standalone-module-rotate:hover,
.standalone-module-rotate:focus {
    background: rgba(74, 33, 157, 0.95);
    transform: translate(-50%, -50%) scale(1.05);
    outline: none;
}

.standalone-module-rotate:active {
    transform: translate(-50%, -50%) scale(0.9);
}

.module-rotate-button {
    position: absolute;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    color: #424242;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translate(-50%, -50%);
    z-index: 5;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.module-rotate-button.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.module-rotate-button:hover,
.module-rotate-button:focus {
    background: rgba(255, 255, 255, 0.95);
    transform: translate(-50%, -50%) scale(1.05);
    outline: none;
}

.module-rotate-button:active {
    transform: translate(-50%, -50%) scale(0.9);
}

.scene-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    color: #86868b;
    pointer-events: none;
}

.scene-empty .dashicons {
    color: #d0d0d0;
    font-size: 48px;
}

.scene-empty-icon {
    width: 72px;
    height: 72px;
    object-fit: contain;
    display: block;
}

.scene-empty p {
    margin: 0;
}

/* Информация о габаритах */
.dimensions-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Отдельно задаём отступы, чтобы точнее контролировать расстояния вокруг текста. */
    padding-top: 5px;
    padding-right: 5px;
    padding-bottom: 0px;
    padding-left: 5px;
    background: #ffffff;
    border-radius: 10px;
    /* Комментарий: убираем обводку и тень, чтобы блок габаритов визуально сливался с общим фоном. */
    color: #1d1d1f;
    /* Комментарий: уменьшаем фиксированную ширину панели, чтобы подписи параметров оставались в одной строке, но блок занимал меньше места. */
    flex: 0 0 230px;
    width: 230px;
    min-width: 120px;
    align-items: stretch;
    height: 100%;
    align-self: stretch;
}

.dimensions-info.is-empty {
    opacity: 0.7;
    /* Комментарий: обновляем ширину пустого состояния, чтобы она совпадала с уменьшенной шириной панели. */
    width: 230px;
}


.dimensions-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.dimensions-row {
    display: flex;
    gap: 0; /* Убираем промежутки, чтобы разделительные линии примыкали к значениям */
    width: 100%;
}

/* Добавляем тонкие разделители между соседними значениями */
.dimensions-row .dimension-item:not(:first-child) {
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.dimensions-row-top .dimension-item {
    flex: 1 1 0;
}

.dimensions-row-middle .dimension-item {
    flex: 1 1 0;
}

.dimensions-row-bottom .dimension-item {
    flex: 1 1 0;
}


.dimension-item {
    display: flex;
    flex-direction: column;
    gap: 0; /* Убираем вертикальный зазор между подписью и значением, чтобы сделать блоки компактнее */
    align-items: center; /* Центрируем значения относительно подписей */
    text-align: center; /* Выравниваем текстовые блоки по центру */
    padding: 0 4px; /* Добавляем аккуратные боковые отступы по 4px, чтобы значения не прилипали к разделителям */
    box-sizing: border-box; /* Учитываем рамки и отступы при расчёте ширины */
}

.dimension-item.dimension-modules {
    min-width: 0;
}

.dimension-item.dimension-modules .dimension-value {
    justify-content: center; /* Сохраняем единое центрирование для счётчика модулей */
}


.dimension-label {
    font-size: 10px; /* Делаем заголовки характеристик чуть заметнее, чтобы читались с первого взгляда */
    color: #5c5c5f;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    width: 100%; /* Позволяем подписи растягиваться, чтобы центрировать текст */
    line-height: 12px; /* Фиксируем высоту строки, чтобы фактический зазор между подписью и значением был 12px без внешних отступов */
}

.dimension-value {
    font-size: 14px; /* Слегка уменьшаем числовое значение, чтобы визуально сблизить его с подписью */
    font-weight: 600;
    color: #1d1d1f;
    display: flex;
    align-items: baseline;
    gap: 3px;
    justify-content: center; /* Центрируем числовые значения и единицы измерения */
    width: 100%; /* Делаем блок растяжимым для корректного центрирования */
}

.dimension-unit {
    font-size: 12px;
    color: #86868b;
}

.dimension-unit.is-hidden {
    visibility: hidden;
}

/* Комментарий: утилита скрывает текст визуально, сохраняя его для скринридеров. */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

.dimension-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: auto;
    padding: 0; /* Комментарий: убираем внутренние отступы, чтобы блок занимал всю доступную ширину без дополнительных полей. */
    box-sizing: border-box; /* Комментарий: сохраняем корректный расчёт ширины с учётом изменённых отступов. */
}

.dimension-controls__row {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    width: 100%; /* Комментарий: растягиваем каждую строку, чтобы элементы сетки занимали всю ширину контейнера. */
}

.dimension-controls__row--spec-toggle {
    display: none;
}

/* Комментарий: в портретной ориентации показываем на кнопке спецификации только иконку, экономя горизонтальное пространство. */
@media (orientation: portrait) {
    #btn-toggle-specification {
        justify-content: center;
    }
}

.dimension-controls .btn {
    width: 100%;
    min-height: 52px;
    padding: 12px;
    font-size: 0;
    font-weight: 600;
    justify-content: center;
    text-align: center;
    background-color: #f2f3f5; /* Комментарий: используем единый светло-серый фон для уменьшения визуального шума. */
    color: #202228;
    border: 2px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.dimension-controls .btn .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.dimension-controls__row .btn {
    width: 100%; /* Комментарий: заставляем каждую кнопку занимать свою долю строки. */
    flex: 1;
    min-width: 0;
}

/* Комментарий: обеспечиваем кнопке авторизации такую же растяжку по ширине, как и у остальных элементов ряда. */
.dimension-controls__row .configurator-auth-button {
    width: 100%;
    flex: 1;
    min-width: 0;
}

/* Комментарий: выравниваем нижний ряд — две кнопки делят доступную ширину поровну. */
.dimension-controls__row > .download-dropdown,
.dimension-controls__row > #btn-share-config {
    flex: 1 1 calc(50% - 6px); /* Комментарий: задаём базовую ширину для каждой кнопки ровно в половину строки с учётом промежутка. */
    max-width: calc(50% - 6px); /* Комментарий: не даём элементам перерастать свою половину, сохраняя симметрию. */
}

/* Комментарий: оставляем возможность выпадающему меню растягиваться на всю свою колонку. */
.dimension-controls__row > .download-dropdown {
    width: 100%;
}

.dimension-controls__row > .download-dropdown #btn-download-menu {
    width: 100%;
}

/* Комментарий: делаем кнопку случайной конфигурации во всю ширину и выравниваем иконку по центру. */
.dimension-controls__row--random {
    gap: 8px; /* Комментарий: уменьшаем отступ между частями разделённой кнопки для визуальной связности */
}

.dimension-controls__row--random .btn {
    width: 100%;
}

.dimension-controls__random-button--primary {
    flex: 0 1 67%; /* Комментарий: основная часть занимает две трети доступной ширины */
}

.dimension-controls__random-button--extend {
    flex: 0 1 33%; /* Комментарий: вспомогательная кнопка занимает оставшуюся треть */
    border-left: 1px solid rgba(32, 34, 40, 0.12); /* Комментарий: добавляем разделитель между частями кнопки */
}

.dimension-controls__random-button--extend .dashicons {
    font-size: 18px; /* Комментарий: делаем иконку добавления чуть крупнее для лучшей читаемости */
}

.dimension-controls__row--history {
    gap: 12px; /* Комментарий: сохраняем единое расстояние между кнопками во всех строках. */
}

.dimension-controls__row--history .btn {
    padding: 12px;
}

.dimension-controls__row--history .btn .dashicons {
    margin: 0;
}

/* Комментарий: выравниваем кнопку открытия меню скачивания под новый вид с иконкой. */
.dimension-controls .download-dropdown__toggle {
    justify-content: center;
    gap: 0;
    background-color: #f2f3f5;
    border: 2px solid rgba(210, 66, 79, 0.66); /* Комментарий: смягчаем красную обводку, снижая её непрозрачность до 66%. */
}

.dimension-controls .download-dropdown__toggle .dashicons {
    font-size: 24px;
}

/* Комментарий: добавляем выразительную обводку для кнопки копирования ссылки. */
.dimension-controls #btn-share-config {
    border-color: rgba(83, 109, 254, 0.66); /* Комментарий: уменьшаем насыщенность синей рамки до 66% прозрачности, чтобы смягчить цвет. */
}

.dimension-controls #btn-share-config:hover,
.dimension-controls .download-dropdown__toggle:hover {
    background-color: #e4e6eb;
}

/* Комментарий: добавляем мягкую подсветку при клавиатурной фокусировке. */
.dimension-controls #btn-share-config:focus-visible,
.dimension-controls .download-dropdown__toggle:focus-visible {
    outline: none;
}

.dimension-controls #btn-share-config:focus-visible {
    box-shadow: 0 0 0 2px rgba(83, 109, 254, 0.25);
}

.dimension-controls .download-dropdown__toggle:focus-visible {
    box-shadow: 0 0 0 2px rgba(210, 66, 79, 0.25);
}

/* Комментарий: убираем цветовые различия у вспомогательных кнопок в блоке управления размерами. */
.dimension-controls .btn.btn-primary,
.dimension-controls .btn.btn-danger,
.dimension-controls .btn.btn-success,
.dimension-controls .btn.btn-dark,
.dimension-controls .btn.btn-random {
    background-color: #f2f3f5;
    color: #202228;
}

.dimension-controls .btn.btn-primary:hover,
.dimension-controls .btn.btn-danger:hover,
.dimension-controls .btn.btn-success:hover,
.dimension-controls .btn.btn-dark:hover,
.dimension-controls .btn.btn-random:hover {
    background-color: #e4e6eb;
}

/* Комментарий: сохраняем компактность высоты строк при увеличенных иконках. */
.dimension-controls .btn-compact {
    min-height: 52px;
    padding: 12px;
}

.dimension-controls .btn-compact .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.download-dropdown {
    position: relative;
    flex: 1;
}

.download-dropdown__toggle {
    width: 100%;
    justify-content: center; /* Комментарий: центрируем иконку загрузки в соответствии с остальными кнопками. */
    gap: 6px;
}

.download-dropdown__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #757575; /* Комментарий: задаём мягкий серый фон для выпадающего меню, чтобы снизить контраст. */
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 6px;
    z-index: 100;
}

/* Комментарий: контейнер для индикатора загрузки в меню скачивания */
.download-dropdown__loader {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
}

/* Комментарий: при активной загрузке показываем спиннер вместо кнопок */
.download-dropdown__loader.is-visible {
    display: flex;
}

/* Комментарий: скрываем все элементы меню, пока активна загрузка, оставляя только индикатор. */
.download-dropdown__menu.is-loading > :not(.download-dropdown__loader) {
    display: none !important;
}

/* Комментарий: круговой индикатор, который плавно вращается */
.download-dropdown__spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    animation: download-dropdown-spinner 0.9s linear infinite;
}

@keyframes download-dropdown-spinner {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.download-dropdown.is-open .download-dropdown__menu {
    display: flex;
}

.download-dropdown__item {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Комментарий: вариант пункта меню с иконкой выравниваем по левому краю и добавляем отступ между иконкой и текстом */
.download-dropdown__item--with-icon {
    justify-content: flex-start;
    gap: 6px;
}

/* Комментарий: немного увеличиваем иконку, чтобы она читалась рядом с текстом */
.download-dropdown__item--with-icon .dashicons {
    font-size: 16px;
}

/* Комментарий: контейнер разделенной кнопки XLSX без внутренних отступов */
.download-dropdown__item--split {
    padding: 0;
    overflow: hidden;
    align-items: stretch;
}

/* Комментарий: базовый стиль частей разделенной кнопки */
.download-dropdown__split-button {
    flex: 1 1 auto;
    background: transparent;
    color: inherit;
    border: none;
    font: inherit;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

/* Комментарий: основная часть кнопки, запускающая мгновенную выгрузку */
.download-dropdown__split-button--primary {
    flex-basis: 66%;
}

/* Комментарий: правая часть для запуска модального окна с номером заказа */
.download-dropdown__split-button--order {
    flex-basis: 34%;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    font-weight: 700;
}

.download-dropdown__item:hover,
.download-dropdown__item:focus {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
    outline: none;
}

/* Комментарий: реакции на наведение и фокус для частей разделенной кнопки */
.download-dropdown__split-button:hover,
.download-dropdown__split-button:focus {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
    outline: none;
}

.download-dropdown__split-button:focus-visible {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.download-dropdown__split-button:active {
    transform: translateY(0);
}

.download-dropdown__item:active {
    transform: translateY(0);
}

.download-dropdown.is-disabled .download-dropdown__toggle,
.download-dropdown.is-disabled .download-dropdown__item {
    cursor: not-allowed;
}

.download-dropdown.is-disabled .download-dropdown__split-button {
    cursor: not-allowed;
    opacity: 0.6;
}

.download-dropdown.is-disabled .download-dropdown__toggle {
    opacity: 0.6;
}

.btn-compact {
    min-height: 22px;
    padding: 5px 7px;
    font-size: 11px;
}

.btn-compact .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
}

.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.btn-primary {
    background: #007AFF;
    color: white;
}

.btn-primary:hover {
    background: #0051D5;
    transform: translateY(-1px);
}

.btn-danger {
    background: #d2424f;
    color: white;
}

.btn-danger:hover {
    background: #b53842;
    transform: translateY(-1px);
}

.btn-random {
    /* Комментарий: задаём новый фирменный оттенок для кнопки случайной конфигурации. */
    background: #D32F2F;
    color: #ffffff;
}

.btn-random:hover {
    /* Комментарий: при наведении делаем цвет чуть темнее для визуальной обратной связи. */
    background: #B71C1C;
    transform: translateY(-1px);
}

.btn-random:disabled,
.btn-random[aria-disabled="true"],
.btn-random[aria-busy="true"] {
    /* Комментарий: сохраняем визуальную консистентность при блокировке кнопки. */
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.btn-random:disabled:hover,
.btn-random[aria-disabled="true"]:hover,
.btn-random[aria-busy="true"]:hover {
    /* Комментарий: в заблокированном состоянии сохраняем основной цвет кнопки. */
    background: #D32F2F;
}

.btn-success {
    background: #34C759;
    color: white;
}

.btn-success:hover {
    background: #248A3D;
    transform: translateY(-1px);
}

.btn-dark {
    background: #757575;
    color: #f5f5f7;
}

.btn-dark:hover:not(:disabled) {
    background: #5e5e5e;
    transform: translateY(-1px);
}

.btn-dark:disabled,
.btn-dark[disabled] {
    background: #9e9e9e;
    color: #d1d1d6;
    cursor: not-allowed;
    transform: none;
    opacity: 0.8;
}

#btn-share-config {
    background-color: #f2f3f5; /* Комментарий: приводим кнопку ссылки к новому единому стилю. */
    border-color: #536dfe;
    color: #202228;
}

#btn-share-config:hover:not(:disabled) {
    background-color: #e4e6eb;
}

/* Комментарий: выделяем кнопку авторизации уникальным стилем и эффектом мерцания рамки, не наследуя общие стили .btn. */
.configurator-auth-button {
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    background-color: #f5fff8;
    color: #993333;
    border: 2px solid #993333;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    animation: configurator-auth-button-border-pulse 1.5s ease-in-out infinite;
}

.configurator-auth-button:hover:not(:disabled),
.configurator-auth-button:focus-visible:not(:disabled) {
    background-color: #eef8f0;
    border-color: #b33b3b;
    box-shadow: 0 0 0 3px rgba(153, 51, 51, 0.25);
}

.configurator-auth-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    box-shadow: none;
}

.configurator-auth-button .dashicons {
    font-size: 18px;
    color: #993333;
}

/* Комментарий: подпись с подсказкой «Войти чтобы увидеть цены» показываем в две строки под иконкой. */
.configurator-auth-button__label {
    /* Комментарий: тянем подпись на всю ширину, чтобы центрировать текст при сохранении иконки слева. */
    display: inline-flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-weight: 700;
    text-align: center;
}

.configurator-auth-button__label-line {
    line-height: 1.1;
}

.configurator-auth-button__label-line--secondary {
    font-size: 12px;
    font-weight: 600;
}

/* Комментарий: анимация мерцания красной рамки для привлечения внимания. */
@keyframes configurator-auth-button-border-pulse {
    0% {
        border-color: #993333;
        box-shadow: 0 0 0 0 rgba(153, 51, 51, 0.35);
    }
    50% {
        border-color: #d14848;
        box-shadow: 0 0 0 4px rgba(209, 72, 72, 0.3);
    }
    100% {
        border-color: #993333;
        box-shadow: 0 0 0 0 rgba(153, 51, 51, 0.35);
    }
}
#btn-share-config .dashicons {
    align-self: center;
}

#btn-share-config .btn-share-label,
#btn-share-config.is-copied .btn-share-label {
    color: inherit;
}

.configurator-access-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100000;
}

.configurator-access-modal.is-visible {
    display: flex;
}

.configurator-access-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.configurator-access-modal__dialog {
    position: relative;
    width: min(960px, 100%);
    max-height: 90vh;
    overflow: auto;
    padding: 10px;
}

.configurator-access-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    background: #ffffff;
    border-radius: 50%;
    border: 1px solid rgba(17, 24, 39, 0.12);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.configurator-access-modal .destyle-configurator-access {
    min-height: auto;
    padding: 0;
    width: 100%;
    background: transparent;
}

.configurator-access-modal .destyle-configurator-access__inner {
    margin: 0 auto;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Список выбранных модулей */
.selected-modules {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 5px; /* Добавляем отступ снизу для блока спецификации */
    padding-left: 5px; /* Добавляем отступ слева для блока спецификации */
}

/* Шапка блока с выбранными модулями и общей ценой */
.selected-modules__header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 10px; /* Комментарий: уменьшаем боковые отступы, чтобы освободить место под название модели. */
    gap: 12px; /* Комментарий: добавляем аккуратный промежуток между названием, ссылкой и ценой. */
    min-height: 40px;
    font-size: 16px; /* Комментарий: выравниваем размер шрифта для всей шапки. */
    color: #1d1d1f; /* Комментарий: задаём единый цвет текста для заголовка и названия модели. */
}

.selected-modules__title {
    font-size: 16px;
    margin: 0;
    color: #1d1d1f;
}

/* Комментарий: центральный блок с названием модели делаем ярким и адаптивным. */
.selected-modules__model-name {
    flex: 1;
    display: none;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 16px; /* Комментарий: выравниваем размер шрифта с заголовком. */
    font-weight: 700;
    color: #1d1d1f; /* Комментарий: выравниваем цвет текста с заголовком. */
    padding: 6px 10px;
    background: #f0f7ff;
    border-radius: 6px;
    min-height: 32px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selected-modules__model-name.is-visible {
    display: flex;
    justify-content: flex-start; /* Комментарий: выравниваем название модели по левому краю при показе. */
    background: transparent; /* Комментарий: убираем фоновую заливку для более чистого вида. */
}

.selected-modules__model-link {
    display: none;
    align-items: center;
    margin-left: auto;
    /* Комментарий: приводим ссылку к стилю вкладок справочного окна. */
    gap: 8px;
    /* Комментарий: уменьшаем горизонтальные отступы и убираем вертикальные. */
    padding: 0 10px;
    border: 1px solid rgba(215, 222, 240, 0.8);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease,
        transform 0.2s ease;
}

.selected-modules__model-link.is-visible {
    display: inline-flex;
}

.selected-modules__model-link:hover,
.selected-modules__model-link:focus {
    /* Комментарий: дублируем поведение наведения и фокуса как у вкладок справки. */
    background: #fff;
    color: #0f172a;
    border-color: #3b82f6;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.18);
    transform: translateY(-1px);
}

.selected-modules__model-link:focus-visible {
    /* Комментарий: подсветка фокуса соответствует кнопкам в окне справки. */
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.selected-modules__total-price {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    white-space: nowrap;
    display: none;
}

.selected-modules__total-price.is-visible {
    display: block;
}

.selected-modules-placeholder {
    display: none;
}

.global-name {
    font-size: 16px; /* Устанавливаем размер шрифта для глобального названия */
    font-weight: bold;
    color: #027ffa; /* Устанавливаем фирменный оттенок текста */
    margin-bottom: 8px;
    padding: 6px 10px 0; /* Оставляем верхний и боковые отступы, убираем нижний */
    background: rgb(0 0 0 / 0%);
    border-radius: 6px;
    min-height: 30px;
}

.modules-list {
    flex: 1;
    background: #f5f5f7;
    border-radius: 8px;
    padding: 8px;
    overflow-y: auto;
    min-height: 0;
    position: relative; /* Комментарий: фиксируем модальное окно выбора сиденья внутри блока спецификации. */
}

.modules-list > .seat-type-overlay {
    border-radius: inherit; /* Комментарий: сохраняем одинаковый радиус у перекрывающего слоя и списка модулей. */
}

.module-item {
    background: white;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 45px;
}

.module-item-number {
    width: 24px;
    height: 24px;
    background: #007AFF;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: bold;
    flex-shrink: 0;
}

.module-item-thumb-wrapper {
    position: relative;
    width: 35px;
    height: 30px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.module-item-thumb-wrapper-option {
    width: 44px;
    height: 44px;
}

.module-item-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f5f5f7;
    border-radius: 3px;
}

.module-item-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(29, 29, 31, 0.8);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.module-item.is-highlighted {
    /* Комментарий: подчёркиваем активный модуль в спецификации тем же цветом, что и на сцене. */
    background: rgba(0, 122, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.35);
}

.module-item.is-highlighted .module-item-number {
    background: #0051d5;
}

.module-item-remove::before {
    content: '\2715';
}

.module-item-remove:focus {
    outline: none;
}

.module-item-remove:focus-visible {
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.6);
}

.module-item-thumb-wrapper:hover .module-item-remove,
.module-item-thumb-wrapper:focus-within .module-item-remove,
.module-item-remove:focus-visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Комментарий: адаптируем кнопку удаления для сцены, чтобы управлять её показом вручную. */
.scene-module-remove {
    z-index: 20;
    transform-origin: center;
}

/* Комментарий: делаем кнопку кликабельной и заметной, когда модуль выделен на сцене. */
.scene-module-remove.is-visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.module-item-seat {
    justify-content: flex-start;
    gap: 14px;
}

.module-item-seat .module-item-number {
    background: #0051D5;
}

.module-item-seat-thumb {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

.module-item-seat-icon {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    /* Перекрашиваем изображение в серый #999999, сохраняя прозрачность */
    filter: grayscale(1) invert(1) brightness(0.6);
}

.module-item-seat-icon-placeholder {
    background: rgba(0, 122, 255, 0.1);
    border-radius: 50%;
}

.module-item-seat .module-item-details {
    flex: 0 1 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    text-align: left;
}

.module-item-seat .module-item-name,
.module-item-seat .module-item-description {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.module-item-seat .module-item-details {
    flex: 0 1 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    text-align: left;
}

.module-item-seat .module-item-name,
.module-item-seat .module-item-description {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.module-item-seat .seat-type-change {
    margin-top: 0;
    margin-left: 0;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #d0d3d8;
    background: #f5f5f7;
    color: #007AFF;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    vertical-align: middle;
}

.module-item-seat .seat-type-change:hover {
    background: #e8f0ff;
    border-color: #007AFF;
}

.module-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.module-item-empty {
    gap: 8px;
}

.module-item-empty-message {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    margin-right: auto;
}

.module-item-name {
    font-size: 15px;
    color: #1d1d1f;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    margin: 0;
    flex-shrink: 0;
}

.module-item-empty .module-item-name,
.module-item-empty .module-item-description {
    white-space: normal;
    flex: 0 0 auto;
    display: block;
    mask-image: none;
    -webkit-mask-image: none;
}

.module-item-description {
    font-size: 13px;
    color: #666;
    text-align: left;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    margin: 0;
    min-width: 0;
    /* Комментарий: возвращаем классическую обрезку текста и плавное затухание по краю, как до эксперимента со скроллбаром. */
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    mask-image: linear-gradient(90deg, rgba(0, 0, 0, 1) calc(100% - 16px), rgba(0, 0, 0, 0));
    -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 1) calc(100% - 16px), rgba(0, 0, 0, 0));
    /* Комментарий: задаём переменные по умолчанию для плавной бегущей строки. */
    --module-description-marquee-distance: 0px;
    --module-description-marquee-duration: 6s;
}

/* Комментарий: оборачиваем текст в отдельный контейнер, чтобы можно было анимировать его смещение. */
.module-item-description-text {
    display: inline-block;
    min-width: 100%;
    transform: translateX(0);
    will-change: transform;
}

/* Комментарий: при запуске бегущей строки убираем затухание и запускаем анимацию движения текста. */
.module-item-description.is-marquee-active {
    mask-image: none;
    -webkit-mask-image: none;
}

/* Комментарий: анимируем перемещение текста влево на рассчитанную дистанцию. */
.module-item-description.is-marquee-active .module-item-description-text {
    animation: module-item-description-marquee var(--module-description-marquee-duration) linear forwards;
}

/* Комментарий: определяем ключевые кадры для эффекта бегущей строки с небольшой паузой перед началом движения. */
@keyframes module-item-description-marquee {
    0% {
        transform: translateX(0);
    }
    10% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-1 * var(--module-description-marquee-distance)));
    }
}

.module-item-seat .module-item-description {
    flex: 0 1 auto;
    padding-right: 0;
    mask-image: none;
    -webkit-mask-image: none;
}

/* Комментарий: выравниваем блок подголовника по центру и возвращаем высоту, как у остальных элементов. */
.module-item-option.module-item-option-headrest {
    /* Комментарий: добавляем класс module-item-option для перекрытия базового столбцового расположения. */
    /* Комментарий: центруем все элементы строки и убираем визуальную разницу по высоте. */
    align-items: center;
    gap: 12px;
    min-height: 45px;
}

/* Перенастраиваем детали подголовников и заглушек для отображения всех элементов в одной строке */
.module-item-option.module-item-option-headrest .module-item-details {
    /* Комментарий: переносим компоновку в одну строку, чтобы вместить тип, цену и кнопку. */
    flex-direction: row;
    align-items: center;
    gap: 0;
    width: 100%;
}

/* Комментарий: основная строка подголовника содержит все данные и должна уметь сжиматься. */
.module-item-option.module-item-option-headrest .module-item-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* Комментарий: название оставляем неизменным, но не даём ему занимать место типа. */
.module-item-option.module-item-option-headrest .module-item-name {
    flex: 0 0 auto;
}

/* Комментарий: тип опции показывает "Подголовник" или "Заглушка подголовника" и обрезается при переполнении. */
.module-item-option.module-item-option-headrest .module-item-headrest-type {
    flex: 1 1 auto;
    font-size: 13px;
    color: #666;
    display: inline-flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Комментарий: цена и количество выводятся в ряд без переноса. */
.module-item-option.module-item-option-headrest .module-item-price--inline,
.module-item-option.module-item-option-headrest .module-item-size--inline {
    flex: 0 0 auto;
    white-space: nowrap;
    align-self: center;
}

/* Комментарий: цену прижимаем вправо, количество оставляем рядом. */
.module-item-option.module-item-option-headrest .module-item-price--inline {
    margin-left: auto;
}

.module-item-option.module-item-option-headrest .module-item-size--inline {
    margin-left: 12px;
}

/* Комментарий: кнопку "Позиции" ставим перед ценой и количеством, оставляя небольшой отступ от типа. */
.module-item-option.module-item-option-headrest .option-card-headrest-btn {
    margin-left: 12px;
    flex: 0 0 auto;
}

/* Отображение цены элемента спецификации */
.module-item-price {
    font-size: 14px;
    color: #1d1d1f;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 12px;
    flex-shrink: 0;
    align-self: flex-start;
}

.module-item-option .module-item-price {
    margin-left: 8px;
}

.module-item-size {
    font-size: 14px;
    color: #86868b;
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
    margin-left: auto;
    align-self: flex-start;
}

.module-item-option {
    gap: 14px;
    padding-left: 12px;
    align-items: flex-start;
}

.module-item-thumb-option {
    width: 44px;
    height: 44px;
    background: transparent;
    border-radius: 0;
    object-fit: contain;
}

.module-item-option .module-item-details {
    gap: 6px;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    width: 100%;
}

.module-item-option .module-item-name {
    max-width: 100%;
    white-space: normal;
    font-weight: 600;
}

.module-item-option .module-item-description {
    flex: 0 1 auto;
    white-space: normal;
    mask-image: none;
    -webkit-mask-image: none;
    color: #555;
}

.module-item-title-with-description {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.module-item-title-with-description .module-item-name {
    flex-shrink: 0;
}

.module-item-inline-description {
    font-size: 13px;
    color: #666;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    flex: 1 1 auto;
    mask-image: linear-gradient(90deg, rgba(0, 0, 0, 1) calc(100% - 16px), rgba(0, 0, 0, 0));
    -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 1) calc(100% - 16px), rgba(0, 0, 0, 0));
}

.module-item-option-fabricable .module-item-name {
    white-space: nowrap;
    max-width: none;
}

.module-item-option .module-item-size {
    margin-left: auto;
    align-self: flex-start;
    font-size: 14px;
    font-weight: 400;
    color: #86868b;
    text-align: right;
    white-space: nowrap;
}

.module-item-option .option-fabric-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    align-items: flex-start;
}

.option-fabric-instance {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.option-fabric-instance-sap {
    margin-left: auto;
    font-size: 14px;
    font-weight: 400;
    color: #86868b;
    white-space: nowrap;
    text-align: right;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

.option-fabric-instance-number {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e8ecf4;
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.option-fabric-select-btn,
.option-fabric-apply-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid #d0d5dd;
    background: #ffffff;
    color: #007AFF;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
}

.option-fabric-select-btn:hover {
    background: rgba(0, 122, 255, 0.08);
}

.option-fabric-select-btn.has-fabric {
    border-color: #007AFF;
    background: #007AFF;
    color: #ffffff;
}

.option-fabric-select-btn.has-fabric:hover {
    background: #0051d5;
    border-color: #0051d5;
}

/* Комментарий: делаем кнопку "Задать для всех" нейтральной, чтобы отличать от выбора ткани. */
.option-fabric-apply-all-btn {
    color: #1d1d1f;
    background: #f7f9fc;
}

.option-fabric-apply-all-btn:hover {
    background: #e4e8f0;
    border-color: #c0c7d4;
}

.empty-list {
    text-align: center;
    color: #86868b;
    padding: 40px 20px;
    font-size: 16px;
}

.news-element-content-sod > * {
    line-height: 20px;
}

/* Правая панель */
.right-panel {
    background: white;
    border-radius: 12px;
    padding-top: 5px;
    padding-right: 5px;
    padding-bottom: 0px;
    padding-left: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Поиск модулей */
.modules-search {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 4px; /* Уменьшаем отступ снизу блока поиска модулей, чтобы компактнее прижимать каталог */
    flex-shrink: 0;
}

/* Горизонтальное выравнивание поля поиска и логотипа бренда */
.modules-search__top-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

/* Сужаем блок поля поиска на 15%, чтобы освободить место справа */
.modules-search__top-row .search-input-wrapper {
    flex: 0 1 85%;
}

/* Ссылка с логотипом: вписываем высоту по размеру поля и убираем декоративную рамку */
.modules-search__top-row .brand-logo-link--modules {
    flex: 0 1 15%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    max-height: 100%;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
}

/* Ограничиваем изображение высотой строки поиска, чтобы логотип не растягивал макет */
.modules-search__top-row .brand-logo-link--modules img {
    width: auto;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 42px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

/* Светло-серая иконка лупы слева внутри поля поиска. */
.search-input__icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.search-input:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
}

.search-input-wrapper .clear-search {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: #86868b;
    cursor: pointer;
    display: none;
    transition: color 0.3s ease;
}

.search-input-wrapper .clear-search:hover {
    color: #007AFF;
}

.search-input:not(:placeholder-shown) + .clear-search {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modules-search .assembly-stage {
    display: none;
}

.catalog-tabs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    row-gap: 8px;
    margin-bottom: 0px; /* Убираем отступ снизу, чтобы вкладки каталога вплотную примыкали к следующему блоку */
}

/* Каталог модулей */
.modules-catalog {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.catalog-tabs {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-bottom: 0;
}

.module-type-filters-row,
.preset-filters-row,
.leg-heights-row,
.fabric-collections-row {
    display: none;
    width: 100%;
    margin-bottom: 8px;
}

.module-type-filters-row.is-visible,
.preset-filters-row.is-visible,
.leg-heights-row.is-visible,
.fabric-collections-row.is-visible {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Комментарий: визуально повторяем бейдж размеров для счётчика доступных модулей в блоке фильтров. */
.module-type-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(4px);
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    white-space: nowrap;
    margin-left: auto;
    flex: 0 0 auto;
    cursor: default;
}

/* Комментарий: контейнер фильтра по функциям скрываем, пока нет данных */
.module-function-filter {
    position: relative;
    display: none;
    flex: 0 0 auto;
}

/* Комментарий: как только появляются варианты, показываем выпадающий фильтр рядом с типами модулей */
.module-function-filter.is-active {
    display: flex;
    align-items: center;
}

/* Комментарий: кнопка переключателя визуально повторяет табы по типу модулей */
.module-function-filter__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #d0d3d8;
    background: #f8f9fb;
    color: #1d1d1f;
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.2s ease;
}

.module-function-filter__toggle:hover:not(:disabled) {
    background: #e8efff;
    border-color: #a9b9ff;
}

.module-function-filter__toggle:disabled {
    cursor: default;
    opacity: 0.6;
}

/* Комментарий: стрелка указывает на наличие выпадающего списка */
.module-function-filter__toggle-icon {
    width: 10px;
    height: 10px;
    position: relative;
    flex: 0 0 auto;
}

/* Комментарий: компактный фильтр по размерам модулей вписывается в строку с табами */
.module-size-filter {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    color: #1d1d1f;
}

/* Комментарий: инпуты конфигурации визуально перекликаются с кнопками фильтра */
.module-size-filter__config-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Комментарий: кнопка сбрасывает ограничения по размерам конфигурации и модулей */
.module-size-filter__reset {
    padding: 8px 12px;
    border: none;
    border-radius: 14px;
    background: #d93025;
    color: #ffffff;
    font-size: 12px;
    margin-right: 8px; /* Комментарий: оставляем небольшой отступ от соседних фильтров */
}

/* Комментарий: выпадающий блок с размерами прячем под отдельную кнопку */
.module-size-filter__group {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    display: none;
    flex-direction: column;
    gap: 16px; /* Комментарий: добавляем небольшой просвет между секциями выпадающего фильтра */
    min-width: 220px;
    padding: 12px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(208, 211, 216, 0.7);
    z-index: 1400000;
}

/* Комментарий: каждая секция внутри выпадающего блока выстраивается отдельной колонкой */
.module-size-filter__section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Комментарий: визуально разделяем блок ввода габаритов конфигурации и список фильтров модулей */
.module-size-filter__section--modules {
    padding-top: 4px;
}

/* Комментарий: подписи секций делаем полужирными, чтобы выделить подзаголовки */
.module-size-filter__section-title {
    font-weight: 600;
    font-size: 12px;
    color: #1d1d1f;
}

/* Комментарий: показываем выпадающий список когда активна основная кнопка */
.module-size-filter.is-group-open .module-size-filter__group {
    display: flex;
}

/* Комментарий: синхронизируем анимацию стрелки основной кнопки с состоянием раскрытия */
.module-size-filter.is-group-open .module-size-filter__main-toggle .module-function-filter__toggle-icon::before {
    transform: translateY(-50%) rotate(180deg);
}

/* Комментарий: каждая группа фильтра содержит кнопку и раскрывающийся список */
.module-size-filter__field {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    width: 100%;
}

/* Комментарий: кнопка повторяет стиль табов и выступает переключателем выпадающего списка */
.module-size-filter__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 100px; /* Комментарий: уменьшаем минимальную ширину для лучшего размещения в строке */
    width: 100%; /* Комментарий: растягиваем кнопку на ширину выпадающего контейнера */
    padding: 6px 12px;
    border: 1px solid #d0d3d8;
    border-radius: 14px;
    background: #f8f9fb;
    color: inherit;
    font-size: 12px;
    line-height: 0.2; /* Комментарий: синхронизируем высоту строки кнопки с компактным контейнером фильтра */
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.module-size-filter__toggle:hover:not(:disabled),
.module-size-filter__toggle:focus-visible {
    background: #e8efff;
    border-color: #a9b9ff;
    outline: none;
}

.module-size-filter__toggle:disabled {
    cursor: default;
    opacity: 0.6;
}

/* Комментарий: иконка-стрелка повторяет поведение фильтра по функциям */
.module-size-filter__toggle-icon {
    position: relative;
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
}

.module-size-filter__toggle-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #1d1d1f;
    transform: translateY(-50%);
    transition: transform 0.2s ease;
}

.module-size-filter__field.is-open .module-size-filter__toggle-icon::before {
    transform: translateY(-50%) rotate(180deg);
}

/* Комментарий: скрываем нативный селект, оставляя его для программного управления */
.module-size-filter__select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    overflow: hidden;
}

/* Комментарий: используем выпадающий список с общей стилизацией фильтра функций */
.module-size-filter__dropdown {
    left: 0;
    right: auto;
    min-width: 100%;
}

/* Комментарий: ограничиваем высоту выпадающих списков и добавляем вертикальную прокрутку для длинных списков */
.module-size-filter__dropdown,
.module-function-filter__dropdown {
    max-height: 500px;
    overflow-y: auto;
}

/* Комментарий: показываем список опций при активном состоянии контейнера */
.module-size-filter__field.is-open .module-size-filter__dropdown {
    display: flex;
}

/* Комментарий: на мобильных элемент растягивается на доступную ширину */
@media (max-width: 767px) {
    .module-size-filter__dropdown {
        min-width: 210px;
    }
}

/* Комментарий: подсказка для опции сброса менее акцентная */
.module-size-filter__option.is-placeholder {
    color: #6b6f76;
}

/* Комментарий: при отключении фильтра уменьшаем контраст и блокируем ввод */
.module-size-filter.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.module-function-filter__toggle-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #1d1d1f;
    transform: translateY(-50%);
    transition: transform 0.2s ease;
}

/* Комментарий: при открытии списка стрелка поворачивается вверх */
.module-function-filter.is-open .module-function-filter__toggle-icon::before {
    transform: translateY(-50%) rotate(180deg);
}

/* Комментарий: выпадающий список располагаем поверх каталога */
.module-function-filter__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    flex-direction: column;
    gap: 4px;
    min-width: 105px; /* Комментарий: задаём минимальную ширину, чтобы элементы списка не сжимались слишком сильно */
    overflow-x: hidden; /* Комментарий: скрываем горизонтальную прокрутку, оставляя только вертикальную */
    padding: 8px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(208, 211, 216, 0.7);
    z-index: 1400000;
}

/* Комментарий: показываем список опций только когда фильтр развёрнут */
.module-function-filter.is-open .module-function-filter__dropdown {
    display: flex;
}

/* Комментарий: каждая опция представляет собой кнопку с иконкой и названием функции */
.module-function-filter__option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #1d1d1f;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.module-function-filter__option:hover,
.module-function-filter__option:focus-visible {
    background: #f0f4ff;
    outline: none;
}

/* Комментарий: активная опция подсвечивается цветом бренда */
.module-function-filter__option.is-active {
    background: #007AFF;
    color: #fff;
}

.module-function-filter__option.is-active .module-function-filter__option-name {
    color: inherit;
}

/* Комментарий: иконку функции увеличиваем до 28 пикселей для лучшей читаемости */
.module-function-filter__option-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
}

.module-function-filter__option-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.module-function-filter__option-name {
    flex: 1 1 auto;
    color: #1d1d1f;
}

.module-type-filters,
.preset-filters,
.leg-heights-tabs,
.fabric-collections-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Фильтр типовых конфигураций по габаритам */
.preset-filters {
    width: 100%;
    justify-content: space-between;
    align-items: flex-end;
    background: #f8f9fb;
    border: 1px solid #d0d3d8;
    border-radius: 12px;
    padding: 12px;
    gap: 12px;
}

.preset-filters__fields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.preset-filters__field {
    /* Держим контейнер полей гибким, чтобы числовые inputs равномерно растягивались в ряду */
    display: flex;
    flex: 1 1 180px;
}

.preset-filters__input {
    /* Растягиваем поле на всю доступную ширину, чтобы убрать пустой отступ внутри label */
    width: 100%;
    border: 1px solid #ccd0d5;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1.4;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.preset-filters__input:focus {
    border-color: #007AFF;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
    outline: none;
}

.preset-filters__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-left: auto;
}

.preset-filters__reset {
    border: 1px solid #d0d3d8;
    background: #ffffff;
    color: #1d1d1f;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-filters__reset:hover,
.preset-filters__reset:focus-visible {
    border-color: #007AFF;
    color: #007AFF;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
}

.preset-filters__counter {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
}

@media (max-width: 1024px) {
    .preset-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .preset-filters__actions {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }
}

@media (orientation: portrait) {
    .preset-filters {
        /* Возвращаем горизонтальное расположение элементов в портретном режиме */
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }

    .preset-filters__field {
        /* Оставляем полям возможность адаптироваться по ширине, чтобы все элементы уместились */
        max-width: 200px;
        flex: 1 1 160px;
    }

    .preset-filters__actions {
        /* Не даём блоку с действиями растягиваться на всю ширину и переноситься на новую строку */
        width: auto;
        margin-left: auto;
        flex-wrap: nowrap;
    }

    .preset-filters__reset,
    .preset-filters__counter {
        /* Фиксируем элементы действий от переноса, чтобы они всегда оставались в одной строке */
        white-space: nowrap;
    }
}

.module-type-tab,
.leg-height-tab,
.fabric-collection-tab {
    flex: 0 0 auto;
    border: 1px solid #d0d3d8;
    background: #f8f9fb;
    color: #1d1d1f;
    border-radius: 16px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.2;
    transition: all 0.2s ease;
}

.module-type-tab:hover,
.leg-height-tab:hover,
.fabric-collection-tab:hover {
    background: #e8efff;
    border-color: #a9b9ff;
}

.fabric-collection-tab.is-featured {
    border-color: #8fb3ff;
    background: #eef4ff;
    box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.12);
}

.module-type-tab.is-active,
.leg-height-tab.is-active,
.fabric-collection-tab.is-active {
    background: #007AFF;
    border-color: #007AFF;
    color: #fff;
    cursor: default;
}

.catalog-tab {
    flex: 0 0 auto;
    border: 1px solid #d0d3d8;
    background: #f5f5f7;
    color: #1d1d1f;
    border-radius: 20px;
    padding: 8px 18px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
    transition: all 0.2s ease;
}

.catalog-tab:hover {
    background: #e8efff;
    border-color: #a9b9ff;
}

.catalog-tab.is-active {
    background: #007AFF;
    border-color: #007AFF;
    color: #fff;
    cursor: default;
}

.catalog-tab.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.catalog-tab.is-hidden {
    display: none;
}

@media (orientation: portrait) {
    .catalog-tabs-row {
        flex-wrap: nowrap;
        gap: 8px;
        align-items: stretch;
    }

    .catalog-tabs {
        flex: 1 1 auto;
        gap: 6px;
    }

    .catalog-tab {
        flex: 1 1 auto;
        padding: 6px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .stage-controls {
        flex: 0 0 auto;
        margin-left: auto;
        width: auto;
        gap: 8px;
        justify-content: flex-end;
        flex-wrap: nowrap;
        align-items: center;
    }

    .stage-help-button {
        flex-shrink: 0;
    }

    .stage-control-toggle {
        gap: 6px;
        font-size: 11px;
        white-space: nowrap;
    }

    .stage-control-toggle-visual {
        width: 32px;
        height: 18px;
    }

    .stage-control-toggle-visual::after {
        width: 14px;
        height: 14px;
        top: 2px;
        left: 2px;
    }

    .stage-control-toggle-input:checked + .stage-control-toggle-visual::after {
        transform: translateX(14px);
    }
}

.catalog-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 12px;     /* Комментарий: уменьшаем вертикальный интервал между карточками вдвое, горизонтальный оставляем прежним. */
    padding: 5px 12px;  /* чуть больше горизонтальный отступ для безопасной зоны */
    overflow-y: auto;
    overflow-x: hidden; /* убираем горизонтальный скролл, пока стопки сдвинуты внутри карточки */
    scrollbar-gutter: stable both-edges;
    flex: 1;
    position: relative;

    /* ← ДОБАВИТЬ: фиксируем высоту строк и не растягиваем их */
    grid-auto-rows: 180px;   /* высота каждой строки (подбери под себя) */
    align-content: start;    /* не распределять свободное место между рядами */
}

/* Комментарий: задаём собственную высоту строк для сетки модулей, чтобы карточки не выходили за пределы. */
.catalog-grid.modules-grid {
    --module-card-height: 190px; /* Комментарий: задаём новую фиксированную высоту карточки модуля в каталоге. */
    grid-auto-rows: var(--module-card-height);
}

/* Комментарий: добавляем класс для компактного режима сетки модулей, чтобы при нехватке ширины
   стопки карточек автоматически переходили в два столбца и не обрезались. */
.catalog-grid.modules-grid.modules-grid--compact {
    grid-template-columns: repeat(2, 1fr);
}

/* Комментарий: фиксируем высоту самих карточек под высоту строки, чтобы предотвратить наложение. */
.catalog-grid.modules-grid .module-card {
    min-height: var(--module-card-height);
    max-height: var(--module-card-height);
}

/* Гарантируем фиксированный верхний отступ 10px для активной сетки модулей,
   чтобы интерфейс выглядел одинаково вне зависимости от скрытия неактивных карточек */
.catalog-grid.modules-grid.is-active {
    padding-top: 10px;
}

.presets-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 12px;
    min-height: 0;
}

.presets-grid .presets-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
    align-content: start;
    grid-auto-rows: minmax(260px, auto);
    scrollbar-gutter: stable;
}

.preset-card {
    background: #f5f5f7;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    transition: all 0.3s ease;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.preset-card:hover {
    border-color: #007AFF;
    background: #ffffff;
    transform: scale(1.003);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
    z-index: 1;
}

.preset-card.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Визуально отключаем типовые конфигурации, которые не проходят фильтр */
.preset-card.is-disabled {
    opacity: 0.45;
    pointer-events: none;
    filter: grayscale(0.25);
}

.preset-card.is-disabled .preset-card-title,
.preset-card.is-disabled .preset-card-size {
    color: #6b6b70;
}

.preset-card-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

.preset-card-header {
    width: 100%;
    flex-shrink: 0;
}

.preset-card-title {
    font-weight: 600;
    font-size: 16px;
    color: #1d1d1f;
    text-align: center;
    /* Увеличиваем межстрочный интервал, чтобы уменьшенный шрифт оставался читаемым */
    line-height: 1.3;
}

.preset-card-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin-top: 0;
    margin-left: auto;
}

@media (orientation: portrait) {
    .preset-card-actions {
        display: none;
    }
}

.preset-card-visual {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
}

.preset-card-image {
    width: 100%;
    background: #ffffff;
    border-radius: 6px;
    /* Убираем отступы вокруг изображений типовых конфигураций */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 160px;
    max-height: 100%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03);
}

.preset-card-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.preset-card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #9ca3af;
    font-size: 14px;
    text-align: center;
}

.preset-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex-shrink: 0;
    margin-top: auto;
}

.preset-card-size {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(4px);
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    white-space: nowrap;
}

.preset-card-size:empty {
    display: none;
}

.preset-card-copy {
    cursor: pointer;
    font: inherit;
}

.presets-placeholder {
    padding: 24px 18px;
    text-align: center;
    color: #6b7280;
    border: 1px dashed #d0d3d8;
    border-radius: 12px;
    background: #f9fafb;
}

.seat-type-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1200002; /* Обеспечиваем перекрытие всех карточек каталога поверх остальных слоёв */
}

.seat-type-overlay.is-visible {
    display: flex;
}

.seat-type-popup {
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.seat-type-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.seat-type-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.seat-type-button {
    padding: 12px 18px;
    border-radius: 8px;
    border: 1px solid #007AFF;
    background: #ffffff;
    color: #007AFF;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.seat-type-button:hover {
    background: #e8f0ff;
}

.seat-type-button-active,
.seat-type-button-active:hover {
    background: #007AFF;
    color: #ffffff;
}

.catalog-grid.is-hidden {
    display: none;
}

.legs-placeholder {
    grid-column: 1 / -1;
    align-self: center;
    justify-self: center;
    text-align: center;
    color: #86868b;
    padding: 40px 20px;
}

.fabrics-placeholder {
    grid-column: 1 / -1;
    align-self: center;
    justify-self: center;
    text-align: center;
    color: #86868b;
    padding: 40px 20px;
}

.module-card,
.option-card {
    background: #f5f5f7;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    gap: 8px;
    /* aspect-ratio: 16/9;  <-- убрано */
    height: 100%;            /* занимает всю высоту строки */
    /* Разрешаем всплывающим подсказкам выходить за пределы карточки. */
    overflow: visible;
    position: relative;
}

/* Комментарий: переводим карточку модулей в колонку, чтобы футер занимал всю ширину. */
/* Комментарий: добавляем светло-серую рамку, чтобы визуально отделить карточку от фона. */
.module-card {
    flex-direction: column;
    border: 1px solid #d0d0d0;
}

/* Комментарий: основной блок оставляем в виде строки для картинки и текста. */
.module-card-main {
    display: flex;
    gap: 4px;
    flex: 1 1 auto;
    width: 100%;
    align-items: stretch;
    min-height: 0;
    /* Комментарий: фиксируем высоту основной зоны на размер карточки, чтобы текст не растягивал её. */
    height: 100%;
}


.module-card:hover,
.option-card:hover {
    border-color: #007AFF;
    background: white;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.module-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.module-card.disabled:hover {
    transform: none;
    box-shadow: none;
}

.module-card-group.disabled,
.module-card-group.incompatible,
.module-card-group.module-limit-reached {
    cursor: not-allowed;
    pointer-events: none;
}

.module-card-group.disabled .module-card,
.module-card-group.incompatible .module-card,
.module-card-group.module-limit-reached .module-card {
    opacity: 0.5;
    cursor: not-allowed;
}

.module-card-group.disabled .module-card:hover,
.module-card-group.incompatible .module-card:hover,
.module-card-group.module-limit-reached .module-card:hover {
    transform: none;
    box-shadow: none;
}

.modules-grid.hide-inactive .module-card.disabled,
.modules-grid.hide-inactive .module-card.incompatible,
.modules-grid.hide-inactive .module-card.module-limit-reached,
.modules-grid.hide-inactive .module-card-group.disabled,
.modules-grid.hide-inactive .module-card-group.incompatible,
.modules-grid.hide-inactive .module-card-group.module-limit-reached {
    display: none !important;
}

.module-group-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 20;
}

.module-group-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.modules-grid.is-group-expanded {
    overflow-y: auto;
    overflow-x: visible;
}

.modules-grid.is-group-expanded > .module-card,
.modules-grid.is-group-expanded .module-card-group:not(.is-expanded) {
    filter: blur(2px);
    opacity: 0.4;
    pointer-events: none;
}

.modules-grid.is-group-expanded .module-card-group:not(.is-expanded) .module-card {
    filter: none;
    opacity: 1;
}

.modules-grid.is-group-expanded .module-card-group.is-expanded {
    filter: none;
    opacity: 1;
    pointer-events: auto;
    isolation: isolate;
}

.modules-grid.is-group-expanded .module-card-group.is-expanded .module-card {
    filter: none;
    opacity: 1;
    pointer-events: auto;
}

.module-card-group {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    height: 100%;
    overflow: visible;
}

.module-card-group .module-card {
    grid-area: 1 / 1;
    width: 100%;
    transition: transform 0.35s ease, box-shadow 0.35s ease, opacity 0.35s ease;
    z-index: var(--stack-z, 1);
}

.module-card-group .module-card.module-card-group-item {
    will-change: transform;
}

.module-card-group:not(.is-expanded) .module-card {
    transform: translate(var(--stack-translate-x, 0), var(--stack-translate-y, 0)) rotate(var(--stack-rotation, 0deg));
    opacity: var(--stack-opacity, 1);
}

.module-card-group:not(.is-expanded) .module-card.disabled,
.module-card-group:not(.is-expanded) .module-card.incompatible,
.module-card-group:not(.is-expanded) .module-card.module-limit-reached {
    opacity: 0.5;
    cursor: not-allowed;
}

.module-card-group:not(.is-expanded) .module-card.is-lead.disabled,
.module-card-group:not(.is-expanded) .module-card.is-lead.module-limit-reached {
    opacity: 1;
    background: #e6e6e6;
}

.module-card-group:not(.is-expanded) .module-card.is-lead.incompatible {
    opacity: 1;
    background: #ffebe9;
}

.module-card-group:not(.is-expanded) .module-card.is-lead.disabled > *,
.module-card-group:not(.is-expanded) .module-card.is-lead.module-limit-reached > * {
    opacity: 0.5;
}

.module-card-group:not(.is-expanded) .module-card.is-lead.incompatible > * {
    opacity: 0.7;
}

.module-card-group:not(.is-expanded) .module-card.is-lead.incompatible::after {
    opacity: 0.7;
}

.module-card-group:not(.is-expanded) .module-card:not(.is-lead) {
    pointer-events: none;
}

.module-card-group:not(.is-expanded) .module-card:hover {
    transform: translate(var(--stack-translate-x, 0), var(--stack-translate-y, 0)) rotate(var(--stack-rotation, 0deg));
}

.module-card-group:not(.is-expanded) .module-card.disabled:hover,
.module-card-group:not(.is-expanded) .module-card.incompatible:hover,
.module-card-group:not(.is-expanded) .module-card.module-limit-reached:hover {
    box-shadow: none;
}

.module-card-group:not(.is-expanded):not(.disabled):not(.incompatible):not(.module-limit-reached):hover .module-card {
    border-color: #007AFF;
}

.module-card-group.is-expanded {
    z-index: 40;
}

.module-card-group.is-expanded .module-card {
    transform: translate(var(--expanded-translate-x, 0), var(--expanded-translate-y, 0));
    opacity: 1;
    pointer-events: auto;
    filter: none;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
    z-index: 90;
}

.module-card-group.is-expanded .module-card.disabled,
.module-card-group.is-expanded .module-card.incompatible,
.module-card-group.is-expanded .module-card.module-limit-reached {
    opacity: 0.5;
    cursor: not-allowed;
}

.module-card-group.is-expanded .module-card.is-lead {
    transform: translate(0, 0);
    z-index: 120;
}

.module-card-group.is-collapsing {
    z-index: 180;
    isolation: isolate;
}

.module-card-group.is-collapsing .module-card {
    z-index: 220;
}

.module-card-group.is-collapsing .module-card.is-lead {
    z-index: 260;
}

.module-card-group.is-expanded .module-card:hover {
    transform: translate(var(--expanded-translate-x, 0), var(--expanded-translate-y, 0));
}

.module-card-group.is-expanded .module-card.disabled:hover,
.module-card-group.is-expanded .module-card.incompatible:hover,
.module-card-group.is-expanded .module-card.module-limit-reached:hover {
    box-shadow: none;
}

.module-card-group .module-card.is-lead {
    z-index: 80;
}

.option-card.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.option-card.is-disabled:hover {
    transform: none;
    box-shadow: none;
}

.module-card.incompatible {
    opacity: 0.7;
    border-color: #d2424f;
    background: #ffebe9;
    cursor: not-allowed;
    position: relative;
}

.module-card.incompatible::after {
    content: '⚠';
    position: absolute;
    top: 5px;
    right: 5px;
    color: #d2424f;
    font-size: 14px;
    z-index: 1;
}

/* Левая часть карточки - изображение */
.module-card-image,
.option-card-image {
    width: 50%;
    /* Комментарий: фиксируем высоту области изображений через соотношение сторон, чтобы карточки не «прыгали». */
    aspect-ratio: 4 / 3;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    min-height: 0;
}

.module-card-visual {
    width: 50%;
    display: flex;
    flex-direction: column;
    flex: 0 0 50%;
    min-width: 0;
}

.module-card-visual .module-card-image {
    width: 100%;
    /* Комментарий: оставляем фиксированное окно под изображение внутри визуальной части карточки. */
    height: auto;
    flex: 0 0 auto;
    min-height: 0;
}

.module-card-image img,
.option-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.module-card-image .placeholder-icon,
.option-card-image .placeholder-icon {
    font-size: 40px;
    color: #c0c0c0;
}

/* Правая часть карточки - информация */
.module-card-info,
.option-card-info {
    width: 50%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Комментарий: разрешаем подсказкам из футера выходить за пределы блока с информацией. */
    overflow: visible;
    padding: 2px;
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
}

/* Комментарий: для карточек модулей ограничиваем высоту информационного столбца высотой карточки. */
.module-card-info {
    height: 100%;
}

/* Карточки опций */
.option-card {
    cursor: default;
    align-items: stretch;
    padding: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas:
        "image info"
        "footer footer";
    gap: 3px; /* Комментарий: уменьшаем промежуток между основными областями карточки опции */
}

.option-card > .option-card-image {
    grid-area: image;
    width: 100%;
    height: 100%;
}

.option-card > .option-card-info {
    grid-area: info;
    width: 100%;
}

.option-card > .option-card-footer {
    grid-area: footer;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 0;
    width: 100%;
}

.option-card.is-on-scene {
    border-color: rgba(52, 199, 89, 0.6);
    background: #f4fff6;
}

/* Текстовый блок карточки опции */
.option-card-textual {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;
    /* Комментарий: растягиваем текстовый блок, чтобы описание могло занять всю высоту правой колонки. */
    min-height: 0;
}

.option-card-info {
    gap: 6px;
}

.option-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 6px;
}

/* Область для вывода цен в карточке опции */
.option-card-price-slot {
    display: none;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    /* Растягиваем контейнер с ценами, чтобы список мог занимать высоту карточки и включалась прокрутка */
    flex: 1 1 auto;
    min-height: 0;
}

.option-card-name {
    font-size: 16px;
    color: #1d1d1f;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    flex: 1 1 auto;
}

.option-card-size-badge {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(4px);
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    margin-left: auto;
}
/* Обновляем параметры описания опции: компактная типографика и ограничение по высоте */
.option-card-description {
    font-size: 12px;
    color: #666;
    line-height: 1.2;
    flex: 1 1 auto;
    margin: 10px 0 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 4px;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
    scrollbar-gutter: stable both-edges;
    /* Комментарий: фиксируем максимальную высоту текста, чтобы карточки оставались ровными. */
    max-height: 9.5em;
    min-height: 0;
}

.option-card-description::-webkit-scrollbar {
    width: 4px;
}

.option-card-description::-webkit-scrollbar-track {
    background: transparent;
}

.option-card-description::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.25);
    border-radius: 999px;
}

.option-card-meta {
    font-size: 12px;
    color: #6b6b6f;
    line-height: 1.4;
}

.option-card-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 0;
    width: 100%;
}

.option-card-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px; /* Комментарий: уменьшаем отступы, чтобы кнопка "Позиции" помещалась в одну строку. */
    flex-wrap: wrap;
    width: 100%;
}

.option-card-footer-row .option-card-controls {
    flex: 0 0 auto; /* предотвращаем растяжение блока с кнопками сверх необходимой ширины */
}

.option-card-video-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 6px;
    border-radius: 999px;
    border: 1px solid #d0d5dd;
    background: #ffffff;
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    flex: 0 0 auto;
}

.option-card-video-btn:hover {
    background: #eef3ff;
    color: #0051d5;
    border-color: #b9c5f7;
}

.option-card-video-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.option-card.is-on-scene .option-card-video-btn {
    border-color: rgba(52, 199, 89, 0.6);
}

.option-card-video-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    flex-shrink: 0;
    vertical-align: middle;
}

.option-card-video-icon-fallback {
    font-size: 14px;
    line-height: 16px;
    text-align: center;
}

.option-card-controls {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d0d5dd;
    border-radius: 999px;
    background: #ffffff;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.2;
    min-height: 32px;
    max-width: 100%;
    flex: 0 1 auto;
    padding-right: 0; /* Комментарий: убираем правый отступ, чтобы кнопки −/+ примыкали к краю бейджа. */
}

/* Комментарий: делаем кнопку "Позиции" визуально идентичной бейджу размеров. */
.option-card-headrest-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(4px);
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    flex: 0 0 auto;
    margin-left: auto;
}

.option-card-headrest-btn:hover,
.option-card-headrest-btn:focus {
    background: #eef3ff;
    color: #0051d5;
    border-color: #b9c5f7;
    box-shadow: 0 3px 6px rgba(0, 81, 213, 0.15);
    outline: none;
}

.option-card-headrest-btn:focus-visible {
    outline: 2px solid rgba(0, 81, 213, 0.4);
    outline-offset: 2px;
}

.option-card-headrest-btn + .option-card-size-badge {
    margin-left: 6px;
}

.option-card.is-on-scene .option-card-headrest-btn {
    border-color: rgba(52, 199, 89, 0.6);
    box-shadow: 0 2px 4px rgba(52, 199, 89, 0.25);
}

.option-card.is-on-scene .option-card-controls {
    border-color: rgba(52, 199, 89, 0.6);
}

/* Комментарий: оформление модального окна с выбором позиций подголовников. */
.headrest-positions-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1200;
    padding: 24px;
    align-items: center;
    justify-content: center;
}

.headrest-positions-overlay:not(.is-hidden) {
    display: flex;
}

/* Комментарий: размываем основной интерфейс, пока активно окно позиций подголовников. */
#destyle-configurator.destyle-configurator--headrest-active > :not(.headrest-positions-overlay) {
    filter: blur(16px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.25s ease;
    background-color: #ffffff;
}

.headrest-positions-dialog {
    /* Комментарий: увеличиваем минимальные габариты модального окна, чтобы оно было не уже 800px и не ниже 650px. */
    width: min(1040px, calc(100vw - 64px));
    min-width: min(800px, calc(100vw - 64px));
    max-height: min(90vh, 760px);
    min-height: min(650px, calc(100vh - 128px));
    border-radius: 20px;
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.headrest-positions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.headrest-positions-title {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
    color: #1c1c1e;
}

.headrest-positions-title-main {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
}

.headrest-positions-title-option {
    font-size: 20px;
    font-weight: 600;
    color: #475467;
}

.headrest-positions-title-option::before {
    content: '•';
    margin-right: 10px;
    color: #d0d5dd;
}

.headrest-positions-title-option:empty {
    display: none;
}

.headrest-positions-body {
    overflow-y: auto;
    padding-right: 6px;
    max-height: 55vh;
}

.headrest-positions-body::-webkit-scrollbar {
    width: 6px;
}

/* Комментарий: визуально отмечаем занятые позиции и выводим подпись с подсказкой. */
.headrest-position-toggle--occupied {
    cursor: not-allowed;
    opacity: 0.45;
}

.headrest-position-toggle--occupied .headrest-position-label-letter {
    color: #98a2b3;
}

.headrest-position-label[data-occupied-caption]::after {
    content: attr(data-occupied-caption);
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.2;
    color: #f04438;
    font-weight: 500;
}

.headrest-positions-body::-webkit-scrollbar-thumb {
    background: #d0d5dd;
    border-radius: 999px;
}

.headrest-positions-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}


.headrest-positions-item {
    /* Комментарий: переводим карточку на двухколоночную сетку, чтобы слева было изображение, а справа весь контент. */
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
    align-items: center;
    gap: 32px;
    border: 1px solid #e4e7ec;
    border-radius: 20px;
    padding: 24px 28px;
    background: #f9fafb;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

/* Комментарий: показываем изображение модуля без декоративной рамки. */
.headrest-module-thumb {
    /* Комментарий: сохраняем контейнер для выравнивания изображения, но убираем фон и рамку. */
    width: 100%;
    max-width: 220px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 0;
    background: transparent;
    padding: 0;
}

/* Комментарий: блок справа от изображения с названием и чекбоксами центрируем по доступному пространству. */
.headrest-module-details {
    /* Комментарий: размещаем текст и элементы управления по центру с комфортными отступами. */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 0 12px;
    color: #1d1d1f;
}

.headrest-module-name {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
}

.headrest-module-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.headrest-module-image--placeholder {
    font-size: 32px;
    color: #98a2b3;
}

.headrest-module-positions {
    /* Комментарий: размещаем чекбоксы в ряд и оставляем возможность переноса на маленьких экранах. */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    flex-wrap: nowrap;
}

.headrest-module-positions-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
}

@media (max-width: 768px) {
    .headrest-module-positions {
        /* Комментарий: на узких экранах разрешаем перенос, чтобы избежать горизонтальной прокрутки. */
        flex-wrap: wrap;
    }

    .headrest-positions-item {
        /* Комментарий: на небольших экранах складываем блоки в колонку для удобства чтения. */
        grid-template-columns: 1fr;
        text-align: center;
        gap: 24px;
    }
}

.headrest-position-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-weight: 600;
    color: #1c1c1e;
}

.headrest-position-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.headrest-position-visual {
    width: 34px;
    height: 34px;
    border-radius: 14px;
    border: 1px solid #d1d1d6;
    background: linear-gradient(180deg, #f9f9fb 0%, #f0f0f4 100%);
    box-shadow: 0 8px 24px rgba(28, 28, 30, 0.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.headrest-position-visual::after {
    content: '\2713';
    font-size: 20px;
    color: #ffffff;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.headrest-position-toggle:hover .headrest-position-visual {
    border-color: #027ffa;
    box-shadow: 0 10px 28px rgba(0, 115, 170, 0.25);
}

.headrest-position-checkbox:focus-visible + .headrest-position-visual {
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.35);
}

.headrest-position-checkbox:checked + .headrest-position-visual {
    border-color: #0051d5;
    background: linear-gradient(180deg, #3366ff 0%, #1f3bb3 100%);
    box-shadow: 0 12px 32px rgba(0, 81, 213, 0.45);
}

.headrest-position-checkbox:checked + .headrest-position-visual::after {
    opacity: 1;
    transform: scale(1);
}

.headrest-position-label {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1;
    text-align: center;
    align-items: center;
}

/* Комментарий: разделяем букву и пояснение, чтобы сделать подпись более информативной. */
.headrest-position-label-letter {
    font-size: 22px;
}

.headrest-position-label-caption {
    font-size: 16px;
    color: #475467;
}

/* Комментарий: текстовое предупреждение под чекбоксами с подсказкой по выбору позиций. */
.headrest-positions-hint {
    margin: 6px 0 0;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    color: #475467;
}

.headrest-position-checkbox:disabled + .headrest-position-visual {
    opacity: 0.6;
    box-shadow: none;
}

.headrest-position-checkbox:disabled + .headrest-position-visual + .headrest-position-label {
    color: #98a2b3;
}

.headrest-positions-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #e5e5ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.headrest-positions-summary {
    font-size: 16px;
    font-weight: 600;
    color: #1c1c1e;
}

.headrest-positions-apply {
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #1f6bff 0%, #0d3fb3 100%);
    color: #ffffff;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 16px 30px rgba(13, 63, 179, 0.3);
}

.headrest-positions-apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(13, 63, 179, 0.38);
}

.headrest-positions-apply:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 63, 179, 0.35);
}

.headrest-positions-empty {
    padding: 28px;
    text-align: center;
    color: #475467;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px dashed #d0d5dd;
}


.option-card-controls .option-card-scene-btn {
    border: none;
    background: transparent;
    border-radius: 0;
    padding: 9px 14px;
    color: #007AFF;
    font-weight: 500;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    height: 100%;
    transition: background-color 0.2s ease, color 0.2s ease, font-weight 0.2s ease;
}

.option-card-controls .option-card-scene-btn:hover {
    color: #0051d4;
}

.option-card-controls .option-card-scene-btn.is-active {
    background: #d2424f;
    color: #ffffff;
    font-weight: 700;
}

.option-card-controls .option-card-scene-btn.is-active:hover {
    background: #b53842;
    color: #ffffff;
}

.option-card-scene-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #007AFF;
    background: #ffffff;
    color: #007AFF;
    font-weight: 600;
    font-size: 12px;
    line-height: 1.1;
    transition: all 0.2s ease;
    cursor: pointer;
}

.option-card-scene-btn:hover {
    background: #e8f0ff;
}

.option-card-scene-btn.is-active {
    background: #34C759;
    border-color: #34C759;
    color: #ffffff;
}

.option-card-scene-btn.is-active:hover {
    background: #2eb252;
    border-color: #2eb252;
}

.option-card-quantity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px;
    border-left: 1px solid #d0d5dd;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    height: 100%;
    white-space: nowrap;
}

/* Комментарий: для подголовников убираем запас справа, чтобы счетчик вплотную прилегал к краю бейджа,
   при этом сохраняем разделительную линию между кнопкой добавления на сцену и счётчиком. */
.option-card-quantity--readonly {
    padding-right: 12px;
    padding-left: 10px;
    border-left-color: #d0d5dd; /* Комментарий: возвращаем цвет разделителя как у обычных карточек. */
}

.option-card.is-on-scene .option-card-quantity {
    border-left-color: rgba(52, 199, 89, 0.6);
}

.option-card.is-on-scene .option-card-quantity--readonly {
    border-left-color: rgba(52, 199, 89, 0.6); /* Комментарий: подсвечиваем разделитель в активном состоянии, как и у остальных карточек. */
}

.option-qty-btn {
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: #1d1d1f;
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.option-qty-btn:hover:not(:disabled) {
    background: #eef3ff;
    color: #0051d5;
}

.option-qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.option-qty-value {
    min-width: 2px;
    text-align: center;
    font-weight: 700;
    color: #1d1d1f;
    font-size: 12px;
}

.options-placeholder {
    grid-column: 1 / -1;
    align-self: center;
    justify-self: center;
    text-align: center;
    color: #86868b;
    padding: 40px 20px;
}

/* Комментарий: переводим контейнер опций в вертикальную колонку, чтобы между блоками поместились заголовки групп. */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 5px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable both-edges;
}

/* Комментарий: оформляем группы опций с заголовком и разделителем. */
.options-group {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Комментарий: гарантируем, что подписи и разделители всегда видны поверх карточек даже при анимациях наведения. */
.options-group__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    position: relative;
    z-index: 1;
    background: #ffffff;
}

.options-group__title {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 600;
    color: #1d1d1f;
}

.options-group__divider {
    flex: 1;
    height: 1px;
    background: #d0d5dd;
    border-radius: 999px;
    display: block;
}

.options-group__cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px 12px;
    grid-auto-rows: 220px;
}

/* Комментарий: центрируем заглушку при отсутствии опций с учётом новой раскладки. */
.options-grid .options-placeholder {
    align-self: center;
    margin: auto;
}

/* Карточки ножек */
.legs-grid {
    grid-auto-rows: 220px;
}

.fabrics-grid {
    grid-auto-rows: 220px;
}

/* Комментарий: переводим карточку на флекс-верстку, чтобы изображение занимало весь доступный верхний блок. */
.leg-card {
    background: #f5f5f7;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    height: 100%;
    overflow: hidden;
}

.leg-card:hover {
    background: #ffffff;
    border-color: #b5d3ff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.leg-card.selected {
    border-color: #34c759;
    background: #f0fff5;
    box-shadow: 0 4px 14px rgba(52, 199, 89, 0.25);
}

.leg-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    /* Комментарий: оставляем возможность наведения, чтобы показать поясняющую подсказку. */
    pointer-events: auto;
    box-shadow: none;
}

/* Комментарий: изображение растягиваем на всю доступную высоту верхней части карточки. */
.leg-card-image {
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Комментарий: убираем лишние отступы, чтобы задействовать максимум полезной площади под изображение. */
.leg-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0;
}

.leg-card-image .placeholder-icon {
    font-size: 42px;
    color: #c0c0c0;
}


/* Комментарий: информационный блок прижимаем к низу, чтобы он не отнимал высоту у изображения. */
.leg-card-info {
    margin-top: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leg-card-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.leg-card-details:empty {
    display: none;
}

/* Комментарий: название оставляем в пределах бейджа, чтобы считывалось вместе с размерами. */
.leg-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leg-card-meta {
    font-size: 13px;
    color: #6b6b6f;
    line-height: 1.4;
}

.leg-card-note {
    font-size: 12px;
    color: #9b9b9f;
    line-height: 1.3;
}

.leg-card-size-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    color: #1d1d1f;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Комментарий: отдельно описываем размеры, чтобы их можно было стилизовать независимо от названия. */
.leg-card-size-value {
    font-size: 12px;
    font-weight: 600;
    color: #4a4a4f;
    white-space: nowrap;
}

/* Комментарий: индикатор в правом верхнем углу предупреждает об ограниченном количестве ножки. */
.leg-card-limited-indicator {
    position: absolute;
    top: 6px;
    right: 6px;
    /* Комментарий: увеличиваем индикатор в 2 раза, чтобы он был заметнее и легче ловился курсором. */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #c18f00;
    background: #ffcc00;
    color: #5c4300;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Комментарий: увеличиваем активную область наведения, чтобы подсказка открывалась комфортнее. */
    padding: 4px;
    /* Комментарий: поднимаем индикатор над изображением карточки, чтобы hover работал по всей площади значка. */
    z-index: 3;
    pointer-events: auto;
    cursor: help;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Карточки тканей */
.fabrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    grid-auto-rows: minmax(64px, auto);
    align-content: start;
    padding: 2px;
}

.fabric-collection-description {
    grid-column: 1 / -1;
    padding: 10px 12px;
    border: 1px solid #d8e4ff;
    border-radius: 10px;
    background: #f6f9ff;
    color: #2f2f34;
    font-size: 13px;
    line-height: 1.45;
}

.fabric-card {
    background: #f5f5f7;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    min-height: 64px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.fabric-card:hover {
    background: #ffffff;
    border-color: #b5d3ff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.fabric-card.selected {
    border-color: #34c759;
    background: #f0fff5;
    box-shadow: 0 4px 14px rgba(52, 199, 89, 0.2);
}

.fabric-card.disabled {
    opacity: 0.55;

    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

.fabric-card-image {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    /* Комментарий: добавляем кастомную лупу для предпросмотра ткани и смещаем горячую точку в левый верхний угол. */
    cursor: url('../images/cursors/preview-cursor.svg') 0 0, zoom-in;
}

/* Подсвечиваем изображение ткани при фокусе с клавиатуры */
.fabric-card-image:focus-visible {
    outline: 2px solid #007aff;
    outline-offset: 2px;
}

.fabric-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.fabric-card-image .placeholder-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f5f5f7;
    font-size: 18px;
    color: #c0c0c0;
    line-height: 1;
}

.fabric-card-image .placeholder-icon::before {
    content: '\1f9f5';
}

.fabric-card-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
}

.fabric-card-name {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fabric-card-number {
    font-size: 12px;
    font-weight: 600;
    color: #4a4a4f;
    line-height: 1.3;
    letter-spacing: 0.01em;
}

.fabric-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 13px;
    color: #6b6b6f;
    line-height: 1.4;
}

.fabric-card-meta .sap-number {
    font-weight: 600;
    color: #1d1d1f;
}

.fabric-card-meta .collection-name {
    padding: 2px 8px;
    border-radius: 999px;
    background: #e8f4fd;
    color: #0051d5;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.fabric-card::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.fabric-card.selected::after {
    border-color: rgba(52, 199, 89, 0.35);
}

.fabric-card.disabled::after {
    border-color: transparent;
}

/* Контейнер с текстом карточки модуля */
.module-card-textual {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    /* Комментарий: растягиваем текстовый блок на всю высоту информационной части карточки. */
    height: 100%;
    /* Комментарий: скрываем лишний текст, чтобы прокручивалось только описание. */
    overflow: hidden;
}

/* Верхняя часть - название */
.module-card .module-name {
    font-size: 16px;
    color: #1d1d1f;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}


.module-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 0;
    flex-shrink: 0;
}

/* Контейнер для цен, который занимает место текста */
.module-card-price-slot {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.module-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 0;
    width: 100%;
    position: relative;
    /* Комментарий: сохраняем выход подсказок поверх футера. */
    overflow: visible;
    z-index: 1;
}

/* Комментарий: фиксируем бейдж типа у левого края футера. */
.module-card-footer .module-type-badge {
    margin-right: auto;
    max-width: 100%;
    white-space: normal;
    text-align: left;
}

/* Комментарий: оставляем бейдж размера прижатым к правому краю. */
.module-card-footer .module-size-badge {
    margin-left: 12px;
    flex-shrink: 0;
}

/* Блок с иконками функций модуля */
/* Комментарий: иконки функций выравниваем справа, рядом с бейджем размера. */
.module-functions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
    flex: 0 0 auto;
}

.module-functions:empty {
    display: none;
}

.module-function-icon {
    position: relative;
    display: inline-flex;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    transition: transform 0.2s ease;
}

.module-function-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.module-function-icon:hover,
.module-function-icon:focus-visible {
    transform: scale(1.12);
}

.module-function-icon:focus-visible {
    outline: 2px solid #0a4a7a;
    outline-offset: 2px;
    border-radius: 6px;
}

.module-function-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%) translateY(8px);
    opacity: 0;
    pointer-events: none;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(14, 24, 44, 0.94);
    color: #fff;
    box-shadow: 0 12px 32px rgba(10, 20, 40, 0.35);
    transition: opacity 0.2s ease, transform 0.2s ease;
    /* Комментарий: увеличиваем ширину подсказки, чтобы длинные описания помещались без переноса. */
    max-width: 480px;
    /* Комментарий: задаём минимальную ширину, чтобы всплывашка выглядела аккуратно даже с коротким текстом. */
    min-width: 260px;
    /* Комментарий: поднимаем слой всплывашки выше всех карточек модулей. */
    z-index: 1400001;
    text-align: left;
}

/* Комментарий: активируем подсказку, когда она вынесена на отдельный слой. */
.module-function-tooltip.is-visible {
    opacity: 1;
}

/* Комментарий: меняем позиционирование для всплывашек, которые показываются поверх каталога. */
.module-function-tooltip.is-floating {
    bottom: auto;
    transform: translate(-50%, -100%);
    /* Комментарий: поднимаем всплывашку на максимальный уровень, чтобы её не перекрывали другие элементы. */
    z-index: 1400002;
}

.module-function-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    border-width: 8px 8px 0 8px;
    border-style: solid;
    border-color: rgba(14, 24, 44, 0.94) transparent transparent transparent;
}

/* Комментарий: сохраняем подсказку скрытой, пока скрипт не перенесёт её на общий слой и не сделает видимой. */
.module-function-icon:hover .module-function-tooltip:not(.is-floating),
.module-function-icon:focus-visible .module-function-tooltip:not(.is-floating) {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
}

.module-function-tooltip__title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.module-function-tooltip__description {
    font-size: 13px;
    line-height: 1.4;
    opacity: 0.9;
}

.scene-module-tooltip {
    /* Комментарий: позиционируем всплывающую подсказку поверх сцены и отключаем обработку событий. */
    pointer-events: none;
    bottom: auto;
    z-index: 1400002;
}

.scene-module-tooltip__dimensions,
.scene-module-tooltip__description,
.scene-module-tooltip__price {
    font-size: 13px;
    line-height: 1.35;
    opacity: 0.92;
}

.scene-module-tooltip__price {
    font-weight: 600;
    margin-top: 6px;
}

/* Блоки с ценами из прайс-листа */
.price-info {
    display: none;
    width: 100%;
    padding: 6px 8px;
    border-radius: 8px;
    background: #fff;
    color: #1d1d1f;
    font-size: 12px;
    line-height: 1.4;
    text-align: left;
    border: 1px solid #d4af37;
    /* Переключаем блок в колоночный flex, чтобы список цен мог занимать свободное место */
    flex-direction: column;
    gap: 4px;
    max-height: 100%;
}

#destyle-configurator.is-price-visible .price-info {
    display: flex;
}

.price-info__title {
    font-weight: 600;
    margin-bottom: 4px;
}

.price-info__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    /* Убираем внутренние отступы у списка цен, чтобы значения располагались вплотную к границе */
    padding: 0;
    /* Дополнительно обнуляем левый внутренний отступ, чтобы избежать наследованных значений в браузерах */
    padding-inline-start: 0;
    /* Жёстко убираем левый отступ, чтобы перекрыть любые более специфичные правила темы */
    padding-left: 0 !important;
    list-style: none;
    /* Даём списку занимать всё доступное пространство и прокручиваться при переполнении */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.price-info__item {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.price-info__label {
    color: #5f5f63;
    font-weight: 500;
}

.price-info__value {
    color: #0a4a7a;
    font-weight: 600;
}

.price-info.module-card-price,
.price-info.option-card-price {
    margin-top: 0;
}

.price-info--module,
.price-info--option {
    align-self: stretch;
}

/* Включение цен в карточках модулей */
#destyle-configurator.is-price-visible .module-card-textual {
    display: none;
}

#destyle-configurator.is-price-visible .module-card-price-slot {
    display: flex;
}

/* Включение цен в карточках опций */
#destyle-configurator.is-price-visible .option-card-textual {
    display: none;
}

#destyle-configurator.is-price-visible .option-card-price-slot {
    display: flex;
}

.module-card .module-size-badge {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(4px);
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    white-space: nowrap;
}

/* Средняя часть - описание */
.module-card .module-description {
    font-size: 12px;
    color: #666;
    line-height: 1.2;
    /* Комментарий: даём описанию растягиваться и скроллиться внутри фиксированной карточки. */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    padding-right: 8px; /* Комментарий: оставляем место под вертикальный скроллбар, чтобы он не перекрывал текст. */
    /* Комментарий: ограничиваем высоту текста высотой текстового блока карточки. */
    max-height: 100%;
    scrollbar-width: thin; /* Комментарий: делаем полосу прокрутки тоньше в поддерживаемых браузерах. */
    scrollbar-color: #c0c0c0 transparent;
}

/* Кастомный скроллбар для описания */
.module-card .module-description::-webkit-scrollbar {
    width: 4px; /* Комментарий: сужаем скроллбар в WebKit-браузерах, чтобы он выглядел аккуратнее. */
}

.module-card .module-description::-webkit-scrollbar-track {
    background: transparent;
}

.module-card .module-description::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 2px;
}

/* Комментарий: слой всплывающих подсказок покрывает весь экран и не ограничивает положение всплывашек. */
.catalog-tooltips-layer {
    position: fixed;
    /* Комментарий: растягиваем слой подсказок на весь экран, чтобы всплывающие окна не обрезались. */
    inset: 0;
    pointer-events: none;
    overflow: visible;
    /* Комментарий: переносим слой подсказок на самый верх, чтобы ничего его не перекрывало. */
    z-index: 1400000;
}

/* Нижняя часть - тип модуля */
.module-type-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-starter { background: #e3f2fd; color: #1976d2; }
.badge-standalone { background: #ede7f6; color: #5e35b1; }
.badge-straight { background: #e8f5e9; color: #388e3c; }
.badge-corner { background: #fff3e0; color: #f57c00; }
.badge-finisher { background: #ffebee; color: #c62828; }

/* Сообщения */
.message-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    max-width: min(360px, calc(100% - 48px));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}

.message {
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    animation: messageSlide 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    pointer-events: auto;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-success {
    background: #d4f4dd;
    color: #248A3D;
    border: 1px solid #c3e6cb;
}

.message-error {
    background: #ffebe9;
    color: #d2424f;
    border: 1px solid #f5c6cb;
}

.message-info {
    background: #e8f4fd;
    color: #0051D5;
    border: 1px solid #bee5eb;
}

.message-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Загрузка */
.loading-modules {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    color: #86868b;
    pointer-events: none;
    width: min(360px, calc(100% - 32px));
}

.loading-modules .loader-animation {
    width: 100%;
    aspect-ratio: 3 / 1;
}

.loading-modules .loading-text {
    font-size: 16px;
    line-height: 1.5;
}

/* Адаптивность */
@media (max-width: 1400px) {
    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .options-group__cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .fabrics-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .configurator-main {
        grid-template-columns: 45% 1fr;
    }

    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .options-group__cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .fabrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .scene-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .scene-container {
        height: 320px;
    }

    .dimensions-info {
        flex-direction: column;
        flex: 1 1 auto;
        width: 100%;
        gap: 14px;
        /* Корректируем отступы под мобильную вёрстку, сохраняя обновлённые значения. */
        padding-top: 5px;
        padding-right: 5px;
        padding-bottom: 0px;
        padding-left: 5px;
        max-width: none;
        height: auto;
    }

    .dimensions-grid {
        gap: 10px;
    }

    .dimensions-row {
        flex-wrap: wrap;
        justify-content: center;
    }

    .dimensions-row .dimension-item {
        flex: 1 1 140px;
        align-items: center;
    }

    .dimension-item.dimension-modules {
        width: 100%;
    }

    .dimension-item {
        min-width: 90px;
    }
}

@media (max-width: 768px) {
    .configurator-main {
        grid-template-columns: 1fr;
        height: auto;
    }

    .left-panel,
    .right-panel {
        height: auto;
    }

    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .options-group__cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .fabrics-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(88px, auto);
        gap: 10px;
    }

    .fabric-card {
        padding: 8px 10px;
        gap: 10px;
    }

    .fabric-card-image {
        flex: 0 0 72px;
        width: 72px;
        height: 72px;
    }

    .scene-container {
        height: 280px;
    }

    .dimensions-info {
        gap: 12px;
        padding: 10px;
    }

    .dimensions-row {
        justify-content: center;
    }

    .dimensions-row .dimension-item {
        flex: 1 1 120px;
    }

    .dimensions-heights {
        justify-content: center;
    }

    .dimension-value {
        font-size: 16px;
    }
}

@media (max-width: 600px) {
    /* Комментарий: на небольших экранах располагаем поле и кнопку поиска вертикально. */
    .model-search-form__search-controls {
        flex-direction: column;
    }

    /* Комментарий: растягиваем кнопку на всю ширину, чтобы упростить нажатие пальцем. */
    .model-search-form__search-button {
        width: 100%;
        padding: 12px 16px;
    }

    .options-group__cards {
        grid-template-columns: 1fr;
    }
}

@media (orientation: portrait) {
    .fabrics-grid {
        /* В портретной ориентации распределяем карточки тканей по доступной ширине, чтобы выводить сразу несколько столбцов */
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (orientation: portrait) and (max-width: 520px) {
    .fabrics-grid {
        /* Для очень узких экранов оставляем один столбец, чтобы карточки не становились слишком маленькими */
        grid-template-columns: minmax(0, 1fr);
    }
}

#destyle-configurator.destyle-configurator--preview-active {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 1100001;
}

#destyle-configurator.destyle-configurator--preview-active > :not(.model-preview-overlay) {
    filter: blur(16px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.25s ease;
    background-color: #fff;
}

/* Фиксируем интерфейс при открытом окне параметров */
#destyle-configurator.destyle-configurator--settings-active {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 1100001;
}

/* Размытие основного интерфейса при открытом окне параметров */
#destyle-configurator.destyle-configurator--settings-active > :not(.configurator-settings-overlay),
#destyle-configurator.destyle-configurator--help-active > :not(.configurator-settings-overlay) {
    filter: blur(16px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.25s ease;
    background-color: #fff;
}

/* Размытие каталога при просмотре видео функции модуля */
#destyle-configurator.destyle-configurator--function-video-active > :not(.module-function-video-overlay) {
    filter: blur(16px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.25s ease;
    background-color: #fff;
}

/* Полупрозрачная подложка окна параметров */
.configurator-settings-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1200000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

/* Комментарий: фиксируем окно справки у верхнего края с безопасными отступами */
.configurator-help-overlay {
    align-items: flex-start;
    justify-content: center;
    padding: 48px 24px;
}

.configurator-settings-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Окно встроенного видео функций модулей */
.module-function-video-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1200000;
    transition: opacity 0.25s ease;
}

.module-function-video-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Контент оверлея с видео функции */
.module-function-video-overlay__content {
    position: relative;
    width: min(90vw, 960px);
    max-height: 90vh;
    background: #111;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Рамка для встроенного видео */
.module-function-video-overlay__frame {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

/* Сам iframe с роликом функции */
.module-function-video-overlay__iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Кнопка закрытия всплывающего окна видео */
.module-function-video-overlay__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(17, 17, 17, 0.85);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.module-function-video-overlay__close:hover,
.module-function-video-overlay__close:focus-visible {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.module-function-video-overlay__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Контейнер содержимого окна параметров */
.configurator-settings-overlay__content {
    /* Дополнительно расширяем модальное окно параметров для комфортного размещения содержимого */
    width: min(700px, calc(100vw - 32px));
    /* Комментарий: ограничиваем высоту модалки 90% экрана, чтобы она точно помещалась в видимую область */
    max-height: 90vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.25);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    /* Комментарий: оставляем переполнение видимым, чтобы тени кнопок не обрезались */
    overflow: visible;
}

/* Оверлей загрузки типовой конфигурации размещаем по центру экрана */
.configurator-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
    z-index: 1300000;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Скрытое состояние оверлея при отсутствии загрузки */
.configurator-loading-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Контент с анимацией загрузки и поясняющим текстом */
.configurator-loading-overlay__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: min(360px, 100%);
    text-align: center;
    color: #68686e;
}

/* Подпись под анимацией загрузки типовой конфигурации */
.configurator-loading-overlay__text {
    font-size: 18px;
    line-height: 1.5;
    font-weight: 500;
}

/* Гарантируем корректные размеры анимации загрузки внутри оверлея */
.configurator-loading-overlay .loader-animation {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 3 / 1;
}

/* Размываем все элементы конфигуратора во время загрузки типового пресета */
#destyle-configurator.is-preset-loading > :not(.configurator-loading-overlay) {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

/* Комментарий: аналогично размываем конфигуратор, пока восстанавливается конфигурация по ссылке */
#destyle-configurator.is-share-loading > :not(.configurator-loading-overlay) {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

/* Блок с кнопкой выхода, располагающий действие в нижней части окна */
.configurator-settings-overlay__footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #e5e5ea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

/* Блок с именем текущего пользователя в футере окна параметров */
.configurator-settings-overlay__user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.configurator-settings-overlay__user .dashicons {
    color: #027ffa;
}

/* Круглая кнопка принудительного обновления страницы */
.configurator-settings-overlay__reload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #027ffa;
    background: #ffffff;
    color: #027ffa;
    font-size: 20px;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

/* Состояния наведения и фокуса для кнопки обновления */
.configurator-settings-overlay__reload-button:hover,
.configurator-settings-overlay__reload-button:focus {
    background: #027ffa;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 115, 170, 0.35);
    transform: translateY(-1px);
}

/* Контур фокусировки для клавиатурной навигации */
.configurator-settings-overlay__reload-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.35);
}

/* Стиль кнопки выхода из учетной записи WordPress */
.configurator-settings-overlay__logout-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid #d12c2c;
    background: #d12c2c;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

/* Состояния наведения и фокуса для кнопки выхода */
.configurator-settings-overlay__logout-button:hover,
.configurator-settings-overlay__logout-button:focus {
    background: #a32020;
    border-color: #a32020;
    box-shadow: 0 8px 24px rgba(209, 44, 44, 0.35);
    transform: translateY(-1px);
}

/* Контур для клавиатурной навигации */
.configurator-settings-overlay__logout-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(209, 44, 44, 0.35);
}

/* Иконка и текст внутри кнопки выхода */
.configurator-settings-overlay__logout-text {
    line-height: 1.2;
}

.configurator-settings-overlay__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.configurator-settings-overlay__title {
    margin: 0;
    font-size: 24px;
    line-height: 1.3;
    color: #1c1c1e;
}

.configurator-settings-overlay__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #d1d1d6;
    background: #f5f5f7;
    color: #1c1c1e;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.configurator-settings-overlay__close:hover,
.configurator-settings-overlay__close:focus {
    color: #ff3b30;
    border-color: #ff3b30;
    background: rgba(255, 59, 48, 0.1);
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.25);
}

.configurator-settings-overlay__close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.35);
}

.configurator-settings-overlay__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Комментарий: даём телу модалки занимать оставшееся пространство и позволяем внутреннему скроллу работать корректно */
    flex: 1 1 auto;
    min-height: 0;
    /* Комментарий: делаем переполнение видимым, чтобы тени кнопок действий не обрезались контейнером */
    overflow: visible;
}

/* Ряд с кнопками скачивания прайса и открытия модификаторов цен */
.configurator-settings-overlay__actions {
    /* Комментарий: используем сетку, чтобы обе кнопки занимали по половине строки и имели одинаковую ширину */
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    /* Комментарий: небольшой отступ сверху, чтобы отделить кнопки от контента выше */
    padding-top: 5px;
}

/* Комментарий: размеры модального окна для ввода номера заказа */
.download-order-overlay__content {
    max-width: 420px;
}

/* Комментарий: внутреннее оформление формы ввода номера заказа */
.download-order-overlay__body {
    gap: 20px;
}

.download-order-overlay__form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.download-order-overlay__label {
    font-size: 13px;
    font-weight: 600;
    color: #1c1c1e;
}

.download-order-overlay__input {
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 10px 12px;
    font-size: 14px;
    background: #ffffff;
    color: #1c1c1e;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.download-order-overlay__input:focus {
    border-color: #34c759;
    box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.25);
    outline: none;
}

.download-order-overlay__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.download-order-overlay__button {
    border-radius: 8px;
    border: none;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.download-order-overlay__button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.4);
}

.download-order-overlay__button--primary {
    background: #34c759;
    color: #ffffff;
}

.download-order-overlay__button--primary:hover,
.download-order-overlay__button--primary:focus {
    background: #2bb24e;
    transform: translateY(-1px);
}

.download-order-overlay__button--secondary {
    background: rgba(28, 28, 30, 0.1);
    color: #1c1c1e;
}

.download-order-overlay__button--secondary:hover,
.download-order-overlay__button--secondary:focus {
    background: rgba(28, 28, 30, 0.18);
    transform: translateY(-1px);
}

/* Оформление блока с пользовательскими модификаторами цен */
.configurator-price-modifiers {
    display: none;
    margin-top: 4px;
    padding: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    background-color: #f8fafc;
}

.configurator-price-modifiers.is-visible {
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Комментарий: позволяем блоку занимать доступное пространство и сжиматься при нехватке места */
    flex: 1 1 auto;
    min-height: 0;
    /* Комментарий: включаем прокрутку только для блока модификаторов, чтобы модалка оставалась без полосы */
    overflow-y: auto;
    max-height: 100%;
}

.configurator-price-modifiers__description {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.4;
    color: rgba(15, 23, 42, 0.75);
}

.configurator-price-modifiers__fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.configurator-price-modifiers__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: rgba(15, 23, 42, 0.9);
}

/* Выравниваем переключатель показа двух цен по вертикали */
.configurator-price-modifiers__field--toggle {
    /* Переключатель с дополнительными чекбоксами располагаем вертикально */
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

/* Комментарий: выравниваем список округления по верхнему краю с блоком выбора валют. */
.configurator-price-modifiers__field--rounding {
    gap: 12px;
}

/* Строка с переключателем показа обеих цен */
.configurator-price-modifiers__toggle-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.configurator-price-modifiers__label {
    font-weight: 600;
    white-space: nowrap; /* Фиксируем подписи в одну строку, чтобы текст не переносился */
}

.configurator-price-modifiers__input {
    height: 40px;
    padding: 0 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    background-color: #ffffff;
    color: rgba(15, 23, 42, 0.9);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Настраиваем внешний вид чекбокса переключателя цен */
.configurator-price-modifiers__input--checkbox {
    width: 20px;
    height: 20px;
    padding: 0;
}

/* Контейнер с чекбоксами выбора типов цен */
.configurator-price-modifiers__currency-list {
    /* Комментарий: располагаем чекбоксы типов цен по строкам с переносом при нехватке места */
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    background-color: #f8fafc;
}

/* Подсветка ошибки, если не выбран ни один тип цены */
.configurator-price-modifiers__currency-list.has-error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

/* Отдельный пункт со своей подписью */
.configurator-price-modifiers__currency-item {
    display: inline-flex; /* Комментарий: оставляем элементы компактными, чтобы они выстраивались в ряд */
    align-items: center;
    gap: 6px;
    white-space: nowrap; /* Фиксируем подписи, чтобы чекбоксы оставались в строку */
    font-size: 13px;
    color: rgba(15, 23, 42, 0.9);
}

.configurator-price-modifiers__currency-checkbox {
    width: 18px;
    height: 18px;
}

.configurator-price-modifiers__currency-label {
    display: inline-block;
    line-height: 1.3;
}

.configurator-price-modifiers__input:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.configurator-price-modifiers__input.has-error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

.configurator-price-modifiers__footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 15px; /* Добавляем отступ сверху для визуального разделения блока */
}

/* Блок уведомления о том, что модификаторами цен управляет администратор */
.configurator-price-management-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-radius: 12px;
    background: #f4f6f8;
    color: #1d2327;
}

.configurator-price-management-notice__text {
    margin: 0;
    font-size: 15px;
    line-height: 1.4;
}

.configurator-price-management-notice strong {
    font-weight: 700;
}

/* Список ведомых учётных записей в настройках администратора модификаторов цен */

.configurator-price-modifiers__dependents {
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
    background: #f8f9fb;
    border: 1px solid #e2e4e7;
}

/* Кнопка-аккордеон для показа ведомых аккаунтов */
.configurator-price-modifiers__dependents-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.configurator-price-modifiers__dependents-toggle:hover,
.configurator-price-modifiers__dependents-toggle:focus-visible {
    border-color: #cdd3db;
    background: #eef2f6;
}

.configurator-price-modifiers__dependents-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.configurator-price-modifiers__dependents-toggle-icon {
    position: relative;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.configurator-price-modifiers__dependents-toggle-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 8px;
    height: 8px;
    border-right: 2px solid #1d2327;
    border-bottom: 2px solid #1d2327;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.configurator-price-modifiers__dependents-toggle.is-open .configurator-price-modifiers__dependents-toggle-icon::after {
    transform: rotate(-135deg);
}

.configurator-price-modifiers__dependents-content {
    display: none;
    margin-top: 10px;
}

.configurator-price-modifiers__dependents-content.is-open {
    display: block;
}

.configurator-price-modifiers__dependents-hint {
    margin: 0 0 12px;
    color: #5c6370;
    font-size: 14px;
}

/* Отображаем список ведомых аккаунтов без собственной прокрутки */
.configurator-price-modifiers__dependents-list {
    /* Комментарий: убираем внутреннюю прокрутку, чтобы работала общая полоса блока */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.configurator-price-modifiers__dependent {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #d7dbe0;
    background: #ffffff;
}

.configurator-price-modifiers__dependent-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 700;
}

.configurator-price-modifiers__dependent-name {
    display: flex;
    align-items: center;
    gap: 6px;
}

.configurator-price-modifiers__dependent-login {
    padding: 2px 6px;
    border-radius: 6px;
    background: #eef2f6;
    color: #5c6370;
    font-size: 12px;
}

.configurator-price-modifiers__dependent-fields {
    display: grid;
    /* Комментарий: ужимаем поля, чтобы три инпута и кнопка сброса помещались в одну строку */
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
}

/* Компактные поля модификаторов для ведомых учёток */
.configurator-price-modifiers__dependent .configurator-price-modifiers__input {
    height: 36px;
    padding: 0 10px;
    font-size: 13px;
}

/* Кнопка сброса модификаторов ведомой учётной записи */
.configurator-price-modifiers__dependent-reset {
    height: 36px;
    /* Комментарий: делаем кнопку компактной, чтобы она корректно вставала в сетку рядом с инпутами */
    /* Комментарий: выравниваем кнопку по нижнему краю, чтобы она совпадала с уровнем полей ввода */
    align-self: end;
    border: 1px solid #d7dbe0;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.configurator-price-modifiers__dependent-reset:hover {
    border-color: #a8afb8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.configurator-price-modifiers__dependent-reset:active {
    transform: translateY(1px);
}

.configurator-price-modifiers__save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 20px;
    border: none;
    border-radius: 8px;
    background-color: #2563eb;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.configurator-price-modifiers__save:hover,
.configurator-price-modifiers__save:focus {
    background-color: #1d4ed8;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.2);
    outline: none;
}

.configurator-price-modifiers__save:disabled {
    background-color: rgba(37, 99, 235, 0.5);
    cursor: not-allowed;
    box-shadow: none;
}

/* Кнопка скачивания прайс-листа */
.configurator-settings-overlay__action {
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Комментарий: центрируем содержимое, чтобы кнопки выглядели одинаково */
    gap: 10px;
    padding: 14px 18px;
    width: 100%; /* Комментарий: растягиваем кнопку на всю выделенную ей половину ряда */
    border-radius: 999px;
    border: 1px solid rgba(215, 222, 240, 0.8);
    background: rgba(255, 255, 255, 0.75);
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease,
        transform 0.2s ease; /* Подтягиваем стиль кнопок к вкладкам окна справки */
}

.configurator-settings-overlay__action:hover,
.configurator-settings-overlay__action:focus {
    background: #fff;
    color: #0f172a;
    border-color: #3b82f6;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.18);
    transform: translateY(-1px); /* Подсвечиваем кнопку аналогично вкладкам справки */
}

.configurator-settings-overlay__action:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35); /* Подсветка совпадает с фокусом вкладок справки */
}

.configurator-settings-overlay__action[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.configurator-settings-overlay__action-text {
    line-height: 1.2;
}

/* Блокировка прокрутки страницы при активном окне параметров */
body.configurator-settings-open,
body.configurator-help-open {
    overflow: hidden;
}

/* Комментарий: расширяем справочное окно и фиксируем его верхнюю кромку */
.configurator-help-overlay__content {
    width: min(1080px, calc(100vw - 32px));
    max-height: calc(100vh - 96px);
    /* Комментарий: в окне справки полностью убираем наследуемый межблочный gap от базовой модалки */
    gap: 0;
    overflow: hidden;
    position: relative;
}

/* Комментарий: добавляем вертикальное распределение элементов справки */
.configurator-help-overlay__body {
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    /* Комментарий: в теле окна справки убираем наследуемый gap между секциями */
    gap: 0;
    height: 100%;
}

/* Комментарий: упрощаем оформление блока вкладок, оставляя лишь внутренние отступы */
.configurator-help-overlay__tabs {
    display: flex;
    gap: 12px;
    padding: 28px 24px 18px;
}

.configurator-help-overlay__tab {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid rgba(215, 222, 240, 0.8);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease,
        transform 0.2s ease;
}

.configurator-help-overlay__tab.is-active {
    color: #0f172a;
    background: #fff;
    border-color: #3b82f6;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.18);
    transform: translateY(-2px);
}

.configurator-help-overlay__tab:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

/* Комментарий: оформляем контейнер с панелями вкладок */
.configurator-help-overlay__panels {
    border-top: 1px solid #e4e7ec;
    background: #fff;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-bottom: 28px;
}

.configurator-help-overlay__panel {
    display: none;
    padding: 24px;
}

.configurator-help-overlay__panel.is-active {
    display: block;
}

.configurator-help-overlay__instructions-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #1f2937;
}

.configurator-help-overlay__instructions-empty {
    margin: 16px 0 0;
    font-size: 14px;
    color: #6b7280;
}

.configurator-help-overlay__video {
    margin-top: 20px;
}

/* Комментарий: оформляем блок с подсказкой про сочетание Ctrl + F5 */
.configurator-help-overlay__support-hint {
    margin: 0;
    padding: 16px 20px;
    border-radius: 16px;
    border: 1px solid #d7def0;
    background: linear-gradient(135deg, #f8faff 0%, #eef3ff 100%);
    box-shadow: 0 12px 32px rgba(23, 37, 84, 0.08);
}

.configurator-help-overlay__support-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.configurator-help-overlay__support-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
}

.configurator-help-overlay__support-text + .configurator-help-overlay__support-text {
    margin-top: 8px;
}

.configurator-help-overlay__support-shortcut {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 6px;
    font-weight: 600;
    color: #0f172a;
}

.configurator-help-overlay__support-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid #c7d2fe;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #312e81;
    box-shadow: inset 0 -2px 0 rgba(49, 46, 129, 0.15);
}

/* Комментарий: делаем список иконок вертикальным и убираем стандартные отступы */
.configurator-help-overlay__list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0 24px 24px;
    padding: 0;
    list-style: none;
}

/* Комментарий: выравниваем иконку и текст по горизонтали */
.configurator-help-overlay__item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* Комментарий: фиксируем размеры обёртки под иконку для аккуратного выравнивания */
.configurator-help-overlay__icon-wrapper {
    flex: 0 0 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Комментарий: ограничиваем иконку, чтобы она не выходила за рамки строки */
.configurator-help-overlay__icon {
    max-width: 56px;
    max-height: 56px;
    width: 100%;
    height: auto;
}

/* Комментарий: настраиваем тексты описания и кодов иконок */
.configurator-help-overlay__description {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.configurator-help-overlay__code {
    font-weight: 600;
    font-size: 15px;
    color: #1b1b1f;
}

.configurator-help-overlay__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: #3f3f46;
}

/* Комментарий: сообщение об отсутствии иконок оформляем в центре */
.configurator-help-overlay__empty {
    margin: 0;
    text-align: center;
    font-size: 15px;
    color: #3f3f46;
}

.configurator-help-overlay__footer {
    position: absolute;
    right: 18px;
    bottom: 10px;
    z-index: 4;
}

.configurator-help-overlay__version-button {
    border: none;
    background: rgba(255, 255, 255, 0.92);
    color: #64748b;
    font-size: 12px;
    line-height: 1.3;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: color 0.2s ease;
}

.configurator-help-overlay__version-button:hover,
.configurator-help-overlay__version-button:focus-visible {
    color: #0f172a;
}

.configurator-help-overlay__version-button:focus-visible {
    outline: none;
    text-decoration: underline;
}

.configurator-help-changelog-modal {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: none;
    background: #fff;
    border-radius: inherit;
    overflow: hidden;
}

.configurator-help-changelog-modal.is-visible {
    display: block;
}

.configurator-help-changelog-modal__dialog {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: inherit;
}

.configurator-help-changelog-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid #e4e7ec;
}

.configurator-help-changelog-modal__title {
    margin: 0;
    font-size: 17px;
    color: #0f172a;
}

.configurator-help-changelog-modal__close {
    border: none;
    background: transparent;
    cursor: pointer;
    color: #475569;
}

.configurator-help-changelog-modal__body {
    padding: 0;
    overflow: auto;
}

.configurator-help-changelog-modal__text {
    margin: 0;
    padding: 16px 18px 18px;
    font-size: 13px;
    line-height: 1.5;
    color: #0f172a;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
}

.model-preview-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1200000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.model-preview-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.model-preview-overlay__content {
    max-width: 80vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    gap: 16px;
}

/* Подсказка над изображением в детальном просмотре */
.model-preview-overlay__instruction {
    /* Комментарий: отступ сверху, чтобы подсказка не прилипала к краю экрана */
    margin-top: clamp(12px, 3vh, 24px);
    color: #ffffff;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    max-width: 70vw;
}

/* Кнопки навигации по предпросмотру (мягкие стрелки по краям окна) */
.model-preview-overlay__nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(44px, 8vw, 60px);
    height: clamp(44px, 8vw, 60px);
    padding: 0;
    margin: 0;
    border: none;
    color: #ffffff;
    cursor: pointer;
    background: transparent;
    isolation: isolate;
    z-index: 2;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Кнопка запуска демонстрационного режима располагается в правом нижнем углу */
.model-preview-overlay__demo-button {
    position: absolute;
    right: clamp(16px, 4vw, 32px);
    bottom: clamp(16px, 4vh, 32px);
    padding: 12px 20px;
    border-radius: 999px;
    border: none;
    background: rgba(18, 19, 22, 0.78);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.model-preview-overlay__demo-button:hover:not(:disabled),
.model-preview-overlay__demo-button:focus-visible:not(:disabled) {
    background: rgba(18, 19, 22, 0.88);
    transform: translateY(-2px);
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.45);
    outline: none;
}

.model-preview-overlay__demo-button:disabled {
    cursor: default;
    opacity: 0.8;
}

.model-preview-overlay__demo-button--active {
    background: rgba(40, 41, 48, 0.9);
}

.model-preview-overlay__nav-button::before,
.model-preview-overlay__nav-button::after {
    /* Отключаем фоновые окружности, оставляя только стрелку и тень drop-shadow */
    content: none;
}

.model-preview-overlay__nav-button--prev {
    left: clamp(8px, 3vw, 28px);
}

.model-preview-overlay__nav-button--next {
    right: clamp(8px, 3vw, 28px);
}

.model-preview-overlay__nav-button-icon {
    /* Контейнер для svg-стрелки */
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.model-preview-overlay__nav-button-icon svg {
    /* Стрелка с лёгкой тенью по периметру */
    width: clamp(20px, 3vw, 28px);
    height: clamp(20px, 3vw, 28px);
    fill: currentColor;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.6));
    transition: transform 0.25s ease;
}

.model-preview-overlay__nav-button:hover:not(:disabled) .model-preview-overlay__nav-button-icon svg,
.model-preview-overlay__nav-button:focus-visible:not(:disabled) .model-preview-overlay__nav-button-icon svg {
    transform: scale(1.12);
}

.model-preview-overlay__nav-button:focus-visible {
    outline: none;
    transform: translateY(-50%) scale(1.06);
}

.model-preview-overlay__nav-button:disabled,
.model-preview-overlay__nav-button--is-disabled {
    cursor: default;
    opacity: 0.45;
}

.model-preview-overlay__nav-button:disabled .model-preview-overlay__nav-button-icon svg,
.model-preview-overlay__nav-button--is-disabled .model-preview-overlay__nav-button-icon svg {
    transform: none;
    filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.4));
}

@media (max-width: 720px) {
    .model-preview-overlay__nav-button {
        width: clamp(40px, 12vw, 52px);
        height: clamp(40px, 12vw, 52px);
    }
}

@media (max-width: 520px) {
    .model-preview-overlay__nav-button {
        top: auto;
        bottom: clamp(16px, 6vh, 32px);
        transform: none;
    }

    .model-preview-overlay__nav-button--prev {
        left: clamp(12px, 6vw, 24px);
    }

    .model-preview-overlay__nav-button--next {
        right: clamp(12px, 6vw, 24px);
    }

    .model-preview-overlay__nav-button:focus-visible {
        transform: scale(1.06);
    }
}

.model-preview-overlay__image-wrapper {
    /* Контейнер для наложения изображений при анимации свайпа */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.model-preview-overlay__image {
    display: block;
    max-width: 100%;
    /* Комментарий: уменьшаем высоту изображения на 15% для визуального воздуха */
    max-height: 76.5vh;
    height: auto;
    width: auto;
    filter: drop-shadow(0 20px 60px rgba(0, 0, 0, 0.35));
    will-change: transform, opacity;
}

.model-preview-overlay__image--hidden {
    /* Скрываем исходное изображение перед запуском анимации */
    opacity: 0;
}

.model-preview-overlay__image--clone {
    /* Копия изображения для анимации ухода предыдущего кадра */
    position: absolute;
    inset: 0;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.model-preview-overlay__image--animate-in-from-right {
    /* Анимация появления следующего изображения при свайпе вправо */
    animation: model-preview-slide-in-from-right 0.35s ease forwards;
}

.model-preview-overlay__image--animate-in-from-left {
    /* Анимация появления предыдущего изображения при свайпе влево */
    animation: model-preview-slide-in-from-left 0.35s ease forwards;
}

.model-preview-overlay__image--animate-out-left {
    /* Анимация ухода текущего изображения при переходе к следующему */
    animation: model-preview-slide-out-to-left 0.35s ease forwards;
}

.model-preview-overlay__image--animate-out-right {
    /* Анимация ухода текущего изображения при переходе к предыдущему */
    animation: model-preview-slide-out-to-right 0.35s ease forwards;
}

@keyframes model-preview-slide-in-from-right {
    from {
        transform: translateX(60px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes model-preview-slide-in-from-left {
    from {
        transform: translateX(-60px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes model-preview-slide-out-to-left {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-60px);
        opacity: 0;
    }
}

@keyframes model-preview-slide-out-to-right {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(60px);
        opacity: 0;
    }
}

.model-preview-overlay__title {
    /* Комментарий: отступ снизу, чтобы подпись под изображением не упиралась в край экрана */
    margin-bottom: clamp(12px, 3vh, 24px);
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    max-width: 70vw;
    word-break: break-word;
}

.model-preview-overlay__title-primary {
    font-size: 20px;
    line-height: 1.4;
    font-weight: 600;
}

.model-preview-overlay__title-secondary {
    font-size: 16px;
    line-height: 1.3;
    font-weight: 500;
    opacity: 0.9;
}

body.model-preview-open {
    overflow: hidden;
}

body.model-preview-open::before {
    content: '';
    position: fixed;
    inset: -32px;
    background-color: #fff;
    z-index: 1100000;
    pointer-events: none;
}

@media (max-width: 520px) {
    .fabric-card {
        flex-direction: column;
        align-items: stretch;
        min-height: 0;
    }

    .fabric-card-image {
        width: 100%;
        flex: 0 0 auto;
        height: 110px;
    }

    .fabric-card-body {
        width: 100%;
        align-items: flex-start;
    }
}
/* Полоса прогресса фоновой подгрузки моделей */

.destyle-prefetch-progress {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    width: min(92vw, 960px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    padding: 16px 24px 18px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 2200000; /* Повышенный z-index, чтобы перекрывать любые оверлеи интерфейса */
    pointer-events: none;
    border-radius: 24px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.94) 14%, rgba(255, 255, 255, 0.94) 86%, rgba(255, 255, 255, 0)); /* Светлая подложка с плавным исчезновением к краям */
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(6px);
}

.destyle-prefetch-progress.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.destyle-prefetch-progress.is-hover-suppressed {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.destyle-prefetch-progress__track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #666666; /* Светлый фон для ещё не загруженных моделей */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.destyle-prefetch-progress__indicator {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ff9999 0%, #993333 100%);
    transition: width 0.4s ease;
}

.destyle-prefetch-progress__label {
    font-size: 13px;
    font-weight: 600;
    color: #000000;
    text-align: center;
    text-shadow: none;
}

.destyle-prefetch-progress__note {
    font-size: 12px;
    font-weight: 500;
    color: #000000;
    text-align: center;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .destyle-prefetch-progress {
        bottom: 16px;
        width: calc(100vw - 32px);
        padding: 14px 18px 16px;
    }

    .destyle-prefetch-progress__label {
        font-size: 12px;
    }

    .destyle-prefetch-progress__note {
        font-size: 11px;
    }
}
