/* 櫃台 POS — 平板橫向優先（1024~1366），觸控大按鈕，資料當主角 */
.screen { min-height: 100vh; }
[hidden] { display: none !important; }
.err { color: var(--red); min-height: 1.4em; font-size: 14px; margin-top: var(--s2); }
.small { font-size: 13px; }

/* 登入 */
#login { 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 button { width: 100%; margin-top: var(--s2); font-size: 18px; }
.login-foot { text-align: center; margin-top: var(--s5); }

/* 頂欄 */
.topbar { height: 60px; display: grid; grid-template-columns: 1fr auto 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); }
.tb-rule { width: 2px; height: 26px; background: var(--red); border-radius: 1px; }
.topbar .logo { height: 38px; }
.store-name { color: var(--ink-2); font-size: 15px; font-family: var(--serif); font-weight: 600; letter-spacing: .04em; }
.tb-tabs { display: flex; gap: var(--s1); background: var(--paper-2); padding: 3px; border-radius: var(--r); }
.tab { min-height: 44px; border: none; background: transparent; padding: 0 var(--s5); font-weight: 500; color: var(--ink-2); }
.tab.active { background: var(--ink); color: var(--paper); font-weight: 700; }
.badge { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 11px; background: var(--red); color: #fff; font-size: 12px; line-height: 22px; text-align: center; margin-left: 4px; }
.tb-right { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); font-size: 13px; color: var(--ink-2); }
.tb-status { margin-right: var(--s2); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); display: inline-block; }
.dot.ok { background: var(--green); } .dot.bad { background: var(--red); } .dot.warn { background: #C99A2E; }

/* 點餐三欄 */
.view { height: calc(100vh - 60px); }
#viewOrder { display: grid; grid-template-columns: 132px 1fr 360px; }
.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: 72px; font-family: var(--serif); font-weight: 600; font-size: 18px; text-align: left; padding: 0 var(--s4); color: var(--ink-2); position: relative; }
.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(150px, 1fr)); gap: var(--s3); }
.item { min-height: 104px; 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: 500; font-size: 17px; line-height: 1.3; }
.item .p { font-size: 17px; color: var(--ink); align-self: flex-end; font-family: var(--serif); font-weight: 600; }
.item .opt { position: absolute; top: 8px; right: 8px; font-size: 11px; color: var(--ink-3); border: 1px solid var(--hair); border-radius: 3px; padding: 0 4px; }
.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: 22px; color: var(--red); background: rgba(247, 242, 233, .55); }
.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: 14px; }

/* 購物車 */
.cart { border-left: 1px solid var(--hair); display: grid; grid-template-rows: auto 1fr auto; background: var(--white); }
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--hair); font-size: 18px; font-weight: 600; }
.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-sig { display: flex; justify-content: flex-end; margin-top: var(--s3); }
.cart-lines { overflow-y: auto; }
.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(--s3) var(--s4); border-bottom: 1px solid var(--hair); display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s3); }
.line .ln { font-weight: 500; }
.line .lo { grid-column: 1 / -1; color: var(--ink-2); font-size: 13px; }
.line .lt { text-align: right; font-weight: 500; }
.line .lq { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s2); }
.line .lq button { min-height: 40px; min-width: 44px; padding: 0; }
.line .lq .q { min-width: 32px; text-align: center; font-weight: 700; }
.line .lq .del { margin-left: auto; color: var(--ink-3); border-color: transparent; }
.cart-sum { border-top: 1px solid var(--hair); padding: var(--s3) var(--s4) var(--s4); }
.cart-sum .row { display: flex; justify-content: space-between; padding: 4px 0; color: var(--ink-2); }
.cart-sum .row.total { color: var(--ink); font-size: 26px; font-weight: 700; padding-top: var(--s2); border-top: 1px dashed var(--hair); margin-top: var(--s1); }
.cart-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin: var(--s3) 0; }
button.big { width: 100%; min-height: 68px; font-size: 22px; }

/* 看板 */
.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: 18px; 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: 13px; color: var(--ink-3); }
.ticket.late .age { color: var(--red); font-weight: 700; }
.ticket .ti { font-size: 15px; line-height: 1.5; }
.ticket .ti b { font-weight: 700; }
.ticket .ti .o { color: var(--ink-2); font-size: 13px; }
.ticket .ta { display: flex; gap: var(--s2); margin-top: var(--s3); }
.ticket .ta button { flex: 1; }
.ticket .pf { color: var(--red); font-size: 13px; margin-top: var(--s2); }
.done .ticket { padding: var(--s2) var(--s3); display: flex; justify-content: space-between; align-items: center; }
.done .ticket .stamp { font-size: 18px; border-width: 2px; }
.ticket.cancelled { opacity: .5; text-decoration: line-through; }

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

/* modal 內容 */
.modal.narrow { width: min(460px, 100%); }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.more-grid button { min-height: 64px; }
.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: 14px; }
.body input, .body textarea { display: block; width: 100%; margin-top: var(--s1); min-height: 52px; padding: var(--s2) var(--s3); border: 1px solid var(--hair); border-radius: var(--r); background: var(--white); font-size: 18px; }
.body textarea { resize: vertical; }
.quick { display: flex; gap: var(--s2); margin-bottom: var(--s3); }
.quick button { flex: 1; }
.opt-group { margin-bottom: var(--s4); }
.opt-group h4 { margin: 0 0 var(--s2); font-size: 14px; color: var(--ink-2); font-weight: 500; }
.opt-group h4 .req { color: var(--red); margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { min-height: 52px; padding: 0 var(--s4); font-size: 17px; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.qty-ctl { display: flex; align-items: center; gap: var(--s3); margin-right: auto; }
.qty-ctl button { min-width: 56px; }
.qty-ctl span { font-size: 22px; font-weight: 700; min-width: 32px; text-align: center; }

/* 結帳 */
.modal.pay { width: min(860px, 100%); }
.pay-body { display: grid; grid-template-columns: 1fr 260px; gap: var(--s5); }
.pay-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 36px; font-weight: 700; padding-bottom: var(--s2); border-bottom: 1px solid var(--hair); }
.pay-remain { display: flex; justify-content: space-between; color: var(--red); font-weight: 700; padding: var(--s2) 0; }
.methods { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s2); margin: var(--s3) 0; }
.methods button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.received { display: flex; justify-content: space-between; align-items: baseline; font-size: 28px; padding: var(--s2) 0; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.keypad button { min-height: 60px; font-size: 24px; font-weight: 500; }
.change { display: flex; justify-content: space-between; align-items: baseline; font-size: 28px; color: var(--green); font-weight: 700; padding-top: var(--s3); }
.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; }
.partials { font-size: 14px; }
.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(--s6) var(--s5) var(--s4); }
.stamp.pickup { font-size: 112px; padding: .05em .2em; margin: var(--s3) 0; }
.done-change { font-size: 30px; font-weight: 700; color: var(--green); min-height: 1.3em; }
.done-print { font-size: 14px; 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%; }

@media (max-width: 900px) {
  #viewOrder { grid-template-columns: 100px 1fr 300px; }
  .board { grid-template-columns: 1fr 1fr; }
  .col.done { display: none; }
  .pay-body { grid-template-columns: 1fr; }
  .pay-right { border-left: none; padding-left: 0; }
}
