/* 雞蛋糕點餐：奶油白底、金黃主色、焦糖棕文字 */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #FBF6EE;
  --surface: #FFFFFF;
  --surface-2: #F5ECDF;
  --surface-3: #ECDFCC;
  --line: #EBDFCD;
  --ink: #3A2A1C;
  --ink-2: #7A6552;
  --ink-3: #A8937D;
  --brand: #EAA23A;
  --brand-hover: #E0952B;
  --brand-soft: #FCEBCB;
  --brand-deep: #A9641A;
  --ok: #3F8352;
  --ok-soft: #E2F0E4;
  --danger: #C24E37;
  --danger-soft: #F9E1DA;
  --shadow: 0 1px 2px rgba(58, 42, 28, .06), 0 6px 20px rgba(58, 42, 28, .06);
  --shadow-lg: 0 24px 60px rgba(43, 30, 18, .28);
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  color-scheme: light;
}

html, body { height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
button:disabled { cursor: not-allowed; opacity: .42; }
svg { display: block; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* ---------- 頂部列 ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); }
.tab {
  position: relative;
  padding: 9px 24px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-2);
}
.tab.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(58, 42, 28, .14); }
.tab-badge {
  position: absolute;
  top: 0;
  right: 2px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.status { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
}
.mode-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.clock { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.update-btn { padding: 6px 12px; border-radius: 999px; background: var(--ink); color: var(--brand-soft); font-size: 14px; font-weight: 700; }

.view { flex: 1; min-height: 0; overflow: auto; }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .15s, transform .08s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--brand); color: var(--ink); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-soft { background: var(--brand-soft); color: var(--brand-deep); }
.btn-ghost { background: var(--surface-2); color: var(--ink-2); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { height: 38px; padding: 0 14px; border-radius: 10px; font-size: 15px; }
.btn-lg { height: 56px; padding: 0 26px; border-radius: 16px; font-size: 19px; }
.btn-xl { height: 66px; border-radius: 18px; font-size: 23px; letter-spacing: .08em; }
.btn-block { width: 100%; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-2);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.danger { background: transparent; color: var(--danger); }

.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(58, 42, 28, .15);
}

/* ---------- 點餐 ---------- */
.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 20px;
  height: 100%;
  padding: 20px;
}
.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(200px, 1fr);
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding: 2px;
}
.menu-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px 16px;
  border: 2px solid transparent;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .08s, border-color .15s, background .15s;
}
.menu-card:active { transform: scale(.97); }
.menu-card.in-cart { border-color: var(--brand); background: #FFFBF3; }
.menu-icon { width: 112px; height: 112px; margin-bottom: 6px; }
.menu-icon svg, .brand-mark svg { width: 100%; height: 100%; }
.menu-name { font-size: 27px; font-weight: 800; letter-spacing: .06em; }
.menu-price { font-size: 20px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.menu-qty {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--brand);
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.menu-card.bump .menu-qty { animation: bump .25s; }
@keyframes bump { 40% { transform: scale(1.28); } }

.cart {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px; }
.cart-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.no-pill {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.cart-lines { flex: 1; min-height: 0; overflow: auto; padding: 0 12px; }
.cart-line {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px dashed var(--line);
}
.cart-line:last-child { border-bottom: 0; }
.cart-line .name { display: block; font-size: 19px; font-weight: 800; line-height: 1.3; }
.cart-line .unit { display: block; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.stepper { display: flex; align-items: center; gap: 4px; }
.step {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-2);
}
.step svg { width: 20px; height: 20px; }
.step:active { background: var(--surface-3); }
.stepper .qty { min-width: 30px; text-align: center; font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.line-amt { min-width: 62px; text-align: right; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  min-height: 140px;
  padding: 20px;
  color: var(--ink-3);
  font-weight: 700;
  text-align: center;
}
.cart-empty svg { width: 76px; height: 76px; opacity: .5; }
.cart-empty p { margin: 0; }
.cart-note { padding: 12px 20px; border-top: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
  padding: 7px 14px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 700;
}
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--ink); }
.note-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  outline: none;
}
.note-input:focus { border-color: var(--brand); background: #fff; }
.cart-foot { padding: 12px 20px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.total-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.total-row span { font-size: 18px; font-weight: 800; color: var(--ink-2); }
.total-row small { margin-left: 6px; font-size: 14px; font-weight: 700; color: var(--ink-3); }
.total-row strong { font-size: 42px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cart-actions { display: grid; grid-template-columns: 1fr 2.3fr; gap: 10px; }
.cart-actions .btn-ghost { height: 66px; border-radius: 18px; }

/* ---------- 彈出視窗 ---------- */
#modal-root { position: relative; z-index: 50; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(43, 30, 18, .45);
  backdrop-filter: blur(3px);
  animation: fade .15s;
}
.modal-backdrop.closing { animation: fade .15s reverse forwards; pointer-events: none; }
.modal {
  width: min(880px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: 24px 28px 28px;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 24px; font-weight: 800; }
.modal-actions { display: flex; gap: 12px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }
.modal-confirm { width: min(460px, 100%); }
.modal-confirm h2 { margin: 4px 0 8px; font-size: 24px; font-weight: 800; }
.modal-confirm p { margin: 0; color: var(--ink-2); font-size: 17px; }

/* 結帳 */
.checkout-body { display: grid; grid-template-columns: 1fr 1.15fr; gap: 24px; margin-bottom: 20px; }
.checkout-summary { display: flex; flex-direction: column; padding: 16px 20px; border-radius: 20px; background: var(--bg); }
.sum-lines { flex: 1; }
.sum-line {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 18px;
  font-weight: 700;
}
.sum-line .x { color: var(--ink-2); }
.sum-line .amt { min-width: 60px; text-align: right; font-variant-numeric: tabular-nums; }
.sum-note { margin-top: 10px; color: var(--brand-deep); font-size: 15px; font-weight: 700; }
.sum-total { display: flex; align-items: baseline; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 2px solid var(--line); }
.sum-total span { font-size: 18px; font-weight: 800; color: var(--ink-2); }
.sum-total strong { font-size: 42px; font-weight: 900; font-variant-numeric: tabular-nums; }
.pay-display { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.pay-display > div { padding: 10px 16px; border-radius: 16px; background: var(--bg); }
.pay-display label { display: block; font-size: 14px; font-weight: 800; color: var(--ink-2); }
.pay-display strong { font-size: 32px; font-weight: 900; font-variant-numeric: tabular-nums; }
.pay-display .ph { color: var(--ink-3); }
.pay-display .change { color: var(--ok); }
.pay-display.short .change { color: var(--danger); font-size: 22px; }
.quick-cash { display: grid; gap: 8px; margin-bottom: 8px; }
.quick-cash .btn { height: 50px; padding: 0 6px; font-size: 17px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key { height: 54px; border-radius: 14px; background: var(--surface-2); font-size: 24px; font-weight: 800; }
.key:active { background: var(--surface-3); }

/* 出單成功 */
.modal-success { width: min(820px, 100%); }
.success-body { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 24px; }
.success-main { padding: 6px 0; text-align: center; }
.success-check {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
}
.success-check svg { width: 30px; height: 30px; stroke-width: 3; }
.success-label { font-size: 18px; font-weight: 800; color: var(--ink-2); }
.success-no {
  margin: 4px 0 12px;
  color: var(--brand-deep);
  font-size: 132px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
.success-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 19px; font-weight: 700; }
.success-note { margin-top: 6px; color: var(--brand-deep); font-weight: 700; }
.success-money { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.success-money > div { padding: 10px; border-radius: 14px; background: var(--bg); }
.success-money span { display: block; font-size: 13px; font-weight: 800; color: var(--ink-2); }
.success-money b { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.success-money .hl { background: var(--ok-soft); }
.success-money .hl b { color: var(--ok); }

/* 收據預覽（白色感熱紙＋鋸齒底邊） */
.paper-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  max-height: 62dvh;
  overflow: auto;
  padding: 20px 20px 28px;
  border-radius: 20px;
  background: var(--surface-2);
}
.paper-shadow { filter: drop-shadow(0 3px 8px rgba(58, 42, 28, .18)); }
.paper {
  --tooth: 7px;
  width: 236px;
  padding: 12px 8px calc(var(--tooth) + 10px);
  background: #fff;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--tooth)) 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--tooth)) 100%;
}
.paper img { display: block; width: 100%; height: auto; }
.modal-receipt { width: min(440px, 100%); }

/* ---------- 一般頁面 ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-meta { color: var(--ink-2); font-weight: 700; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  color: var(--ink-2);
  font-weight: 800;
}
.seg-btn.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(58, 42, 28, .14); }
.seg-count {
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 13px;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.seg-btn.on .seg-count { background: var(--brand-soft); color: var(--brand-deep); }
.card { padding: 18px 20px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.card h3 { margin: 0 0 14px; font-size: 18px; font-weight: 800; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.empty { padding: 80px 20px; color: var(--ink-3); font-size: 18px; font-weight: 700; text-align: center; }
.empty.small { padding: 40px 10px; font-size: 16px; }
.hint { margin: 10px 0 0; color: var(--ink-3); font-size: 14px; }
.hint.warn { color: var(--brand-deep); font-weight: 700; }

/* 訂單 */
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.order-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px 16px;
  border-top: 6px solid var(--brand);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.order-card.s-ready { border-top-color: var(--ok); }
.order-card.s-void { border-top-color: var(--ink-3); opacity: .6; }
.order-card header { display: flex; align-items: center; gap: 10px; }
.order-no { font-size: 32px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pill { padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.p-making { background: var(--brand-soft); color: var(--brand-deep); }
.p-ready { background: var(--ok-soft); color: var(--ok); }
.p-void { background: var(--surface-2); color: var(--ink-2); }
.order-time { margin-left: auto; color: var(--ink-2); font-size: 14px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.order-time.late { color: var(--danger); }
.order-lines { margin: 0; padding: 0; list-style: none; }
.order-lines li { display: flex; justify-content: space-between; padding: 2px 0; font-size: 19px; font-weight: 800; }
.order-lines li span:last-child { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.order-note { padding: 6px 10px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-deep); font-size: 15px; font-weight: 700; }
.order-card footer { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); }
.order-card footer strong { margin-right: auto; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.s-void .order-lines, .s-void footer strong { text-decoration: line-through; }

/* 報表 */
.day-nav { display: flex; align-items: center; gap: 10px; }
.day-label { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.today-tag { padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-deep); font-size: 13px; }
.head-actions { display: flex; gap: 10px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { padding: 16px 20px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.kpi span { display: block; color: var(--ink-2); font-size: 15px; font-weight: 800; }
.kpi strong { font-size: 36px; font-weight: 900; font-variant-numeric: tabular-nums; }
.kpi small { margin-left: 4px; color: var(--ink-2); font-size: 16px; font-weight: 700; }
.kpi.hero { background: var(--ink); }
.kpi.hero span { color: var(--brand-soft); opacity: .8; }
.kpi.hero strong { color: var(--brand); }
.report-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }
.item-table { width: 100%; border-collapse: collapse; }
.item-table th { padding: 6px 8px; border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: 13px; font-weight: 800; text-align: left; }
.item-table td { padding: 10px 8px; border-bottom: 1px dashed var(--line); font-size: 17px; font-weight: 700; }
.item-table tr:last-child td { border-bottom: 0; }
.item-table td .dot { margin-right: 8px; vertical-align: -1px; }
.item-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.item-table .bar-col { width: 36%; }
.bar-wrap { display: flex; align-items: center; gap: 8px; }
.bar { flex: 1; height: 10px; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(58, 42, 28, .1); }
.pct { width: 40px; color: var(--ink-2); font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.hour-chart { display: flex; align-items: flex-end; gap: 6px; height: 230px; }
.hour-col { display: flex; flex: 1; flex-direction: column; align-items: center; gap: 4px; min-width: 0; height: 100%; }
.hour-bar { display: flex; align-items: flex-end; flex: 1; width: 100%; max-width: 38px; overflow: hidden; border-radius: 8px; background: var(--bg); }
.hour-bar i { display: block; width: 100%; border-radius: 8px 8px 0 0; background: var(--brand); }
.hour-val { height: 18px; color: var(--ink-2); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hour-label { color: var(--ink-3); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 設定 */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: span 2; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: 14px; font-weight: 800; }
.field small, .switch-row small { display: block; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.field input, .field select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  outline: none;
  font-size: 17px;
}
.field input:focus, .field select:focus { border-color: var(--brand); background: #fff; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.switch-row > span:first-child { font-weight: 800; }
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .15s; }
.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .15s;
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(22px); }
.menu-edit-head, .menu-row { display: grid; grid-template-columns: 48px 1fr 140px 72px 44px; align-items: center; gap: 12px; }
.menu-edit-head { padding-bottom: 6px; color: var(--ink-3); font-size: 13px; font-weight: 800; }
.menu-row { padding: 8px 0; border-top: 1px dashed var(--line); }
.menu-row .name {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  outline: none;
  font-size: 18px;
  font-weight: 800;
}
.price-input { display: flex; align-items: center; height: 46px; padding-left: 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); }
.price-input span { color: var(--ink-2); font-weight: 800; }
.price-input input { width: 100%; height: 100%; padding: 0 8px; border: 0; background: transparent; outline: none; font-size: 18px; font-weight: 800; }
.price-input:focus-within, .menu-row .name:focus { border-color: var(--brand); background: #fff; }
.color-pick {
  position: relative;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(58, 42, 28, .14);
  cursor: pointer;
}
.color-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.stat-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 12px; font-weight: 700; }
.stat-line .ok { color: var(--ok); }
.stat-line .warn { color: var(--brand-deep); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.version { margin: 20px 0 8px; color: var(--ink-3); font-size: 13px; text-align: center; }
.fatal { max-width: 560px; margin: 80px auto; padding: 24px; text-align: center; }

/* ---------- 提示訊息 ---------- */
#toast-root {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-weight: 700;
  white-space: nowrap;
  pointer-events: auto;
  animation: pop .2s;
}
.toast button { padding: 4px 6px; color: var(--brand); font-weight: 900; }
.toast.out { opacity: 0; transition: opacity .2s; }

/* ---------- 列印（系統列印時只印收據圖） ---------- */
#print-area { display: none; }
@media print {
  html, body { display: block; height: auto; overflow: visible; background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; text-align: center; }
  #print-area img { display: inline-block; }
}

/* ---------- 較小的平板 ---------- */
@media (max-width: 1100px) {
  .order-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; padding: 16px; }
  .menu-grid { gap: 12px; grid-auto-rows: minmax(180px, auto); }
  .menu-icon { width: 76px; height: 76px; }
  .menu-name { font-size: 24px; }
  .tab { padding: 9px 18px; }
}

/* ---------- 直放平板／手機 ---------- */
@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; gap: 10px 12px; padding-left: 16px; padding-right: 16px; }
  .tabs { grid-column: 1 / -1; order: 3; }
  .tab { flex: 1; padding: 8px 0; }
  .order-layout { grid-template-columns: 1fr; height: auto; padding: 16px; }
  .menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(160px, auto); overflow: visible; }
  .cart { overflow: visible; }
  .cart-lines { overflow: visible; }
  .cart-foot { position: sticky; bottom: 0; border-radius: 0 0 26px 26px; box-shadow: 0 -10px 24px rgba(58, 42, 28, .07); }
  .checkout-body, .success-body { grid-template-columns: 1fr; }
  .success-body .paper-wrap { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .report-grid, .settings-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page { padding: 16px; }
}
@media (max-width: 600px) {
  .status .mode-pill { display: none; }
  .menu-icon { width: 64px; height: 64px; }
  .menu-name { font-size: 22px; }
  .success-no { font-size: 104px; }
  .modal { padding: 20px; }
  .menu-edit-head { display: none; }
  .menu-row { grid-template-columns: 44px 1fr 56px 44px; grid-template-areas: "c n n d" ". p s ."; }
  .color-pick { grid-area: c; }
  .menu-row .name { grid-area: n; }
  .price-input { grid-area: p; }
  .menu-row .switch { grid-area: s; }
  .menu-row .icon-btn { grid-area: d; }
}
