:root {
  --brand: #f28e3a;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #ececec;
  --bg: #f7f4f0;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center;
  padding: 12px 16px 10px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.store { font-size: 17px; font-weight: 800; }
.table { margin-top: 2px; font-size: 14px; font-weight: 700; color: var(--brand); }
.cats {
  position: sticky; top: 58px; z-index: 19;
  display: flex; gap: 8px; overflow-x: auto;
  padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto; border: 0; border-radius: 999px;
  padding: 8px 14px; font-size: 14px; font-weight: 700;
  background: #f3f4f6; color: var(--ink);
}
.cat.is-on { background: var(--brand); color: #fff; }
.list { padding: 8px 12px 96px; }
.sec-title { margin: 16px 4px 8px; font-size: 16px; font-weight: 800; }
.item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; margin-bottom: 8px; padding: 12px;
  border: 0; border-radius: 16px; background: #fff; text-align: left;
}
.item img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; background: #eee; }
.item-name { flex: 1; font-size: 16px; font-weight: 800; }
.item-price { font-size: 16px; font-weight: 800; color: var(--brand); }
.item-add {
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 22px; font-weight: 800;
}
.cart-bar {
  position: fixed; left: 12px; right: 12px; bottom: 16px; z-index: 25;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 54px; padding: 0 18px; border: 0; border-radius: 999px;
  background: #1f2937; color: #fff; font-size: 16px; font-weight: 800;
}
.sheet-mask { position: fixed; inset: 0; z-index: 30; background: rgba(17,24,39,.45); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  max-height: 86vh; overflow: auto;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0; background: #fff;
}
.sheet-handle { width: 40px; height: 4px; margin: 6px auto 12px; border-radius: 999px; background: #d1d5db; }
.sheet h2 { margin: 0 0 6px; font-size: 20px; }
.option-price { margin-bottom: 12px; font-weight: 800; color: var(--brand); }
.opt-group { margin-bottom: 14px; }
.opt-title { margin-bottom: 8px; font-size: 15px; font-weight: 800; }
.req { margin-left: 6px; color: #ef4444; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid #e5e7eb; border-radius: 14px; background: #fff;
  padding: 8px 12px; font-size: 14px; font-weight: 700;
}
.chip.is-on { border-color: var(--brand); background: #fff4ea; color: var(--brand); }
.remark-label { display: block; margin: 10px 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.remark-label input {
  display: block; width: 100%; margin-top: 6px; padding: 12px;
  border: 1px solid #e5e7eb; border-radius: 12px; font-size: 16px;
}
.sheet-error { min-height: 20px; color: #ef4444; font-weight: 700; }
.sheet-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.qty { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.qty button, .line-qty button {
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 20px; font-weight: 800;
}
.btn-main, .btn-ghost {
  min-height: 46px; border: 0; border-radius: 14px; padding: 0 16px;
  font-size: 16px; font-weight: 800;
}
.btn-main { background: var(--brand); color: #fff; }
.btn-ghost { background: #f3f4f6; }
.btn-block { width: 100%; margin-top: 12px; }
.cart-line { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line b { flex: 1; }
.cart-total { margin-top: 12px; font-size: 20px; font-weight: 800; text-align: right; }
.success { min-height: 100vh; padding: 80px 24px; text-align: center; background: #fff; }
.success-kicker { color: var(--muted); font-weight: 700; }
.success-table { font-size: 20px; font-weight: 800; }
.success-no { margin: 8px 0; font-size: 64px; font-weight: 900; color: var(--brand); letter-spacing: 2px; }
.success-hint { color: var(--muted); }
.success .btn-main { margin-top: 28px; min-width: 180px; }
.blocked { padding: 80px 24px; text-align: center; font-size: 18px; font-weight: 800; }
.voice-dock {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 24;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}
body.has-cart .voice-dock {
  bottom: calc(86px + env(safe-area-inset-bottom));
}
.voice-dock > * { pointer-events: auto; }
.voice-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.mic-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(242, 142, 58, .35);
}
.mic-bar.recording {
  background: #f04438;
  animation: posMicPulse 1s ease-in-out infinite;
}
.mic-bar.busy { background: #667085; cursor: wait; }
.text-toggle {
  width: 56px;
  height: 56px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  color: #4b5563;
}
.text-toggle.is-open {
  border-color: var(--brand);
  background: #fff4ea;
  color: var(--brand);
}
.text-chat-panel {
  display: none;
  width: 100%;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(17, 24, 39, .12);
}
.text-chat-panel:not(.hidden) { display: flex; align-items: center; gap: 8px; }
.text-chat-panel input {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
}
.text-chat-panel button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}
.pos-mic-hint {
  display: none;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(17, 24, 39, .88);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}
.pos-mic-hint.show { display: block; }
.pos-toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 40;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  pointer-events: none;
  max-width: 90vw;
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(17, 24, 39, .92);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  transition: .25s;
}
body.has-cart .pos-toast { bottom: calc(158px + env(safe-area-inset-bottom)); }
.pos-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@keyframes posMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 68, 56, .55); }
  50% { box-shadow: 0 0 0 10px rgba(240, 68, 56, 0); }
}
.tables { padding: 16px; }
.table-card {
  display: inline-block; width: 180px; margin: 8px; padding: 12px;
  border-radius: 16px; background: #fff; text-align: center;
}
.table-card img { width: 140px; height: 140px; }
.table-card b { display: block; margin-top: 8px; }
.table-card small { display: block; margin-top: 6px; word-break: break-all; font-size: 11px; color: var(--muted); }
