/* =====================================================================
   BÉ NỐC — bộ màu và thành phần dùng chung, lấy theo tờ menu giấy:
   nền kem, chữ nâu ca cao, hồng đỏ của chữ "BÉ NỐC", mỗi danh mục một màu khung.
   Chủ ý chỉ dùng giao diện sáng để giống menu in.
   ===================================================================== */
:root {
  --bg: #FBF1DF;          /* nền kem của tờ menu */
  --paper: #FFF8EC;       /* nền trong các khung danh mục */
  --card: #FFFFFF;
  --ink: #3B2A24;         /* chữ nâu ca cao */
  --ink-2: #7E675C;
  --line: #EBD9BE;
  --red: #E2325C;         /* hồng đỏ của chữ "BÉ NỐC ĂN VẶT" và giá */
  --red-ink: #FFFFFF;
  --red-soft: #FCDDE6;
  --ok: #2E8A55; --ok-soft: #DFF2E5;
  --warn: #A85A06; --warn-soft: #FFEFCF;
  --danger: #C2352E; --danger-soft: #FCE3E0;
  --scrim: rgba(59, 42, 36, .42);
  --shadow: 0 4px 18px rgba(59, 42, 36, .12);
  --f-hand: "Mali", "Comic Neue", "Segoe Print", system-ui, sans-serif;
  --f-head: "Baloo 2", "Nunito", "Segoe UI Rounded", system-ui, sans-serif;
  --f-body: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
/* Màu khung (--cb) và nền tiêu đề (--ch) của từng danh mục, giống từng ô trên menu */
.cc-vang      { --cb: #F2A33C; --ch: #FFD966; }
.cc-cam       { --cb: #F0943A; --ch: #FFCF86; }
.cc-hong      { --cb: #EA6A8B; --ch: #F9C2D1; }
.cc-xanhla    { --cb: #78B567; --ch: #CDE8BD; }
.cc-xanhduong { --cb: #65A6DC; --ch: #C6E2F7; }
.cc-tim       { --cb: #A47ACB; --ch: #E3D3F3; }
.cc-nau       { --cb: #B7835F; --ch: #F0DACA; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--ink); font: 400 15px/1.5 var(--f-body); -webkit-tap-highlight-color: transparent; }
body.locked { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 640px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

/* ---------- Nút ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; background: var(--red); color: var(--red-ink); font-weight: 600; padding: 10px 18px; min-height: 46px; text-align: center; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-soft { background: var(--red-soft); color: var(--red); }
.btn-line { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.link { border: 0; background: none; color: var(--red); font-weight: 600; padding: 4px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Ô nhập ---------- */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.field input, .field textarea, .field select { border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; font-size: 16px; font-weight: 400; color: var(--ink); width: 100%; min-width: 0; }
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--red); outline: none; }
.field.invalid input { border-color: var(--warn); background: var(--warn-soft); }
.req { color: var(--red); }
.msg { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 500; }
.msg-ok { background: var(--ok-soft); color: var(--ok); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; } }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-mute { background: var(--line); color: var(--ink-2); }
.tag { display: inline-block; vertical-align: 2px; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: #FFD966; color: #5B3D00; font: 600 11px/1.6 var(--f-body); white-space: nowrap; }

/* Công tắc bật/tắt */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--red); outline-offset: 2px; }

/* Bộ tăng giảm số lượng */
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; flex: none; background: var(--card); }
.stepper button { width: 40px; height: 44px; border: 0; background: none; font: 800 20px/1 var(--f-head); color: var(--red); }
.stepper button:disabled { color: var(--line); }
.stepper output { min-width: 28px; text-align: center; font: 700 18px/1 var(--f-head); }
.stepper--sm button { width: 32px; height: 34px; font-size: 18px; }
.stepper--sm output { min-width: 22px; font-size: 16px; }

/* Ảnh món: khung vuông, món chưa có ảnh hiện biểu tượng trên nền màu danh mục */
.thumb { width: 68px; height: 68px; border-radius: 14px; overflow: hidden; flex: none; background: var(--ch, var(--line)); display: grid; place-items: center; border: 1.5px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb svg { width: 34px; height: 34px; color: var(--ink); opacity: .55; }

/* ---------- Bảng trượt ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 640px; max-height: calc(92% - env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; background: var(--card); border-radius: 22px 22px 0 0; box-shadow: var(--shadow); outline: none; }
.sheet--wide { max-width: 760px; }
@media (min-width: 760px) { .overlay { align-items: center; } .sheet { border-radius: 22px; max-height: 88%; } }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: rise .2s ease-out; } }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sh-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px max(18px, env(safe-area-inset-right, 0px)) 10px max(18px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); }
.sh-title { min-width: 0; }
.sh-head h3 { margin: 0; font: 800 22px/1.2 var(--f-head); text-wrap: balance; }
.sh-head p { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
.x { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink); display: grid; place-items: center; padding: 0; }
.x svg { width: 18px; height: 18px; }
.sh-body { overflow-y: auto; padding: 12px max(18px, env(safe-area-inset-right, 0px)) 16px max(18px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; }
.sh-foot { padding: 12px max(18px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sh-foot .grow { flex: 1; }

.toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 80; background: var(--ink); color: #FFF8EC; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; max-width: calc(100% - 32px); text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.on { opacity: 1; }

/* Ô số thứ tự kiểu vé giấy */
.qbox { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px dashed var(--red); border-radius: 12px; padding: 6px 4px; background: var(--card); }
.qbox span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); font-weight: 600; }
.qbox b { font: 800 38px/1 var(--f-head); color: var(--red); }
.qbox--mv { border-style: solid; border-color: var(--warn); background: var(--warn-soft); color: var(--warn); gap: 2px; }
.qbox--mv svg { width: 30px; height: 30px; }
.qbox--mv span { color: var(--warn); font-weight: 800; letter-spacing: .04em; white-space: nowrap; }

.empty { text-align: center; color: var(--ink-2); padding-block: 24px; }
.loading { color: var(--ink-2); padding-block: 24px; }

/* Nhãn thông báo chế độ xem thử */
.demo-note { background: #FFD966; color: #5B3D00; font-size: 13px; }
.demo-note .wrap { padding-block: 8px; }
.demo-note a { color: inherit; font-weight: 700; }

/* Thanh "Chế độ test" (chỉ bản xem thử) — màu nâu đậm để tách khỏi giao diện thật */
.testbar { background: #3B2A24; color: #FFF8EC; }
.envbar { background: repeating-linear-gradient(135deg, #F4C430 0 14px, #3B2A24 14px 28px); color: #3B2A24; text-align: center; padding: 6px 12px; font-size: 13px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; }
.envbar b, .envbar span { background: #F4C430; padding: 1px 8px; border-radius: 6px; }
.envbar b { letter-spacing: .06em; }
.testbar-in { max-width: 980px; margin: 0 auto; padding-block: 8px 10px; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 6px; }
.tb-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; letter-spacing: .02em; opacity: .9; }
.tb-help { border: 1.5px solid rgba(255, 248, 236, .5); background: none; color: #FFF8EC; border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 600; }
.tb-roles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.tb-roles a { position: relative; display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 4px 3px; border-radius: 10px; background: rgba(255, 248, 236, .1); color: #FFF8EC; text-decoration: none; font-weight: 600; font-size: 13px; text-align: center; line-height: 1.2; }
.tb-roles a[aria-current="page"] { background: #FFF8EC; color: #3B2A24; }
.tb-roles a:focus-visible { outline: 3px solid #FFD966; outline-offset: 2px; }
.tb-badge { position: absolute; top: -5px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #E2325C; color: #fff; font: 700 12px/20px var(--f-body); text-align: center; }
.tg-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.tg-steps li { padding-left: 4px; }
.inline-test-reset { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
