/* Kantumruy Pro carries Khmer glyphs Inter doesn't, so it trails Inter in the
   stack — Latin characters render in Inter, Khmer falls through per-glyph. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Kantumruy+Pro:wght@400;500;600;700;800&display=swap');

:root {
  --espresso: #2B1810;
  --espresso-soft: #6B5647;
  --caramel: #D4A373;
  --caramel-deep: #B27F4C;
  --cream: #FAF8F5;
  --paper: #FFFFFF;
  --matcha: #5F7A52;
  --matcha-tint: #E4EADD;
  --danger: #A6402B;
  --danger-tint: #F4DDD6;
  --line: rgba(43, 24, 16, 0.12);
  --shadow: rgba(43, 24, 16, 0.14);

  --font-sans: 'Inter', 'Kantumruy Pro', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--espresso);
  color: var(--espresso);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

:focus-visible { outline: 2px solid var(--caramel-deep); outline-offset: 2px; }

/* A centred phone-width column on desktop viewports; full-bleed on an actual
   phone where the viewport already is that width. */
.app-shell {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--cream);
  position: relative;
  padding-bottom: 78px;
  box-shadow: 0 0 60px var(--shadow);
}
body.has-summary-bar .app-shell { padding-bottom: 172px; }

/* ---------- press feedback ---------- */

button, .item-card, .cat-pill, .opt-pill, .dest-chip {
  transition: transform 0.12s ease, filter 0.12s ease, background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
button:active, .item-card:active, .cat-pill:active, .opt-pill:active, .dest-chip:active { transform: scale(0.96); }

/* ---------- sticky header ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--espresso);
  color: var(--cream);
  padding: 14px 16px 10px;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 6px 20px var(--shadow);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-mark {
  font-size: 20px;
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(212, 163, 115, 0.18);
  border-radius: 10px;
}
.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.table-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--caramel);
  border: 1px solid rgba(212, 163, 115, 0.45);
  padding: 5px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.table-tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--matcha); flex: none; }
.table-tag span#tableTagText { text-transform: uppercase; }

.lang-toggle {
  border: 1px solid rgba(250, 248, 245, 0.25);
  background: rgba(250, 248, 245, 0.08);
  color: var(--cream);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.lang-toggle:active { background: var(--caramel); color: var(--espresso); }

.search-row {
  position: relative;
  margin-top: 12px;
}
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  fill: none; stroke: rgba(250, 248, 245, 0.55); stroke-width: 2; stroke-linecap: round;
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: rgba(250, 248, 245, 0.1);
  border: 1px solid rgba(250, 248, 245, 0.18);
  color: var(--cream);
  border-radius: 12px;
  padding: 10px 14px 10px 36px;
  font-size: 14px;
  -webkit-appearance: none;
}
.search-input::placeholder { color: rgba(250, 248, 245, 0.45); }
.search-input:focus { outline: none; border-color: var(--caramel); background: rgba(250, 248, 245, 0.14); }
.search-input::-webkit-search-cancel-button { filter: invert(1); opacity: 0.6; }

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px 0 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs .cat-pill {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 15px 7px;
  border-radius: 16px;
  background: rgba(250, 248, 245, 0.08);
  border: 1px solid rgba(250, 248, 245, 0.16);
  cursor: pointer;
  white-space: nowrap;
}
.cat-pill-primary { font-size: 12.5px; font-weight: 700; color: rgba(250, 248, 245, 0.92); line-height: 1.3; }
.cat-pill-secondary { font-size: 9px; font-weight: 500; color: rgba(250, 248, 245, 0.55); line-height: 1.15; }
.tabs .cat-pill.active { background: var(--caramel); border-color: var(--caramel); }
.tabs .cat-pill.active .cat-pill-primary { color: var(--espresso); }
.tabs .cat-pill.active .cat-pill-secondary { color: rgba(43, 24, 16, 0.65); }

main { padding: 12px 16px 16px; }

/* ---------- menu grid ---------- */

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--caramel-deep);
  margin: 16px 2px 10px;
}

/* Category heading above the item grid — whichever language is active leads,
   the other trails as a small caption on the same baseline. */
.category-title {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin: 16px 2px 10px;
}
.category-title-primary { font-weight: 800; font-size: 15px; color: var(--espresso); line-height: 1.35; }
.category-title-secondary {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--caramel-deep);
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.item-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  animation: cardIn 0.22s ease;
}
.item-card.in-cart { border-color: var(--caramel); box-shadow: 0 0 0 1px var(--caramel) inset; }
@keyframes cardIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.item-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1.15 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--cream);
  margin-bottom: 8px;
}
.item-photo { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 0.25s ease; }
.item-media.is-loaded .item-photo { opacity: 1; }
/* Shimmer skeleton shown while a menu photo is still loading. */
.item-media.is-loading::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, var(--cream) 40%, rgba(212, 163, 115, 0.14) 50%, var(--cream) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -20% 0; } }
.item-swatch {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}

.quick-add-btn {
  position: absolute;
  right: 7px; bottom: 7px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--espresso);
  color: var(--cream);
  font-size: 18px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 8px var(--shadow);
}
.quick-add-btn:active { background: var(--caramel-deep); }

.item-qty-pill {
  position: absolute;
  right: 7px; bottom: 7px;
  min-width: 30px; height: 30px; padding: 0 4px;
  border-radius: 15px;
  background: var(--espresso);
  color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 8px var(--shadow);
}
.item-qty-pill button {
  border: none; background: transparent; color: inherit;
  width: 20px; height: 20px; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.item-qty-pill span { font-size: 12.5px; font-weight: 700; min-width: 12px; text-align: center; }

.item-titles { min-width: 0; }
/* Whichever language is active fills the primary slot (Khmer by default).
   The line-height is generous enough for Kantumruy Pro, which reads a touch
   smaller than Inter at the same size, without looking loose when Inter
   lands here instead after switching to English. */
.title-primary {
  font-weight: 700;
  font-size: 14px;
  margin: 0;
  color: var(--espresso);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.title-secondary {
  font-weight: 500;
  font-size: 11px;
  margin: 2px 0 0;
  color: #57432F; /* darker than espresso-soft for AA contrast (Khmer) */
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.menu-temp { display: flex; gap: 5px; align-items: center; margin-top: 6px; }
.temp-chip {
  font-size: 10.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  background: var(--cream); color: var(--espresso-soft); border: 1px solid var(--line);
}
.temp-chip.active { background: var(--espresso); color: var(--cream); border-color: var(--espresso); }
.temp-fixed { font-size: 10.5px; color: var(--espresso-soft); font-weight: 600; }

.item-price-dual {
  margin-top: 7px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.item-price-dual .usd { font-size: 13px; font-weight: 800; color: var(--espresso); }
.item-price-dual .khr { font-size: 10.5px; font-weight: 600; color: var(--espresso-soft); }

/* "Your usual" — one-tap re-add of the drinks this customer orders most. */
.usual-box {
  background: var(--paper); border: 1px solid var(--caramel); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 10px;
}
.usual-box .section-label { margin: 0 0 8px; color: var(--caramel-deep); }
.usual-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-top: 1px solid var(--line);
}
.usual-row:first-of-type { border-top: none; }
.usual-info { display: flex; flex-direction: column; min-width: 0; }
.usual-name { font-weight: 700; font-size: 13.5px; }
.usual-opts { font-size: 11px; color: var(--espresso-soft); margin-top: 1px; }
.usual-add {
  flex: none; font-size: 12px; font-weight: 700;
  padding: 7px 14px; border-radius: 14px; cursor: pointer;
  background: var(--espresso); color: var(--cream); border: none;
}

.search-results-label { font-size: 12px; color: var(--espresso-soft); margin: 2px 2px 10px; }

/* ---------- bottom sheet (customization modal) ---------- */

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(43, 24, 16, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  z-index: 40;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.bottom-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 460px;
  transform: translate(-50%, 100%);
  background: var(--paper);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 34px var(--shadow);
  z-index: 41;
  max-height: 86vh;
  overflow-y: auto;
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-sheet.open { transform: translate(-50%, 0); }

.sheet-handle {
  width: 40px; height: 4px; border-radius: 3px;
  background: var(--line);
  margin: 10px auto 4px;
}

.sheet-content { padding: 6px 20px 20px; }

.sheet-header {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.sheet-header .item-media { width: 58px; height: 58px; flex: none; margin: 0; aspect-ratio: auto; }
.sheet-header-titles { min-width: 0; flex: 1; }
.sheet-header-titles .title-primary { font-size: 17px; }
.sheet-header-titles .title-secondary { font-size: 12.5px; }
.sheet-close {
  border: none; background: var(--cream); color: var(--espresso-soft);
  width: 30px; height: 30px; border-radius: 50%; font-size: 15px; cursor: pointer;
  flex: none;
}

.opt-section { margin-bottom: 18px; }
.opt-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--espresso-soft); margin-bottom: 9px;
}
.opt-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.opt-pill {
  font-size: 13px; font-weight: 600;
  padding: 9px 16px; border-radius: 14px;
  background: var(--cream); color: var(--espresso);
  border: 1px solid var(--line); cursor: pointer; white-space: nowrap;
}
.opt-pill.active { background: var(--espresso); color: var(--cream); border-color: var(--espresso); }

.sheet-note {
  width: 100%; min-height: 52px; resize: vertical;
  background: var(--cream); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 13px; color: var(--espresso);
}
.sheet-note:focus { outline: 1px solid var(--caramel-deep); }

.sheet-qty-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.sheet-qty-row .qty-stepper { display: flex; align-items: center; gap: 14px; }
.qty-stepper button {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--cream); color: var(--espresso); font-size: 17px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.qty-stepper button:active { background: var(--caramel); }
.qty-stepper span { min-width: 18px; text-align: center; font-weight: 700; font-size: 14px; }

.sheet-footer {
  display: flex; align-items: center; gap: 12px;
  position: sticky; bottom: 0;
  background: var(--paper);
  padding-top: 6px;
}
.sheet-footer .sheet-total { font-weight: 800; font-size: 15px; flex: none; white-space: nowrap; }
.sheet-footer .primary-btn { margin: 0; }

/* ---------- qty controls (menu quick-add fallback / cart lines) ---------- */

.qty-controls { display: flex; align-items: center; gap: 0; flex: none; }
.qty-controls button {
  width: 27px; height: 27px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--cream); color: var(--espresso); font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.qty-controls button:active { background: var(--caramel); }
.qty-controls span { width: 24px; text-align: center; font-size: 13px; font-weight: 700; }

/* ---------- cart ---------- */

.cart-list { padding-bottom: 4px; }
.cart-line-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 13px; margin-bottom: 9px;
}
.cart-line {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.cart-line .line-names { display: flex; flex-direction: column; min-width: 0; }
.cart-line .line-title-primary { font-weight: 700; font-size: 14px; color: var(--espresso); line-height: 1.35; }
.cart-line .line-title-secondary { font-weight: 500; font-size: 10.5px; color: var(--espresso-soft); line-height: 1.2; margin-top: 1px; }
.cart-line .line-price { font-weight: 800; font-size: 13px; color: var(--espresso); flex: none; }

.line-opts-summary {
  font-size: 11.5px; color: var(--espresso-soft); margin-top: 5px;
}
.line-note-preview { font-size: 11.5px; color: var(--espresso-soft); margin-top: 2px; font-style: italic; }

.cart-line-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; gap: 10px; }
.edit-line-btn {
  border: 1px dashed var(--caramel-deep); background: transparent; color: var(--caramel-deep);
  font-size: 11.5px; font-weight: 700; padding: 6px 12px; border-radius: 12px; cursor: pointer;
}
.edit-line-btn:active { background: var(--caramel); color: var(--espresso); border-style: solid; }

.temp-badge { font-size: 13px; }

.order-ref {
  font-size: 21px; font-weight: 800; color: var(--espresso);
  margin-top: 12px; letter-spacing: 0.01em;
}

/* Blocks the whole app (menu, cart, tabbar) until destinationResolved() is
   true — see app.js render(). Hidden via body.dest-gate-active below so a
   customer can't browse or search before the order's destination is known. */
.dest-gate {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 15vh 8px 24px; max-width: 320px; margin: 0 auto;
}
.dest-gate-icon { font-size: 40px; margin-bottom: 12px; }
.dest-gate-title { font-size: 19px; font-weight: 700; color: var(--espresso); margin: 0 0 20px; }
.dest-gate .dest-chips, .dest-gate .dest-scan-btn, .dest-gate .table-select { width: 100%; }
.dest-gate .dest-note { text-align: center; }

body.dest-gate-active .search-row,
body.dest-gate-active .tabs,
body.dest-gate-active .tabbar { display: none; }

.dest-field { margin-top: 20px; }
.dest-field label {
  display: block; font-size: 10.5px; letter-spacing: 0.08em; font-weight: 700;
  text-transform: uppercase; color: var(--espresso-soft); margin-bottom: 8px;
}
.dest-scan-btn {
  width: 100%; font-size: 14.5px; font-weight: 700;
  padding: 13px 10px; border-radius: 12px; cursor: pointer;
  background: var(--caramel-deep); color: var(--cream); border: none;
  margin-bottom: 10px;
}
.dest-chips { display: flex; gap: 8px; }
.dest-chip {
  flex: 1; font-size: 14px; font-weight: 600;
  padding: 12px 10px; border-radius: 12px; cursor: pointer;
  background: var(--paper); color: var(--espresso); border: 1px solid var(--line);
}
.dest-chip.active { background: var(--espresso); color: var(--cream); border-color: var(--espresso); }
.reward-chip {
  width: 100%; text-align: center;
  border-color: var(--caramel-deep); color: var(--caramel-deep); font-weight: 700;
}
.reward-chip.active { background: var(--caramel-deep); border-color: var(--caramel-deep); color: var(--cream); }
.table-select {
  width: 100%; margin-top: 10px; padding: 12px;
  font-size: 14px; color: var(--espresso);
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
}
.dest-note { margin: 10px 0 0; font-size: 12.5px; color: var(--espresso-soft); }

.note-field { margin-top: 20px; }
.note-field label {
  display: block; font-size: 10.5px; letter-spacing: 0.08em; font-weight: 700;
  text-transform: uppercase; color: var(--espresso-soft); margin-bottom: 6px;
}
.note-field textarea {
  width: 100%; min-height: 60px; resize: vertical;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 13px; color: var(--espresso);
}
.note-field textarea:focus { outline: 1px solid var(--caramel-deep); }

/* ---------- floating cart bar ---------- */

.floating-cart-bar {
  position: fixed;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 436px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  background: var(--espresso);
  color: var(--cream);
  border-radius: 18px;
  box-shadow: 0 10px 28px var(--shadow);
  z-index: 15;
  animation: barIn 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes barIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.floating-cart-bar .bar-totals { min-width: 0; }
.floating-cart-bar .total-label {
  font-size: 10px; letter-spacing: 0.08em; font-weight: 700; text-transform: uppercase;
  color: var(--caramel);
  display: flex; align-items: center; gap: 5px;
}
.floating-cart-bar .cart-badge-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--caramel); color: var(--espresso); font-size: 10px; font-weight: 800;
  transition: transform 0.18s ease;
}
.floating-cart-bar .cart-badge-count.bump { animation: badgeBump 0.32s ease; }
@keyframes badgeBump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

.floating-cart-bar .total-amount { font-size: 18px; font-weight: 800; margin-top: 2px; }
.floating-cart-bar .total-amount .khr { font-size: 11px; font-weight: 600; color: rgba(250, 248, 245, 0.65); margin-left: 5px; }
.floating-cart-bar .total-amount .was-price {
  font-size: 12px; font-weight: 600; color: rgba(250, 248, 245, 0.5);
  text-decoration: line-through; margin-right: 6px;
}
.floating-cart-bar .primary-btn { width: auto; margin: 0; padding: 12px 20px; flex: none; }

/* ---------- buttons ---------- */

.primary-btn {
  width: 100%; padding: 13px; border: none; border-radius: 14px;
  background: var(--espresso); color: var(--cream); font-size: 14.5px; font-weight: 700;
  cursor: pointer; margin-top: 8px;
}
.primary-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.primary-btn:active:not(:disabled) { filter: brightness(1.15); }

/* ---------- checkout / QR ---------- */

.qr-box {
  text-align: center; padding: 26px 20px 22px; background: var(--paper);
  border-radius: 18px; border: 1px solid var(--line); position: relative; overflow: hidden;
}
.qr-box canvas { margin: 0 auto 4px; }
.qr-box .qr-image {
  width: 176px; height: 176px; margin: 0 auto 8px; display: block;
  border-radius: 12px; border: 1px solid var(--line); padding: 8px; background: var(--paper);
  object-fit: contain; box-sizing: border-box;
}
.qr-box pre {
  white-space: pre-wrap; word-break: break-all; font-size: 11px;
  background: var(--cream); padding: 12px; border-radius: 10px; text-align: left;
  border: 1px dashed var(--caramel-deep); color: var(--espresso);
}
.qr-box p { font-size: 13.5px; }
.qr-box .total-line { font-size: 14.5px; margin-top: 14px; }
.qr-box .total-line strong { color: var(--espresso); }
.total-line .usd-sub { font-size: 11px; font-weight: 600; color: var(--espresso-soft); }
.currency-chips { margin-top: 8px; }

/* Payment received / paid banner */
.paid-box { padding-top: 34px; padding-bottom: 30px; }
.paid-icon { font-size: 56px; line-height: 1; margin-bottom: 8px; }
.paid-title { font-size: 17px; font-weight: 800; color: var(--matcha); margin: 0 0 10px; }

/* "Pay with cash instead" — secondary action under the QR */
.switch-cash-btn {
  margin-top: 8px; background: transparent; color: var(--caramel-deep);
  border: 1.5px solid var(--caramel-deep); font-size: 13px;
}
.switch-cash-btn:active:not(:disabled) { background: var(--caramel); color: var(--espresso); }
.qr-box .test-hint { color: var(--espresso-soft); font-size: 12px; margin-top: 4px; }
.qr-box .reward-note { color: var(--caramel-deep); font-weight: 700; font-size: 12.5px; margin-top: 8px; }

.waiting-indicator {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--caramel-deep); margin-bottom: 6px;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--caramel-deep);
  animation: pulseDot 1.4s ease-in-out infinite;
}
@keyframes pulseDot { 0%, 100% { opacity: 0.35; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1.15); } }

.countdown {
  font-size: 22px; font-weight: 800; color: var(--espresso); margin-bottom: 10px; letter-spacing: 0.02em;
}

/* QR expired state */
.expired-icon { font-size: 40px; margin-bottom: 8px; }
.expired-title { font-size: 15px; font-weight: 800; color: var(--espresso); margin: 0 0 6px; }

.aba-app-btn {
  display: block; text-decoration: none; box-sizing: border-box;
  background: var(--caramel-deep); color: var(--cream);
}
.aba-app-btn:active { filter: brightness(1.1); }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--line); color: var(--espresso-soft);
}
.status-pill.st-progress { background: #F3E2D3; color: var(--caramel-deep); }
.status-pill.cash-pending { background: var(--matcha-tint); color: var(--matcha); }
.status-pill.st-ready { background: var(--matcha-tint); color: var(--matcha); }
.status-pill.st-done { background: var(--matcha-tint); color: var(--matcha); }
.status-pill.st-cancelled { background: var(--danger-tint); color: var(--danger); }

/* ---------- profile ---------- */

.profile-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.profile-header .avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--caramel-deep), var(--caramel));
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800;
  flex: none;
}
.profile-header .name { font-weight: 700; font-size: 16px; }
.profile-header .handle { color: var(--espresso-soft); font-size: 12.5px; margin-top: 1px; }

.loyalty-card {
  background: var(--espresso); color: var(--cream); border-radius: 18px; padding: 18px 20px; margin-bottom: 22px;
  position: relative; overflow: hidden;
}
.loyalty-card::after {
  content: ""; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px;
  border-radius: 50%; background: radial-gradient(circle, var(--caramel) 0%, transparent 70%); opacity: 0.4;
  pointer-events: none;
}
.loyalty-card .label {
  font-size: 10.5px; letter-spacing: 0.08em; font-weight: 700; text-transform: uppercase; color: var(--caramel);
  position: relative;
}
.loyalty-card .points { font-size: 32px; font-weight: 800; margin-top: 4px; position: relative; }
.loyalty-card .rule { font-size: 12px; margin-top: 10px; color: rgba(250, 248, 245, 0.7); position: relative; font-weight: 600; }

.stamp-dots {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; position: relative;
}
.stamp-dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  background: rgba(250, 248, 245, 0.1); border: 1.5px dashed rgba(250, 248, 245, 0.35);
}
.stamp-dot.filled { background: var(--caramel); border-style: solid; border-color: var(--caramel); }

.order-history-item {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 14px; margin-bottom: 8px;
}
.order-history-item .meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px; color: var(--espresso-soft); margin-bottom: 8px; gap: 10px;
}
.order-history-item .items-line { font-size: 13.5px; }
.order-history-item .note-line { font-size: 12px; color: var(--espresso-soft); margin-top: 6px; font-style: italic; }
.order-history-item .total { margin-top: 8px; font-weight: 800; font-size: 13.5px; color: var(--espresso); }

/* Shop contact card (Profile tab) */
.shop-card {
  background: var(--paper); border: 1px solid var(--caramel); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 18px;
}
.shop-title { font-weight: 800; font-size: 14px; color: var(--espresso); }
.shop-line { font-size: 12.5px; color: var(--espresso-soft); margin-top: 4px; }
.shop-line a { color: var(--espresso); text-decoration: none; }
.shop-maps { display: inline-block; margin-top: 7px; font-size: 12px; font-weight: 700; color: var(--caramel-deep); text-decoration: none; }

.history-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.reorder-btn {
  font-size: 12px; font-weight: 700; cursor: pointer;
  padding: 7px 13px; border-radius: 14px;
  background: transparent; color: var(--caramel-deep); border: 1px solid var(--caramel-deep);
}

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 460px;
  display: flex; background: var(--paper);
  border-top: 1px solid var(--line);
  z-index: 16;
}
.tab {
  flex: 1; border: none; background: none; padding: 9px 0 8px; font-size: 11px; color: var(--espresso-soft);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font-weight: 500;
}
.tab svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round;
  flex: none;
}
.tab-label { white-space: nowrap; }
.tab.active { color: var(--caramel-deep); font-weight: 700; }

/* ---------- misc ---------- */

.empty-state { text-align: center; color: var(--espresso-soft); padding: 48px 20px; font-size: 13.5px; }
.empty-state .empty-illo {
  display: block; width: 62px; height: 62px; margin: 0 auto 14px;
  color: var(--caramel-deep); opacity: 0.85;
}
.empty-state .empty-illo svg { width: 100%; height: 100%; display: block; }

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