:root{
  --bg:#F5F7F4;
  --surface:#FFFFFF;
  --surface-alt:#ECF1EC;
  --ink:#152321;
  --ink-soft:#54655F;
  --ink-faint:#8B9992;
  --border:#DBE3DB;
  --border-soft:#E9EFE8;
  --accent:#0E8B77;
  --accent-ink:#FFFFFF;
  --accent-soft:#E1F2EC;
  --accent-soft-ink:#0A6B5B;
  --deal:#DD5228;
  --deal-soft:#FCE7DE;
  --deal-soft-ink:#B23F1B;
  --warn:#B37F1E;
  --warn-soft:#F7EDD8;
  --shadow-shell: 0 24px 60px -24px rgba(16,35,30,0.35);
  --font-body:"Noto Sans TC","PingFang TC","Microsoft JhengHei",sans-serif;
  --font-num:"IBM Plex Mono","SFMono-Regular",Menlo,Consolas,monospace;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0C1614; --surface:#13201D; --surface-alt:#192823;
    --ink:#E9F1EE; --ink-soft:#9EB2AC; --ink-faint:#6C807A;
    --border:#25352F; --border-soft:#1D2B26;
    --accent:#33C7A8; --accent-ink:#04211B; --accent-soft:rgba(51,199,168,0.14); --accent-soft-ink:#5FE0C2;
    --deal:#FF7E51; --deal-soft:rgba(255,126,81,0.14); --deal-soft-ink:#FFA37E;
    --warn:#E7B65E; --warn-soft:rgba(231,182,94,0.14);
    --shadow-shell: 0 24px 60px -24px rgba(0,0,0,0.6);
  }
}
:root[data-theme="dark"]{
  --bg:#0C1614; --surface:#13201D; --surface-alt:#192823;
  --ink:#E9F1EE; --ink-soft:#9EB2AC; --ink-faint:#6C807A;
  --border:#25352F; --border-soft:#1D2B26;
  --accent:#33C7A8; --accent-ink:#04211B; --accent-soft:rgba(51,199,168,0.14); --accent-soft-ink:#5FE0C2;
  --deal:#FF7E51; --deal-soft:rgba(255,126,81,0.14); --deal-soft-ink:#FFA37E;
  --warn:#E7B65E; --warn-soft:rgba(231,182,94,0.14);
  --shadow-shell: 0 24px 60px -24px rgba(0,0,0,0.6);
}

*{box-sizing:border-box;}
p{margin:0;}
html,body{margin:0; background:var(--bg); color:var(--ink); font-family:var(--font-body);}
body{display:flex; justify-content:center; padding-block:28px; padding-inline:16px; min-height:100vh;}
button,input,select{font-family:inherit;}
.num{font-family:var(--font-num); font-variant-numeric:tabular-nums;}

.app-shell{
  position:relative;
  width:100%; max-width:412px; background:var(--surface); border-radius:30px;
  box-shadow:var(--shadow-shell); border:1px solid var(--border-soft);
  overflow:hidden; display:flex; flex-direction:column; height:812px;
}

.modal-overlay{
  position:absolute; inset:0; z-index:25; background:rgba(0,0,0,.45);
  display:flex; align-items:center; justify-content:center; padding:20px;
}
.modal-card{
  width:100%; max-width:340px; background:var(--surface); border-radius:20px;
  padding:20px; display:flex; flex-direction:column; gap:12px;
  box-shadow:var(--shadow-shell);
}
.btn-row{display:flex; gap:10px;}
.btn-row .btn{flex:1;}

.ai-status-row{display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--ink-soft); min-height:18px;}
.intro-section{margin-bottom:14px;}
.intro-section:last-child{margin-bottom:0;}
.intro-label{font-weight:800; color:var(--accent-soft-ink); margin-bottom:4px; font-size:13px;}
.mini-spinner{width:14px; height:14px; border-radius:50%; border:2px solid var(--border); border-top-color:var(--accent); animation:spin 0.8s linear infinite; flex:none;}
@media (prefers-reduced-motion:reduce){ .mini-spinner{animation:none;} }

.scanner-overlay{
  position:absolute; inset:0; z-index:30; background:#000;
  display:flex; align-items:center; justify-content:center;
}
.scanner-overlay video{ width:100%; height:100%; object-fit:cover; }
.scanner-frame{
  position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
  width:76%; height:110px; border:3px solid var(--accent); border-radius:12px;
  box-shadow:0 0 0 999px rgba(0,0,0,.5); pointer-events:none;
}
.scanner-status{
  position:absolute; bottom:64px; left:16px; right:16px; text-align:center;
  color:#fff; font-size:13px;
}
.toast{
  position:absolute; bottom:90px; left:50%; transform:translateX(-50%);
  background:var(--ink); color:var(--surface); font-size:13px; font-weight:600;
  padding:10px 18px; border-radius:999px; z-index:40; white-space:nowrap;
  box-shadow:var(--shadow-shell); max-width:80%; overflow:hidden; text-overflow:ellipsis;
}
.scanner-close{
  position:absolute; top:16px; right:16px; width:36px; height:36px; border-radius:50%;
  background:rgba(255,255,255,.18); color:#fff; border:none; font-size:16px; cursor:pointer;
}
@media (max-width:460px){
  body{padding:0;}
  .app-shell{max-width:100%; border-radius:0; box-shadow:none; border:none; height:100vh; height:100dvh;}
}

.topbar{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 20px 14px; border-bottom:1px solid var(--border-soft);}
.brand{display:flex; align-items:center; gap:8px;}
.brand-mark{width:22px; height:22px; flex:none;}
.brand-name{font-weight:900; font-size:17px;}
.points-chip{display:flex; align-items:center; gap:6px; background:linear-gradient(135deg, #25C99A 0%, #08AD8C 50%, #028A7C 100%); color:#fff; border:none; border-radius:999px; padding:6px 12px 6px 8px; font-weight:700; font-size:14px; cursor:pointer;}
.points-chip svg{width:16px; height:16px;}
.barcode-rule{height:6px; display:flex; gap:2px; padding:0 20px 10px; opacity:.5;}
.barcode-rule span{background:var(--ink-faint); flex:none;}

main{flex:1; overflow-y:auto;}
section[data-view]{padding:18px 20px 28px; display:flex; flex-direction:column; gap:16px;}
#view-scan{gap:32px;}
.eyebrow{font-size:14px; font-weight:800; letter-spacing:.03em; color:var(--ink);}
.summary-row{font-size:15px; font-weight:800; color:var(--ink); line-height:1.4;}
.page-intro{display:flex; flex-direction:column; gap:4px;}
.region-select{font-size:13.5px; color:var(--ink); background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:10px 12px; width:100%;}
.online-compare-card{display:flex; flex-direction:column; gap:10px;}

.boot-screen{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:16px; padding:80px 20px; text-align:center; color:var(--ink-soft); font-size:13.5px;}
.boot-spinner{width:32px; height:32px; border-radius:50%; border:3px solid var(--border); border-top-color:var(--accent); animation:spin 0.9s linear infinite;}
@keyframes spin{to{transform:rotate(360deg);}}
@media (prefers-reduced-motion:reduce){ .boot-spinner{animation:none;} }

.store-picker-card{
  background:var(--surface-alt); border:1px solid var(--border-soft); border-radius:16px;
  padding:14px; margin-top:10px; display:flex; flex-direction:column;
}
.mini-label{display:block; font-size:12.5px; font-weight:700; color:var(--ink-soft); margin-bottom:6px;}
.or-divider{display:flex; align-items:center; gap:10px; margin:14px 0 4px; font-size:11.5px; color:var(--ink-faint);}
.or-divider::before,.or-divider::after{content:""; flex:1; height:1px; background:var(--border);}
.map-link-row{display:flex; gap:8px;}
.map-link-row input{flex:1; min-width:0;}
.map-link-row .btn{flex:none; padding:11px 18px;}

.report-step{display:flex; flex-direction:column; gap:14px;}

.scope-toggle{display:flex; gap:8px;}
.scope-btn{
  flex:1; padding:9px 12px; border-radius:10px; border:1px solid var(--border);
  background:var(--surface); color:var(--ink-soft); font-size:12.5px; font-weight:700; cursor:pointer;
}
.scope-btn.active{background:#028A7C; border-color:#028A7C; color:var(--accent-ink);}

.selected-store-chip{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:var(--accent-soft); color:var(--accent-soft-ink); border-radius:12px;
  padding:12px 14px; font-size:14px; font-weight:700;
}
.selected-store-chip button{
  background:none; border:1px solid currentColor; color:inherit; border-radius:8px;
  padding:4px 10px; font-size:12px; font-weight:700; cursor:pointer;
}

.history-chip-list{display:flex; gap:8px; overflow-x:auto; padding-bottom:2px;}
.history-chip{
  flex:none; display:flex; flex-direction:column; gap:2px;
  background:var(--surface-alt); border:1px solid var(--border-soft); border-radius:12px;
  padding:8px 12px; cursor:pointer; max-width:150px; text-align:left;
}
.history-chip:hover{border-color:var(--accent);}
.history-chip .h-name{font-size:12.5px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.history-chip .h-time{font-size:10.5px; color:var(--ink-faint);}

.store-list{display:flex; flex-direction:column; gap:10px;}
.store-row{display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:12px 14px;}
.store-row.is-cheapest{border-color:var(--deal); box-shadow:0 0 0 1px var(--deal) inset;}
.store-main{flex:1; min-width:0; display:flex; flex-direction:column; gap:4px;}
.store-name{font-size:14px; font-weight:700;}
.store-region{font-size:11px; font-weight:600; color:var(--ink-faint); margin-left:6px;}
.store-mode-note{font-size:11.5px; color:var(--ink-faint);}
.store-nav-btn{align-self:flex-start; margin-top:2px; padding:4px 10px; min-height:32px; border:1px solid var(--border); border-radius:999px; background:var(--surface); color:var(--ink-soft); font-size:13px; cursor:pointer;}
.store-nav-btn:focus-visible{outline:2px solid var(--deal); outline-offset:2px;}
.store-price-block{text-align:right; flex:none; display:flex; flex-direction:column; gap:2px; align-items:flex-end;}
.store-price{font-size:17px; font-weight:700;}
.store-date{font-size:11px; color:var(--ink-faint);}
.tag{display:inline-flex; align-items:center; gap:4px; font-size:10.5px; font-weight:700; border-radius:999px; padding:2px 8px; width:fit-content;}
.tag-deal{background:var(--deal-soft); color:var(--deal-soft-ink);}
.tag-sale{background:var(--deal); color:#fff;}
.tag-warn{background:var(--warn-soft); color:var(--warn);}
.tag-pending{background:var(--surface-alt); color:var(--ink-faint); border:1px solid var(--border);}

.teaser-card{display:flex; flex-direction:column; align-items:center; gap:10px; text-align:center; background:var(--surface-alt); border:1px dashed var(--border); border-radius:18px; padding:26px 20px;}
.teaser-card svg{width:26px; height:26px; color:var(--ink-faint);}
.teaser-title{font-size:14.5px; font-weight:700;}
.teaser-body{font-size:12.5px; color:var(--ink-soft); max-width:30ch; line-height:1.5;}

.field{display:flex; flex-direction:column; gap:6px;}
.field-label-row{display:flex; align-items:center; justify-content:space-between; gap:8px;}
.field label{font-size:14px; font-weight:700; color:var(--ink-soft);}
.text-link-btn{
  background:none; border:none; color:var(--ink-soft); text-decoration:underline;
  font-size:12.5px; cursor:pointer; padding:6px 0; text-align:left;
}
.field input,.field select{font-size:14.5px; color:var(--ink); background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:11px 12px;}
.field input:focus,.field select:focus{outline:2px solid var(--accent); outline-offset:1px;}

#myReportsFilter{
  width:100%; font-size:14.5px; color:var(--ink);
  background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:11px 12px;
}
#myReportsFilter:focus{outline:2px solid var(--accent); outline-offset:1px;}

.autocomplete-wrap{position:relative; min-width:0;}
.autocomplete-wrap input{width:100%;}
.suggestion-list{
  position:absolute; top:100%; left:0; right:0; z-index:15;
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  margin-top:4px; max-height:220px; overflow-y:auto;
  box-shadow:var(--shadow-shell);
}
.suggestion-item{
  padding:10px 14px; font-size:14px; cursor:pointer; border-bottom:1px solid var(--border-soft);
}
.suggestion-item:last-child{border-bottom:none;}
.suggestion-item:active{background:var(--surface-alt);}
.field-hint{font-size:11.5px; color:var(--ink-faint);}

.checkbox-row{display:flex; align-items:flex-start; gap:8px; font-size:12.5px; color:var(--ink-soft); line-height:1.5; cursor:pointer;}
.checkbox-row input{margin-top:2px; flex:none;}

.btn{display:inline-flex; align-items:center; justify-content:center; gap:7px; border-radius:13px; border:1px solid transparent; font-weight:700; font-size:14px; cursor:pointer; padding:12px 16px;}
.btn:active{transform:scale(.98);}
.btn-primary{background:linear-gradient(135deg, #25C99A 0%, #08AD8C 50%, #028A7C 100%); color:var(--accent-ink);}

.scan-banner{
  position:relative; display:flex; align-items:center; width:100%;
  aspect-ratio:728/543; border:none; border-radius:20px; padding:0; margin:0;
  background-color:transparent; background-size:cover; background-position:center;
  cursor:pointer; -webkit-appearance:none; appearance:none; -webkit-tap-highlight-color:transparent;
}
.scan-banner:active{ transform:scale(.98); }
.scan-banner-compare{ background-image:url("banner-compare.png"); }
.scan-banner-report{ background-image:url("banner-report.png"); }
.scan-banner-text{
  margin-left:auto; margin-right:9%; text-align:right; color:#fff; font-weight:900;
  font-size:21px; line-height:1.35; text-shadow:0 2px 10px rgba(0,0,0,0.18);
}
.btn-secondary{background:var(--surface); color:var(--ink); border-color:var(--border);}
.btn-block{width:100%;}
.btn:disabled{opacity:.6; cursor:not-allowed;}
.btn:focus-visible{outline:2px solid var(--accent); outline-offset:2px;}

.balance-card{background:linear-gradient(155deg,var(--accent) 0%, #0A6656 100%); color:#fff; border-radius:20px; padding:22px 20px; display:flex; flex-direction:column; gap:4px;}
.balance-label{font-size:12.5px; opacity:.85; font-weight:600;}
.balance-value{font-size:38px; font-weight:800; display:flex; align-items:baseline; gap:6px;}
.balance-value small{font-size:15px; font-weight:600; opacity:.85;}
.balance-note{font-size:11.5px; opacity:.75;}

.earn-tip{display:flex; gap:10px; padding:14px; background:var(--surface-alt); border-radius:14px; font-size:12.5px; color:var(--ink-soft); line-height:1.6;}
.earn-tip svg{width:16px; height:16px; flex:none; color:var(--accent-soft-ink); margin-top:2px;}

.invite-code-card{display:flex; align-items:center; justify-content:space-between; gap:12px; background:var(--surface-alt); border:1px dashed var(--border); border-radius:16px; padding:16px 18px;}
.invite-code{font-family:var(--font-num); font-size:20px; font-weight:700; letter-spacing:.06em;}

.my-reports-list{display:flex; flex-direction:column; gap:10px;}
.my-report-row{display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:12px 14px;}
.my-report-main{flex:1; min-width:0; display:flex; flex-direction:column; gap:3px;}
.my-report-name{font-size:13.5px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; cursor:pointer;}
.my-report-name.expanded{white-space:normal; overflow:visible; text-overflow:clip;}
.my-report-sub{font-size:11.5px; color:var(--ink-faint);}
.my-report-price-block{text-align:right; flex:none; display:flex; flex-direction:column; gap:3px; align-items:flex-end;}
.my-report-price{font-size:15px; font-weight:700;}

.ledger-list{display:flex; flex-direction:column; gap:2px;}
.ledger-row{
  display:flex; align-items:center; gap:12px;
  padding:12px 2px; border-bottom:1px solid var(--border-soft);
}
.ledger-row:last-child{border-bottom:none;}
.ledger-icon{
  width:34px; height:34px; border-radius:10px; flex:none;
  display:flex; align-items:center; justify-content:center;
}
.ledger-icon svg{width:16px; height:16px;}
.ledger-icon.earn{background:var(--accent-soft); color:var(--accent-soft-ink);}
.ledger-icon.spend{background:var(--deal-soft); color:var(--deal-soft-ink);}
.ledger-main{flex:1; min-width:0; display:flex; flex-direction:column; gap:2px;}
.ledger-title{font-size:13.5px; font-weight:600;}
.ledger-sub{font-size:11.5px; color:var(--ink-faint);}
.ledger-delta{font-size:14.5px; font-weight:700; flex:none;}
.ledger-delta.earn{color:var(--accent-soft-ink);}
.ledger-delta.spend{color:var(--ink-faint);}
.status-chip{font-size:10px; font-weight:700; padding:1px 7px; border-radius:999px; width:fit-content;}
.status-pending{background:var(--warn-soft); color:var(--warn);}
.status-first{background:var(--accent-soft); color:var(--accent-soft-ink);}
.status-confirmed{background:var(--accent-soft); color:var(--accent-soft-ink);}
.edit-chip{background:none; border:1px solid var(--border); color:var(--ink-soft); cursor:pointer; font-family:inherit;}
.my-report-chip-row{display:flex; gap:6px; align-items:center;}

.tabbar{display:flex; border-top:1px solid var(--border-soft); background:var(--surface); padding:6px 6px calc(env(safe-area-inset-bottom,0px) + 6px);}
.tab-btn{position:relative; flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; background:none; border:none; padding:8px 4px 6px; border-radius:12px; color:var(--ink-faint); cursor:pointer;}
.tab-btn svg{width:21px; height:21px;}
.tab-btn span{font-size:10.5px; font-weight:600;}
.tab-btn[aria-current="page"]{color:var(--accent);}
.tab-btn[aria-current="page"]::after{
  content:""; position:absolute; bottom:1px; left:50%; transform:translateX(-50%);
  width:22px; height:3px; border-radius:999px; background:var(--accent);
}
.tab-btn:focus-visible{outline:2px solid var(--accent); outline-offset:-2px;}

[hidden]{display:none !important;}

/* ===== 購物車・分帳 ===== */
.cart-panel{display:flex; flex-direction:column; gap:16px;}
.btn-sm{padding:6px 12px; font-size:12.5px; border-radius:10px;}
.danger-link{color:var(--deal-soft-ink);}
.modal-scroll{max-height:86vh; overflow-y:auto;}

.cart-list{display:flex; flex-direction:column; gap:10px;}
.cart-row{display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:12px 14px;}
.cart-row-check{flex:none; width:18px; height:18px; accent-color:var(--accent);}
.cart-row-main{flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; background:none; border:none; padding:0; text-align:left; color:inherit; cursor:pointer; font:inherit;}
.cart-row-title{font-size:14px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.cart-row-sub{font-size:11.5px; color:var(--ink-faint);}
.cart-row-side{flex:none; text-align:right; display:flex; flex-direction:column; gap:2px; align-items:flex-end;}
.cart-row-total{font-size:15px; font-weight:700;}
.cart-row-mine{font-size:11px; font-weight:700;}
.owe{color:var(--deal-soft-ink);}
.receive{color:var(--accent-soft-ink);}

.cart-head{display:flex; flex-direction:column; gap:4px;}
.cart-head-store{font-size:18px; font-weight:900;}
.cart-head-sub{font-size:12px; color:var(--ink-faint); display:flex; gap:8px; align-items:center; flex-wrap:wrap;}

.member-chip-list{display:flex; flex-wrap:wrap; gap:8px;}
.member-chip{display:inline-flex; align-items:center; gap:6px; background:var(--surface-alt); border:1px solid var(--border-soft); border-radius:999px; padding:6px 12px; font-size:13px; font-weight:700; color:var(--ink); cursor:pointer; font-family:inherit;}
.member-chip.is-me{background:var(--accent-soft); color:var(--accent-soft-ink); border-color:transparent;}
.member-chip .chip-note{font-size:10.5px; font-weight:600; color:var(--ink-faint);}
.member-chip.add{border-style:dashed; color:var(--ink-soft); background:none;}
.member-chip .chip-x{font-size:12px; color:var(--ink-faint);}

.contact-suggest{display:flex; flex-wrap:wrap; gap:6px;}
.contact-suggest:empty{display:none;}
.contact-pill{background:none; border:1px dashed var(--border); border-radius:999px; padding:4px 10px; font-size:12px; color:var(--ink-soft); cursor:pointer; font-family:inherit;}

.cart-add-card{display:flex; flex-direction:column; gap:10px; background:var(--surface-alt); border:1px solid var(--border-soft); border-radius:16px; padding:14px;}
.cart-add-card input{width:100%; font-size:14.5px; color:var(--ink); background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:11px 12px;}

.cart-group{display:flex; flex-direction:column; gap:8px; margin-bottom:14px;}
.cart-group-head{display:flex; justify-content:space-between; align-items:baseline; font-size:13px; font-weight:800; color:var(--ink-soft);}
.cart-item-row{display:flex; align-items:center; gap:10px; background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:10px 12px; width:100%; text-align:left; font:inherit; color:inherit; cursor:pointer;}
.cart-item-row:disabled{cursor:default;}
.cart-item-main{flex:1; min-width:0; display:flex; flex-direction:column; gap:4px;}
.cart-item-name{font-size:13.5px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.cart-item-tags{display:flex; flex-wrap:wrap; gap:4px;}
.cart-item-price{flex:none; text-align:right; display:flex; flex-direction:column; gap:2px; align-items:flex-end;}
.cart-item-line{font-size:14.5px; font-weight:700;}
.cart-item-unit{font-size:11px; color:var(--ink-faint);}
.tag-muted{background:var(--surface-alt); color:var(--ink-soft);}
.tag-ok{background:var(--accent-soft); color:var(--accent-soft-ink);}

.cart-item-product{font-size:14px; font-weight:700; line-height:1.5;}
.seg-toggle{display:inline-flex; border:1px solid var(--border); border-radius:10px; overflow:hidden;}
.seg-btn{background:var(--surface); border:none; padding:5px 12px; font-size:12.5px; font-weight:700; color:var(--ink-soft); cursor:pointer; font-family:inherit;}
.seg-btn.active{background:#028A7C; color:var(--accent-ink);}

.discount-list{display:flex; flex-direction:column; gap:6px; margin-bottom:8px;}
.discount-row{display:flex; justify-content:space-between; align-items:center; gap:8px; font-size:13px; background:var(--surface-alt); border-radius:10px; padding:8px 12px;}
.discount-row button{background:none; border:none; color:var(--ink-faint); cursor:pointer; font-size:12px; font-family:inherit;}
.discount-form{display:flex; gap:6px; margin-bottom:6px;}
.discount-form select,.discount-form input{min-width:0; font-size:13.5px; color:var(--ink); background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:8px;}
.discount-form select{flex:none;}
.discount-form #discountValue{width:64px; flex:none;}
.discount-form #discountLabel{flex:1;}

.settle-card{display:flex; flex-direction:column; gap:10px; background:var(--surface-alt); border:1px solid var(--border-soft); border-radius:18px; padding:16px;}
.settle-row{display:flex; justify-content:space-between; align-items:center; gap:10px; font-size:13px; color:var(--ink-soft);}
.settle-row strong{color:var(--ink); font-size:14px;}
.settle-row input,.settle-row select{width:120px; font-size:13.5px; color:var(--ink); background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:7px 10px; text-align:right;}
.settle-row select{text-align:left;}
.settle-total{border-top:1px solid var(--border); padding-top:10px; font-size:15px;}
.settle-total strong{font-size:18px;}
.settle-divider{height:1px; background:var(--border); margin:2px 0;}
.debt-row{display:flex; align-items:center; gap:10px; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:10px 12px;}
.debt-main{flex:1; min-width:0; font-size:13.5px; font-weight:700;}
.debt-sub{font-size:11.5px; color:var(--ink-faint); font-weight:500;}
.debt-amt{flex:none; text-align:right; font-weight:700;}

.nearby-list{display:flex; flex-direction:column; gap:6px; margin-top:8px;}
.nearby-item{display:flex; justify-content:space-between; gap:8px; background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:9px 12px; font-size:13.5px; text-align:left; cursor:pointer; font-family:inherit; color:var(--ink);}
.nearby-item span:last-child{color:var(--ink-faint); font-size:11.5px; flex:none;}

.join-claim-list{display:flex; flex-direction:column; gap:8px;}
.contacts-list{display:flex; flex-direction:column; gap:6px;}
.contact-row{display:flex; justify-content:space-between; align-items:center; font-size:14px; padding:8px 4px; border-bottom:1px solid var(--border-soft);}
.contact-row button{background:none; border:1px solid var(--border); border-radius:8px; color:var(--deal-soft-ink); font-size:12px; padding:3px 10px; cursor:pointer; font-family:inherit;}
.cart-owner-actions{display:flex; flex-direction:column; gap:10px; align-items:center;}

.stepper{display:flex; align-items:stretch; border:1px solid var(--border); border-radius:12px; overflow:hidden; background:var(--surface);}
.stepper input{flex:1; min-width:0; width:100%; border:none !important; border-radius:0 !important; text-align:center; padding:11px 4px !important; -moz-appearance:textfield;}
.stepper input::-webkit-outer-spin-button,.stepper input::-webkit-inner-spin-button{-webkit-appearance:none; margin:0;}
.stepper-btn{flex:none; width:40px; border:none; background:var(--surface-alt); color:var(--ink); font-size:18px; font-weight:700; cursor:pointer; font-family:inherit;}
.stepper-btn:active{background:var(--accent-soft);}
.stepper-btn:focus-visible{outline:2px solid var(--accent); outline-offset:-2px;}
.alloc-list{display:flex; flex-direction:column; gap:6px;}
.alloc-row{display:flex; align-items:center; gap:10px; padding:6px 6px 6px 12px; border:1px solid var(--border-soft); border-radius:12px; background:var(--surface);}
.alloc-row.active{border-color:var(--accent); background:var(--accent-soft);}
.alloc-name{flex:1; min-width:0; font-size:14px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.alloc-row .stepper{flex:none; width:128px;}
.alloc-row .stepper input{padding:7px 2px !important; font-size:14px;}
.alloc-row .stepper-btn{width:36px;}
.ai-tax-note{margin-left:6px; font-size:11px; color:var(--accent-soft-ink); font-weight:700;}

.settle-summary{display:flex; flex-direction:column; gap:10px;}
.tax-free-box{display:flex; flex-direction:column; gap:6px; background:var(--surface); border:1px dashed var(--border); border-radius:12px; padding:10px 12px;}
.tax-free-box.on{border-style:solid; border-color:var(--accent); background:var(--accent-soft);}
.tax-free-status{font-size:12px; color:var(--ink-soft);}
.tax-free-status.reached{color:var(--accent-soft-ink); font-weight:700;}
.settle-details{border-top:1px solid var(--border); padding-top:8px;}
.settle-details summary{cursor:pointer; font-size:13px; font-weight:700; color:var(--ink-soft); padding:4px 0; list-style:none;}
.settle-details summary::-webkit-details-marker{display:none;}
.settle-details summary::before{content:"▸ "; }
.settle-details[open] summary::before{content:"▾ ";}
.settle-details .settle-detail-body{display:flex; flex-direction:column; gap:10px; margin-top:8px;}

.tax-free-check{font-size:14px; font-weight:700; color:var(--ink);}
.tax-free-check input{width:18px; height:18px; accent-color:var(--accent);}

.balance-top-row{display:flex; align-items:center; justify-content:space-between; gap:12px;}
.balance-main{display:flex; flex-direction:column; gap:2px;}
.balance-history-btn{flex:none; background:rgba(255,255,255,.18); color:#fff; border:1px solid rgba(255,255,255,.4); padding:9px 14px; font-size:13px;}
.balance-history-btn:active{background:rgba(255,255,255,.28);}
.ledger-detail{font-weight:500; color:var(--ink-soft);}

.cart-quota{font-size:13px; font-weight:700; color:var(--accent-soft-ink); background:var(--accent-soft); border-radius:10px; padding:9px 12px;}
.cart-quota:empty{display:none;}
.cart-quota.is-paid{color:var(--warn); background:var(--warn-soft);}
.cart-quota.is-short{color:var(--deal-soft-ink); background:var(--deal-soft); font-weight:600; line-height:1.5;}

/* 結算：總金額最醒目，免稅只是一行小設定 */
.settle-grand{display:flex; justify-content:space-between; align-items:baseline; gap:10px;}
.settle-grand strong{font-size:28px; font-weight:800; color:var(--ink);}
.settle-count{color:var(--ink);}
.settle-count strong{font-size:15px;}
.tax-free-box{background:none; border:none; padding:0; gap:2px;}
.tax-free-box.on{background:none; border:none;}
.tax-free-check{font-size:13px; font-weight:600; color:var(--ink-soft);}
.tax-free-box.on .tax-free-check{color:var(--accent-soft-ink);}
.tax-free-check input{width:16px; height:16px;}
.tax-free-status{padding-left:24px; font-size:11.5px; color:var(--ink-faint);}

.debt-row.is-paid .debt-main,.debt-row.is-paid .debt-amt{opacity:.55;}
.debt-row.is-paid .debt-amt{text-decoration:line-through;}
.paid-toggle{display:inline-block; margin-top:4px; background:none; border:1px solid var(--border); border-radius:999px; padding:2px 10px; font-size:11.5px; font-weight:700; color:var(--ink-soft); cursor:pointer; font-family:inherit; opacity:1;}
.paid-toggle.on{background:var(--accent-soft); border-color:transparent; color:var(--accent-soft-ink);}
.debt-row.is-paid .paid-toggle{opacity:1;}

.cart-head-title-row{display:flex; align-items:baseline; justify-content:space-between; gap:10px;}
.cart-head-title-row .text-link-btn{flex:none;}
.export-list{display:flex; flex-direction:column; gap:6px; max-height:45vh; overflow-y:auto;}
.export-row{display:flex; gap:10px; align-items:center; border-bottom:1px solid var(--border-soft); padding:6px 0;}
.export-main{flex:1; min-width:0;}
.export-name{font-size:13px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.export-sub{font-size:11.5px; color:var(--ink-faint);}
.export-price{flex:none; text-align:right; font-size:12px; color:var(--ink-soft);}
.export-price strong{font-size:13.5px; color:var(--ink);}

/* 確認視窗：要蓋在其他視窗上面 */
.confirm-overlay{z-index:35;}
.confirm-message{font-size:15px; font-weight:700; line-height:1.6; color:var(--ink); margin:4px 0 6px;}
.btn-danger{background:var(--deal); color:#fff;}

/* 購物車列表各區塊之間拉開一點 */
#cartOpenWrap,#cartHistoryWrap,#settlementWrap{margin-top:28px;}

.history-actions{display:flex; gap:8px;}
.btn-danger-outline{background:var(--surface); color:var(--deal-soft-ink); border-color:var(--deal-soft);}
.btn-danger-outline:not(:disabled){border-color:var(--deal); color:var(--deal);}

/* 歷史紀錄往左滑刪除 */
.swipe-wrap{position:relative; border-radius:16px; overflow:hidden;}
.swipe-delete{position:absolute; top:0; right:0; bottom:0; width:88px; border:none; background:var(--deal); color:#fff; font-size:14px; font-weight:700; cursor:pointer; font-family:inherit;}
.swipe-wrap .cart-row{position:relative; transition:transform .2s ease; touch-action:pan-y;}
@media (prefers-reduced-motion:reduce){ .swipe-wrap .cart-row{transition:none;} }

.intro-report-btn{color:var(--accent-soft-ink); border-color:var(--accent-soft-ink);}
.intro-report-btn.is-unlocked{background:var(--accent-soft); border-color:transparent;}
.my-report-chip-row{flex-wrap:wrap; justify-content:flex-end;}

/* ===== 購買點數（LINE Pay 轉帳） ===== */
.package-row{display:grid; grid-template-columns:repeat(3,1fr); gap:8px;}
.package-card{display:flex; flex-direction:column; align-items:center; gap:2px; padding:14px 6px; border-radius:14px; border:1px solid var(--border); background:var(--surface); cursor:pointer; font-family:inherit; color:var(--ink);}
.package-card:active{background:var(--accent-soft);}
.package-points{font-size:18px; font-weight:800;}
.package-price{font-size:13px; color:var(--ink-soft);}
.order-list{display:flex; flex-direction:column; gap:6px;}
.order-row{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px; border-radius:12px; border:1px solid var(--border-soft); background:var(--surface); font-family:inherit; color:var(--ink); text-align:left; cursor:pointer;}
.order-row:disabled{cursor:default; opacity:.75;}
.order-main{display:flex; flex-direction:column; gap:2px;}
.order-title{font-size:14px; font-weight:700;}
.order-sub{font-size:11.5px; color:var(--ink-faint);}
.status-rejected{background:var(--deal-soft); color:var(--deal-soft-ink);}
.status-muted{background:var(--surface-alt); color:var(--ink-faint);}
.order-amount{display:flex; align-items:baseline; gap:8px;}
.order-amount .num{font-size:28px; font-weight:800;}
.order-amount small{font-size:14px; color:var(--ink-soft); font-weight:700;}
.order-code-box{background:var(--accent-soft); border-radius:12px; padding:10px 12px; display:flex; flex-direction:column; gap:4px;}
.order-code-row{display:flex; align-items:center; justify-content:space-between; gap:8px;}
.order-code-row strong{font-size:22px; letter-spacing:.08em; color:var(--accent-soft-ink);}
.order-steps{margin:0; padding-left:20px; font-size:13px; line-height:1.8; color:var(--ink);}
.order-qr{display:block; width:200px; max-width:70%; margin:0 auto; border-radius:12px; border:1px solid var(--border);}
.order-state{font-size:13.5px; line-height:1.7; color:var(--ink);}
.order-state.is-error{color:var(--deal-soft-ink);}
.admin-card{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px; border-radius:16px; border:1px dashed var(--accent); background:var(--accent-soft);}
.admin-order-list{display:flex; flex-direction:column; gap:10px;}
.admin-order{display:flex; flex-direction:column; gap:6px; padding:12px; border-radius:12px; border:1px solid var(--border);}
.admin-order-head{display:flex; align-items:baseline; gap:10px;}
.admin-order-head strong{font-size:18px;}
.admin-order-code{margin-left:auto; font-weight:700; color:var(--accent-soft-ink);}
.admin-reject-reason{font-size:13px; padding:7px 10px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--ink);}
.preview-banner{font-size:12.5px; font-weight:700; color:var(--warn); background:var(--warn-soft); border-radius:10px; padding:8px 12px; margin-bottom:8px;}
.order-qr-placeholder{display:flex; flex-direction:column; align-items:center; justify-content:center; aspect-ratio:1; background:var(--surface-alt); color:var(--ink-soft); font-size:13px; font-weight:700; text-align:center;}
