/* Wonder 254 customer app (light, food-first). Brand colours come from /api/brand.php (set on :root). */
:root {
  --brand: #C8102E;
  --brand-dark: #8E0B20;
  --brand-soft: #FDECEF;
  --bg: #F7F5F2;
  --surface: #FFFFFF;
  --surface-2: #F1EEEA;
  --text: #1F1A17;
  --muted: #6F665F;
  --border: #E6E0D9;
  --ok: #1E9E5A;
  --warn: #B26A00;
  --warn-bg: #FFF4E0;
  --bad: #C62828;
  --radius: 16px;
  --radius-sm: 10px;
  --font-head: "Outfit", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font-body); padding-bottom: 96px; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; line-height: 1.15; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { border-radius: 10px; flex: none; }
.brand-txt { min-width: 0; }
.brand-name { font: 800 18px var(--font-head); }
.where { border: 0; background: none; padding: 0; color: var(--brand); font-weight: 600; font-size: 13px; max-width: 62vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; text-align: left; }
.track-link { color: var(--text); font-weight: 600; font-size: 13px; text-decoration: none; padding: 8px 12px; border: 1px solid var(--border); border-radius: 99px; white-space: nowrap; }

.side-tabs { position: sticky; top: 59px; z-index: 19; display: flex; gap: 8px; padding: 10px 14px; background: var(--bg); }
.side-tabs button { flex: 1; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 10px; font-weight: 700; }
.side-tabs button.on { background: var(--text); color: #fff; border-color: var(--text); }
.side-tabs .closed-dot { font-weight: 500; font-size: 12px; opacity: .75; }

.view { padding: 4px 14px 20px; max-width: 760px; margin: 0 auto; }
.powered { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 0 20px; }

/* ---------- welcome ---------- */
.hero { margin: 14px 0; padding: 22px 18px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); box-shadow: var(--shadow); }
.hero h1 { font-size: 28px; }
.hero p { margin: 6px 0 0; opacity: .9; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.choice button { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 18px 12px; text-align: left; box-shadow: var(--shadow); }
.choice b { display: block; font: 700 17px var(--font-head); margin-top: 6px; }
.choice .ico { font-size: 26px; }
.site-card { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.site-card .st { font-size: 13px; margin-top: 2px; }

/* ---------- status banners ---------- */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); margin: 10px 0; font-size: 14px; }
.banner.warn { background: var(--warn-bg); color: #5b3a00; }
.banner.info { background: var(--surface-2); }
.banner.bad { background: #FDECEC; color: #7a1414; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: 1px; }
.dot.on { background: var(--ok); } .dot.off { background: var(--bad); }

/* ---------- food menu ---------- */
.cats { position: sticky; top: 117px; z-index: 18; display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; margin: 0 -14px; padding-left: 14px; padding-right: 14px;
  background: var(--bg); scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats button { flex: none; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 7px 13px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.cats button.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.cat-title { font: 700 19px var(--font-head); margin: 18px 0 2px; scroll-margin-top: 170px; }
.cat-desc { margin: 0 0 8px; font-size: 13px; }
.item { display: flex; gap: 12px; width: 100%; text-align: left; border: 0; background: var(--surface); border-radius: var(--radius); padding: 12px; margin: 8px 0; box-shadow: var(--shadow); align-items: stretch; }
.item .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item .nm { font-weight: 700; font-size: 15.5px; }
.item .ds { color: var(--muted); font-size: 13px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .pr { margin-top: auto; padding-top: 6px; font-weight: 700; }
.item .ph { width: 88px; height: 88px; border-radius: 12px; flex: none; background: var(--surface-2) center/cover no-repeat; display: grid; place-items: center; font-size: 30px; position: relative; }
.item .add { position: absolute; right: -4px; bottom: -4px; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 700; box-shadow: var(--shadow); }
.item.sold { opacity: .55; }
.item .in-cart { color: var(--brand); font-weight: 700; font-size: 12px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin-right: 4px; background: var(--surface-2); color: var(--muted); text-transform: capitalize; }
.tag.popular { background: var(--brand-soft); color: var(--brand); }

/* ---------- drinks ---------- */
.search { position: relative; margin: 6px 0 10px; }
.search input { width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 13px 16px 13px 42px; font-size: 16px; }
.search::before { content: '🔍'; position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .6; }
.section-title { font: 700 13px var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 6px; }
.drink { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; margin: 6px 0; box-shadow: var(--shadow); }
.drink .nm { flex: 1; min-width: 0; font-weight: 600; }
.drink .pr { font-weight: 700; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 8px 12px; font-weight: 600; font-size: 13px; }
.chip .p { color: var(--muted); font-weight: 500; margin-left: 4px; }

/* qty stepper */
.step { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); flex: none; }
.step button { width: 34px; height: 34px; border: 0; background: none; font-size: 18px; font-weight: 700; color: var(--brand); }
.step span { min-width: 22px; text-align: center; font-weight: 700; }
.plus { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 20px; font-weight: 700; flex: none; }

/* ---------- buttons, fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 700; min-height: 48px; text-decoration: none; }
.btn.big { width: 100%; font-size: 16px; min-height: 54px; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:disabled { opacity: .5; }
.btn.soft { background: var(--surface-2); color: var(--text); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.ok { background: var(--ok); color: #fff; }
.link-btn { border: 0; background: none; color: var(--brand); font-weight: 600; padding: 6px 0; }
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field input, .field textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 13px; background: var(--surface); font-size: 16px; }
.field textarea { min-height: 70px; resize: vertical; }
.field.invalid input { border-color: var(--bad); }
.err { color: var(--bad); font-size: 14px; min-height: 0; margin: 6px 0; }
.err:empty { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 10px 0; background: var(--surface); }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--brand); flex: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: 12px; font-weight: 600; text-align: left; }
.seg button small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.seg button.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }

/* ---------- cart bar ---------- */
.cart-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
  width: min(732px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px; border: 0; border-radius: 16px; padding: 14px 16px;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 16px; box-shadow: 0 8px 24px rgba(200,16,46,.35); }
.cart-bar .cnt { background: rgba(255,255,255,.22); border-radius: 8px; padding: 2px 9px; }
.cart-bar .lbl { flex: 1; text-align: left; }

/* ---------- sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20,15,12,.45); z-index: 40; }
.sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 41; width: min(760px, 100%); max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.18); }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 4px auto 12px; }
.sheet h2 { font-size: 21px; }
.sheet .x { position: absolute; right: 12px; top: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 18px; }
.sheet-foot { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: var(--surface); padding: 12px 0 calc(18px + env(safe-area-inset-bottom)); margin: 12px 0 calc(-18px - env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }

/* item sheet */
.it-photo { height: 180px; margin: 0 -18px 12px; background: var(--surface-2) center/cover no-repeat; display: grid; place-items: center; font-size: 60px; }
.opt-group { margin: 16px 0 6px; }
.opt-group h3 { font: 700 15px var(--font-body); display: flex; justify-content: space-between; align-items: baseline; }
.opt-group .req { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.opt-group .req.need { background: var(--brand-soft); color: var(--brand); }
.opt-group.missing .req { background: var(--bad); color: #fff; }
.opt { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
.opt input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.opt .on { flex: 1; }
.opt .op { color: var(--muted); font-size: 14px; }

/* cart */
.cart-sec { margin: 12px 0; }
.cart-sec h3 { font: 700 16px var(--font-head); display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.line { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.line .txt { flex: 1; min-width: 0; }
.line .nm { font-weight: 600; }
.line .op { color: var(--muted); font-size: 13px; }
.line .pr { font-weight: 700; white-space: nowrap; }
.totals { margin: 12px 0; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font: 800 18px var(--font-head); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }

/* location */
.results { list-style: none; margin: 8px 0; padding: 0; }
.results li button { width: 100%; text-align: left; border: 0; background: none; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.results li small { display: block; color: var(--muted); }

/* tracking */
.track-head { text-align: center; margin: 18px 0 10px; }
.track-head .code { font: 800 30px var(--font-head); letter-spacing: .04em; }
.track-head .big { font: 700 20px var(--font-head); margin-top: 6px; }
.part { background: var(--surface); border-radius: var(--radius); padding: 14px; margin: 10px 0; box-shadow: var(--shadow); }
.part .ph { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: #E3F6EC; color: var(--ok); }
.pill.wait { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: #FDECEC; color: var(--bad); }
.steps { display: flex; gap: 4px; margin: 12px 0 4px; }
.steps i { flex: 1; height: 5px; border-radius: 4px; background: var(--surface-2); }
.steps i.done { background: var(--ok); }
.steps i.now { background: var(--warn); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.order-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: var(--surface); border-radius: var(--radius-sm); padding: 12px 14px; margin: 8px 0; box-shadow: var(--shadow); }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); opacity: 0; transition: .2s; z-index: 60;
  background: #1F1A17; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

/* deals + new (Today at Wonder 254) */
.tag.new { background: #1f7a3f; color: #fff; }
.tag.deal { background: #fff1c2; color: #7a4b00; text-transform: none; }
s.was { color: var(--muted); font-weight: 500; font-size: .86em; margin-left: 4px; }
.deals-title { font: 700 15px var(--font-head, inherit); margin: 4px 0 8px; }
.deals { display: flex; gap: 10px; overflow-x: auto; margin: 0 -14px 14px; padding: 2px 14px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.deals::-webkit-scrollbar { display: none; }
.dl { flex: none; width: 260px; display: flex; gap: 10px; align-items: stretch; text-align: left; border: 0; border-radius: var(--radius); padding: 10px;
  background: linear-gradient(135deg, #fff8e6, #ffffff 70%); box-shadow: var(--shadow); scroll-snap-align: start; color: inherit; font: inherit; }
.dl.later { opacity: .7; }
.dl-ph { width: 72px; height: 72px; flex: none; border-radius: 10px; background: var(--surface-2) center/cover no-repeat; display: grid; place-items: center; font-size: 28px; }
.dl-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.dl-txt b { font-size: 15px; line-height: 1.2; }
.dl-badge { align-self: flex-start; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--brand); color: #fff; }
.dl-badge.new { background: #1f7a3f; }
.dl-sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-when { margin-top: auto; font-weight: 700; font-size: 12px; color: #7a4b00; }
.deal-line { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: #fff1c2; color: #5c3900; font-size: 14px; }
.line .op.deal { color: #7a4b00; font-weight: 700; }
.line.free { background: #f0faf3; border-radius: 10px; padding-left: 6px; padding-right: 6px; }
.line.free .pr { color: #1f7a3f; font-weight: 800; }
.qty-free { font-weight: 700; color: var(--muted); padding: 0 8px; }
.totals .saved { color: #1f7a3f; font-weight: 700; }
.powered a { color: inherit; }
