.cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 240;
    display: grid;
    align-items: end;
    pointer-events: auto;
}

.cart-drawer.is-page {
    position: relative;
    z-index: 1;
    min-height: calc(100svh - 72px);
    padding: 12px var(--page-gutter) 24px;
}

.cart-drawer__scrim {
    position: absolute;
    inset: 0;
    background: rgba(27, 29, 24, .42);
    backdrop-filter: blur(12px);
}

.cart-drawer.is-page .cart-drawer__scrim {
    display: none;
}

.cart-drawer__panel {
    position: relative;
    display: grid;
    width: 100%;
    max-height: min(88svh, 760px);
    overflow: hidden;
    border: 1px solid rgba(223, 212, 195, .9);
    border-radius: 24px 24px 0 0;
    background:
        radial-gradient(circle at 12% 0, rgba(200, 97, 56, .08), transparent 30%),
        linear-gradient(180deg, #FFFDF7, #F7F4EF);
    box-shadow: 0 -24px 54px rgba(27, 29, 24, .22);
}

.cart-drawer.is-page .cart-drawer__panel {
    width: min(100%, 720px);
    max-height: none;
    margin-inline: auto;
    border-radius: 22px;
    box-shadow: 0 18px 44px rgba(27, 29, 24, .08);
}

.cart-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(223, 212, 195, .72);
}

.cart-drawer__header span {
    display: grid;
    gap: 2px;
}

.cart-drawer__header small,
.cart-line__meta,
.cart-line small,
.cart-line em,
.cart-summary dt,
.cart-suggestion small {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 740;
    line-height: 1.15;
}

.cart-drawer__header strong {
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 900;
    line-height: 1;
}

.cart-drawer__close {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 253, 247, .9);
}

.cart-drawer__content {
    display: grid;
    gap: 14px;
    overflow: auto;
    padding: 14px 14px max(14px, env(safe-area-inset-bottom));
}

.cart-drawer__content.htmx-request {
    opacity: .62;
    pointer-events: none;
}

.cart-drawer__content.htmx-swapping {
    opacity: 0;
}

.cart-drawer__content.htmx-settling {
    animation: cart-content-enter 180ms ease both;
}

.cart-live-status {
    position: fixed;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 280;
    max-width: min(320px, calc(100vw - 28px));
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--brand);
    color: var(--cream);
    box-shadow: 0 14px 32px rgba(27, 29, 24, .18);
    font-size: .76rem;
    font-weight: 850;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.cart-live-status.is-error {
    background: var(--accent-strong);
}

.cart-live-status.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes cart-content-enter {
    from {
        opacity: .45;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-inline-error {
    margin: 0;
    padding: 9px 10px;
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    background: rgba(200, 97, 56, .1);
    color: var(--text);
    font-size: .7rem;
    font-weight: 800;
    line-height: 1.25;
}

.cart-lines {
    display: grid;
    gap: 9px;
}

.cart-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px 10px;
    padding: 11px;
    border: 1px solid rgba(223, 212, 195, .76);
    border-radius: 14px;
    background: rgba(255, 253, 247, .86);
    box-shadow: 0 10px 22px rgba(27, 29, 24, .045);
}

.cart-line__main {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.cart-line__main strong {
    overflow: hidden;
    color: var(--text);
    font-size: .9rem;
    font-weight: 900;
    line-height: 1.12;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-line__booking {
    color: var(--brand);
    font-size: .66rem;
    font-weight: 850;
    line-height: 1.2;
}

.cart-line__qty {
    display: grid;
    grid-template-columns: 30px 42px 30px;
    align-items: center;
    align-self: center;
    overflow: hidden;
    border: 1px solid rgba(223, 212, 195, .82);
    border-radius: 999px;
    background: #FFFDF7;
}

.cart-line__qty button,
.cart-line__qty input {
    min-height: 30px;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-align: center;
}

.cart-line__qty button {
    padding: 0;
    color: var(--brand);
    font-weight: 900;
}

.cart-line__qty input {
    width: 42px;
    padding: 0;
    color: var(--text);
    font-size: .82rem;
    font-weight: 900;
}

.cart-line__total {
    color: var(--accent);
    font-size: .88rem;
    font-weight: 900;
}

.cart-line__remove {
    justify-self: end;
}

.cart-line__remove button {
    width: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 0;
    border-radius: 50%;
    color: var(--accent);
    background: var(--accent-soft);
}

.cart-empty {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 22px 12px;
    text-align: center;
}

.cart-empty__icon {
    display: inline-flex;
    width: 54px;
    height: 54px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--brand);
    background: var(--brand-soft);
}

.cart-empty strong {
    font-size: 1rem;
    font-weight: 900;
}

.cart-empty p {
    max-width: 28ch;
    margin: 0;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.28;
}

.cart-suggestions {
    display: grid;
    gap: 9px;
}

.cart-suggestions h2 {
    margin: 0;
    font-size: .9rem;
    font-weight: 900;
}

.cart-suggestions__rail {
    display: grid;
    gap: 8px;
}

.cart-suggestion {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 34px;
    gap: 9px;
    align-items: center;
    padding: 9px;
    border: 1px solid rgba(223, 212, 195, .74);
    border-radius: 13px;
    background: rgba(255, 253, 247, .72);
}

.cart-suggestion span {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.cart-suggestion strong {
    overflow: hidden;
    color: var(--text);
    font-size: .78rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-suggestion em {
    color: var(--accent);
    font-size: .76rem;
    font-style: normal;
    font-weight: 900;
}

.cart-suggestion button {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 50%;
    color: var(--cream);
    background: var(--accent);
}

.cart-summary {
    display: grid;
    gap: 12px;
    padding-top: 2px;
}

.cart-summary dl {
    display: grid;
    gap: 6px;
    margin: 0;
}

.cart-summary dl div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cart-summary dd {
    margin: 0;
    color: var(--text);
    font-weight: 900;
}

.cart-summary__total {
    padding-top: 8px;
    border-top: 1px solid rgba(223, 212, 195, .8);
}

.cart-summary__total dt,
.cart-summary__total dd {
    color: var(--text);
    font-size: 1rem;
    font-weight: 900;
}

.cart-checkout {
    min-height: 44px;
    gap: 8px;
    border: 0;
    border-radius: 13px;
    background: var(--accent);
    color: var(--cream);
    font-size: .9rem;
    font-weight: 900;
}

.cart-checkout:disabled {
    opacity: .48;
    cursor: not-allowed;
}

.cart-continue {
    justify-self: center;
    color: var(--brand);
    font-size: .78rem;
    font-weight: 900;
}

@media (min-width: 720px) {
    .cart-drawer {
        align-items: stretch;
        justify-items: end;
    }

    .cart-drawer__panel {
        width: min(440px, 100vw);
        max-height: none;
        height: 100%;
        border-radius: 22px 0 0 22px;
        box-shadow: -24px 0 54px rgba(27, 29, 24, .18);
    }

    .cart-drawer.is-page {
        justify-items: center;
    }

    .cart-drawer.is-page .cart-drawer__panel {
        width: min(720px, 100%);
        height: auto;
        border-radius: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cart-drawer__content.htmx-settling {
        animation: none;
    }

    .cart-live-status {
        transition: none;
    }
}
