:root {
    --paper: #f6f4ef;
    --surface: #ffffff;
    --ink: #20242c;
    --muted: #6f7782;
    --line: #ddd7cc;
    --green: #2d7a5f;
    --green-dark: #1f5d48;
    --coral: #d65f45;
    --gold: #b9842c;
    --blue: #2e5f87;
    --danger: #b42318;
    --success-bg: #e8f6ef;
    --error-bg: #fff0ed;
    --info-bg: #eef5fb;
    --shadow: 0 12px 30px rgba(32, 36, 44, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
    letter-spacing: 0;
}

body {
    margin: 0;
    min-height: 100vh;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px clamp(16px, 4vw, 42px);
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    min-width: max-content;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
    line-height: 1.1;
}

.brand small {
    color: var(--muted);
    font-size: 0.75rem;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

.link-button {
    padding: 0;
    border: 0;
    color: var(--blue);
    background: transparent;
    cursor: pointer;
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 34px auto 64px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.page-heading h1,
.form-heading h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.12;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.content-grid,
.checkout-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 22px;
    align-items: start;
}

.menu-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
}

.account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-grid,
.address-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
    gap: 16px;
}

.product-card,
.address-card,
.panel,
.summary-panel,
.auth-form {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.product-card,
.address-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 190px;
    padding: 18px;
}

.product-card h2,
.address-card h2,
.panel h2,
.summary-panel h2 {
    margin: 0 0 10px;
    font-size: 1.12rem;
    line-height: 1.25;
}

.product-card p,
.address-card p,
.panel p,
.summary-panel p {
    margin: 0 0 10px;
    color: var(--muted);
}

.product-card footer,
.actions,
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.panel,
.summary-panel {
    padding: 20px;
}

.summary-panel {
    position: sticky;
    top: 88px;
}

.auth-shell {
    display: grid;
    place-items: start center;
    padding-top: 16px;
}

.auth-form {
    width: min(560px, 100%);
    padding: 24px;
}

.form-heading {
    margin-bottom: 18px;
}

label {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
}

input:focus,
select:focus {
    outline: 3px solid rgba(46, 95, 135, 0.18);
    border-color: var(--blue);
}

input.is-invalid {
    border-color: var(--danger);
}

.field-error,
.danger {
    color: var(--danger);
}

.form-split,
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.compact-grid {
    gap: 10px;
}

.span-2 {
    grid-column: span 2;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 600;
}

.checkbox-row input {
    width: 18px;
    min-height: 18px;
    margin-top: 2px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid var(--green);
    border-radius: 8px;
    background: var(--green);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
}

.button:hover {
    background: var(--green-dark);
    text-decoration: none;
}

.button.secondary {
    background: #fff;
    color: var(--green);
}

.button.ghost {
    background: #fff;
    border-color: var(--line);
    color: var(--muted);
}

.button.compact {
    min-height: 36px;
    padding: 8px 12px;
}

.button.full {
    width: 100%;
}

.button:disabled {
    border-color: #c8c4bc;
    background: #c8c4bc;
    cursor: not-allowed;
}

.flash {
    width: min(1120px, calc(100% - 32px));
    margin: 18px auto 0;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    font-weight: 700;
}

.flash.success {
    background: var(--success-bg);
    color: var(--green-dark);
}

.flash.error {
    background: var(--error-bg);
    color: var(--danger);
}

.flash.info {
    background: var(--info-bg);
    color: var(--blue);
}

.clean-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.clean-list li,
.summary-row,
.table-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.clean-list li:last-child,
.summary-row:last-child,
.table-row:last-child {
    border-bottom: 0;
}

.summary-row.total {
    font-size: 1.12rem;
    font-weight: 900;
}

.muted {
    color: var(--muted);
}

.empty-state {
    display: grid;
    gap: 14px;
    justify-items: start;
    padding: 34px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.badge,
.selectable-address em {
    display: inline-flex;
    width: fit-content;
    padding: 4px 8px;
    border-radius: 999px;
    background: #fff3d9;
    color: #7a520e;
    font-size: 0.75rem;
    font-style: normal;
    font-weight: 800;
}

.details {
    display: grid;
    gap: 12px;
    margin: 0;
}

.details div {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 14px;
}

.details dt {
    color: var(--muted);
    font-weight: 800;
}

.details dd {
    margin: 0;
}

.table-list {
    display: grid;
}

.table-row > div {
    display: grid;
    gap: 4px;
}

.order-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
}

.table-row span {
    color: var(--muted);
}

.quantity-input {
    max-width: 84px;
}

.checkout-main {
    display: grid;
    gap: 16px;
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.segmented-control label {
    margin: 0;
}

.segmented-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-control span {
    display: grid;
    place-items: center;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-weight: 900;
    text-align: center;
}

.segmented-control input:checked + span {
    border-color: var(--green);
    background: #eaf6f0;
    color: var(--green-dark);
}

.mode-panel {
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.mode-panel h3 {
    margin: 0 0 10px;
}

.address-options {
    display: grid;
    gap: 10px;
}

.selectable-address {
    margin: 0;
}

.selectable-address input {
    position: absolute;
    opacity: 0;
}

.selectable-address > span {
    display: grid;
    gap: 5px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.selectable-address input:checked + span {
    border-color: var(--green);
    box-shadow: inset 0 0 0 2px rgba(45, 122, 95, 0.18);
}

.selectable-address.disabled > span {
    background: #faf8f4;
    color: var(--muted);
}

.selectable-address small {
    color: var(--muted);
}

.form-message {
    min-height: 20px;
    color: var(--muted);
    font-weight: 700;
}

.form-message.error {
    color: var(--danger);
}

.stacked-actions,
.status-form {
    display: grid;
    gap: 12px;
}

.map-picker {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfaf7;
}

.map-picker-header,
.map-picker-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.map-picker-header span,
.map-picker-actions small {
    color: var(--muted);
    font-weight: 700;
}

.map-canvas {
    width: 100%;
    min-height: 280px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ece7dc;
    overflow: hidden;
}

.tracking-canvas {
    min-height: 420px;
}

.tracking-panel {
    margin-top: 22px;
}

.driver-pin,
.store-pin,
.destination-pin {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 2px solid #fff;
    border-radius: 999px;
    color: #fff;
    font-weight: 900;
    box-shadow: 0 6px 18px rgba(32, 36, 44, 0.22);
}

.driver-pin {
    background: var(--coral);
}

.store-pin {
    background: var(--blue);
}

.destination-pin {
    background: var(--green);
}

.form-footer {
    text-align: center;
    color: var(--muted);
}

.is-hidden {
    display: none !important;
}

@media (max-width: 840px) {
    .topbar,
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav {
        justify-content: flex-start;
    }

    .content-grid,
    .checkout-layout,
    .menu-layout,
    .account-grid {
        grid-template-columns: 1fr;
    }

    .summary-panel {
        position: static;
    }
}

@media (max-width: 620px) {
    .page {
        width: min(100% - 24px, 1120px);
        margin-top: 22px;
    }

    .page-heading h1,
    .form-heading h1 {
        font-size: 1.55rem;
    }

    .form-split,
    .form-grid,
    .segmented-control {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

    .product-card,
    .address-card,
    .panel,
    .summary-panel,
    .auth-form {
        padding: 16px;
    }

    .button {
        width: 100%;
        white-space: normal;
    }

    .details div,
    .table-row {
        grid-template-columns: 1fr;
    }

    .table-row {
        display: grid;
        justify-items: stretch;
    }
}
