/* 奶油黃主題（固定淺色），淡綠、淡藍、淡紫、淡粉紅點綴 */
:root {
  --bg: #fcf9f0;
  --surface: #ffffff;
  --surface-2: #faf5e8;
  --text: #4a4335;
  --muted: #9b917c;
  --border: #ebe2c9;
  --primary: #94763a;          /* 文字、強調用的深金黃 */
  --primary-fill: #f3e2ae;     /* 主要按鈕的淡黃色 */
  --primary-soft: #f7efd6;
  --primary-text: #4f4228;     /* 黃色底上的文字 */
  --lavender: #ece6ff;
  --mint: #dff5e9;
  --peach: #ffecd9;
  --sky: #e1f0fd;
  --pink: #ffe6ef;
  --ok: #2b9f7f;
  --ok-bg: #dcf6ec;
  --warn: #c9822a;
  --warn-bg: #fff0d9;
  --danger: #e04f78;
  --danger-bg: #ffe3ea;
  --radius: 20px;
  --shadow: 0 2px 4px rgb(160 130 70 / 5%), 0 8px 24px rgb(160 130 70 / 8%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, #f6edcf 0, transparent 42%),
    radial-gradient(circle at 95% 8%, #e3f1ff 0, transparent 32%),
    radial-gradient(circle at 85% 95%, #f1ebff 0, transparent 30%),
    radial-gradient(circle at 15% 100%, #e2f6ea 0, transparent 38%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 1.4rem; display: flex; align-items: center; gap: .5rem; }
h2 { font-size: 1.05rem; margin-bottom: .75rem; }
[hidden] { display: none !important; }
button { font-family: inherit; }

/* ---------- 版面 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1.25rem;
  padding: .6rem max(1rem, env(safe-area-inset-left));
  background: rgb(255 255 255 / 85%); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; color: var(--text); font-size: 1.1rem; letter-spacing: .02em; }
.brand img { width: 32px; height: 32px; }
.topnav { display: flex; gap: .25rem; flex: 1; }
.topnav a { padding: .4rem .85rem; border-radius: 999px; color: var(--muted); display: flex; gap: .35rem; align-items: center; font-weight: 600; }
.topnav a.active, .topnav a:hover { background: var(--primary-soft); color: var(--primary-text); }
.gear { font-size: 1.2rem; padding: .3rem .5rem; border-radius: 999px; margin-left: auto; }
.gear.active, .gear:hover { background: var(--primary-soft); }
.main { max-width: 1120px; margin: 0 auto; padding: 1.25rem 1rem 6rem; }
.bottomnav { display: none; }

.fabs { position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 20; display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.fab {
  width: 58px; height: 58px; border-radius: 50%; border: 3px solid #fff;
  background: linear-gradient(135deg, #f8ebc4, #ecd697); color: var(--primary-text); font-size: 2rem; line-height: 1;
  box-shadow: 0 8px 22px rgb(185 150 80 / 35%); cursor: pointer;
}
.fab:active { transform: scale(.95); }
.fab.mini { width: 46px; height: 46px; font-size: 1.25rem; background: #fff; border: 2px solid var(--border); box-shadow: var(--shadow); }

@media (max-width: 720px) {
  .topbar { padding-top: max(.6rem, env(safe-area-inset-top)); }
  .topnav { display: none; }
  .main { padding: 1rem .75rem calc(7rem + env(safe-area-inset-bottom)); }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 15;
    background: rgb(255 255 255 / 92%); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: .4rem 0 .35rem; color: var(--muted); font-size: .72rem; font-weight: 600; }
  .bottomnav .ico { font-size: 1.35rem; line-height: 1.25; filter: grayscale(.6) opacity(.7); transition: transform .15s; }
  .bottomnav a.active { color: var(--primary); }
  .bottomnav a.active .ico { filter: none; transform: translateY(-2px) scale(1.1); }
  .fabs { bottom: calc(4.8rem + env(safe-area-inset-bottom)); right: 1rem; }
}

.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; gap: .5rem; }
.panel-head h2 { margin: 0; }
.section-title { margin: 1.75rem .25rem .75rem; }
.sub-title { font-size: .92rem; margin: 1rem 0 .3rem; color: var(--muted); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty h2 { color: var(--text); margin-top: .5rem; }
.empty-ico { font-size: 3rem; margin-bottom: .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.center { text-align: center; }
.strong { font-weight: 700; }
.grow { flex: 1; min-width: 0; }
.inline { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.mt { margin-top: .6rem; }
.neg { color: var(--danger); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger); }
.dim { opacity: .6; }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  padding: .5rem 1.1rem; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
  min-height: 40px; white-space: nowrap; transition: transform .1s, background .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary-fill); border-color: #e4d09a; color: var(--primary-text); box-shadow: 0 4px 12px rgb(185 150 80 / 22%); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn.danger-outline { color: var(--danger); border-color: #f3b5c3; }
.btn.ghost { background: transparent; }
.btn.small { padding: .25rem .8rem; min-height: 32px; font-size: .85rem; }
.btn.tiny-btn { padding: .1rem .7rem; min-height: 28px; font-size: .78rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 1.15rem; cursor: pointer; padding: .3rem .55rem; border-radius: 999px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }

/* ---------- 首頁 ---------- */
.hero { padding: .5rem .25rem 1rem; }
.hero h1 { font-size: 1.6rem; }
.hero h1::after { content: "💳✨"; font-size: 1.2rem; }
.hero p { margin: .25rem 0 0; }
.picker-panel { background: linear-gradient(135deg, #fff 0%, #fbf7ea 60%, #f2f9ff 100%); }
.picker-panel .field-label { display: block; margin-bottom: .5rem; }
.amount-row { display: flex; align-items: center; gap: .5rem; margin-top: .85rem; background: var(--surface-2); border-radius: 999px; padding: .2rem .4rem .2rem 1rem; border: 1.5px solid var(--border); }
.amount-row .prefix { font-weight: 800; color: var(--primary); }
.amount-row input { border: 0; background: transparent; min-height: 40px; padding-left: 0; font-weight: 700; }
.amount-row input:focus { outline: none; }
.amount-row:focus-within { border-color: #d8c58f; }

.cat-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.cat {
  display: inline-flex; align-items: center; gap: .3rem; border: 1.5px solid var(--border); background: #fff;
  border-radius: 999px; padding: .35rem .8rem; font-size: .88rem; font-weight: 600; color: var(--text); cursor: pointer;
  transition: all .15s;
}
.cat:hover { border-color: #e2d3a6; }
.cat.on { background: var(--primary-soft); border-color: #ddc78b; color: var(--primary-text); box-shadow: 0 2px 8px rgb(185 150 80 / 18%); }
@media (max-width: 720px) {
  .cat-picker { gap: .35rem; }
  .cat { padding: .3rem .65rem; font-size: .84rem; }
}

.reco-hint { margin: .25rem .25rem .5rem; }
.reco-list { display: flex; flex-direction: column; gap: .75rem; }
.reco {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem;
  box-shadow: var(--shadow); border-left: 8px solid var(--c);
}
.reco.top { border-color: #e6d7a8; border-left-color: var(--c); background: linear-gradient(135deg, #fff 55%, #f9f1dc 100%); box-shadow: 0 6px 24px rgb(185 150 80 / 18%); }
.reco-head { display: flex; align-items: center; gap: .75rem; }
.reco-rank {
  width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); font-weight: 800;
}
.reco.top .reco-rank { background: #fff3c4; font-size: 1.2rem; }
.reco-name { font-weight: 800; font-size: 1.05rem; }
.reco-value { text-align: right; display: flex; flex-direction: column; }
.reco-value strong { font-size: 1.3rem; color: var(--ok); }
.reco.top .reco-value strong { font-size: 1.5rem; }
.reco-promos { list-style: none; margin: .7rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.reco-promos li { background: var(--surface-2); border-radius: 14px; padding: .55rem .75rem; }
.reco-promos li.muted { background: transparent; padding: 0 .25rem; }
.plus { color: var(--ok); font-weight: 800; white-space: nowrap; }
.reco-actions { display: flex; justify-content: flex-end; margin-top: .6rem; }

.progress-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.pcard-head {
  display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem;
  background: linear-gradient(120deg, var(--c), color-mix(in srgb, var(--c) 55%, #fff)); color: var(--ink);
}
.pcard-name { font-weight: 800; }
.pcard-head .chev { color: var(--ink); }
.pcard-body { padding: .8rem 1rem 1rem; display: flex; flex-direction: column; gap: .8rem; }
.promo + .promo { border-top: 1px dashed var(--border); padding-top: .8rem; }
.base-line { background: var(--surface-2); border-radius: 12px; padding: .35rem .7rem; }
.rate-pill { background: var(--lavender); color: #7a5cc7; border-radius: 999px; padding: .05rem .6rem; font-size: .8rem; font-weight: 700; white-space: nowrap; }

.quota { margin-top: .35rem; }
.quota-line { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; font-size: .88rem; }

/* ---------- 統計 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: .75rem 1rem; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat-value { font-size: 1.25rem; font-weight: 800; word-break: break-all; }
.stat.ok .stat-value { color: var(--ok); }
.stat.warn .stat-value { color: var(--warn); }
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .stats > :nth-child(3):last-child { grid-column: 1 / -1; }
  .stat { padding: .6rem .8rem; }
  .stat-value { font-size: 1.05rem; }
}

/* ---------- 標籤 ---------- */
.badge { display: inline-block; font-size: .72rem; padding: .08rem .55rem; border-radius: 999px; font-weight: 700; margin-left: .35rem; white-space: nowrap; vertical-align: middle; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; white-space: nowrap; font-weight: 600; }
.chip::before { content: ""; width: .65rem; height: .65rem; border-radius: 50%; background: var(--c); }
.mini-card {
  display: inline-grid; place-items: center; width: 2.2rem; height: 1.5rem; border-radius: 6px; flex: none;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #fff)); font-size: .8rem;
}

/* ---------- 進度條 ---------- */
.bar { height: 10px; border-radius: 999px; background: #f2eddf; overflow: hidden; margin-top: .3rem; }
.bar > div { height: 100%; border-radius: 999px; transition: width .4s; background: linear-gradient(90deg, #f1e2b4, #dcc07c); }
.bar.good > div { background: linear-gradient(90deg, #a8e6cf, #5cc9a2); }
.bar.warn > div { background: linear-gradient(90deg, #ffd8a8, #f5a65b); }
.bar.full > div { background: linear-gradient(90deg, #ffb3c6, #e04f78); }
.bar.soft > div { background: linear-gradient(90deg, #d6ccff, #a996f2); }

/* ---------- 帳單 / 卡片 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
@media (max-width: 720px) { .card-grid, .progress-grid { grid-template-columns: 1fr; gap: .75rem; } }
.ctile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.ctile-head {
  display: flex; justify-content: space-between; align-items: center; padding: .85rem 1rem;
  background: linear-gradient(120deg, var(--c), color-mix(in srgb, var(--c) 55%, #fff)); color: var(--ink);
}
.ctile-name { font-weight: 800; font-size: 1.05rem; }
.ctile-sub { font-size: .8rem; opacity: .85; letter-spacing: .03em; }
.ctile-head .chev { color: var(--ink); }
.chev { font-size: 1.5rem; color: var(--muted); line-height: 1; }
.ctile-body { padding: .85rem 1rem; flex: 1; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.kv > span:first-child { color: var(--muted); font-size: .85rem; }
.big { font-size: 1.4rem; }
.ctile-actions { display: flex; gap: .5rem; padding: 0 1rem .9rem; }

.due-list, .rules, .plain-list { list-style: none; margin: 0; padding: 0; }
.due-list li, .plain-list li { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-top: 1px dashed var(--border); }
.plain-list li { flex-wrap: wrap; }
.due-list li:first-child, .plain-list li:first-child { border-top: 0; }
.due-amt { display: flex; align-items: center; }
.rule-item { padding: .8rem 0; border-top: 1px dashed var(--border); }
.rule-item:first-child { border-top: 0; }
.rule-actions { display: flex; gap: .4rem; margin-top: .45rem; }

.list { padding: 0; overflow: hidden; }
.list-row { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .75rem; padding: .85rem 1.1rem; border-top: 1px dashed var(--border); cursor: pointer; width: 100%; color: var(--text); }
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--surface-2); }
details.panel summary, .sub-details summary { cursor: pointer; color: var(--muted); font-weight: 600; }
details.panel .list { margin-top: .75rem; }
.sub-details { background: var(--surface-2); border-radius: 14px; padding: .6rem .85rem; margin-top: .5rem; }
.sub-details[open] summary { margin-bottom: .6rem; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px dashed var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
th.num, td.num { text-align: right; }
tr.current td { background: var(--surface-2); }

/* ---------- 消費明細 ---------- */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters > * { flex: 1 1 160px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: .25rem; flex: 1 1 220px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 999px; padding: 0 .25rem; }
.month-label { font-weight: 800; }
.tx-list section { margin-bottom: 1rem; }
.tx-date { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); font-weight: 600; padding: 0 .5rem .35rem; }
.tx-group { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.tx-row {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%;
  display: flex; gap: .75rem; align-items: center; padding: .7rem .9rem; border-top: 1px dashed var(--border);
}
.tx-row:first-child { border-top: 0; }
.tx-row:hover { background: var(--surface-2); }
.tx-ico { width: 2.3rem; height: 2.3rem; flex: none; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 1.15rem; }
.tx-main { min-width: 0; flex: 1; }
.tx-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { display: flex; flex-wrap: wrap; gap: .2rem .7rem; font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.tx-right { text-align: right; flex: none; }
.tx-amt { font-weight: 800; font-size: 1.05rem; }
.tx-reward { font-size: .78rem; color: var(--ok); font-weight: 600; }

/* ---------- 表單 ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 1.5px solid var(--border); border-radius: 14px; padding: .55rem .8rem; width: 100%; min-height: 44px;
}
input::placeholder, textarea::placeholder { color: #c5bba0; }
input[type=checkbox] { width: 1.2rem; height: 1.2rem; min-height: 0; flex: none; margin: .15rem 0 0; accent-color: var(--primary); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--primary-soft); border-color: #d8c58f; }
@media (max-width: 720px) { input, select, textarea { font-size: 16px; } } /* 避免 iOS 自動放大 */
.form { display: flex; flex-direction: column; gap: .85rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field-label { font-size: .85rem; color: var(--muted); font-weight: 700; }
.hint { color: var(--muted); font-size: .75rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 420px) { .row2 { gap: .5rem; } }
.check { display: flex; gap: .55rem; align-items: flex-start; cursor: pointer; font-size: .92rem; }
.rule-picker { display: flex; flex-direction: column; gap: .5rem; }
.form-actions { display: flex; justify-content: space-between; gap: .5rem; margin-top: .25rem; }
.error-text { color: var(--danger); min-height: 1.2em; margin: 0; font-size: .9rem; }
.swatches { display: flex; gap: .5rem; flex-wrap: wrap; }
.sw { width: 2rem; height: 2rem; border-radius: 50%; border: 3px solid #fff; background: var(--c); cursor: pointer; box-shadow: 0 0 0 1.5px var(--border); }
.sw.on { box-shadow: 0 0 0 2.5px #c4a65c; transform: scale(1.1); }
.cat-editor { display: flex; flex-direction: column; gap: .45rem; }
.cat-row { display: flex; gap: .4rem; align-items: center; }
.emoji-input { width: 3.3rem; flex: none; text-align: center; padding: .4rem; }

/* ---------- 對話框 ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 24px; width: min(560px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem);
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgb(120 95 20 / 22%); display: flex; flex-direction: column;
}
dialog.modal:not([open]) { display: none; }
dialog::backdrop { background: rgb(70 60 30 / 32%); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1rem .6rem 1.3rem; background: linear-gradient(135deg, #f8f0d8, #edf4fb); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 1rem 1.3rem 1.3rem; overflow-y: auto; }
@media (max-width: 720px) {
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .modal-body { padding-bottom: calc(1.3rem + env(safe-area-inset-bottom)); }
}

/* ---------- 登入 ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.login-box { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 28px; padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: .9rem; box-shadow: var(--shadow); }
.login-box h1 { justify-content: center; }
.login-box p { margin: -.5rem 0 0; }
.login-box label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); font-weight: 700; }
.login-logo { width: 72px; height: 72px; margin: 0 auto; }

/* ---------- 提示 ---------- */
#toast {
  position: fixed; left: 50%; bottom: 2rem; transform: translate(-50%, 150%); opacity: 0; z-index: 100;
  background: #4a4335; color: #fff; padding: .6rem 1.2rem; border-radius: 999px; font-size: .9rem; font-weight: 600;
  transition: transform .25s, opacity .25s; pointer-events: none; max-width: calc(100vw - 2rem);
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast.error { background: var(--danger); }
@media (max-width: 720px) { #toast { bottom: calc(5.2rem + env(safe-area-inset-bottom)); } }

/* ---------- v3 新增 ---------- */
.cat-picker.compact { gap: .3rem; }
.cat-picker.compact .cat, .cat.mini { padding: .22rem .6rem; font-size: .8rem; }
.day-pills { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .25rem; }
.day-pill { font-size: .74rem; font-weight: 700; padding: .05rem .55rem; border-radius: 999px; background: var(--sky); color: #3d7ab8; white-space: nowrap; }
.day-pill:nth-child(3) { background: var(--peach); color: #c46a2b; }
.day-pill.gift { background: var(--pink); color: #c0517d; }
.net { font-size: .68rem; font-weight: 800; padding: .02rem .45rem; border-radius: 6px; margin-left: .45rem; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.net.visa { background: #e0ecff; color: #3559b8; }
.net.master { background: #ffe8d6; color: #c25b1a; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin: -.4rem 0 1rem; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: .2rem; gap: .2rem; border: 1px solid var(--border); }
.seg.wrap { display: flex; flex-wrap: wrap; border-radius: 18px; margin-bottom: .75rem; }
.seg button { border: 0; background: transparent; padding: .35rem .85rem; border-radius: 999px; font-weight: 700; color: var(--muted); cursor: pointer; font-size: .85rem; }
.seg button.on { background: var(--primary-fill); color: var(--primary-text); box-shadow: 0 2px 6px rgb(185 150 80 / 20%); }
.month-nav.single { margin-bottom: 1rem; max-width: 360px; }
.range-panel { display: flex; flex-direction: column; gap: .6rem; }
.range-row { display: flex; align-items: center; gap: .4rem; }
.range-row input { flex: 1; min-width: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; gap: .25rem; } }
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.rank-row { display: block; color: var(--text); border-radius: 10px; padding: .1rem .2rem; }
.rank-row:hover { background: var(--surface-2); }
.bar > .card-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 60%, #fff), var(--c)); }
.filter-note { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; background: var(--lavender); color: #6a51b5; border-radius: 14px; padding: .45rem .8rem; margin: -.4rem 0 1rem; font-size: .85rem; font-weight: 600; }
.list-input { display: flex; flex-direction: column; gap: .3rem; }
.remember { font-size: .8rem; color: var(--primary); font-weight: 600; }
.sub-input { margin-top: .4rem; }
.scan-btn { align-self: flex-start; }
.scan-preview { max-width: 100%; max-height: 260px; object-fit: contain; border-radius: 14px; background: var(--surface-2); align-self: center; }
.scan-preview:not([src]) { display: none; }
.scan-list { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.tx-row.done { opacity: .45; }
.tx-row.done .tx-amt::after { content: " ✓"; color: var(--ok); }
.opt-row { display: flex; gap: .4rem; align-items: center; }
.opt-row > input:not(.emoji-input) { flex: 1; min-width: 0; }
.opt-row.merchant select { width: 6.5rem; flex: none; padding-left: .5rem; padding-right: .3rem; font-size: .85rem; }
.opt-row.add { margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--border); }
@media (max-width: 520px) {
  .opt-row.merchant { flex-wrap: wrap; }
  .opt-row.merchant > input { flex: 1 1 100%; }
  .opt-row.merchant select { flex: 1; width: auto; }
}

.reco-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .85rem; align-items: center; }
.reco-inputs .amount-row { margin-top: 0; }
.reco-inputs .list-input input { border-radius: 999px; padding-left: 1rem; background: var(--surface-2); min-height: 48px; }
@media (max-width: 720px) { .reco-inputs { grid-template-columns: 1fr; } }

.qr { width: 180px; height: 180px; background: #fff; border-radius: 14px; border: 1px solid var(--border); padding: .4rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

.badge.day { background: var(--sky); color: #3d7ab8; }
.other-days { margin-top: .5rem; background: var(--mint); color: #2f7a5f; border-radius: 10px; padding: .35rem .6rem; }
.pack { border: 1px dashed var(--border); border-radius: 14px; padding: .75rem .9rem; display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; }
.pack .quota-line { width: 100%; }
.pack p { margin: 0; }
