/* JodJod — ตาม ref Expensix · Layout: navy header + action circles → white body with soft-grey rounded cards · flat bottom bar with blue scan button in the middle */
:root {
  --bg: #ffffff;
  --card: #f4f5f7;
  --card-2: #eceef2;
  --surface: #ffffff;
  --line: #e8eaef;
  --text: #0f1222;
  --muted: #858a97;
  --faint: #b8bcc6;
  --primary: #3355ff;
  --primary-press: #2443e6;
  --primary-soft: #eaeeff;
  --on-primary: #ffffff;
  --navy-1: #0a1a52;
  --navy-2: #173493;
  --navy-3: #2447b8;
  --on-navy: #ffffff;
  --on-navy-2: rgba(255, 255, 255, 0.78);
  --navy-chip: rgba(255, 255, 255, 0.17);
  --navy-track: rgba(255, 255, 255, 0.28);
  --pos: #1aae3c;
  --neg: #e5372b;
  --income-ic: #3355ff;
  --spend-ic: #22bf33;
  --save-ic: #8b5cf6;
  --save: #7c4dff;
  --warn: #f29d0b;
  --warn-soft: #fff4dd;
  --pos-soft: #e3f7e8;
  --neg-soft: #fde8e6;
  --shadow: 0 12px 32px -14px rgba(15, 25, 70, 0.28);
  --backdrop: rgba(8, 14, 40, 0.45);

  --font: 'Inter', 'Noto Sans Thai', 'IBM Plex Sans Thai', 'Sukhumvit Set', 'Thonburi', system-ui, -apple-system, sans-serif;
  --r-card: 24px;
  --r-row: 20px;
  --r-input: 16px;
  --pill: 999px;
  --g: 20px;
  --nav-h: 74px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0a0d1a; --card: #151a2c; --card-2: #1d2338; --surface: #1a2034; --line: #242b42;
    --text: #f1f3fa; --muted: #949bb1; --faint: #5a6178;
    --primary: #5b78ff; --primary-press: #4a66f0; --primary-soft: #1d2654;
    --navy-1: #050b26; --navy-2: #102472; --navy-3: #1b3598;
    --pos: #3ccf5f; --neg: #ff6457; --income-ic: #5b78ff; --spend-ic: #2fcc44;
    --warn-soft: #3b2c0c; --pos-soft: #12301b; --neg-soft: #3a1714;
    --shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.7); --backdrop: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0a0d1a; --card: #151a2c; --card-2: #1d2338; --surface: #1a2034; --line: #242b42;
  --text: #f1f3fa; --muted: #949bb1; --faint: #5a6178;
  --primary: #5b78ff; --primary-press: #4a66f0; --primary-soft: #1d2654;
  --navy-1: #050b26; --navy-2: #102472; --navy-3: #1b3598;
  --pos: #3ccf5f; --neg: #ff6457; --income-ic: #5b78ff; --spend-ic: #2fcc44;
  --warn-soft: #3b2c0c; --pos-soft: #12301b; --neg-soft: #3a1714;
  --shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.7); --backdrop: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
[hidden] { display: none !important; }
svg { flex: none; }

#app { max-width: 480px; margin: 0 auto; min-height: 100%; background: var(--bg); position: relative; }
@media (min-width: 520px) { #app { box-shadow: 0 0 0 1px var(--line); } }
.view { min-height: 100vh; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom, 0px)); }
.view.no-nav { padding-bottom: 28px; }
.body { padding: 22px var(--g) 0; display: flex; flex-direction: column; gap: 26px; }
.body > * { min-width: 0; }

/* ---------- Navy header (ตาม ref) ---------- */
.hdr {
  background: radial-gradient(130% 80% at 85% 0%, var(--navy-3) 0%, transparent 60%), linear-gradient(170deg, var(--navy-1) 0%, var(--navy-2) 100%);
  color: var(--on-navy);
  padding: calc(env(safe-area-inset-top, 0px) + 18px) var(--g) 26px;
}
.hdr-row { display: flex; align-items: center; gap: 12px; }
.avatar { width: 54px; height: 54px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 21px; color: #fff;
  background: linear-gradient(145deg, #ffb36b, #ff6a6a); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35); }
.hello { flex: 1; min-width: 0; }
.hello b { display: block; font-size: 21px; font-weight: 600; line-height: 1.25; }
.hello small { display: block; font-size: 14px; color: var(--on-navy-2); }
.circle { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--navy-chip); color: var(--on-navy); transition: transform 0.12s; }
.circle:active { transform: scale(0.92); }
.circle svg { width: 22px; height: 22px; }
.circle.light { background: var(--card); color: var(--text); }
.circle:disabled { opacity: 0.3; }
.hdr-label { margin-top: 24px; font-size: 16px; color: var(--on-navy-2); display: flex; align-items: center; gap: 6px; }
.hdr-label button { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.hdr-label svg { width: 18px; height: 18px; }
.big { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.big b { font-size: clamp(34px, 10.5vw, 44px); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.big button { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-chip); color: var(--on-navy); flex: none; }
.big button svg { width: 17px; height: 17px; }
.limit { margin-top: 22px; }
.limit-row { display: flex; justify-content: space-between; font-size: 15px; color: var(--on-navy-2); }
.limit-row b { color: var(--on-navy); font-weight: 600; }
.bar { height: 8px; border-radius: 4px; background: var(--navy-track); margin: 12px 0 8px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: #fff; transition: width 0.5s ease; }
.limit small { font-size: 13.5px; color: var(--on-navy-2); }
.actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 22px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 9px; color: var(--on-navy); font-size: 13px; text-align: center; line-height: 1.2; }
.action .ac { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-chip); transition: transform 0.12s, background 0.15s; position: relative; }
.action .ac svg { width: 25px; height: 25px; }
.action:active .ac { transform: scale(0.9); }
.action .ac.hot { background: #fff; color: var(--navy-2); }
.badge-n { position: absolute; top: -2px; right: -2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--neg); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--navy-2); }

/* sub-page navy header (Add Money / Saving Goals ใน ref) */
.hdr.sub { padding-bottom: 30px; }
.sub-top { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; }
.sub-top h1 { margin: 0; text-align: center; font-size: 19px; font-weight: 600; }
.sub-meta { margin-top: 22px; }
.sub-meta small { font-size: 15px; color: var(--on-navy-2); }
.sub-meta b { display: block; font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }

/* white-page header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; padding: 14px var(--g) 8px; }
.top h1 { margin: 0; text-align: center; font-size: 19px; font-weight: 600; }
.top.left { grid-template-columns: 1fr auto; }
.top.left h1 { text-align: left; font-size: 26px; font-weight: 700; }

/* ---------- Section ---------- */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.see { color: var(--muted); font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- Wallet cards ---------- */
.wallet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wcard { background: var(--card); border-radius: var(--r-card); padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; text-align: left; }
.wcard-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.wcard-top svg.m { width: 22px; height: 22px; color: var(--muted); }
.dotic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.dotic svg { width: 24px; height: 24px; }
.wcard small { color: var(--muted); font-size: 15px; }
.wcard b { font-size: 26px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.02em; }
.wcard .sub { font-size: 12.5px; color: var(--muted); }

/* ---------- Transaction rows (การ์ดเทาทีละแถว) ---------- */
.rows { display: flex; flex-direction: column; gap: 10px; }
.row-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-row); background: var(--card); width: 100%; text-align: left; transition: background 0.15s; }
.row-card:active { background: var(--card-2); }
.logo { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface); position: relative; }
.logo svg { width: 23px; height: 23px; }
.logo .tag { position: absolute; right: -3px; bottom: -3px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; box-shadow: 0 0 0 2px var(--card); }
.logo .tag svg { width: 11px; height: 11px; stroke-width: 2.4; }
.rc-main { flex: 1; min-width: 0; }
.rc-main b { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-main small { display: block; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-amt { font-size: 17px; font-weight: 700; white-space: nowrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.sav { color: var(--save); }
.day-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--muted); margin: 6px 4px 2px; }
.day-label b { color: var(--text); font-size: 16px; font-weight: 600; }

/* ---------- Bottom nav (ตาม ref) ---------- */
.nav { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px;
  background: var(--surface); border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: var(--faint); font-weight: 500; }
.nav a svg { width: 25px; height: 25px; }
.nav a[aria-current='page'] { color: var(--text); }
.nav .scan-btn { justify-self: center; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; position: relative;
  box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--primary) 85%, transparent); transition: transform 0.12s; }
.nav .scan-btn:active { transform: scale(0.92); }
.nav .scan-btn svg { width: 28px; height: 28px; }
.nav .scan-btn .badge-n { box-shadow: 0 0 0 2px var(--surface); }

/* ---------- Buttons / chips / inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 56px; padding: 0 24px; border-radius: var(--pill);
  background: var(--primary); color: var(--on-primary); font-weight: 600; font-size: 16px; transition: transform 0.1s, background 0.15s; }
.btn:active { transform: scale(0.98); background: var(--primary-press); }
.btn:disabled { opacity: 0.4; }
.btn.block { width: 100%; }
.btn.outline { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.grey { background: var(--card); color: var(--text); }
.btn.danger { background: var(--neg-soft); color: var(--neg); }
.btn.sm { height: 40px; padding: 0 16px; font-size: 14px; }
.btn svg { width: 20px; height: 20px; }
.qchips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.qchip { height: 38px; padding: 0 4px; white-space: nowrap; border-radius: var(--pill); background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 15px; }
.qchip:active { background: color-mix(in srgb, var(--primary) 20%, var(--primary-soft)); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--g) * -1); padding: 2px var(--g); }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: var(--pill); background: var(--card); font-size: 14.5px; white-space: nowrap; flex: none; font-weight: 500; }
.chip[aria-pressed='true'] { background: var(--text); color: var(--bg); }
.chip svg { width: 17px; height: 17px; }
.input { width: 100%; height: 54px; padding: 0 18px; border-radius: var(--r-input); border: 1.5px solid transparent; background: var(--card); outline: none; font-size: 16px; transition: border-color 0.15s, background 0.15s; }
.input:focus { border-color: var(--primary); background: var(--surface); }
.input::placeholder { color: var(--faint); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 14px; font-weight: 500; color: var(--muted); }
.search { position: relative; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.search .input { padding-left: 46px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card); border-radius: var(--pill); padding: 5px; }
.seg button { height: 42px; border-radius: var(--pill); font-size: 15px; color: var(--muted); font-weight: 500; transition: all 0.18s; white-space: nowrap; text-align: center; }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: 0 2px 8px -2px rgba(15, 25, 70, 0.14); }
.seg.sm button { height: 34px; font-size: 13.5px; padding: 0 12px; }
.switch { width: 52px; height: 32px; border-radius: 16px; background: var(--card-2); position: relative; flex: none; transition: background 0.2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.switch[aria-checked='true'] { background: var(--primary); }
.switch[aria-checked='true']::after { transform: translateX(20px); }

/* radio card (Wallet ใน Add Money) */
.radio-list { display: flex; flex-direction: column; gap: 10px; }
.radio { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--r-row); background: var(--card); border: 1.5px solid transparent; width: 100%; text-align: left; }
.radio[aria-checked='true'] { border-color: var(--primary); background: var(--surface); }
.radio .rd { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--faint); display: grid; place-items: center; flex: none; margin-left: auto; }
.radio[aria-checked='true'] .rd { background: var(--primary); border-color: var(--primary); color: #fff; }
.radio .rd svg { width: 14px; height: 14px; stroke-width: 3; }
.radio b { font-weight: 500; font-size: 16px; }

/* category picker */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 6px; }
.cat-opt { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.25; }
.cat-opt .ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; transition: transform 0.15s, box-shadow 0.15s; }
.cat-opt .ic svg { width: 25px; height: 25px; }
.cat-opt[aria-pressed='true'] { color: var(--text); font-weight: 600; }
.cat-opt[aria-pressed='true'] .ic { box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 4.5px currentColor; transform: scale(1.04); }
.group-title { grid-column: 1 / -1; font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.mini-cats { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.mini-cats::-webkit-scrollbar { display: none; }
.mini-cat { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px 0 5px; border-radius: var(--pill); background: var(--surface); font-size: 14px; white-space: nowrap; flex: none; border: 1.5px solid var(--line); }
.mini-cat .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.mini-cat .ic svg { width: 16px; height: 16px; }
.mini-cat[aria-pressed='true'] { border-color: var(--primary); background: var(--primary-soft); font-weight: 600; }

/* ไอคอนหมวดแบบอีโมจิ (กรอบมนสีอ่อน) */
.emo { line-height: 1; border-radius: 16px; }
.cat-opt .ic.emo { border-radius: 19px; font-size: 27px; }
.cat-opt[aria-pressed='true'] .ic.emo { box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 4.5px currentColor; }
.logo.emo { font-size: 23px; border-radius: 16px; }
.li .logo.emo { font-size: 20px; border-radius: 14px; }
.mini-cat .ic.emo { font-size: 16px; border-radius: 50%; }
.dotic.emo { font-size: 24px; border-radius: 16px; }
.goal .gi.emo-in { font-size: 21px; line-height: 1; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emoji-grid button { height: 42px; border-radius: 12px; font-size: 23px; }
.emoji-grid button[aria-pressed='true'] { background: var(--primary-soft); box-shadow: inset 0 0 0 1.5px var(--primary); }

/* สลิปเข้าเอง: แถวค่าที่คัดลอกได้ */
.copy-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.copy-row .grow { flex: 1; min-width: 0; }
.copy-row small { display: block; font-size: 12.5px; color: var(--muted); }
.copy-row code { display: block; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: all; }
.copy-row .circle { width: 40px; height: 40px; }
.copy-row .circle svg { width: 19px; height: 19px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-2 .btn { padding: 0 12px; font-size: 15px; }
.how-row b b, .how-row span span b { display: inline; font-size: inherit; }

/* add screen */
.amount-in { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 16px; }
.amount-in span { font-size: 40px; font-weight: 700; }
.amount-in input { border: 0; background: transparent; outline: none; font-size: 52px; font-weight: 700; letter-spacing: -0.03em; width: 100%; min-width: 0; padding: 0; font-variant-numeric: tabular-nums; }
.amount-in input::placeholder { color: var(--faint); }
.form-h { margin: 0; font-size: 22px; font-weight: 600; }
.form-sub { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meta-btn { position: relative; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 54px; border-radius: var(--r-input); background: var(--card); font-size: 14.5px; min-width: 0; text-align: left; }
.meta-btn svg { width: 20px; height: 20px; color: var(--muted); }
.meta-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; }
.sticky-cta { position: sticky; bottom: 0; padding: 14px var(--g) calc(14px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 72%, transparent); z-index: 5; }

/* ---------- Scan / import ---------- */
.hero-scan { background: var(--card); border-radius: 28px; padding: 26px 20px 22px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; position: relative; overflow: hidden; }
.hero-scan.drag { box-shadow: inset 0 0 0 2px var(--primary); }
.stack { position: relative; width: 150px; height: 120px; margin-bottom: 6px; }
.stack .s { position: absolute; width: 74px; height: 102px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); left: 38px; top: 6px; padding: 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.stack .s:nth-child(1) { transform: rotate(-14deg) translate(-30px, 8px); }
.stack .s:nth-child(2) { transform: rotate(12deg) translate(30px, 6px); }
.stack .s i { display: block; height: 6px; border-radius: 3px; background: var(--card-2); }
.stack .s i.b { background: var(--primary-soft); width: 70%; height: 10px; }
.stack .s i.g { background: color-mix(in srgb, var(--spend-ic) 30%, transparent); width: 50%; }
.stack .q { position: absolute; right: 4px; bottom: 0; width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 4px var(--card); }
.stack .q svg { width: 22px; height: 22px; }
.hero-scan h2 { margin: 0; font-size: 21px; font-weight: 700; }
.hero-scan p { margin: 0 0 8px; color: var(--muted); font-size: 14.5px; max-width: 30ch; }
.banks { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.banks span { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: var(--pill); background: var(--surface); color: var(--muted); }
.how { display: grid; gap: 14px; }
.how-row { display: flex; gap: 14px; align-items: flex-start; }
.how-row .n { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.how-row b { display: block; font-size: 15.5px; font-weight: 600; }
.how-row span { font-size: 14px; color: var(--muted); }

.progress-card { background: linear-gradient(160deg, var(--navy-1), var(--navy-2)); color: var(--on-navy); border-radius: 28px; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.progress-card .pc-top { display: flex; align-items: center; gap: 16px; }
.gauge { width: 84px; height: 84px; position: relative; flex: none; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.progress-card h2 { margin: 0; font-size: 20px; font-weight: 600; }
.progress-card p { margin: 2px 0 0; color: var(--on-navy-2); font-size: 14px; }
.counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.count { background: var(--navy-chip); border-radius: 16px; padding: 10px 4px; text-align: center; }
.count b { display: block; font-size: 20px; font-weight: 700; }
.count small { font-size: 11.5px; color: var(--on-navy-2); }
.thumbs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 3px; margin: -3px; }
.thumbs::-webkit-scrollbar { display: none; }
.th { width: 46px; height: 62px; border-radius: 10px; background: var(--navy-chip) center top / cover no-repeat; flex: none; position: relative; }
.th i { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: 0 0 0 2px var(--navy-2); }
.th i svg { width: 11px; height: 11px; stroke-width: 3; }
.th.reading::after { content: ''; position: absolute; inset: 0; border-radius: 10px; background: linear-gradient(transparent 40%, rgba(255, 255, 255, 0.5) 50%, transparent 60%); background-size: 100% 300%; animation: sweep 1.1s linear infinite; }
@keyframes sweep { from { background-position: 0 100%; } to { background-position: 0 -100%; } }

.review-card { background: var(--card); border-radius: var(--r-card); padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rv-top { display: flex; gap: 12px; }
.rv-thumb { width: 68px; height: 92px; border-radius: 14px; object-fit: cover; object-position: top; background: var(--card-2); flex: none; display: block; }
.rv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rv-amt { display: flex; align-items: baseline; gap: 4px; }
.rv-amt span { font-size: 18px; font-weight: 700; }
.rv-amt input { border: 0; background: transparent; outline: none; width: 100%; min-width: 0; padding: 0; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rv-meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-self: flex-start; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--pill); font-size: 12px; font-weight: 600; }
.pill svg { width: 13px; height: 13px; }
.pill.ok { background: var(--pos-soft); color: var(--pos); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--neg-soft); color: var(--neg); }
.pill.blue { background: var(--primary-soft); color: var(--primary); }
.rv-fields { display: grid; gap: 8px; }
.rv-fields .input { height: 46px; font-size: 14.5px; background: var(--surface); }
.rv-actions { display: flex; gap: 8px; }
.ocr-text { font-size: 12px; white-space: pre-wrap; background: var(--surface); padding: 10px; border-radius: 12px; color: var(--muted); max-height: 160px; overflow: auto; margin: 6px 0 0; }
details summary { cursor: pointer; font-size: 13px; color: var(--muted); list-style: none; }
details summary::-webkit-details-marker { display: none; }

.notice { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--r-row); background: var(--primary-soft); width: 100%; text-align: left; }
.notice .dotic { width: 42px; height: 42px; }
.notice .dotic svg { width: 21px; height: 21px; }
.notice b { display: block; font-size: 15.5px; font-weight: 600; }
.notice span { font-size: 13.5px; color: var(--muted); }
.notice .grow { flex: 1; min-width: 0; }
.notice > svg { width: 20px; height: 20px; color: var(--muted); }
.notice.warn { background: var(--warn-soft); }

/* ---------- Report ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--card); border-radius: var(--r-card); padding: 16px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stat small { color: var(--muted); font-size: 14px; }
.stat b { font-size: 22px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.02em; }
.stat .vs { font-size: 12px; color: var(--muted); }
.stat svg.spark { width: 100%; height: 44px; margin-top: 8px; overflow: visible; }
.panel { background: var(--card); border-radius: var(--r-card); padding: 18px 16px; min-width: 0; }
.panel h3 { margin: 0; font-size: 17px; font-weight: 600; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.rings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.ring-item { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-align: center; min-width: 0; }
.ring-item svg { width: 62px; height: 62px; transform: rotate(-90deg); }
.ring-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cat-lines { display: flex; flex-direction: column; }
.cat-line { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); font-size: 14.5px; text-align: left; width: 100%; }
.cat-line:first-child { border-top: 0; }
.cat-line .pc { color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-line .nm { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); }
.cat-line .nm i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cat-line .nm span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-line b { font-weight: 600; font-variant-numeric: tabular-nums; }
.gauge-wrap { display: grid; place-items: center; position: relative; }
.gauge-wrap svg { width: 100%; max-width: 290px; height: auto; }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gauge-center b { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.gauge-center small { color: var(--muted); font-size: 13px; }
.gauge-center .pill { align-self: center; }
.info-line { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 10px 14px; border-radius: var(--pill); background: var(--surface); font-size: 13px; color: var(--muted); }
.info-line svg { width: 18px; height: 18px; color: var(--text); }
.period { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.period b { font-size: 17px; font-weight: 600; text-align: center; flex: 1; }

/* ---------- Budget (Saving Goals ใน ref) ---------- */
.goal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.goal { background: var(--card); border-radius: var(--r-card); padding: 16px; display: flex; flex-direction: column; gap: 2px; text-align: left; min-width: 0; }
.goal .ringic { width: 50px; height: 50px; position: relative; margin-bottom: 10px; }
.goal .ringic svg.r { width: 100%; height: 100%; transform: rotate(-90deg); }
.goal .ringic .gi { position: absolute; inset: 0; display: grid; place-items: center; }
.goal .ringic .gi svg { width: 21px; height: 21px; }
.goal b { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal small { font-size: 13px; color: var(--muted); }
.goal .amt { font-size: 21px; font-weight: 700; margin-top: 10px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal .of { font-size: 12.5px; color: var(--muted); }
.fab-pill { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 30; box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--primary) 70%, transparent); }

/* ---------- Settings ---------- */
.list { background: var(--card); border-radius: var(--r-card); overflow: hidden; }
.li { display: flex; align-items: center; gap: 14px; padding: 14px 16px; width: 100%; text-align: left; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .logo { width: 42px; height: 42px; }
.li .logo svg { width: 20px; height: 20px; }
.li .grow { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 500; }
.li .grow small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li > svg { width: 18px; height: 18px; color: var(--faint); }
.list-title { font-size: 14px; font-weight: 600; color: var(--muted); margin: 0 4px 10px; }

/* ---------- Sheet / toast ---------- */
.overlay { position: fixed; inset: 0; background: var(--backdrop); z-index: 80; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.2s both; }
@keyframes fade { from { opacity: 0; } }
.bsheet { width: 100%; max-width: 480px; background: var(--bg); border-radius: 30px 30px 0 0; padding: 10px var(--g) calc(22px + env(safe-area-inset-bottom, 0px)); max-height: 90vh; overflow-y: auto; animation: up 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.05) both; }
@keyframes up { from { transform: translateY(100%); } }
.bsheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 16px; }
.bsheet h3 { margin: 0 0 4px; font-size: 21px; font-weight: 700; }
.bsheet p.sub { margin: 0 0 18px; color: var(--muted); font-size: 14.5px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom, 0px)); z-index: 100; background: var(--text); color: var(--bg);
  padding: 13px 18px; border-radius: var(--pill); font-size: 14.5px; font-weight: 500; box-shadow: var(--shadow); animation: toastIn 0.25s both; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 40px); }
.toast span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast button { color: var(--primary); font-weight: 700; white-space: nowrap; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

.empty { text-align: center; padding: 30px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--card); border-radius: var(--r-card); }
.empty .dotic { width: 64px; height: 64px; background: var(--primary-soft); color: var(--primary); margin-bottom: 4px; }
.empty .dotic svg { width: 30px; height: 30px; }
.empty b { color: var(--text); font-size: 17px; font-weight: 600; }
.empty span { font-size: 14px; max-width: 30ch; }
.img-full { width: 100%; border-radius: 18px; display: block; }
.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.glyph-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.glyph-grid button { height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--card); }
.glyph-grid button svg { width: 22px; height: 22px; }
.glyph-grid button[aria-pressed='true'] { background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.color-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-row button { width: 34px; height: 34px; border-radius: 50%; }
.color-row button[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text); }

/* onboarding */
.onb { min-height: 100vh; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top, 0px) + 28px) var(--g) calc(24px + env(safe-area-inset-bottom, 0px)); gap: 20px; }
.onb h1 { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; text-wrap: balance; }
.onb p.lead { margin: -8px 0 0; color: var(--muted); font-size: 15.5px; }
.feats { display: flex; flex-direction: column; gap: 14px; }
.feat { display: flex; gap: 12px; align-items: flex-start; }
.feat .dotic { width: 26px; height: 26px; background: var(--primary); }
.feat .dotic svg { width: 15px; height: 15px; stroke-width: 3; }
.feat b { display: block; font-size: 16px; font-weight: 600; }
.feat span { font-size: 14px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
