:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #171717;
  --muted: #62636a;
  --line: #e6e6e8;
  --soft: #f5f5f6;
  --yellow: #ffc928;
  --yellow-strong: #f5b900;
  --burgundy: #7c1326;
  --green: #19aa68;
  --red: #d92d20;
  --radius-sm: 12px;
  --radius-md: 18px;
  --shadow: 0 12px 36px rgba(23, 23, 23, .12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Noto Sans Thai", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
select { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell { width: 100%; max-width: 720px; min-height: 100dvh; margin: 0 auto; padding-top: 46px; background: var(--surface); }
.view { min-height: calc(100dvh - 46px); }

.store-header { display: grid; grid-template-columns: 72px 1fr 48px; gap: 13px; align-items: center; padding: 18px 18px 4px; }
.store-logo { width: 72px; height: 58px; object-fit: contain; }
.store-heading { min-width: 0; }
.store-heading h1 { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; }
.store-status { display: flex; align-items: center; gap: 7px; margin: 5px 0 0; color: var(--green); font-size: 14px; font-weight: 600; }
.store-status span { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.store-status.checking { color: var(--muted); }
.add-button:disabled, .quantity-button:disabled { opacity: .45; cursor: wait; }
.store-status.closed { color: var(--red); }

.icon-button { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 50%; cursor: pointer; }
.icon-button:active { background: var(--soft); transform: scale(.97); }
.icon-button svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.delivery-notice { margin: 2px 18px 14px 103px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.service-mode { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; margin: 10px 18px 8px; padding: 5px; border-radius: 17px; background: var(--soft); }
.mode-button { min-height: 44px; border: 0; border-radius: 13px; background: transparent; font-weight: 700; cursor: pointer; }
.mode-button.selected { background: var(--yellow); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.search-wrap { padding: 6px 18px 4px; }
.search-wrap input { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 15px; padding: 0 16px; background: var(--soft); outline: none; }
.search-wrap input:focus { border-color: var(--yellow-strong); box-shadow: 0 0 0 3px rgba(255,201,40,.25); }

.category-nav { display: flex; gap: 9px; overflow-x: auto; padding: 7px 18px 15px; border-bottom: 1px solid var(--line); scrollbar-width: none; position: sticky; top: 46px; z-index: 4; background: rgba(255,255,255,.97); }
.category-nav::-webkit-scrollbar { display: none; }
.category-button { flex: none; min-height: 42px; border: 0; border-radius: 21px; padding: 0 18px; background: var(--soft); font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.category-button.selected { background: var(--yellow); font-weight: 800; }

.menu-list { padding: 4px 18px 126px; }
.menu-item { display: grid; grid-template-columns: 132px minmax(0,1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); min-height: 164px; }
.menu-photo { width: 132px; height: 132px; border-radius: 16px; overflow: hidden; background: #f0f0f0; align-self: center; }
.menu-photo img { width: 100%; height: 100%; object-fit: contain; background: #f3f3f3; }
.menu-copy { min-width: 0; display: flex; flex-direction: column; }
.menu-copy h2 { margin: 1px 0 3px; font-size: 18px; line-height: 1.35; font-weight: 800; }
.menu-option { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.menu-note { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.menu-price-row { margin-top: auto; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.menu-price { color: var(--burgundy); font-size: 19px; font-weight: 800; }
.add-button, .quantity-button { width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 28px; line-height: 1; }
.add-button { background: var(--yellow); }
.quantity-control { display: flex; align-items: center; gap: 7px; }
.quantity-control strong { min-width: 24px; text-align: center; font-size: 17px; }
.quantity-button { background: var(--soft); font-size: 23px; }
.quantity-button.plus { background: var(--yellow); }
.add-button:active, .quantity-button:active { transform: scale(.94); }

.cart-bar { position: fixed; z-index: 10; left: 50%; bottom: 0; transform: translateX(-50%); width: min(720px,100%); min-height: 88px; padding: 13px 18px calc(13px + var(--safe-bottom)); background: var(--burgundy); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 16px; box-shadow: 0 -8px 24px rgba(42,0,8,.18); }
.cart-summary { display: flex; flex-direction: column; gap: 2px; }
.cart-count { font-size: 13px; opacity: .85; }
.cart-summary strong { font-size: 19px; }
.primary-button { min-width: 154px; height: 54px; border: 0; border-radius: 28px; background: var(--yellow); font-size: 17px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.primary-button svg, .submit-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

.checkout-view { padding-bottom: calc(100px + var(--safe-bottom)); }
.checkout-header { min-height: 76px; display: grid; grid-template-columns: 48px 1fr 62px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 46px; z-index: 8; }
.checkout-header h1 { margin: 0; text-align: center; font-size: 21px; font-weight: 800; }
.checkout-logo { width: 62px; height: 48px; object-fit: contain; }
.checkout-content { padding: 0 18px 28px; }
.checkout-content section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.checkout-content section:last-of-type { border-bottom: 0; }
.checkout-content h2 { margin: 0 0 15px; font-size: 19px; line-height: 1.35; font-weight: 800; }
.checkout-content h2 span { color: var(--muted); font-weight: 500; }
.checkout-item { display: grid; grid-template-columns: 74px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 10px 0; }
.checkout-item img { width: 74px; height: 74px; border-radius: 13px; object-fit: contain; background: var(--soft); }
.checkout-item h3 { margin: 0; font-size: 15px; line-height: 1.35; }
.checkout-item p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.checkout-item .item-price { color: var(--burgundy); font-weight: 800; margin-top: 5px; }
.checkout-item .handling-label { color: var(--green); font-size: 12px; font-weight: 700; }
.item-handling { display: flex; gap: 5px; margin-top: 7px; }
.item-handling button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 15px; background: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.item-handling button.selected { border-color: var(--green); background: #e9f8f1; color: #087748; }
.checkout-item .quantity-control { gap: 3px; }
.checkout-item .quantity-button { width: 38px; height: 38px; }
.subtotal-row { display: flex; justify-content: space-between; padding-top: 15px; margin-top: 8px; border-top: 1px solid var(--line); font-size: 16px; }
.subtotal-row strong { color: var(--burgundy); font-size: 19px; }

.slot-list { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.field-label { display: block; margin: -2px 0 7px; font-size: 13px; font-weight: 700; }
.date-select { width: 100%; height: 48px; margin-bottom: 12px; padding: 0 13px; border: 1px solid #d4d5d8; border-radius: var(--radius-sm); background: #fff; color: var(--text); }
.section-hint { margin: -9px 0 12px; color: var(--muted); font-size: 13px; }
.handling-options { display: grid; gap: 8px; }
.table-choice-list { display:grid; grid-template-columns:repeat(4,1fr); gap:9px; }
.table-choice { min-height:52px; border:1px solid #d4d5d8; border-radius:13px; background:#fff; font-weight:800; font-size:16px; }
.table-choice.selected { border-color:var(--yellow-strong); background:#fff4d0; box-shadow:0 0 0 2px rgba(255,201,40,.18); }
.handling-button { min-height: 46px; padding: 9px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; text-align: left; font-weight: 700; cursor: pointer; }
.handling-button.selected { border-color: var(--yellow-strong); background: #fff8df; box-shadow: 0 0 0 2px rgba(255,201,40,.2); }
.handling-helper { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.slot-button { flex: none; min-height: 48px; border: 1px solid transparent; border-radius: 25px; padding: 0 17px; background: var(--soft); font-size: 14px; font-weight: 600; cursor: pointer; }
.slot-button.selected { background: var(--yellow); border-color: var(--yellow-strong); font-weight: 800; }
.slot-button:disabled { color: #999; opacity: .7; }
.no-slot { margin: 0; padding: 14px; border-radius: var(--radius-sm); background: #fff3f2; color: #8b1b13; font-size: 14px; }

.field { margin: 0 0 17px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 700; }
.field label em { color: var(--red); font-style: normal; }
.field label span { color: var(--muted); font-weight: 400; }
.field input, .field textarea { width: 100%; border: 1px solid #d4d5d8; border-radius: var(--radius-sm); padding: 13px 14px; background: #fff; outline: none; font-size: 16px; color: var(--text); }
.field input { height: 50px; }
.field textarea { resize: vertical; min-height: 92px; }
.field input:focus, .field textarea:focus { border-color: var(--yellow-strong); box-shadow: 0 0 0 3px rgba(255,201,40,.22); }
.field.invalid input, .field.invalid textarea { border-color: var(--red); }
.field-error { margin: 6px 0 0; color: var(--red); font-size: 12px; line-height: 1.45; }

.location-actions { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 9px; }
.location-button { width: 100%; min-height: 58px; display: grid; grid-template-columns: 30px minmax(0,1fr) 20px; gap: 8px; align-items: center; border: 1.5px solid var(--green); border-radius: var(--radius-sm); padding: 8px 11px; background: #fff; color: var(--text); text-align: left; font-weight: 700; cursor: pointer; }
.location-button svg { width: 28px; height: 28px; fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.location-button .chevron { width: 21px; stroke: var(--text); }
.location-button.loading { opacity: .65; pointer-events: none; }
.map-picker-button { min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid #cfd1d4; border-radius: var(--radius-sm); padding: 5px; background: var(--soft); font-size: 11px; font-weight: 700; line-height: 1.2; cursor: pointer; }
.map-picker-button svg { width: 23px; height: 23px; fill: none; stroke: var(--green); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.map-picker-button:active { transform: scale(.97); background: #e9f7f1; }
.location-status { margin: 9px 0 0; font-size: 13px; font-weight: 600; line-height: 1.45; }
.location-status.success { color: var(--green); }
.location-status.error { color: var(--red); }

.map-modal { position: fixed; z-index: 50; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding-top: 28px; background: rgba(0,0,0,.46); }
.map-sheet { width: min(720px, 100%); max-height: calc(100dvh - 28px); overflow-y: auto; padding: 18px 18px calc(18px + var(--safe-bottom)); border-radius: 22px 22px 0 0; background: #fff; box-shadow: 0 -12px 36px rgba(0,0,0,.2); }
.map-sheet-header { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 12px; align-items: start; margin-bottom: 13px; }
.map-sheet-header h2 { margin: 0; font-size: 21px; }
.map-sheet-header p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.map-close-button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--soft); font-size: 29px; line-height: 1; cursor: pointer; }
.delivery-map { width: 100%; height: min(50dvh, 410px); min-height: 280px; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: var(--soft); }
.map-distance-status { min-height: 42px; margin: 10px 2px; font-size: 13px; font-weight: 700; line-height: 1.45; }
.map-distance-status.success { color: var(--green); }
.map-distance-status.error { color: var(--red); }
body.map-open { overflow: hidden; }
.leaflet-control-attribution { font-size: 9px; }

.totals { display: grid; gap: 10px; }
.totals > div { display: flex; justify-content: space-between; gap: 20px; color: #393a40; }
.totals .grand-total { padding-top: 12px; border-top: 1px solid var(--line); color: var(--text); font-size: 21px; }
.grand-total strong:last-child { color: var(--burgundy); font-size: 24px; }
.policy-check { display: grid; grid-template-columns: 25px 1fr; gap: 10px; align-items: start; margin-top: 22px; cursor: pointer; color: #45464c; font-size: 13px; line-height: 1.5; }
.policy-check input { position: absolute; opacity: 0; }
.checkmark { width: 25px; height: 25px; border: 2px solid #c8c9cd; border-radius: 7px; display: grid; place-items: center; }
.policy-check input:checked + .checkmark { background: var(--yellow); border-color: var(--yellow); }
.policy-check input:checked + .checkmark::after { content: ""; width: 10px; height: 6px; border-left: 2px solid #111; border-bottom: 2px solid #111; transform: rotate(-45deg) translateY(-1px); }
.checkout-action { position: fixed; z-index: 9; left: 50%; bottom: 0; transform: translateX(-50%); width: min(720px,100%); padding: 12px 18px calc(12px + var(--safe-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); }
.submit-button { width: 100%; min-height: 58px; border: 0; border-radius: 29px; background: var(--yellow); color: #111; font-size: 18px; font-weight: 800; display: flex; justify-content: center; align-items: center; gap: 8px; cursor: pointer; }
.submit-button:disabled { background: #d7d7d9; color: #777; cursor: not-allowed; }

.center-state { min-height: 100dvh; padding: 40px 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.center-state h1 { margin: 20px 0 8px; font-size: 25px; }
.center-state p { margin: 0; max-width: 390px; color: var(--muted); line-height: 1.65; }
.secondary-button { min-height: 48px; margin-top: 22px; padding: 0 22px; border: 1px solid #c9cace; border-radius: 24px; background: #fff; font-weight: 700; cursor: pointer; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--soft); border-top-color: var(--yellow-strong); border-radius: 50%; animation: spin .8s linear infinite; }
.success-icon { width: 76px; height: 76px; border-radius: 50%; background: #e9f8f1; color: var(--green); display: grid; place-items: center; }
.success-icon svg { width: 42px; height: 42px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.success-state .submit-button { max-width: 360px; margin-top: 28px; }
.closed-logo { width: 130px; max-height: 110px; object-fit: contain; }
.empty-state { padding: 70px 24px; text-align: center; }
.empty-state h2 { margin: 0 0 6px; }
.empty-state p { color: var(--muted); }
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(104px + var(--safe-bottom)); transform: translateX(-50%); width: calc(100% - 36px); max-width: 520px; padding: 13px 16px; border-radius: var(--radius-sm); background: #222; color: #fff; text-align: center; font-size: 13px; box-shadow: var(--shadow); }

@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 620px) {
  .app-shell { box-shadow: 0 0 0 1px var(--line), 0 20px 80px rgba(0,0,0,.08); }
  .store-header { padding-left: 26px; padding-right: 26px; }
  .delivery-notice { margin-left: 111px; }
  .menu-list, .checkout-content { padding-left: 26px; padding-right: 26px; }
  .menu-item { grid-template-columns: 164px minmax(0,1fr); }
  .menu-photo { width: 164px; height: 146px; }
}
@media (max-width: 380px) {
  .location-actions { grid-template-columns: minmax(0, 1fr) 84px; gap: 7px; }
  .location-button { padding-left: 9px; padding-right: 8px; font-size: 14px; }
  .map-picker-button { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
.language-switcher{position:fixed;z-index:1200;top:0;left:0;right:0;height:46px;display:flex;align-items:center;justify-content:flex-end;gap:2px;padding:5px max(12px,env(safe-area-inset-right)) 5px 12px;background:rgba(255,255,255,.97);border-bottom:1px solid #e4e4e7;box-shadow:0 2px 10px rgba(0,0,0,.06)}
.language-switcher button{min-width:42px;min-height:32px;padding:4px 9px;border:0;border-radius:999px;background:transparent;color:#62636a;font:700 12px/1.2 inherit}
.language-switcher button.selected{background:#7c1326;color:#fff}
.language-switcher button:focus-visible{outline:3px solid rgba(255,201,40,.75);outline-offset:1px}

.menu-options-dialog{width:min(520px,calc(100vw - 24px));max-height:90dvh;border:0;border-radius:18px;padding:20px;color:#171717;box-sizing:border-box;overflow:auto}.menu-options-dialog::backdrop{background:#0008}.menu-options-dialog header,.menu-options-dialog footer{display:flex;align-items:center;justify-content:space-between;gap:12px}.menu-options-dialog h2{margin:0;font-size:22px}.menu-options-dialog fieldset{border:1px solid #ddd;border-radius:12px;margin:16px 0;padding:12px}.menu-options-dialog legend{font-weight:700}.menu-options-dialog label{display:flex;align-items:center;gap:10px;min-height:48px}.menu-options-dialog label span{flex:1}.menu-options-dialog button{min-height:44px;border:0;border-radius:10px;padding:10px 16px;font:inherit}.menu-options-dialog [data-save]{background:#7c1326;color:white}.menu-options-dialog [data-save]:disabled{opacity:.45}.menu-options-dialog [data-error],.cart-item-error{color:#a1142d}.menu-options-dialog input{width:22px;height:22px;accent-color:#7c1326}.menu-photo[role=button],.menu-copy h2[role=button]{cursor:pointer}
/* Checkout benefits: keep independent of the flex rows used for totals. */
.totals > .order-benefits { display:block; margin:8px 0; padding:18px; border:1px solid #e7ddd2; border-radius:20px; background:linear-gradient(145deg,#fffdf8,#fff); box-shadow:0 4px 18px rgba(64,28,20,.04); color:var(--text); }
.order-benefits .benefits-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:16px; }
.order-benefits h3 { margin:0; font-size:17px; font-weight:700; color:var(--burgundy); }
.order-benefits button { min-height:46px; border-radius:12px; padding:10px 14px; font:600 15px/1.4 "Noto Sans Thai",system-ui,sans-serif; cursor:pointer; white-space:nowrap; }
.order-benefits .benefits-refresh { min-height:44px; padding:8px 12px; border:1px solid #d8c8b4; background:#fffaf0; color:var(--burgundy); }
.order-benefits .benefits-section { padding:16px 0 0; border-top:1px solid #ede5db; }
.order-benefits .benefits-section + .benefits-section { margin-top:18px; }
.order-benefits .benefits-label { display:block; margin:0 0 8px; font-size:14px; font-weight:600; }
.order-benefits .benefits-action-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:stretch; }
.order-benefits select, .order-benefits input { display:block; width:100%; min-width:0; height:48px; padding:10px 12px; border:1px solid #d9d4ce; border-radius:12px; background:#fff; color:var(--text); font:400 16px/1.4 "Noto Sans Thai",system-ui,sans-serif; }
.order-benefits select { padding-right:28px; text-overflow:ellipsis; }
.order-benefits input::placeholder { color:#8a8580; }
.order-benefits .benefits-apply { min-width:106px; border:1px solid var(--burgundy); background:var(--burgundy); color:#fff; box-shadow:0 2px 5px rgba(124,19,38,.10); }
.order-benefits button:disabled { opacity:.5; cursor:wait; }
.order-benefits :is(button,select,input):focus-visible { outline:3px solid #c5a766; outline-offset:3px; }
.order-benefits .benefits-points-balance { display:flex; align-items:baseline; justify-content:space-between; gap:12px; font-size:14px; }
.order-benefits .benefits-points-balance strong { font-size:26px; line-height:1.3; color:var(--burgundy); font-variant-numeric:tabular-nums; }
.order-benefits p { margin:0; font-size:13px; line-height:1.6; overflow-wrap:anywhere; }
.order-benefits .benefits-rate { margin:4px 0 14px; color:var(--muted); }
.order-benefits .benefits-note { margin-top:12px; color:var(--muted); }
.order-benefits #couponMessage:not(:empty) { margin-top:14px; padding-top:12px; border-top:1px solid #ede5db; color:var(--burgundy); }
.order-benefits #couponMessage:empty { display:none; }
#couponSummary { color:var(--burgundy); padding:10px 0; font-weight:600; }
@media(max-width:380px) {
 .totals > .order-benefits { padding:14px; }
 .order-benefits .benefits-header { gap:8px; }
 .order-benefits h3 { font-size:16px; }
 .order-benefits .benefits-refresh { padding-inline:9px; font-size:13px; }
 .order-benefits .benefits-action-row { gap:8px; }
 .order-benefits .benefits-apply { min-width:90px; padding-inline:10px; font-size:14px; }
}
