/* 維修單頁面 */
.repair-page .view { padding-bottom: 90px; }
.home-link { text-decoration: none; margin-right: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chips button { padding: 8px 12px; border-radius: 18px; font-size: 14px; background: #fff; }
.chips button.on { background: var(--p); color: #fff; border-color: var(--p); }
#btn-new { width: 100%; margin: 6px 0 12px; }
.rcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.rcard .r1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rcard .no { font-weight: bold; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; background: #e9eef4; color: #345; }
.pill.intake { background: #fff1c2; color: #7a5a00; }
.pill.signed { background: #e3f0ff; color: #0b57d0; }
.pill.done { background: #d9f5dd; color: #1b6b2a; }
.pill.picked { background: #eceff1; color: #555; }
.pill.cancelled { background: #fdecea; color: #c62828; }
.form-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.sec-title { font-weight: bold; color: #345; margin-bottom: 6px; }
.repair-page .card { margin-bottom: 10px; }
.repair-page label { display: block; margin-top: 6px; }
.repair-page label.inline { display: flex; align-items: center; gap: 6px; }
.repair-page textarea { width: 100%; box-sizing: border-box; font-size: 16px; padding: 8px; border: 1px solid #b7c2cf; border-radius: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.small-note { font-size: 12px; margin: 4px 0 8px; }
.pay-grid { display: grid; grid-template-columns: 56px 1fr 1fr; gap: 6px; align-items: center; }
.pay-grid b { text-align: center; font-size: 13px; color: #607080; }
.pay-grid input { width: 100%; box-sizing: border-box; }
.irow { display: grid; grid-template-columns: 1fr 96px 34px; gap: 6px; margin-bottom: 6px; }
.irow input { width: 100%; box-sizing: border-box; padding: 8px 6px; font-size: 15px; }
.irow .x { padding: 0; }
.checks { display: grid; grid-template-columns: 1fr; gap: 2px; }
@media (min-width: 760px) { .checks { grid-template-columns: 1fr 1fr; column-gap: 16px; } }
.ck { display: grid; grid-template-columns: 1fr 56px; align-items: center; gap: 4px; padding: 3px 0; border-bottom: 1px solid #eef1f4; font-size: 14px; }
.ck.head { font-size: 12px; color: #607080; border: 0; }
.ck.head span:not(:first-child) { text-align: center; }
.ck button { height: 34px; padding: 0; font-size: 18px; font-weight: bold; background: #fff; }
.ck button.ok { color: #1b5e20; background: #e8f5e9; border-color: #a5d6a7; }
.ck button.ng { color: #c62828; background: #fdecea; border-color: #f5c6c2; }
.ck button.na { color: #555; background: #eceff1; }
.terms { margin: 0; padding-left: 22px; font-size: 13px; line-height: 1.55; color: #333; max-height: 260px; overflow-y: auto; }
.sign-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .sign-row { grid-template-columns: 1fr 1fr; } }
.sign-box { border: 1px dashed #b7c2cf; border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.sign-box img { width: 100%; max-height: 140px; object-fit: contain; background: #fafafa; border-radius: 6px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg, #f3f4f7); padding: 8px 0; z-index: 5; flex-wrap: wrap; }
.history { font-size: 12px; margin-top: 10px; line-height: 1.6; }
.modal-body.center { text-align: center; }
#qr-box { display: inline-block; padding: 12px; background: #fff; margin: 8px 0; }
#qr-url { word-break: break-all; font-size: 12px; }

/* 簽名板：全螢幕；直拿手機時把內容轉 90 度，讓客人橫著簽 */
.sigpad { position: fixed; inset: 0; z-index: 100; background: #fff; touch-action: none; overscroll-behavior: none; }
.sig-stage { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; display: flex; flex-direction: column; padding: 10px 14px; box-sizing: border-box; }
.sigpad.rot .sig-stage { left: 100vw; width: 100vh; height: 100vw; transform-origin: top left; transform: rotate(90deg); }
.sig-top { display: flex; gap: 10px; align-items: baseline; font-size: 17px; }
#sig-canvas { flex: 1; width: 100%; min-height: 0; border: 2px solid #c9d3de; border-radius: 10px; margin-top: 8px; background: #fff; touch-action: none; }
.sig-line { height: 0; border-top: 1px dashed #b0bec5; margin: -38px 30px 37px; pointer-events: none; }
.sig-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.sig-actions button { min-width: 96px; height: 44px; font-size: 16px; }

/* 三步驟 */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; position: sticky; top: 52px; z-index: 6; background: var(--bg); padding: 4px 0; }
.steps button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 4px; font-size: 14px; background: #fff; border-radius: 10px; }
.steps button b { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; background: #e9eef4; font-size: 13px; }
.steps button.on { border-color: var(--p); color: var(--p); font-weight: bold; }
.steps button.on b { background: var(--p); color: #fff; }
.big-label { font-weight: bold; }
.big-input { height: 54px; font-size: 22px !important; letter-spacing: 1px; }
.chips.quick button { font-size: 15px; padding: 9px 13px; }
.chips.quick button.on { background: var(--p); color: #fff; border-color: var(--p); }
.sum-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 18px; font-weight: bold; }
.sum-line input { width: 150px; font-size: 22px; font-weight: bold; text-align: right; color: var(--p); }
.seg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid #b7c2cf; border-radius: 10px; overflow: hidden; margin-top: 2px; }
.seg2 button { border: 0; border-radius: 0; height: 42px; background: #fff; font-size: 15px; }
.seg2 button.on { background: var(--p); color: #fff; }
details.more { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; }
details.more summary { cursor: pointer; color: #345; font-size: 14px; padding: 4px 0; }
.next { width: 100%; margin: 4px 0 12px; }
.choice2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.choice2 button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 6px; font-size: 16px; background: #fff; border-radius: 12px; }
.choice2 button span { font-size: 13px; color: var(--muted); }
.choice2 button.on { border: 2px solid var(--p); background: #eef5ff; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.nopower-note { background: #fff4e5; color: #8a4b00; border-radius: 10px; padding: 12px; font-weight: bold; }
.ck.two { grid-template-columns: 1fr 52px 52px; }
.summary .sum-grid { display: grid; grid-template-columns: 52px 1fr; gap: 6px 10px; font-size: 15px; }
.summary .sum-grid > span { color: var(--muted); }
.summary .err { color: var(--err); }
.done-check { color: var(--ok); font-size: 20px; font-weight: bold; margin-bottom: 4px; }
.sig-hint { margin-right: auto; align-self: center; font-size: 13px; }

/* 圖形密碼 */
.pattern-field { margin-top: 6px; }
.pf-label { display: block; }
.pattern-btn { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 8px; justify-content: flex-start; padding: 4px 8px; background: #fff; text-align: left; }
.pattern-btn svg { flex: none; }
.pattern-pad { width: min(78vw, 300px); height: min(78vw, 300px); touch-action: none; user-select: none; -webkit-user-select: none; background: #f6f8fb; border-radius: 16px; margin: 10px auto 4px; display: block; }
.pattern-seq { font-size: 18px; font-weight: bold; letter-spacing: 1px; color: #0b57d0; min-height: 26px; }

/* PDF 預覽 */
.pdf-viewer { position: fixed; inset: 0; z-index: 90; background: #525659; display: flex; flex-direction: column; }
.pdf-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top)); background: #1d2a36; color: #fff; }
.pdf-bar button { height: 40px; padding: 0 14px; font-size: 16px; }
.pdf-x { background: #fff; color: #1d2a36; font-weight: bold; }
.pdf-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pdf-body canvas { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.pdf-loading { color: #eee; margin-top: 40px; }
.pdf-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.pdf-body { align-items: flex-start; }
.pdf-body canvas { margin: 0 auto; cursor: zoom-in; }
.pdf-body canvas.zoom { cursor: zoom-out; margin: 0; }
.pdf-acts { display: flex; gap: 6px; }
#a4-printer { width: 100%; }
/* 第 4 步、進度 */
.steps { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.steps button[hidden] { display: none; }
.flowbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; list-style: none; padding: 0; margin: 0 0 10px; }
.flowbar li { background: #e9eef4; border-radius: 8px; padding: 6px 4px; text-align: center; font-size: 12px; color: #607080; display: flex; flex-direction: column; }
.flowbar li b { font-size: 13px; }
.flowbar li.past { background: #d9f5dd; color: #1b6b2a; }
.flowbar li.now { background: var(--p); color: #fff; }
.flowbar li.cancel { grid-column: 1 / -1; background: #fdecea; color: #c62828; font-weight: bold; }
.timeline { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.7; }
.timeline li span { color: var(--muted); margin-left: 6px; font-size: 13px; }
.req { color: var(--err); }
.ck .bf { font-style: normal; font-weight: bold; margin-left: 4px; font-size: 13px; opacity: .55; }
.ck .bf.ok { color: #1b5e20; } .ck .bf.ng { color: #c62828; opacity: .9; }
.ck button:disabled { opacity: .55; }
#pickup-card.dim { opacity: .55; }
.sig-img { width: 100%; max-height: 140px; object-fit: contain; background: #fafafa; border-radius: 6px; margin-top: 6px; }
/* 機身照片 */
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.photos .ph { position: relative; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; background: #eee; }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; }
.photos .ph button { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; padding: 0; border-radius: 50%; font-size: 13px; background: rgba(255,255,255,.9); }
.photos .ph span { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 11px; text-align: center; }
.steps button { white-space: nowrap; font-size: 13.5px; gap: 4px; padding: 8px 2px; }
/* 照片檢視 */
.photos .ph img { cursor: zoom-in; }
.photo-viewer { position: fixed; inset: 0; z-index: 95; background: #111; display: flex; flex-direction: column; }
.pv-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top)); color: #fff; }
.pv-bar button { height: 40px; padding: 0 14px; font-size: 16px; }
.pv-body { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: pan-y pinch-zoom; }
.pv-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; font-size: 34px; padding: 0; background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 10px; }
#pv-prev { left: 6px; } #pv-next { right: 6px; }
.pv-foot { text-align: center; padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); color: #bbb; }
.store-path { background: #f3f6f9; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.store-path code { font-size: 12.5px; word-break: break-all; background: #fff; padding: 4px 6px; border-radius: 6px; }
.line-test { font-size: 13px; line-height: 1.7; background: #f6f8fb; border-radius: 8px; padding: 6px 10px; margin-top: 6px; word-break: break-all; }
.line-test:empty { display: none; }
/* 收款 */
.paym { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0; }
.paym button { padding: 9px 2px; font-size: 13.5px; background: #fff; border-radius: 10px; white-space: nowrap; }
.paym button.on { background: var(--p); color: #fff; border-color: var(--p); }
.paym.big button { padding: 12px 2px; font-size: 14.5px; font-weight: bold; }
.paid-line { margin: 6px 0; font-size: 15px; }
.due-text { color: var(--err); font-weight: bold; }
.ok-text { color: var(--ok); font-weight: bold; }
.pay-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.pl-row { display: flex; align-items: center; gap: 8px; font-size: 14.5px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.pl-row span { flex: 1; } .pl-row em { display: block; font-style: normal; font-size: 12px; color: var(--muted); }
.pl-row.tot { font-size: 16px; font-weight: bold; border-bottom: 1px solid var(--line); }
.pl-row .x { width: 30px; height: 30px; padding: 0; }
.due-box { border-radius: 12px; padding: 14px; text-align: center; font-size: 18px; margin: 6px 0 10px; }
.due-box b { font-size: 30px; display: block; }
.due-box.unpaid { background: #fdecea; color: #c62828; border: 2px solid #f19a93; }
.due-box.paid { background: #e8f5e9; color: #1b6b2a; font-weight: bold; }
.due-box .rel { font-size: 13px; margin-top: 4px; }
.pay-modal .pm-amt input { text-align: center; font-weight: bold; color: var(--p); }
.bank-card { text-align: left; background: #f3f6f9; border-radius: 10px; padding: 10px 12px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.bank-card div { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.bank-card span { color: var(--muted); width: 36px; font-size: 13px; }
.bank-card b { flex: 1; letter-spacing: .5px; }
.qr-wrap { display: inline-block; padding: 10px; background: #fff; margin: 6px 0; }
.lp-note { font-size: 15px; margin: 4px 0; }
.lp-wait { font-size: 17px; font-weight: bold; color: #06c755; margin: 4px 0; }
.lp-wait.err { color: var(--err); }
.lp-big { font-size: 40px; font-weight: 800; color: #06c755; margin: 2px 0 6px; }
.order-actions { flex-wrap: wrap; margin-top: 4px; }
.qr-status { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #eef5ff; color: #0b57d0; font-weight: bold; }
.qr-status.ok { background: #e8f5e9; color: #1b6b2a; }
.qr-status.err { background: #fdecea; color: #c62828; }
/* POS 消費紀錄（舊單參考） */
.pos-hist { margin-top: 14px; border-top: 2px dashed var(--line); padding-top: 10px; }
.ph-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 16px; }
.phcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.phcard.rep { border-left: 4px solid #f9a825; }
.phcard .r1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.phcard .r1 b { font-size: 15px; }
.phcard .amt { font-weight: bold; color: var(--p); }
.phcard .items { font-size: 14px; margin-top: 4px; line-height: 1.5; word-break: break-word; }
.phcard .items .rp { color: #b26a00; font-weight: bold; }
.sale-modal { max-width: 520px; }
.sm-head { display: flex; justify-content: space-between; align-items: center; font-size: 17px; }
.sm-lines { margin: 10px 0; }
.sm-line { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.sm-line .nm { word-break: break-word; } .sm-line .nm.rp { color: #b26a00; font-weight: bold; }
.sm-line .sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.sm-line .am { font-weight: bold; text-align: right; }
.sm-total { text-align: right; font-size: 18px; font-weight: bold; }
.sm-extra { margin-top: 8px; font-size: 14px; line-height: 1.7; background: #f6f8fb; border-radius: 8px; padding: 6px 10px; }
.sm-extra:empty { display: none; }
/* 取件：結帳寫入 POS */
.pos-box { background: #f6f8fb; border-radius: 10px; padding: 10px; margin: 6px 0 10px; }
.pos-preview { font-size: 14.5px; line-height: 1.6; }
.inv-pick { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.inv-pick input { width: 100%; box-sizing: border-box; }
#inv-company-f { display: flex; flex-direction: column; gap: 6px; }
#inv-company-f[hidden] { display: none; }
.pos-result { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: #eef5ff; font-size: 14.5px; line-height: 1.6; }
.pos-result.ok { background: #e8f5e9; color: #1b6b2a; }
.pos-result.err { background: #fdecea; color: #c62828; font-weight: bold; }
