/* Coinzera. Giao diện theo bản Figma Make "Thiết Kế Lại App Thu Chi": nền kem, thẻ trắng bo 22px viền mảnh bóng mờ,
   thẻ tổng xanh rừng đậm, chữ Manrope đậm. Biến --zera* là màu chính của tool.
   Sáng/tối: html[data-theme] = light | dark | auto (Cá nhân → Giao diện; auto theo hệ thống). */
:root {
  color-scheme: light dark;
  --bg: light-dark(#fbfaf6, oklch(0.16 0.014 160));
  --bg-2: light-dark(#ffffff, oklch(0.2 0.017 160));
  --surface: light-dark(#eef1ed, oklch(0.24 0.02 160));
  --surface-2: light-dark(#e2e8e1, oklch(0.29 0.024 160));
  --rule: light-dark(#edf0eb, oklch(0.27 0.02 160));
  --rule-2: light-dark(#dce3dc, oklch(0.36 0.026 160));
  --ink: light-dark(#17241d, oklch(0.96 0.008 160));
  --ink-2: light-dark(#6b7a71, oklch(0.8 0.016 160));
  --ink-3: light-dark(#87918a, oklch(0.68 0.016 160));
  --zera: light-dark(#2c7654, oklch(0.76 0.11 152));
  --zera-ink: light-dark(#1f6748, oklch(0.84 0.09 150));
  --zera-soft: light-dark(#e9f3ec, oklch(0.29 0.045 158));
  --zera-solid: light-dark(#18563e, oklch(0.47 0.08 156));
  --on-zera: #ffffff;
  /* Thẻ tổng (Giao dịch, Ví): nền xanh đậm (--hero-bg bên dưới), chữ sáng. */
  --hero-ink-2: #b4c7bb;
  --hero-in: #bde9c4;
  --hero-out: #f2bfa3;
  /* Thu xanh lá, chi cam đất (chỉ dùng ở tổng; từng giao dịch chi để màu chữ thường). */
  --in: light-dark(#2e8a5b, oklch(0.8 0.14 148));
  --out: light-dark(#c36543, oklch(0.76 0.12 38));
  --danger: light-dark(oklch(0.52 0.2 27), oklch(0.72 0.17 27));
  /* Biểu đồ danh mục: xanh rừng, cam, xanh khói, xanh lá nhạt, hồng tím, vàng đất; còn lại xám. */
  --c1: light-dark(#2c7654, #92c7a0);
  --c2: light-dark(#e8b57d, #e8b57d);
  --c3: light-dark(#729ca7, #8fb6c0);
  --c4: light-dark(#92c7a0, #4f8a67);
  --c5: light-dark(#b98aa6, #c79bb6);
  --c6: light-dark(#c9b27e, #b5a676);
  --c-other: light-dark(#d9dfd8, oklch(0.4 0.01 160));
  --heat: light-dark(#2c7654, oklch(0.62 0.1 152));

  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* Độ sâu: thẻ nằm (--shadow) = viền mảnh + bóng rộng rất mờ; thẻ nổi khi rê chuột (--shadow-2); lớp trên cùng (--shadow-3).
     Nền tối bóng khó thấy nên thêm viền sáng mảnh phía trên (--edge-top). */
  --shadow-c: light-dark(rgba(31, 54, 41, .06), oklch(0 0 0 / .45));
  --edge-top: light-dark(transparent, oklch(1 0 0 / .07));
  --edge-ring: light-dark(#e8ece7, oklch(1 0 0 / .05));
  --edge: inset 0 1px 0 var(--edge-top), inset 0 0 0 1px var(--edge-ring);
  --shadow: var(--edge), 0 8px 26px var(--shadow-c);
  --shadow-2: var(--edge), 0 12px 32px light-dark(rgba(31, 54, 41, .1), oklch(0 0 0 / .55));
  --shadow-3: 0 4px 16px var(--shadow-c), 0 30px 80px light-dark(rgba(25, 42, 32, .16), oklch(0 0 0 / .6));
  /* Thẻ tổng: gradient xanh rừng, bóng xanh bên dưới; vòng sáng góc trên phải vẽ bằng ::before (.hero, .worth). */
  --hero-bg: linear-gradient(145deg, #174c38, #0c3327);
  --hero-shadow: 0 18px 32px light-dark(rgba(18, 70, 50, .2), oklch(0 0 0 / .5));
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --col: 600px;
  --tab-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --z-sticky: 10;
  --z-tabbar: 20;
  --z-toast: 40;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 500 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1, h2 { text-wrap: balance; letter-spacing: -0.035em; }
ul { margin: 0; padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--zera-ink); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--zera); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); font-size: 14px; }
svg { flex: none; }
.icon-btn svg, .tabbar svg, .search svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

main { max-width: var(--col); margin: 0 auto; padding: calc(22px + env(safe-area-inset-top, 0px)) 20px calc(var(--tab-h) + var(--safe-b) + 32px); }
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* ---------- Đầu màn: nhãn nhỏ viết hoa + tiêu đề to, nút tròn bên phải ---------- */
.topbar, .page-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.topbar h1, .page-title h1 { font-size: 23px; font-weight: 800; line-height: 1.25; letter-spacing: -0.04em; }
.grow { flex: 1; min-width: 0; }
.round-btn { display: grid; place-items: center; flex: none; width: 43px; height: 43px; overflow: hidden; border: 1px solid var(--rule-2); border-radius: 50%;
  background: var(--bg-2); color: var(--ink); text-decoration: none; box-shadow: 0 6px 20px var(--shadow-c); }
.round-btn:hover { background: var(--surface); }
.round-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.round-btn img { width: 100%; height: 100%; object-fit: cover; }
.round-btn span { font-size: 14px; font-weight: 800; color: var(--zera-ink); }
/* Nút viên thuốc nhỏ: "+ Thêm ví", "Sắp xếp". */
.pill { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 38px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: 13px;
  background: var(--bg-2); color: var(--zera-ink); font-size: 12px; font-weight: 800; cursor: pointer; }
.pill:hover { background: var(--surface); }
.pill svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pill.quiet { height: 32px; border-color: transparent; background: none; }
.pill.quiet:hover, .pill.on { background: var(--zera-soft); }

/* ---------- Trang chủ ---------- */
.balance { gap: 0; min-height: 188px; padding: 22px; }
.balance .hero-net { margin-top: 18px; }
.balance-foot { display: flex; align-items: center; gap: 7px; margin-top: 23px; font-size: 12px; color: var(--hero-ink-2); }
.growth { display: inline-flex; align-items: center; gap: 3px; padding: 5px 7px; border-radius: 8px; background: rgba(152, 209, 169, .13); color: var(--hero-in); font-weight: 800; }
.growth.down { background: rgba(242, 191, 163, .13); color: var(--hero-out); }
.mini-bars { display: flex; align-items: flex-end; gap: 4px; height: 38px; margin-left: auto; }
.mini-bars i { display: block; width: 5px; border-radius: 4px; background: rgba(189, 233, 196, .65); }
.recent { display: grid; gap: 10px; margin-top: 10px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; }
.section-heading h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.035em; }
.section-heading a { color: var(--zera-ink); font-size: 12px; font-weight: 800; text-decoration: none; }
#hNotice:empty { display: none; }

/* ---------- Cá nhân ---------- */
.profile { display: grid; justify-items: center; text-align: center; padding-top: 14px; }
.avatar { display: grid; place-items: center; width: 76px; height: 76px; margin-bottom: 15px; overflow: hidden; border-radius: 50%;
  background: var(--zera-solid); color: var(--on-zera); font-size: 21px; font-weight: 800; box-shadow: 0 9px 20px light-dark(rgba(25, 80, 57, .2), oklch(0 0 0 / .4)); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.profile h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.04em; overflow-wrap: anywhere; }
.profile-intro { max-width: 300px; margin: 10px auto 14px; color: var(--ink-3); font-size: 12px; line-height: 1.7; }
.menu { display: grid; overflow: hidden; border-radius: 18px; background: var(--bg-2); box-shadow: var(--shadow); }
.menu a { display: flex; align-items: center; gap: 10px; padding: 17px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 700; }
.menu a + a { border-top: 1px solid var(--rule); }
.menu a:hover { background: color-mix(in oklch, var(--surface) 55%, var(--bg-2)); }
.menu span { flex: 1; min-width: 0; }
.menu small { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.menu b { color: var(--ink-3); font-size: 19px; line-height: 1; }

/* ---------- Tháng, tóm tắt ---------- */
/* Tiêu đề tháng: nhãn nhỏ viết hoa ("Tháng này") trên, tên tháng to bên trái; nút lùi/tiến tròn bên phải. */
.monthbar { display: flex; align-items: center; gap: 8px; padding-top: 6px; }
.monthbar .month-title { order: -1; margin-right: auto; }
.monthbar .back-home { order: -2; margin-left: -8px; }
.month-title { display: flex; flex-direction: column; font-size: 23px; font-weight: 800; line-height: 1.25; letter-spacing: -0.04em; }
.month-title small, .eyebrow { display: block; margin-bottom: 2px; font-size: 11px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.icon-btn svg { width: 20px; height: 20px; }
.monthbar .icon-btn { width: 42px; height: 42px; border: 1px solid var(--rule-2); background: var(--bg-2); color: var(--ink); box-shadow: 0 6px 20px var(--shadow-c); }
.monthbar .icon-btn:hover { background: var(--surface); }
.monthbar .icon-btn:disabled { background: var(--bg-2); box-shadow: none; }

.summary { margin: 0; container-type: inline-size; display: grid; grid-template-columns: repeat(3, 1fr); border-radius: 22px; background: var(--bg-2); box-shadow: var(--shadow); }
.summary > div { padding: 10px 12px; min-width: 0; }
.summary > div + div { border-left: 1px solid var(--rule); }
.summary dt { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.summary dd { margin: 2px 0 0; font-weight: 800; font-size: min(16px, 4cqi); letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.pos { color: var(--in); }
.neg { color: var(--out); }

/* Thẻ tổng màn Giao dịch: nền xanh rừng, chênh lệch to, so với tháng trước, đường chi cộng dồn, thu/chi dưới cùng. */
.hero { display: grid; gap: 10px; padding: 20px 20px 16px; border-radius: 27px; background: var(--hero-bg); color: var(--on-zera); container-type: inline-size;
  box-shadow: var(--hero-shadow); position: relative; overflow: hidden; isolation: isolate; }
/* Vòng sáng góc trên phải của thẻ tổng. */
.hero::before, .worth::before { content: ""; position: absolute; z-index: -1; width: 180px; height: 180px; right: -45px; top: -50px;
  border: 42px solid rgba(147, 202, 166, .12); border-radius: 50%; pointer-events: none; }
.hero-label { font-size: 14px; font-weight: 500; color: var(--hero-ink-2); }
.hero-net { font-size: min(33px, 10cqi); font-weight: 800; letter-spacing: -0.05em; line-height: 1.15; white-space: nowrap; margin-top: 6px; }
.hero-net .cur { font-size: .55em; font-weight: 700; margin-left: 3px; opacity: .7; vertical-align: .35em; }
.hero-cmp { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13.5px; }
.hero-cmp b { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 8px; background: rgba(152, 209, 169, .13); font-weight: 800; font-size: 12.5px; }
.hero-cmp.down b { color: var(--hero-in); }
.hero-cmp.up b { color: var(--hero-out); background: rgba(242, 191, 163, .13); }
.hero-cmp small { font-size: 12px; color: var(--hero-ink-2); }
.spark svg { display: block; width: 100%; height: 56px; overflow: visible; }
.sp-cur { fill: none; stroke: var(--on-zera); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.eye { display: grid; place-items: center; width: 34px; height: 34px; margin: -6px -6px -6px 0; border: 0; border-radius: 50%;
  background: transparent; color: #d5e2d9; cursor: pointer; transition: background-color .15s, transform .15s var(--ease); }
.eye:hover { background: oklch(1 0 0 / .18); }
.eye:active { transform: scale(.92); }
.eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sp-area { fill: oklch(1 0 0 / .1); stroke: none; }
.sp-prev { fill: none; stroke: oklch(1 0 0 / .42); stroke-width: 1.5; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.spark-key { display: flex; gap: 14px; margin-top: 6px; font-size: 12px; color: var(--hero-ink-2); }
.spark-key span { display: inline-flex; align-items: center; gap: 6px; }
.spark-key i { width: 14px; height: 0; border-top: 2px solid var(--on-zera); }
.spark-key i.k-prev { border-top: 2px dashed oklch(1 0 0 / .5); }
.hero-row { display: grid; grid-template-columns: 1fr 1fr; margin: 0; padding-top: 12px; border-top: 1px solid oklch(1 0 0 / .12); }
.hero-row > div + div { padding-left: 14px; border-left: 1px solid oklch(1 0 0 / .12); }
.hero-row dt { font-size: 12px; color: var(--hero-ink-2); }
.hero-row dd { margin: 2px 0 0; font-weight: 800; font-size: min(17px, 5cqi); letter-spacing: -0.02em; white-space: nowrap; }
.hero .pos { color: var(--hero-in); }
.hero .neg { color: var(--hero-out); }

/* Ghi nhanh: hai nút Ghi khoản chi / Ghi khoản thu dưới thẻ tổng. */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick button { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 12px; border: 0; border-radius: 18px; background: var(--bg-2); color: var(--ink);
  text-align: left; cursor: pointer; box-shadow: var(--shadow); transition: box-shadow .2s var(--ease); }
@media (hover: hover) { .quick button:hover { box-shadow: var(--shadow-2); } }
.quick .q-ic { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 13px; transition: transform .2s var(--ease); }
.quick button:active .q-ic { transform: scale(.94); }
.quick svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.quick .q-out .q-ic { color: light-dark(#c36543, #f2bfa3); background: light-dark(#fff0e7, oklch(0.3 0.04 45)); }
.quick .q-in .q-ic { color: light-dark(#26704d, #bde9c4); background: light-dark(#e7f3ea, oklch(0.3 0.045 150)); }
.q-text { display: grid; gap: 2px; min-width: 0; }
.q-text b { font-size: 13px; font-weight: 800; line-height: 1.25; }
.q-text small { font-size: 11px; color: var(--ink-3); line-height: 1.25; }

/* Ghi bằng một câu: ô gõ dạng viên thuốc, nút micro tròn bên phải; đang nghe thì micro đỏ và nháy vòng. */
.say { display: grid; gap: 6px; }
.say-box { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 18px; border-radius: 999px; background: var(--bg-2); box-shadow: var(--shadow);
  border: 1px solid transparent; transition: border-color .2s, box-shadow .2s var(--ease); }
.say-box:focus-within { border-color: var(--zera); box-shadow: var(--shadow-2); }
.say-box input { flex: 1; min-width: 0; height: 40px; border: 0; background: none; outline: none; font-size: 15px; font-weight: 600; }
.say-box input::placeholder { color: var(--ink-3); font-weight: 500; }
.say-mic { position: relative; display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: var(--zera-solid); color: var(--on-zera); cursor: pointer; transition: background-color .2s, transform .15s var(--ease); }
.say-mic:active { transform: scale(.94); }
.say-mic svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.say-mic[aria-pressed="true"] { background: var(--out); }
.say-mic[aria-pressed="true"]::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--out); animation: listen 1.2s var(--ease) infinite; }
@keyframes listen { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.25); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .say-mic[aria-pressed="true"]::after { animation: none; } }
.say-hint { min-height: 1.3em; padding: 0 18px; font-size: 12.5px; color: var(--ink-3); }
.say-hint:empty { display: none; }
.say-hint b { color: var(--ink); font-weight: 700; }

/* ---------- Bộ lọc ---------- */
.filters { display: flex; gap: 8px; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--rule-2); border-radius: 15px; background: var(--bg-2); }
.search:focus-within { border-color: var(--zera); }
.search svg { width: 17px; height: 17px; color: var(--ink-3); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; }
select, .field input {
  height: 44px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: 13px; background: var(--bg-2); font-size: 16px; font-weight: 600; min-width: 0;
}
select:focus, .field input:focus { outline: none; border-color: var(--zera); }
.filters select { flex: none; width: 38%; }
.chips-row:empty { display: none; }
.chips, .chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: 12px;
  background: var(--bg-2); font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--zera); }
.chip.on { border-color: color-mix(in oklch, var(--zera) 70%, transparent); background: var(--zera-soft); color: var(--zera-ink); }
.chip .x { font-size: 16px; line-height: 1; color: var(--ink-3); }

.notice { display: grid; gap: 8px; padding: 14px 16px; border-radius: 18px; background: var(--surface); font-size: 13.5px; color: var(--ink-2); }
.notice .acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Danh sách giao dịch ---------- */
.day { margin-top: 8px; }
.day-head { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 10px 2px 8px; background: var(--bg); font-size: 15px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.day-head .num { font-size: 12.5px; font-weight: 700; letter-spacing: 0; color: var(--ink-3); }
.txs { position: relative; border-radius: 22px; background: var(--bg-2); box-shadow: var(--shadow); overflow: hidden; }
/* Viền sáng phía trên vẽ đè lên các dòng (dòng có nền riêng sẽ che bóng inset). */
.txs::after, .rows::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: var(--edge); pointer-events: none; z-index: 2; }
.tx { position: relative; overflow: hidden; }
.tx + .tx::before { content: ""; position: absolute; top: 0; left: 15px; right: 15px; z-index: 1; border-top: 1px solid var(--rule); }
.tx-del { position: absolute; inset: 1px 0 1px auto; width: 88px; border: 0; background: oklch(0.55 0.2 27); color: oklch(0.99 0 0); font-weight: 650; cursor: pointer; }
.tx-main { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 15px; border: 0; background: var(--bg-2);
  text-align: left; cursor: pointer; touch-action: pan-y; transition: transform .22s var(--ease); }
.tx-main:hover { background: color-mix(in oklch, var(--surface) 55%, var(--bg-2)); }
.tx.dragging .tx-main { transition: none; }
/* Ô icon: ô vuông bo 14px, icon nét trên nền nhạt theo màu nhóm (--h hue, --k 0 = xám); emoji lạ thì vẽ emoji. */
.ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--surface); font-size: 20px; line-height: 1; flex: none; }
.ic.ico { background: light-dark(oklch(0.955 calc(0.04 * var(--k)) var(--h)), oklch(0.3 calc(0.05 * var(--k)) var(--h)));
  color: light-dark(oklch(0.5 calc(0.12 * var(--k)) var(--h)), oklch(0.84 calc(0.1 * var(--k)) var(--h))); }
.ic.sm.ico { box-shadow: none; }
.ic svg { width: 50%; height: 50%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 24px; height: 24px; border-radius: 8px; font-size: 14px; }
.ic.sm svg { stroke-width: 2.2; }
.named { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; vertical-align: middle; }
.named > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx.flash .tx-main { animation: flash 1.2s var(--ease); }
@keyframes flash { from { background: var(--zera-soft); } }
.tx-text { flex: 1; min-width: 0; display: grid; }
.tx-text b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-text small { font-size: 11.5px; font-weight: 500; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amt { font-size: 13.5px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt.tr { color: var(--ink-2); }
.amt .bal { display: block; font-size: 12px; font-weight: 450; color: var(--ink-3); text-align: right; }
.tag { font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 6px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }

.empty { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty b { color: var(--ink); font-size: 16px; }
.empty p { max-width: 34ch; text-wrap: pretty; }

/* ---------- Khối, danh sách chung ---------- */
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 17px; border-radius: 22px; background: var(--bg-2); box-shadow: var(--shadow);
  transition: box-shadow .25s var(--ease), transform .25s var(--ease); }
@media (hover: hover) { .panel:hover { box-shadow: var(--shadow-2); } }
.panel-title { font-size: 17px; font-weight: 800; letter-spacing: -0.03em; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.list-head h2 { font-size: 18px; font-weight: 800; }
.list-acts { display: flex; gap: 6px; }
.rows { position: relative; border-radius: 22px; background: var(--bg-2); box-shadow: var(--shadow); overflow: hidden; }
.rows:empty { display: none; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 16px; }
.row + .row { border-top: 1px solid var(--rule); }
.row.child { padding-left: 40px; }
.row.off { opacity: .55; }
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; padding: 0; background: none; text-align: left; cursor: pointer; }
.row-text { flex: 1; min-width: 0; display: grid; }
.row-text b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-text small { font-size: 11.5px; color: var(--ink-3); }
.row .amt { margin-left: auto; }
.row-tools { display: flex; gap: 2px; }
.row-tools .icon-btn { width: 36px; height: 36px; }
.row-tools svg { width: 18px; height: 18px; }
.hidden-group summary { padding: 6px 2px; color: var(--ink-2); font-size: 14px; cursor: pointer; }
.hidden-group .rows { margin-top: 6px; }

.worth { display: grid; gap: 4px; padding: 22px 24px; border-radius: 24px; background: linear-gradient(135deg, #174c38, #2a6b4e); color: var(--on-zera); box-shadow: var(--hero-shadow); position: relative; overflow: hidden; isolation: isolate; }
.worth-label { font-size: 13px; font-weight: 600; color: var(--hero-ink-2); }
.worth-value { font-size: 28px; font-weight: 800; letter-spacing: -0.04em; }
.worth-value .cur { font-size: .55em; font-weight: 700; margin-left: 3px; opacity: .7; vertical-align: .35em; }
.worth-sub { font-size: 12px; color: var(--hero-ink-2); }

/* ---------- Nút ---------- */
.primary, .ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px;
  border-radius: 15px; font-weight: 800; font-size: 14px; cursor: pointer; text-decoration: none;
  transition: background-color .15s, filter .15s, transform .15s var(--ease), box-shadow .15s; }
.primary { border: 0; background: var(--zera-solid); color: var(--on-zera);
  box-shadow: 0 9px 20px light-dark(rgba(25, 82, 59, .2), oklch(0 0 0 / .4)); }
.primary:hover { filter: brightness(1.1); }
.primary:active, .ghost:active { transform: scale(.98); }
.ghost { border: 1px solid var(--rule-2); background: var(--bg-2); color: var(--ink); }
.ghost:hover { background: var(--surface); }
.ghost.sm { height: 38px; padding: 0 12px; border-radius: 13px; font-size: 12px; color: var(--zera-ink); }
.ghost.on { border-color: var(--zera); color: var(--zera-ink); background: var(--zera-soft); }
.ghost.danger { color: var(--danger); }
.stack { display: grid; gap: 8px; }
.sync-text { font-size: 14px; color: var(--ink-2); }
.sync-text .err { color: var(--danger); }

/* Nút chọn: rãnh xám nhạt, mục đang chọn là ô trắng nổi chữ xanh. */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 15px; background: var(--surface); }
.seg button { height: 38px; border: 0; border-radius: 11px; background: transparent; color: var(--ink-3); font-weight: 800; font-size: 12.5px; cursor: pointer; transition: background-color .18s var(--ease), color .18s, box-shadow .18s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--bg-2); color: var(--zera-ink); box-shadow: 0 4px 12px light-dark(rgba(41, 64, 51, .08), oklch(0 0 0 / .35)); }
.seg button:disabled { cursor: default; opacity: .45; }

/* ---------- Báo cáo ---------- */
.donut { display: grid; place-items: center; }
.donut svg { width: min(220px, 62vw); height: auto; }
.donut text { fill: var(--ink); font-family: var(--font); }
.donut .d-label { fill: var(--ink-2); }
.legend li + li { border-top: 1px solid var(--rule); }
.legend button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 2px; border: 0; background: none; text-align: left; cursor: pointer; }
.legend button:hover .lg-name { color: var(--zera-ink); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lg-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-pct { width: 46px; text-align: right; color: var(--ink-2); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.lg-amt { min-width: 96px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.legend .sub button { padding-left: 22px; font-size: 14px; color: var(--ink-2); }
.bars { position: relative; }
.bars svg { width: 100%; height: auto; display: block; }
.bars text { fill: var(--ink-3); font: 500 11px var(--font); }
.bars .cur text.m { fill: var(--ink); font-weight: 700; }
.bars line.grid { stroke: var(--rule); stroke-dasharray: 2 4; }
.bar-tip { position: absolute; top: -6px; display: grid; gap: 1px; padding: 7px 10px; border-radius: 10px; background: var(--ink); color: var(--bg-2);
  font-size: 12.5px; white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); }
.bar-tip .pos { color: light-dark(oklch(0.85 0.12 148), oklch(0.5 0.13 148)); }
.rep-period { margin-top: -4px; }
/* Bảng tràn ra hai mép thẻ để cuộn ngang (khớp padding 17px của .panel); chữ "Chưa có." thì thụt lại cho thẳng tiêu đề. */
.mat-wrap { overflow-x: auto; margin: 0 -17px -17px; padding: 0 0 6px; }
.mat-wrap > .pad { padding: 0 17px 11px; }
.mat { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mat th, .mat td { padding: 0; border-bottom: 1px solid var(--rule); text-align: right; }
.mat thead th { padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.mat th:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg-2); text-align: left; max-width: 46vw; }
.mat th[scope="row"] button, .mat td button { width: 100%; padding: 7px 10px; border: 0; background: none; color: inherit; font: inherit; text-align: inherit; cursor: pointer; }
.mat th[scope="row"] button { overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.mat th[scope="row"] button:hover, .mat td button:hover { color: var(--zera-ink); }
.mat td { padding: 7px 10px; }
.mat td:has(button) { padding: 0; }
.mat td.sum { font-weight: 650; }
.mat td.zero { color: var(--ink-3); }
.mat tbody td[style] { background: color-mix(in oklch, var(--heat) calc(var(--h) * 34%), transparent); }
.mat tfoot th, .mat tfoot td { padding: 8px 10px; font-weight: 650; border-bottom: 0; }
.mat tr > :nth-child(3) { border-right: 1px solid var(--rule); color: var(--ink-2); }
.bars rect.hit { fill: transparent; cursor: pointer; }
.bars .cur rect.hit { fill: var(--surface); }
.bar-key { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); }
.bar-key span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Thanh dưới: 4 mục + nút Thêm tròn nhô lên giữa ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-tabbar);
  display: grid; grid-template-columns: 1fr 1fr 72px 1fr 1fr; align-items: center;
  max-width: var(--col); margin: 0 auto; height: calc(var(--tab-h) + var(--safe-b)); padding: 0 10px var(--safe-b);
  background: color-mix(in oklch, var(--bg-2) 92%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--rule);
}
@media (min-width: 640px) { .tabbar { bottom: 12px; border: 0; border-radius: 26px; padding-bottom: 0; height: var(--tab-h); box-shadow: var(--edge), var(--shadow-3); } }
.tabbar a { display: grid; justify-items: center; gap: 4px; padding: 6px 0; color: var(--ink-3); text-decoration: none; font-size: 11px; font-weight: 700; transition: color .2s; }
.tabbar a svg { width: 22px; height: 22px; stroke-width: 1.8; }
.tabbar a[aria-current="page"] { color: var(--zera-ink); }
.tabbar .add { justify-self: center; display: grid; place-items: center; width: 60px; height: 60px; border: 6px solid light-dark(#f2f3ef, var(--bg)); border-radius: 50%;
  background: var(--zera-solid); color: var(--on-zera); cursor: pointer; transform: translateY(-16px);
  box-shadow: 0 8px 20px light-dark(rgba(25, 83, 60, .28), oklch(0 0 0 / .5));
  transition: transform .15s var(--ease); }
.tabbar .add svg { width: 26px; height: 26px; stroke-width: 2.2; }
.tabbar .add span { display: none; }
.tabbar .add:active { transform: translateY(-16px) scale(.95); }

/* ---------- Bảng nhập (dialog) ---------- */
.sheet {
  width: 100%; max-width: 560px; max-height: 94dvh; margin: auto auto 0; padding: 0; border: 0;
  border-radius: 30px 30px 0 0; background: var(--bg); color: var(--ink); overflow: auto; overscroll-behavior: contain; box-shadow: var(--shadow-3);
}
/* Thanh kéo nhỏ trên đầu bảng nhập. */
.sheet form::before { content: ""; justify-self: center; width: 38px; height: 4px; margin-bottom: 2px; border-radius: 99px; background: var(--rule-2); }
@media (min-width: 640px) { .sheet { margin: auto; border-radius: 26px; max-height: 88dvh; } .sheet form::before { display: none; } }
.sheet::backdrop { background: rgba(10, 27, 19, .44); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.sheet[open] { animation: sheet-in .24s var(--ease); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.sheet form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 10px 20px calc(20px + var(--safe-b)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.04em; }
.sheet-head .icon-btn { width: 38px; height: 38px; border: 1px solid var(--rule-2); background: var(--bg-2); color: var(--ink); }
.sheet-actions { display: flex; gap: 8px; margin-top: 4px; }
.sheet-actions .primary { flex: 1; }
.amount { display: flex; align-items: baseline; gap: 6px; padding: 14px 4px 10px; border-bottom: 2px solid var(--zera); }
.amount input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; text-align: center; font: 800 37px/1.2 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -0.05em; }
.amount .cur { font-size: 18px; font-weight: 700; color: var(--ink-3); }
.hint { min-height: 1em; font-size: 13px; color: var(--ink-2); }
.hint:empty { display: none; }
.error { color: var(--danger); font-size: 14px; font-weight: 500; }
.error:empty { display: none; }
.field { display: grid; gap: 5px; min-width: 0; }
.field .label { font-size: 11px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }
.field input, .field select { width: 100%; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.grid2:has(> [hidden]) { grid-template-columns: minmax(0, 1fr); }
/* Danh mục hay dùng: hàng icon tròn cuộn ngang. */
.cat-grid { display: flex; gap: 4px; overflow-x: auto; scroll-snap-type: x proximity; margin-inline: -4px; padding: 2px 4px 4px; scrollbar-width: none; }
.cat-grid::-webkit-scrollbar { display: none; }
.cat { flex: 0 0 74px; scroll-snap-align: start; display: grid; justify-items: center; gap: 5px; padding: 6px 2px; border: 0; border-radius: 14px; background: none;
  font-size: 11.5px; font-weight: 700; line-height: 1.25; cursor: pointer; text-align: center; min-width: 0; color: var(--ink-2); }
.cat .ic.e, .cat > .e { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; font-size: 20px; transition: box-shadow .15s, transform .15s var(--ease); }
.cat > .e { background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--rule-2); }
.cat:active .e { transform: scale(.94); }
.cat .n { width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cat.on { color: var(--zera-ink); font-weight: 650; }
.cat.on .e { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--zera); }
.cat.more { color: var(--ink-2); }
.cat-all { display: grid; border: 1px solid var(--rule-2); border-radius: 16px; overflow: hidden; }
.cat-all button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; background: var(--bg-2); text-align: left; cursor: pointer; font-size: 14px; font-weight: 600; }
.cat-all button + button { border-top: 1px solid var(--rule); }
.cat-all button.child { padding-left: 34px; }
.cat-all button.on { background: var(--zera-soft); color: var(--zera-ink); font-weight: 600; }
.name-row { display: flex; align-items: flex-end; gap: 10px; }
.grow { flex: 1; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; max-height: 176px; overflow-y: auto; padding: 2px; }
.icon-grid button { display: grid; place-items: center; height: 40px; border: 0; border-radius: 10px; background: none; cursor: pointer; }
.icon-grid button .ic.sm { width: 32px; height: 32px; }
.icon-grid button:hover { background: var(--surface); }
.icon-grid button.on { outline: 2px solid var(--zera); outline-offset: -2px; }

/* Bàn phím số riêng của bảng thêm giao dịch: chỉ trên điện thoại cảm ứng. */
.keypad { display: none; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.keypad button { height: 46px; border: 0; border-radius: 12px; background: var(--surface); font-size: 17px; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums;
  transition: background-color .12s, transform .12s var(--ease); }
.keypad button:active { background: light-dark(#dce8df, var(--surface-2)); transform: scale(.96); }
.keypad [data-key="k"], .keypad [data-key="tr"], .keypad [data-key="back"], .keypad [data-key="clear"] { color: var(--zera-ink); font-size: 18px; }
.keypad .wide { grid-column: span 2; }
.keypad svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
@media (pointer: coarse) and (max-width: 1023px) {
  .keypad { display: grid; }
  .amount input { caret-color: var(--zera); }
}
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--zera-solid); }

/* ---------- Thông báo ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); z-index: var(--z-toast); transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); padding: 10px 10px 10px 16px; border-radius: 15px;
  background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px oklch(0 0 0 / .25);
  animation: toast-in .2s var(--ease);
}
@keyframes toast-in { from { transform: translate(-50%, 8px); opacity: 0; } }
.toast button { border: 0; background: none; color: light-dark(oklch(0.85 0.11 148), oklch(0.4 0.08 158)); font-weight: 700; cursor: pointer; padding: 6px 8px; }
.toast button:empty { display: none; }

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

/* ---------- Bố cục hai cột: phần chung ---------- */
.col-main, .col-side { display: grid; gap: 14px; align-content: start; min-width: 0; }
#txAside, .desk, .tx-col, .w-flow { display: none; }
.panel-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.link-sm { font-size: 13.5px; font-weight: 600; text-decoration: none; }
.link-sm:hover { text-decoration: underline; text-underline-offset: 3px; }
.abars li + li { margin-top: 2px; }
.abars button { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: 9px; background: none; text-align: left; cursor: pointer; }
.abars button:hover { background: var(--surface); }
.abars button.on { background: var(--zera-soft); color: var(--zera-ink); }
.ab-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; }
.ab-amt { font-weight: 600; font-size: 14.5px; }
.ab-bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.ab-bar i { display: block; height: 100%; border-radius: inherit; background: var(--out); }
.txs.flat .pad { padding: 12px 14px; }

/* ---------- Máy tính (≥ 1024 px): thanh bên + nội dung rộng ---------- */
@media (min-width: 1024px) {
  :root { --side: 224px; }
  body { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
  main { grid-column: 2; width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 32px 48px; }

  .tabbar {
    grid-column: 1; grid-row: 1; position: sticky; top: 0; align-self: start;
    display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    max-width: none; height: auto; margin: 0; padding: 20px 14px; bottom: auto;
    border: 0; border-right: 1px solid var(--rule); border-radius: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    min-height: 100dvh;
  }
  .tabbar a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 13px; font-size: 14px; color: var(--ink-2); }
  .tabbar a:hover { background: var(--surface); color: var(--ink); }
  .tabbar a[aria-current="page"] { background: var(--bg-2); color: var(--zera-ink); box-shadow: var(--shadow); }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar .add { order: -1; justify-self: auto; display: flex; gap: 8px; width: 100%; height: 48px; margin-bottom: 14px; border: 0; border-radius: 15px; transform: none;
    font-weight: 800; font-size: 14px; }
  .tabbar .add:active { transform: scale(.98); }
  .tabbar .add svg { width: 20px; height: 20px; }
  .tabbar .add span { display: inline; }
  .toast { bottom: 24px; left: calc(50% + var(--side) / 2); }

  .view:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
  .view.narrow:not([hidden]) { grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 760px; margin-inline: auto; }
  #txAside, .desk { display: grid; }
  #txAside { gap: 14px; position: sticky; top: 16px; }
  .monthbar .month-title { margin-right: 12px; font-size: 26px; }
  .monthbar { padding-top: 0; }

  /* Danh sách giao dịch thành bảng: tên · ghi chú · ví · giờ · số tiền */
  .tx-main { display: grid; grid-template-columns: 42px minmax(150px, 1.1fr) minmax(0, 1.4fr) minmax(0, 1fr) 46px minmax(110px, auto); gap: 14px; padding: 10px 18px; }
  .tx-text small { display: none; }
  .tx-col { display: block; min-width: 0; font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tx-time { color: var(--ink-3); text-align: right; }
  .amt { text-align: right; }
  .day-head { padding-inline: 4px; }
  .tx-del { display: none; } /* máy tính xoá trong bảng sửa */

  /* Báo cáo: tháng + khoảng thời gian; danh mục bên trái; cột 12 tháng + khoản lớn nhất bên phải; bảng danh mục × tháng dưới cùng */
  #view-report:not([hidden]) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "month per" "sum sum" "cats bars" "cats top" "mat mat"; grid-template-rows: auto auto auto 1fr auto; }
  #view-report > .monthbar { grid-area: month; }
  .rep-period { grid-area: per; align-self: center; justify-self: end; width: 380px; margin-top: 0; }
  #view-report > .summary { grid-area: sum; }
  .rep-mat { grid-area: mat; }
  .mat th:first-child { max-width: 240px; }
  .rep-cats { grid-area: cats; }
  .rep-bars { grid-area: bars; }
  .rep-top { grid-area: top; }
  .rep-top .txs { border-radius: 0; box-shadow: none; }
  .rep-top .txs::after { display: none; }
  .rep-top .tx + .tx::before { left: 50px; right: 0; }
  .rep-top .tx-main { grid-template-columns: 42px minmax(0, 1fr) auto; padding-inline: 0; }
  .rep-top .tx-note, .rep-top .tx-wal, .rep-top .tx-time { display: none; }
  .rep-top .tx-text small { display: block; }
  .donut svg { width: 240px; }
  .summary dd { font-size: min(20px, 4cqi); }
  .summary > div { padding: 14px 18px; }

  /* Ví: tổng tài sản + danh sách rộng, có cột tiền vào/ra tháng này */
  .worth { padding: 26px 28px; }
  .worth-value { font-size: 34px; }
  .w-flow { display: flex; gap: 14px; font-size: 14px; white-space: nowrap; }
  #wList .row-main, .hidden-group .row-main { gap: 16px; }
  #wList .amt, .hidden-group .amt { min-width: 140px; text-align: right; }

  .list-head { margin-top: 0; }
}

/* Máy tính màn nhỏ (1024–1279 px): bỏ cột phải màn Giao dịch, nhường chỗ cho bảng. */
@media (min-width: 1024px) and (max-width: 1279px) {
  #view-tx:not([hidden]) { grid-template-columns: minmax(0, 1fr); }
  #txAside { display: none; }
  .tx-main { grid-template-columns: 42px minmax(140px, 1fr) minmax(0, 1.2fr) minmax(0, 0.9fr) 46px minmax(100px, auto); }
}
