:root {
  --bg: #1c1917; --panel: #292524; --panel2: #3a3532; --ink: #fafaf9; --muted: #a8a29e; --line: #44403c;
  --accent: #ea580c; --accent2: #fb923c; --ok: #22c55e; --bad: #ef4444; --warn: #eab308; --seat: #57534e;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif; background: var(--bg);
  color: var(--ink); font-size: 16px; overflow: hidden; user-select: none; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; background: var(--panel2); border-radius: 10px; }
button:active { transform: scale(.97); }
button:disabled { opacity: .4; }
input { font: inherit; }
.app { display: grid; grid-template-rows: 54px 1fr; height: 100vh; height: 100dvh; }
.top { display: flex; align-items: center; gap: 8px; padding: 0 12px; background: #0c0a09; border-bottom: 1px solid var(--line); }
.top .store { font-weight: 700; margin-right: 8px; white-space: nowrap; }
.top .tabs { display: flex; gap: 6px; }
.top .tabs button { padding: 8px 16px; background: transparent; color: var(--muted); }
.top .tabs button.on { background: var(--accent); color: #fff; }
.top .right { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); white-space: nowrap; }
.top .right a { color: var(--muted); text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; }
.view { overflow: hidden; height: 100%; }
.hidden { display: none !important; }

/* floor */
.floor-view { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.area-tabs { display: flex; gap: 6px; padding: 10px 12px; overflow-x: auto; }
.area-tabs button { padding: 8px 18px; white-space: nowrap; }
.area-tabs button.on { background: var(--ink); color: var(--bg); }
.floor-scroll { overflow: auto; padding: 4px 12px 16px; }
.floor { display: grid; gap: 6px; }
.fcell { border-radius: 6px; background: #231f1d; display: grid; place-items: center; font-size: 12px; color: var(--muted); }
.fcell.entrance { background: #14532d; } .fcell.counter { background: #1e3a8a; }
.fcell.restroom { background: #4c1d95; } .fcell.blocked { background: #3f3f46; }
.seat { background: var(--seat); border-radius: 10px; padding: 6px 8px; display: flex; flex-direction: column; text-align: left;
  justify-content: space-between; min-height: 0; overflow: hidden; }
.seat .nm { font-size: 20px; font-weight: 700; }
.seat .info { font-size: 13px; color: #e7e5e4; line-height: 1.3; }
.seat.busy { background: var(--accent); }
.seat.busy.pending { box-shadow: inset 0 0 0 3px var(--warn); }
.seat.long { background: #b91c1c; }

/* lists */
.list-view { padding: 12px; overflow-y: auto; height: 100%; }
.list-view .bar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.ocard { background: var(--panel); padding: 12px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.ocard .no { font-size: 22px; font-weight: 700; }
.ocard .muted { color: var(--muted); font-size: 13px; }
.big { padding: 12px 20px; font-size: 17px; }
.primary { background: var(--accent); color: #fff; }
.ok { background: #15803d; color: #fff; }
.danger { background: #7f1d1d; color: #fff; }
table.hist { width: 100%; border-collapse: collapse; }
table.hist td, table.hist th { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.hist .num { text-align: right; font-variant-numeric: tabular-nums; }

/* order */
.order-view { display: grid; grid-template-columns: minmax(320px, 38%) 1fr; height: 100%; }
.ticket { background: var(--panel); display: grid; grid-template-rows: auto 1fr auto auto; min-height: 0; border-right: 1px solid var(--line); }
.ticket .head { padding: 10px 12px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.ticket .head .title { font-size: 20px; font-weight: 700; }
.ticket .head .sub { color: var(--muted); font-size: 13px; }
.ticket .head .back { margin-left: auto; padding: 8px 14px; }
.lines { overflow-y: auto; padding: 4px 0; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 12px; border-bottom: 1px solid #34302d; }
.line .n { font-weight: 600; }
.line .o { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.line .p { text-align: right; font-variant-numeric: tabular-nums; }
.line .st { font-size: 12px; padding: 1px 6px; border-radius: 6px; margin-left: 6px; background: var(--panel2); color: var(--muted); }
.line .st.sent { background: #713f12; color: #fde68a; } .line .st.done { background: #14532d; color: #bbf7d0; }
.line.draft { background: #3b2416; }
.line.void { opacity: .4; text-decoration: line-through; }
.line.sel { outline: 2px solid var(--accent2); outline-offset: -2px; }
.line-actions { display: flex; gap: 6px; grid-column: 1 / -1; margin-top: 6px; }
.line-actions button { padding: 6px 12px; font-size: 14px; }
.sums { padding: 8px 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.sums div { display: flex; justify-content: space-between; }
.sums .total { color: var(--ink); font-size: 24px; font-weight: 700; margin-top: 4px; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px; }
.actions button { padding: 14px 4px; font-size: 15px; }
.menu { display: grid; grid-template-rows: auto auto 1fr; min-height: 0; }
.cat-tabs { display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; }
.cat-tabs button { padding: 8px 14px; white-space: nowrap; font-size: 15px; }
.cat-tabs button.on { background: var(--ink); color: var(--bg); }
.search { padding: 0 10px 6px; }
.search input { width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.products { overflow-y: auto; padding: 4px 10px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; align-content: start; }
.pbtn { background: var(--panel); padding: 10px; min-height: 76px; text-align: left; display: flex; flex-direction: column; justify-content: space-between; }
.pbtn .pn { font-weight: 600; line-height: 1.25; }
.pbtn .pp { color: var(--accent2); font-variant-numeric: tabular-nums; }
.pbtn.off { opacity: .35; }
.pbtn .dot { color: var(--muted); font-size: 12px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 12px; }
.modal { background: var(--panel); border-radius: 14px; width: min(560px, 100%); max-height: 92vh; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.modal header { padding: 14px 16px; font-size: 19px; font-weight: 700; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.modal .body { padding: 12px 16px; overflow-y: auto; }
.modal footer { padding: 10px 16px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); }
.modal footer button { padding: 12px 22px; }
.grp { margin-bottom: 14px; }
.grp .gh { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.grp .gh b { color: var(--ink); font-size: 16px; }
.grp .req { color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 10px 14px; position: relative; }
.chip.on { background: var(--accent); color: #fff; }
.chip .cnt { position: absolute; top: -6px; right: -6px; background: var(--ink); color: var(--bg); border-radius: 999px; font-size: 12px; padding: 0 6px; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 46px; height: 46px; font-size: 22px; }
.stepper .v { font-size: 22px; min-width: 40px; text-align: center; }
.field { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.keypad button { padding: 14px; font-size: 20px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.amount-box { font-size: 30px; font-weight: 700; text-align: right; padding: 8px 12px; background: var(--bg); border-radius: 10px; font-variant-numeric: tabular-nums; }
.pay-rows div { display: flex; justify-content: space-between; padding: 4px 0; font-variant-numeric: tabular-nums; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #0c0a09; border: 1px solid var(--line); padding: 12px 20px; border-radius: 10px; z-index: 99; max-width: 90vw; }
.toast.err { border-color: var(--bad); color: #fecaca; }

@media (max-width: 760px) {
  .top .store { display: none; }
  .order-view { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
  .ticket { border-right: 0; border-bottom: 1px solid var(--line); }
  .actions button { padding: 10px 2px; font-size: 14px; }
  .pay-grid { grid-template-columns: 1fr; }
  .products { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
/* 交班 */
.shift-sum { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.shift-sum td { padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.shift-sum td.num { text-align: right; }
label.fl { display: block; margin: 8px 0; color: var(--muted); font-size: 14px; }
label.fl .field { margin-top: 4px; }
.shift-diff { margin: 6px 0; font-size: 14px; }
