:root {
  --brand: #B5452B;   /* สีหลัก — เปลี่ยนตาม theme_color ในแท็บ settings */
  --accent: #E8922E;
  --bg: #FBF5EA;
  --card: #FFFFFF;
  --ink: #2A1A17;
  --muted: #8A7466;
  --line: #EFE4D3;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* ให้ hidden ชนะ display ของคลาส (.logo / .lang ตั้ง display ไว้ — ไม่งั้นซ่อนไม่ได้) */
[hidden] { display: none !important; }
body {
  font-family: 'Prompt', system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 520px; margin: 0 auto; min-height: 100vh; }

/* ── หัวร้าน ── */
header {
  background: var(--brand); color: #fff; text-align: center;
  padding: 26px 16px 20px; border-radius: 0 0 28px 28px; position: relative;
}
.logo {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--accent); background: #fff; display: block; margin: 0 auto 10px;
}
header h1 { font-size: 23px; font-weight: 700; padding: 0 56px; text-wrap: balance; }
.info {
  display: inline-block; margin-top: 10px; font-size: 13px; white-space: pre-line;
  background: rgba(255,255,255,.14); padding: 6px 14px; border-radius: 14px;
}
.lang {
  position: absolute; top: 14px; right: 14px; display: flex;
  background: rgba(255,255,255,.18); border-radius: 999px; padding: 3px;
}
.lang button {
  border: 0; background: none; color: #fff; font: 500 12.5px 'Prompt', sans-serif;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.lang button.on { background: #fff; color: var(--brand); }

/* ── แท็บหมวด ── */
nav {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; gap: 8px; overflow-x: auto; padding: 14px 16px 10px; scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }
nav button {
  flex: none; border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-size: 14px; padding: 7px 16px; border-radius: 999px; cursor: pointer;
}
nav button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ── รายการเมนู ── */
main { padding: 4px 16px 24px; }
h2 {
  font-size: 17px; font-weight: 600; margin: 18px 2px 10px;
  display: flex; align-items: center; gap: 8px;
}
h2::after { content: ""; flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.item {
  display: flex; gap: 12px; align-items: center; background: var(--card);
  border-radius: 16px; padding: 10px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.thumb {
  width: 78px; height: 78px; border-radius: 12px; flex: none; object-fit: cover;
  background: #F4EADB; display: grid; place-items: center; font-size: 30px;
}
.info-col { flex: 1; min-width: 0; }
.name { font-size: 15.5px; font-weight: 500; line-height: 1.35; }
.desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 600; color: #fff;
  background: var(--accent); padding: 1px 8px; border-radius: 6px; margin-bottom: 3px;
}
.price { font-size: 17px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.price small { font-size: 12px; font-weight: 500; color: var(--muted); }
.item.soldout { opacity: .55; }
.item.soldout .thumb { filter: grayscale(1); }
.item.soldout .price { color: var(--muted); text-decoration: line-through; }
.sold { display: inline-block; font-size: 11px; font-weight: 600; color: #fff; background: #8A7466; padding: 1px 8px; border-radius: 6px; margin-bottom: 3px; }

.state { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 14px; line-height: 1.6; }
.stale { text-align: center; font-size: 12px; color: var(--muted); padding: 6px 16px 0; }

/* ── ติดต่อ ── */
footer {
  margin: 8px 16px 24px; padding: 18px 16px; background: var(--brand);
  color: #fff; border-radius: 20px; font-size: 14px;
}
footer h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
footer a {
  display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none;
  padding: 10px 0; border-top: 1px solid rgba(255,255,255,.15);
}
footer a:first-child { border-top: 0; }

/* ── สั่งอาหาร ───────────────────────────────────────────── */
.table-chip {
  display: inline-block; margin-top: 10px; margin-left: 6px; font-size: 13px; font-weight: 600;
  background: var(--accent); color: #fff; padding: 6px 14px; border-radius: 14px;
}
.scan-hint {
  margin: 12px 16px 0; padding: 10px 14px; border-radius: 12px; font-size: 13.5px;
  background: #fff; border: 1.5px dashed var(--line); color: var(--muted); text-align: center;
}
.right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--brand);
  background: #fff; color: var(--brand); font: 600 18px/1 'Prompt', sans-serif; cursor: pointer;
}
.stepper button.add { background: var(--brand); color: #fff; }
.stepper .q { min-width: 18px; text-align: center; font-weight: 600; }
body:has(.cart-bar:not([hidden])) .wrap { padding-bottom: 84px; }

.cart-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 8px;
  max-width: 520px; margin: 0 auto; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.cart-bar button {
  flex: 1; border: 0; border-radius: 14px; padding: 14px 12px; cursor: pointer;
  font: 600 15px 'Prompt', sans-serif;
}
.cart-bar .primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.cart-bar .ghost { flex: 0 0 auto; background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }

.overlay {
  position: fixed; inset: 0; z-index: 30; background: rgba(20,10,8,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.panel {
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; background: var(--bg);
  border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
.panel h3 { font-size: 18px; margin-bottom: 12px; }
.cart-line { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.cl-name { flex: 1; font-size: 15px; }
.cl-sum { min-width: 64px; text-align: right; font-weight: 600; color: var(--brand); }
.note {
  width: 100%; margin: 6px 0 10px; padding: 10px 12px; border-radius: 12px; resize: vertical;
  border: 1.5px solid var(--line); font: 14px 'Prompt', sans-serif; background: #fff;
}
.cart-total { display: flex; justify-content: space-between; font-size: 17px; margin: 4px 2px 12px; }
.cart-total b { color: var(--brand); }
.send {
  width: 100%; border: 0; border-radius: 14px; padding: 15px; cursor: pointer;
  background: var(--brand); color: #fff; font: 600 16px 'Prompt', sans-serif;
}
.send:disabled { opacity: .6; }
.pay-note { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.err { color: #C0392B; font-size: 14px; margin: 0 2px 10px; }

.big-no { text-align: center; font-size: 46px; font-weight: 700; color: var(--brand); }
.st-table { text-align: center; color: var(--muted); margin-bottom: 14px; }
.steps { list-style: none; display: flex; gap: 6px; margin-bottom: 12px; }
.steps li {
  flex: 1; text-align: center; font-size: 12.5px; padding: 8px 4px; border-radius: 10px;
  background: #fff; color: var(--muted); border: 1.5px solid var(--line);
}
.steps li.done { background: var(--brand); border-color: var(--brand); color: #fff; }
.st-now { text-align: center; font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.st-now.err { color: #C0392B; }
.st-items { list-style: none; background: #fff; border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; font-size: 14px; }
.st-items li { padding: 3px 0; }
.st-total { text-align: center; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
