:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #1c1b19;
  --muted: #6b6862;
  --faint: #a8a49c;
  --border: #e5e2db;
  --accent: #1f6b58;
  --accent-soft: #dcebe5;
  --on-accent: #ffffff;
  --income: #1f7a4a;
  --danger: #b4441c;
  --warn-bg: #fdf1e3;
  --warn-text: #8a4a0f;
  --s-need: #138a72;
  --s-imp: #d4621a;
  --s-other: #6a7bd0;
  --bar: #1f6b58;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .05);
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --surface: #1e1d1b;
    --surface-2: #2a2926;
    --text: #ecebe7;
    --muted: #9a978f;
    --faint: #6a675f;
    --border: #302f2b;
    --accent: #5fb89c;
    --accent-soft: #1f3530;
    --on-accent: #0c1c17;
    --income: #7cc79a;
    --danger: #ef8a62;
    --warn-bg: #3a2a18;
    --warn-text: #f4c088;
    --s-need: #2c9c7f;
    --s-imp: #d9772c;
    --s-other: #8a80d4;
    --bar: #5fb89c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Segoe UI", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }

#app {
  max-width: 600px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px calc(96px + var(--safe-b));
}
body.bare #app { padding-bottom: calc(32px + var(--safe-b)); }
body.bare .tabbar { display: none; }

/* ---------- Shared ---------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 10px 2px; }
.error { color: var(--danger); font-size: 13px; margin: 4px 0; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center-row { justify-content: center; }
.grow { flex: 1; }
.stack { display: grid; gap: 10px; }
.good { color: var(--income); }
.bad { color: var(--danger); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
code.copy { cursor: copy; }

.page-head { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; margin: 0 -4px 12px; min-height: 40px; }
.page-head h1 { text-align: center; font-size: 17px; font-weight: 650; }
.head-action { justify-self: end; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1; display: inline-grid; place-items: center; text-decoration: none; flex: none;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.small { width: 30px; height: 30px; font-size: 15px; }

.sec { font-size: 13px; font-weight: 600; color: var(--muted); margin: 20px 4px 8px; display: flex; justify-content: space-between; align-items: baseline; }
.sec-link { font-weight: 500; text-decoration: none; }
.sub { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.sub:first-child { margin-top: 0; }
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.card.pad { padding: 14px 16px; }
.card.list { overflow: hidden; }
.card + .card { margin-top: 10px; }
.pad { padding: 14px 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; text-decoration: none; color: var(--text); min-height: 44px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.big { width: 100%; padding: 14px; font-size: 16px; min-height: 52px; }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.linkish { border: 0; background: none; color: var(--accent); padding: 0; font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }
.tools { margin-top: 18px; justify-content: center; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  max-width: 600px; margin: 0 auto;
  padding: 6px 8px calc(6px + var(--safe-b));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--border);
}
.tabbar a { display: grid; justify-items: center; gap: 1px; font-size: 11px; color: var(--muted); text-decoration: none; padding: 4px 0; }
.tabbar a .ti { font-size: 19px; filter: grayscale(1); opacity: .7; }
.tabbar a.on { color: var(--text); font-weight: 600; }
.tabbar a.on .ti { filter: none; opacity: 1; }
.tab-add {
  justify-self: center; width: 52px; height: 52px; margin-top: -18px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--on-accent); font-size: 28px; line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
}

/* ---------- Home ---------- */
.home-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.brand { font-size: 22px; font-weight: 750; letter-spacing: .02em; }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.sync-dot.idle { background: var(--income); }
.sync-dot.syncing { background: var(--s-other); animation: pulse 1s infinite; }
.sync-dot.error { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }

.hero { background: var(--accent); color: var(--on-accent); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 12px; }
.hero .label { display: block; font-size: 12px; opacity: .8; }
.hero .big { display: block; font-size: 34px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.hero-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--on-accent) 22%, transparent); }
.hero-row .v { display: block; font-weight: 650; font-variant-numeric: tabular-nums; }
.hero.slim { display: flex; justify-content: space-between; align-items: baseline; }
.hero.slim .big { font-size: 26px; }

.banner {
  display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center;
  background: var(--warn-bg); color: var(--warn-text); text-decoration: none;
  padding: 12px 14px; border-radius: var(--r); margin-bottom: 8px; font-size: 14px;
}
.banner > span:first-child { font-size: 22px; text-align: center; }
.banner.soft { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.banner.soft b { color: var(--text); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: none; border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; white-space: nowrap; box-shadow: var(--shadow);
}
.chip b { margin-left: 4px; font-variant-numeric: tabular-nums; }
.chip.toggle { box-shadow: none; }
.chip.toggle.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }

.meter + .meter { margin-top: 12px; }
.meter-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; gap: 8px; }
.meter-top span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.meter-bar span { display: block; height: 100%; border-radius: 4px; background: var(--bar); }
.meter.near .meter-bar span { background: var(--s-imp); }
.meter.over .meter-bar span { background: var(--danger); }
.meter.over .meter-top span:last-child { color: var(--danger); font-weight: 600; }
.meter.goal .meter-bar span { background: var(--s-other); }

/* ---------- Transaction list ---------- */
.day { margin-bottom: 12px; }
.day-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 0 4px 6px; font-variant-numeric: tabular-nums; }
.tx { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border: 0; background: none; text-align: left; }
.tx + .tx { border-top: 1px solid var(--border); }
.tx:hover { background: var(--surface-2); }
.tx-icon { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; font-size: 19px; background: var(--surface-2); }
.tx-body { flex: 1; min-width: 0; display: grid; }
.tx-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-right { display: grid; justify-items: end; gap: 3px; }
.tx-amt { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-amt.inc { color: var(--income); }
.tx-amt.xfer { color: var(--muted); }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.impulse { background: color-mix(in srgb, var(--s-imp) 16%, transparent); color: var(--s-imp); font-weight: 600; }
.badge.need { background: color-mix(in srgb, var(--s-need) 14%, transparent); color: var(--s-need); }
.badge.cooled { background: color-mix(in srgb, var(--s-other) 16%, transparent); color: var(--s-other); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.rv-regret { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; line-height: 1.7; }
.empty .emoji { font-size: 38px; display: block; margin-bottom: 6px; }

.search { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); outline: none; min-width: 0; min-height: 44px; }
.search:focus { border-color: var(--accent); }
.filters { margin-top: 10px; }
.result-sum { margin: 12px 4px 8px; }

/* ---------- Forms ---------- */
dialog.sheet {
  border: 0; padding: 16px 16px calc(16px + var(--safe-b)); background: var(--surface); color: var(--text);
  width: min(560px, 100%); max-width: 100%; max-height: 92vh; overflow-y: auto;
  border-radius: 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .42); }
@media (max-width: 640px) {
  dialog.sheet { margin: auto 0 0; border-radius: 20px 20px 0 0; animation: up .22s ease; }
  @keyframes up { from { transform: translateY(40px); opacity: .5; } }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.sheet-head h2 { font-size: 17px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 12px; }
.confirm-msg { margin: 6px 2px 16px; line-height: 1.6; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; }
.seg-btn { border: 0; background: none; padding: 7px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; min-height: 36px; }
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.full-seg { margin-bottom: 10px; }
.full-seg .seg { display: flex; }
.full-seg .seg-btn { flex: 1; }

.amount-field { display: flex; align-items: baseline; gap: 8px; border-bottom: 2px solid var(--border); padding: 8px 2px 4px; margin: 4px 0; }
.amount-field:focus-within { border-bottom-color: var(--accent); }
.amount-field .cur { color: var(--muted); font-size: 20px; font-weight: 600; }
.amount-field input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 34px; font-weight: 750; font-variant-numeric: tabular-nums; padding: 0; }

.intent-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
.intent-pick .seg-btn.on[data-v="impulse"] { color: var(--s-imp); }
.intent-pick .seg-btn.on[data-v="need"] { color: var(--s-need); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 6px; margin: 10px 0; }
.cat { border: 1px solid transparent; background: var(--surface-2); border-radius: 12px; padding: 7px 2px; display: grid; justify-items: center; gap: 1px; font-size: 12px; color: var(--muted); }
.cat .e { font-size: 20px; }
.cat.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }

.field { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; min-width: 0; }
.field > span { display: block; }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row .field.grow { min-width: 130px; }
.field input, .field select, .field textarea, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: 16px; outline: none; min-height: 44px;
}
.field input:focus, .field select:focus, textarea:focus { border-color: var(--accent); }
select.attention { border-color: var(--s-imp); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-imp) 20%, transparent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- Stats ---------- */
.month-nav { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 4px 0 10px; font-variant-numeric: tabular-nums; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.stat { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; min-width: 0; }
.stat .label { display: block; font-size: 12px; color: var(--muted); }
.stat .v { display: block; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v.up { color: var(--danger); }
.stat .v.down { color: var(--income); }

.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; }
.chart .zero { fill: var(--border); }
.chart .s-need { fill: var(--s-need); }
.chart .s-imp { fill: var(--s-imp); }
.chart .s-other { fill: var(--s-other); }
.chart .col.hover .hit { fill: color-mix(in srgb, var(--text) 6%, transparent); }
.legend { display: flex; gap: 14px; justify-content: center; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; vertical-align: 0; margin-right: 4px; }
.dot.s-need { background: var(--s-need); }
.dot.s-imp { background: var(--s-imp); }
.dot.s-other { background: var(--s-other); }

.rank { display: grid; grid-template-columns: 28px 1fr auto; gap: 3px 10px; align-items: center; padding: 8px 0; }
.rank + .rank { border-top: 1px solid var(--border); }
.rank-icon { font-size: 18px; text-align: center; grid-row: span 2; }
.rank-name small { color: var(--muted); margin-left: 6px; font-size: 12px; }
.rank-amt { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.rank-bar { grid-column: 2 / 4; height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.rank-bar > span { display: block; height: 100%; background: var(--bar); border-radius: 4px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-variant-numeric: tabular-nums; }
.kv + .kv { border-top: 1px solid var(--border); }
.kv.total { font-weight: 700; }

.hbar { display: grid; grid-template-columns: minmax(96px, 42%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.hbar-track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar-track span { display: block; height: 100%; background: var(--s-imp); border-radius: 4px; }
.hbar-v { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-l { white-space: nowrap; }

.report-hero { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 16px 18px; border-left: 4px solid var(--s-imp); }
.report-hero h2 { font-size: 17px; margin-bottom: 8px; }
.report-hero ul { margin: 0; padding-left: 20px; line-height: 1.8; }

/* ---------- Menus ---------- */
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; background: none;
  text-decoration: none; color: var(--text); text-align: left;
}
.menu-item + .menu-item { border-top: 1px solid var(--border); }
a.menu-item:hover, button.menu-item:hover { background: var(--surface-2); }
.menu-item.dim { opacity: .55; }
.mi-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 18px; flex: none; }
.mi-body { flex: 1; min-width: 0; display: grid; }
.mi-body small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { color: var(--faint); font-size: 20px; }
.count { background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 6px; }
.acc-bal { font-weight: 650; font-variant-numeric: tabular-nums; }
.acc-bal.neg { color: var(--danger); }
.budget-row + .budget-row { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.budget-row .meter { margin-bottom: 8px; }

.cool-item + .cool-item { border-top: 1px solid var(--border); padding-top: 12px; }
.cool-item .row.gap { margin-top: 10px; }
.cool-item .muted.small { margin-top: 2px; }

.review-card.done { opacity: .75; }
.rv-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 12px 12px; }
.rv-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 9px 4px; font-weight: 600; min-height: 42px; }
.rv-btn.on.worth { background: color-mix(in srgb, var(--s-need) 16%, transparent); border-color: var(--s-need); }
.rv-btn.on.meh { background: var(--surface-2); border-color: var(--faint); }
.rv-btn.on.regret { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: var(--danger); }

/* ---------- Onboarding ---------- */
.ob { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; gap: 12px; max-width: 460px; margin: 0 auto; }
.ob-intro { text-align: center; display: grid; gap: 14px; justify-items: center; }
.ob-intro h1 { font-size: 26px; }
.ob-intro p { margin: 0; line-height: 1.7; }
.ob-logo { font-size: 56px; }
.ob-q { font-size: 21px; }
.ob .muted { margin: 0 0 6px; }
.ob textarea { font-size: 17px; }
.ob-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.dots { display: flex; gap: 6px; margin-bottom: 6px; }
.dots span { width: 26px; height: 4px; border-radius: 2px; background: var(--border); }
.dots span.on { background: var(--accent); }
.choice-list { display: grid; gap: 8px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.choice {
  border: 1.5px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px 14px; text-align: left;
  display: grid; gap: 2px; min-height: 48px;
}
.choice .e { font-size: 20px; }
.choice small { color: var(--muted); font-size: 13px; line-height: 1.5; }
.choice.on { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Impulse question ---------- */
.ask { max-width: 460px; margin: 0 auto; display: grid; gap: 14px; padding-top: 12px; }
.ask-close { justify-self: end; font-size: 14px; color: var(--muted); text-decoration: none; }
.ask-app { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.ask-icon { font-size: 22px; }
.ask-line { font-size: 22px; font-weight: 650; line-height: 1.5; margin: 6px 0 10px; letter-spacing: .01em; }
.ask-actions { display: grid; gap: 8px; }
.ask-btn {
  display: grid; gap: 1px; text-align: left; border: 1.5px solid var(--border); background: var(--surface);
  border-radius: 14px; padding: 12px 16px; min-height: 56px;
}
.ask-btn b { font-size: 16px; }
.ask-btn small { color: var(--muted); font-size: 12.5px; }
.ask-btn:active { transform: scale(.99); }
.ask-btn.cool { border-color: color-mix(in srgb, var(--s-other) 50%, var(--border)); }
.ask-btn.skip { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ask-btn.skip small { color: inherit; opacity: .8; }
.ask.done { text-align: center; justify-items: center; padding-top: 12vh; }
.ask.done h1 { font-size: 24px; }
.ask.done p { margin: 0; line-height: 1.7; }
.done-icon { font-size: 60px; }
.pay-amt { font-size: 40px; font-weight: 750; text-align: center; font-variant-numeric: tabular-nums; }
.q { font-weight: 600; margin: 0 0 8px; }
.card .seg + .hint { margin-top: 6px; }
.card .seg { margin-bottom: 12px; }
.warn-box { background: var(--warn-bg); color: var(--warn-text); padding: 10px 12px; border-radius: 10px; font-size: 13.5px; margin: 0 0 10px; }

/* ---------- Screenshot scan ---------- */
.drop {
  display: grid; justify-items: center; gap: 6px; text-align: center; padding: 40px 20px; cursor: pointer;
  border: 2px dashed var(--border); border-radius: 18px; background: var(--surface);
}
.drop:hover { border-color: var(--accent); }
.drop-icon { font-size: 40px; }
.drop.busy { cursor: default; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-row.dim { opacity: .55; }
.scan-row.invalid { outline: 2px solid var(--danger); }
.scan-row .row.between { margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }

/* ---------- Guide ---------- */
.guide p { margin: 0 0 8px; line-height: 1.7; }
.guide ol, .guide ul { margin: 0 0 8px; padding-left: 20px; line-height: 1.8; }
.guide li + li { margin-top: 6px; }
.plain { list-style: none; padding-left: 0 !important; }

/* ---------- Lock ---------- */
.lock { min-height: 80vh; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; }
.lock-icon { font-size: 54px; }
.lock .btn { min-width: 200px; }

/* ---------- toast / tooltip ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); z-index: 20; transform: translate(-50%, 16px);
  max-width: calc(100% - 32px); width: max-content;
  background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s ease; display: flex; gap: 14px; align-items: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.warn { background: var(--warn-bg); color: var(--warn-text); box-shadow: 0 6px 24px rgba(0, 0, 0, .18); border: 1px solid color-mix(in srgb, var(--warn-text) 30%, transparent); }
.toast button { border: 0; background: none; color: var(--accent-soft); font-weight: 700; padding: 0; white-space: nowrap; }
.toast.warn button { color: var(--warn-text); }
.tooltip {
  position: fixed; z-index: 30; pointer-events: none; background: var(--text); color: var(--bg);
  padding: 7px 10px; border-radius: 8px; font-size: 12px; line-height: 1.6; white-space: nowrap;
  font-variant-numeric: tabular-nums; transform: translate(-50%, calc(-100% - 8px));
}
.tooltip .dot { width: 8px; height: 8px; }

@media (min-width: 700px) {
  #app { padding-top: 24px; }
}

.app-pick { display: grid; gap: 6px; }
.app-pick .chips { padding: 0; }
.app-pick .chip { box-shadow: none; padding: 7px 12px; font-size: 13.5px; }

.drop-idle, .drop-busy { display: grid; justify-items: center; gap: 6px; }
dialog .drop { padding: 30px 16px; margin: 6px 0 4px; }
.skip-scan { margin-top: 10px; }
