/* qmen.us — public Mesa page (live order tracking).
   Brand tokens (--color-*, --font-sans, .wm) come from output.css, loaded first. */

:root {
  --text-xs: .75rem; --text-sm: .875rem; --text-base: 1rem; --text-lg: 1.125rem;
  --text-xl: 1.25rem; --text-2xl: 1.5rem; --text-3xl: 1.875rem;
  --radius-field: .25rem; --radius-box: .5rem;
  --radius-btn: var(--radius-field); --radius-card: var(--radius-box);
  --brand-accent: var(--color-primary); --brand-accent-content: var(--color-primary-content);
  --mole-900: oklch(21% 0.03 33); --mole-line: oklch(34% 0.03 33); --cream-soft: oklch(96% 0.012 80);
  --hairline: var(--color-base-300);
  --muted: color-mix(in oklab, var(--color-base-content) 64%, transparent);
  --green: oklch(56% 0.14 155); --blue: oklch(56% 0.15 245); --amber: oklch(68% 0.16 64);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--color-base-200); min-height: 100vh; font-family: var(--font-sans); color: var(--color-base-content); }

.wrap { width: 100%; max-width: 760px; margin-inline: auto; padding-inline: 28px; }
@media (max-width: 560px) { .wrap { padding-inline: 20px; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-family: var(--font-sans);
  font-weight: 600; font-size: var(--text-sm); border-radius: var(--radius-btn); border: 1px solid transparent;
  padding: 0 16px; height: 42px; cursor: pointer; text-decoration: none; line-height: 1;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 2; fill: none; }
.btn-ghost { background: transparent; color: var(--color-base-content); }
.btn-ghost:hover { background: color-mix(in oklab, var(--color-base-content) 8%, transparent); }
.btn-outline { background: transparent; color: var(--brand-accent); border-color: color-mix(in oklab, var(--brand-accent) 40%, var(--hairline)); }
.btn-outline:hover { border-color: var(--brand-accent); background: color-mix(in oklab, var(--brand-accent) 7%, transparent); }
.btn-outline:disabled { opacity: .55; cursor: default; }
.btn-sm { height: 34px; padding: 0 12px; font-size: var(--text-xs); }

/* badges */
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 11px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #fff; white-space: nowrap; }
.badge.lg { height: 28px; padding: 0 14px; font-size: 12px; }
.badge.sm { height: 21px; padding: 0 9px; font-size: 10px; }
.badge.green { background: var(--green); }
.badge.ghost { background: var(--color-neutral); }
.badge.info  { background: var(--blue); }
.badge.amber { background: var(--amber); }
.badge.primary { background: var(--color-primary); }

/* eyebrow + live dot */
.eyebrow { display: inline-flex; align-items: center; gap: 9px; font-size: var(--text-sm); font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--brand-accent); }
.eyebrow .live { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-accent);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--brand-accent) 55%, transparent); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--brand-accent) 55%, transparent); }
  70% { box-shadow: 0 0 0 9px color-mix(in oklab, var(--brand-accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--brand-accent) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .eyebrow .live, .step.current .node::after { animation: none !important; } }

/* top bar */
.topbar { background: var(--color-base-100); border-bottom: 1px solid var(--hairline); position: sticky; top: 0; z-index: 30; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.topbar .wm { font-size: 22px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-right .tag { font-size: var(--text-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 480px) { .topbar-right .tag { display: none; } }

/* desk header */
.dhead { background: var(--color-base-100); border-bottom: 1px solid var(--hairline); }
.dhead-inner { padding-block: 30px 28px; }
.dhead-logo { display: block; width: auto; max-width: 200px; max-height: 46px; object-fit: contain; margin: 0 0 16px; }
.mesa-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mesa-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 17px; border-radius: 999px;
  background: var(--color-base-content); color: var(--cream-soft); font-weight: 800; letter-spacing: -.01em; }
.mesa-chip .n { font-size: var(--text-xl); line-height: 1; }
.mesa-chip .k { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; opacity: .6; line-height: 1; }
.rest-name { font-size: var(--text-lg); font-weight: 700; color: var(--color-base-content); text-decoration: none; }
.dhead h1 { font-size: clamp(1.9rem, 5vw, 2.5rem); font-weight: 800; letter-spacing: -.025em; line-height: 1.05; margin: 18px 0 0; }
.dhead .sub { font-size: var(--text-sm); margin: 8px 0 0; }

/* main + cards */
main { padding: 26px 0 12px; }
.card { background: var(--color-base-100); border: 1px solid var(--hairline); border-radius: var(--radius-card); box-shadow: 0 1px 2px oklch(0% 0 0 / .04); }
.order { overflow: hidden; }
.order + .order { margin-top: 16px; }
.ord-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 0; }
.ord-head h2 { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -.01em; margin: 0; }
.ord-head .waiter { font-size: var(--text-sm); color: var(--muted); margin: 5px 0 0; }
.ord-head .waiter b { color: var(--color-base-content); font-weight: 700; }

/* status banner */
.status-line { padding: 16px 24px 0; }
.status-msg { display: flex; align-items: center; gap: 11px; font-size: var(--text-base); font-weight: 600; color: var(--color-base-content); }
.status-msg .ic { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.status-msg .ic svg { width: 19px; height: 19px; stroke: #fff; stroke-width: 2.1; fill: none; }
.status-msg .eta { font-size: var(--text-xs); font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; margin-top: 2px; }
.status-msg .txt { display: flex; flex-direction: column; line-height: 1.2; }

/* tracker */
.tracker { display: flex; padding: 24px 24px 6px; }
.step { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; }
.step::before { content: ""; position: absolute; top: 19px; right: 50%; left: -50%; height: 3px; background: var(--hairline); z-index: 0; border-radius: 2px; transition: background .4s ease; }
.step:first-child::before { display: none; }
.step .node { position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%; background: var(--color-base-100);
  border: 3px solid var(--hairline); display: flex; align-items: center; justify-content: center; color: var(--muted); transition: all .35s ease; }
.step .node svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 2; fill: none; }
.step .lbl { font-size: var(--text-xs); font-weight: 700; margin-top: 9px; color: var(--muted); transition: color .3s ease; }
.step .lbl small { display: block; font-weight: 500; font-size: 10px; opacity: .7; margin-top: 1px; }
.step.done::before { background: var(--green); }
.step.done .node { background: var(--green); border-color: var(--green); color: #fff; }
.step.done .lbl { color: var(--color-base-content); }
.step.current::before { background: var(--green); }
.step.current .node { border-color: var(--cur); color: var(--cur); background: var(--color-base-100); box-shadow: 0 0 0 5px color-mix(in oklab, var(--cur) 16%, transparent); }
.step.current .lbl { color: var(--cur); }
.step.current .node::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid var(--cur); animation: pin 2s ease-out infinite; }
/* Partial: some items ready while others still cook — half-lit node + connector. */
.step.partial::before { background: linear-gradient(to right, var(--green) 0 50%, var(--hairline) 50% 100%); }
/* little dot marking where the green progress line stops, between two stages —
   centered on the 3px line (top 19px + 1.5px) */
.step.partial::after { content: ""; position: absolute; top: 20.5px; left: 0; width: 12px; height: 12px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--color-base-100); transform: translate(-50%, -50%); z-index: 2; }
.step.partial .node { border-color: var(--green); color: var(--green); background: color-mix(in oklab, var(--green) 14%, var(--color-base-100)); }
.step.partial .lbl { color: var(--color-base-content); }
@keyframes pin { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.5); opacity: 0; } }

/* items */
.items { padding: 8px 24px 6px; }
.item { display: flex; align-items: center; gap: 13px; padding: 13px 0; border-top: 1px solid color-mix(in oklab, var(--hairline) 75%, transparent); }
.item:first-child { border-top: none; }
.item .ibar { width: 4px; align-self: stretch; border-radius: 3px; flex: 0 0 4px; background: var(--hairline); }
.item.s-preparing .ibar { background: var(--amber); }
.item.s-ready .ibar { background: var(--green); }
.item.s-delivered .ibar { background: var(--color-neutral); }
.item .qty { font-size: var(--text-base); font-weight: 800; color: var(--color-base-content); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.item .ibody { flex: 1 1 auto; min-width: 0; }
.item .iname { font-size: var(--text-base); font-weight: 600; }
.item .icfg { font-size: var(--text-xs); font-weight: 700; color: var(--brand-accent); margin-top: 1px; }
.item .inotes { font-size: var(--text-xs); color: var(--muted); margin-top: 2px; display: inline-flex; align-items: center; gap: 5px; }
.item .inotes svg { width: 12px; height: 12px; stroke: var(--amber); stroke-width: 2; fill: none; }

/* customer "I got it" confirm — shown on the tracker once the order is ready */
.got-foot { padding: 6px 24px 22px; }
.got-btn { width: 100%; height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: 0; border-radius: 13px; cursor: pointer; font-family: var(--font-sans); font-weight: 700; font-size: 15px;
  background: var(--green); color: #fff; transition: filter .12s ease, transform .12s ease; }
.got-btn:hover { filter: brightness(.96); }
.got-btn:active { transform: translateY(1px); }
.got-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.4; fill: none; }
.again-btn { width: 100%; height: 48px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--color-primary); border-radius: 13px; font-family: var(--font-sans); font-weight: 700; font-size: 15px;
  color: var(--color-base-content); text-decoration: none; }
@media (max-width: 560px) { .got-foot { padding-inline: 16px; } }

/* call-waiter footer */
.ord-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 24px 20px; margin-top: 6px; border-top: 1px solid var(--hairline); background: color-mix(in oklab, var(--color-base-200) 50%, transparent); }
.ord-foot .hint { font-size: var(--text-sm); color: var(--muted); }
.order.all-ready { border-color: color-mix(in oklab, var(--green) 55%, var(--hairline)); }
.order.all-ready .ord-head { background: color-mix(in oklab, var(--green) 9%, transparent); padding-bottom: 18px; }

/* previous orders */
.sec-label { font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 30px 0 12px; }
.order.past { opacity: .92; }
.order.past .ord-head { padding-bottom: 4px; }
.order.past .items { padding-top: 4px; }
.order.past .item .iname, .order.past .item .qty { color: var(--muted); }

/* empty state */
.empty { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty .big { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px; background: var(--color-base-200); display: flex; align-items: center; justify-content: center; }
.empty .big svg { width: 26px; height: 26px; stroke: var(--muted); stroke-width: 1.7; fill: none; }
.empty h3 { font-size: var(--text-xl); font-weight: 800; color: var(--color-base-content); margin: 0 0 6px; }
.empty p { font-size: var(--text-sm); margin: 0; }

/* refresh meta */
.refresh { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 22px 0 8px; font-size: var(--text-xs); color: var(--muted); }
.refresh svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; animation: spin 9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .refresh svg { animation: none; } }

/* toast */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 140%); background: var(--mole-900); color: #fff;
  padding: 13px 18px; border-radius: 12px; font-size: var(--text-sm); font-weight: 600;
  box-shadow: 0 18px 40px -16px oklch(15% 0.04 33 / .6); display: flex; align-items: center; gap: 10px; z-index: 60;
  transition: transform .35s cubic-bezier(.2,.9,.3,1.3); max-width: calc(100vw - 36px); }
.toast.show { transform: translate(-50%, 0); }
.toast .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: 0 0 9px; }

/* footer */
footer.ft { background: var(--mole-900); color: rgba(255,255,255,.7); padding: 36px 0 32px; margin-top: 40px; }
.ft-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.ft .wm { font-size: 22px; }
.ft .tag { font-size: var(--text-sm); margin-top: 12px; max-width: 34ch; color: rgba(255,255,255,.5); }
.ft-right { font-size: var(--text-sm); color: rgba(255,255,255,.6); text-align: right; }
.ft-right a { color: rgba(255,255,255,.82); text-decoration: none; font-weight: 600; }
.ft-right a:hover { color: #fff; }
.ft-bot { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--mole-line); font-size: var(--text-xs); color: rgba(255,255,255,.45); }

/* ───────────────────────── mobile ───────────────────────── */
@media (max-width: 560px) {
  main { padding-top: 18px; }
  .dhead-inner { padding-block: 22px 20px; }
  .dhead h1 { margin-top: 14px; }

  /* Tighter card gutters so content gets more room. */
  .ord-head { padding: 18px 16px 0; gap: 10px; }
  .ord-head h2 { font-size: var(--text-xl); }
  .status-line { padding: 14px 16px 0; }
  .items, .order.past .items { padding-inline: 16px; }
  .ord-foot { padding: 14px 16px 18px; }

  /* Tracker: stop labels from overflowing into neighbouring steps. */
  .tracker { padding: 22px 10px 4px; }
  .step { min-width: 0; padding-inline: 2px; }
  .step .node { width: 34px; height: 34px; }
  .step .node svg { width: 16px; height: 16px; }
  .step::before { top: 16px; }
  .step.partial::after { top: 17.5px; }
  .step .lbl { margin-top: 7px; overflow-wrap: anywhere; line-height: 1.2; }
  .step .lbl small { font-size: 9px; }
}

@media (max-width: 380px) {
  /* On the narrowest phones, the per-step item counts no longer fit cleanly
     under each node — drop them; the same info is in the status banner + list. */
  .step .lbl small { display: none; }
}

/* ── Rate invite (shown on a delivered order, links into the rating flow) ── */
.rate-ask {
  border-color: color-mix(in oklab, var(--color-primary) 30%, var(--color-base-300));
  background: linear-gradient(180deg, color-mix(in oklab, var(--color-primary) 5%, var(--color-base-100)), var(--color-base-100));
}
.rate-ask .ra-top { display: flex; gap: 11px; align-items: flex-start; }
.rate-ask .ra-ic { color: var(--color-primary); flex: none; margin-top: 1px; }
.rate-ask .ra-ic svg { width: 20px; height: 20px; display: block; }
.rate-ask h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.rate-ask .ra-sub { font-size: 14px; margin: 2px 0 0;
  color: color-mix(in oklab, var(--color-base-content) 62%, transparent); }
.rate-ask .ra-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 14px; }
.rate-ask .ra-chip { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: color-mix(in oklab, var(--color-base-content) 6%, transparent);
  color: color-mix(in oklab, var(--color-base-content) 62%, transparent); }
.rate-ask .ra-cta { display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 50px; background: var(--color-primary); color: var(--color-primary-content, #fff);
  border: 0; border-radius: 14px; font-size: 15.5px; font-weight: 700; text-decoration: none; }
.rate-ask .ra-cta:active { transform: translateY(1px); }

/* pay the bill by Pix (orders/pix.py) */
.pix-card { margin-top: 14px; padding: 18px 20px; }
.pix-card h2 { margin: 0 0 10px; font-size: var(--text-lg); font-weight: 800; }
.pix-rows { display: grid; gap: 6px; margin-bottom: 14px; }
.pix-row { display: flex; justify-content: space-between; gap: 12px; font-size: var(--text-sm); color: var(--muted); }
.pix-row.pix-total { color: var(--color-base-content); font-weight: 800; font-size: var(--text-base); }
.pix-sub { margin: 0 0 12px; font-size: var(--text-sm); color: var(--muted); }
.pix-pay { width: 100%; height: 54px; border: 0; border-radius: 14px; font-size: 16px; font-weight: 700;
  background: var(--color-primary); color: var(--color-primary-content, #fff); }
.pix-pay:disabled { opacity: .6; }
.pix-qr { text-align: center; }
.pix-qr img { display: block; width: 240px; max-width: 100%; height: auto; margin: 4px auto 12px; image-rendering: pixelated; }
.pix-code-row { display: flex; gap: 8px; }
.pix-code-row input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; font: inherit; font-size: var(--text-xs);
  border: 1px solid var(--hairline); border-radius: var(--radius-field); background: var(--color-base-200); color: var(--color-base-content); }
.pix-wait { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 4px; font-weight: 600; font-size: var(--text-sm); }
.pix-note { margin: 6px 0 0; font-size: var(--text-xs); color: var(--muted); }
.pix-error { margin: 10px 0 0; font-size: var(--text-sm); color: var(--color-error, #c0392b); }
.pix-split { margin-top: 12px; }
.pix-split summary { padding: 12px 0; text-align: center; font-weight: 700; font-size: var(--text-sm); color: var(--brand-accent); cursor: pointer; }
.pix-people { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; font-weight: 600; font-size: var(--text-sm); }
.pix-stepper { display: flex; align-items: center; gap: 6px; }
.pix-stepper button { width: 48px; height: 48px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--color-base-200); color: var(--color-base-content); font-size: 22px; font-weight: 700; cursor: pointer; }
.pix-stepper output { min-width: 34px; text-align: center; font-size: var(--text-lg); font-weight: 800; }
.pix-other { display: block; margin: 14px 0 6px; font-size: var(--text-sm); color: var(--muted); }
.pix-other-row input { height: 48px; font-size: 16px; }
.pix-other-row .btn { min-height: 48px; white-space: nowrap; }
.pix-qr-amount { margin: 0 0 8px; font-weight: 800; font-size: var(--text-lg); }
.pix-cancel { margin-top: 10px; padding: 10px; border: 0; background: none; color: var(--muted); font: inherit; font-size: var(--text-sm); text-decoration: underline; cursor: pointer; }
.pix-done { display: flex; align-items: center; gap: 14px; }
.pix-done h2 { margin: 0; }
.pix-done .pix-sub { margin: 2px 0 0; }
.pix-ic { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; background: var(--green); }
.pix-ic svg { width: 22px; height: 22px; stroke: #fff; stroke-width: 2.4; fill: none; }
