.m360-packs[hidden],
.m360-packs__badge[hidden],
.m360-packs-total[hidden] {
    display: none !important;
}

.m360-packs-native-counter,
.m360-packs-native-price {
    display: none !important;
}

/*
 * ВАЖНО:
 * Новый блок количества теперь выводится сервером сразу, без ожидания AJAX.
 * Поэтому штатный +/- скрываем уже на первом рендере по самому наличию
 * видимого .m360-packs. Это убирает FOUC и скачок верстки при загрузке.
 */
body .m360-packs-row,
body .counter_wrapp:has(> .m360-packs:not([hidden])) {
    display: flex !important;
    align-items: flex-end;
    gap: 12px;
    overflow: visible !important;
}

body .m360-packs-row:before,
body .m360-packs-row:after,
body .counter_wrapp:has(> .m360-packs:not([hidden])):before,
body .counter_wrapp:has(> .m360-packs:not([hidden])):after {
    display: none !important;
}

/* Штатный счетчик Aspro не должен мелькать даже до запуска pack-selector.js. */
body .m360-packs-row > .counter_block_inner,
body .counter_wrapp:has(> .m360-packs:not([hidden])) > .counter_block_inner {
    display: none !important;
}

body .m360-packs-row .button_block,
body .counter_wrapp:has(> .m360-packs:not([hidden])) .button_block {
    float: none !important;
    width: auto !important;
    flex: 0 0 auto;
    margin: 0 !important;
}

body .m360-packs-row .button_block .btn,
body .counter_wrapp:has(> .m360-packs:not([hidden])) .button_block .btn {
    white-space: nowrap;
}

.m360-packs {
    min-width: 0;
    flex: 1 1 auto;
}

.m360-packs__label {
    font-size: 10px;
    line-height: 16px;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 14px;
    color: #666;
}

.m360-packs__options {
    display: flex;
    gap: 8px;
}

body .m360-packs__option {
    position: relative;
    flex: 1;
    min-width: 0;
    padding: 0 10px;
    height: 48px;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    background: #fff;
    color: #555;
    font: inherit;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

body .m360-packs__option.is-active {
    background: #505050;
    border-color: #505050;
    color: #fff;
}

body .m360-packs__option:hover:not(:disabled) {
    border-color: #505050;
}

body .m360-packs__option:focus-visible {
    outline: 2px solid #505050;
    outline-offset: 3px;
}

body .m360-packs__option:disabled {
    opacity: .4;
    cursor: default;
}

/* Во время первого запроса не делаем кнопки полупрозрачными - только блокируем клики. */
body .m360-packs[aria-busy="true"] .m360-packs__option {
    pointer-events: none;
}

body .m360-packs[aria-busy="true"] .m360-packs__option:disabled {
    opacity: 1;
}

.m360-packs__badge {
    position: absolute;
    top: -12px;
    right: 5px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #dc0326;
    color: #fff;
    font-size: 12px;
    line-height: 15px;
    font-weight: 600;
}

.m360-packs__status {
    font-size: 11px;
    line-height: 16px;
    color: #777;
}

.m360-packs__status:empty {
    display: none;
}

.m360-packs-total {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    color: var(--white_text_black, #222);
}

.m360-packs-total__old {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.25;
    font-weight: 400;
    color: #999;
    text-decoration: line-through;
}

.m360-packs-total__value {
    display: block;
}

/*
 * До запуска JS класс .m360-packs-scope еще не успевает появиться.
 * :has(.m360-packs) применяет ту же финальную раскладку сразу на первом paint.
 */
body :where(
    .m360-packs-scope,
    .middle-info-wrapper:has(.m360-packs:not([hidden])),
    .table-view__item-wrapper:has(.m360-packs:not([hidden]))
) .prices_block {
    min-width: 120px;
}

body :where(
    .m360-packs-scope,
    .middle-info-wrapper:has(.m360-packs:not([hidden])),
    .table-view__item-wrapper:has(.m360-packs:not([hidden]))
) .buy_block {
    min-width: 0;
}

body :where(
    .m360-packs-scope,
    .middle-info-wrapper:has(.m360-packs:not([hidden])),
    .table-view__item-wrapper:has(.m360-packs:not([hidden]))
) .product-purchase-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}

body :where(
    .m360-packs-scope,
    .middle-info-wrapper:has(.m360-packs:not([hidden])),
    .table-view__item-wrapper:has(.m360-packs:not([hidden]))
) .product-purchase-row > .prices_block {
    flex: 0 0 auto;
    max-width: 100%;
    padding-bottom: 9px;
}

body :where(
    .m360-packs-scope,
    .middle-info-wrapper:has(.m360-packs:not([hidden])),
    .table-view__item-wrapper:has(.m360-packs:not([hidden]))
) .product-purchase-row > .buy_block {
    position: static !important;
    flex: 1 1 350px;
    width: auto !important;
    margin: 0 !important;
}

body :where(
    .m360-packs-scope,
    .middle-info-wrapper:has(.m360-packs:not([hidden])),
    .table-view__item-wrapper:has(.m360-packs:not([hidden]))
) .product-purchase-row > .buy_block > .counter_wrapp {
    float: none;
    transform: none;
    width: 100%;
}

/* DESKTOP ONLY */
@media (min-width: 992px) {
    body :where(
        .m360-packs-scope,
        .middle-info-wrapper:has(.m360-packs:not([hidden])),
        .table-view__item-wrapper:has(.m360-packs:not([hidden]))
    ) .info-wrapper {
        flex-wrap: wrap;
    }

    body :where(
        .m360-packs-scope,
        .middle-info-wrapper:has(.m360-packs:not([hidden])),
        .table-view__item-wrapper:has(.m360-packs:not([hidden]))
    ) .info-wrapper > .product-purchase-row,
    body :where(
        .m360-packs-scope,
        .middle-info-wrapper:has(.m360-packs:not([hidden])),
        .table-view__item-wrapper:has(.m360-packs:not([hidden]))
    ) .product-purchase-row {
        flex: 1 1 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: grid !important;
        grid-template-columns: 120px minmax(0, 1fr);
        column-gap: 18px !important;
        row-gap: 0 !important;
        align-items: end !important;
    }

    body :where(
        .m360-packs-scope,
        .middle-info-wrapper:has(.m360-packs:not([hidden])),
        .table-view__item-wrapper:has(.m360-packs:not([hidden]))
    ) .product-purchase-row > .prices_block {
        width: 120px !important;
        min-width: 120px !important;
        max-width: 120px !important;
        margin: 0 !important;
        padding: 0 0 9px !important;
    }

    body :where(
        .m360-packs-scope,
        .middle-info-wrapper:has(.m360-packs:not([hidden])),
        .table-view__item-wrapper:has(.m360-packs:not([hidden]))
    ) .product-purchase-row > .buy_block {
        position: static !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
    }

    body .m360-packs-row,
    body .counter_wrapp:has(> .m360-packs:not([hidden])) {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: flex-end !important;
        gap: 12px !important;
        width: 100% !important;
        min-width: 0 !important;
        float: none !important;
        transform: none !important;
        overflow: visible !important;
    }

    body .m360-packs-row > .m360-packs,
    body .counter_wrapp:has(> .m360-packs:not([hidden])) > .m360-packs {
        flex: 0 0 345px !important;
        width: 345px !important;
        min-width: 345px !important;
        max-width: 345px !important;
        margin: 0 !important;
    }

    body .m360-packs-row > .m360-packs .m360-packs__options,
    body .counter_wrapp:has(> .m360-packs:not([hidden])) > .m360-packs .m360-packs__options {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px !important;
        width: 100% !important;
    }

    body .m360-packs-row > .m360-packs .m360-packs__option,
    body .counter_wrapp:has(> .m360-packs:not([hidden])) > .m360-packs .m360-packs__option {
        width: 100% !important;
        min-width: 0 !important;
    }

    body .m360-packs-row > .button_block,
    body .counter_wrapp:has(> .m360-packs:not([hidden])) > .button_block {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 116px !important;
        margin: 0 !important;
    }

    body .m360-packs-row > .button_block .btn,
    body .counter_wrapp:has(> .m360-packs:not([hidden])) > .button_block .btn {
        min-width: 116px !important;
        justify-content: center;
        text-align: center;
    }
}

/* MOBILE - сохраняем текущую рабочую раскладку. */
@media (max-width: 600px) {
    body .m360-packs-row,
    body .counter_wrapp:has(> .m360-packs:not([hidden])) {
        flex-wrap: wrap;
        gap: 14px;
    }

    .m360-packs {
        flex-basis: 100%;
    }

    body .m360-packs-row .button_block,
    body .counter_wrapp:has(> .m360-packs:not([hidden])) .button_block {
        width: 100% !important;
    }

    body .m360-packs-row .button_block .btn,
    body .counter_wrapp:has(> .m360-packs:not([hidden])) .button_block .btn {
        width: 100%;
    }

    body .m360-packs__option {
        font-size: 12px;
        height: 44px;
        padding: 0 6px;
    }

    .m360-packs-total {
        font-size: 24px;
    }

    body :where(
        .m360-packs-scope,
        .middle-info-wrapper:has(.m360-packs:not([hidden])),
        .table-view__item-wrapper:has(.m360-packs:not([hidden]))
    ) .product-purchase-row > .buy_block {
        flex-basis: 100%;
    }
}
