/* ——— Корзина (desktop + mobile) ——— */

.cart-title-count {
    font-size: 0.72em;
    font-weight: 700;
    color: #64748b;
    vertical-align: middle;
}

.cart-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 28px;
    align-items: start;
    margin-bottom: 40px;
}

.cart-shell__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
}

.cart-shell__head-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-shell__bulk-remove {
    border: none;
    background: none;
    padding: 6px 0;
    font-size: 14px;
    font-weight: 600;
    color: #ef4444;
    cursor: pointer;
}

.cart-shell__bulk-remove.is-hidden {
    display: none;
}

.cart-shell__bulk-remove:active {
    opacity: 0.7;
}

.cart-shell__all {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    user-select: none;
}

.cart-shell__all input {
    width: 18px;
    height: 18px;
    accent-color: #1f64b7;
}

.cart-shell__count {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.cart-shell__main {
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

.cart-shell__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.cart-shell__list > li:last-child .cart-card {
    border-bottom: none;
}

.cart-card {
    display: grid;
    grid-template-columns: auto 100px minmax(0, 1fr);
    grid-template-areas:
        "sel photo body";
    align-items: start;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid #eef2f7;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.cart-card.is-active {
    background: #fafcff;
}

.cart-card.is-idle {
    opacity: 0.55;
}

.cart-card__sel {
    grid-area: sel;
    display: flex;
    align-self: center;
}

.cart-card__sel input {
    width: 20px;
    height: 20px;
    accent-color: #1f64b7;
    cursor: pointer;
}

.cart-card__photo {
    grid-area: photo;
    width: 100px;
    height: 112px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid #eef2f7;
    background: #f8fafc;
    text-decoration: none;
}

.cart-card__photo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cart-card__body {
    grid-area: body;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cart-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.cart-card__name {
    flex: 1;
    min-width: 0;
    color: #1f3656;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.cart-card__name:hover {
    color: #1f64b7;
}

.cart-card__sum {
    flex-shrink: 0;
    font-size: 20px;
    font-weight: 800;
    color: #1f64b7;
    letter-spacing: -0.02em;
    white-space: nowrap;
    line-height: 1.2;
}

.cart-card.is-idle .cart-card__sum {
    color: #94a3b8;
}

.cart-card__unit {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.cart-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}

.cart-card__stepper {
    display: flex;
    align-items: stretch;
    width: 120px;
    height: 42px;
    border: 1px solid #dbe6f3;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.cart-card__step {
    flex: 0 0 38px;
    border: none;
    background: #f3f8fd;
    color: #1f64b7;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.cart-card__step:active {
    background: #e3edf9;
}

.cart-card__qty {
    flex: 1;
    min-width: 0;
    border: none;
    border-left: 1px solid #e8eef5;
    border-right: 1px solid #e8eef5;
    background: #fff;
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    color: #1f3656;
    outline: none;
}

.cart-card__remove {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    font-size: 17px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.cart-card__remove:active {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.cart-dock__panel {
    position: sticky;
    top: 20px;
    padding: 22px;
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

.cart-dock__heading {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 800;
    color: #1f3656;
}

.cart-dock__meta {
    margin: 0 0 12px;
    font-size: 13px;
    color: #64748b;
}

.cart-dock__total-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-top: 12px;
    border-top: 1px solid #eef2f7;
    font-size: 14px;
    color: #334155;
    font-weight: 600;
}

.cart-dock__total-row strong {
    font-size: 28px;
    font-weight: 800;
    color: #1f64b7;
    letter-spacing: -0.02em;
}

.cart-dock__checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 0 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    text-decoration: none;
}

.cart-empty {
    padding: 56px 24px;
    text-align: center;
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}

.cart-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: #eef5ff;
    color: #1f64b7;
    font-size: 28px;
}

.cart-empty__title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 800;
    color: #1f3656;
}

.cart-empty__text {
    margin: 0 auto 20px;
    max-width: 300px;
    font-size: 14px;
    line-height: 1.45;
    color: #64748b;
}

.cart-empty__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 220px;
    min-height: 48px;
    padding: 0 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    text-transform: none;
}

/* ——— Модалка корзины (DFI-style popup) ——— */
.cart-modal {
    position: fixed;
    inset: 0;
    z-index: 11100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top, 0px)) 14px max(16px, env(safe-area-inset-bottom, 0px));
    pointer-events: none;
}

.cart-modal.is-open {
    pointer-events: auto;
}

.cart-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.cart-modal.is-open .cart-modal__backdrop {
    opacity: 1;
}

.cart-modal__panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(100%, 400px);
    max-height: min(92vh, 720px);
    height: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
    opacity: 0;
    transition: opacity 0.2s ease;
    overflow: hidden;
    will-change: opacity;
}

.cart-modal.is-open .cart-modal__panel {
    opacity: 1;
}

.cart-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 16px 18px;
    background: #fff;
    border-bottom: 1px solid #eef2f7;
}

.cart-modal__title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #1f3656;
    line-height: 1.2;
}

.cart-modal__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #eef5ff;
    color: #1f64b7;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
}

.cart-modal__badge.is-hidden {
    display: none;
}

.cart-modal__close {
    width: 38px;
    height: 38px;
    border: 1px solid #dbe6f3;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
}

.cart-modal__close:active {
    background: #f8fafc;
    color: #334155;
}

.cart-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 18px 18px;
}

.cart-modal__content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: calc(min(92vh, 720px) - 62px);
    opacity: 0;
}

.cart-modal__content.is-ready {
    opacity: 1;
    transition: opacity 0.12s ease;
}

.cart-modal__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    min-height: 160px;
    padding: 32px 0;
}

.cart-modal__loading[hidden] {
    display: none !important;
}

.cart-modal__error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 16px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

.cart-modal__retry {
    border: none;
    background: #eef5ff;
    color: #1f64b7;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    touch-action: manipulation;
}

/* Popup content (inside modal) */
.cart-popup {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.cart-popup__list {
    list-style: none;
    margin: 0;
    padding: 4px 0 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    max-height: min(44vh, 340px);
}

.cart-popup__item {
    padding: 14px 0;
    border-bottom: 1px solid #eef2f7;
}

.cart-popup__item:last-child {
    border-bottom: none;
    padding-bottom: 8px;
}

.cart-popup__top {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.cart-popup__photo {
    width: 76px;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
}

.cart-popup__photo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cart-popup__info {
    min-width: 0;
}

.cart-popup__name {
    color: #1f3656;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.cart-popup__name:active {
    color: #1f64b7;
}

.cart-popup__meta {
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.cart-popup__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    padding-left: 90px;
}

.cart-popup__stepper {
    display: flex;
    align-items: stretch;
    height: 40px;
    border: 1px solid #b8d4ef;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    flex-shrink: 0;
}

.cart-popup__step {
    flex: 0 0 40px;
    min-width: 40px;
    border: none;
    background: #fff;
    color: #1f64b7;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    touch-action: manipulation;
}

.cart-popup__step:active {
    background: #f0f7ff;
}

.cart-popup__qty {
    width: 40px;
    min-width: 40px;
    border: none;
    border-left: 1px solid #dbeaf8;
    border-right: 1px solid #dbeaf8;
    background: #fff;
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    color: #1f3656;
    outline: none;
}

.cart-popup__remove {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid #b8d4ef;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.cart-popup__remove:active {
    color: #ef4444;
    background: #fef2f2;
    border-color: #fecaca;
}

.cart-popup__summary {
    flex-shrink: 0;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #eef2f7;
}

.cart-popup__sum-box {
    border-radius: 10px;
    background: #f8fafc;
    overflow: hidden;
    margin-bottom: 14px;
}

.cart-popup__sum-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}

.cart-popup__sum-row strong {
    font-size: 15px;
    font-weight: 800;
    color: #1f3656;
    white-space: nowrap;
}

.cart-popup__sum-row--total {
    background: #f1f5f9;
    font-size: 15px;
    color: #1f3656;
}

.cart-popup__sum-row--total strong {
    font-size: 18px;
    color: #1f64b7;
}

.cart-popup__checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(180deg, #5ec4f0 0%, #45b3e8 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 6px 18px rgba(69, 179, 232, 0.38);
    touch-action: manipulation;
}

.cart-popup__checkout:active {
    background: linear-gradient(180deg, #45b3e8 0%, #2ea2dc 100%);
}

.cart-popup__checkout.is-disabled {
    background: #cbd5e1;
    box-shadow: none;
    pointer-events: none;
}

.cart-popup--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
}

.cart-popup__empty {
    text-align: center;
    padding: 20px 8px 8px;
}

.cart-popup__empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: #eef5ff;
    color: #1f64b7;
    font-size: 24px;
}

.cart-popup__empty-title {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 800;
    color: #1f3656;
}

.cart-popup__empty-text {
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.45;
    color: #64748b;
}

.cart-popup__empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    touch-action: manipulation;
}

body.cart-modal-open {
    overflow: hidden;
}

body.is-mobile-app.cart-page .cart-page-full {
    visibility: hidden;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body.is-mobile-app.cart-modal-open .support-chat-dock:not(.is-open) {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .cart-modal {
        padding-left: 12px;
        padding-right: 12px;
    }

    .cart-modal__panel {
        width: min(100%, 390px);
    }

    .cart-popup__actions {
        padding-left: 0;
    }
}

/* ——— Mobile (full page fallback / desktop) ——— */
@media (max-width: 768px) {
    body.is-mobile-app:not(.cart-page) .cart-page-full {
        display: none;
    }

    body.is-mobile-app.cart-page .breadcrumb {
        display: none;
    }

    body.is-mobile-app.cart-page .page-title {
        font-size: 22px;
        font-weight: 800;
        color: #1f3656;
        margin-bottom: 12px;
    }

    body.is-mobile-app.cart-page .cart-title-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 26px;
        height: 26px;
        padding: 0 8px;
        margin-left: 6px;
        border-radius: 999px;
        background: #eef5ff;
        color: #1f64b7;
        font-size: 13px;
    }

    body.is-mobile-app.cart-page .content-wrap {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 118px);
    }

    body.is-mobile-app.mobile-has-cart-bar {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 118px);
    }

    body.is-mobile-app.mobile-has-cart-bar .support-chat-dock:not(.is-open) {
        bottom: calc(env(safe-area-inset-bottom, 0px) + 112px);
    }

    body.is-mobile-app.cart-page .cart-shell {
        grid-template-columns: 1fr;
        gap: 0;
        margin-bottom: 0;
    }

    body.is-mobile-app.cart-page .cart-shell__main {
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    body.is-mobile-app.cart-page .cart-shell__head {
        padding: 0 0 10px;
        border: none;
        background: transparent;
    }

    body.is-mobile-app.cart-page .cart-shell__all {
        font-size: 14px;
    }

    body.is-mobile-app.cart-page .cart-shell__all input {
        width: 20px;
        height: 20px;
    }

    body.is-mobile-app.cart-page .cart-shell__count {
        display: none;
    }

    body.is-mobile-app.cart-page .cart-shell__bulk-remove {
        font-size: 15px;
        padding: 8px 4px;
    }

    body.is-mobile-app.cart-page .cart-shell__list {
        gap: 0;
        background: #fff;
        border: 1px solid #e8eef5;
        border-radius: 14px;
        overflow: hidden;
    }

    body.is-mobile-app.cart-page .cart-card {
        grid-template-columns: 28px 72px minmax(0, 1fr);
        gap: 10px;
        padding: 14px 12px;
        border-bottom: 1px solid #eef2f7;
        background: #fff;
        box-shadow: none;
    }

    body.is-mobile-app.cart-page .cart-card.is-active {
        background: #f8fbff;
    }

    body.is-mobile-app.cart-page .cart-card.is-idle {
        opacity: 0.45;
        background: #fff;
    }

    body.is-mobile-app.cart-page .cart-card__photo {
        width: 72px;
        height: 72px;
        padding: 4px;
        border-radius: 10px;
    }

    body.is-mobile-app.cart-page .cart-card__name {
        font-size: 14px;
        -webkit-line-clamp: 2;
        line-height: 1.35;
    }

    body.is-mobile-app.cart-page .cart-card__sum {
        font-size: 16px;
    }

    body.is-mobile-app.cart-page .cart-card__unit {
        font-size: 12px;
    }

    body.is-mobile-app.cart-page .cart-card__foot {
        margin-top: 2px;
    }

    body.is-mobile-app.cart-page .cart-card__stepper {
        width: 108px;
        height: 38px;
    }

    body.is-mobile-app.cart-page .cart-card__step {
        flex-basis: 34px;
        font-size: 17px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    body.is-mobile-app.cart-page .cart-card__qty {
        font-size: 16px;
        pointer-events: none;
        -webkit-user-select: none;
        user-select: none;
    }

    body.is-mobile-app.cart-page .cart-card__remove {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    body.is-mobile-app.cart-page .cart-dock {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10980;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    body.is-mobile-app.cart-page .cart-dock__panel {
        position: static;
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 12px 14px max(12px, env(safe-area-inset-bottom, 0px));
        border: none;
        border-radius: 16px 16px 0 0;
        border-top: 1px solid #dce6f2;
        box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.12);
    }

    body.is-mobile-app.cart-page .cart-dock__heading {
        display: none;
    }

    body.is-mobile-app.cart-page .cart-dock__meta {
        margin: 0;
        font-size: 12px;
        color: #64748b;
    }

    body.is-mobile-app.cart-page .cart-dock__total-row {
        display: flex;
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
        margin: 0;
        padding: 0;
        border: none;
        font-size: 14px;
        color: #334155;
        font-weight: 600;
    }

    body.is-mobile-app.cart-page .cart-dock__total-row strong {
        font-size: 24px;
        color: #1f3656;
        line-height: 1;
    }

    body.is-mobile-app.cart-page .cart-dock__checkout {
        width: 100%;
        max-width: none;
        min-height: 50px;
        margin-top: 2px;
        font-size: 15px;
    }

    body.is-mobile-app.cart-page .cart-empty {
        padding: 48px 20px;
    }

    body.is-mobile-app.cart-page .cart-empty__btn {
        width: 100%;
        max-width: none;
    }
}
