/* ReadyLah design system: phone-first, photo-led, high contrast for hawker-centre daylight.
   Colours are OKLCH with sRGB hex fallbacks for older phones. See DESIGN.md. */

:root {
  --bg: #ffffff;
  --bg-2: #faf4f3;
  --ink: #1d1714;
  --ink-2: #5d534f;
  --line: #e8e1df;
  --accent: #d24011;
  --accent-press: #b93000;
  --accent-soft: #ffeae1;
  --accent-ink: #b22900;
  --on-accent: #ffffff;
  --ok: #048149;
  --ok-soft: #dcf9e5;
  --ok-ink: #005e31;
  --on-ok: #ffffff;
  --warn: #f2b036;
  --warn-soft: #fff2ce;
  --warn-ink: #7d4a07;
  --danger: #be222a;
  --scrim: rgb(13 9 7 / 0.62);
  --shadow-float: 0 6px 20px rgb(29 23 20 / 0.16), 0 1px 3px rgb(29 23 20 / 0.12);

  --r-sm: 12px;
  --r-md: 18px;
  --r-pill: 999px;
  --tap: 52px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1); /* ease-out-quart */
  --z-sticky: 10;
  --z-bar: 20;
  --z-toast: 60;
  --z-alert: 80;
  color-scheme: light;
}
@supports (color: oklch(0 0 0)) {
  :root {
    --bg: oklch(1 0 0);
    --bg-2: oklch(0.972 0.006 40);
    --ink: oklch(0.21 0.012 40);
    --ink-2: oklch(0.45 0.014 40);
    --line: oklch(0.915 0.008 40);
    --accent: oklch(0.58 0.19 36);
    --accent-press: oklch(0.52 0.18 36);
    --accent-soft: oklch(0.955 0.03 40);
    --accent-ink: oklch(0.5 0.18 36);
    --ok: oklch(0.53 0.13 155);
    --ok-soft: oklch(0.955 0.04 155);
    --ok-ink: oklch(0.42 0.11 155);
    --warn: oklch(0.8 0.15 78);
    --warn-soft: oklch(0.965 0.05 85);
    --warn-ink: oklch(0.46 0.1 65);
    --danger: oklch(0.52 0.19 25);
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0d; --bg-2: #191716; --ink: #f7f2f1; --ink-2: #b7afac; --line: #312d2c;
    --accent: #ea6134; --accent-press: #d24f22; --accent-soft: #3b1d14; --accent-ink: #fb906a; --on-accent: #0d0d0d;
    --ok: #37ab6b; --ok-soft: #0f2e1b; --ok-ink: #7ad59c; --on-ok: #0d0d0d;
    --warn-soft: #372508; --warn-ink: #f4c26a; --danger: #f47b74;
    --shadow-float: 0 6px 20px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent-ink); }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-2); }
.sm { font-size: 15px; }
.xs { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ic { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.s { width: 20px; height: 20px; }
.ic.l { width: 32px; height: 32px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink);
  font-weight: 650; font-size: 17px; text-decoration: none; white-space: nowrap;
  transition: transform 150ms var(--ease), background-color 150ms var(--ease), border-color 150ms var(--ease), opacity 150ms;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; transform: none; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:active { background: var(--accent-press); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #1d1714; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.block { display: flex; width: 100%; }
.btn.lg { min-height: 60px; font-size: 19px; border-radius: var(--r-md); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 15px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--bg-2); color: var(--ink); transition: transform 150ms var(--ease);
}
.icon-btn:active { transform: scale(0.92); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

/* ---------- chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--r-pill); font-size: 14px; font-weight: 650; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok-ink); }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.danger { background: color-mix(in srgb, var(--danger) 12%, var(--bg)); color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- photos ---------- */
.ph { position: relative; overflow: hidden; background: var(--bg-2); border-radius: var(--r-md); }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph.empty { display: grid; place-items: center; color: color-mix(in srgb, var(--ink-2) 55%, var(--bg-2)); }

/* ---------- stall cover (customer page) ---------- */
.cover { position: relative; height: 230px; background: var(--ink); color: #fff; overflow: hidden; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgb(13 9 7 / 0.82) 0%, rgb(13 9 7 / 0.25) 55%, rgb(13 9 7 / 0.1) 100%); }
.cover .inner { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 0 16px 18px; max-width: 560px; margin: 0 auto; }
.cover h1 { font-size: 30px; font-weight: 800; }
.cover .meta { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cover .meta .chip { background: rgb(255 255 255 / 0.18); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cover.plain { height: auto; background: var(--bg); color: var(--ink); padding-top: calc(28px + env(safe-area-inset-top)); }
.cover.plain::after { display: none; }
.cover.plain .inner { position: static; padding-bottom: 8px; }
.cover.plain .meta .chip { background: var(--bg-2); color: var(--ink-2); }
.brand-pill { position: absolute; z-index: 1; top: calc(12px + env(safe-area-inset-top)); left: 16px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: var(--r-pill); background: rgb(255 255 255 / 0.92); color: #1d1714; font-weight: 750; font-size: 14px; text-decoration: none; }
.logo { width: 24px; height: 24px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.logo .ic { width: 16px; height: 16px; stroke-width: 3; }

/* ---------- category tabs ---------- */
.tabs { position: sticky; top: 0; z-index: var(--z-sticky); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.tabs .scroll { display: flex; gap: 4px; overflow-x: auto; padding: 0 12px; scrollbar-width: none; max-width: 560px; margin: 0 auto; }
.tabs .scroll::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 0; background: none; min-height: 50px; padding: 0 12px; font-weight: 650; font-size: 16px; color: var(--ink-2); position: relative; }
.tab[aria-current="true"] { color: var(--ink); }
.tab[aria-current="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }

/* ---------- menu rows ---------- */
.sec-title { font-size: 22px; font-weight: 800; padding: 26px 0 4px; scroll-margin-top: 64px; }
.mrow { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: 0; }
.mrow .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mrow .name { font-weight: 650; font-size: 17px; line-height: 1.25; }
.mrow .alt { font-size: 15px; color: var(--ink-2); margin-top: 2px; }
.mrow .price { font-weight: 750; margin-top: auto; padding-top: 8px; font-variant-numeric: tabular-nums; }
.mrow .pic { position: relative; flex: none; width: 104px; height: 104px; }
.mrow .pic .ph { width: 100%; height: 100%; }
.mrow.off .pic img, .mrow.off .txt { opacity: 0.45; }
.mrow.off .pic .chip { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--ink); color: var(--bg); }
.add {
  position: absolute; right: -6px; bottom: -6px; width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: var(--bg); color: var(--accent-ink); box-shadow: var(--shadow-float);
  display: grid; place-items: center; transition: transform 150ms var(--ease);
}
.add:active { transform: scale(0.9); }
.add.has { background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 18px; }
.stepper { display: inline-flex; align-items: center; gap: 2px; margin-top: 10px; align-self: flex-start; background: var(--bg-2); border-radius: var(--r-pill); }
.stepper button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); display: grid; place-items: center; }
.stepper button:active { background: var(--line); }
.stepper output { min-width: 22px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- floating cart bar ---------- */
.cartbar { position: fixed; z-index: var(--z-bar); left: 0; right: 0; bottom: 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); pointer-events: none; }
.cartbar .btn { pointer-events: auto; max-width: 528px; margin: 0 auto; border-radius: var(--r-pill); min-height: 62px; box-shadow: var(--shadow-float); animation: rise 240ms var(--ease); }
.cartbar .btn.cart { justify-content: space-between; padding: 0 10px; }
.cartbar .count { min-width: 40px; height: 40px; border-radius: 50%; background: rgb(255 255 255 / 0.22); display: grid; place-items: center; font-size: 17px; }
.cartbar .total { padding-right: 10px; font-variant-numeric: tabular-nums; }
.bar-space { height: calc(100px + env(safe-area-inset-bottom)); }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* ---------- sheets ---------- */
dialog.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92dvh; border-radius: 24px 24px 0 0; background: var(--bg); color: var(--ink); box-shadow: 0 -10px 40px rgb(0 0 0 / 0.25); }
dialog.sheet::backdrop { background: rgb(13 9 7 / 0.5); }
dialog.sheet[open] { animation: sheet-up 240ms var(--ease); }
.sheet-head { position: sticky; top: 0; z-index: 1; background: var(--bg); display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; }
.sheet-head h2 { flex: 1; font-size: 22px; font-weight: 800; }
.sheet-body { padding: 0 16px 16px; }
.sheet-foot { position: sticky; bottom: 0; background: var(--bg); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
@keyframes sheet-up { from { transform: translateY(48px); opacity: 0.6; } }

/* ---------- forms ---------- */
.field { display: block; }
.field > span { display: block; font-size: 15px; font-weight: 650; margin-bottom: 6px; }
input[type="text"], input[type="tel"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; min-height: var(--tap); padding: 12px 14px; font-size: 17px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--ink);
  transition: border-color 150ms var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: 1; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; }
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.pin { text-align: center; letter-spacing: 0.5em; font-size: 28px !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--bg-2); border-radius: 16px; }
.seg button, .seg label { min-height: 48px; border: 0; border-radius: 12px; background: transparent; font-weight: 650; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink-2); position: relative; cursor: pointer; }
.seg [aria-pressed="true"], .seg label:has(input:checked) { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; display: inline-block; vertical-align: middle; width: 54px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--line); transition: background-color 180ms var(--ease); pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: transform 180ms var(--ease); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

/* ---------- lists ---------- */
.list { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--bg); }
.list > * + * { border-top: 1px solid var(--line); }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px; }
.thumb { width: 52px; height: 52px; border-radius: 12px; flex: none; }

/* ---------- toast ---------- */
.toast { position: fixed; z-index: var(--z-toast); left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); text-align: center; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 650; font-size: 15px; box-shadow: var(--shadow-float); animation: toast-in 200ms var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- skeleton ---------- */
.skel { background: linear-gradient(90deg, var(--bg-2) 0%, var(--line) 50%, var(--bg-2) 100%); background-size: 200% 100%; animation: skel 1.2s linear infinite; border-radius: var(--r-sm); }
@keyframes skel { to { background-position: -200% 0; } }

/* ---------- order number ---------- */
.ticket-no { font-size: 96px; font-weight: 850; letter-spacing: -0.04em; line-height: 0.95; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
