/* 櫃台 POS — 平板橫向優先（1024~1366），觸控大按鈕，資料當主角 */
/* 櫃台尺寸級距：平板（預設）／小平板（≤1100）／電腦大螢幕（≥1500）。品項與分類的字級、各欄寬度都從這裡來 */
:root {
  --pos-cats: 132px;      /* 分類欄 */
  --pos-cart: 352px;      /* 購物車欄 */
  --pos-done: 250px;      /* 已完成欄（即點即交） */
  --pos-item-min: 158px;  /* 品項卡最小寬 */
  --pos-item-h: 124px;    /* 品項卡最小高 */
  --pos-item-fs: 22px;    /* 品名與價格 */
  --pos-cat-fs: 21px;     /* 分類 */
}
@media (min-width: 1500px) {
  :root { --pos-cats: 152px; --pos-cart: 400px; --pos-done: 290px; --pos-item-min: 184px; --pos-item-h: 136px; --pos-item-fs: 24px; --pos-cat-fs: 23px; }
}
@media (max-width: 1100px) {
  :root { --pos-cats: 116px; --pos-cart: 326px; --pos-done: 210px; --pos-item-min: 150px; --pos-item-h: 120px; --pos-item-fs: 21px; --pos-cat-fs: 20px; }
}

.screen { min-height: 100vh; }
[hidden] { display: none !important; }
.err { color: var(--red); min-height: 1.4em; font-size: 16px; margin-top: var(--s2); }
.small { font-size: 15px; }

/* Uber 補登：以墨色框與文字辨識，不新增通路色。 */
.cart.uber-mode { outline: 3px solid var(--ink); outline-offset: -3px; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.cart-head #btnUber { min-height: 56px; padding: 0 var(--s3); }
.cart-head #btnUber[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.uber-fields { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: var(--s2); padding: var(--s2) var(--s4); border-bottom: 1px solid var(--hair); }
.uber-mark { display: inline-block; padding: var(--s1) var(--s2); border: 3px solid var(--ink); letter-spacing: .12em; }
.uber-fields label { display: block; min-width: 0; margin-top: 0; font-size: 14px; color: var(--ink); }
.uber-fields input { display: block; width: 100%; min-width: 0; height: 48px; min-height: 48px; margin-top: var(--s1); padding: 0 var(--s3); background: var(--paper); color: var(--ink); border: 1px solid var(--hair); border-radius: var(--r); font-size: 20px; }
.uber-fields input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.uber-fields p { margin: var(--s2) 0 0; font-size: 14px; }
.uber-mode #cartTitle { font-size: 20px; }

/* 登入 */
#login, #pickStore { display: flex; align-items: center; justify-content: center; }
.login-card { width: min(420px, 92vw); background: var(--white); border: 1px solid var(--hair); border-radius: var(--r); padding: var(--s6) var(--s6) var(--s5); box-shadow: var(--shadow-sm); }
.brand { text-align: center; margin-bottom: var(--s5); }
.brand-mark { font-family: var(--serif); font-weight: 900; font-size: 40px; letter-spacing: .04em; line-height: 1; }
.brand-mark.sm { font-size: 22px; }
.brand-sub { color: var(--ink-3); font-size: 12px; letter-spacing: .18em; margin-top: var(--s3); }
#loginForm label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: var(--s3); }
#loginForm input { display: block; width: 100%; margin-top: var(--s1); height: 52px; padding: 0 var(--s3); border: 1px solid var(--hair); border-radius: var(--r); background: var(--paper); font-size: 18px; }
#loginForm input:focus { outline: none; border-color: var(--ink); }
#loginForm label.inline-check { display: flex; align-items: center; gap: var(--s2); min-height: 36px; }
#loginForm label.inline-check input { display: inline-block; width: 22px; height: 22px; margin: 0; padding: 0; accent-color: var(--red); }
#loginForm button { width: 100%; margin-top: var(--s2); font-size: 18px; }
.login-foot { text-align: center; margin-top: var(--s5); }
.pick-store-title { margin: 0 0 var(--s2); font-family: var(--serif); font-size: 26px; }
.store-picker { display: grid; gap: var(--s2); margin: var(--s4) 0; }
.store-picker button { min-height: 56px; margin: 0; text-align: left; }
.pick-store-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }

/* 頂欄 */
.topbar { height: 60px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; padding: 0 var(--s4); border-bottom: 1px solid var(--hair); background: var(--paper); position: sticky; top: 0; z-index: 10; }
.tb-left { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.tb-rule { width: 2px; height: 26px; background: var(--red); border-radius: 1px; }
.topbar .logo { height: 38px; }
.store-name { color: var(--ink-2); font-size: 17px; font-family: var(--serif); font-weight: 600; letter-spacing: .04em; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-tabs { display: flex; gap: var(--s1); background: var(--paper-2); padding: 3px; border-radius: var(--r); }
.tab { min-height: 48px; border: none; background: transparent; padding: 0 var(--s5); font-weight: 500; color: var(--ink-2); font-size: 19px; white-space: nowrap; }
.tab.active { background: var(--ink); color: var(--paper); font-weight: 700; }
.badge { display: inline-block; min-width: 24px; padding: 0 6px; border-radius: 12px; background: var(--red); color: var(--on-red); font-size: 14px; line-height: 24px; text-align: center; margin-left: 4px; }
.tb-right { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); font-size: 15px; color: var(--ink-2); min-width: 0; white-space: nowrap; }
.tb-right button.sm { font-size: 16px; min-height: 44px; }
.who-pos { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--hair) !important; background: var(--white) !important; flex: 0 1 auto; min-width: 0; }
.tb-status { margin-right: var(--s2); }
.queue-failed { min-height: 32px; padding: 0 var(--s2); border-color: var(--red); color: var(--red); background: var(--red-wash); font-size: 14px; white-space: nowrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink-3); display: inline-block; flex: 0 0 auto; }
.dot.ok { background: var(--green); } .dot.bad { background: var(--red); } .dot.warn { background: var(--warn); }

/* 新版本通知 */
.update-bar {
  position: sticky;
  top: 60px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 40px;
  padding: 0 var(--s4);
  background: var(--red);
  color: var(--paper);
  font-size: 16px;
  font-weight: 700;
}
.update-bar span { flex: 1; }
.update-bar button {
  min-height: 32px;
  border-color: var(--paper);
  background: transparent;
  color: var(--paper);
  white-space: nowrap;
}
.update-bar #updateNow {
  border-color: var(--paper);
  background: var(--paper);
  color: var(--red);
}

/* 點餐三欄 */
.view { height: calc(100vh - 60px); }
#viewOrder { display: grid; grid-template-columns: var(--pos-cats) minmax(0, 1fr) var(--pos-cart); }
#viewOrder.instant-serve { grid-template-columns: var(--pos-cats) minmax(0, 1fr) var(--pos-cart) var(--pos-done); }
.cats { border-right: 1px solid var(--hair); display: flex; flex-direction: column; overflow-y: auto; background: var(--paper-2); }
.cat { border: none; border-bottom: 1px solid var(--hair); border-radius: 0; background: transparent; min-height: 80px; font-family: var(--serif); font-weight: 600; font-size: var(--pos-cat-fs); text-align: left; padding: var(--s2) var(--s3); color: var(--ink-2); position: relative; line-height: 1.25; text-wrap: balance; }
.cat.active { background: var(--paper); color: var(--ink); }
.cat.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--red); }
.items-wrap { overflow-y: auto; padding: var(--s4); position: relative; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--pos-item-min), 1fr)); grid-auto-flow: row; gap: var(--s3); }
.item-heading { grid-column: 1 / -1; padding-top: var(--s1); border-bottom: 1px solid var(--hair); color: var(--ink-3); font-size: 15px; line-height: 1.5; }
.items .item.row-start { grid-column-start: 1; }
.item { min-height: var(--pos-item-h); display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left; padding: var(--s3); background: var(--white); position: relative; box-shadow: var(--shadow-sm); border-bottom: 2px solid var(--hair); }
.item:hover { border-bottom-color: var(--red); }
.item .n { font-weight: 700; font-size: var(--pos-item-fs); line-height: 1.25; text-wrap: balance; overflow-wrap: anywhere; }
.item .p { font-size: var(--pos-item-fs); color: var(--ink); align-self: flex-end; font-family: var(--serif); font-weight: 600; line-height: 1.2; }
.item .opt { position: absolute; top: auto; right: auto; font-size: 13px; color: var(--ink-3); border: 1px solid var(--hair); border-radius: 3px; padding: 1px 6px; left: var(--s3); bottom: var(--s3); line-height: 1.4; }
.item.soldout { background: var(--paper-3); color: var(--ink-3); }
.item.soldout::after { content: "售完"; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-weight: 900; font-size: 26px; color: var(--red); background: var(--soldout-veil); }
.item.soldout-edit { border-color: var(--red); }
.soldout-hint { background: var(--red-wash); color: var(--red); padding: var(--s2) var(--s3); border-radius: var(--r); margin-bottom: var(--s3); font-size: 16px; }

/* 購物車 */
.cart { border-left: 1px solid var(--hair); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--white); min-width: 0; min-height: 0; } /* min-height:0＝品項多時清單自己捲，不把結帳鈕擠出畫面 */
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--hair); font-size: 21px; font-weight: 600; }
.cart-head button.sm { font-size: 16px; min-height: 44px; }
.cart-head .serif::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--red); border-radius: 1px; margin-right: 8px; vertical-align: 2px; }
.cart-lines { overflow-y: auto; min-height: 0; }
.cart-empty { padding: var(--s7) var(--s4); text-align: center; background: url('/shared/brand/logo.png') center 30% / 150px auto no-repeat; opacity: .38; min-height: 240px; display: flex; align-items: flex-end; justify-content: center; }
.line { padding: var(--s2) var(--s4); border-bottom: 1px solid var(--hair); display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s3); }
.line .ln { font-weight: 700; font-size: 19px; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.line .lo { grid-column: 1 / -1; color: var(--ink-2); font-size: 15px; }
.line .lt { text-align: right; font-weight: 700; font-size: 19px; line-height: 1.3; white-space: nowrap; }
.line .lq { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.line .lq button { min-height: 46px; min-width: 48px; padding: 0; font-size: 22px; line-height: 1; }
.line .lq .q { min-width: 32px; text-align: center; font-weight: 700; font-size: 20px; }
.line .lq button.sm, .line .lq .del { min-width: 0; padding: 0 var(--s2); font-size: 15px; line-height: 1.2; }
.line .lq .del { margin-left: auto; color: var(--ink-2); border-color: transparent; }
.cart-sum { border-top: 1px solid var(--hair); padding: var(--s2) var(--s4) var(--s3); }
.cart-sum .row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--ink-2); font-size: 18px; }
.cart-sum .row.total { color: var(--ink); font-size: 32px; font-weight: 700; padding-top: var(--s2); border-top: 1px dashed var(--hair); margin-top: var(--s1); line-height: 1.2; }
.cart-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin: var(--s3) 0; }
.cart-actions button { min-height: 48px; padding: 0 var(--s1); font-size: 17px; }
button.big { width: 100%; min-height: 72px; font-size: 26px; }
/* 結帳視窗：客人臨時加點要能一眼看到「返回加點」，購物車會保留（訂單在「收款完成」才建立） */
.pay-foot { display: grid; grid-template-columns: 1fr 2fr; gap: var(--s3); }
.pay-foot .pay-back { background: var(--paper-2); color: var(--ink); border: 1px solid var(--hair); }
.pay-foot button.big { font-size: 26px; }

/* 即點即交：已完成單固定在點餐頁右側 */
.done-aside { border-left: 1px solid var(--hair); display: grid; grid-template-rows: auto 1fr; min-height: 0; background: var(--paper-2); min-width: 0; }
.done-aside h2 { margin: 0; padding: var(--s3) var(--s4); font-family: var(--serif); font-size: 20px; font-weight: 600; border-bottom: 1px solid var(--hair); display: flex; justify-content: space-between; }
.done-aside-list { overflow-y: auto; padding: var(--s3); display: flex; flex-direction: column; gap: var(--s3); }

/* 看板 */
.board { display: grid; grid-template-columns: 1fr 1fr 300px; }
.col { border-right: 1px solid var(--hair); display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.col:last-child { border-right: none; background: var(--paper-2); }
.col h2 { margin: 0; padding: var(--s3) var(--s4); font-family: var(--serif); font-size: 20px; font-weight: 600; border-bottom: 1px solid var(--hair); display: flex; justify-content: space-between; }
.col-body { overflow-y: auto; padding: var(--s3); display: flex; flex-direction: column; gap: var(--s3); }
.ticket { background: var(--white); border: 1px solid var(--hair); border-left: 4px solid var(--ink); border-radius: var(--r); padding: var(--s3) var(--s4); box-shadow: var(--shadow-sm); }
#colReady .ticket { border-left-color: var(--green); }
.ticket.late { border-color: var(--red); }
.ticket .th { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s2); }
.ticket .stamp { font-size: 30px; }
.ticket .age { font-size: 15px; color: var(--ink-3); }
.ticket.late .age { color: var(--red); font-weight: 700; }
.ticket .ti { font-size: 18px; line-height: 1.5; }
.ticket .ti b { font-weight: 700; }
.ticket .ti .o { color: var(--ink-2); font-size: 15px; }
.ticket .ta { display: flex; gap: var(--s2); margin-top: var(--s3); }
.ticket .ta button { flex: 1; }
.ticket .pf { color: var(--red); font-size: 15px; margin-top: var(--s2); }
.done .ticket, .done-aside .ticket { padding: var(--s2) var(--s3); }
.done-ticket-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.done-ticket-head .stamp { font-size: 30px; border-width: 2px; }
.done-ticket-head .num { font-size: 19px; font-weight: 700; }
.done-ticket-meta { margin-top: var(--s1); color: var(--ink-3); font-size: 15px; }
.done-ticket-actions { display: flex; gap: var(--s2); margin-top: var(--s2); }
.done-ticket-actions button { flex: 1; }
.done-ticket-actions button, .ticket .ta button { min-height: 44px; font-size: 16px; }
.ticket.cancelled { opacity: .5; }
.ticket.cancelled .num { text-decoration: line-through; }
.ticket .cancel-order { color: var(--red); }

/* 失敗橫幅 */
.fail-banner { position: fixed; left: 0; right: 0; bottom: 0; background: var(--red); color: var(--on-red); padding: var(--s3) var(--s5); display: flex; align-items: center; gap: var(--s3); z-index: 200; font-weight: 700; font-size: 18px; }
.fail-banner span { flex: 1; }
.fail-banner button { color: var(--ink); }
.toast { font-size: 18px; }

/* modal 內容 */
.modal.narrow { width: min(500px, 100%); }
.modal header { padding: var(--s3) var(--s5); }
.modal header h3 { font-size: 22px; }
.modal .body { padding: var(--s4) var(--s5); }
.modal footer { padding: var(--s3) var(--s5); }
.modal footer button { font-size: 18px; }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.more-grid button { min-height: 64px; font-size: 19px; }
.more-grid button.warn { border-color: var(--red); color: var(--red); background: var(--red-wash); }
.more-grid button small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.more-who { padding-bottom: var(--s2); border-bottom: 1px solid var(--hair); font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.more-actions { display: flex; align-items: center; gap: var(--s2); }
.more-actions button.sm { font-size: 16px; min-height: 44px; }
.go-nav { position: relative; }
.go-menu { position: absolute; z-index: 30; top: calc(100% + var(--s1)); right: 0; min-width: 220px; padding: var(--s1); border: 1px solid var(--hair); border-radius: var(--r); background: var(--paper); }
.go-menu a, .go-menu button { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: space-between; padding: 0 var(--s2); border: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; font-size: 16px; font-weight: 500; text-align: left; text-decoration: none; }
.go-menu a:hover, .go-menu button:hover { background: var(--red-wash); }
.go-menu .go-divider { height: 1px; margin: var(--s1); background: var(--hair); }
.go-menu .go-sub { margin-left: var(--s2); border-left: 1px solid var(--hair); }
.go-menu .go-sub a { font-size: 15px; }
.more-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--hair); }
.body label { display: block; margin-bottom: var(--s3); color: var(--ink-2); font-size: 16px; }
.body input, .body textarea { display: block; width: 100%; margin-top: var(--s1); min-height: 56px; padding: var(--s2) var(--s3); border: 1px solid var(--hair); border-radius: var(--r); background: var(--white); font-size: 20px; }
.body textarea { resize: vertical; }
.quick { display: flex; gap: var(--s2); margin-bottom: var(--s3); }
.quick button { flex: 1; min-height: clamp(44px, 6.6vh, 56px); font-size: 20px; }
.qty-pick { display: flex; align-items: center; gap: var(--s2); }
.qty-pick button { min-width: 56px; min-height: 56px; padding: 0 var(--s3); }
.qty-pick span { min-width: 36px; text-align: center; font-size: 26px; font-weight: 700; }
.qty-pick button, .qty-ctl button { font-size: 24px; }
.qty-pick .ghost { margin-left: auto; font-size: 18px; }
.opt-group { margin-bottom: var(--s4); }
.opt-group h4 { margin: 0 0 var(--s2); font-size: 17px; color: var(--ink-2); font-weight: 500; }
.opt-group h4 .req { color: var(--red); margin-left: 4px; }
.opt-qty-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s2) 0; border-bottom: 1px solid var(--hair); }
.opt-qty-name { min-width: 0; overflow-wrap: anywhere; font-size: 20px; }
.opt-qty-row .qty-pick { flex-shrink: 0; }
.opt-qty-row .qty-pick button { width: 56px; height: 56px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { min-height: 56px; padding: 0 var(--s4); font-size: 20px; }
.chip.on { background: var(--red-wash); color: var(--ink); border: 2px solid var(--red); }
.qty-ctl { display: flex; align-items: center; gap: var(--s3); margin-right: auto; }
.qty-ctl button { min-width: 56px; }
.qty-ctl span { font-size: 26px; font-weight: 700; min-width: 32px; text-align: center; }
.modal footer .qty-ctl button { min-height: 48px; padding: 0; font-size: 26px; line-height: 1; }

/* 結帳 */
.modal.pay { width: min(860px, 100%); display: flex; flex-direction: column; max-height: 94vh; overflow: hidden; }
.modal.pay header { padding: var(--s2) var(--s5); }
.modal.pay .pay-body { flex: 1; min-height: 0; overflow: auto; padding: var(--s4) var(--s5); }
.modal.pay footer { flex: 0 0 auto; padding: var(--s3) var(--s5); }
.pay-body { display: grid; grid-template-columns: 1fr 260px; gap: var(--s4); }
.pay-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 34px; font-weight: 700; padding-bottom: var(--s2); border-bottom: 1px solid var(--hair); line-height: 1.2; }
.pay-remain { display: flex; justify-content: space-between; color: var(--red); font-weight: 700; padding: var(--s2) 0; font-size: 18px; }
.methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--s2); margin: var(--s2) 0; }
.methods button { min-height: clamp(44px, 6.6vh, 56px); font-size: 20px; }
.methods button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
#cashQuick { margin-bottom: var(--s2); }
.received { display: flex; justify-content: space-between; align-items: baseline; font-size: 28px; padding: 6px 0; line-height: 1.2; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.keypad button { min-height: clamp(44px, 7.2vh, 60px); font-size: 28px; font-weight: 700; }
.change { display: flex; justify-content: space-between; align-items: baseline; font-size: 28px; color: var(--green); font-weight: 700; padding-top: var(--s2); line-height: 1.2; }
.pay-right { border-left: 1px solid var(--hair); padding-left: var(--s5); }
.split-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s3); font-weight: 600; font-size: 18px; }
.partials { font-size: 16px; }
.partial { display: flex; justify-content: space-between; padding: var(--s2) 0; border-bottom: 1px solid var(--hair); color: var(--ink); }

/* 完成 */
.modal.done-card { width: min(520px, 100%); text-align: center; }
.done-body { padding: var(--s5) var(--s5) var(--s3); }
.done-body > .muted { font-size: 18px; }
.stamp.pickup { font-size: 112px; padding: .05em .2em; margin: var(--s3) 0; }
.done-change { font-size: 34px; font-weight: 700; color: var(--green); min-height: 1.3em; }
.done-print { font-size: 16px; color: var(--ink-3); margin-top: var(--s2); min-height: 1.3em; }
.done-print.bad { color: var(--red); font-weight: 700; }
.done-card footer { justify-content: center; }
.done-card footer button { width: 100%; }
.done-card footer button.big { font-size: 26px; }

/* 離線補送失敗：讓店長依原收款內容人工補單後再移除 */
.failed-queue-notice { margin: 0 0 var(--s3); color: var(--red); font-size: 16px; line-height: 1.6; }
.failed-queue-item { border-top: 1px solid var(--hair); padding: var(--s3) 0; }
.failed-queue-item > div { display: flex; justify-content: space-between; gap: var(--s3); }
.failed-queue-item p { margin: var(--s1) 0; font-size: 16px; color: var(--ink-2); }
.failed-queue-item .failed-queue-error { color: var(--red); }

/* 打卡 */
.timeclock { height: calc(100vh - 60px); overflow-y: auto; padding: var(--s5); }
.timeclock-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); border-bottom: 1px solid var(--hair); padding-bottom: var(--s3); }
.timeclock-head h1 { margin: 0; font-family: var(--serif); font-size: 28px; }
.timeclock-head p { margin: 4px 0 0; }
.timeclock-actions { display: flex; gap: var(--s2); }
.timeclock-actions button.sm { font-size: 16px; min-height: 44px; }
.device-bar { display: flex; align-items: center; gap: var(--s2); min-height: 44px; margin: 0 0 var(--s4); color: var(--ink-2); font-size: 16px; }
.device-bar.required { color: var(--red); font-weight: 700; }
.device-bar button { min-height: 44px; flex: 0 0 auto; }
.timeclock-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s4); }
.clock-card { border: 1px solid var(--hair); border-radius: var(--r); background: var(--white); padding: var(--s4); display: grid; gap: var(--s3); }
.clock-card.stale { border-color: var(--red); background: var(--red-wash); }
.clock-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); }
.clock-card h2 { margin: 0; font-family: var(--serif); font-size: 26px; }
.clock-card .clock-status { min-height: 26px; color: var(--ink-2); font-size: 18px; }
.clock-card .clock-status.on { color: var(--green); font-weight: 700; }
.clock-card .clock-status.stale { color: var(--red); font-weight: 700; }
.clock-status-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.clock-card .clock-fix { min-height: 44px; font-size: 16px; padding: 0 var(--s3); flex: 0 0 auto; color: var(--ink-2); text-decoration: underline; }
.clock-schedules, .clock-shifts { font-size: 15px; color: var(--ink-2); min-height: 20px; }
.clock-card button { min-height: 64px; font-size: 21px; }
.clock-pin-dots { text-align: center; font-size: 28px; letter-spacing: .25em; margin-bottom: var(--s4); min-height: 40px; }
.clock-keypad button { min-height: 58px; }

/* 招待與報廢 */
.line.comp { background: var(--red-wash); }
.line.comp .lt b, .comp-tag { color: var(--red); }
.comp-tag, .discount-tag { margin-left: var(--s1); font-size: 14px; vertical-align: middle; }
.done-ticket-items { margin-top: var(--s2); color: var(--ink-2); font-size: 15px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.done-ticket-items .comp-tag { font-size: 13px; }
.waste { min-height: calc(100vh - 60px); display: grid; grid-template-columns: minmax(300px, 1fr) minmax(280px, .8fr) minmax(280px, .8fr); gap: 0; background: var(--paper); }
.waste > section { min-width: 0; padding: var(--s4); border-right: 1px solid var(--hair); overflow-y: auto; }
.waste > section:last-child { border-right: 0; }
.waste-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s3); border-bottom: 1px solid var(--hair); padding-bottom: var(--s2); }
.waste-head h1, .waste-head h2 { margin: 0; font-family: var(--serif); font-size: 24px; }
.waste-cats { display: flex; gap: var(--s1); overflow-x: auto; padding-bottom: var(--s3); }
.waste-cats .cat { min-height: 48px; white-space: nowrap; font-size: 19px; padding: 0 var(--s4); }
.waste-cats .discontinued, .waste-item.discontinued { color: var(--ink-3); background: var(--paper-2); }
.waste-items { display: grid; gap: 1px; border-top: 1px solid var(--hair); }
.waste-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s2); align-items: center; min-height: 68px; padding: var(--s2) 0; border-bottom: 1px solid var(--hair); }
.waste-item.selected { border-left: 2px solid var(--red); padding-left: var(--s2); }
.waste-item .n { min-width: 0; font-size: 19px; font-weight: 500; overflow-wrap: anywhere; }
.waste-item small { display: block; color: var(--ink-3); font-size: 14px; }
.waste-qty { display: inline-flex; align-items: center; gap: var(--s1); }
.waste-qty button { min-width: 48px; min-height: 48px; font-size: 22px; padding: 0; }
.waste-qty b { min-width: 28px; text-align: center; font-size: 20px; }
.waste-cart { display: grid; align-content: start; gap: var(--s3); }
.waste-cart label { display: grid; gap: var(--s1); color: var(--ink-2); font-size: 16px; }
.waste-cart select, .waste-cart textarea { width: 100%; font-size: 18px; padding: var(--s2) var(--s3); }
.waste-cart select { min-height: 52px; }
.waste-cart #btnWasteSave { min-height: 56px; }
.waste-lines { display: grid; gap: var(--s2); min-height: 40px; font-size: 17px; }
.waste-lines > div, .waste-entry { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); border-bottom: 1px solid var(--hair); padding-bottom: var(--s2); }
.waste-entry { font-size: 16px; line-height: 1.5; }
.waste-entry button { min-height: 44px; }

/* 小平板（901～1100 寬）：頂欄收一點才放得下四個分頁 */
@media (max-width: 1100px) {
  .tab { padding: 0 var(--s4); font-size: 18px; }
  .tb-right { gap: 6px; font-size: 14px; }
  .who-pos { max-width: 140px; }
  .topbar { grid-template-columns: auto minmax(min-content, 1fr) auto; }
  .tb-tabs { justify-self: center; }
}
@media (max-width: 900px) {
  :root { --pos-item-min: 140px; --pos-item-fs: 20px; --pos-cat-fs: 19px; }
  #viewOrder { grid-template-columns: 100px 1fr 300px; }
  #viewOrder.instant-serve { grid-template-columns: 100px minmax(0, 1fr) 300px; grid-template-rows: calc(100vh - 116px) auto; height: auto; min-height: calc(100vh - 116px); }
  .done-aside { grid-column: 1 / -1; min-height: 0; border-left: none; border-top: 1px solid var(--hair); }
  .done-aside-list { max-height: 42vh; }
  .done-aside.collapsed .done-aside-list { display: none; }
  .done-aside h2 { cursor: pointer; }
  .done-aside h2::after { content: "收合"; color: var(--ink-3); font-family: inherit; font-size: 12px; font-weight: 400; }
  .done-aside.collapsed h2::after { content: "展開"; }
  .board { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - 116px); }
  .board .col { min-height: 0; border-right: 0; border-bottom: 1px solid var(--hair); }
  .board .col-body { max-height: 42vh; }
  .board .col.done { display: grid; background: var(--paper-2); }
  .board .col.done.collapsed .col-body { display: none; }
  .board .col.done h2 { cursor: pointer; }
  .board .col.done h2::after { content: "收合"; color: var(--ink-3); font-family: inherit; font-size: 12px; font-weight: 400; }
  .board .col.done.collapsed h2::after { content: "展開"; }
  .pay-body { grid-template-columns: 1fr; }
  .pay-right { border-left: none; padding-left: 0; }
  .topbar { grid-template-columns: 1fr auto; height: auto; padding: var(--s2) var(--s3); gap: var(--s2); }
  .update-bar { padding: 0 var(--s3); }
  .tb-tabs { order: 3; grid-column: 1 / -1; overflow-x: auto; justify-self: stretch; } .tb-tabs .tab { flex: 1; min-width: 100px; }
  .tb-right { gap: 4px; flex-wrap: wrap; } .tb-status { display: inline; margin-right: 2px; font-size: 13px; white-space: nowrap; } .who-pos { max-width: 130px; }
  .queue-failed { min-height: 28px; font-size: 13px; }
  .tab { font-size: 17px; min-height: 44px; } .tb-right button.sm { min-height: 40px; }
  .line .lq { gap: var(--s1); } .line .lq button { min-width: 44px; }
  .view:not(.board), .timeclock { height: calc(100vh - 116px); } .timeclock { padding: var(--s3); }
  .device-bar { align-items: flex-start; flex-wrap: wrap; }
  .waste { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - 116px); }
  .waste > section { max-height: none; border-right: 0; border-bottom: 1px solid var(--hair); }
}
/* 矮螢幕（平板瀏覽器有網址列時可視高度約 670）：結帳視窗再收一點邊，維持一屏 */
@media (max-height: 700px) {
  .modal.pay header { padding: var(--s1) var(--s5); }
  .modal.pay footer { padding: var(--s2) var(--s5); }
  .pay-foot button.big { min-height: 60px; }
  .modal.pay .pay-body { padding-top: var(--s3); padding-bottom: var(--s3); }
  .received { padding: 4px 0; }
}
/* 「更多」身分列：右側的前往／登出不折行，左側文字可換行 */
.more-who > strong { min-width: 0; }
.more-actions { flex-shrink: 0; }
.more-actions button { white-space: nowrap; }
/* 登入框：大標題寫清楚這是哪個入口、要用哪種帳號；最上面一顆大的返回鍵（點錯入口可以回去重選） */
.login-title { margin: var(--s2) 0 var(--s1); text-align: center; font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1.2; }
.login-hint { margin: 0 0 var(--s4); text-align: center; color: var(--ink-2); font-size: 16px; }
.login-hint b { color: var(--red); }
.login-back { display: flex; align-items: center; justify-content: center; margin: 0 0 var(--s4); min-height: 56px; color: var(--ink); font-size: 17px; font-weight: 700; text-decoration: none; background: var(--paper-2); border: 1px solid var(--hair); border-radius: var(--r); }
.login-back:hover, .login-back:active { border-color: var(--red); }
.login-back.attn { border-color: var(--red); color: var(--red); background: var(--red-wash); }
.login-card .err { margin-top: var(--s2); font-size: 15px; font-weight: 700; line-height: 1.5; }
.reprint-choices { display: grid; gap: var(--s3); }
.reprint-choices button, #mReprint header button, #btnTestLabel, [data-a="reprint"] { min-height: 56px; }
.bowl-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: var(--s3); }
#labelPrinterStatus { display: inline-flex; align-items: center; gap: var(--s1); }
.pf:empty { display: none; }
#labelPrinterStatus[hidden] { display: none; }

/* 少量湯品放大；直放平板兩欄，保留售完及分類標題。 */
#items.few { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#items.few .item { min-height: 150px; }
#items.few .item .n { font-size: 26px; font-weight: 700; }
#items.few .item .p { font-size: 24px; }
@media (max-width: 900px) {
  #items.few { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.opt-qty-row { padding-inline: var(--s2); border-radius: var(--r); }
.opt-qty-row.selected { background: var(--red-wash); }
.opt-qty-row.selected [data-opt-count] { color: var(--red); }
:root[data-theme="dark"] .cart-empty { opacity: .18; }
.theme-picker { display: grid; grid-template-columns: auto 1fr 1fr; align-items: center; gap: var(--s3); border-bottom: 1px solid var(--hair); }
.theme-picker button { min-height: 56px; font-size: 19px; }
.theme-picker button[aria-pressed="true"] { background: var(--red-wash); color: var(--ink); border: 2px solid var(--red); }
/* LINE Pay 延續既有亮／暗主題；掃碼槍輸入保有焦點，手動輸入可展開。 */
.linepay-panel { position:relative; padding:24px 0; border-top:1px solid var(--hair); }
.linepay-panel h3 { font-family:var(--serif); font-size:24px; line-height:1.5; margin:0 0 16px; }
.linepay-panel p { line-height:1.6; }
.linepay-actions { display:flex; flex-wrap:wrap; gap:12px; margin-top:20px; }
.linepay-actions button, #linepayCode { min-height:56px; }
.linepay-scanner { position:absolute; width:1px; height:1px; overflow:hidden; opacity:0; }
.linepay-scanner.manual { position:static; display:block; width:auto; height:auto; opacity:1; }
.linepay-scanner.manual input { display:block; width:100%; margin-top:8px; background:var(--paper); color:var(--ink); border:1px solid var(--hair); border-radius:var(--r); padding:12px; }
#linepayVideo { width:100%; max-height:240px; margin-top:16px; border-radius:var(--r); }
#linepayOffline { line-height:1.6; }
.linepay-pending { border-color:var(--red); }
.linepay-pending .ta button { min-height:56px; }

/* SS-W10：手機備援櫃台；同一購物車在底部展開。 */
.mobile-cart-bar, .cart-close, .cart-handle, .cart-backdrop { display: none; }
.cart-title-row { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.cart-title-row .uber-mark { font-size: 12px; padding: var(--s1); letter-spacing: 0; border-width: 2px; }
.cart-head { gap: var(--s1); flex-wrap: nowrap; }
.cart-head button { flex: none; white-space: nowrap; }
.cart-title-row #cartTitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* 標題已寫「Uber Eats 單」，框字只在寬度夠時顯示，避免把「清空」擠到第二行 */
@media (max-width: 1400px) { .cart-head .cart-title-row .uber-mark { display: none; } }
.methods button { white-space: nowrap; padding-inline: var(--s1); }
@media (max-width: 600px) { .methods button { font-size: 16px; } }
.cart-head #btnUber { padding: 0 var(--s2); }
.more-foot { flex-wrap: wrap; gap: var(--s2); }
.other-store-queue { margin: 0; padding: var(--s2) var(--s4); background: var(--paper-2); color: var(--ink); font-size: 14px; }
@media (max-width: 600px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; padding: var(--s2); }
  .tb-left, .tb-right { min-width: 0; }
  .tb-left .logo { height: 32px; }
  .tb-right .who-pos, .tb-right #printerDot, .tb-right #printerText, #labelPrinterStatus { display: none; }
  .tb-right { max-width: 140px; }
  .tb-right button.sm, .tb-tabs .tab { min-height: 56px; }
  .tb-tabs { max-width: 100%; }
  .tb-tabs .tab { min-width: 80px; flex: 1 0 auto; }
  #viewOrder, #viewOrder.instant-serve { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; height: auto; min-height: calc(100dvh - 128px); padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .cats { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--hair); gap: var(--s2); padding: var(--s2); }
  .cats .cat { flex: 0 0 auto; min-height: 56px; padding: 0 var(--s4); border: 1px solid var(--hair); border-radius: var(--r); white-space: nowrap; }
  .items-wrap { padding: var(--s3); min-width: 0; }
  .items, #items.few { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .item { min-width: 0; min-height: 128px; height: auto; padding: var(--s3); }
  .item .n { font-size: 21px; overflow-wrap: anywhere; }
  .item .p { font-size: 18px; }
  .cart, .cart.uber-mode { position: fixed; inset: auto 0 0; width: 100%; max-width: 100%; max-height: 80vh; max-height: 80dvh; z-index: 30; display: flex; flex-direction: column; border: 1px solid var(--hair); padding-bottom: env(safe-area-inset-bottom); }
  .cart:not(.cart-open) > :not(.mobile-cart-bar) { display: none !important; }
  .mobile-cart-bar { display: flex; order: 5; flex: 0 0 auto; gap: var(--s2); padding: var(--s2); border-top: 1px solid var(--hair); background: var(--paper); }
  #mobileCartSummary { min-width: 0; flex: 1; padding: 0 var(--s2); text-align: left; font-size: 17px; }
  #mobileCheckout { min-width: 88px; }
  .cart-open .cart-handle { display: flex; align-items: center; justify-content: center; min-height: 56px; flex: 0 0 auto; padding: 0; }
  .cart-handle span { width: 40px; height: 4px; border-radius: var(--r); background: var(--hair); }
  .cart-close { display: block; min-height: 56px; padding: 0 var(--s2); }
  .cart-head { padding: 0 var(--s2) var(--s2); flex: 0 0 auto; font-size: 18px; }
  .cart-head #btnClear { min-height: 56px; }
  .cart-head .cart-title-row { flex: 1 1 auto; }
  .cart-lines { flex: 1 1 auto; min-height: 70px; overflow-y: auto; overscroll-behavior: contain; }
  .cart-empty { min-height: 80px; padding: var(--s3); }
  .cart-sum { flex: 0 0 auto; padding: var(--s2); }
  .cart-sum #btnCheckout { display: none; }
  .cart-sum .row.total { font-size: 24px; }
  .cart-actions { margin: var(--s2) 0 0; }
  .cart-actions button, .line .lq button { min-height: 56px; }
  .uber-fields { flex: 0 0 auto; padding: var(--s2); grid-template-columns: 128px minmax(0, 1fr); }
  .uber-fields input { font-size: 16px; padding: 0 var(--s2); }
  .cart-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 29; background: var(--scrim); }
  .modal-bg { padding: var(--s2); }
  .modal, .modal.pay { max-width: 100%; max-height: calc(100dvh - 16px); }
  .modal header, .modal .body, .modal footer, .modal.pay header, .modal.pay .pay-body, .modal.pay footer { padding: var(--s3); min-width: 0; }
  .modal header h3 { min-width: 0; overflow-wrap: anywhere; font-size: 20px; }
  .modal .body, .pay-body { overflow-x: hidden; }
  .pay-body { grid-template-columns: minmax(0, 1fr); }
  .pay-left, .pay-right { min-width: 0; }
  .more-grid { gap: var(--s2); }
  .more-grid button { min-width: 0; font-size: 17px; overflow-wrap: anywhere; }
  .opt-qty-name { min-width: 0; overflow-wrap: anywhere; }
  .qty-pick { flex: 0 0 auto; }
  .modal footer .qty-ctl button { min-height: 56px; }
  .modal footer { flex-wrap: wrap; }
}
