/* 馬蔥餅叫貨 門市端（手機直式為主、店內平板、少數電腦）
   規則：只用 tokens.css 變數；單一圓角 var(--r)；層次靠 1px hairline；陰影只給浮層
   紅色＝現在該按的那一顆／出事了；綠色＝已完成
   防破版：grid 一律 minmax(0,1fr)；長字 overflow-wrap:anywhere；只有分類列可以橫捲 */

:root { color-scheme: light; --top-h: 56px; --tab-h: 62px; --off-h: 0px; --bar-real: 84px; --ed-head-h: 0px; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.st { overflow-x: clip; background: var(--paper); }
.st button, .st a { touch-action: manipulation; }
.st a { color: inherit; }
.st-view { min-height: 100vh; min-height: 100dvh; padding-top: var(--off-h); }
.red-t { color: var(--red); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* 按鈕（門市端：主要 ≥56px，次要 ≥48px） */
.st .mo-btn { min-height: 52px; font-size: 18px; padding: 0 20px; line-height: 1.25; }
.st .mo-btn.big { min-height: 64px; font-size: 21px; }
.st .mo-btn.main { min-height: 56px; font-size: 19px; }
.st .mo-btn.sec { background: var(--white); border-color: var(--ink-2); color: var(--ink); }
.st .mo-btn.sec:hover { background: var(--paper-2); }
.st .mo-btn.wrap { white-space: normal; text-align: center; padding-top: 8px; padding-bottom: 8px; }
.st .mo-btn.ghost { color: var(--ink-2); }
.st .mo-btn:active:not(:disabled) { transform: scale(.98); }
.st .mo-btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* ── 頂欄＋分頁 ───────────────────────── */
.st-top { position: sticky; top: var(--off-h); z-index: 10; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: var(--top-h); padding: env(safe-area-inset-top) 16px 0; background: var(--paper); border-bottom: 1px solid var(--hair); }
.st-top .logo { height: 32px; width: auto; }
/* 店名不截斷（店員靠它確認「我登對店了」）：長店名在手機上縮一點字、最多換兩行 */
.st-top-t { margin: 0; min-width: 0; font-family: var(--serif); font-size: clamp(16px, 4.6vw, 19px); font-weight: 600; line-height: 1.25;
  overflow-wrap: anywhere; word-break: break-word; padding: 6px 0; }
.st-toptabs { display: none; }
.st-back { display: inline-flex; align-items: center; min-height: 48px; min-width: 48px; padding: 0 8px 0 0; font-size: 18px; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }

.st-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--white); border-top: 1px solid var(--hair); }
.st-tab { position: relative; display: flex; align-items: center; justify-content: center; min-height: var(--tab-h); padding: 0 4px; color: var(--ink-2);
  font-size: 18px; font-weight: 700; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-tab[aria-current="page"] { color: var(--ink); box-shadow: inset 0 3px 0 var(--red); }
body.has-tabs .st-page { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 28px); }

@media (min-width: 1024px) {
  .st-tabbar { display: none !important; }
  .st-toptabs { display: flex; gap: 4px; }
  .st-toptabs .st-tab { min-height: 56px; min-width: 96px; padding: 0 16px; font-size: 18px; }
  .st-toptabs .st-tab[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--red); }
  .st-top { min-height: 60px; padding-left: 24px; padding-right: 24px; }
  body.has-tabs .st-page { padding-bottom: 48px; }
}

/* ── 頁面容器 ─────────────────────────── */
.st-page { width: 100%; max-width: 680px; margin: 0 auto; padding: 16px 16px 32px; min-width: 0; }
.st-page.wide { max-width: 1200px; }
.st-h1 { margin: 4px 0 12px; font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.st-h2 { margin: 24px 0 10px; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.st-sig { display: flex; justify-content: center; padding: 28px 0 8px; }
.st-sig .sig { font-size: 15px; }
.st-sig .sig .zh { font-size: 12px; }

/* 狀態標籤：方角、一律顏色＋文字 */
.tag { display: inline-flex; align-items: center; min-height: 30px; padding: 2px 10px; border: 1px solid var(--hair); border-radius: 3px; font-size: 17px; font-weight: 700;
  line-height: 1.3; white-space: nowrap; background: var(--paper-2); color: var(--ink-2); flex-shrink: 0; }
.tag.sm { min-height: 24px; padding: 0 6px; font-size: 14px; }
.tag.todo { background: var(--white); border-color: var(--red); color: var(--red); }
.tag.draft { background: var(--paper-2); border: 1px dashed var(--ink-2); color: var(--ink-2); }
.tag.sent { background: var(--green-wash); border-color: var(--green); color: var(--green); }
.tag.late { background: var(--red-wash); border-color: var(--red); color: var(--red); }
.tag.missed { background: var(--red); border-color: var(--red); color: #fff; }
.tag.mod { background: var(--white); border-color: var(--red); color: var(--red); }
.tag.skip { background: var(--paper-2); border-color: var(--ink-3); color: var(--ink-2); }
.tag.lock { background: var(--paper-2); border-color: var(--paper-2); color: var(--ink-2); }
.tag.hq { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tag.add { background: var(--white); border-color: var(--ink); color: var(--ink); }
.tag.pend, .tag.stor { background: var(--white); border-color: var(--ink-2); color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }

/* 提示框（一行事實；紅＝出事了） */
.note { background: var(--white); border: 1px solid var(--hair); box-shadow: inset 4px 0 0 var(--ink-2); border-radius: var(--r); padding: 12px 14px 12px 18px;
  font-size: 17px; line-height: 1.55; overflow-wrap: anywhere; min-width: 0; }
.note.bad { background: var(--red-wash); border-color: var(--red); box-shadow: inset 4px 0 0 var(--red); color: var(--ink); }
.note.lock { background: var(--paper-2); }
.note b.red { color: var(--red); }
.note ul { margin: 6px 0 8px; padding-left: 20px; }
.note .mo-btn { margin-top: 8px; }
.note-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.note-acts .mo-btn { margin-top: 0; }
.notice { margin-bottom: 16px; white-space: pre-wrap; }
.notice-h { display: block; font-weight: 700; margin-bottom: 2px; }

/* 骨架（不做流光） */
.sk { background: var(--paper-2); border-radius: var(--r); }
.sk-band { height: 300px; margin-top: 4px; }
.sk-row { height: 76px; margin-top: 8px; }

/* 錯誤畫面 */
.err-box { background: var(--white); border: 1px solid var(--hair); border-radius: var(--r); padding: 24px 20px; display: grid; gap: 12px; margin-top: 24px; text-align: center; }
.err-box h2 { margin: 0; font-family: var(--serif); font-size: 24px; }
.err-box p { margin: 0; font-size: 17px; color: var(--ink-2); overflow-wrap: anywhere; }

/* ── 登入 ─────────────────────────────── */
.lg { min-height: 100vh; min-height: 100dvh; display: flex; align-items: flex-start; justify-content: center; padding: 16px; }
.lg-card { width: min(440px, 100%); background: var(--white); border: 1px solid var(--hair); border-radius: var(--r); padding: 16px 20px 20px; display: grid; gap: 6px; margin: auto 0; }
.lg-back { display: inline-flex; align-items: center; justify-self: start; min-height: 56px; padding: 0 12px 0 0; font-size: 18px; font-weight: 700; color: var(--ink); text-decoration: none; }
.lg-logo { height: 84px; width: auto; margin: 0 auto; }
.lg-title { margin: 6px 0 0; font-family: var(--serif); font-size: 28px; font-weight: 600; text-align: center; }
.lg-hint { margin: 0 0 6px; text-align: center; color: var(--ink-2); font-size: 16px; overflow-wrap: anywhere; }
.lg-hint b { color: var(--red); }
.lg-expired { margin: 0 0 4px; }
.lg-field { display: grid; gap: 6px; font-size: 16px; font-weight: 700; color: var(--ink-2); margin-top: 6px; }
.lg-field input { width: 100%; min-width: 0; height: 56px; padding: 0 14px; border: 1px solid var(--ink-3); border-radius: var(--r); background: var(--white); color: var(--ink);
  font-size: 20px; font-weight: 500; letter-spacing: .02em; }
.lg-field input:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.pw { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.pw-toggle { min-height: 56px; min-width: 76px; padding: 0 12px; font-size: 17px; font-weight: 700; background: var(--white); border: 1px solid var(--ink-2); }
.lg-check { display: flex; align-items: center; gap: 10px; min-height: 52px; font-size: 17px; color: var(--ink); cursor: pointer; }
.lg-check input { width: 24px; height: 24px; margin: 0; accent-color: var(--ink); flex-shrink: 0; }
.lg-go { min-height: 60px !important; font-size: 21px !important; }
.lg-err { min-height: 1.5em; color: var(--red); font-size: 17px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.lg-wrong { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--red); background: var(--red-wash); border-radius: var(--r); }
.lg-wrong p { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.lg-help { margin: 4px 0 0; color: var(--ink-2); font-size: 16px; text-align: center; }
.lg-foot { display: flex; justify-content: center; margin-top: 12px; }

/* ── 首頁：期別帶 ─────────────────────── */
.home { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.home-side { display: grid; gap: 16px; min-width: 0; }
.band { background: var(--white); border: 1px solid var(--hair); box-shadow: inset 4px 0 0 var(--hair); border-radius: var(--r); padding: 18px 18px 18px 22px;
  display: grid; gap: 12px; min-width: 0; overflow-wrap: anywhere; }
.band.t-act { box-shadow: inset 4px 0 0 var(--red); }
.band.t-done { box-shadow: inset 4px 0 0 var(--green); }
.band.t-late { background: var(--red-wash); border-color: var(--red); box-shadow: inset 6px 0 0 var(--red); }
.band.t-act.urgent { box-shadow: inset 6px 0 0 var(--red); }
.band-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.band-date { margin: 0; min-width: 0; font-family: var(--serif); font-weight: 600; font-size: 26px; line-height: 1.2; }
.band.hero .band-date { font-size: 32px; }
.band-sub { margin: -6px 0 0; color: var(--ink-2); font-size: 16px; line-height: 1.45; }
.band-note { margin: 0; font-size: 17px; line-height: 1.5; padding-left: 10px; box-shadow: inset 3px 0 0 var(--ink-2); white-space: pre-wrap; }
.band-alert { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--red); line-height: 1.25; }
.cd { display: grid; gap: 2px; min-width: 0; }
.cd-label { font-size: 16px; color: var(--ink-2); }
.cd-num { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.band.hero .cd-num { font-size: clamp(32px, 10.4vw, 48px); }
.cd-num.urgent, .cd-sm .urgent { color: var(--red); }
.cd-at { font-size: 17px; color: var(--ink-2); }
.cd-sm { margin: 0; font-size: 17px; color: var(--ink-2); line-height: 1.5; }
.cd-sm span[data-cd] { font-weight: 700; color: var(--ink); }
.band-line { margin: 0; font-size: 17px; line-height: 1.5; }
.band-line.red { color: var(--red); font-weight: 700; }
.band-line.muted { color: var(--ink-2); }
.band-box { border: 1px solid var(--hair); background: var(--paper); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 8px; }
.band-box p { margin: 0; font-size: 17px; line-height: 1.5; }
.band-acts { display: grid; gap: 10px; margin-top: 2px; }
.band-acts .mo-btn { width: 100%; }
.home-empty { background: var(--white); border: 1px solid var(--hair); border-radius: var(--r); padding: 28px 20px; text-align: center; display: grid; gap: 14px; }
.home-empty p { margin: 0; font-size: 18px; color: var(--ink-2); }
.skew { margin: 0 0 12px; font-size: 15px; color: var(--ink-2); }

@media (min-width: 768px) {
  .band { padding: 22px 24px 22px 28px; }
  .band.hero .band-date { font-size: 40px; }
  .band.hero .cd-num { font-size: 52px; }
}
@media (min-width: 1024px) {
  .home.two { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .band.hero .band-date { font-size: 44px; }
  .band.hero .cd-num { font-size: 60px; }
  .band-acts { grid-template-columns: minmax(0, 1fr); }
}

/* ── 叫貨編輯 ─────────────────────────── */
.ed-head { position: sticky; top: var(--off-h); z-index: 10; background: var(--paper); }
.ed-top { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; min-height: var(--top-h); padding: env(safe-area-inset-top) 12px 0 8px;
  border-bottom: 1px solid var(--hair); background: var(--paper); }
.ed-back { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; min-width: 48px; padding: 0 10px; font-size: 18px; font-weight: 700;
  color: var(--ink); text-decoration: none; background: transparent; border: 0; white-space: nowrap; }
.ed-tt { min-width: 0; padding: 6px 0; }
.ed-title { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.ed-cdl { font-size: 15px; color: var(--ink-2); line-height: 1.35; overflow-wrap: anywhere; }
.ed-cdl span[data-cd] { font-weight: 700; color: var(--ink); white-space: nowrap; }
.ed-cdl span[data-cd].urgent { color: var(--red); }
.ed-cats { display: flex; gap: 2px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 4px 8px; border-bottom: 1px solid var(--hair); background: var(--paper); }
.ed-cats::-webkit-scrollbar { display: none; }
.chip { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 12px; border: 0; border-radius: 0; background: transparent;
  font-size: 17px; color: var(--ink-2); white-space: nowrap; }
.chip:hover { background: transparent; }
.chip.on { color: var(--ink); font-weight: 700; }
.chip.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 3px; background: var(--red); }
.chip .n { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 3px; background: var(--ink); color: var(--paper);
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ed-search { padding: 8px 12px; border-bottom: 1px solid var(--hair); background: var(--paper); }
.srch { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.srch svg { position: absolute; left: 12px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--ink-2); pointer-events: none; }
.srch input { width: 100%; min-width: 0; height: 48px; padding: 0 12px 0 40px; border: 1px solid var(--ink-3); border-radius: var(--r); background: var(--white); font-size: 17px; color: var(--ink);
  -webkit-appearance: none; appearance: none; }
.srch input::-webkit-search-cancel-button { display: none; }
.srch input:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.srch .mo-btn { min-height: 48px; font-size: 16px; padding: 0 14px; }
body.searching .ed-cats { display: none; }

.ed-list { padding-bottom: calc(var(--bar-real) + env(safe-area-inset-bottom) + 24px); min-width: 0; }
.ed-notes { display: grid; gap: 10px; padding: 12px 12px 0; }
.ed-notes:empty { display: none; }
.ed-tools { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; }
.ed-tools:empty { display: none; }
.ed-tools .mo-btn { flex: 0 1 auto; min-height: 50px; font-size: 17px; }
.sec { scroll-margin-top: calc(var(--off-h) + var(--ed-head-h)); }
.sec-h { position: sticky; top: calc(var(--off-h) + var(--ed-head-h)); z-index: 5; margin: 0; padding: 8px 16px; background: var(--paper-2); color: var(--ink-2);
  font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--hair); }
.ed-empty { padding: 32px 16px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.ed-empty p { margin: 0; font-size: 18px; color: var(--ink-2); overflow-wrap: anywhere; }

/* 品項列：手機兩行（品名整行、下面 meta＋步進器），≥600 單行 */
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name name" "meta qty"; gap: 6px 12px; align-items: center;
  min-height: 96px; padding: 12px 12px 12px 16px; background: var(--white); border-bottom: 1px solid var(--hair); }
.item.has-qty { box-shadow: inset 3px 0 0 var(--red); }
.item.flash { outline: 3px solid var(--red); outline-offset: -3px; }
.item-name { grid-area: name; font-size: 19px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; line-break: strict; text-wrap: pretty; }
.item-meta { grid-area: meta; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: 15px; color: var(--ink-2); line-height: 1.45; overflow-wrap: anywhere; }
.item-meta .price { color: var(--ink); font-weight: 700; font-size: 16px; white-space: nowrap; }
.item-meta .code { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.item-meta .last { white-space: nowrap; }
.item-meta .pnote { color: var(--ink); }
.item-meta .full { flex-basis: 100%; }
.item-meta .gone { color: var(--red); font-weight: 700; }
.item .qty { grid-area: qty; }
.qty { display: inline-flex; gap: 4px; align-items: center; }
.qty button { min-height: 48px; min-width: 48px; height: 48px; padding: 0; font-size: 26px; line-height: 1; font-weight: 500; background: var(--white); border: 1px solid var(--ink-3);
  color: var(--ink); border-radius: var(--r); }
.qty .qty-val { min-width: 66px; padding: 0 6px; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--paper); color: var(--ink-3); }
.item.has-qty .qty-val { border: 2px solid var(--ink); color: var(--ink); }
.qty button:disabled { opacity: .35; }
@media (min-width: 600px) {
  .item { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name qty" "meta qty"; min-height: 80px; }
}
@media (min-width: 768px) and (pointer: coarse) {
  .qty button { min-height: 56px; min-width: 56px; height: 56px; font-size: 28px; }
  .qty .qty-val { min-width: 76px; font-size: 26px; }
  .item-name { font-size: 21px; }
  .item-meta { font-size: 16px; }
}

/* 底部送出列（手機、平板直式） */
.sbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--hair); }
.sbar-sum { min-width: 0; display: grid; gap: 0; }
.sbar-n { font-size: 17px; font-weight: 700; white-space: nowrap; }
.sbar-n b { font-family: var(--serif); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 6px; }
.sbar-pend { font-size: 14px; color: var(--ink-2); }
.save-st { font-size: 14px; color: var(--ink-2); line-height: 1.35; overflow-wrap: anywhere; }
.save-st.bad { color: var(--red); font-weight: 700; }
.sbar .go { min-height: 58px; font-size: 19px; padding: 0 18px; }
.sbar .go.wrap { max-width: 46vw; }
body.kb-open .sbar, body.kb-open .ck-bar { display: none; }
@media (max-width: 359px) { .sbar .save-st:not(.bad) { display: none; } }
.ed-cart { display: none; }

/* ≥1024：三欄（分類／品項／叫貨單），送出鈕在右欄 */
@media (min-width: 1024px) {
  .v-ed { overflow: hidden; }
  .ed { display: grid; grid-template-columns: 132px minmax(0, 1fr) 340px; grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "top top top" "cats search cart" "cats list cart"; height: calc(100vh - var(--off-h)); height: calc(100dvh - var(--off-h)); }
  .ed-head { display: contents; }
  .ed-top { grid-area: top; min-height: 60px; padding-left: 16px; }
  .ed-title { font-size: 22px; }
  .ed-cats { grid-area: cats; flex-direction: column; overflow-x: hidden; overflow-y: auto; padding: 8px 0; gap: 0; border-bottom: 0; border-right: 1px solid var(--hair); background: var(--paper-2); }
  .chip { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; min-height: 64px; width: 100%; padding: 8px 10px 8px 16px;
    font-family: var(--serif); font-size: 19px; white-space: normal; text-align: left; line-height: 1.25; overflow-wrap: anywhere; }
  .chip .n { font-family: var(--sans); min-width: 0; height: 22px; padding: 0 6px; font-size: 13px; }
  .chip .n::after { content: " 項"; }
  .chip.on { background: var(--white); }
  .chip.on::after { left: 0; right: auto; top: 10px; bottom: 10px; width: 4px; height: auto; }
  body.searching .ed-cats { display: flex; }
  .ed-search { grid-area: search; padding: 10px 16px; }
  .ed-list { grid-area: list; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 32px; min-height: 0; }
  .sec { scroll-margin-top: 0; }
  .sec-h { top: 0; }
  .item { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name qty" "meta qty"; min-height: 76px; padding-left: 20px; }
  .item-name { font-size: 20px; max-width: 760px; }
  .sbar { display: none; }
  .ed-cart { grid-area: cart; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; background: var(--white); border-left: 1px solid var(--hair); }
  .v-ed .mo-toasts { bottom: 24px; }
}
@media (min-width: 1024px) and (max-width: 1279px) { .ed { grid-template-columns: 116px minmax(0, 1fr) 320px; } .chip { font-size: 17px; padding-left: 12px; } }
@media (min-width: 1536px) { .ed { grid-template-columns: 152px minmax(0, 1fr) 380px; } }
.cart-h { padding: 14px 16px; border-bottom: 1px solid var(--hair); }
.cart-h h2 { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.cart-list { overflow-y: auto; min-height: 0; padding: 4px 0; }
.cart-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 16px; border-bottom: 1px solid var(--hair); font-size: 16px; }
.cart-row .n { overflow-wrap: anywhere; font-weight: 700; }
.cart-row .q { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cart-row .a { grid-column: 1 / -1; color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.cart-row.gone .n { color: var(--red); }
.cart-empty { padding: 24px 16px; color: var(--ink-2); font-size: 16px; text-align: center; }
.cart-f { display: grid; gap: 10px; padding: 14px 16px 16px; border-top: 1px solid var(--hair); }
.cart-tot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 18px; font-weight: 700; }
.cart-tot b { font-family: var(--serif); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cart-f .go { min-height: 64px; font-size: 21px; width: 100%; white-space: normal; }

/* ── 數字鍵盤（底部抽屜；平板以上置中） ── */
.kp-bg { position: fixed; inset: 0; z-index: 40; background: rgba(28, 28, 28, .55); display: flex; align-items: flex-end; justify-content: center; }
.kp { width: 100%; max-height: 94dvh; overflow-y: auto; background: var(--paper); border-radius: var(--r) var(--r) 0 0; box-shadow: var(--shadow-md);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.kp-name { font-size: 19px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.kp-meta { font-size: 15px; color: var(--ink-2); line-height: 1.45; overflow-wrap: anywhere; }
.kp-val { min-height: 72px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--hair); background: var(--white); border-radius: var(--r);
  font-family: var(--serif); font-size: 48px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kp-val.fresh { color: var(--ink-2); }
.kp-err { min-height: 1.4em; color: var(--red); font-size: 16px; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.kp-err .mo-btn { min-height: 44px; font-size: 16px; margin: 6px 4px 0; }
.kp-keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kp-keys button { min-height: clamp(52px, 8dvh, 64px); height: clamp(52px, 8dvh, 64px); padding: 0; font-size: 28px; font-weight: 700; background: var(--white); border: 1px solid var(--hair);
  font-variant-numeric: tabular-nums; }
.kp-keys button.fn { font-size: 18px; color: var(--ink-2); }
.kp-acts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; }
.kp-acts .mo-btn { min-height: 56px; font-size: 19px; }
@media (min-width: 768px) {
  .kp-bg { align-items: center; padding: 16px; }
  .kp { width: min(440px, 100%); border-radius: var(--r); }
}

/* ── 檢查清單 ─────────────────────────── */
.ck-top { position: sticky; top: var(--off-h); z-index: 10; }
.ck-body { width: 100%; max-width: 720px; margin: 0 auto; padding: 12px 16px calc(var(--bar-real) + env(safe-area-inset-bottom) + 24px); display: grid; gap: 16px; min-width: 0; }
.ck-main, .ck-side { display: grid; gap: 12px; align-content: start; min-width: 0; }
.ck-h { margin: 6px 0 0; font-size: 18px; font-weight: 700; }
.ck-list { background: var(--white); border: 1px solid var(--hair); border-radius: var(--r); min-width: 0; }
.ck-cat { padding: 6px 14px; background: var(--paper-2); color: var(--ink-2); font-size: 15px; font-weight: 700; border-bottom: 1px solid var(--hair); }
.ck-colh { display: grid; grid-template-columns: minmax(0, 1fr) 64px 96px; gap: 8px; padding: 6px 14px; font-size: 14px; color: var(--ink-2); border-bottom: 1px solid var(--hair); }
.ck-colh span:not(:first-child), .ck-row .q, .ck-row .a { text-align: right; }
.ck-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 96px; gap: 8px; align-items: start; width: 100%; min-height: 56px; padding: 10px 14px; margin: 0; border: 0;
  border-bottom: 1px solid var(--hair); border-radius: 0; background: transparent; text-align: left; font-size: 17px; color: var(--ink); }
.ck-row:last-child { border-bottom: 0; }
.ck-row .n { font-weight: 700; overflow-wrap: anywhere; line-height: 1.35; }
.ck-row .n small { display: block; font-weight: 400; color: var(--ink-2); font-size: 14px; }
.ck-row .q { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.2; }
.ck-row .a { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); padding-top: 2px; }
.ck-row.gone .n { color: var(--red); }
.ck-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; background: var(--white); border: 1px solid var(--hair); border-radius: var(--r);
  padding: 14px 16px; font-size: 18px; font-weight: 700; }
.ck-total b { font-family: var(--serif); font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ck-alert-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--hair); }
.ck-alert-row:first-of-type { border-top: 0; }
.ck-alert-row .mo-btn { min-height: 48px; font-size: 16px; padding: 0 14px; }
.ck-note { display: grid; gap: 6px; font-size: 16px; font-weight: 700; color: var(--ink-2); }
.ck-note textarea { width: 100%; min-width: 0; min-height: 96px; padding: 10px 12px; border: 1px solid var(--ink-3); border-radius: var(--r); background: var(--white); color: var(--ink);
  font-family: var(--sans); font-size: 17px; font-weight: 400; line-height: 1.5; resize: vertical; overflow-wrap: anywhere; }
.ck-note textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.ck-cnt { justify-self: end; font-size: 14px; font-weight: 400; }
.ck-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--hair); }
.ck-bar .mo-btn { min-height: 60px; font-size: 19px; width: 100%; white-space: normal; padding: 6px 12px; }
.ck-bar .go { font-size: 21px; }
@media (min-width: 1024px) {
  .ck-body { max-width: 1160px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); padding-top: 20px; }
  .ck-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); padding-left: max(16px, calc(50% - 580px)); padding-right: max(16px, calc(50% - 580px)); }
  .ck-bar::before { content: ""; }
}

/* ── 送出中／結果不明 ─────────────────── */
.busy { position: fixed; inset: 0; z-index: 70; background: var(--paper); display: flex; align-items: center; justify-content: center; padding: 24px; }
.busy-box { width: min(480px, 100%); display: grid; gap: 14px; text-align: center; }
.busy-t { font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.35; }
.busy-s { min-height: 1.5em; font-size: 18px; color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }
.busy-s.bad { color: var(--red); font-weight: 700; }
.busy-bar { height: 4px; background: var(--paper-3); border-radius: var(--r); overflow: hidden; }
.busy-bar i { display: block; height: 100%; width: 35%; background: var(--ink); animation: busyMove 1.4s linear infinite; }
@keyframes busyMove { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.unk { position: fixed; inset: 0; z-index: 70; background: var(--paper); overflow-y: auto; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; justify-content: center; }
.unk-box { width: min(520px, 100%); display: grid; gap: 14px; align-content: center; margin: auto 0; }
.unk-box h1 { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--red); line-height: 1.3; }
.unk-box p { margin: 0; font-size: 18px; line-height: 1.6; overflow-wrap: anywhere; }

/* ── 送出成功（收據） ─────────────────── */
.done { width: 100%; max-width: 520px; margin: 0 auto; padding: 32px 16px 40px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.done-mark { position: relative; width: 96px; height: 96px; border-radius: 50%; background: var(--green); }
.done-mark::after { content: ""; position: absolute; left: 30px; top: 22px; width: 26px; height: 44px; border: solid #fff; border-width: 0 8px 8px 0; transform: rotate(45deg); }
.done-title { margin: 4px 0 0; font-family: var(--serif); font-size: 34px; font-weight: 600; color: var(--green); }
.done-sub { margin: 0; font-size: 19px; line-height: 1.5; overflow-wrap: anywhere; }
.done-no { max-width: 100%; }
.done-no .stamp { font-size: clamp(26px, 8vw, 38px); padding: .15em .35em; overflow-wrap: anywhere; }
.done-facts { width: 100%; margin: 6px 0 0; display: grid; gap: 0; background: var(--white); border: 1px solid var(--hair); border-radius: var(--r); text-align: left; }
.done-facts > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 12px 16px; border-bottom: 1px solid var(--hair); }
.done-facts > div:last-child { border-bottom: 0; }
.done-facts dt { font-size: 17px; color: var(--ink-2); }
.done-facts dd { margin: 0; font-size: 19px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.done-edit { margin: 0; font-size: 18px; color: var(--ink-2); line-height: 1.5; }
.done .note { width: 100%; text-align: left; }
.done-acts { width: 100%; display: grid; gap: 10px; margin-top: 6px; }

/* ── 紀錄 ─────────────────────────────── */
.hist { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--hair); border-radius: var(--r); }
.hist li { border-bottom: 1px solid var(--hair); }
.hist li:last-child { border-bottom: 0; }
/* 到貨日不拆行（「到／貨」分兩行很難看）；標籤放不下就整組換到下一行靠右 */
.hist-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; min-height: 80px; padding: 12px 16px; text-decoration: none; color: var(--ink); }
.hist-row:hover { background: var(--paper); }
.hist-date { flex: 1 0 auto; max-width: 100%; font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.hist-sub { flex: 1 0 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 16px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hist-row .tags { margin-left: auto; justify-content: flex-end; }
.hist-more { margin-top: 12px; }
.seg2 { display: flex; gap: 4px; background: var(--paper-2); padding: 3px; border-radius: var(--r); overflow-x: auto; scrollbar-width: none; }
.seg2 button { flex: 1 0 auto; min-height: 48px; padding: 0 14px; border: 0; background: transparent; font-size: 17px; color: var(--ink-2); white-space: nowrap; border-radius: var(--r); }
.seg2 button[aria-selected="true"] { background: var(--ink); color: var(--paper); font-weight: 700; }
.dt-head { display: grid; gap: 8px; margin-bottom: 12px; }
.dt-date { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.25; }
.dt-orders { display: grid; gap: 8px; margin: 4px 0 16px; }
.dt-order { background: var(--white); border: 1px solid var(--hair); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 4px; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.dt-order b { font-size: 17px; }
.dt-order .no { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dt-items { margin-top: 12px; }
.dt-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 96px; gap: 8px; align-items: start; padding: 10px 14px; border-bottom: 1px solid var(--hair); font-size: 17px; }
.dt-row:last-child { border-bottom: 0; }
.dt-row .n { font-weight: 700; overflow-wrap: anywhere; line-height: 1.35; }
.dt-row .n small { display: block; font-weight: 400; color: var(--ink-2); font-size: 14px; }
.dt-row .q { text-align: right; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dt-row .a { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 2px; }
.dt-row.tot { background: var(--paper); font-weight: 700; }
.dt-row.tot .a { color: var(--ink); font-size: 19px; }
.dt-note { margin-top: 12px; white-space: pre-wrap; }
.tl { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--hair); border-radius: var(--r); }
.tl li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 10px 14px 10px 18px; border-bottom: 1px solid var(--hair); box-shadow: inset 3px 0 0 var(--hair); font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.tl li:last-child { border-bottom: 0; }
.tl li.k-send { box-shadow: inset 3px 0 0 var(--green); }
.tl li.k-bad { box-shadow: inset 3px 0 0 var(--red); }
.tl time { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 15px; }
.tl b { font-size: 17px; }
.dt-acts { display: grid; gap: 10px; margin-top: 20px; }

/* ── 我的 ─────────────────────────────── */
.me-card { background: var(--white); border: 1px solid var(--hair); border-radius: var(--r); padding: 18px; display: grid; gap: 10px; }
.me-name { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.me-dl { margin: 0; display: grid; gap: 6px; }
.me-dl > div { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 8px; font-size: 17px; line-height: 1.45; }
.me-dl dt { color: var(--ink-2); }
.me-dl dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.me-acts { display: grid; gap: 10px; margin-top: 16px; }
.me-ver { margin: 16px 0 0; text-align: center; font-size: 14px; color: var(--ink-2); }
.pwf { background: var(--white); border: 1px solid var(--hair); border-radius: var(--r); padding: 18px; display: grid; gap: 4px; }
.pwf .lg-field input { font-size: 18px; }
.pwf .lg-err { margin-top: 4px; }
