.cart-drawer__overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 26, 32, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 100050;
}
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: 540px;
    max-width: 100vw;
    background: #fff;
    box-shadow: -12px 0 40px rgba(17, 26, 32, 0.18);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(.4, 0, .2, 1);
    z-index: 100051;
    display: flex;
    flex-direction: column;
}
body.cart-drawer-open .cart-drawer { transform: translateX(0); }
body.cart-drawer-open .cart-drawer__overlay { opacity: 1; visibility: visible; }
body.cart-drawer-open { overflow: hidden; }

.cart-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid #eef0f3;
    flex: 0 0 auto;
}
.cart-drawer__title { font-size: 18px; font-weight: 800; color: #171a20; }
.cart-drawer__count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 6px; margin-left: 4px;
    background: #3076d5; color: #fff; border-radius: 11px; font-size: 12px; font-weight: 700;
}
.cart-drawer__close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: 0; background: #f1f3f5; border-radius: 10px;
    color: #171a20; cursor: pointer; transition: background 0.15s;
}
.cart-drawer__close:hover { background: #e6e8ec; }

.cart-drawer__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 18px;
}
.cd-item {
    display: grid;
    grid-template-columns: 68px 1fr 24px;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #f2f4f6;
    position: relative;
}
.cd-item.is-busy { opacity: 0.5; pointer-events: none; }
.cd-item__img {
    width: 68px; height: 68px; border-radius: 10px; overflow: hidden;
    background: #f6f7f9; display: block; flex: 0 0 auto;
}
.cd-item__img img { width: 100%; height: 100%; object-fit: contain; }
.cd-item__main { min-width: 0; }
.cd-item__name {
    display: block; font-size: 13.5px; font-weight: 600; color: #171a20;
    line-height: 1.35; text-decoration: none;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cd-item__name:hover { color: #3076d5; }
.cd-item__prices { display: flex; align-items: baseline; gap: 8px; margin: 5px 0 8px; }
.cd-item__price { font-size: 14px; font-weight: 700; color: #171a20; }
.cd-item__old { font-size: 12px; color: #9aa1ab; text-decoration: line-through; }
.cd-item__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cd-qty {
    display: inline-flex; align-items: center; border: 1px solid #e2e6ea; border-radius: 9px; overflow: hidden;
}
.cd-qty__btn {
    width: 30px; height: 30px; border: 0; background: #fff; color: #171a20;
    font-size: 17px; line-height: 1; cursor: pointer; transition: background 0.15s;
}
.cd-qty__btn:hover { background: #f1f3f5; }
.cd-qty__val { min-width: 30px; text-align: center; font-size: 14px; font-weight: 700; }
.cd-item__sum { font-size: 14px; font-weight: 700; color: #171a20; white-space: nowrap; }
.cd-item__remove {
    width: 24px; height: 24px; border: 0; background: transparent; color: #b3b9c2;
    cursor: pointer; padding: 0; transition: color 0.15s;
}
.cd-item__remove:hover { color: #e03131; }

.cart-drawer__foot {
    flex: 0 0 auto;
    padding: 16px 18px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eef0f3;
    box-shadow: 0 -6px 18px rgba(17, 26, 32, 0.05);
}
.cd-sumrow {
    display: flex; align-items: baseline; justify-content: space-between; padding: 4px 0; font-size: 14px;
}
.cd-sumrow span:first-child { color: #6b7280; }
.cd-sumrow span:last-child { font-weight: 600; color: #171a20; white-space: nowrap; }
.cd-sumrow--disc span:last-child { color: #e03131; }
.cd-total {
    display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px;
}
.cart-drawer__foot .cd-sumrow + .cd-total {
    margin-top: 8px; padding-top: 10px; border-top: 1px solid #eef0f3;
}
.cd-total span { font-size: 15px; color: #6b7280; }
.cd-total b { font-size: 18px; font-weight: 800; color: #171a20; }
.cd-checkout {
    display: flex; align-items: center; justify-content: center;
    height: 52px; background: #3076d5; color: #fff; border-radius: 12px;
    font-size: 16px; font-weight: 700; text-decoration: none; transition: background 0.15s;
}
.cd-checkout:hover { background: #245fb0; color: #fff; }
.cd-viewcart {
    display: flex; align-items: center; justify-content: center;
    height: 44px; margin-top: 8px; color: #3076d5; text-decoration: none;
    font-size: 14px; font-weight: 600;
}
.cd-viewcart:hover { text-decoration: underline; }

.cart-drawer__empty {
    flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 30px 24px; gap: 6px;
}
.cart-drawer__empty-title { font-size: 19px; font-weight: 800; color: #171a20; margin-top: 8px; }
.cart-drawer__empty-text { font-size: 14px; color: #6b7280; margin-bottom: 18px; line-height: 1.5; max-width: 300px; }
.cd-empty-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    height: 54px; padding: 0 30px; min-width: 220px;
    background: #3076d5; color: #fff; border: 0; border-radius: 14px;
    font-family: inherit; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer;
    box-shadow: 0 10px 24px rgba(48, 118, 213, 0.30);
    transition: transform .15s, box-shadow .2s, background .15s;
}
.cd-empty-btn:hover { background: #245fb0; color: #fff; transform: translateY(-2px); box-shadow: 0 14px 30px rgba(48, 118, 213, 0.40); }
.cd-empty-btn:active { transform: translateY(0); }

@media (max-width: 480px) {
    .cart-drawer { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
    .cart-drawer { transition: none; }
    .cart-drawer__overlay { transition: none; }
}
