html.cart-overlay-open,
body.cart-overlay-open {
    overflow: hidden;
}

.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 20, 33, 0.24);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
    z-index: 1000000;
}

body.cart-open .cart-overlay {
    opacity: 1;
    pointer-events: auto;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 50vw;
    min-width: 50vw;
    max-width: 50vw;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    overflow: auto;
    overscroll-behavior: contain;
    transform: translateX(100%);
    transition: opacity 0.24s ease, transform 0.24s ease;
    z-index: 1000001;
    background: var(--off-white);
    border-left: 1px solid rgba(62, 53, 124, 0.22);
    box-shadow: -12px 0 26px rgba(25, 22, 69, 0.14);
    padding: 16px;
    color: var(--dark-indigo);
}

body.cart-open .cart-sidebar {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.cart-header-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cart-close-btn {
    appearance: none;
    border: 1px solid rgba(62, 53, 124, 0.28);
    background: rgba(255, 255, 255, 0.74);
    color: var(--blue-gray);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.86rem;
    line-height: 1;
    cursor: pointer;
}

.cart-close-btn:hover {
    border-color: rgba(62, 53, 124, 0.56);
    background: rgba(255, 255, 255, 0.96);
}

.cart-header,
.cart-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-indigo);
}

.cart-count,
.cart-total-sub {
    color: var(--dark-indigo-soft);
    font-size: 0.75rem;
    font-family: "DM Mono", monospace;
}

.cart-items {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    margin: 12px 0;
    display: grid;
    gap: 8px;
    align-content: start;
}

.cart-empty {
    min-height: 170px;
    border: 1px dashed rgba(62, 53, 124, 0.28);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--blue-gray);
    background: rgba(255, 255, 255, 0.46);
    gap: 6px;
    text-align: center;
    padding: 12px;
}

.cart-item {
    border: 1px solid rgba(62, 53, 124, 0.2);
    border-radius: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.72);
}

.cart-item-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.83rem;
}

.cart-item-remove {
    border: 0;
    background: transparent;
    color: var(--blue);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0 3px;
}

.cart-item-meta {
    display: grid;
    gap: 2px;
    margin-bottom: 4px;
}

.cart-item-detail {
    color: var(--blue-gray);
    font-size: 0.7rem;
}

.cart-item-price {
    font-family: "DM Mono", monospace;
    font-size: 0.76rem;
    color: var(--dark-indigo);
}

.cart-item-period {
    font-size: 0.62rem;
    color: var(--blue-gray);
    margin-left: 4px;
    font-family: "DM Mono", monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-checkout {
    appearance: none;
    border: none;
    background-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px 0 rgba(23, 25, 39, 0.1);
    border-radius: 10px;
    padding: 8px 11px;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
    width: 100%;
    font-weight: 600;
    color: var(--dark-indigo);
    border: 1px solid rgba(62, 53, 124, 0.24);
    background-color: rgba(255, 255, 255, 0.72);
}

.btn-checkout:disabled {
    opacity: 0.52;
    cursor: not-allowed;
}

#cart-auth-msg a {
    color: var(--blue);
}

@media (max-width: 900px) {
    .cart-sidebar {
        width: 100vw;
        min-width: 100vw;
        max-width: 100vw;
    }
}
