/* B7B – Tiền Biết Nói · nền connector · Công nợ SIM
   Token màu/phông lấy theo demo UX08 (demo08/tbn-ux-unified-phone.html). Không tải asset từ Internet. */

@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/BeVietnamPro-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/BeVietnamPro-SemiBold.ttf") format("truetype");
}

:root {
  color-scheme: light;
  --bg: #f2f6f3;
  --paper: #ffffff;
  --ink: #173b30;
  --muted: #587064;
  --line: #dce7df;
  --soft: #e9f4ec;
  --green: #196b4e;
  --good-bg: #e7f3eb;
  --red: #a13e43;
  --red-bg: #faeceb;
  --amber: #8c621b;
  --amber-bg: #fcf3de;
  --info: #305b8b;
  --info-bg: #eaf0fb;
  --action: #17664c;
  --action-text: #ffffff;
  --focus: #305b8b;
  --shadow: 0 10px 40px rgba(23, 59, 48, .18);
  --nav-h: 64px;
}
/* Giao diện: không đặt data-theme = theo máy (sáng/tối); "light" = sáng thường; "contrast" = sáng tương phản cao; "dark" = tối. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #14221f;
    --paper: #1d302a;
    --ink: #e4f4eb;
    --muted: #b2c8bb;
    --line: #3c5749;
    --soft: #284536;
    --green: #96e2b7;
    --good-bg: #234530;
    --red: #ffb4b8;
    --red-bg: #4a2b30;
    --amber: #f3d391;
    --amber-bg: #44391f;
    --info: #afccf8;
    --info-bg: #263853;
    --action: #9ae0b8;
    --action-text: #173a2a;
    --focus: #afccf8;
    --shadow: 0 10px 40px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14221f;
  --paper: #1d302a;
  --ink: #e4f4eb;
  --muted: #b2c8bb;
  --line: #3c5749;
  --soft: #284536;
  --green: #96e2b7;
  --good-bg: #234530;
  --red: #ffb4b8;
  --red-bg: #4a2b30;
  --amber: #f3d391;
  --amber-bg: #44391f;
  --info: #afccf8;
  --info-bg: #263853;
  --action: #9ae0b8;
  --action-text: #173a2a;
  --focus: #afccf8;
  --shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
:root[data-theme="light"] { color-scheme: light; }
/* Sáng tương phản: chữ/nền ≥ 7:1 (đã đo), viền rõ, chữ đậm hơn — cho ngoài nắng, mắt yếu. */
:root[data-theme="contrast"] {
  color-scheme: light;
  --bg: #ffffff;
  --paper: #ffffff;
  --ink: #0b1f17;
  --muted: #2f4a3d;
  --line: #5b7467;
  --soft: #e8f3ec;
  --green: #0a5236;
  --good-bg: #d5ecdc;
  --red: #8a1c22;
  --red-bg: #fde3e2;
  --amber: #6b4700;
  --amber-bg: #fff0c2;
  --info: #153f78;
  --info-bg: #dbe8fb;
  --action: #0a5236;
  --action-text: #ffffff;
  --focus: #0033cc;
  --shadow: 0 6px 24px rgba(0, 0, 0, .28);
}
:root[data-theme="contrast"] body { font-weight: 500; }
:root[data-theme="contrast"] .paper, :root[data-theme="contrast"] .metric, :root[data-theme="contrast"] .btn, :root[data-theme="contrast"] .chip { border-width: 1.5px; }
:root[data-theme="contrast"] a { text-decoration: underline; text-underline-offset: 2px; }
:root[data-theme="contrast"] .nav a { text-decoration: none; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 25px; letter-spacing: -.8px; }
h3 { font-size: 16px; }
p { margin: 8px 0; }
.boot-msg { padding: 24px 16px; color: var(--muted); text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.sim { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; color: var(--muted); }

/* ---------- Nút, trường ---------- */
.btn {
  min-height: 44px; min-width: 44px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  padding: 10px 14px; border-radius: 11px; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary { background: var(--action); color: var(--action-text); border-color: var(--action); font-weight: 600; }
.btn.danger { background: var(--red-bg); color: var(--red); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions .btn { flex: 1 1 auto; }

.field { display: block; font-size: 13px; color: var(--muted); margin-top: 12px; }
.field > span.label { display: block; }
.field input, .field select, .field textarea {
  display: block; width: 100%; margin-top: 5px; min-height: 44px; padding: 10px 11px;
  color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px;
}
.field textarea { min-height: 88px; resize: vertical; }
.field .hint { display: block; font-size: 12px; margin-top: 4px; color: var(--muted); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--red); }
.field-error { color: var(--red); font-size: 12px; margin-top: 4px; display: block; }

/* ---------- Ghi chú/thông báo màu: luôn kèm chữ ---------- */
.note { padding: 12px 14px; border-radius: 13px; font-size: 13px; margin-top: 12px; background: var(--info-bg); color: var(--info); overflow-wrap: anywhere; }
.note.warn { background: var(--amber-bg); color: var(--amber); }
.note.bad { background: var(--red-bg); color: var(--red); }
.note.good { background: var(--good-bg); color: var(--green); }
.note strong { font-weight: 600; }
.note .actions { margin-top: 10px; }

.chip { font-size: 12px; line-height: 1.3; border-radius: 7px; padding: 3px 8px; display: inline-block; background: var(--soft); color: var(--green); white-space: nowrap; font-weight: 600; }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.green { background: var(--good-bg); color: var(--green); }
.chip.blue { background: var(--info-bg); color: var(--info); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

.paper { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 11px 0; min-width: 0; }
.row + .row { border-top: 1px solid var(--line); }
.row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.row > .money, .row > .val { text-align: right; flex-shrink: 0; }
.row > .val { max-width: 60%; overflow-wrap: anywhere; }

/* ---------- Đăng nhập ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 24px 20px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-brand img { width: 48px; height: 48px; border-radius: 12px; }
.auth-brand strong { display: block; font-size: 18px; letter-spacing: -.4px; }
.auth-brand small { display: block; color: var(--muted); font-size: 12px; }
.auth-card form .btn.primary { width: 100%; margin-top: 18px; }

/* ---------- Khung app ---------- */
.app-head {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 38px; height: 38px; object-fit: contain; flex-shrink: 0; border-radius: 9px; }
.brand strong { font-weight: 600; letter-spacing: -.5px; font-size: 17px; display: block; white-space: nowrap; }
.brand small { display: block; color: var(--muted); font-size: 11px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-text { text-align: right; font-size: 13px; line-height: 1.3; min-width: 0; }
.who-text strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; }

.shell { display: grid; grid-template-columns: 180px minmax(0, 1fr); min-height: calc(100vh - 67px); }
.nav { padding: 20px 12px; background: var(--paper); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.nav a {
  min-height: 48px; border-radius: 12px; color: var(--muted); padding: 11px 12px; text-decoration: none;
  display: flex; align-items: center; gap: 8px; font-size: 14px;
}
.nav a[aria-current="page"] { background: var(--soft); color: var(--green); font-weight: 600; }
.nav svg { width: 20px; height: 20px; flex-shrink: 0; }
.main { padding: 24px; min-width: 0; max-width: 1100px; }
.foot { padding: 14px 24px; font-size: 11px; color: var(--muted); text-align: center; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* ---------- Công nợ SIM ---------- */
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 4px 0 14px; }
.filter {
  min-width: 0; min-height: 64px; padding: 8px 10px; text-align: left;
  border: 1px solid var(--line); border-radius: 13px; background: var(--paper); color: var(--ink);
}
.filter small { display: block; font-size: 12px; }
.filter strong { display: block; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.filter[data-filter="unpaid"] { color: var(--red); background: var(--red-bg); }
.filter[data-filter="partial"] { color: var(--amber); background: var(--amber-bg); }
.filter[data-filter="paid"] { color: var(--green); background: var(--good-bg); }
.filter[data-filter="needs_review"] { color: var(--amber); background: var(--paper); border-color: var(--amber); }
.filter[aria-pressed="true"] { outline: 3px solid currentColor; outline-offset: 1px; }
.filter[aria-pressed="true"] small::after { content: " · đang chọn"; }

.search { margin: 0 0 12px; }
.search input { font-variant-numeric: tabular-nums; }

.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.metric { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); min-width: 0; }
.metric > span { display: block; font-size: 12px; }
.metric > strong { display: block; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 4px; overflow-wrap: anywhere; }
.tone-green { background: var(--good-bg); color: var(--green); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-blue { background: var(--info-bg); color: var(--info); }
.summary-scope { font-size: 12px; color: var(--muted); margin: -4px 0 12px; }

.pending { margin-bottom: 12px; }
.pending.tone-amber-border { border-color: var(--amber); }
.pending h3 { font-size: 15px; }
.pending-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.pending-item { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.pending-main { min-width: 0; }
.pending-main small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.pending-main .money { color: var(--amber); }
.pending-item .btn { flex-shrink: 0; }
@media (max-width: 420px) {
  .pending-item { flex-direction: column; align-items: stretch; }
}
.list-state { padding: 22px 12px; text-align: center; color: var(--muted); }
.list-state .btn { margin-top: 10px; }

.sim-table { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 0 14px; }
.sim-head, .sim-row {
  display: grid;
  grid-template-columns: 96px minmax(118px, 1fr) minmax(150px, 1.3fr) minmax(110px, 1fr) minmax(120px, 1fr) 104px;
  gap: 10px; align-items: center;
}
.sim-head { font-size: 12px; color: var(--muted); padding: 12px 0; }
.sim-row {
  width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink);
  text-align: left; padding: 12px 0; min-height: 56px; font-size: 13px;
}
.sim-row:hover { background: var(--soft); }
.sim-row .c-date, .sim-row .c-agent, .sim-row .c-source, .sim-row .c-paid { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; min-width: 0; }
.sim-row .c-sim { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 15px; }
.sim-row .c-amount { min-width: 0; }
.sim-row .c-amount .money { font-size: 15px; display: block; }
.sim-row .c-amount small { display: block; font-size: 12px; color: var(--muted); }
.sim-row .chips { margin-top: 4px; }
.sim-row .src-rev { display: block; }
.c-paid .lbl-phone, .c-agent .lbl-phone { display: none; }
.more-wrap { padding: 12px 0; text-align: center; border-top: 1px solid var(--line); }

/* ---------- Ngăn chi tiết / form ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 25, 20, .45); z-index: 30; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); z-index: 31;
  background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.sheet.form-sheet { z-index: 41; }
.overlay.form-overlay { z-index: 40; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px 10px 18px; background: var(--info-bg); color: var(--info); border-bottom: 1px solid var(--line);
}
.sheet-head h3 { font-size: 17px; outline: none; }
.sheet-body { padding: 16px 18px 28px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet-section { margin-top: 18px; }
.sheet-section > h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.note-item { padding: 10px 0; border-top: 1px solid var(--line); }
.note-item:first-child { border-top: 0; }
.note-item .meta { font-size: 12px; color: var(--muted); }
.note-item .body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.rev-item { padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.rev-item:first-child { border-top: 0; }
.rev-item .rev-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.rev-item .rev-fields { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.char-count { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }

.alloc-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; align-items: end; padding: 10px 0; border-top: 1px solid var(--line); }
.alloc-line:first-child { border-top: 0; }
.alloc-line .who-sim { min-width: 0; font-size: 13px; padding-bottom: 6px; }
.alloc-line .field { margin-top: 0; }
.picker-results { margin-top: 6px; }
.picker-item {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  min-height: 48px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); margin-top: 6px; text-align: left;
}
.picker-item small { display: block; color: var(--muted); font-size: 12px; }
.calc { margin-top: 12px; }

/* ---------- N1 Tiền gia đình (family.js) ---------- */
.tone-text-green { color: var(--green); }
.tone-text-red { color: var(--red); }
.tone-text-blue { color: var(--info); }
.month-field { max-width: 260px; margin-top: 0; margin-bottom: 12px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.crumb a { color: var(--info); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.check input { width: 22px; height: 22px; flex-shrink: 0; margin: 0; accent-color: var(--action); }

.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.home-card { padding: 14px; border: 1px solid var(--line); border-radius: 15px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hc-label { font-size: 13px; }
.hc-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow-wrap: normal; }
/* Giá trị là chữ (vd. "Chưa có kế hoạch"): nhỏ hơn số tiền, được xuống dòng, không tràn thẻ */
.hc-value.is-text { font-size: 16px; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; }
.hc-sub { font-size: 12px; opacity: .92; }
.home-card .hc-toggle { margin-top: 6px; align-self: flex-start; padding: 8px 0; color: inherit; text-decoration: underline; font-size: 13px; }
#home-net { margin: 8px 2px 0; }
.home-sim {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px;
  padding: 14px; border: 1px solid var(--line); border-radius: 15px; text-decoration: none; min-height: 44px;
}
.home-sim > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home-sim-go { font-weight: 600; white-space: nowrap; }
.wallet-line { padding: 4px 0 10px; }
.wallet-line + .wallet-line { border-top: 1px solid var(--line); }
.wallet-line .btn { padding: 8px 12px; font-size: 13px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.seg-btn {
  min-height: 44px; padding: 8px 14px; border-radius: 22px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-size: 14px; white-space: nowrap;
}
.seg-btn[aria-pressed="true"] { background: var(--soft); color: var(--green); border-color: var(--green); font-weight: 600; }
.seg-btn[aria-pressed="true"]::before { content: "✓ "; }
.seg-btn.seg-income[aria-pressed="true"] { background: var(--good-bg); color: var(--green); border-color: var(--green); }
.seg-btn.seg-expense[aria-pressed="true"] { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.seg-btn.seg-transfer[aria-pressed="true"] { background: var(--info-bg); color: var(--info); border-color: var(--info); }

.ledger-filters { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 320px); gap: 0 10px; }
.ledger-filters .field { margin-top: 0; }
.ledger-summary { margin-top: 8px; }
.ledger-summary .metric small { display: block; font-size: 11px; margin-top: 2px; }
.entry-days { display: flex; flex-direction: column; gap: 12px; }
.day-head { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px 2px; }
.entry-list { padding: 0 12px; }
.entry-row {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 11px 0; min-height: 56px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left;
}
.entry-row:first-child { border-top: 0; }
.entry-row:hover { background: var(--soft); }
.e-main { display: flex; flex-direction: column; min-width: 0; }
.e-title { font-weight: 600; overflow-wrap: anywhere; }
.e-sub, .e-note, .e-date { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.e-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.e-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.e-amt { font-size: 15px; }
.entry-row.voided .e-amt { text-decoration: line-through; opacity: .75; }

.more-list { padding: 0 12px; }
.more-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  min-height: 52px; padding: 10px 0; border: 0; border-top: 1px solid var(--line); background: transparent;
  color: var(--ink); text-decoration: none; text-align: left; font-size: 15px;
}
.more-item:first-child { border-top: 0; }
.more-item > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.more-item small { font-size: 12px; color: var(--muted); }
.more-item.not-yet { color: var(--muted); }
.more-sub { margin: 18px 0 8px; font-size: 14px; color: var(--muted); }

.set-row { padding: 6px 0 10px; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row .row { padding-bottom: 4px; }
.set-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.set-actions .btn { padding: 8px 12px; font-size: 13px; }
.cat-head { margin: 14px 0 6px; font-size: 14px; font-weight: 600; }
.add-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 12px; }
.add-row .field { margin-top: 0; flex: 1 1 180px; min-width: 0; }
.rev-hidden .rev-fields { font-style: italic; }
.rename { padding: 8px 0; }
.rename input {
  width: 100%; min-height: 44px; padding: 10px 11px; font-size: 16px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
}
.rename-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }
@media (max-width: 600px) {
  .ledger-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  /* Điện thoại: một cột, mỗi thẻ gọn — nhãn trái, giá trị phải; dòng phụ ở dưới */
  .home-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .home-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px; align-items: baseline; padding: 12px; }
  .home-card > .hc-label { grid-column: 1; grid-row: 1; min-width: 0; }
  .home-card > .hc-value { grid-column: 2; grid-row: 1; text-align: right; font-size: 20px; }
  .home-card > .hc-value.is-text { font-size: 15px; max-width: 11em; }
  .home-card > .hc-sub, .home-card > .hc-toggle { grid-column: 1 / -1; }
  .ledger-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .month-field { max-width: none; }
}
@media (max-width: 380px) {
  .ledger-filters { grid-template-columns: minmax(0, 1fr); }
}
/* ---------- N2 Kế hoạch (plans.js) ---------- */
.bell { position: relative; padding: 8px 10px; }
.bell svg { width: 20px; height: 20px; }
.bell-badge {
  position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: var(--paper); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}
/* UX-V-03: tab Kế hoạch XUỐNG DÒNG thay vì cuộn ngang ẩn thanh (tab "Nhắc" từng bị khuất ở 360/390). */
.plan-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; overflow: visible; margin: 0 0 12px; padding: 2px 0 6px;
}
.plan-tab {
  flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-decoration: none; font-size: 14px; white-space: nowrap;
}
.plan-tab[aria-current="page"] { background: var(--soft); color: var(--green); border-color: var(--green); font-weight: 600; }
.plan-tab[aria-current="page"]::before { content: "✓ "; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 10px; }
.linklike { border: 0; background: transparent; padding: 0; min-height: 44px; color: var(--info); font-weight: 600; text-decoration: underline; text-align: left; font-size: 15px; }
.budget-row { padding: 8px 0 12px; }
.budget-row + .budget-row { border-top: 1px solid var(--line); }
.budget-row .row { padding: 0; align-items: center; }
.budget-bar { display: block; width: 100%; height: 10px; margin: 6px 0; accent-color: var(--green); }
.budget-bar.near { accent-color: var(--amber); }
.budget-bar.over { accent-color: var(--red); }
.budget-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.budget-foot .btn { padding: 8px 12px; font-size: 13px; }
.money.is-text, .e-amt.is-text { font-size: 13px; font-weight: 600; white-space: normal; color: var(--amber); }
.occ-row .chips { justify-content: flex-end; }
.set-row.unread { box-shadow: inset 3px 0 0 var(--info); padding-left: 8px; }
.fund-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 10px; }
.fund-card .row:first-child { padding-top: 0; }
.cf-days { padding: 0 12px; }
.cf-row { display: grid; grid-template-columns: minmax(84px, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; align-items: baseline; padding: 8px 0; font-size: 13px; }
.cf-row > .money { text-align: right; overflow: hidden; text-overflow: ellipsis; }
.cf-head { font-size: 12px; color: var(--muted); }
.cf-head > span:not(:first-child) { text-align: right; }
.cf-day { border-top: 1px solid var(--line); }
.cf-day[data-negative="true"] { background: var(--red-bg); }
.cf-items { margin: 0 0 8px; padding-left: 18px; font-size: 12px; color: var(--muted); }
.cf-neg { font-weight: 600; }
.is-text-strong { white-space: normal; }
.attention-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 10px 0; min-height: 52px;
  border-top: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.attention-row:first-child { border-top: 0; }
#home-formula ul, #cf-assumptions ul { margin: 6px 0 0; padding-left: 18px; }
#home-formula .btn { margin-top: 8px; }
@media (max-width: 600px) {
  .cf-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 8px; }
  .cf-head { display: none; }
  .cf-row .cf-date { grid-column: 1; font-weight: 600; }
  .cf-row > .money:last-child { grid-column: 2; grid-row: 1; font-weight: 600; }
  .attention-row { grid-template-columns: minmax(0, 1fr); }
  .attention-row .chips { justify-content: flex-start; }
}
/* ---------- N3 Thẻ & khoản vay, Lương cửa hàng (debts.js, payroll.js) ---------- */
.nowrap { white-space: nowrap; }
.money.strike { text-decoration: line-through; opacity: .7; }
#debt-tabs { margin-bottom: 10px; }
#debt-back { margin-bottom: 8px; padding-left: 0; }
#debt-total, #debt-balance { margin: 4px 0 12px; }
#debt-total small, #debt-balance small { display: block; font-size: 12px; margin-top: 4px; }
.debt-row .e-title { display: flex; flex-wrap: wrap; gap: 4px 8px; }
/* N3 sửa 1/1: màn hẹp — tiêu đề thẻ + chip "Thiếu điều khoản…" xuống dòng thay vì nới khung trang (đo ở 360/390 thấy layout 401–553px). */
@media (max-width: 600px) {
  #debts-page .page-head > div { flex-wrap: wrap; }
  #debts-page .chip { white-space: normal; overflow-wrap: anywhere; }
}
.stmt-version { padding: 2px 0; }
.stmt-version.old { opacity: .85; }
.stmt-version + .stmt-version { border-top: 1px dashed var(--line); }
.sim-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 10px; margin-top: 12px; }
.sim-card h4 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.sim-card ul { margin: 4px 0 0; padding-left: 18px; }
.sched-wrap { overflow-x: auto; margin-top: 10px; -webkit-overflow-scrolling: touch; max-width: 100%; }
.sched { border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
.sched th, .sched td { padding: 6px 6px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.sched th:first-child, .sched td:first-child, .sched th:nth-child(2), .sched td:nth-child(2) { text-align: left; }
.sched thead th { color: var(--muted); font-weight: 600; border-top: 0; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 0 14px; }
.pay-grid .row { padding: 6px 0; }
.pay-grid .row + .row { border-top: 0; }
.payroll-line { padding: 8px 0 12px; }
#payroll-excel { min-height: 44px; padding: 0; border-top: 0; flex: 0 1 auto; gap: 8px; }
#payroll-period > .row { padding-top: 0; }
/* Ảnh chứng từ (người dùng tải lên) */
.alloc-item + .alloc-item { border-top: 1px solid var(--line); }
.alloc-item .row { padding-bottom: 6px; }
.att-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 0 0 12px; }
.att-count { font-size: 12px; color: var(--info); min-width: 0; overflow-wrap: anywhere; }
.att-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.att-actions .btn { padding: 8px 12px; font-size: 13px; }
.img-box { margin-top: 4px; }
.field input[type="file"] { padding: 8px; font-size: 16px; cursor: pointer; }
.img-preview-wrap { margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.img-preview { display: block; max-width: 100%; max-height: 260px; margin: 0 auto; object-fit: contain; border-radius: 8px; }
.img-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; margin-top: 8px; }
.overlay.viewer-overlay { z-index: 50; }
.sheet.viewer-sheet { z-index: 51; }
.att-figure { margin: 12px 0 0; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.att-img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; border-radius: 8px; }
.att-figure figcaption { margin-top: 6px; overflow-wrap: anywhere; }
.att-status { margin: 0 0 6px; }
.att-status .btn { margin-left: 8px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 60;
  max-width: min(520px, calc(100% - 32px)); padding: 12px 16px; border-radius: 12px;
  background: var(--good-bg); color: var(--green); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14px;
}
.toast.bad { background: var(--red-bg); color: var(--red); }
.net-banner { padding: 10px 16px; background: var(--red-bg); color: var(--red); font-size: 13px; text-align: center; }

.placeholder { max-width: 560px; }

/* ---------- Điện thoại (một cột) ---------- */
@media (max-width: 720px) {
  .app-head { padding: 10px 14px; }
  .brand strong { font-size: 15px; }
  .brand > div { min-width: 0; }
  .brand small { display: none; }
  .brand img { width: 32px; height: 32px; }
  .who-text small { font-size: 11px; }
  .app-head { flex-wrap: wrap; row-gap: 6px; }
  .brand { flex: 1 1 auto; order: 1; }
  .who { display: contents; }
  .who .btn { order: 2; padding: 8px 12px; font-size: 13px; white-space: nowrap; }
  .who-text { order: 3; flex: 1 0 100%; text-align: left; display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; padding-top: 6px; border-top: 1px solid var(--line); }
  .who-text strong::before { content: "Đang xem: "; font-weight: 400; color: var(--muted); }
  .who-text small { white-space: normal; }
  .shell { display: block; min-height: 0; }
  .main { padding: 16px 16px calc(var(--nav-h) + 24px); }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--nav-h);
    flex-direction: row; justify-content: space-between; gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
  }
  .nav a { flex: 1; min-width: 0; flex-direction: column; gap: 2px; justify-content: center; padding: 4px 1px; font-size: 11px; white-space: nowrap; text-align: center; min-height: 52px; }
  .nav svg { width: 18px; height: 18px; }
  .foot { padding-bottom: calc(var(--nav-h) + 12px); }
  .toast { bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); }
  h2 { font-size: 23px; }
  .page-head > .btn { width: 100%; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .filter[data-filter="all"] { grid-column: 1 / -1; min-height: 52px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric > strong { font-size: 16px; }
  .sheet { width: 100%; border-left: 0; }
  .row > .val { max-width: 55%; }
  .sim-table { padding: 0 12px; }
}
/* Phần chỉ dành cho màn hẹp: ẩn trên desktop để desktop giữ nguyên */
.sum-toggle, .info-phone, .pending-toggle, .pending-none { display: none; }

/* F-01: điện thoại — SIM là nội dung chính, thấy dòng SIM ngay màn đầu */
@media (max-width: 600px) {
  .main { padding-top: 12px; }
  .page-head { flex-wrap: nowrap; align-items: center; gap: 8px; margin-bottom: 10px; }
  .page-head > div { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto; }
  .page-head .crumb, .page-head .sub { display: none; }
  .page-head h2 { font-size: 21px; white-space: nowrap; }
  .page-head > .btn { width: auto; flex: 0 0 auto; padding: 8px 12px; }
  .info-phone { display: block; position: relative; }
  .info-phone > summary {
    list-style: none; cursor: pointer; width: 44px; height: 44px; display: grid; place-items: center;
    border-radius: 50%; color: var(--info);
  }
  .info-phone > summary::-webkit-details-marker { display: none; }
  .info-phone > summary span {
    width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center;
    font-size: 13px; font-weight: 600; font-style: italic; background: var(--info-bg);
  }
  .info-phone[open] > p {
    position: absolute; z-index: 15; left: -110px; top: 46px; width: min(300px, calc(100vw - 32px));
    margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--info-bg); color: var(--info);
    border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px;
  }

  /* UX-V-03: các nút lọc XUỐNG DÒNG (không cuộn ngang ẩn thanh) để mọi nút đều thấy được ngay, kể cả "Cần rà lại". */
  .filters {
    display: flex; flex-wrap: wrap; overflow: visible; gap: 6px;
    margin: 0 0 10px; padding: 3px 0 5px;
  }
  .filters .filter, .filters .filter[data-filter="all"] {
    flex: 0 1 auto; min-height: 44px; display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 22px; white-space: nowrap;
  }
  .filter small { display: inline; font-size: 13px; }
  .filter strong { display: inline; font-size: 15px; }
  .filter[aria-pressed="true"] { outline-width: 2px; }
  .filter[aria-pressed="true"] small::after { content: none; }
  .filter[aria-pressed="true"] small::before { content: "✓ "; }

  .search { margin: 0 0 8px; }
  .search > .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .search input { margin-top: 0; }
  .search .hint { display: none; }
  .search .hint.hint-warn { display: block; color: var(--amber); }

  .sum-toggle {
    display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--red-bg); color: var(--red);
    text-align: left; font-size: 14px; margin-bottom: 8px;
  }
  .sum-toggle .sum-line { min-width: 0; }
  .sum-toggle .sum-more { font-size: 12px; text-decoration: underline; flex-shrink: 0; }
  .sum-wrap.open .sum-toggle .sum-more { text-decoration: none; }
  .sum-wrap:not(.open) .summary, .sum-wrap:not(.open) .summary-scope { display: none; }
  .sum-wrap.open .summary-scope { margin: 0 0 10px; }

  .pending { padding: 4px 4px 4px 12px; margin-bottom: 8px; }
  .pending h3 { font-size: 14px; }
  .pending-head { flex-wrap: nowrap; }
  .pending-head h3 { flex: 1 1 auto; min-width: 0; }
  .pending-toggle { display: inline-flex; padding: 8px 10px; }
  .pending-none { display: inline-block; }
  .pending:not(.open) .pending-body { display: none; }
  .pending.open .pending-body { padding-right: 8px; padding-bottom: 8px; }
}
/* Danh sách dạng gọn (điện thoại + màn hẹp không đủ 6 cột) */
@media (max-width: 1040px) {
  .sim-head { display: none; }
  .sim-row { grid-template-columns: minmax(118px, 1fr) minmax(0, 1.2fr); gap: 2px 10px; padding: 12px 0; }
  .sim-row .c-date { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* F5 bổ sung: tên đại lý/CTV chiếm trọn một hàng, tên dài xuống dòng — không cắt "…" */
  .sim-row .c-agent { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: break-word; }
  .sim-row .c-status .chips { justify-content: flex-end; }
  .sim-row .c-date { grid-column: 1; grid-row: 1; }
  .sim-row .c-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .sim-row .c-sim { grid-column: 1; grid-row: 2; font-size: 17px; }
  .sim-row .c-amount { grid-column: 2; grid-row: 2; text-align: right; }
  .sim-row .c-amount .money { font-size: 16px; }
  .sim-row .c-amount .chips { display: none; }
  .sim-row .c-agent { grid-column: 1 / -1; grid-row: 3; }
  .sim-row .c-paid { grid-column: 1 / -1; grid-row: 4; text-align: right; }
  .sim-row .c-paid.empty { display: none; }
  .sim-row .c-source { display: none; }
  .c-paid .lbl-phone { display: inline; }
}
@media (min-width: 1041px) {
  .sim-row .c-status { display: none; }
}
@media (max-width: 360px) {
  .filter strong { font-size: 18px; }
  .sim-row .c-sim { font-size: 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: slide-in .16s ease-out; }
  @keyframes slide-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
/* N4 §10: gỡ phân bổ / hủy khoản thu / trang Dữ liệu */
.alloc-item.reversed .row > span:first-child { opacity: .8; }
.inline-confirm { margin: 8px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.pending-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 0; }
.imp-cols { display: grid; gap: 8px; }
.imp-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.imp-col:first-child { border-top: 0; }
.imp-col > span { min-width: 0; overflow-wrap: anywhere; }
.imp-col small { display: block; color: var(--muted); font-size: 12px; }
.imp-tally { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 8px; }
.imp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.imp-row:first-child { border-top: 0; }
.imp-row .imp-main { min-width: 0; overflow-wrap: anywhere; }
.imp-row .imp-main small { display: block; color: var(--muted); font-size: 12px; }
/* chặng B luồng 4 bổ sung: khối so số sao kê / kế hoạch sao kê / trả thừa — mỗi ý một dòng, chữ nằm trong khung */
#dimp-stmt, #dimp-plan, [data-testid="dimp-overpay"], [data-testid="dimp-over"] { overflow-wrap: anywhere; min-width: 0; }
#dimp-plan strong, #dimp-plan small, [data-testid="dimp-overpay"] strong, [data-testid="dimp-overpay"] small, [data-testid="dimp-over"] strong, [data-testid="dimp-over"] small, #dimp-stmt .row small { display: block; }
#dimp-plan small, [data-testid="dimp-overpay"] small, [data-testid="dimp-over"] small, #dimp-stmt .row small { margin-top: 4px; color: var(--muted); font-size: 12px; }
#dimp-stmt .row { align-items: flex-start; gap: 8px; padding: 8px 0; }
#dimp-stmt .row > span { min-width: 0; }
/* gói sửa gộp sau Fresh 0149d3e: khối cảnh báo trả thừa (sao kê nhập tay, nhập từ tệp, ghi khoản trả tay) — tiêu đề một dòng, giải thích dòng dưới */
#ds-overpay, #dp-overpay, #dimp-target-warn { overflow-wrap: anywhere; min-width: 0; margin: 8px 0; }
#ds-overpay strong, #dp-overpay strong, #dimp-target-warn strong, #ds-overpay small, #dp-overpay small, #dimp-target-warn small { display: block; }
#ds-overpay small, #dp-overpay small, #dimp-target-warn small { margin-top: 4px; font-size: 12px; }
#dimp-stmt .row > .chip, [data-testid="dimp-over"] .chip { flex: 0 0 auto; white-space: nowrap; }
[data-testid="dimp-over"] .chip { display: inline-block; margin: 6px 0 2px; }
.imp-row .imp-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.imp-row .imp-extra { grid-column: 1 / -1; }
.imp-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.split-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; align-items: end; padding: 6px 0; border-top: 1px dashed var(--line); }
.split-line:first-child { border-top: 0; }
/* N4: ô chọn/nhập nằm ngoài .field (cột tự nhận, nhóm theo dòng, phần tách) vẫn chạm ≈44px, chữ ≥16px */
.imp-col select, .imp-extra select, .split-line input, .split-line select {
  display: block; width: 100%; min-height: 44px; padding: 10px 11px; min-width: 0;
  color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; font-size: 16px;
}
.split-line > :nth-child(3) { grid-column: 1 / -1; margin-top: 6px; }
.split-line > .btn { grid-column: 1 / -1; margin-top: 6px; }
/* N5: bảng từng tháng (cuộn ngang trong khung, trang không kéo ngang) */
.table-wrap { overflow-x: auto; max-width: 100%; margin-top: 8px; }
.pu-table { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; min-width: 720px; }
.pu-table th, .pu-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.pu-table th:first-child, .pu-table td:first-child { text-align: left; }
.pu-table tr.below td { color: var(--red); }
#rp-limits summary, #pu-assumptions summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
/* N6: Trợ lý một cửa — thanh đầu màn + sheet nháp */
.assist-bar { margin-bottom: 16px; padding: 12px 14px; }
.assist-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.assist-title { font-size: 15px; }
.assist-mock { font-size: 12px; color: var(--muted); }
.assist-input-row { display: flex; gap: 8px; margin-top: 8px; }
.assist-input-row input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 10px 11px; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.assist-input-row .btn { flex: 0 0 auto; }
.assist-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.assist-chips .btn { flex: 1 1 auto; }
.ast-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 600px) { .ast-grid { grid-template-columns: minmax(0, 1fr); } }
.ast-pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; margin: 6px 0; padding: 8px 10px; background: var(--soft); border-radius: 10px; }
.ast-sample { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.ast-voice { display: block; width: 100%; margin-top: 8px; text-align: left; }
.ast-groups { display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: 13px; }
.ast-line { border: 1px solid var(--line); border-left-width: 4px; border-radius: 12px; padding: 10px 12px; margin-top: 10px; background: var(--paper); overflow-wrap: anywhere; }
.ast-line.ast-green { border-left-color: var(--green); }
.ast-line.ast-amber { border-left-color: var(--amber); }
.ast-line.ast-blue { border-left-color: var(--info); }
.ast-line-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ast-raw, .ast-understood { margin: 6px 0 0; font-size: 14px; }
.ast-raw .label, .ast-understood .label { font-weight: 600; color: var(--muted); }
.ast-evidence { margin: 6px 0 0; padding-left: 18px; }
.ast-question { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; margin-top: 8px; }
.ast-question input, .ast-question select, .ast-fill input, .ast-fill select, .ast-editor input, .ast-editor select { width: 100%; min-height: 44px; font-size: 16px; }
.ast-editor { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ast-limits { padding-left: 18px; margin-top: 12px; }
.ast-recent-item { display: block; width: 100%; margin-top: 6px; text-align: left; }
/* UX-B3-F1: thanh mở khối "Nhập bảng lương từ CSV" đạt vùng bấm ≥44px (cùng kiểu khối chốt kỳ SIM); khối nhập sao kê thẻ/vay dùng cùng kiểu ngay từ đầu */
#payroll-import > summary, #debt-import > summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; min-height: 44px; cursor: pointer; font-weight: 600; }
/* UX-B3-F2: dòng tóm tắt số cũ → mới trong Nhật ký — xuống dòng theo từ, không bẻ giữa chữ */
[data-testid="au-row"] > span { min-width: 0; }
/* mục có tóm tắt: nhãn việc đặt TRÊN dòng nội dung (nhãn dài không ép cột chữ thành từng từ ở 360px) */
[data-testid="au-row"]:has([data-testid="au-summary"]) { flex-direction: column-reverse; align-items: stretch; gap: 4px; }
[data-testid="au-row"]:has([data-testid="au-summary"]) > strong { text-align: left; }
[data-testid="au-summary"] { display: block; color: var(--muted); font-size: 12px; overflow-wrap: normal; word-break: normal; }
/* Chặng B luồng 2: báo cáo đối soát / chốt kỳ SIM */
.closes > summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; min-height: 44px; cursor: pointer; font-weight: 600; }
.close-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.close-main { min-width: 0; overflow-wrap: anywhere; }
.close-main small { display: block; color: var(--muted); font-size: 12px; }
.close-detail { grid-column: 1 / -1; min-width: 0; }
.close-detail .row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
/* Chặng B luồng 1: sao kê — dòng gốc, chọn loại/người hưởng */
.imp-raw { display: block; overflow-wrap: anywhere; color: var(--muted); }
.imp-extra select { width: 100%; min-height: 44px; font-size: 16px; margin-top: 6px; }
/* nhãn kết quả dài không được ép cột tên dòng (360px): cột phải tối đa 40% hàng, nhãn được xuống dòng */
.imp-row { grid-template-columns: minmax(0, 1fr) fit-content(40%); }
.imp-row .imp-side .chip { white-space: normal; text-align: right; }
/* N7: cài đặt / sao lưu / gộp nhóm */
#family-scope .row, #settings-backup-page .row, #settings-merge-page .row, #settings-audit-page .row, #settings-session-page .row, #settings-assistant-page .row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
#family-scope .row:first-child, #settings-backup-page .paper > .row:first-child, #settings-audit-page .row:first-child { border-top: 0; }
.fs-val { text-align: right; min-width: 0; }
.bk-row, .mg-row { padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.bk-row:first-child, .mg-row:first-child { border-top: 0; }
#settings-backup-page input, #settings-merge-page input, #settings-merge-page select, #settings-assistant-page input { width: 100%; min-height: 44px; font-size: 16px; }

/* ảnh chứng từ (OCR tại máy) trong trợ lý */
.ast-ocr-item { margin: 10px 0; overflow-wrap: anywhere; min-width: 0; }
.ast-thumb { display: block; max-width: 100%; max-height: 220px; width: auto; height: auto; border-radius: 10px; margin: 8px 0; border: 1px solid var(--line); object-fit: contain; }
.ast-ocr-text > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.conv-warn { display: block; margin-top: 4px; }
[data-testid="conv-panel"] small, [data-testid="conv-panel"] strong { display: block; margin-top: 4px; }
[data-testid="conv-panel"] { overflow-wrap: anywhere; min-width: 0; margin: 8px 0; }

#fund-stop-choices small, #fund-stop-choices strong { display: block; }
#fund-stop-choices .check { align-items: flex-start; margin: 8px 0; }

[data-testid="rp-refund-box"] strong, [data-testid="rp-refund-box"] small { display: block; margin-top: 4px; }
[data-testid="rp-refund-box"] { overflow-wrap: anywhere; min-width: 0; margin: 8px 0; }

/* Nhắc khi đóng app: danh sách thiết bị có nút Gỡ (Cài đặt › Trợ lý) */
.push-devices { list-style: none; margin: .5rem 0; padding: 0; display: grid; gap: .5rem; }
.push-device { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; justify-content: space-between; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.push-device .push-device-label { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Thành viên (Owner): mật khẩu tạm hiện một lần ---------- */
.pw-reveal { font-family: ui-monospace, Consolas, monospace; font-size: 16px; letter-spacing: 0.04em; user-select: all; word-break: break-all; text-align: right; color: var(--ink); }
.mb-row + .mb-row { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.pw-label { flex: 0 0 auto; white-space: nowrap; }
.pw-reveal { flex: 1 1 auto; min-width: 0; }

/* ---- Tổng quan SIM, bảng hạn trả thẻ & vay, chọn giao diện */
.sim-overview { margin: 8px 0 14px; }
.sim-overview h3, .due-board h3 { margin: 0 0 8px; font-size: 15px; }
.ov-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.metric > small { display: block; font-size: 11px; margin-top: 2px; overflow-wrap: anywhere; }
.due-board { margin: 12px 0; padding: 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--paper); }
.due-board.tone-red { border-color: var(--red); background: var(--red-bg); color: var(--ink); }
.due-board.tone-amber { border-color: var(--amber); background: var(--amber-bg); color: var(--ink); }
.due-board.tone-green { border-color: var(--green); background: var(--good-bg); color: var(--ink); }
.due-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.due-item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.due-item .chip { font-weight: 700; }
.due-name { font-size: 15px; }
.due-meta { font-size: 13px; color: var(--muted); }
.theme-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 8px; margin-top: 8px; }
.theme-opt { min-height: 48px; text-align: left; }
.theme-opt[aria-pressed="true"] { border: 2px solid var(--action); background: var(--soft); font-weight: 700; }
.theme-opt small { display: block; font-weight: 400; color: var(--muted); }


/* ====================================================================================================
   UX/UI HỢP NHẤT 12/11/2026 (bảng tiêu chí B3 a4727c3a · TC-01/02/03): nhận diện xanh bạc · navy · điểm vàng · B7B.
   Khối này đặt CUỐI tệp để ghi đè token/kiểu cũ theo thứ tự cascade, không sửa rải rác phía trên.
   Giữ nguyên: 6 mục điều hướng, đường theo vai, công thức số, luồng nhập → xem lại → sửa/xác nhận.
   ==================================================================================================== */
:root {
  --bg: #e9eff8; --paper: #ffffff; --ink: #10243e; --muted: #485975; --line: #cdd9ec; --soft: #eef3ff;
  --navy: #0b244e; --navy-2: #183789; --gold: #9a6117; --gold-line: #d4a756; --gold-bg: #fff7e2; --silver: #f5f8ff;
  --green: #0a635b; --good-bg: #e6f4f0; --info: #183789; --info-bg: #e9efff;
  --action: #0b244e; --action-text: #ffffff; --focus: #183789;
  --shadow: 0 10px 40px rgba(11, 36, 78, .16);
  --head-bg: #0b244e; --head-ink: #ffffff; --head-muted: #c9d6ee; --head-line: rgba(255, 255, 255, .32);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0b1830; --paper: #13223d; --ink: #e6edf8; --muted: #aab9d1; --line: #2b4068; --soft: #1c2f52;
    --navy: #e6edf8; --navy-2: #9fb8ee; --gold: #f1c667; --gold-line: #d4a756; --gold-bg: #3a2e12; --silver: #13223d;
    --green: #8fe0cf; --good-bg: #153d3a; --info: #aac4f5; --info-bg: #1c2f52;
    --action: #f1c667; --action-text: #0b1830; --focus: #f1c667;
    --shadow: 0 10px 40px rgba(0, 0, 0, .55);
    --head-bg: #07122a; --head-ink: #ffffff; --head-muted: #aab9d1; --head-line: rgba(255, 255, 255, .28);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1830; --paper: #13223d; --ink: #e6edf8; --muted: #aab9d1; --line: #2b4068; --soft: #1c2f52;
  --navy: #e6edf8; --navy-2: #9fb8ee; --gold: #f1c667; --gold-line: #d4a756; --gold-bg: #3a2e12; --silver: #13223d;
  --green: #8fe0cf; --good-bg: #153d3a; --info: #aac4f5; --info-bg: #1c2f52;
  --action: #f1c667; --action-text: #0b1830; --focus: #f1c667;
  --shadow: 0 10px 40px rgba(0, 0, 0, .55);
  --head-bg: #07122a; --head-ink: #ffffff; --head-muted: #aab9d1; --head-line: rgba(255, 255, 255, .28);
}
:root[data-theme="contrast"] {
  --bg: #ffffff; --paper: #ffffff; --ink: #061a35; --muted: #2e4466; --line: #5b7496; --soft: #e4ecfb;
  --navy: #061a35; --navy-2: #0c2f7a; --gold: #6b4300; --gold-line: #8a5a10; --gold-bg: #fff0c2; --silver: #ffffff;
  --green: #0a5236; --good-bg: #d5ecdc; --info: #0c2f7a; --info-bg: #dbe8fb;
  --action: #061a35; --action-text: #ffffff; --focus: #0033cc;
  --head-bg: #061a35; --head-ink: #ffffff; --head-muted: #dbe4f5; --head-line: rgba(255, 255, 255, .45);
}

/* Chữ nội dung ≥ 16 px (tiêu chí 1 của phiếu); chữ phụ 13 px. */
body { font-size: 16px; }
.small, .row small, .field .hint, .field-error, .note-item .meta, .crumb, .chip, .hc-sub, .metric > small, .page-head .sub, .summary-scope { font-size: 13px; }
.note { font-size: 14px; }
.field { font-size: 16px; }
.btn { font-size: 16px; border-radius: 999px; }
.btn.primary { background: var(--action); color: var(--action-text); border: 1.5px solid var(--gold-line); font-weight: 700; box-shadow: 0 4px 14px rgba(11, 36, 78, .18); }
.btn.secondary { background: var(--paper); color: var(--ink); border: 1.5px solid var(--gold-line); font-weight: 600; }
.btn.hero { min-height: 56px; font-size: 20px; padding: 12px 28px; letter-spacing: -.2px; }
.btn.ghost { border-radius: 10px; }
.chip.draft { background: var(--gold-bg); color: var(--gold); border: 1px solid var(--gold-line); font-size: 13px; padding: 4px 12px; border-radius: 999px; }
.paper { border-radius: 18px; }

/* Đầu trang: dải navy, viền vàng, "B7B | Tiền Biết Nói" */
.app-head { background: var(--head-bg); color: var(--head-ink); border-bottom: 3px solid var(--gold-line); }
.brand strong { color: var(--head-ink); font-size: 18px; }
.brand small { color: var(--head-muted); }
.brand .brand-b7b { font-weight: 700; letter-spacing: .6px; color: var(--head-ink); }
.brand .brand-sep { color: var(--gold-line); margin: 0 8px; font-weight: 400; }
.brand img { border-radius: 9px; box-shadow: 0 0 0 1.5px var(--gold-line); }
.who-text strong { color: var(--head-ink); }
.who-text small { color: var(--head-muted); }
.app-head .btn { background: transparent; color: var(--head-ink); border-color: var(--head-line); box-shadow: none; }
.app-head .btn:focus-visible { outline-color: var(--gold-line); }
.env-badge { font-size: 12px; color: var(--head-muted); border: 1px solid var(--head-line); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.auth-brand strong { color: var(--navy); }
.auth-card { border-color: var(--gold-line); border-width: 1.5px; }

/* Điều hướng: giữ 6 mục; mục đang mở màu vàng/navy, thanh dưới navy */
.nav a { font-size: 16px; }
.nav a[aria-current="page"] { background: var(--soft); color: var(--navy-2); box-shadow: inset 3px 0 0 var(--gold-line); }
@media (max-width: 720px) {
  .env-badge { display: none; }
  .who-text { border-top-color: var(--head-line); }
  .who-text strong::before { color: var(--head-muted); }
  .nav { background: var(--head-bg); border-top: 2px solid var(--gold-line); }
  .nav a { color: var(--head-muted); font-size: 12px; position: relative; }
  .nav a[aria-current="page"] { background: transparent; color: var(--gold); box-shadow: none; font-weight: 700; }
  .nav a[aria-current="page"]::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: 3px; height: 3px; border-radius: 2px; background: var(--gold-line); }
}
:root[data-theme="dark"] .nav a[aria-current="page"], :root:not([data-theme]) .nav a[aria-current="page"] { color: var(--gold); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .nav a[aria-current="page"] { color: var(--navy-2); } }
@media (max-width: 720px) { :root:not([data-theme]) .nav a[aria-current="page"], :root[data-theme="light"] .nav a[aria-current="page"], :root[data-theme="contrast"] .nav a[aria-current="page"] { color: #f1c667; } }
:root[data-theme="contrast"] .nav a { color: #e8eefa; }
@media (max-width: 720px) { :root[data-theme="contrast"] .nav a[aria-current="page"] { color: #ffd86b; } }

/* Tổng quan (TC-01/TC-02): tiêu đề lớn; thẻ chính "Tiền đang có" + hai thẻ phụ; nút chính "Ghi thu chi" thấy ngay khi mở màn */
.home-head h2 { font-size: 34px; letter-spacing: -1px; color: var(--navy); }
.hero-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 12px; margin: 8px 0 14px; }
.hero-card { background: var(--paper); border: 1.5px solid var(--gold-line); border-radius: 18px; padding: 16px 18px; min-width: 0; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 6px 24px rgba(11, 36, 78, .08); }
.hero-card .hc-label { font-size: 16px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.hero-card .hc-value { font-size: 30px; color: var(--gold); font-weight: 700; }
.hero-card.main .hc-value { font-size: 40px; }
.hero-card .hc-value.is-text { font-size: 18px; white-space: normal; color: var(--muted); font-weight: 600; }
.hero-card .hc-sub { color: var(--muted); }
.hero-card .hc-toggle { margin-top: 6px; align-self: flex-start; padding: 8px 0; color: var(--info); text-decoration: underline; font-size: 14px; min-height: 44px; }
.hero-icon { width: 26px; height: 26px; color: var(--gold); flex-shrink: 0; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 6px 0 18px; }
.hero-cta .btn.hero { flex: 1 1 260px; }
.hero-cta .btn.secondary { flex: 0 1 auto; min-height: 52px; padding: 10px 22px; }
.home-section-title { font-size: 18px; margin: 18px 0 8px; color: var(--navy); }
@media (max-width: 720px) {
  .home-head h2 { font-size: 30px; }
  .hero-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hero-card.main { grid-column: 1 / -1; }
  .hero-card { padding: 12px 14px; }
  .hero-card.main .hc-value { font-size: 32px; }
  .hero-card .hc-value { font-size: 22px; }
  .hero-cta .btn.secondary { flex: 1 1 100%; }
}
@media (max-width: 380px) {
  .hero-card .hc-value { font-size: 20px; }
  .hero-card.main .hc-value { font-size: 28px; }
  .btn.hero { font-size: 19px; }
}

/* Ghi thu chi · bước xem lại (TC-03): chip "Chưa ghi", "Xem lại giao dịch", "Sửa bản nháp" / "Xác nhận ghi"; web ≥ 960 px hai khung cạnh nhau */
.fe-review-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 8px; }
.fe-review-head h4 { font-size: 20px; margin: 0; color: var(--navy); }
#fe-review-summary { border: 1.5px solid var(--gold-line); border-radius: 16px; }
#fe-review-summary .row > .money { color: var(--gold); font-size: 20px; }
.fe-col-title { font-size: 20px; margin: 0 0 6px; color: var(--navy); }
.sheet.fe-wide { width: min(1040px, 100%); }
.sheet-body.fe-wide-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-content: start; }
.fe-col { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; min-width: 0; align-self: start; }
.fe-col.fe-preview { border: 1.5px solid var(--gold-line); }
.fe-col .actions { margin-top: 16px; }
.fe-col.fe-disabled .field input, .fe-col.fe-disabled .field select, .fe-col.fe-disabled .field textarea, .fe-col.fe-disabled .seg-btn { opacity: .72; }
.sheet-head { background: var(--head-bg); color: var(--head-ink); border-bottom: 2px solid var(--gold-line); }
.sheet-head .btn { background: transparent; color: var(--head-ink); border-color: var(--head-line); }

/* Điện thoại (≤ 720 px): nút chính "Ghi thu chi" phải nằm trong khung nhìn khi mở Tổng quan (phiếu: "Ghi thu chi" thấy ngay).
   Đo thực tế 375×812 trước khi sửa: nút ở y = 989 (ngoài màn). Cách sửa chỉ bố cục: đầu trang 2 hàng, thanh Trợ lý gọn
   (chip cuộn ngang, vẫn đủ 5 lối vào), ô "Kỳ xem" cạnh tiêu đề, chữ phụ thẻ ngắn. Không bỏ lối vào nào. */
.home-head { align-items: center; }
.home-head .home-month-field { margin: 0; max-width: 220px; flex: 0 0 auto; }
@media (max-width: 720px) {
  .who .btn#logout-btn { order: 3; flex: 0 0 auto; padding: 6px 12px; font-size: 13px; min-height: 44px; }
  .who-text { flex: 1 0 60%; min-width: 0; order: 3; display: block; overflow: hidden; } /* 60% ép xuống hàng 2, chừa chỗ nút Đăng xuất cùng hàng */
  .who-text strong { display: block; max-width: 100%; }
  .who-text small { display: block; white-space: normal; }
  .app-head { align-items: center; padding: 8px 12px; row-gap: 2px; }
  .who-text { padding-top: 0; }
  .main { padding-top: 8px; }
  .assist-bar { padding: 8px 10px; margin-bottom: 6px; }
  .assist-row .assist-mock { display: none; }
  .assist-row { display: none; }
  .assist-input-row { margin-top: 0; }
  .assist-input-row input { min-height: 44px; }
  .assist-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 8px; margin-top: 8px; padding-bottom: 2px; scrollbar-width: none; }
  .assist-chips::-webkit-scrollbar { display: none; }
  .assist-chips .btn { flex: 0 0 auto; white-space: nowrap; }
  .page-head.home-head { flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
  .page-head.home-head > div { flex: 0 1 auto; }
  .home-head h2 { font-size: 28px; }
  .home-head .home-month-field { max-width: 190px; flex: 0 1 190px; }
  .home-head .home-month-field > .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .home-head .home-month-field input { min-height: 44px; }
  .hero-grid { margin: 2px 0 8px; gap: 8px; }
  .hero-card { padding: 10px 12px; gap: 3px; }
  .hero-card .hc-value.is-text { font-size: 16px; }
  .hero-card .hc-label { font-size: 16px; line-height: 1.25; }
  .hero-card .hc-sub { line-height: 1.25; }
  .hero-card.main .hc-toggle { min-height: 36px; padding: 4px 0; margin-top: 0; }
  .hero-cta { margin: 2px 0 14px; gap: 10px; }
}
/* ====================================================================================================
   TỔNG QUAN SÁT MẪU (phiếu bad79825, 12/11; mẫu tbn-2050-tong-quan-mobile d682c5f0): nền xanh bạc có ánh sáng,
   thẻ viền vàng bóng, thẻ phụ biểu tượng ở trên, nút chính có quầng vàng, nút phụ có biểu tượng túi;
   thanh Trợ lý ở Tổng quan thu gọn mặc định. Giữ: 6 mục, nhãn số (TC-01/TC-02), nút Ghi thu chi ngay dưới tiêu đề (F-03, Owner chốt).
   ==================================================================================================== */
:root { --bg-grad: radial-gradient(120% 55% at 50% -8%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 60%), radial-gradient(90% 38% at 50% 34%, rgba(212, 167, 86, .20), rgba(212, 167, 86, 0) 70%), linear-gradient(180deg, #eef3fb 0%, #e3eaf7 55%, #d7e1f3 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --bg-grad: radial-gradient(90% 38% at 50% 30%, rgba(241, 198, 103, .10), rgba(241, 198, 103, 0) 70%), linear-gradient(180deg, #10213f 0%, #0b1830 55%, #07122a 100%); } }
:root[data-theme="dark"] { --bg-grad: radial-gradient(90% 38% at 50% 30%, rgba(241, 198, 103, .10), rgba(241, 198, 103, 0) 70%), linear-gradient(180deg, #10213f 0%, #0b1830 55%, #07122a 100%); }
:root[data-theme="contrast"] { --bg-grad: #ffffff; }
body { background: var(--bg-grad); background-attachment: scroll; }
.hero-card { background: linear-gradient(180deg, var(--paper) 0%, var(--silver) 100%); border: 1.5px solid var(--gold-line); box-shadow: 0 0 0 3px rgba(212, 167, 86, .16), 0 10px 28px rgba(11, 36, 78, .12); }
:root[data-theme="contrast"] .hero-card { box-shadow: none; background: var(--paper); }
.hero-cta .btn.hero { box-shadow: 0 0 0 3px rgba(212, 167, 86, .28), 0 10px 24px rgba(11, 36, 78, .28); }
.hero-cta a.btn { text-decoration: none; }
.hero-cta .btn.secondary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 6px 18px rgba(11, 36, 78, .10); }
.hero-cta .btn.secondary .hero-icon { width: 24px; height: 24px; color: var(--navy); padding-right: 10px; border-right: 1.5px solid var(--gold-line); box-sizing: content-box; }
/* Thanh Trợ lý ở Tổng quan: thu gọn thành một nút (≥ 48 px), mở ra giữ ô gõ + 5 lối vào */
.assist-bar.assist-home { padding: 0; }
.assist-bar-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 14px; background: transparent; border: 0; color: var(--ink); font: inherit; font-size: 16px; text-align: left; cursor: pointer; border-radius: inherit; }
.assist-bar-toggle .assist-toggle-sub { color: var(--muted); font-weight: 400; }
.assist-bar-toggle .assist-toggle-caret { margin-left: auto; color: var(--gold); font-size: 18px; }
.assist-bar-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.assist-bar.assist-home .assist-bar-body { padding: 0 14px 12px; }
.assist-bar.assist-home .assist-row { margin-top: 0; }
.assist-bar.assist-home[data-collapsed="false"] .assist-bar-toggle { border-bottom: 1px solid var(--line); border-radius: 18px 18px 0 0; }
@media (max-width: 720px) {
  .assist-bar.assist-home { padding: 0; }
  .assist-bar.assist-home .assist-bar-body { padding: 8px 10px 10px; }
  .assist-bar.assist-home .assist-row { display: none; }
  /* Thẻ theo mẫu: thẻ chính căn giữa, thẻ phụ biểu tượng ở trên + gạch vàng + số vàng */
  .hero-card.main { align-items: center; text-align: center; }
  .hero-card.main .hc-label { justify-content: center; }
  .hero-card.main .hc-toggle { align-self: center; }
  .hero-card:not(.main) { align-items: center; text-align: center; padding: 12px 10px; gap: 6px; }
  .hero-card:not(.main) .hc-label { flex-direction: column; gap: 6px; width: 100%; }
  .hero-card:not(.main) .hc-label::after { content: ""; display: block; width: 72%; height: 1.5px; background: var(--gold-line); margin: 4px auto 0; }
  .hero-card:not(.main) .hero-icon { width: 30px; height: 30px; }
  .hero-card:not(.main) .hc-value { font-size: 22px; }
  .hero-card:not(.main) .hc-value.is-text { font-size: 16px; }
}
/* Minh họa Owner duyệt (tbn-vi.png c197e217…, tbn-robot-b7b.png 5b5afd27…): web ≥ 1001 px nằm bên phải tiêu đề (mẫu web);
   721–1000 px thành hàng dưới tiêu đề; điện thoại nằm SAU hàng nút "Ghi thu chi" (nút vẫn ngay dưới tiêu đề — Owner chốt) và TRƯỚC cụm thẻ. */
.home-illus { display: flex; justify-content: center; align-items: flex-end; gap: 18px; margin: 0 0 10px; }
.home-illus img { width: auto; height: 112px; max-width: 45%; object-fit: contain; filter: drop-shadow(0 8px 16px rgba(11, 36, 78, .18)); }
#home-page { position: relative; }
@media (min-width: 1001px) {
  .home-illus { position: absolute; right: 250px; top: -6px; margin: 0; }
  .home-illus img { height: 118px; }
}
/* R1 tăng cỡ (thư 921444d9, Owner duyệt ±20%): mẫu cặp hình nhìn thấy = 0,727 × 0,286 bề ngang màn. Hai PNG duyệt có khoảng trong suốt
   (phần nhìn thấy: ví 0,844 × 0,719 khung; rô-bốt 0,805 × 0,725 khung). Khung vuông cao 39,4 vw ⇒ phần nhìn thấy cao ≈ 0,725 × 0,394 = 0,286
   bề ngang màn; rộng cặp ≈ (0,844 + 0,805 + 0,078 + 0,097) × 0,394 + 8 px ≈ 0,74 bề ngang màn. Không cắt/không méo PNG (object-fit: contain, khung vuông). */
@media (max-width: 720px) {
  .home-illus { order: 0; margin: 0 0 8px; gap: 8px; }
  .home-illus img { height: 39.4vw; max-width: 46%; }
}
/* F-03 (phiếu 5498a52f, Fresh ca 2): trên điện thoại cụm thẻ có khoản phải chi đẩy nút xuống dưới thanh dưới cố định.
   Đưa hàng nút hiện có (#home-cta: "Ghi thu chi →" + "Thử trước khi mua") lên NGAY DƯỚI tiêu đề Tổng quan bằng thứ tự flex;
   DOM, id và hành vi nút không đổi; web (> 720 px) giữ nút sau cụm thẻ như ảnh chuẩn. */
@media (max-width: 720px) {
  #home-page { display: flex; flex-direction: column; }
  #home-page > .page-head { order: -2; }
  #home-body { display: contents; }
  #home-cta { order: -1; margin: 2px 0 10px; }
}
/* Máy tính bảng / cửa sổ hẹp (721–1100 px): 3 cột quá hẹp cho số 40 px (đo n1 768×1024: số tràn thẻ) → 2 cột, thẻ chính trọn hàng */
@media (min-width: 721px) and (max-width: 1100px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .hero-card.main { grid-column: 1 / -1; }
  .hero-card.main .hc-value { font-size: 36px; }
  .hero-card .hc-value { font-size: 26px; }
}
@media (max-width: 380px) {
  .home-head h2 { font-size: 24px; }
  .home-head .home-month-field { max-width: 180px; flex-basis: 180px; }
  .hero-card { padding: 8px 10px; }
  .btn.hero { min-height: 50px; }
  .hero-grid { gap: 6px; }
  .hero-card.is-text .hc-sub { display: none; } /* ≤380: giá trị đã là chữ "Chưa có kế hoạch", ẩn dòng phụ để nút chính còn trong khung nhìn */
}
/* ====================================================================================================
   GÓI SỬA GỘP TỔNG QUAN 20/11/2026 (phiếu Owner ab9659ee; ảnh R5 điện thoại d7ccc091 + web 38694689 — chỉ minh họa bố cục/phong cách).
   Nền sáng, chữ navy, điểm nhấn xanh tím; nhận diện "AI B7B | Tiền Biết Nói" nhỏ trên đầu; không hình ví/rô-bốt lớn.
   Điều hướng 3 mục; thứ tự 6 khối; web ≥ 1101 px: hai cột (trái Cần lo trước + Ghi thu chi; phải Tiền sắp về, Dự kiến cuối tháng, Hỏi Trợ lý).
   Tối/tương phản cao giữ token riêng (bộ chọn có độ ưu tiên cao hơn :root).
   ==================================================================================================== */
:root {
  --accent: #4b3fd8; --accent-2: #7a3fe0; --accent-soft: #eeebff; --accent-line: #c9c2f5;
  --tq-amber-bg: #fff4dc; --tq-amber-ink: #6b4300; --tq-red-bg: #fde8e8; --tq-red-ink: #9b1c1c;
  --head-bg: rgba(255, 255, 255, .92); --head-ink: #0b244e; --head-muted: #485975; --head-line: #cdd9ec;
  --nav-bg: #ffffff; --nav-ink: #485975; --nav-active: #4b3fd8; --nav-active-bg: #eeebff;
  --bg-grad: radial-gradient(110% 50% at 15% -5%, rgba(196, 186, 255, .45), rgba(196, 186, 255, 0) 60%), radial-gradient(90% 45% at 100% 30%, rgba(170, 220, 255, .40), rgba(170, 220, 255, 0) 65%), linear-gradient(180deg, #f6f7ff 0%, #eef2fb 60%, #e9eef9 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --accent: #b3a8ff; --accent-2: #c7a4ff; --accent-soft: #241f4d; --accent-line: #4a4290; --tq-amber-bg: #3a2e12; --tq-amber-ink: #f1c667; --tq-red-bg: #4a1c1c; --tq-red-ink: #ffb4b4;
    --nav-bg: #07122a; --nav-ink: #aab9d1; --nav-active: #c7bdff; --nav-active-bg: #241f4d; }
}
:root[data-theme="dark"] { --accent: #b3a8ff; --accent-2: #c7a4ff; --accent-soft: #241f4d; --accent-line: #4a4290; --tq-amber-bg: #3a2e12; --tq-amber-ink: #f1c667; --tq-red-bg: #4a1c1c; --tq-red-ink: #ffb4b4;
  --nav-bg: #07122a; --nav-ink: #aab9d1; --nav-active: #c7bdff; --nav-active-bg: #241f4d; }
:root[data-theme="contrast"] { --accent: #2a1fb0; --accent-2: #2a1fb0; --accent-soft: #e4e1ff; --accent-line: #2a1fb0; --nav-bg: #061a35; --nav-ink: #e8eefa; --nav-active: #ffd86b; --nav-active-bg: transparent; }

/* Đầu trang sáng (chỉ chế độ sáng; tối/tương phản giữ dải tối qua token riêng) */
.app-head { border-bottom: 1px solid var(--head-line); backdrop-filter: blur(8px); }
.brand .brand-b7b { color: var(--accent); }
.brand .brand-sep { color: var(--gold-line); }
.brand img { box-shadow: none; }

/* Điều hướng 3 mục */
html:root .app-root .nav a { color: var(--nav-ink); }
html:root .app-root .nav a[aria-current="page"] { color: var(--nav-active); background: var(--nav-active-bg); box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; }
@media (max-width: 720px) {
  html:root .app-root .nav { background: var(--nav-bg); border-top: 1px solid var(--line); justify-content: space-around; }
  html:root .app-root .nav a { font-size: 13px; max-width: 132px; border-radius: 14px; margin: 2px 4px; }
  html:root .app-root .nav a[aria-current="page"] { box-shadow: none; }
  html:root .app-root .nav a[aria-current="page"]::after { display: none; }
}

/* Tiêu đề Tổng quan */
.tq-page .home-head h2 { color: var(--navy); letter-spacing: -.6px; }
.tq-page .home-head .tq-period { display: block; margin: 2px 0 0; color: var(--muted); font-size: 15px; }
@media (max-width: 600px) { .tq-page .page-head.home-head .tq-period { display: block; font-size: 14px; } .tq-page .page-head.home-head > div { display: block; } }

/* 1 · Ba số */
.tq-hero .hero-card { background: linear-gradient(160deg, rgba(255, 255, 255, .96) 0%, rgba(245, 243, 255, .9) 100%); border: 1px solid var(--accent-line); box-shadow: 0 8px 26px rgba(75, 63, 216, .10); border-radius: 20px; }
:root[data-theme="dark"] .tq-hero .hero-card, :root[data-theme="contrast"] .tq-hero .hero-card { background: var(--paper); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .tq-hero .hero-card { background: var(--paper); } }
.tq-hero .hero-card .hc-value { color: var(--navy); }
.tq-hero .hero-card .hc-value.is-text { color: var(--muted); }
.tq-arrow { font-weight: 800; font-size: 20px; line-height: 1; }
.tq-arrow-up { color: var(--green); }
.tq-arrow-down { color: #c2410c; }
:root[data-theme="dark"] .tq-arrow-down { color: #ffb08a; }
.tq-note { margin: -6px 0 14px; text-align: center; font-style: italic; color: var(--muted); font-size: 14px; }
@media (max-width: 720px) {
  .tq-hero .hero-card.main { align-items: flex-start; text-align: left; }
  .tq-hero .hero-card.main .hc-label { justify-content: flex-start; }
  .tq-hero .hero-card.main .hc-toggle { align-self: flex-start; }
  .tq-hero .hero-card:not(.main) { align-items: flex-start; text-align: left; }
  .tq-hero .hero-card:not(.main) .hc-label { flex-direction: row; gap: 6px; }
  .tq-hero .hero-card:not(.main) .hc-label::after { display: none; }
  .tq-hero .hero-card:not(.main) .hc-value { font-size: 21px; }
}
@media (max-width: 360px) { .tq-hero .hero-card:not(.main) .hc-value { font-size: 18px; } .tq-hero { grid-template-columns: minmax(0, 1fr); } }

/* Khối chung */
.tq-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.tq-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tq-card { background: var(--paper); border: 1px solid var(--accent-line); border-radius: 20px; padding: 14px 16px; min-width: 0; box-shadow: 0 6px 20px rgba(11, 36, 78, .06); }
.tq-card h3 { margin: 0; color: var(--navy); font-size: 20px; }
.tq-sub { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.tq-empty { margin: 10px 0 4px; color: var(--muted); }
.tq-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; padding: 0 2px; cursor: pointer; font: inherit; font-weight: 600; }
.tq-card > .tq-link { margin-top: 4px; }

/* 2 · Cần lo trước */
.tq-attention { border-left: 4px solid var(--gold-line); background: linear-gradient(180deg, #fffaf0 0%, var(--paper) 70%); }
:root[data-theme="dark"] .tq-attention, :root[data-theme="contrast"] .tq-attention { background: var(--paper); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .tq-attention { background: var(--paper); } }
.tq-att-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.tq-att-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 14px; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); text-decoration: none; min-height: 56px; }
.tq-att-row:hover { border-color: var(--accent-line); }
.tq-att-row:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tq-att-row .e-main { display: flex; flex-direction: column; min-width: 0; }
.tq-att-row .e-title { font-weight: 600; overflow-wrap: anywhere; }
.tq-att-row .e-sub { color: var(--muted); font-size: 13px; }
.tq-badge { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--tq-amber-bg); color: var(--tq-amber-ink); border: 1px solid var(--gold-line); }
.tq-badge[data-group="overdue"] { background: var(--tq-red-bg); color: var(--tq-red-ink); border-color: currentColor; }
.tq-badge[data-group="upcoming"] { background: var(--soft); color: var(--navy-2); border-color: var(--line); }
.tq-att-amt { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.tq-att-amt .money { font-size: 17px; color: var(--navy); white-space: nowrap; }
.tq-att-amt .money.is-text { font-size: 14px; color: var(--tq-amber-ink); white-space: normal; }
.tq-att-amt small { color: var(--muted); font-size: 12px; }
.tq-go { color: var(--muted); font-size: 20px; }
@media (max-width: 420px) {
  .tq-att-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "b b" "m a"; row-gap: 4px; }
  .tq-att-row .tq-badge { grid-area: b; justify-self: start; }
  .tq-att-row .e-main { grid-area: m; }
  .tq-att-row .tq-att-amt { grid-area: a; }
  .tq-att-row .tq-go { display: none; }
}

/* 3 · Ghi thu hoặc chi */
.tq-page .hero-cta { margin: 0; }
.tq-page .btn.hero.tq-cta { background: linear-gradient(90deg, #2346c8 0%, var(--accent) 50%, var(--accent-2) 100%); color: #fff; border: 0; box-shadow: 0 10px 24px rgba(75, 63, 216, .30); display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.tq-page .btn.hero.tq-cta .tq-plus { font-size: 26px; line-height: 1; font-weight: 700; }
:root[data-theme="dark"] .tq-page .btn.hero.tq-cta { background: linear-gradient(90deg, #3b4fd8 0%, #6a4fe0 100%); }
:root[data-theme="contrast"] .tq-page .btn.hero.tq-cta { background: var(--action); color: var(--action-text); }
.tq-page .hero-cta .btn.secondary { border-color: var(--accent-line); }

/* 4 · Tiền sắp về · 5 · Dự kiến cuối tháng */
.tq-inc-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tq-inc-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; }
.tq-inc-row > span { min-width: 0; overflow-wrap: anywhere; }
.tq-inc-row small { color: var(--muted); }
.tq-inc-row .money { color: var(--navy); white-space: nowrap; }
.tq-forecast { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 14px; background: linear-gradient(120deg, #eef4ff 0%, #f3efff 100%); }
:root[data-theme="dark"] .tq-forecast, :root[data-theme="contrast"] .tq-forecast { background: var(--paper); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .tq-forecast { background: var(--paper); } }
.tq-forecast .hc-value { font-size: 26px; font-weight: 700; color: var(--navy); }
.tq-forecast .hc-value.is-text { font-size: 16px; color: var(--muted); }
.tq-forecast[data-tone="red"] .hc-value { color: var(--tq-red-ink); }
.tq-forecast .hc-toggle { flex-basis: 100%; }

/* 6 · Hỏi Trợ lý (thanh Trợ lý hiện có trong ô dành sẵn) */
.tq-assist .assist-bar { margin: 0; border: 1px solid var(--accent-line); border-radius: 20px; }
.tq-assist .assist-bar-toggle { min-height: 64px; gap: 14px; }
.tq-assist .assist-toggle-orb { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; background: radial-gradient(circle at 35% 30%, #ffffff 0%, #9fd8ff 30%, #7a6bff 65%, #c56bff 100%); box-shadow: 0 4px 12px rgba(75, 63, 216, .35); }
.tq-assist .assist-toggle-text { display: flex; flex-direction: column; border-left: 1px solid var(--line); padding-left: 14px; }
.tq-assist .assist-toggle-text strong { font-size: 18px; color: var(--navy); }
.tq-assist .assist-toggle-caret { color: var(--accent); }

/* Bố cục: bỏ thứ tự flex cũ (nút chính đã nằm đúng chỗ trong DOM) */
@media (max-width: 720px) {
  .tq-page { display: block; }
  .tq-page #home-body { display: block; }
  .tq-page #home-cta { order: 0; margin: 0; }
}
@media (min-width: 1101px) {
  .tq-cols { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
  .tq-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tq-hero .hero-card.main .hc-value { font-size: 36px; }
  .tq-hero .hero-card .hc-value { font-size: 32px; }
}
/* Tự xem ảnh 390 px: ô Kỳ xem đè tiêu đề dài "Tiền và việc sắp tới" → điện thoại: tiêu đề trọn hàng, ô tháng xuống hàng dưới */
@media (max-width: 720px) {
  .tq-page .page-head.home-head { flex-wrap: wrap; align-items: flex-end; row-gap: 6px; }
  .tq-page .page-head.home-head > div { flex: 1 1 100%; min-width: 0; }
  .tq-page .home-head h2 { white-space: normal; font-size: 26px; line-height: 1.15; }
  .tq-page .home-head .home-month-field { flex: 0 1 220px; max-width: 220px; }
}
@media (max-width: 380px) { .tq-page .home-head h2 { font-size: 24px; } }
/* ====================================================================================================
   ĐỒNG BỘ GIAO DIỆN TOÀN APP 22/11/2026 (phiếu Owner cda616d1 · ảnh e6ce9b78 điện thoại / 49c9cc45 web).
   Giữ nguyên 6 menu, đường dẫn, quyền theo a0bee59 (thanh trái web, thanh dưới điện thoại như cũ).
   Một hệ thiết kế cho mọi trang: nền sáng, chữ navy, điểm nhấn xanh tím; nút, ô nhập, tab, thẻ, danh sách, hộp thoại, thông báo cùng kiểu.
   Không ép trang khác thành bố cục Tổng quan; không thu nhỏ chữ, không giấu thao tác. Tối/tương phản cao giữ token riêng.
   ==================================================================================================== */
:root {
  --action: #3b34c4; --action-text: #ffffff; --focus: #4b3fd8;
  --soft: #f0eeff; --info: #3530a8; --info-bg: #eeecff; --line: #d6dcf0;
  --btn-grad: linear-gradient(90deg, #2346c8 0%, #4b3fd8 55%, #7a3fe0 100%);
}
:root[data-theme="dark"] { --btn-grad: linear-gradient(90deg, #3b4fd8 0%, #6a4fe0 100%); --action-text: #ffffff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --btn-grad: linear-gradient(90deg, #3b4fd8 0%, #6a4fe0 100%); --action-text: #ffffff; } }
:root[data-theme="contrast"] { --btn-grad: var(--action); }

/* Chữ: tiêu đề navy, cùng thang */
h2, h3, .page-head h2, .sheet-head h3, .day-head { color: var(--navy); }
:root[data-theme="dark"] h2, :root[data-theme="dark"] h3 { color: var(--ink); }

/* Nút */
.btn { border-color: var(--accent-line); color: var(--ink); }
.btn.primary, .btn.primary:hover { background: var(--btn-grad); color: #fff; border: 0; box-shadow: 0 6px 16px rgba(75, 63, 216, .22); }
:root[data-theme="contrast"] .btn.primary { background: var(--action); color: var(--action-text); box-shadow: none; }
.btn.ghost { color: var(--accent); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.danger { border: 1px solid currentColor; }

/* Ô nhập */
.field input, .field select, .field textarea { border-color: var(--line); border-radius: 12px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(75, 63, 216, .18); outline: none; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

/* Thẻ, danh sách, bảng */
.paper, .metric, .home-card { border-color: var(--accent-line); border-radius: 18px; box-shadow: 0 4px 16px rgba(11, 36, 78, .05); }
:root[data-theme="contrast"] .paper, :root[data-theme="contrast"] .metric { box-shadow: none; border-color: var(--line); }
.entry-row:hover, .more-item:hover { background: var(--accent-soft); }
.more-item > span:last-child { color: var(--accent); }

/* Tab, nhóm lựa chọn */
.plan-tab[aria-current="page"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }
.seg-btn[aria-pressed="true"]:not(.seg-income):not(.seg-expense):not(.seg-transfer) { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.crumb a { color: var(--accent); }

/* Hộp thoại / tờ trượt */
.sheet-head { border-bottom: 1px solid var(--accent-line); }
.sheet { border-color: var(--accent-line); }

/* Trạng thái: trống / đang tải / lỗi / thành công / không được thao tác — cùng khung, có chữ (không chỉ màu) */
.list-state { border: 1px dashed var(--accent-line); border-radius: 18px; background: var(--paper); }
.note { border-radius: 14px; border: 1px solid transparent; }
.note.bad { border-color: currentColor; }
.note.good { border-color: rgba(10, 99, 91, .35); }
.note.warn { border-color: var(--gold-line); }

/* Điều hướng: đúng 6 mục / 5 mục (thành viên) như a0bee59; điện thoại nhãn được xuống 2 dòng thay vì thu chữ */
@media (max-width: 720px) {
  :root { --nav-h: 66px; }
  html:root .app-root .nav { justify-content: space-between; padding-left: 2px; padding-right: 2px; }
  html:root .app-root .nav a { font-size: 12px; max-width: none; margin: 2px 1px; padding: 4px 0; white-space: normal; line-height: 1.15; min-height: 56px; border-radius: 12px; }
  html:root .app-root .nav a span { display: block; overflow-wrap: anywhere; }
}

/* S3 — Tổng quan điện thoại: thấy nội dung "Cần lo trước" ngay màn đầu, không bị thanh dưới che, không thu chữ nội dung */
.tq-note .hc-toggle { display: inline-flex; min-height: 44px; padding: 0 2px; vertical-align: middle; font-style: normal; color: var(--accent); text-decoration: underline; font-size: 14px; }
@media (max-width: 720px) {
  .tq-page .home-head .tq-period { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tq-page .page-head.home-head { margin-bottom: 6px; row-gap: 4px; }
  .tq-page .home-head h2 { font-size: 26px; }
  .tq-hero { gap: 8px; margin: 0 0 4px; }
  .tq-hero .hero-card { padding: 10px 12px; gap: 2px; }
  .tq-hero .hero-card.main { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; }
  .tq-hero .hero-card.main .hc-label { grid-column: 1; }
  .tq-hero .hero-card.main .hc-value { grid-column: 1 / -1; font-size: 30px; line-height: 1.15; }
  .tq-hero .hero-card.main .hc-sub { grid-column: 1; }
  .tq-hero .hero-card.main .hc-toggle { grid-column: 2; grid-row: 1; align-self: center; min-height: 40px; margin: 0; padding: 0; }
  .tq-hero .hero-card:not(.main) .hc-value { font-size: 20px; }
  .tq-hero .hero-card .hc-sub { line-height: 1.25; }
  .tq-note { margin: 0 0 8px; }
  .tq-cols { gap: 10px; }
  .tq-col { gap: 10px; }
  .tq-attention { padding: 12px 12px; }
  .tq-attention .section-head { flex-wrap: nowrap; align-items: flex-start; margin-bottom: 0; }
  .tq-attention .section-head > div { min-width: 0; }
  .tq-attention .section-head .tq-link { flex: 0 0 auto; white-space: nowrap; }
  .tq-att-list { margin-top: 8px; gap: 6px; }
  .tq-att-row { padding: 8px 10px; min-height: 52px; }
}
@media (max-width: 420px) {
  .tq-att-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "b a" "m m"; column-gap: 8px; row-gap: 2px; }
  .tq-att-row .tq-att-amt { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: 0 6px; align-items: baseline; }
  .tq-att-row .tq-att-amt small { flex-basis: 100%; text-align: right; }
}
@media (max-width: 360px) {
  .tq-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tq-hero .hero-card:not(.main) .hc-value { font-size: 18px; }
  .tq-page .home-head h2 { font-size: 24px; }
}

/* S4 — kỳ được mở từ "Cần lo trước": đánh dấu rõ bằng viền + chữ (aria-current) */
.occ-row.occ-focus { outline: 3px solid var(--accent); outline-offset: -3px; background: var(--accent-soft); }
/* S3 lượt 2 (đo 320×700: dòng việc đầu ở y = 855, thanh dưới ở 634) — chỉ bố cục, không thu chữ nội dung:
   phụ đề "Đang có" trải hết bề ngang; "Xem tất cả" xuống dưới danh sách trên điện thoại (như ảnh mẫu điện thoại); nút công thức thành liên kết trong câu. */
@media (max-width: 720px) {
  .tq-hero .hero-card.main .hc-sub { grid-column: 1 / -1; }
  .tq-attention { display: flex; flex-direction: column; }
  .tq-attention .section-head { display: contents; }
  .tq-attention .section-head > div { order: 0; }
  .tq-attention .tq-att-list, .tq-attention .tq-empty { order: 1; }
  .tq-attention #home-attention-all { order: 2; align-self: center; }
  .tq-attention #home-open-calendar { order: 3; align-self: center; }
  .tq-note .hc-toggle { display: inline; min-height: 0; padding: 0; }
}
@media (max-width: 380px) {
  .who-text small { display: inline; }
  .who-text { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; }
  .tq-hero .hero-card { padding: 8px 10px; }
  .tq-page .page-head.home-head { margin-bottom: 4px; }
}
/* S3 lượt 3 (đo 320×700: còn hụt 54 px) — bố cục, không thu chữ */
@media (max-width: 380px) {
  .tq-hero .hero-card.main { display: flex; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 10px; row-gap: 0; }
  .tq-hero .hero-card.main .hc-label { order: 0; }
  .tq-hero .hero-card.main .hc-value { order: 1; margin-left: auto; font-size: 28px; }
  .tq-hero .hero-card.main .hc-sub { order: 2; flex: 1 1 0; min-width: 0; width: auto; }
  .tq-hero .hero-card.main .hc-toggle { order: 3; flex: 0 0 auto; margin: 0 0 0 auto; align-self: center; }
  .tq-attention { padding: 10px 12px; }
}
/* Tiêu đề cột "Cần lo trước" như ảnh web (máy tính); điện thoại: số tiền vẫn là phần còn cần trả (nêu trong nhãn đọc màn hình) */
.tq-att-head { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto 14px; gap: 10px; padding: 0 12px 2px; color: var(--muted); font-size: 13px; font-weight: 600; }
.tq-att-head span:last-child { grid-column: 3; text-align: right; }
@media (max-width: 720px) { .tq-att-head { display: none; } }
/* ====================================================================================================
   SỬA GỘP SAU KIỂM 3633115 (phiếu Tổng e51ffdd6 · Fresh KT L1/L3, Fresh UX U1/U2) — chỉ bố cục, không thu nhỏ chữ nội dung.
   ==================================================================================================== */
/* Tf-3: thẻ "Đang có" ≤ 380 px — phụ đề không bao giờ chui lên hàng của số tiền (gốc lỗi: phụ đề flex-basis 0 bị ép vào chỗ trống cạnh số
   ⇒ cột 4–5 ký tự, tràn mép, trang nở ngang). Ngắt hàng bắt buộc sau số tiền; số tiền dài tự xuống dòng riêng, không cắt. */
@media (max-width: 380px) {
  .tq-hero .hero-card.main { min-width: 0; }
  .tq-hero .hero-card.main::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
  .tq-hero .hero-card.main .hc-value { white-space: nowrap; max-width: 100%; }
  .tq-hero .hero-card.main .hc-sub { order: 3; flex: 1 1 auto; min-width: 8em; }
  .tq-hero .hero-card.main .hc-toggle { order: 4; }
}
.tq-hero .hero-card, .tq-hero .hero-card .hc-value { min-width: 0; }

/* ====================================================================================================
   SỬA GỘP TRƯỚC TEST (phiếu Tổng 8607bd5d · Owner 5a7931a8): N1 số liền một khối · N2 không thu/giấu chữ ở bố cục gọn ·
   B1 dòng việc đầu không lấn thanh dưới ở 320×568 · B2 vùng bấm ≥ 44 px. Thay toàn bộ bố cục gọn của d142571.
   ==================================================================================================== */
/* "có nhắc chưa đọc" là phần tử riêng — màn cao: nối sau dòng hạn; màn thấp: cùng dòng hạn (xuống dòng nếu thiếu chỗ) */
.tq-att-row .tq-remind { color: var(--muted); font-size: 13px; margin-left: 4px; }
.tq-att-row .tq-remind::before { content: "· "; }
@media (min-height: 761px), (min-width: 721px) {
  .tq-att-row .e-main { display: block; }
  .tq-att-row .e-main .e-title { display: block; }
  .tq-att-row .e-main .tq-meta, .tq-att-row .e-main .e-sub { display: inline; }
}

/* N1 — mọi số tiền ở Tổng quan đọc liền một khối (số + "đ" không tách); thẻ tự xếp lại thay vì ngắt số. */
.tq-page .hc-value, .tq-page .tq-att-amt .money, .tq-page .tq-inc-row .money { white-space: nowrap; overflow-wrap: normal; word-break: keep-all; }
@media (max-width: 720px) {
  /* Ba thẻ số dạng hàng có thể xuống dòng: thẻ phụ không co nhỏ hơn số của nó ⇒ không đủ chỗ thì xuống hàng, không tràn */
  .tq-hero { display: flex; flex-wrap: wrap; gap: 8px; }
  .tq-hero .hero-card.main { flex: 1 1 100%; }
  .tq-hero .hero-card:not(.main) { flex: 1 1 0; min-width: min-content; }
  .tq-hero .hero-card .hc-value { min-width: max-content; }
}

/* Bố cục gọn (vùng nhìn cao ≤ 760 px, rộng ≤ 720 px). Giữ: số "Đang có" 30 px (390–430) / 28 px (≤ 380) như bố cục thường;
   Sắp nhận, Còn cần chi 20 px (18 px ở ≤ 360) như bố cục thường; mọi dòng mô tả hiện; tiêu đề trang hiện; dòng cửa sổ hạn ngay dưới "Cần lo trước".
   Chỉ xếp lại: ba số trong MỘT thẻ, khoảng cách nhỏ hơn, dòng việc 3 hàng ngắn. */
@media (max-width: 720px) and (max-height: 760px) {
  .main { padding-top: 6px; }
  .tq-page .page-head.home-head { margin-bottom: 4px; row-gap: 2px; }
  .tq-hero { column-gap: 12px; row-gap: 0; margin: 0 0 4px; padding: 0 10px; background: var(--paper); border: 1px solid var(--accent-line); border-radius: 18px; box-shadow: 0 4px 16px rgba(11, 36, 78, .06); }
  .tq-hero .hero-card, .tq-hero .hero-card.main, .tq-hero .hero-card:not(.main) { padding: 6px 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; text-align: left; min-height: 0; }
  /* Đang có: [nhãn ······ số] / [Tiền mặt và tài khoản ······ Xem N ví] */
  .tq-hero .hero-card.main { display: flex; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 0; }
  .tq-hero .hero-card.main .hc-label { order: 0; }
  .tq-hero .hero-card.main .hc-value { order: 1; margin-left: auto; font-size: 30px; line-height: 1.15; }
  .tq-hero .hero-card.main::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
  .tq-hero .hero-card.main .hc-sub { order: 3; flex: 1 1 auto; min-width: 0; position: static; width: auto; height: auto; clip: auto; overflow: visible; white-space: normal; }
  /* B2: chữ "Xem N ví" giữ một dòng nhưng vùng bấm cao 44 px (đệm trên/dưới bù bằng lề âm, không đẩy bố cục) */
  .tq-hero .hero-card.main .hc-toggle { order: 4; margin: -12px 0 -12px auto; padding: 12px 0 12px 8px; min-height: 44px; box-sizing: border-box; display: inline-flex; align-items: center; }
  /* Sắp nhận | Còn cần chi cạnh nhau; số dài ⇒ (lớp .tq-hero-long do Tổng quan gắn theo độ dài chuỗi số) mỗi số một hàng [nhãn ··· số] */
  .tq-hero .hero-card:not(.main) { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border-top: 1px solid var(--line); }
  .tq-hero .hero-card:not(.main) .hc-label { flex-direction: row; width: auto; gap: 6px; }
  .tq-hero .hero-card:not(.main) .hc-label::after { display: none; }
  .tq-hero .hero-card:not(.main) .hc-value { font-size: 20px; line-height: 1.2; }
  .tq-hero .hero-card .hc-value.is-text { font-size: 16px; white-space: normal; min-width: 0; }
  .tq-hero .hero-card .hc-sub { line-height: 1.25; }
  .tq-hero.tq-hero-long .hero-card:not(.main) { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 8px; }
  .tq-hero.tq-hero-long .hero-card:not(.main) .hc-sub { flex-basis: 100%; }
  .tq-note { margin: 0 0 4px; }
  .tq-cols, .tq-col { gap: 8px; }
  .tq-attention { padding: 6px 10px 8px; }
  .tq-attention #home-attention-window { margin-top: 0; }
  .tq-att-list { margin-top: 4px; }
  .tq-att-row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "b b a" "m m m" "d d d"; column-gap: 8px; row-gap: 1px; padding: 6px 10px; min-height: 0; }
  .tq-att-row .e-main { display: contents; }
  .tq-att-row .tq-badge { grid-area: b; align-self: center; padding: 2px 8px; }
  .tq-att-row .e-title { grid-area: m; align-self: center; }
  .tq-att-row .tq-att-amt { grid-area: a; align-self: center; }
  .tq-att-row .tq-meta { grid-area: d; display: flex; flex-wrap: wrap; column-gap: 6px; align-items: baseline; min-width: 0; }
  .tq-att-row .tq-meta .e-sub { grid-area: auto; }
  .tq-att-row .tq-go { display: none; }
}
@media (max-width: 380px) and (max-height: 760px) { .tq-hero .hero-card.main .hc-value { font-size: 28px; } }
@media (max-width: 360px) and (max-height: 760px) { .tq-hero .hero-card:not(.main) .hc-value { font-size: 18px; } }

/* 320×568 và màn hẹp-thấp tương tự (rộng ≤ 340, cao ≤ 600): đầu app 2 hàng gọn — hàng 1: logo + "AI B7B | Tiền Biết Nói" (xuống 2 dòng) + chuông + Đăng xuất;
   hàng 2: "Đang xem … · Vai …" một dòng. Mọi nút vẫn cao 44 px (B2). Không ẩn chữ nào. */
@media (max-width: 340px) and (max-height: 600px) {
  .app-head { padding-top: 4px; padding-bottom: 4px; column-gap: 6px; }
  .brand { gap: 8px; }
  .brand strong { white-space: normal; line-height: 1.15; font-size: 15px; }
  .brand .brand-sep { margin: 0 4px; }
  .who .btn#logout-btn { order: 2; min-height: 44px; padding: 6px 10px; }
  .who-text { order: 3; flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; padding-top: 2px; }
  .who-text strong, .who-text small { display: inline; }
  .main { padding-top: 4px; }
}
/* S6-A: cảnh báo kỳ quá hạn ngoài cửa sổ nằm SAU danh sách việc (điện thoại dùng thứ tự flex ở khối Cần lo trước) */
.tq-outside { margin: 8px 0 0; }
@media (max-width: 720px) { .tq-attention #home-attention-outside { order: 2; } }
/* B2: "Xem N ví" ở bố cục thường cũng ≥ 44 px (trước 40 px) */
@media (max-width: 720px) { .tq-hero .hero-card.main .hc-toggle { min-height: 44px; } }
/* B1 (đo 320×568: đầu app 3 hàng vì khối thương hiệu giữ bề rộng tối đa khi xếp dòng) — cho khối thương hiệu co để "Đăng xuất" lên hàng 1 */
@media (max-width: 340px) and (max-height: 600px) {
  .brand { flex: 1 1 0; min-width: 0; }
  .brand > div { min-width: 0; }
}
/* Bố cục gọn: "có nhắc chưa đọc" cách dòng hạn bằng khoảng trống (không thêm dấu "·") để vừa một dòng ở màn hẹp */
@media (max-width: 720px) and (max-height: 760px) {
  .tq-att-row .tq-remind { margin-left: 0; }
  .tq-att-row .tq-remind::before { content: none; }
}
@media (max-width: 340px) and (max-height: 760px) {
  .tq-attention { padding-left: 8px; padding-right: 8px; }
  .tq-att-row { padding-left: 8px; padding-right: 8px; }
}
/* Câu "Tiền dự kiến chưa phải tiền đang có." nằm trong khối ba số: web trọn hàng dưới ba thẻ, điện thoại trọn hàng cuối thẻ (chữ 14 px như cũ) */
.tq-hero .tq-note { grid-column: 1 / -1; flex: 1 1 100%; margin: 2px 0 0; }
@media (max-width: 720px) and (max-height: 760px) {
  .tq-hero .tq-note { margin: 0; padding: 2px 0 6px; border-top: 1px solid var(--line); }
  .tq-page .home-head .home-month-field input { height: 44px; min-height: 44px; padding-top: 0; padding-bottom: 0; box-sizing: border-box; }
  .tq-hero .hero-card, .tq-hero .hero-card.main, .tq-hero .hero-card:not(.main) { padding-top: 5px; padding-bottom: 5px; }
  .tq-attention h3 { margin: 0; line-height: 1.25; }
  .tq-cols, .tq-col { gap: 6px; }
}
@media (max-width: 340px) and (max-height: 600px) {
  .tq-page .page-head.home-head { margin-bottom: 2px; row-gap: 2px; }
  .tq-page .home-head h2 { line-height: 1.15; }
  .tq-hero { margin-bottom: 4px; }
}
/* Bộ số lớn ở ≤ 340 px màn thấp (chế độ hàng): bớt đệm trên/dưới; thẻ ba số bớt đệm ngang */
@media (max-width: 340px) and (max-height: 760px) {
  .tq-hero { padding-left: 6px; padding-right: 6px; }
  .tq-hero.tq-hero-long .hero-card:not(.main) { padding-top: 3px; padding-bottom: 3px; }
}
/* K3 (Fresh KT trên bef9116): 375×548 (Safari iPhone SE khi thanh công cụ hiện) che tên + hạn việc đầu vì đầu app gọn chỉ áp ≤ 340 px.
   Mở rộng đúng cách xếp đầu app 2 hàng (Đăng xuất lên hàng 1, vẫn 44 px; "Đang xem … · Vai …" một dòng) cho mọi bề rộng điện thoại ở màn cao ≤ 600 px. */
@media (max-width: 720px) and (max-height: 600px) {
  .app-head { padding-top: 4px; padding-bottom: 4px; column-gap: 6px; }
  .brand { gap: 8px; flex: 1 1 0; min-width: 0; }
  .brand > div { min-width: 0; }
  .brand strong { white-space: normal; line-height: 1.15; }
  .brand .brand-sep { margin: 0 4px; }
  .who .btn#logout-btn { order: 2; min-height: 44px; padding: 6px 10px; }
  .who-text { order: 3; flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; padding-top: 2px; }
  .who-text strong, .who-text small { display: inline; }
  .main { padding-top: 4px; }
  .tq-page .page-head.home-head { margin-bottom: 2px; }
}
/* K3/B1: ở bề rộng ≥ 375 px sáu nhãn thanh dưới (12 px) vừa một dòng ⇒ thanh 56 px thay vì 66 px (không đổi chữ, không đổi vùng bấm ≥ 44 px) */
@media (min-width: 375px) and (max-width: 720px) {
  :root { --nav-h: 56px; }
  html:root .app-root .nav a { white-space: nowrap; min-height: 46px; }
}
/* Màn cao ≤ 600 px: bớt khoảng đệm giữa các khối (không đổi chữ, không bỏ dòng nào) */
@media (max-width: 720px) and (max-height: 600px) {
  .tq-hero { margin-bottom: 2px; }
  .tq-cols, .tq-col { gap: 4px; }
  .tq-attention { padding-top: 4px; }
  .tq-attention h3 { line-height: 1.15; }
  .tq-att-list { margin-top: 2px; }
}
@media (max-width: 720px) and (max-height: 600px) {
  .tq-att-row { padding-top: 5px; padding-bottom: 5px; }
  .tq-hero .tq-note { padding-bottom: 4px; }
  .tq-hero .hero-card, .tq-hero .hero-card.main, .tq-hero .hero-card:not(.main) { padding-top: 4px; padding-bottom: 4px; }
}
/* B1/K3 bộ ba số lớn ở màn cao ≤ 600 px: hai hàng Sắp nhận / Còn cần chi (chế độ hàng) bớt đệm trên/dưới — không đổi chữ */
@media (max-width: 720px) and (max-height: 600px) {
  .tq-hero.tq-hero-long .hero-card:not(.main) { padding-top: 2px; padding-bottom: 2px; }
}

/* ====================================================================================================
   SỬA GỘP UI TỔNG QUAN 24/11/2026 (phiếu Owner e918416d · nền 48fc4b2) — bám hai ảnh duyệt 20/11 (e6ce9b78 điện thoại, 49c9cc45 web).
   Giữ: menu web bên trái, menu điện thoại ở dưới, tên/thứ tự/đường dẫn/quyền; cỡ chữ; vùng bấm ≥ 44 px.
   ==================================================================================================== */
:root { --nav-ink: #1f3358; --nav-h: 68px; }

/* Menu theo ảnh: nhãn đậm (được xuống 2 dòng), biểu tượng nét đậm, mục đang chọn là khối nền tím nhạt bo tròn */
html:root .app-root .nav a { font-weight: 700; color: var(--nav-ink); }
html:root .app-root .nav svg { stroke-width: 2.2; }
html:root .app-root .nav a[aria-current="page"] { background: var(--nav-active-bg); color: var(--nav-active); border-radius: 14px; box-shadow: none; }
@media (max-width: 720px) {
  html:root .app-root .nav { height: var(--nav-h); padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); gap: 2px; justify-content: space-between; }
  html:root .app-root .nav a { font-size: 12.5px; line-height: 1.15; white-space: normal; min-height: 56px; margin: 0; padding: 4px 1px; gap: 2px; }
  html:root .app-root .nav a span { display: block; overflow-wrap: normal; word-break: normal; }
  html:root .app-root .nav svg { width: 22px; height: 22px; }
}
@media (min-width: 721px) { html:root .app-root .nav a { padding: 11px 14px; } html:root .app-root .nav svg { width: 22px; height: 22px; } }

/* Ba số tiền: "Đang có" nổi rõ hơn hai số dự kiến (cỡ số và khung); "Xem N ví" ở góc thẻ */
.tq-hero .hero-card.main { border: 1.5px solid var(--accent); box-shadow: 0 10px 28px rgba(75, 63, 216, .16); }
.tq-hero .hero-card.main .hc-value { font-weight: 800; }
.tq-hero .hero-card:not(.main) .hc-value { font-weight: 700; }
@media (min-width: 721px) {
  .tq-hero .hero-card { padding: 12px 18px; }
  .tq-hero .hero-card.main { position: relative; }
  .tq-hero .hero-card.main .hc-toggle { position: absolute; top: 6px; right: 12px; margin: 0; padding: 0 4px; min-height: 44px; display: inline-flex; align-items: center; }
  .tq-hero .hero-card.main .hc-value { font-size: 40px; }
  .tq-hero .hero-card:not(.main) .hc-value { font-size: 28px; }
}
@media (min-width: 1101px) { .tq-hero { grid-template-columns: 1.35fr 1fr 1fr; } .tq-hero .hero-card.main .hc-value { font-size: 44px; } .tq-hero .hero-card:not(.main) .hc-value { font-size: 30px; } }

/* Cần lo trước (điện thoại): chân thẻ một hàng [Xem tất cả ›  |  Mở lịch nghĩa vụ ›]; nút "Ghi thu hoặc chi" nằm NGAY SAU thẻ */
@media (max-width: 720px) {
  .tq-page .tq-attention { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 8px; align-content: start; }
  .tq-page .tq-attention .section-head { display: contents; }
  .tq-page .tq-attention .section-head > div { grid-column: 1 / -1; order: 0; }
  .tq-page .tq-attention .tq-att-list, .tq-page .tq-attention .tq-empty { grid-column: 1 / -1; order: 1; }
  .tq-page .tq-attention #home-attention-outside { grid-column: 1 / -1; order: 2; }
  .tq-page .tq-attention #home-attention-all { grid-column: 1; justify-self: start; order: 3; }
  .tq-page .tq-attention #home-open-calendar { grid-column: 2; justify-self: end; order: 3; }
}
/* Cảnh báo S6-A gọn: tóm tắt một đoạn ngắn + "Giải thích" (giữ nguyên câu K1 trong phần mở) */
.tq-outside { margin: 6px 0 2px; padding: 8px 10px; line-height: 1.35; }
.tq-outside .tq-more { margin-top: 2px; }
.tq-outside .tq-more summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.tq-outside .tq-more p { margin: 4px 0; }

/* Web ≥ 1101 px: nút "Ghi thu hoặc chi" nằm trong thẻ Cần lo trước (cuối thẻ, rộng hết thẻ) như ảnh web; "Thử trước khi mua" ngay dưới */
@media (min-width: 1101px) {
  .tq-left { gap: 0; }
  .tq-left .tq-attention { border-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; box-shadow: none; }
  .tq-left #home-cta { margin: 0; padding: 4px 16px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; background: var(--paper); border: 1px solid var(--accent-line); border-top: 0; border-left: 4px solid var(--gold-line); border-radius: 0 0 20px 20px; box-shadow: 0 6px 20px rgba(11, 36, 78, .06); }
  .tq-left #home-cta .btn.hero, .tq-left #home-cta .btn.secondary { width: 100%; flex: none; }
}

/* Hỏi Trợ lý theo ảnh: quả cầu, "Hỏi Trợ lý", "Xem lại trước khi lưu", mũi tên › (xoay xuống khi mở) */
.tq-assist .assist-toggle-caret { font-size: 28px; line-height: 1; color: var(--accent); transition: transform .15s; }
.tq-assist .assist-bar-toggle[aria-expanded="true"] .assist-toggle-caret { transform: rotate(90deg); }
.tq-assist .assist-toggle-sub { font-weight: 400; }

/* Đổi tháng: phần phụ thuộc tháng mờ đi + có dòng trạng thái khi dữ liệu tháng mới chưa về */
.tq-stale { opacity: .55; }
.tq-switching { margin: 0 0 6px; color: var(--accent); font-weight: 600; font-size: 14px; }
/* Bố cục gọn (màn cao ≤ 760): "Đang có" nổi bằng cỡ số, KHÔNG viền lồng trong thẻ gộp; bớt vài px đệm (không đổi chữ) */
@media (max-width: 720px) and (max-height: 760px) {
  .tq-hero .hero-card.main { border: 0; box-shadow: none; }
}
@media (max-width: 720px) and (max-height: 600px) {
  .tq-hero .tq-note { padding-bottom: 2px; }
  .tq-attention { padding-top: 2px; }
}
/* Cảnh báo S6-A nằm sau nút, ngoài thẻ: cách nút một khoảng nhỏ */
.tq-left > #home-attention-outside { margin: 8px 0 0; }
/* Web ≥ 1101: nút "Ghi thu hoặc chi" (≈ 65 % hàng) và "Thử trước khi mua" cùng một hàng cuối thẻ để nút chính thấy ngay ở màn đầu 1280×800 */
@media (min-width: 1101px) {
  .tq-left #home-cta { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: stretch; }
  .tq-left #home-cta .btn.hero { min-height: 56px; }
  .tq-page .page-head.home-head { margin-bottom: 10px; }
  .tq-hero .tq-note { margin-top: 0; }
}
/* "Xem tất cả ›" và "Mở lịch nghĩa vụ ›" cùng một hàng: web = góc phải tiêu đề thẻ; điện thoại = chân thẻ (trọn hàng, hai đầu) */
.tq-att-links { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; column-gap: 14px; }
@media (max-width: 720px) { .tq-page .tq-attention .section-head > .tq-att-links { grid-column: 1 / -1; order: 3; justify-content: space-between; } }
@media (min-width: 1101px) {
  .tq-hero .hero-card { padding: 10px 16px; }
  .tq-att-row { padding: 6px 12px; }
  .tq-att-list { gap: 6px; }
}

/* LOGO AI B7B (phiếu Owner bổ sung 24/11): rô-bốt cạnh tên "Tiền Biết Nói" ở đầu trang (web + điện thoại) và trang đăng nhập; chữ "AI B7B" navy như ảnh duyệt.
   Biểu tượng app (logo.png) không dùng ở đây. PNG có viền trong suốt nên không bo góc, không đổ bóng. */
.brand img, .auth-brand img { object-fit: contain; border-radius: 0; box-shadow: none; }
.brand img { width: 44px; height: 44px; }
.auth-brand img { width: 56px; height: 56px; }
.brand .brand-b7b, .auth-brand .brand-b7b { color: var(--head-ink, var(--navy)); }
@media (max-width: 720px) { .brand img { width: 40px; height: 40px; } }
@media (max-width: 720px) and (max-height: 600px) { .brand img { width: 34px; height: 34px; } }

/* ====================================================================================================
   CHỐT SỬA GỘP TỔNG QUAN 24/11 (phiếu Owner 2e28f798): việc 2 ô tháng tiếng Việt · việc 3 đầu trang theo CHUẨN_DAU_TRANG_B7B (92fdb646)
   ==================================================================================================== */
.tq-month { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; flex: 0 0 auto; border: 1.5px solid var(--accent-line); border-radius: 14px; background: var(--paper); color: var(--navy); font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: 0 2px 8px rgba(11, 36, 78, .06); }
.tq-month .tq-month-caret { color: var(--accent); font-size: 16px; line-height: 1; }
.tq-month input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.tq-month:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 720px) { .tq-page #home-period { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .tq-page .page-head.home-head > .tq-month { margin-top: 2px; } }
:root { --head-bg: #ffffff; --head-ink: #14264a; --brand-label: #4436af; --head-line: #d6dcf0; }
:root[data-theme="dark"] { --head-bg: #101b32; --head-ink: #f1f5ff; --brand-label: #c5baff; --head-line: #2b4068; }
.app-head { background: var(--head-bg); backdrop-filter: none; }
.brand strong { color: var(--head-ink); }
.brand .brand-b7b, .auth-brand .brand-b7b { color: var(--brand-label); }
:root[data-theme="dark"] .brand img { background: #e9eefb; border-radius: 10px; padding: 2px; box-sizing: border-box; }
@media (min-width: 1024px) { .app-head { padding-left: 24px; padding-right: 24px; } .brand { gap: 12px; } .brand img { width: 48px; height: 48px; } .brand strong { font-size: 24px; } }
@media (min-width: 600px) and (max-width: 1023px) { .app-head { padding-left: 16px; padding-right: 16px; } .brand { gap: 10px; } .brand img { width: 40px; height: 40px; } .brand strong { font-size: 20px; } }
@media (max-width: 599px) {
  .app-head { padding-left: 12px; padding-right: 12px; }
  .brand { gap: 8px; }
  .brand img { width: 36px; height: 36px; }
  .brand strong { display: flex; flex-direction: column; font-size: 18px; line-height: 1.15; white-space: normal; }
  .brand .brand-b7b { font-size: 13px; line-height: 1.1; }
  .brand .brand-sep { display: none; }
}

/* sửa theo kiểm: tên app đậm (chuẩn), vùng bấm ô tháng phủ cả viền ≥ 44 px */
.brand strong { font-weight: 700; }
.tq-month input { inset: -2px; width: calc(100% + 4px); height: calc(100% + 4px); }

/* CHỐT VỊ TRÍ NÚT GHI (phiếu Owner 25/11): màn thấp (rộng ≤ 599 px và cao ≤ 600 px) — nút "Ghi thu chi" cùng hàng ô tháng; giữ cỡ chữ 16 px, vùng bấm ≥ 44 px */
@media (max-width: 599px) and (max-height: 600px) {
  .tq-page .page-head.home-head { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 2px; }
  .tq-page .page-head.home-head > div:first-child { flex: 1 1 100%; }
  .tq-page .home-head > .tq-month { flex: 1 1 0; min-width: 0; padding: 0 8px; gap: 6px; justify-content: center; white-space: nowrap; }
  .tq-page .home-head > #home-new-entry { flex: 0 0 auto; width: auto; min-height: 44px; padding: 0 12px; white-space: nowrap; font-size: 16px; font-weight: 700; border-radius: 14px; margin: 0; letter-spacing: 0; box-shadow: none; }
  .tq-page .home-head > #home-new-entry .tq-plus { display: none; }
}
