:root {
  --bg: #eef1f4; --surface: #ffffff; --ink: #0f141a; --muted: #5b6572; --faint: #98a2ae;
  --line: #e7ebef; --line2: #d8dee4;
  --accent: #2563eb; --accent-strong: #1d4fd7; --accent-ink: #fff; --accent-soft: #e9f0fe;
  --ok: #15794a; --ok-soft: #e7f4ec; --danger: #cf3f3d; --danger-soft: #fdecec;
  --radius: 18px; --radius-sm: 12px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; padding-bottom: 90px; }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 620px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 20px; letter-spacing: -0.02em; margin: 0 0 4px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; height: 58px; }
.brand { font-weight: 800; font-size: 19px; letter-spacing: -0.02em; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 0; margin-right: auto; }
.brand span { color: var(--accent); }
.bar-actions { display: flex; gap: 8px; }
.iconbtn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; position: relative; }
.iconbtn .badge { position: absolute; top: -6px; right: -6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px; }
.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 18px; height: 18px; }
.subbar { background: var(--accent-soft); color: var(--accent-strong); font-size: 12.5px; font-weight: 600; }
.subbar .wrap { padding-top: 8px; padding-bottom: 8px; text-align: center; }

#app { padding-top: 18px; }
.screen { display: none; }
.screen.on { display: block; animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.back { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 0; margin-bottom: 8px; }
.back:hover { color: var(--ink); }

.hero { margin-bottom: 16px; }
.eyebrow { text-transform: uppercase; letter-spacing: .09em; font-size: 11px; font-weight: 800; color: var(--faint); }
.hero h1 { margin: 2px 0 4px; }
.hero p { color: var(--muted); margin: 0; }

/* Products */
.products { display: flex; flex-direction: column; gap: 10px; }
.prod { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.thumb { width: 52px; height: 52px; border-radius: 13px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; overflow: hidden; }
.thumb.has-img { background: var(--surface); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.p-main { flex: 1; min-width: 0; }
.p-name { font-weight: 700; }
.p-unit { color: var(--muted); font-size: 12.5px; }
.p-price { font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 1px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line2); border-radius: 11px; overflow: hidden; flex: none; }
.stepper button { width: 36px; height: 38px; border: 0; background: none; font-size: 18px; font-weight: 600; color: var(--ink); cursor: pointer; }
.stepper button:active { background: var(--accent-soft); }
.stepper .n { min-width: 26px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.stepper .qin { width: 48px; height: 38px; border: 0; text-align: center; font: inherit; font-weight: 800; color: var(--ink); background: none; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.stepper .qin::-webkit-outer-spin-button, .stepper .qin::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .qin:focus { outline: none; background: var(--accent-soft); }
.addbtn { flex: none; border: 0; border-radius: 11px; background: var(--accent); color: #fff; font: inherit; font-weight: 700; padding: 9px 16px; cursor: pointer; }
.loading { color: var(--muted); text-align: center; padding: 30px 0; }

/* Cards / panels */
.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel { max-width: 460px; margin: 4px auto; }
.card { margin-bottom: 12px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.muted.center { text-align: center; margin-top: 14px; }
.note { font-size: 12.5px; color: var(--muted); background: var(--accent-soft); border-radius: 11px; padding: 10px 12px; margin: 4px 0 14px; }
.err { color: var(--danger); background: var(--danger-soft); border-radius: 10px; padding: 9px 12px; font-size: 13.5px; margin: 0 0 12px; }

/* Buttons */
.btn { font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 13px; background: var(--accent); color: #fff; padding: 14px; width: 100%; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line2); }
.btn.sm { width: auto; padding: 11px 20px; }
.row-btns { display: flex; gap: 10px; margin-top: 8px; }
.row-btns .btn { width: auto; flex: 1; }

/* Forms */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line2); border-radius: 11px; padding: 11px 12px; }
.field textarea { min-height: 56px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Order summary lines */
.li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .l-s { color: var(--muted); font-size: 12.5px; }
.li .l-a { font-weight: 700; font-variant-numeric: tabular-nums; }
.li .rm { background: none; border: 0; color: var(--faint); font-size: 12px; cursor: pointer; padding: 0; margin-top: 2px; }
.li .rm:hover { color: var(--danger); }
.trow { display: flex; justify-content: space-between; font-size: 14px; margin-top: 4px; }
.trow .m { color: var(--muted); }
.trow.big { font-size: 17px; font-weight: 800; margin-top: 8px; }
.free { color: var(--ok); font-weight: 700; }
.acct { font-size: 13px; color: var(--muted); background: var(--accent-soft); border-radius: 11px; padding: 10px 12px; margin: 12px 0; }
.acct a { font-weight: 700; }
.pay { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; margin: 4px 0 12px; }
.pay .tag { margin-left: auto; font-size: 11px; }

/* Account */
.store-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.store-row:first-child { border-top: 0; }
.store-row .av { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.store-row .s-main { flex: 1; }
.store-row .s-name { font-weight: 700; }
.store-row .s-sub { color: var(--muted); font-size: 12.5px; }
.owe { color: var(--danger); font-weight: 800; font-variant-numeric: tabular-nums; }
.settled { color: var(--ok); font-weight: 700; font-size: 13px; }
.pill { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.pill.new { background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.grey { background: #eef0f3; color: var(--muted); }
.sec-label { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 800; color: var(--faint); margin: 18px 0 8px; }

/* Confirm */
.done { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 4px auto 12px; }
.ref { display: inline-flex; flex-direction: column; gap: 2px; border: 1px dashed var(--line2); border-radius: 12px; padding: 10px 22px; margin: 8px 0 18px; }
.ref .rl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.ref .rc { font-size: 22px; font-weight: 800; letter-spacing: .04em; }
.steps { list-style: none; padding: 0; margin: 0 0 18px; text-align: left; }
.steps li { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.steps li:not(:last-child)::before { content: ""; position: absolute; left: 8px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.steps .bead { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line2); background: var(--surface); flex: none; z-index: 1; margin-top: 2px; }
.steps li.done .bead { background: var(--ok); border-color: var(--ok); }
.steps li.now .bead { background: var(--accent); border-color: var(--accent); }
.steps .st { font-weight: 700; font-size: 14px; }
.steps li.todo .st { color: var(--muted); font-weight: 500; }
.steps .sd { color: var(--muted); font-size: 12.5px; }

/* Cart bar */
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--line2); }
.cartbar-in { display: flex; align-items: center; gap: 14px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.cartbar .ct { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.cartbar .cc { color: var(--muted); font-size: 12px; }
.cartbar .btn { margin-left: auto; }

/* Toast */
.toast { position: fixed; left: 16px; right: 16px; bottom: 92px; margin: 0 auto; max-width: 588px; background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 15px; font-weight: 600; font-size: 14px; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; pointer-events: none; z-index: 40; text-align: center; }
.toast.show { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
