:root {
    --bg: #f8f2ea;
    --surface: #fff9f3;
    --surface-strong: #fffdf9;
    --brand-700: #1f5b54;
    --brand-500: #1f5b54;
    --text: #1f5b54;
    --muted: #5f817b;
    --line: #ecd8c6;
    --line-strong: #e5ccb7;
    --shadow: 0 18px 34px rgba(31, 91, 84, 0.1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Sora", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(255, 232, 210, 0.92), transparent 38%),
        linear-gradient(180deg, #fff8f1 0%, var(--bg) 100%);
    color: var(--text);
}

.container {
    width: min(1140px, 92vw);
    margin: 0 auto;
    padding: 24px 0 42px;
}

.top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
}

.page-intro {
    flex: 1 1 420px;
}

.page-intro .site-copy {
    gap: 6px;
}

.layout {
    margin-top: 20px;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.95fr);
    gap: 20px;
    align-items: start;
}

.bill-card,
.summary-card {
    background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface) 100%);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 20px;
}

.bill-card {
    display: grid;
    gap: 14px;
}

.summary-card {
    position: sticky;
    top: 18px;
    display: grid;
    gap: 12px;
}

.head,
.summary-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.head h2,
.summary-head h3 {
    margin: 0;
    color: var(--brand-700);
    font-family: "Fraunces", serif;
}

.head p,
.summary-head p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.cart-list {
    display: grid;
    gap: 12px;
}

.item-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 24px rgba(90, 46, 22, 0.06);
}

.thumb {
    width: 92px;
    height: 84px;
    border-radius: 14px;
    background: linear-gradient(140deg, #f5dbc5, #f9eee4);
    overflow: hidden;
    border: 1px solid #ecd7c6;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-main {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.item-main h4 {
    margin: 0;
    color: var(--brand-700);
    font-size: 15px;
    line-height: 1.45;
    word-break: break-word;
}

.item-main p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.qty-row {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    padding: 1px;
    border: 1px solid #ddc2ad;
    border-radius: 10px;
    background: #fff3e6;
    width: fit-content;
    justify-self: start;
}

.qty-row button {
    border: none;
    background: rgba(255, 255, 255, 0.58);
    width: 24px;
    height: 24px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    color: var(--brand-700);
}

.qty-row input {
    width: 30px;
    height: 24px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--brand-700);
    font-size: 11px;
    font-weight: 700;
}

.actions {
    display: grid;
    gap: 8px;
    justify-items: end;
    align-content: center;
    min-width: 150px;
}

.item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.actions button {
    min-width: 78px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.actions button:hover {
    transform: translateY(-1px);
}

.update-btn {
    background: #f2ddcb;
    color: var(--brand-700);
}

.remove-btn {
    background: #ffe7e3;
    color: #a13128;
}

.item-total {
    color: var(--brand-700);
    font-weight: 800;
    white-space: nowrap;
}

.row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
}

.row span {
    color: var(--brand-700);
    font-size: 13px;
    font-weight: 600;
}

.row strong {
    color: var(--brand-700);
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.row.total {
    border-color: var(--line-strong);
    background: linear-gradient(180deg, #fff4e9 0%, #fff8f2 100%);
}

.row-muted {
    background: #fff6ee;
    border-color: #e9cfb6;
}

.place-btn {
    width: 100%;
    border: none;
    border-radius: 14px;
    background: linear-gradient(120deg, var(--brand-700), var(--brand-700));
    color: #fff;
    font-weight: 800;
    padding: 14px 18px;
    margin-top: 2px;
    cursor: pointer;
    box-shadow: 0 18px 30px rgba(90, 46, 22, 0.18);
}

.place-btn:hover {
    transform: translateY(-1px);
}

.note {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.status-msg {
    min-height: 20px;
    margin: 0;
    color: #1d7a3d;
    font-size: 13px;
    font-weight: 700;
}

.empty {
    border: 1px dashed #d8bea9;
    background: #fff8f1;
    border-radius: 16px;
    padding: 22px;
    color: var(--muted);
    text-align: center;
}

.hidden {
    display: none !important;
}

@media (max-width: 920px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .summary-card {
        position: static;
    }
}

@media (max-width: 720px) {
    .container {
        width: min(100%, calc(100vw - 24px));
        padding: 20px 0 34px;
    }

    .bill-card,
    .summary-card {
        padding: 16px;
        border-radius: 18px;
    }

    .item-row {
        grid-template-columns: 82px minmax(0, 1fr);
        align-items: start;
    }

    .actions {
        grid-column: 1 / -1;
        justify-items: stretch;
        min-width: 0;
        width: 100%;
    }

    .item-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .item-total {
        justify-self: start;
    }

    .actions button {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 520px) {
    .item-row {
        grid-template-columns: 1fr;
    }

    .thumb {
        width: 100%;
        height: 180px;
    }

    .item-total {
        font-size: 15px;
    }

    .head,
    .summary-head,
    .row {
        flex-direction: column;
        align-items: flex-start;
    }

    .row strong {
        white-space: normal;
    }
}

body.modal-open {
    overflow: hidden;
}

.delivery-modal {
    position: fixed;
    inset: 0;
    background: rgba(20, 18, 16, 0.48);
    display: grid;
    place-items: center;
    padding: 18px;
    z-index: 1200;
}

.delivery-modal-card {
    width: min(420px, 100%);
    background: linear-gradient(180deg, #fffdf9 0%, #fff6ee 100%);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 22px 48px rgba(31, 91, 84, 0.22);
    padding: 20px 18px;
    text-align: center;
    display: grid;
    gap: 12px;
}

.delivery-modal-card h3 {
    margin: 0;
    color: var(--brand-700);
    font-family: "Fraunces", serif;
    font-size: 24px;
}

.delivery-modal-card p {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

.delivery-modal-actions {
    display: flex;
    justify-content: center;
}

.delivery-modal-btn {
    border: none;
    border-radius: 12px;
    background: var(--brand-700);
    color: #fff;
    font-weight: 800;
    padding: 10px 24px;
    cursor: pointer;
    min-width: 108px;
}
