/* Customer ordering screens. Phone first; centred column on bigger screens. */
body.customer { background: var(--surface); }
.app {
  max-width: 560px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(110px + var(--safe-bottom));
  background: var(--paper);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 64px;
  padding: .5rem .75rem .5rem 1rem;
  background: var(--brand);
  color: var(--brand-ink);
}
.topbar-left { display: flex; align-items: center; gap: .65rem; min-width: 0; flex: 1; }
.topbar-title { flex: 2; font-family: var(--font-display); font-size: 1.35rem; text-align: center; }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .15); }
.brand-logo { width: 44px; height: 44px; object-fit: contain; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-text strong { font-family: var(--font-display); font-size: 1.35rem; letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text span { font-size: .85rem; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- name screen ---------- */
.name-screen { display: flex; flex-direction: column; min-height: calc(100dvh - 64px); padding: 2rem 1.25rem 1.5rem; }
.name-form { display: flex; flex-direction: column; gap: .9rem; margin-top: 12vh; }
.name-label { font-family: var(--font-display); font-size: clamp(2.4rem, 11vw, 3.4rem); line-height: 1; }
.name-help { color: var(--muted); font-size: 1.05rem; margin-bottom: .5rem; }
.name-foot { margin-top: auto; padding-top: 2rem; color: var(--muted); text-align: center; font-size: .9rem; }
.table-chip {
  align-self: flex-start;
  display: inline-block;
  padding: .3rem .8rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 1.15rem;
}
.table-chip.small { font-size: .95rem; padding: .15rem .6rem; }
.name-screen .banner { margin: 1rem 0 0; }

/* ---------- menu ---------- */
.hello { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem 1rem 0; }
.hello-name {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: underline dotted var(--line);
  text-underline-offset: 5px;
}

.order-pill {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: .75rem 1rem 0;
  padding: .6rem .6rem .6rem 1rem;
  border-radius: var(--r-m);
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 700;
}
.order-pill-no { font-family: var(--font-display); font-size: 1.6rem; line-height: 1; }
.order-pill-go { margin-left: auto; padding: .55rem .9rem; border-radius: 999px; background: var(--brand); color: var(--brand-ink); }
.order-pill[data-status="ready"] { background: var(--ok); color: #fff; }

.cat-bar {
  position: sticky;
  top: 64px;
  z-index: 15;
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
  padding: .6rem 1rem;
  overflow-x: auto;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.1rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.cat-chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

.menu-section { padding: 1.25rem 1rem 0; scroll-margin-top: 130px; }
.menu-cat { font-family: var(--font-display); font-size: 1.9rem; line-height: 1; margin-bottom: .5rem; }
.menu-list { display: flex; flex-direction: column; }

.item {
  display: flex;
  align-items: center;
  gap: .9rem;
  width: 100%;
  padding: .85rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}
.item:last-child { border-bottom: 0; }
.item-img { width: 88px; height: 88px; flex: none; border-radius: var(--r-m); object-fit: cover; background: var(--surface); }
.item-img-blank { display: grid; place-items: center; font-family: var(--font-display); font-size: 2.2rem; color: var(--muted); }
.item-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; flex: 1; }
.item-name { font-weight: 800; font-size: 1.08rem; line-height: 1.2; }
.item-desc {
  color: var(--muted);
  font-size: .92rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-price { font-weight: 800; margin-top: .15rem; }
.item-add {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-ink);
}
.item.is-soldout { opacity: .55; cursor: not-allowed; }
.item.is-soldout .item-img { filter: grayscale(1); }
.empty { padding: 2rem 1rem; color: var(--muted); text-align: center; }

/* ---------- sticky cart bar ---------- */
.cartbar-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: .75rem 1rem calc(.75rem + var(--safe-bottom));
  background: linear-gradient(to top, var(--paper) 70%, rgba(255, 255, 255, 0));
}
.cartbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 528px;
  min-height: 64px;
  margin: 0 auto;
  padding: 0 1.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
  font-size: 1.12rem;
  text-decoration: none;
  box-shadow: 0 10px 24px -10px rgba(21, 24, 28, .55);
}
.cartbar:disabled { opacity: .5; cursor: not-allowed; }
.cartbar-total { font-family: var(--font-display); font-size: 1.4rem; }

/* ---------- item sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(21, 24, 28, .55); animation: fade .2s ease; }
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 41;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  border-radius: var(--r-l) var(--r-l) 0 0;
  background: var(--paper);
  transform: translateX(-50%);
  animation: slide-up .25s cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide-up { from { transform: translate(-50%, 40%); opacity: 0; } }
.sheet-close { position: absolute; top: .75rem; right: .75rem; z-index: 2; background: rgba(255, 255, 255, .92); }
.sheet-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; flex: none; background: var(--surface); }
.sheet-body { padding: 1.25rem 1.25rem .5rem; overflow-y: auto; overscroll-behavior: contain; }
.sheet-title { font-family: var(--font-display); font-size: 2rem; line-height: 1.05; padding-right: 3rem; }
.sheet-desc { color: var(--muted); margin-top: .4rem; }
.sheet-price { font-weight: 800; font-size: 1.15rem; margin: .5rem 0 .75rem; }

.opt-group { margin: 0 0 1.1rem; padding: 0; border: 0; }
.opt-group legend { display: flex; align-items: center; gap: .5rem; width: 100%; padding: 0; margin-bottom: .6rem; font-weight: 800; font-size: 1.05rem; }
.opt-tag { padding: .05rem .5rem; border-radius: 6px; background: var(--surface); color: var(--muted); font-size: .78rem; font-weight: 700; }
.choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; pointer-events: none; }
.choice span {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 48px;
  padding: 0 1rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.choice small { color: var(--muted); font-weight: 600; }
.choice input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.choice input:checked + span small { color: rgba(255, 255, 255, .8); }
.choice input:focus-visible + span { outline: 3px solid var(--info); outline-offset: 2px; }

.notes-label { display: block; font-weight: 800; margin-bottom: .4rem; }
.notes { margin-bottom: .5rem; }

.sheet-foot {
  display: flex;
  gap: .75rem;
  padding: .75rem 1rem calc(.75rem + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.stepper { display: inline-flex; align-items: center; border: 2px solid var(--line); border-radius: 999px; }
.step-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: none;
}
.step-btn:disabled { opacity: .3; }
.step-val { min-width: 2ch; text-align: center; font-weight: 800; font-size: 1.15rem; }
.stepper.small .step-btn { width: 44px; height: 44px; }
.stepper.small svg { width: 20px; height: 20px; }

/* ---------- cart / checkout ---------- */
.checkout { padding: .5rem 1rem 1rem; }
.lines { list-style: none; margin: 0; padding: 0; }
.line { display: flex; gap: .75rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.line-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .15rem;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}
.line-name { font-weight: 800; font-size: 1.05rem; }
.line-opts, .line-notes { color: var(--muted); font-size: .92rem; }
.line-notes { font-style: italic; }
.line-side { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; }
.line-price { font-weight: 800; }
.line.is-soldout .line-name { text-decoration: line-through; }
.add-more { display: inline-flex; align-items: center; gap: .4rem; min-height: 52px; font-weight: 800; color: var(--brand); text-decoration: none; }
.who { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: .5rem 0 1rem; padding: .75rem 1rem; border-radius: var(--r-m); background: var(--surface); }

.pay { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: .65rem; }
.pay-legend { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: .6rem; padding: 0; }
.pay-option {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: .8rem;
  align-items: center;
  min-height: 72px;
  padding: .9rem 1rem;
  border: 2px solid var(--line);
  border-radius: var(--r-m);
  cursor: pointer;
}
.pay-option input { grid-row: span 2; width: 24px; height: 24px; margin: 0; accent-color: var(--brand); }
.pay-title { font-weight: 800; font-size: 1.1rem; }
.pay-sub { grid-column: 2; color: var(--muted); font-size: .92rem; }
.pay-option:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, #fff); }
.pay-option.is-disabled { opacity: .5; cursor: not-allowed; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 1.25rem; font-size: 1.15rem; }
.total-row strong { font-family: var(--font-display); font-size: 2rem; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 4rem 1.5rem; text-align: center; font-size: 1.1rem; }

/* ---------- order ticket (the order number) ---------- */
.status { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.ticket {
  position: relative;
  padding: 1.25rem 1.25rem 1.4rem;
  border-radius: var(--r-m);
  background: var(--accent);
  color: var(--accent-ink);
  text-align: center;
  overflow: hidden;
}
.ticket-cafe { font-weight: 800; font-size: .95rem; opacity: .8; }
.ticket-no {
  font-family: var(--font-display);
  font-size: clamp(6.5rem, 36vw, 11.5rem);
  line-height: .9;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums lining-nums;
  margin: .35rem 0 .3rem;
}
.ticket-name { font-weight: 800; font-size: 1.45rem; line-height: 1.2; overflow-wrap: anywhere; }
/* Tear-off line with punched notches, like a queue ticket */
.ticket-tear { position: relative; height: 0; margin: 1.2rem -1.25rem 1.1rem; border-top: 3px dashed rgba(128, 128, 128, .45); }
.ticket-tear::before, .ticket-tear::after {
  content: '';
  position: absolute;
  top: -16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--paper);
}
.ticket-tear::before { left: -15px; }
.ticket-tear::after { right: -15px; }
.ticket-status {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1.1rem;
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
  font-size: 1.1rem;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
.ticket[data-status="completed"] .status-dot, .ticket[data-status="cancelled"] .status-dot { animation: none; }
.ticket[data-status="ready"] .ticket-status { background: var(--ok); }
.ticket[data-status="cancelled"] { background: #ECE7E3; color: var(--ink); }
.ticket[data-status="cancelled"] .ticket-no { text-decoration: line-through; text-decoration-thickness: 6px; }
.ticket-meta { margin-top: .8rem; font-size: .9rem; font-weight: 600; opacity: .75; }
@keyframes pulse { 50% { opacity: .3; } }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; margin: 0; padding: 0; list-style: none; }
.step { display: flex; flex-direction: column; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 700; color: var(--muted); text-align: center; }
.step-dot { width: 100%; height: 8px; border-radius: 4px; background: var(--line); }
.step.is-done .step-dot { background: var(--brand); }
.step.is-now { color: var(--ink); }
.step.is-now .step-dot { background: var(--brand); animation: pulse 1.6s ease-in-out infinite; }
.status .banner { margin: 0; }

.pay-panel { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 1.25rem; border: 2px solid var(--ink); border-radius: var(--r-m); text-align: center; }
.pay-panel-counter { align-items: stretch; text-align: left; }
.pay-amount { font-family: var(--font-display); font-size: 2.4rem; line-height: 1; }
.pay-ref { color: var(--muted); font-weight: 600; }
.qr-img { width: 100%; max-width: 360px; aspect-ratio: 1; object-fit: contain; border-radius: var(--r-s); background: #fff; }
.qr-label { font-weight: 700; }
.pay-steps { margin: 0; padding-left: 1.25rem; text-align: left; color: var(--ink-soft); display: flex; flex-direction: column; gap: .35rem; }

.summary { border-radius: var(--r-m); background: var(--surface); }
.summary summary { min-height: 56px; display: flex; align-items: center; padding: 0 1rem; font-weight: 800; cursor: pointer; }
.sum-list { list-style: none; margin: 0; padding: 0 1rem; }
.sum-list li { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: .5rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.sum-qty { font-weight: 800; }
.sum-name { display: flex; flex-direction: column; font-weight: 700; }
.sum-name small { color: var(--muted); font-weight: 500; }
.sum-total { display: flex; justify-content: space-between; padding: .75rem 1rem 0; border-top: 2px solid var(--line); margin: 0 1rem; font-size: 1.1rem; }
.sum-pay { padding: .25rem 1rem 1rem; color: var(--muted); }
.screenshot-tip { color: var(--muted); text-align: center; font-size: .92rem; }

/* ---------- READY full screen ---------- */
.ready {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 2rem 1.5rem calc(2rem + var(--safe-bottom));
  background: var(--brand);
  color: var(--brand-ink);
  text-align: center;
  animation: ready-in .35s ease;
}
.ready-word { font-family: var(--font-display); font-size: clamp(3.5rem, 20vw, 7rem); line-height: .9; }
.ready-no {
  font-family: var(--font-display);
  font-size: clamp(6.5rem, 40vw, 15rem);
  line-height: .85;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  animation: ready-beat 1s ease-in-out 3;
}
.ready-name { font-size: 1.8rem; font-weight: 800; overflow-wrap: anywhere; }
.ready-help { font-size: 1.15rem; margin-bottom: 1.5rem; opacity: .95; }
.ready .btn { max-width: 360px; }
@keyframes ready-in { from { opacity: 0; transform: scale(1.04); } }
@keyframes ready-beat { 50% { transform: scale(1.06); } }

@media (min-width: 600px) {
  .app { box-shadow: 0 0 0 1px var(--line); }
}

/* ---------- receipt ---------- */
.receipt-wrap { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.receipt {
  padding: 1.5rem 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: #fff;
  color: #111;
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
}
.r-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .1rem; color: #444; font-size: .88rem; }
.r-logo { width: 64px; height: 64px; object-fit: contain; margin-bottom: .4rem; }
.r-name { font-family: var(--font-display); font-size: 1.7rem; color: #111; line-height: 1.1; margin-bottom: .2rem; }
.r-title { margin: 1.1rem 0 .6rem; padding: .5rem 0; border-top: 2px dashed #bbb; border-bottom: 2px dashed #bbb; text-align: center; font-size: 1.05rem; letter-spacing: .2em; }
.r-meta { margin: 0 0 .75rem; display: flex; flex-direction: column; gap: .2rem; }
.r-meta div { display: flex; justify-content: space-between; gap: 1rem; }
.r-meta dt { color: #555; }
.r-meta dd { margin: 0; font-weight: 700; text-align: right; }
.r-items { width: 100%; border-collapse: collapse; border-top: 2px dashed #bbb; }
.r-items td { padding: .5rem 0; vertical-align: top; border-bottom: 1px solid #eee; }
.r-items small { display: block; color: #666; font-size: .82rem; }
.r-qty { width: 2.4rem; font-weight: 700; }
.r-amt { text-align: right; white-space: nowrap; padding-left: .75rem !important; }
.r-total { display: flex; justify-content: space-between; align-items: baseline; padding: .75rem 0 .25rem; border-top: 2px solid #111; margin-top: .25rem; font-weight: 800; font-size: 1.1rem; }
.r-total strong { font-family: var(--font-display); font-size: 1.8rem; }
.r-paid { display: inline-block; margin: .5rem 0 0; padding: .2rem .7rem; border: 3px solid var(--ok); border-radius: 6px; color: var(--ok); font-weight: 900; letter-spacing: .15em; transform: rotate(-3deg); }
.r-foot { margin-top: 1rem; padding-top: .75rem; border-top: 2px dashed #bbb; text-align: center; color: #444; }
.receipt-actions { display: flex; flex-direction: column; gap: .6rem; }

@media print {
  @page { margin: 12mm; }
  body.customer { background: #fff; }
  body.customer .topbar, .receipt-actions, .toast, #sheet-root, #ready-root, .cartbar-wrap { display: none !important; }
  .app { max-width: none; min-height: 0; padding: 0; box-shadow: none; }
  .receipt-wrap { padding: 0; }
  .receipt { max-width: 90mm; margin: 0 auto; border: 0; padding: 0; }
  .r-paid { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
