/* 天津狗不理包子 Restaurant OS: 茶記水牌 (cha chaan teng menu board).
   Cream paper, diner green, red prices, yellow stickers, 2px ink rules.
   Shape rules: controls 4px, panels 8px, phone sheets 18px top corners,
   round only for stickers and stamps. Primary buttons sit on a 4px ink ledge.
   Light only: the brand is printed paper. The kitchen screen sets its own green board. */
:root {
  --paper: #fbf5e4;
  --paper-2: #f3e9cf;
  --paper-3: #efe2bf;
  --shelf: #efe5c9;
  --ink: #1d1a16;
  --ink-2: #3d362c;
  --muted: #5b5243;
  --rule: #b9a97f;
  --green: #11653d;
  --green-deep: #0e3b25;
  --green-soft: #dcebdf;
  --red: #cf2a1f;
  --red-deep: #a8211a;
  --red-soft: #f7ddd6;
  --yellow: #f7c318;
  --yellow-soft: #fbe9a8;

  /* Role tokens used across the surfaces. */
  --bg: var(--paper);
  --surface: #fdf9ec;
  --surface-2: var(--paper-2);
  --surface-3: var(--paper-3);
  --line: var(--ink);
  --accent: var(--red);
  --accent-hover: var(--red-deep);
  --accent-ink: var(--paper);
  --accent-soft: var(--red-soft);
  --ok: var(--green);
  --ok-soft: var(--green-soft);
  --warn: #8a6300;
  --warn-soft: var(--yellow-soft);
  --info: var(--green);
  --info-soft: var(--green-soft);
  --danger: var(--red);
  --shadow: 0 10px 30px rgb(60 40 10 / 18%);
  --ledge: 0 4px 0 var(--ink);
  --r-ctl: 4px;
  --r-panel: 8px;
  --font: "Noto Sans HK", "Noto Sans TC", system-ui, -apple-system, "PingFang HK", sans-serif;
  --display: "Noto Serif HK", "Noto Serif TC", serif;
  --num: "Oswald", "Noto Sans HK", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
[x-cloak] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
a:hover { color: var(--red); }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 900; }
p { margin: 0; }
.num { font-family: var(--num); font-weight: 600; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.price { font-family: var(--num); font-weight: 700; color: var(--red); line-height: 1; }
.serif { font-family: var(--display); font-weight: 900; }
.caps { font-family: var(--num); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Brand mark: 包 set in serif on a red square with a yellow rule. Type, not artwork. */
.seal {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  background: var(--red); color: var(--paper); border: 2px solid var(--yellow); border-radius: 6px;
  font: 900 22px/1 var(--display);
}
.seal.lg { width: 60px; height: 60px; font-size: 34px; border-width: 3px; border-radius: 8px; }
.seal.inv { background: var(--yellow); color: var(--red); border-color: var(--ink); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; }
.brand small { display: block; font-weight: 500; font-size: 12px; opacity: .85; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--r-ctl);
  border: 2px solid var(--ink); background: var(--surface); color: var(--ink);
  font-weight: 900; white-space: nowrap; text-decoration: none; line-height: 1.1;
  transition: background .12s, transform .06s, box-shadow .06s;
}
.btn:hover { background: var(--paper-2); color: var(--ink); }
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--red); color: var(--paper); box-shadow: var(--ledge); }
.btn.primary:hover { background: var(--red-deep); color: var(--paper); }
.btn.primary:active, .btn.green:active, .btn.yellow:active { box-shadow: 0 2px 0 var(--ink); }
.btn.green { background: var(--green); color: var(--paper); box-shadow: var(--ledge); }
.btn.green:hover { background: #0d5532; color: var(--paper); }
.btn.yellow { background: var(--yellow); color: var(--ink); box-shadow: var(--ledge); }
.btn.yellow:hover { background: #eab60a; }
.btn.dark { background: var(--ink); color: var(--yellow); }
.btn.dark:hover { background: #000; color: var(--yellow); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--paper-2); }
.btn.danger { color: var(--red); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.lg { min-height: 56px; padding: 0 22px; font-size: 18px; }
.btn.block { width: 100%; }
.btn i { font-size: 1.15em; }
.icon-btn { width: 44px; padding: 0; }
.btn:focus-visible, .chip:focus-visible, .tile:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--yellow); outline-offset: 2px;
}

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 900; color: var(--ink); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-ctl);
  border: 2px solid var(--ink); background: var(--surface); color: var(--ink);
}
.input::placeholder { color: #7d705a; }
textarea.input { min-height: 80px; resize: vertical; }
.help { font-size: 12px; color: var(--muted); }
.error { font-size: 13px; color: var(--red); font-weight: 700; }

/* Chips: square-cornered menu-board tabs. Pressed is red; .opt pressed is green. */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border-radius: var(--r-ctl); border: 2px solid var(--ink); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: 14px; white-space: nowrap;
}
.chip[aria-pressed="true"], .chip.on { background: var(--red); color: var(--paper); font-weight: 900; }
.chip.opt[aria-pressed="true"] { background: var(--green); color: var(--paper); }
.chip.dark[aria-pressed="true"] { background: var(--ink); color: var(--yellow); }
.chip .d { font-family: var(--num); color: var(--red); font-weight: 600; }
.chip[aria-pressed="true"] .d { color: var(--yellow); }

/* Segmented control */
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: var(--r-ctl); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; height: 34px; padding: 0 14px; font-weight: 900; color: var(--ink); white-space: nowrap; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--yellow); }

/* Badges and tags */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 3px;
  font-size: 12px; font-weight: 900; background: var(--paper-2); color: var(--ink); white-space: nowrap;
  border: 1.5px solid var(--ink);
}
.badge.accent { background: var(--red); color: var(--paper); }
.badge.ok { background: var(--green); color: var(--paper); }
.badge.warn { background: var(--yellow); color: var(--ink); }
.badge.info { background: var(--green-soft); color: var(--green); }
.badge.solid { background: var(--ink); color: var(--yellow); }
.badge.plain { border-color: transparent; }
.tier { font-weight: 900; }
.tier-member { background: var(--paper-2); color: var(--ink); }
.tier-platinum { background: #e4e1d8; color: var(--ink); }
.tier-diamond { background: var(--surface); color: var(--green); border-color: var(--green); }
.tier-crown { background: var(--yellow); color: var(--ink); }
.status-pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 3px; background: var(--yellow); color: var(--ink); border: 2px solid var(--ink); font-weight: 900; font-size: 13px; white-space: nowrap; }
.status-pill.closed { background: var(--paper-2); color: var(--muted); }

/* Stickers and stamps: live HTML over photos, never baked into images. */
.sticker { position: absolute; top: -8px; left: -8px; z-index: 2; display: grid; place-items: center; font: 900 12px/1 var(--font); pointer-events: none; white-space: nowrap; }
.sticker.must { width: 38px; height: 38px; border-radius: 50%; background: var(--red); color: var(--paper); border: 2px solid var(--paper); box-shadow: 0 0 0 2px var(--red); transform: rotate(-12deg); font-size: 13px; }
.sticker.new { width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: var(--paper); border: 2px solid var(--ink); transform: rotate(-10deg); font-size: 15px; }
.sticker.rec { top: -6px; left: -6px; padding: 3px 6px; background: var(--yellow); color: var(--ink); border: 2px solid var(--ink); transform: rotate(-8deg); }
.sticker.ltd { top: -6px; left: -6px; padding: 3px 6px; background: var(--red); color: var(--paper); border: 2px solid var(--ink); transform: rotate(-8deg); }
.sticker.big.must { width: 48px; height: 48px; font-size: 15px; top: 10px; left: 10px; }
.sticker.big.new { width: 40px; height: 40px; font-size: 17px; top: 10px; left: 10px; }
.sticker.big.rec, .sticker.big.ltd { top: 12px; left: 12px; font-size: 14px; }
.stamp { display: inline-grid; place-items: center; border: 3px solid currentColor; color: var(--red); font: 900 20px/1.1 var(--display); transform: rotate(-10deg); padding: 4px 12px; background: rgb(253 249 236 / 85%); }
.stamp.round { width: 96px; height: 96px; border-radius: 50%; padding: 0; }
.soldout { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; }
.soldout > span { border: 3px solid var(--red); color: var(--red); background: rgb(253 249 236 / 90%); font: 900 20px/1 var(--display); padding: 6px 12px; transform: rotate(-12deg); }

/* Panels */
.panel { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--r-panel); }
.pad { padding: 16px; }
.hr { height: 0; border: 0; border-top: 1.5px dashed var(--rule); margin: 0; }
.band { background: var(--ink); color: var(--paper); padding: 8px 14px; display: flex; align-items: center; gap: 10px; }
.band h2, .band h3 { font: 900 20px var(--display); color: var(--yellow); }
.band .caps { font-size: 13px; }
.leader { display: flex; align-items: baseline; gap: 8px; }
.leader::after { content: ""; order: 1; flex: 1; border-bottom: 1.5px dotted var(--rule); transform: translateY(-4px); }
.leader > :last-child { order: 2; }

/* Sheet: modal that rises from the bottom on phones, centres on larger screens. */
.scrim { position: fixed; inset: 0; background: rgb(45 36 22 / 55%); z-index: 40; display: grid; place-items: center; padding: 16px; }
.sheet {
  width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--surface); border: 2px solid var(--ink); border-radius: var(--r-panel); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.sheet header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 2px solid var(--ink); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet header h3 { flex: 1; font: 900 20px var(--display); }
.sheet header h3 .caps { font-size: 13px; color: inherit; margin-left: 6px; }
.sheet header.red { background: var(--red); color: var(--paper); }
.sheet header .x { width: 36px; height: 36px; border: 2px solid currentColor; border-radius: var(--r-ctl); background: transparent; color: inherit; display: grid; place-items: center; font-size: 18px; }
.sheet .body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.sheet footer { display: flex; gap: 10px; padding: 14px 16px; border-top: 2px solid var(--ink); position: sticky; bottom: 0; background: var(--surface); }
@media (max-width: 640px) {
  .scrim.phone { align-items: end; padding: 0; }
  .scrim.phone .sheet { width: 100%; border-radius: 18px 18px 0 0; border-bottom: 0; max-height: 92dvh; }
}

/* Toasts */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--yellow); padding: 10px 16px; border-radius: var(--r-ctl); font-weight: 900; font-size: 14px; box-shadow: 0 4px 0 var(--red); animation: rise .25s cubic-bezier(.16,1,.3,1); }
.toast.bad { background: var(--red); color: var(--paper); box-shadow: var(--ledge); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Dish image: photo when mapped, typeset paper tile otherwise. */
.food { position: relative; overflow: hidden; width: 100%; height: 100%; display: grid; place-items: center; background: #f1e6c8; }
.food > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
.food.contain > img { object-fit: contain; background: #efe6cf; }
.food.type { background: repeating-linear-gradient(135deg, #efe2bf 0 7px, #f8efd6 7px 14px); color: #7a5b22; }
.food.type > span { font: 900 var(--fs, 24px)/1.1 var(--display); text-align: center; padding: 0 8%; }

/* Tables (data) */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 900; color: var(--yellow); background: var(--ink); font-size: 13px; padding: 9px 10px; white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1.5px dashed var(--rule); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover { background: var(--paper-2); }
.table.plain th { background: transparent; color: var(--muted); border-bottom: 2px solid var(--ink); }

.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.skeleton { background: repeating-linear-gradient(135deg, var(--paper-2) 0 10px, var(--paper) 10px 20px); background-size: 200% 100%; animation: shimmer 1.6s infinite linear; border-radius: var(--r-panel); }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
