:root {
  color-scheme: light;
  --brand: #d62f2a;
  --brand-dark: #a91f1c;
  --green: #185a35;
  --ink: #211d1a;
  --muted: #756f69;
  --line: #ebe4da;
  --surface: #ffffff;
  --soft: #fff8ee;
  --shadow: 0 16px 40px rgb(65 35 12 / 14%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: #f3eee7;
  color: var(--ink);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app {
  width: min(100%, 560px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: 0 0 56px rgb(72 39 13 / 12%);
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 78px 1fr;
  align-items: center;
  min-height: 92px;
  padding: 10px 14px;
  background: rgb(255 255 255 / 94%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.table-block { min-width: 0; }
.table-block strong { display: block; color: var(--green); font-size: 23px; line-height: 1.1; letter-spacing: -0.5px; }
.table-block span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.brand-logo { width: 66px; height: 66px; justify-self: center; border-radius: 18px; object-fit: cover; box-shadow: 0 8px 22px rgb(207 43 34 / 18%); }
.header-actions { display: flex; align-items: stretch; justify-content: flex-end; gap: 5px; }
.header-button { width: 56px; min-height: 54px; padding: 5px 3px; border: 0; border-radius: 14px; background: #fff; color: #2e2925; font-size: 10px; font-weight: 700; line-height: 1.18; box-shadow: inset 0 0 0 1px var(--line); }
.header-button.danger { color: var(--brand); }

.search-panel { position: sticky; top: 92px; z-index: 18; padding: 12px 14px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 10px 20px rgb(50 30 12 / 8%); }
.search-panel label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 800; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; min-width: 0; height: 44px; padding: 0 13px; border: 1px solid #dcd3c9; border-radius: 12px; outline: none; }
.search-row input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgb(24 90 53 / 12%); }
.search-row button { border: 0; padding: 0 15px; border-radius: 12px; background: #eee9e3; font-weight: 700; }

.categories {
  position: sticky;
  top: 92px;
  z-index: 15;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px;
  background: rgb(255 255 255 / 96%);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.categories::-webkit-scrollbar { display: none; }
.category-button { flex: 0 0 auto; min-height: 42px; padding: 0 17px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 800; box-shadow: 0 2px 5px rgb(40 20 5 / 4%); }
.category-button.active { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgb(214 47 42 / 23%); }

.order-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 14px 0; padding: 13px 14px; border-radius: 15px; background: #edf8f1; border: 1px solid #cfe7d7; color: #174f30; }
.order-status strong { display: block; font-size: 14px; }
.order-status span { display: block; margin-top: 3px; font-size: 12px; }
.order-status.checkout-requested { border-color: #efcf96; background: #fff7e5; color: #74480b; }
.order-status.checkout-closed { border-color: #d8d8d8; background: #f3f3f3; color: #555; }
.order-status-actions { display: grid; flex: 0 0 auto; gap: 5px; }
.history-open-button { flex: 0 0 auto; min-height: 39px; border: 1px solid #afd1bc; border-radius: 10px; padding: 0 11px; background: #fff; color: var(--green); font-size: 11px; font-weight: 850; }
.order-status-actions .history-open-button, .checkout-open-button { min-height: 32px; }
.checkout-open-button { border: 0; border-radius: 9px; padding: 0 10px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 850; }
.menu-shell { padding: 0 14px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 17px 0 10px; border-bottom: 1px solid var(--line); }
.section-heading > div { display: flex; align-items: baseline; gap: 9px; }
.section-heading h1 { margin: 0; font-size: 19px; letter-spacing: -0.3px; }
.section-heading span, .section-heading p { margin: 0; color: var(--muted); font-size: 11px; }

.menu-card { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.menu-image { width: 124px; height: 124px; border-radius: 14px; object-fit: cover; background: var(--soft); }
.menu-content { display: flex; min-width: 0; flex-direction: column; }
.menu-content h2 { margin: 0; font-size: 17px; line-height: 1.2; letter-spacing: -0.2px; }
.menu-description { min-height: 34px; margin: 5px 0 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.portion { align-self: flex-start; padding: 4px 7px; border-radius: 6px; background: #f5f1ec; color: #6d655e; font-size: 10px; font-weight: 700; }
.menu-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; }
.price { color: var(--brand); font-size: 16px; font-weight: 850; white-space: nowrap; }
.price.market { font-size: 13px; }
.quantity { display: grid; grid-template-columns: 34px 34px 34px; align-items: center; height: 38px; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: #fff; }
.quantity button { width: 34px; height: 36px; border: 0; background: #fff; color: #5c554f; font-size: 21px; line-height: 1; }
.quantity button:last-child { background: var(--brand); color: #fff; }
.quantity button:disabled { color: #c8c2bc; cursor: not-allowed; }
.quantity span { text-align: center; font-size: 14px; font-weight: 850; }
.market-button { min-height: 37px; border: 1px solid #e8cdc8; border-radius: 12px; padding: 0 10px; background: #fff4f1; color: var(--brand-dark); font-size: 11px; font-weight: 800; }
.sold-out { opacity: .55; }
.sold-out .price { color: var(--muted); }

.options-panel { grid-column: 1 / -1; padding: 12px; border: 1px solid #dbe8de; border-radius: 14px; background: #f5faf6; }
.options-title { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--green); font-size: 12px; font-weight: 800; }
.required { color: var(--brand); }
.option-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.option-button { min-height: 44px; border: 1px solid #d7ddd8; border-radius: 11px; background: #fff; color: var(--ink); font-weight: 700; }
.option-button.selected { border-color: var(--green); color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.chilli-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; font-weight: 700; }
.toggle-buttons { display: grid; grid-template-columns: 65px 65px; overflow: hidden; border: 1px solid #d7ddd8; border-radius: 10px; }
.toggle-buttons button { height: 36px; border: 0; background: #fff; }
.toggle-buttons button.selected { background: var(--green); color: #fff; }

.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--ink); }

.cart-bar { position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; display: flex; width: min(100%, 560px); min-height: 86px; margin: 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px calc(11px + env(safe-area-inset-bottom)); background: rgb(255 253 249 / 97%); border-top: 1px solid #e2d9cf; box-shadow: 0 -14px 35px rgb(57 33 13 / 12%); backdrop-filter: blur(16px); }
.cart-summary { display: flex; min-width: 0; align-items: center; gap: 9px; }
.cart-count { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border-radius: 11px; background: var(--green); color: #fff; font-weight: 850; }
.cart-summary strong { display: block; font-size: 12px; }
.cart-summary span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.cart-summary b { color: var(--brand); font-size: 15px; }
.primary-button { min-width: 164px; min-height: 52px; border: 0; border-radius: 14px; padding: 0 18px; background: linear-gradient(135deg, #e03a32, #c92320); color: #fff; font-weight: 850; box-shadow: 0 10px 24px rgb(200 35 30 / 22%); }

.cart-dialog { width: min(100%, 560px); max-width: none; margin: auto auto 0; padding: 0; border: 0; border-radius: 24px 24px 0 0; background: transparent; }
.cart-dialog::backdrop { background: rgb(31 21 15 / 48%); backdrop-filter: blur(3px); }
.cart-sheet { max-height: 88dvh; overflow-y: auto; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: #fff; }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 14px; border-radius: 99px; background: #d7d0c9; }
.sheet-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.eyebrow { margin: 0; color: var(--brand); font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.sheet-heading h2 { margin: 4px 0 0; font-size: 24px; }
.close-button { min-height: 38px; border: 0; border-radius: 10px; padding: 0 12px; background: #f2eee9; color: #4d4741; font-weight: 700; }
.cart-lines { margin-top: 17px; border-top: 1px solid var(--line); }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line strong { display: block; font-size: 14px; }
.cart-line span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.cart-line b { color: var(--brand); font-size: 14px; }
.note-field { display: block; margin-top: 16px; color: #3a342f; font-size: 13px; font-weight: 800; }
.note-field textarea { width: 100%; margin-top: 7px; resize: vertical; padding: 12px; border: 1px solid #dcd4cc; border-radius: 12px; outline: none; line-height: 1.45; }
.note-field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgb(24 90 53 / 11%); }
.sheet-total { display: flex; justify-content: space-between; margin-top: 16px; font-size: 15px; }
.sheet-total strong { color: var(--brand); font-size: 22px; }
.submit-button { width: 100%; min-height: 54px; margin-top: 16px; border: 0; border-radius: 14px; background: var(--brand); color: #fff; font-size: 16px; font-weight: 850; }
.submit-button:disabled { background: #c9c3bd; cursor: wait; }
.sheet-footnote { margin: 9px 0 0; text-align: center; color: var(--muted); font-size: 11px; }

.customer-history-dialog { width: min(100%, 560px); max-width: none; margin: auto auto 0; padding: 0; border: 0; border-radius: 24px 24px 0 0; background: transparent; }
.customer-history-dialog::backdrop { background: rgb(31 21 15 / 48%); backdrop-filter: blur(3px); }
.customer-history-sheet { max-height: 90dvh; overflow-y: auto; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: #fff; }
.customer-history-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.customer-history-stat { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffaf4; }
.customer-history-stat span, .customer-history-stat strong { display: block; }
.customer-history-stat span { color: var(--muted); font-size: 10px; font-weight: 750; }
.customer-history-stat strong { margin-top: 5px; color: var(--green); font-size: 19px; }
.customer-history-stat.money strong { color: var(--brand); }
.customer-checkout-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; padding: 13px; border: 1px solid #efd4a3; border-radius: 13px; background: #fff8e9; }
.customer-checkout-box strong, .customer-checkout-box span { display: block; }
.customer-checkout-box strong { color: #6d4308; font-size: 13px; }
.customer-checkout-box span { margin-top: 4px; color: #80663e; font-size: 10px; line-height: 1.4; }
.customer-checkout-box button { flex: 0 0 auto; min-height: 42px; border: 0; border-radius: 10px; padding: 0 12px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 850; }
.customer-checkout-box button:disabled { background: #b9b1a7; }
.customer-checkout-box.requested { border-color: #efd19c; background: #fff4dc; }
.customer-checkout-box.closed { border-color: #cfe2d5; background: #edf8f1; }
.customer-checkout-box.closed strong { color: var(--green); }
.customer-history-orders { margin-top: 14px; }
.customer-history-empty { padding: 28px 20px; border: 1px dashed #d8cec4; border-radius: 14px; background: #fbf8f4; text-align: center; }
.customer-history-empty strong, .customer-history-empty span { display: block; }
.customer-history-empty strong { color: var(--green); font-size: 14px; }
.customer-history-empty span { max-width: 320px; margin: 7px auto 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.customer-order-card { margin-top: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.customer-order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px; background: #f8f6f2; }
.customer-order-head strong, .customer-order-head span { display: block; }
.customer-order-head strong { font-size: 13px; }.customer-order-head span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.customer-order-status { flex: 0 0 auto; padding: 6px 8px; border-radius: 8px; background: #e7f1ea; color: var(--green); font-size: 10px !important; font-weight: 850; }
.customer-order-status.cancelled { background: #f8e8e6; color: #9c2f2a; }
.customer-order-lines { padding: 4px 12px; }
.customer-order-line { display: grid; grid-template-columns: 28px 1fr auto; gap: 7px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.customer-order-line:last-child { border-bottom: 0; }
.customer-order-line > b { color: var(--brand); }.customer-order-line strong { display: block; font-size: 12px; }.customer-order-line span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }.customer-order-line > strong:last-child { font-size: 11px; }
.customer-order-note { margin: 4px 12px 10px; padding: 9px; border-radius: 9px; background: #fff8e9; color: #70501b; font-size: 10px; }
.customer-order-total { display: flex; justify-content: space-between; padding: 10px 12px 12px; border-top: 1px solid var(--line); font-size: 12px; }.customer-order-total strong { color: var(--brand); font-size: 15px; }
.history-privacy { margin: 14px 4px 0; color: var(--muted); text-align: center; font-size: 10px; line-height: 1.45; }

.toast { position: fixed; right: 18px; bottom: 105px; left: 18px; z-index: 80; width: min(calc(100% - 36px), 520px); margin: auto; padding: 13px 15px; border-radius: 13px; background: #1f3d2b; color: #fff; text-align: center; font-size: 13px; font-weight: 750; box-shadow: var(--shadow); }
.toast.error { background: #8d2521; }

.landing { display: grid; width: min(calc(100% - 32px), 520px); min-height: calc(100dvh - 32px); margin: 16px auto; place-content: center; padding: 38px 28px; border-radius: 28px; background: radial-gradient(circle at top, #fff5df 0, #fff 50%); box-shadow: var(--shadow); text-align: center; }
.landing-logo { width: 180px; height: 180px; margin: 0 auto 22px; border-radius: 36px; object-fit: cover; box-shadow: 0 22px 55px rgb(180 48 24 / 18%); }
.landing h1 { max-width: 420px; margin: 8px auto 12px; font-size: clamp(28px, 8vw, 42px); line-height: 1.08; letter-spacing: -1.4px; }
.landing > p:not(.eyebrow) { margin: 0 auto; color: var(--muted); line-height: 1.6; }
.landing-note { margin-top: 24px; padding: 14px; border-radius: 14px; background: #f7f2ec; color: #5e5750; font-size: 12px; line-height: 1.45; }

@media (max-width: 400px) {
  .topbar { grid-template-columns: 1fr 62px 1fr; padding-inline: 10px; }
  .brand-logo { width: 54px; height: 54px; border-radius: 15px; }
  .table-block strong { font-size: 20px; }
  .header-button { width: 49px; font-size: 9px; }
  .menu-card { grid-template-columns: 110px minmax(0, 1fr); gap: 10px; }
  .menu-image { width: 110px; height: 110px; }
  .menu-content h2 { font-size: 16px; }
  .quantity { grid-template-columns: 31px 31px 31px; }
  .quantity button { width: 31px; }
  .primary-button { min-width: 148px; }
}
