/* TH Sổ Vàng — navy & white, gold as a small accent. iPhone Safari first. */
:root {
  --navy: #16233F;
  --navy-2: #22314F;
  --navy-line: #2E3E5E;
  --on-navy-muted: #B4BFD3;
  --gold: #C9A24D;
  --gold-text: #8C6B22;
  --gold-bar: #A8822F;
  --gold-tint: #F8F3E6;
  --ink: #141A26;
  --muted: #5B6474;
  --faint: #8A93A3;
  --line: #E3E7EE;
  --divider: #EEF1F5;
  --tint: #F5F7FA;
  --chip: #EDF1F7;
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --warn-text: #5E4614;
  --navy-text: #16233F;
  --nav-bg: rgba(255, 255, 255, 0.96);
  --toast-bg: #141A26;
  --toast-fg: #FFFFFF;
  color-scheme: light;
  --green: #1E6B3A;
  --green-tint: #E3F1E7;
  --red: #9A3412;
  --red-tint: #F7E7DE;
  --radius-l: 22px;
  --radius-m: 16px;
  --radius-s: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; min-height: 100dvh; font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--navy-text); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
svg { width: 20px; height: 20px; flex-shrink: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- page frame ---------- */
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.page { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: calc(16px + var(--safe-t)) 20px 28px; }
.page.with-nav { padding-bottom: calc(96px + var(--safe-b)); }
.top { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.top .titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.top h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.2px; }
.top .center { flex: 1; text-align: center; font-size: 17px; font-weight: 700; margin: 0; }
.brand { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; color: var(--gold-text); }
.sub { font-size: 13px; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); flex: none; text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; }

.lang { display: flex; background: var(--chip); border-radius: 999px; padding: 3px; gap: 2px; flex: none; }
.lang button { border: 0; border-radius: 999px; min-width: 44px; min-height: 40px; font-size: 13px; font-weight: 600; background: transparent; color: var(--navy-text); }
.lang button[aria-pressed="true"] { background: var(--navy); color: #fff; }

h2 { margin: 0; font-size: 17px; font-weight: 700; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tag { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--tint); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.link { font-size: 13px; font-weight: 600; color: var(--gold-text); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 6px 0; }

/* ---------- navy hero ---------- */
.hero { background: var(--navy); color: #fff; border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.hero .label { font-size: 14px; font-weight: 500; color: var(--on-navy-muted); }
.hero .big { font-weight: 700; letter-spacing: -0.8px; line-height: 1.1; }
.hero .note { font-size: 12px; color: var(--gold); }
.hero .note.muted { color: var(--on-navy-muted); line-height: 1.5; }
.hero .pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hero .cell { background: var(--navy-2); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hero .cell span:first-child { font-size: 12px; color: var(--on-navy-muted); }
.hero .cell .v { font-size: 16px; font-weight: 700; }
.hero .split { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--navy-line); padding-top: 12px; }
.hero .split span:first-child { font-size: 13px; color: var(--on-navy-muted); }
.hero .gold { color: var(--gold); }

/* sizes for long VND figures: the number always stays on one line */
.fit-1 { font-size: 34px; } .fit-2 { font-size: 30px; } .fit-3 { font-size: 26px; } .fit-4 { font-size: 22px; }
.cell .v.fit-s { font-size: 14px; }

/* ---------- banks ---------- */
.bank-list { display: flex; flex-direction: column; gap: 10px; }
.bank { display: flex; flex-direction: column; gap: 12px; border: 1.5px solid var(--line); border-radius: 18px; padding: 14px 16px; text-decoration: none; color: var(--ink); }
.bank .line { display: flex; align-items: center; gap: 14px; }
.badge { width: 44px; height: 44px; border-radius: 12px; background: var(--chip); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--navy-text); flex: none; }
.bank .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bank .who b { font-size: 15px; font-weight: 600; }
.bank .bal { font-size: 16px; font-weight: 700; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; border-radius: 16px; border: 0; background: var(--navy); color: #fff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 0 18px; width: 100%; }
.btn svg { width: 20px; height: 20px; }
.btn.ghost { background: var(--bg); color: var(--navy-text); border: 1.5px solid var(--navy); min-height: 48px; font-size: 14px; }
.btn.danger { background: var(--bg); color: var(--red); border: 1.5px solid var(--line); min-height: 48px; font-size: 14px; }
.btn.small { min-height: 44px; font-size: 13px; width: auto; border-radius: 12px; padding: 0 14px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

.stats2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat span:first-child { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 17px; font-weight: 700; }
.pos { color: var(--green); } .neg { color: var(--red); } .navy { color: var(--navy-text); }

.soft { display: flex; flex-direction: column; gap: 12px; background: var(--tint); border-radius: 20px; padding: 16px; text-decoration: none; color: var(--ink); }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.trio div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trio span:first-child { font-size: 12px; color: var(--muted); }
.trio .v { font-size: 14px; font-weight: 700; }
.pill-note { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 500; color: var(--navy-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }

.info { display: flex; gap: 10px; align-items: flex-start; background: var(--tint); border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.5; color: var(--navy-text); }
.info svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.info.warn { background: var(--gold-tint); color: var(--warn-text); }

/* ---------- segmented controls & chips ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; background: var(--chip); border-radius: 16px; padding: 4px; }
.seg button { min-height: 44px; border: 0; border-radius: 12px; font-size: 14px; font-weight: 600; background: transparent; color: var(--navy-text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(22, 35, 63, 0.12); }
.pills { display: flex; gap: 8px; }
.pills button { flex: 1; min-height: 44px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; color: var(--ink); }
.pills button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.pills button:disabled { border-style: dashed; color: var(--faint); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; }
.chips button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .lab { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { height: 50px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; font-size: 16px; background: var(--surface); width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; }
.input:focus { border-color: var(--navy); outline: none; }
input[type="date"].input { line-height: 46px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.amount-box { display: flex; flex-direction: column; gap: 6px; align-items: center; background: var(--tint); border-radius: 20px; padding: 18px 16px; }
.amount-box label { font-size: 13px; font-weight: 600; color: var(--muted); }
.amount-box input { width: 100%; border: 0; background: transparent; text-align: center; font-weight: 700; letter-spacing: -0.6px; font-size: 34px; padding: 0; }
.amount-box input:focus { outline: none; }
.amount-box .words { font-size: 13px; color: var(--muted); text-align: center; min-height: 19px; }
.amount-box .quick { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.amount-box .quick button { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--navy-text); }
.check { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 52px; font-size: 14px; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--navy); }
.err { color: var(--red); font-size: 13px; font-weight: 500; }

.receipt-pick { display: flex; gap: 10px; }
.thumb { width: 84px; height: 104px; border-radius: 12px; background: var(--tint); border: 1.5px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; flex: none; overflow: hidden; font-size: 11px; color: var(--muted); text-align: center; padding: 4px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.drop { flex: 1; min-height: 104px; border-radius: 12px; border: 1.5px dashed var(--navy-text); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--navy-text); position: relative; text-align: center; padding: 8px; }
.drop small { font-size: 11px; color: var(--muted); font-weight: 400; }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.drop svg { width: 26px; height: 26px; }
.drop.big { min-height: 150px; border-radius: 20px; background: var(--tint); }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.tx { display: flex; align-items: center; gap: 12px; padding: 13px 0; border: 0; border-bottom: 1px solid var(--divider); background: none; text-align: left; width: 100%; color: var(--ink); }
.tx .ic { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.tx .ic svg { width: 20px; height: 20px; }
.ic.in { background: var(--green-tint); } .ic.out { background: var(--red-tint); } .ic.move { background: var(--chip); }
.tx .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tx .mid b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .mid span { font-size: 12px; color: var(--muted); }
.tx .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tx .right b { font-size: 14px; font-weight: 700; }
.mini { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 3px 8px; color: var(--navy-text); background: var(--chip); }
.mini svg { width: 12px; height: 12px; }
.mini.auto { color: var(--gold-text); background: var(--gold-tint); }
.mini.ok { color: var(--green); background: var(--green-tint); }
.mini.bad { color: var(--red); background: var(--red-tint); }
.empty { border: 1.5px dashed var(--line); border-radius: 16px; padding: 18px; text-align: center; font-size: 13px; color: var(--muted); }

.card { border: 1.5px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.card.strong { border-color: var(--navy); }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kv div { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); min-width: 0; }
.kv b { font-size: 14px; font-weight: 600; color: var(--ink); }
.kv.tinted div { background: var(--tint); border-radius: 12px; padding: 10px; }
.kv.tinted b { font-size: 15px; font-weight: 700; }
.match { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.match svg { width: 22px; height: 22px; }

.table { border: 1.5px solid var(--line); border-radius: 18px; overflow: hidden; }
.table .tr { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--divider); align-items: center; font-size: 13px; }
.table .tr.th { background: var(--tint); border-top: 0; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; }
.table .tr.foot { background: var(--tint); font-size: 12px; color: var(--muted); grid-template-columns: 1fr auto; }
.table .r { text-align: right; }
.table button.tr { width: 100%; border: 0; border-top: 1px solid var(--divider); background: var(--surface); text-align: left; color: var(--ink); }
.code { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.code b { font-size: 14px; }
.code span { font-size: 12px; color: var(--muted); }
.table.bank3 .tr { grid-template-columns: 1fr 1.2fr 1.2fr; }

/* ---------- monthly chart ---------- */
.chart { border: 1.5px solid var(--line); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.a { background: var(--navy); } .legend i.b { background: var(--gold-bar); }
.bars { display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; scrollbar-width: none; }
.bars::-webkit-scrollbar { display: none; }
.bars button { flex: 1 0 46px; display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: transparent; border-radius: 12px; padding: 8px 2px; font-size: 12px; color: var(--ink); }
.bars button[aria-pressed="true"] { background: var(--chip); font-weight: 700; }
.bars .pair { height: 130px; display: flex; align-items: flex-end; gap: 3px; }
.bars .pair i { width: 11px; border-radius: 4px 4px 0 0; display: block; min-height: 3px; }
.bars .pair i.a { background: var(--navy); } .bars .pair i.b { background: var(--gold-bar); }

.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.month-nav span { font-size: 14px; font-weight: 600; }

/* ---------- bottom nav ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--nav-bg); -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + var(--safe-b)); }
.nav .in { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; }
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--navy-text); font-weight: 700; }
.nav a[aria-current="page"]::after { content: ''; width: 16px; height: 3px; border-radius: 2px; background: var(--gold); }

/* ---------- sheet (bottom drawer) ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(20, 26, 38, 0.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 520px; max-height: 88vh; max-height: 88dvh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 10px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; animation: up 0.22s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); align-self: center; }
.sheet h3 { margin: 0; font-size: 18px; }
.sheet .receipt-view img { width: 100%; border-radius: 14px; border: 1px solid var(--line); }
@keyframes up { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + var(--safe-b)); z-index: 60; background: var(--toast-bg); color: var(--toast-fg); border-radius: 14px; padding: 12px 16px; font-size: 14px; max-width: calc(100% - 40px); box-shadow: 0 6px 24px rgba(20, 26, 38, 0.25); }
.toast.bad { background: var(--red); }

.loading { display: flex; justify-content: center; padding: 60px 0; color: var(--muted); font-size: 14px; }
.spin { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--navy); border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; vertical-align: -4px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login { padding-top: calc(24px + var(--safe-t)); }
.login .mark { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 28px; text-align: center; }
.logo { width: 76px; height: 76px; border-radius: 24px; background: var(--navy); display: flex; align-items: center; justify-content: center; }
.logo svg { width: 40px; height: 40px; }
.login h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.5px; }
.login .tagline { margin: 0; font-size: 15px; color: var(--muted); }
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.otp input { height: 56px; border: 1.5px solid var(--line); border-radius: 12px; text-align: center; font-size: 22px; font-weight: 700; width: 100%; padding: 0; }
.otp input:focus { border-color: var(--navy); outline: none; }
.login .foot { margin-top: auto; display: flex; gap: 10px; align-items: flex-start; border-top: 1px solid var(--line); padding-top: 18px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.login .foot svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }

/* ---------- log ---------- */
.log-row { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--divider); }
.log-row .d { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 6px; background: var(--green); }
.log-row .d.bad { background: var(--red); } .log-row .d.neutral { background: var(--faint); }
.log-row .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.log-row .t1 { display: flex; justify-content: space-between; gap: 8px; }
.log-row .t1 b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.log-row .t1 span, .log-row .meta { font-size: 12px; color: var(--muted); }
.log-row .mini { align-self: flex-start; }
.sess { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.sess .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sess .who b { font-size: 14px; }
.sess .who span { font-size: 12px; color: var(--muted); }

.menu { display: flex; flex-direction: column; border: 1.5px solid var(--line); border-radius: 18px; overflow: hidden; }
.menu a, .menu button { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 56px; border: 0; border-top: 1px solid var(--divider); background: var(--surface); text-decoration: none; color: var(--ink); font-size: 15px; font-weight: 500; text-align: left; width: 100%; }
.menu > :first-child { border-top: 0; }
.menu svg { width: 20px; height: 20px; color: var(--navy-text); flex: none; }
.menu .grow { flex: 1; }

@media (min-width: 560px) {
  #app { border-left: 1px solid var(--divider); border-right: 1px solid var(--divider); }
}
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack.tight { gap: 12px; }
.login-form { margin-top: 32px; }
.plainlink { text-decoration: none; color: inherit; }
.pills a { flex: 1; min-height: 44px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; display: flex; align-items: center; justify-content: center; }
.pills a[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.month-nav .icon-btn { width: 40px; height: 40px; }
.receipt-view { display: block; }
.badge svg { width: 22px; height: 22px; }
.hero .big.gold { color: var(--gold); }
.sess .badge { font-size: 12px; }
.tx.plainlink { text-decoration: none; }
.seg { flex: 1; }
.link { white-space: nowrap; }
.link svg { width: 16px; height: 16px; }
.err { margin: 0; }
.err:empty { display: none; }
p { margin: 0; }
.match svg { flex: none; }
.card, .sub { overflow-wrap: anywhere; }
.log-row .meta.strong { color: var(--ink); font-size: 13px; }
.hist { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--divider); padding-top: 12px; }
.hist .item { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.hist .item b { font-size: 13px; color: var(--ink); font-weight: 600; }
.input.caps { text-transform: uppercase; letter-spacing: 0.5px; }
.pills { flex-wrap: wrap; }
.pills > * { flex: 1 1 calc(33.333% - 8px); min-width: 0; }
.pills a, .pills button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.bank-card .line { display: flex; align-items: center; gap: 14px; }
.bank-card .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bank-card .bal { font-size: 15px; font-weight: 700; }
.small-row .btn.small { flex: 1; }
.small-row .btn.small[data-up], .small-row .btn.small[data-down] { flex: 0 0 52px; font-size: 18px; }
.tx .btn.small { flex: none; }
.stats4 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats4 .stat { padding: 10px 12px; }
.stats4 .stat .v { font-size: 20px; }
.card.warnborder { border-color: var(--gold); }
.bsrow { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--divider); }
.bscheck { display: flex; align-items: flex-start; padding-top: 2px; }
.bscheck input { width: 24px; height: 24px; accent-color: var(--navy); }
.bsmid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.bsnote { font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.input.small-select { height: 40px; font-size: 14px; padding: 0 10px; background: var(--tint); border-color: var(--tint); }
.sticky-cta { position: sticky; bottom: 0; padding: 12px 0 calc(12px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
details.card summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.btn-row .btn.ghost svg { width: 18px; height: 18px; }

/* screenshot import */
.bsrow.off { opacity: .45; }
.bsmid { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.shot-edit { display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1.15fr); gap: 6px; }
.datebox { position: relative; display: flex; align-items: center; min-width: 0; overflow: hidden; font-size: 16px; color: var(--ink); white-space: nowrap; }
/* the native date picker sits invisibly on top: Safari's long "ngày 27 thg 9, 2026" text no longer squeezes into the box */
.datebox input[type=date] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; margin: 0; -webkit-appearance: none; appearance: none; font-size: 16px; }
.sign-btn { height: 40px; border-radius: 10px; border: 1px solid var(--divider); background: var(--surface); font-size: 20px; font-weight: 700; line-height: 1; }
.sign-btn.pos { color: var(--green); border-color: var(--green); }
.sign-btn.neg { color: var(--red); border-color: var(--red); }
.sign-btn.unk { color: var(--red); border-style: dashed; }
.shot-thumbs { display: flex; gap: 8px; overflow-x: auto; padding-top: 10px; }
.shot-thumbs img { height: 220px; width: auto; border-radius: 10px; border: 1px solid var(--divider); }
.seg + .info { margin-top: 0; }
.bsmid input.input { font-size: 16px; }

/* JV business fund */
.jv-holder { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.jv-holder:last-child { border-bottom: 0; }
.jv-holder > b { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: none; }
.jv-holder > .sub { flex: 1; }
.jv-holder .right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.conv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.jv-usd { white-space: normal; overflow-wrap: anywhere; font-size: 12px; color: var(--muted); text-align: center; margin: 14px 0 4px; line-height: 1.5; }
.soft.jv .row-head b { display: flex; align-items: center; gap: 8px; }
.tx .right .sub { font-size: 11px; color: var(--muted); font-weight: 400; }
.sheet > *, .sheet .field { min-width: 0; }
.sheet .seg { flex: none; }
.sheet input.input { width: 100%; min-width: 0; }
.jv-usdbox { display: flex; flex-direction: column; gap: 16px; }
.sheet > * { flex-shrink: 0; }

/* ---------- dark mode: Auto follows the phone, or chosen in the menu ---------- */
:root[data-theme="dark"] {
  --navy: #22345A;
  --navy-2: #2B3F69;
  --navy-line: #3A4D78;
  --navy-text: #DCE4F5;
  --on-navy-muted: #B4BFD3;
  --gold-text: #E0BF73;
  --gold-bar: #C9A24D;
  --gold-tint: #2A2414;
  --ink: #E8ECF4;
  --muted: #A3ADC2;
  --faint: #7D879C;
  --line: #2C3857;
  --divider: #232D47;
  --tint: #1B2540;
  --chip: #212C48;
  --bg: #0D1320;
  --surface: #161F33;
  --warn-text: #EBCB85;
  --nav-bg: rgba(13, 19, 32, 0.94);
  --toast-bg: #E8ECF4;
  --toast-fg: #0D1320;
  --green: #5CC384;
  --green-tint: #15301F;
  --red: #F08A6C;
  --red-tint: #3A1E16;
  color-scheme: dark;
}
:root[data-theme="dark"] svg[stroke="#16233F"] { stroke: var(--navy-text); }
:root[data-theme="dark"] svg[stroke="#1E6B3A"] { stroke: var(--green); }
:root[data-theme="dark"] svg[stroke="#9A3412"] { stroke: var(--red); }
:root[data-theme="dark"] svg[stroke="#8C6B22"] { stroke: var(--gold-text); }
:root[data-theme="dark"] svg[stroke="#5B6474"] { stroke: var(--muted); }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--navy-2); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
:root[data-theme="dark"] .hero { box-shadow: inset 0 0 0 1px var(--navy-line); }
:root[data-theme="dark"] .btn.ghost, :root[data-theme="dark"] .btn.danger { background: transparent; }

@media (prefers-color-scheme: dark) {

/* ---------- dark mode: Auto follows the phone, or chosen in the menu ---------- */
:root:not([data-theme="light"]) {
  --navy: #22345A;
  --navy-2: #2B3F69;
  --navy-line: #3A4D78;
  --navy-text: #DCE4F5;
  --on-navy-muted: #B4BFD3;
  --gold-text: #E0BF73;
  --gold-bar: #C9A24D;
  --gold-tint: #2A2414;
  --ink: #E8ECF4;
  --muted: #A3ADC2;
  --faint: #7D879C;
  --line: #2C3857;
  --divider: #232D47;
  --tint: #1B2540;
  --chip: #212C48;
  --bg: #0D1320;
  --surface: #161F33;
  --warn-text: #EBCB85;
  --nav-bg: rgba(13, 19, 32, 0.94);
  --toast-bg: #E8ECF4;
  --toast-fg: #0D1320;
  --green: #5CC384;
  --green-tint: #15301F;
  --red: #F08A6C;
  --red-tint: #3A1E16;
  color-scheme: dark;
}
:root:not([data-theme="light"]) svg[stroke="#16233F"] { stroke: var(--navy-text); }
:root:not([data-theme="light"]) svg[stroke="#1E6B3A"] { stroke: var(--green); }
:root:not([data-theme="light"]) svg[stroke="#9A3412"] { stroke: var(--red); }
:root:not([data-theme="light"]) svg[stroke="#8C6B22"] { stroke: var(--gold-text); }
:root:not([data-theme="light"]) svg[stroke="#5B6474"] { stroke: var(--muted); }
:root:not([data-theme="light"]) .seg button[aria-pressed="true"] { background: var(--navy-2); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
:root:not([data-theme="light"]) .hero { box-shadow: inset 0 0 0 1px var(--navy-line); }
:root:not([data-theme="light"]) .btn.ghost, :root:not([data-theme="light"]) .btn.danger { background: transparent; }
}

/* app version line and change log */
.app-ver { text-align: center; font-size: 12px; color: var(--faint); margin: 18px 0 4px; }
.app-ver a { color: var(--faint); text-decoration: none; border-bottom: 1px dotted var(--faint); }
.ver-card h3 { margin: 0; font-size: 16px; display: flex; gap: 8px; align-items: baseline; }
.ver-card h3 .sub { font-weight: 400; font-size: 13px; }
.ver-card ul { margin: 8px 0 0; padding-left: 18px; }
.ver-card li { margin: 3px 0; }
.ver-card.current { border-color: var(--gold); }
.qty-edit { width: 110px; height: 40px; text-align: right; font-size: 16px; }
.hold-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--divider); }
.hold-row:last-child { border-bottom: 0; }
.hold-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mini.edited { background: var(--gold-tint); color: var(--gold-text); }
ol.guide { margin: 8px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.gold-num { font-size: 22px; color: var(--gold-text); }
