/* =========================================================
   MyKT — giao diện
   Chàm làm màu thương hiệu, bạc hà = thu, san hô = chi.
   Font Be Vietnam Pro (thiết kế cho tiếng Việt), số dạng bảng.
   ========================================================= */

:root {
  --ink: #1c1e3a;
  --muted: #6a6e8c;
  --mist: #f4f5fb;
  --line: #e4e6f1;
  --surface: #ffffff;

  --indigo: #3b3fd8;
  --indigo-600: #2f33b8;
  --indigo-deep: #23256b;
  --indigo-50: #eceefe;
  --indigo-200: #c3c6f7;

  --mint: #12a87a;
  --mint-600: #0e8c66;
  --mint-50: #e3f6ef;
  --coral: #ef5a55;
  --coral-600: #d64843;
  --coral-50: #fdeceb;
  --sun: #ffc94d;

  --chart-in: #12a87a;
  --chart-out: #ef5a55;
  --chart-line: #3b3fd8;
  --chart-radius: 6;

  --r-hero: 22px;
  --r-panel: 16px;
  --r-ctl: 12px;

  /* Bootstrap 5.3 */
  --bs-body-font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .95rem;
  --bs-body-color: var(--ink);
  --bs-body-color-rgb: 28, 30, 58;
  --bs-body-bg: var(--surface);   /* nền thẻ, menu, ô nhập */
  --bs-secondary-color: var(--muted);
  --bs-emphasis-color: var(--ink);
  --bs-border-color: var(--line);
  --bs-border-color-translucent: var(--line);
  --bs-border-radius: var(--r-ctl);
  --bs-border-radius-sm: 9px;
  --bs-border-radius-lg: var(--r-panel);
  --bs-primary: var(--indigo);
  --bs-primary-rgb: 59, 63, 216;
  --bs-success-rgb: 18, 168, 122;
  --bs-danger-rgb: 239, 90, 85;
  --bs-info-rgb: 59, 63, 216;
  --bs-link-color: var(--indigo);
  --bs-link-color-rgb: 59, 63, 216;
  --bs-link-hover-color: var(--indigo-600);
  --bs-link-hover-color-rgb: 47, 51, 184;
  --bs-focus-ring-color: rgba(59, 63, 216, .25);
}

html { font-size: 15px; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
  background: var(--mist);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
body > .page { flex: 1 0 auto; }

h1, .h1, h2, .h2, h3, .h3, h4, .h4 { font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.text-muted { color: var(--muted) !important; }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn:hover, .nav-link:hover, .dropdown-item:hover, .page-link:hover { text-decoration: none; }

/* Số tiền: chữ số thẳng hàng */
.num, .table td.text-end, .amount { font-variant-numeric: tabular-nums; }
.amount-in { color: var(--mint-600); }
.amount-out { color: var(--coral-600); }

/* Focus rõ ràng cho bàn phím */
:focus-visible { outline: 3px solid var(--indigo-200); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 .22rem rgba(59, 63, 216, .2);
  border-color: var(--indigo);
  outline: none;
}

/* ---------------- Thanh trên ---------------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1030;
}
.topbar .navbar { padding-top: .6rem; padding-bottom: .6rem; }
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 800; font-size: 1.2rem; color: var(--ink);
  letter-spacing: -.02em;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark {
  position: relative;
  width: 30px; height: 30px; border-radius: 10px;
  background: var(--indigo);
  display: grid; place-items: center;
  color: #fff; font-size: .95rem; font-weight: 800;
}
.brand-mark::after {
  /* đồng xu vàng nhỏ ở góc */
  content: ""; position: absolute; top: -3px; right: -3px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--sun); border: 2px solid var(--surface);
}
.topbar .nav-link {
  color: var(--muted); font-weight: 500;
  border-radius: 999px; padding: .4rem .9rem !important;
}
.topbar .nav-link:hover { color: var(--ink); background: var(--mist); }
.topbar .nav-link.active { color: var(--indigo); background: var(--indigo-50); font-weight: 600; }
.topbar .navbar-toggler { border: 1px solid var(--line); border-radius: var(--r-ctl); }

.org-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--line); border-radius: 999px;
  padding: .3rem .8rem .3rem .35rem !important;
  color: var(--ink) !important; background: var(--surface);
  font-weight: 600; max-width: 260px;
}
.org-chip:hover { border-color: var(--indigo-200); background: var(--surface) !important; }
.org-chip .org-type {
  font-size: .72rem; font-weight: 600; color: var(--indigo);
  background: var(--indigo-50); border-radius: 999px; padding: .15rem .55rem;
}
.org-chip .org-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--ink); color: #fff; font-size: .8rem; font-weight: 700;
}

/* ---------------- Thẻ & khung ---------------- */
.card {
  --bs-card-border-color: var(--line);
  --bs-card-border-radius: var(--r-panel);
  --bs-card-inner-border-radius: calc(var(--r-panel) - 1px);
  --bs-card-cap-bg: transparent;
  --bs-card-spacer-y: 1.1rem;
  --bs-card-spacer-x: 1.25rem;
  box-shadow: none !important;
}
.card-header { font-weight: 600; border-bottom-color: var(--line); padding-top: .9rem; padding-bottom: .9rem; }
.list-group { --bs-list-group-border-color: var(--line); }
.list-group-item.bg-light { background: var(--mist) !important; color: var(--muted); font-weight: 600; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.6rem; margin: 0; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: .2rem; }

/* ---------------- Nút ---------------- */
.btn { font-weight: 600; border-radius: var(--r-ctl); padding: .5rem 1rem; }
.btn-sm { border-radius: 9px; padding: .3rem .7rem; }
.btn-lg { padding: .7rem 1.3rem; }
.btn-primary {
  --bs-btn-bg: var(--indigo); --bs-btn-border-color: var(--indigo);
  --bs-btn-hover-bg: var(--indigo-600); --bs-btn-hover-border-color: var(--indigo-600);
  --bs-btn-active-bg: var(--indigo-600); --bs-btn-active-border-color: var(--indigo-600);
  --bs-btn-disabled-bg: var(--indigo); --bs-btn-disabled-border-color: var(--indigo);
}
.btn-outline-primary {
  --bs-btn-color: var(--indigo); --bs-btn-border-color: var(--indigo-200);
  --bs-btn-hover-bg: var(--indigo-50); --bs-btn-hover-color: var(--indigo); --bs-btn-hover-border-color: var(--indigo-200);
  --bs-btn-active-bg: var(--indigo); --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--indigo);
}
.btn-outline-secondary {
  --bs-btn-color: var(--ink); --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: var(--mist); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line);
  --bs-btn-active-bg: var(--line); --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: var(--line);
}
.btn-outline-danger {
  --bs-btn-color: var(--coral-600); --bs-btn-border-color: #f6c3c1;
  --bs-btn-hover-bg: var(--coral-50); --bs-btn-hover-color: var(--coral-600); --bs-btn-hover-border-color: #f6c3c1;
  --bs-btn-active-bg: var(--coral); --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--coral);
}
.btn-outline-success {
  --bs-btn-color: var(--mint-600); --bs-btn-border-color: #a9e2cf;
  --bs-btn-hover-bg: var(--mint-50); --bs-btn-hover-color: var(--mint-600); --bs-btn-hover-border-color: #a9e2cf;
  --bs-btn-active-bg: var(--mint); --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--mint);
}
/* Nút Thu / Chi: nền nhạt, chữ đậm màu — gọn mắt hơn khối đặc */
.btn-success, .btn-danger { border-width: 1px; }
.btn-success {
  --bs-btn-color: var(--mint-600); --bs-btn-bg: var(--mint-50); --bs-btn-border-color: var(--mint-50);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--mint); --bs-btn-hover-border-color: var(--mint);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--mint-600); --bs-btn-active-border-color: var(--mint-600);
}
.btn-danger {
  --bs-btn-color: var(--coral-600); --bs-btn-bg: var(--coral-50); --bs-btn-border-color: var(--coral-50);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--coral); --bs-btn-hover-border-color: var(--coral);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--coral-600); --bs-btn-active-border-color: var(--coral-600);
}
.btn-link { --bs-btn-color: var(--muted); --bs-btn-hover-color: var(--ink); font-weight: 500; text-decoration: none; }

/* Nhóm lựa chọn Thu/Chi trong form */
.type-switch { background: var(--mist); border-radius: 14px; padding: 4px; display: flex; gap: 4px; }
.type-switch .btn { flex: 1; border: 0; border-radius: 11px; color: var(--muted); background: transparent; }
.type-switch .btn-check:checked + .btn-outline-danger { background: var(--surface); color: var(--coral-600); box-shadow: 0 1px 2px rgba(28, 30, 58, .08); }
.type-switch .btn-check:checked + .btn-outline-success { background: var(--surface); color: var(--mint-600); box-shadow: 0 1px 2px rgba(28, 30, 58, .08); }

/* Nhóm phân đoạn ngày/tuần/tháng */
.segmented { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; display: inline-flex; }
.segmented a { padding: .32rem 1rem; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .88rem; }
.segmented a:hover { color: var(--ink); text-decoration: none; }
.segmented a.on { background: var(--ink); color: #fff; }

/* ---------------- Form ---------------- */
.form-label { font-weight: 500; font-size: .88rem; color: var(--muted); margin-bottom: .3rem; }
.form-control, .form-select { border-color: var(--line); background-color: var(--surface); padding: .55rem .8rem; }
.form-control-sm, .form-select-sm { padding: .35rem .65rem; border-radius: 9px; }
.form-control-lg { font-size: 1.15rem; font-weight: 600; }
.input-group-text { background: var(--mist); border-color: var(--line); color: var(--muted); font-weight: 600; }
.form-check-input:checked { background-color: var(--indigo); border-color: var(--indigo); }
.form-text { color: var(--muted); }

.filter-bar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: .9rem 1rem; margin-bottom: 1.25rem; }

/* ---------------- Bảng ---------------- */
.table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--mist);
  --bs-table-border-color: var(--line);
  margin-bottom: 0;
}
.table > thead th {
  font-size: .78rem; font-weight: 600; color: var(--muted);
  background: transparent !important; border-bottom-width: 1px;
  padding-top: .8rem; padding-bottom: .8rem; white-space: nowrap;
}
.table > tbody td { padding-top: .75rem; padding-bottom: .75rem; }
.table > tbody tr:last-child td { border-bottom: 0; }

/* ---------------- Nhãn ---------------- */
.badge { font-weight: 600; border-radius: 999px; padding: .32em .7em; }
.badge.chip-in { background: var(--mint-50); color: var(--mint-600); }
.badge.chip-out { background: var(--coral-50); color: var(--coral-600); }
.badge.bg-secondary { background: var(--mist) !important; color: var(--muted); border: 1px solid var(--line); }
.badge.bg-info { background: var(--indigo-50) !important; color: var(--indigo); }
.badge.bg-primary { background: var(--indigo) !important; }
.badge.bg-warning { background: #fff4d6 !important; color: #8a6200 !important; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .45rem; vertical-align: 1px; }

/* ---------------- Thông báo, menu, phân trang ---------------- */
.alert { border-radius: var(--r-ctl); border: 0; }
.alert-success { background: var(--mint-50); color: #0b6b4e; }
.alert-danger { background: var(--coral-50); color: #a2312d; }
.alert-warning { background: #fff4d6; color: #7a5600; }
.alert-info { background: var(--indigo-50); color: var(--indigo-deep); }

.dropdown-menu {
  --bs-dropdown-border-color: var(--line);
  --bs-dropdown-border-radius: 14px;
  --bs-dropdown-link-active-bg: var(--indigo-50);
  --bs-dropdown-link-active-color: var(--indigo);
  --bs-dropdown-link-hover-bg: var(--mist);
  padding: .4rem; box-shadow: 0 12px 32px rgba(28, 30, 58, .12);
}
.dropdown-item { border-radius: 9px; padding: .45rem .7rem; }

.pagination {
  --bs-pagination-border-color: var(--line);
  --bs-pagination-color: var(--ink);
  --bs-pagination-hover-bg: var(--mist);
  --bs-pagination-active-bg: var(--ink);
  --bs-pagination-active-border-color: var(--ink);
  --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(59, 63, 216, .2);
  gap: 4px;
}
.pagination .page-link { border-radius: 9px !important; }

.progress { background: var(--mist); }

/* ---------------- Tổng quan: khối số dư ---------------- */
.balance-hero {
  position: relative; overflow: hidden;
  background: var(--indigo-deep);
  color: #fff;
  border-radius: var(--r-hero);
  padding: 1.6rem 1.75rem 1.4rem;
  margin-bottom: 1.25rem;
}
.balance-hero::before {
  /* một vệt sáng nhẹ góc phải, không phải gradient trang trí cả khối */
  content: ""; position: absolute; right: -80px; top: -120px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 128, 255, .45), rgba(124, 128, 255, 0) 70%);
  pointer-events: none;
}
.balance-hero .label { color: rgba(255, 255, 255, .7); font-size: .9rem; }
.balance-hero .balance {
  font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 800; letter-spacing: -.03em;
  line-height: 1.1; font-variant-numeric: tabular-nums; margin-top: .25rem;
}
.balance-hero .balance.neg { color: #ffb3b0; }
.balance-hero .balance .cur { font-size: .45em; font-weight: 600; opacity: .7; margin-left: .3rem; letter-spacing: 0; }
.split-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .12); gap: 3px; }
.split-bar .in { background: #3fd9a6; }
.split-bar .out { background: #ff8380; }
.split-legend { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: .8rem; }
.split-legend .k { color: rgba(255, 255, 255, .7); font-size: .82rem; }
.split-legend .v { font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.split-legend .v.in { color: #7ff0c9; }
.split-legend .v.out { color: #ffaaa7; }
.balance-hero .hero-actions { position: relative; display: flex; gap: .5rem; }
.balance-hero .btn-hero {
  background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .18);
}
.balance-hero .btn-hero:hover { background: rgba(255, 255, 255, .22); color: #fff; }

/* Danh sách giao dịch gần đây */
.tx-row { display: flex; align-items: center; gap: .85rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--line); }
.tx-row:last-child { border-bottom: 0; }
.tx-icon {
  width: 38px; height: 38px; flex: none; border-radius: 12px;
  display: grid; place-items: center; font-weight: 700; font-size: .95rem;
}
.tx-main { flex: 1; min-width: 0; }
.tx-main .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-main .m { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Ô tổng nhỏ (trang thu chi) */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: .8rem 1rem; }
.stat .k { color: var(--muted); font-size: .8rem; }
.stat .v { font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* ---------------- Đăng nhập / đăng ký ---------------- */
.auth-wrap { min-height: calc(100vh - 160px); display: grid; place-items: center; padding: 1.5rem 0; }
.auth-card {
  width: 100%; max-width: 880px; display: grid; grid-template-columns: 1fr;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-hero); overflow: hidden;
}
@media (min-width: 768px) { .auth-card { grid-template-columns: 1fr 1fr; } }
.auth-side {
  display: none; background: var(--indigo-deep); color: #fff; padding: 2.5rem; position: relative; overflow: hidden;
}
@media (min-width: 768px) { .auth-side { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-side h2 { color: #fff; font-size: 1.7rem; line-height: 1.25; max-width: 16ch; }
.auth-side p { color: rgba(255, 255, 255, .72); max-width: 32ch; }
.auth-side .mini-ledger { background: rgba(255, 255, 255, .08); border-radius: 14px; padding: .9rem 1rem; font-size: .88rem; }
.auth-side .mini-ledger div { display: flex; justify-content: space-between; padding: .25rem 0; font-variant-numeric: tabular-nums; }
.auth-side .mini-ledger .in { color: #7ff0c9; }
.auth-side .mini-ledger .out { color: #ffaaa7; }
.auth-form { padding: 2.25rem 2rem; }
.auth-form h1 { font-size: 1.5rem; margin-bottom: .35rem; }

/* ---------------- Nút thêm nhanh trên điện thoại ---------------- */
.fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 1040;
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--indigo); color: #fff; font-size: 1.8rem; line-height: 1;
  display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(59, 63, 216, .35);
}
.fab:hover { color: #fff; background: var(--indigo-600); text-decoration: none; }
@media (min-width: 992px) { .fab { display: none; } }

/* ---------------- Chân trang ---------------- */
.site-footer { color: var(--muted); font-size: .82rem; padding: 1.5rem 0; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav-link, .segmented a, .org-chip, .fab { transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
}

/* Tóm tắt lỗi form: ẩn khi không có lỗi */
.validation-summary-valid { display: none; }
.validation-summary-errors ul { margin: 0; padding-left: 1rem; }
.list-group-item-primary { background: var(--indigo-50); color: var(--ink); }
.rounded-4 { border-radius: var(--r-panel) !important; }

.balance-hero > .d-flex:first-child { margin-bottom: 1.2rem; }
@media (max-width: 991.98px) { body > .page { padding-bottom: 72px; } }


/* =========================================================
   Trang chọn giao diện
   ========================================================= */
.theme-option {
  display: block; height: 100%; cursor: pointer;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-panel);
  padding: 1rem;
}
.theme-option:hover { border-color: var(--indigo-200); }
.btn-check:checked + .theme-option { border-color: var(--indigo); }
.btn-check:focus-visible + .theme-option { outline: 3px solid var(--indigo-200); outline-offset: 2px; }

.theme-preview {
  display: grid; gap: 6px; padding: 8px; height: 150px;
  border-radius: 12px; overflow: hidden; grid-template-rows: 14px 44px 1fr;
}
.theme-preview .tp-bar { display: flex; gap: 5px; align-items: center; padding: 0 6px; border-radius: 4px; }
.theme-preview .tp-bar i { width: 18px; height: 4px; border-radius: 2px; }
.theme-preview .tp-hero { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 0 10px; }
.theme-preview .tp-hero b { width: 46%; height: 9px; border-radius: 3px; }
.theme-preview .tp-hero em { display: flex; height: 4px; gap: 2px; }
.theme-preview .tp-hero u.a { flex: 3; } .theme-preview .tp-hero u.b { flex: 2; }
.theme-preview .tp-tiles, .theme-preview .tp-rows { display: none; }
.theme-preview s { display: block; text-decoration: none; }

/* Xem trước: Cổ điển */
.tp-classic { background: #eef1f5; grid-template-rows: 14px 44px 1fr; }
.tp-classic .tp-bar { background: #1f3b63; border-radius: 3px; }
.tp-classic .tp-bar i { background: rgba(255,255,255,.6); }
.tp-classic .tp-hero { background: #fff; border: 1px solid #d5dbe3; border-top: 3px solid #1f3b63; border-radius: 3px; }
.tp-classic .tp-hero b { background: #1f3b63; }
.tp-classic .tp-hero u.a { background: #2e7d32; } .tp-classic .tp-hero u.b { background: #c62828; }
.tp-classic .tp-rows { display: grid; gap: 0; background: #fff; border: 1px solid #d5dbe3; border-radius: 3px; }
.tp-classic .tp-rows s { border-bottom: 1px solid #d5dbe3; }
.tp-classic .tp-rows s:nth-child(even) { background: #f5f7fa; }

/* Xem trước: Hiện đại tối giản */
.tp-modern { background: #f4f5fb; }
.tp-modern .tp-bar { background: #fff; border: 1px solid #e4e6f1; border-radius: 6px; }
.tp-modern .tp-bar i { background: #c3c6f7; }
.tp-modern .tp-hero { background: #23256b; border-radius: 10px; }
.tp-modern .tp-hero b { background: #fff; }
.tp-modern .tp-hero u.a { background: #3fd9a6; border-radius: 2px; } .tp-modern .tp-hero u.b { background: #ff8380; border-radius: 2px; }
.tp-modern .tp-rows { display: grid; background: #fff; border: 1px solid #e4e6f1; border-radius: 8px; padding: 0 8px; }
.tp-modern .tp-rows s { border-bottom: 1px solid #e4e6f1; }
.tp-modern .tp-rows s:last-child { border: 0; }

/* Xem trước: Thẻ trực quan */
.tp-cards { background: #eef0f8; grid-template-rows: 14px 44px 1fr; }
.tp-cards .tp-bar { background: transparent; }
.tp-cards .tp-bar i { background: #3b3fd8; height: 8px; border-radius: 4px; }
.tp-cards .tp-hero { background: #fff; border-radius: 12px; box-shadow: 0 4px 10px rgba(28,30,58,.06); }
.tp-cards .tp-hero b { background: #23256b; }
.tp-cards .tp-hero em { display: none; }
.tp-cards .tp-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tp-cards .tp-tiles s { border-radius: 10px; }
.tp-cards .tp-tiles .a { background: #d4f3e7; } .tp-cards .tp-tiles .b { background: #fddcda; } .tp-cards .tp-tiles .c { background: #dfe1fd; }

/* =========================================================
   GIAO DIỆN: CỔ ĐIỂN
   Sổ kế toán quen thuộc: menu xanh đậm, góc vuông vắn,
   bảng kẻ dòng xen màu, tiêu đề chữ có chân (Noto Serif).
   ========================================================= */
[data-theme="classic"] {
  --ink: #1d2733;
  --muted: #5c6b7a;
  --mist: #eef1f5;
  --line: #d5dbe3;
  --indigo: #1f3b63;
  --indigo-600: #172e4e;
  --indigo-deep: #1f3b63;
  --indigo-50: #e6ecf4;
  --indigo-200: #a9bad1;
  --mint: #2e7d32; --mint-600: #256628; --mint-50: #e6f2e7;
  --coral: #c62828; --coral-600: #a92121; --coral-50: #f9e5e5;
  --sun: #c9a227;
  --r-hero: 6px; --r-panel: 6px; --r-ctl: 4px;
  --chart-in: #2e7d32; --chart-out: #c62828; --chart-line: #1f3b63; --chart-radius: 0;
  --bs-primary-rgb: 31, 59, 99;
  --bs-success-rgb: 46, 125, 50;
  --bs-danger-rgb: 198, 40, 40;
  --bs-link-color-rgb: 31, 59, 99;
  --bs-link-hover-color-rgb: 23, 46, 78;
  --bs-border-radius-sm: 3px;
}
[data-theme="classic"] h1, [data-theme="classic"] .h1, [data-theme="classic"] h2,
[data-theme="classic"] h3, [data-theme="classic"] .h4, [data-theme="classic"] h4,
[data-theme="classic"] .brand, [data-theme="classic"] .balance-hero .balance,
[data-theme="classic"] .auth-side h2 {
  font-family: "Noto Serif", Georgia, "Times New Roman", serif; letter-spacing: 0;
}
[data-theme="classic"] .topbar { background: var(--indigo); border-bottom: 3px solid var(--sun); }
[data-theme="classic"] .brand, [data-theme="classic"] .brand:hover { color: #fff; }
[data-theme="classic"] .brand-mark { background: #fff; color: var(--indigo); border-radius: 4px; }
[data-theme="classic"] .brand-mark::after { border-color: var(--indigo); }
[data-theme="classic"] .topbar .nav-link { color: rgba(255,255,255,.75); border-radius: 0; }
[data-theme="classic"] .topbar .nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
[data-theme="classic"] .topbar .nav-link.active { color: #fff; background: transparent; box-shadow: inset 0 -3px 0 var(--sun); }
[data-theme="classic"] .topbar .navbar-toggler { border-color: rgba(255,255,255,.4); }
[data-theme="classic"] .topbar .navbar-toggler-icon { filter: invert(1); }
[data-theme="classic"] .org-chip { border-radius: 4px; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff !important; }
[data-theme="classic"] .org-chip:hover { background: rgba(255,255,255,.18) !important; }
[data-theme="classic"] .org-chip .org-type { background: var(--sun); color: var(--ink); border-radius: 3px; }
[data-theme="classic"] .avatar { background: #fff; color: var(--indigo); border-radius: 4px; }

[data-theme="classic"] .card-header { background: #f5f7fa; font-family: "Noto Serif", Georgia, serif; }
[data-theme="classic"] .table > thead th { background: #f5f7fa !important; color: var(--ink); border-bottom: 2px solid var(--line); }
[data-theme="classic"] .table > tbody tr:nth-child(even) > td { background: #f8fafc; }
[data-theme="classic"] .badge, [data-theme="classic"] .segmented, [data-theme="classic"] .segmented a,
[data-theme="classic"] .type-switch, [data-theme="classic"] .type-switch .btn,
[data-theme="classic"] .pagination .page-link, [data-theme="classic"] .tx-icon,
[data-theme="classic"] .dropdown-item, [data-theme="classic"] .split-bar { border-radius: 3px !important; }
[data-theme="classic"] .segmented a.on { background: var(--indigo); }
[data-theme="classic"] .btn-success { --bs-btn-color: #fff; --bs-btn-bg: var(--mint); --bs-btn-border-color: var(--mint); }
[data-theme="classic"] .btn-danger { --bs-btn-color: #fff; --bs-btn-bg: var(--coral); --bs-btn-border-color: var(--coral); }

[data-theme="classic"] .balance-hero {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-top: 4px solid var(--indigo);
}
[data-theme="classic"] .balance-hero::before { display: none; }
[data-theme="classic"] .balance-hero .label, [data-theme="classic"] .split-legend .k { color: var(--muted); }
[data-theme="classic"] .balance-hero .balance { color: var(--indigo); }
[data-theme="classic"] .balance-hero .balance.neg { color: var(--coral); }
[data-theme="classic"] .split-bar { background: var(--mist); height: 8px; }
[data-theme="classic"] .split-bar .in { background: var(--mint); }
[data-theme="classic"] .split-bar .out { background: var(--coral); }
[data-theme="classic"] .split-legend .v.in { color: var(--mint-600); }
[data-theme="classic"] .split-legend .v.out { color: var(--coral-600); }
[data-theme="classic"] .split-legend > div + div { border-left: 1px solid var(--line); padding-left: 1.5rem; }
[data-theme="classic"] .balance-hero .btn-hero { background: var(--surface); color: var(--indigo); border-color: var(--line); }
[data-theme="classic"] .balance-hero .btn-hero:hover { background: var(--indigo-50); color: var(--indigo); }

[data-theme="classic"] .auth-side { background: var(--indigo); }
[data-theme="classic"] .fab { border-radius: 50%; box-shadow: 0 6px 16px rgba(31,59,99,.35); }

/* =========================================================
   GIAO DIỆN: THẺ TRỰC QUAN
   Mọi khối là thẻ trắng bo tròn lớn nổi trên nền,
   số liệu chính thành ô màu, danh sách tách thẻ rời.
   ========================================================= */
[data-theme="cards"] {
  --mist: #eef0f8;
  --r-hero: 26px; --r-panel: 22px; --r-ctl: 14px;
  --chart-radius: 10;
}
[data-theme="cards"] .card {
  border: 0;
  box-shadow: 0 6px 20px rgba(28, 30, 58, .06) !important;
}
[data-theme="cards"] .card-header { border-bottom: 0; font-size: 1.05rem; padding-top: 1.1rem; }
[data-theme="cards"] .filter-bar, [data-theme="cards"] .stat, [data-theme="cards"] .auth-card { border: 0; box-shadow: 0 6px 20px rgba(28, 30, 58, .06); }
[data-theme="cards"] .topbar { background: transparent; border-bottom: 0; position: static; }
[data-theme="cards"] .topbar .navbar { padding-top: 1rem; }
[data-theme="cards"] .topbar .nav-link.active { background: var(--indigo); color: #fff; }
[data-theme="cards"] .topbar .nav-link:hover { background: var(--surface); }
[data-theme="cards"] .org-chip { border: 0; box-shadow: 0 2px 8px rgba(28, 30, 58, .06); }

/* Khối số dư: thẻ trắng, ba ô màu cho thu / chi / tỷ lệ */
[data-theme="cards"] .balance-hero {
  background: var(--surface); color: var(--ink);
  box-shadow: 0 6px 20px rgba(28, 30, 58, .06);
}
[data-theme="cards"] .balance-hero::before { display: none; }
[data-theme="cards"] .balance-hero .label { color: var(--muted); }
[data-theme="cards"] .balance-hero .balance { color: var(--indigo-deep); }
[data-theme="cards"] .balance-hero .balance.neg { color: var(--coral-600); }
[data-theme="cards"] .split-bar { display: none; }
[data-theme="cards"] .split-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-top: 0; }
[data-theme="cards"] .split-legend > div { border-radius: 18px; padding: 1rem 1.1rem; background: var(--indigo-50); }
[data-theme="cards"] .split-legend > div:nth-child(1) { background: var(--mint-50); }
[data-theme="cards"] .split-legend > div:nth-child(2) { background: var(--coral-50); }
[data-theme="cards"] .split-legend .k { color: var(--muted); font-weight: 500; }
[data-theme="cards"] .split-legend .v { font-size: 1.45rem; color: var(--indigo-deep); }
[data-theme="cards"] .split-legend .v.in { color: var(--mint-600); }
[data-theme="cards"] .split-legend .v.out { color: var(--coral-600); }
[data-theme="cards"] .balance-hero .btn-hero { background: var(--mist); color: var(--ink); border: 0; }
[data-theme="cards"] .balance-hero .btn-hero:hover { background: var(--indigo); color: #fff; }

/* Danh sách giao dịch gần đây: mỗi dòng là một thẻ nhỏ */
[data-theme="cards"] .tx-row { border: 0; margin: 0 .75rem .6rem; border-radius: 16px; background: var(--mist); }
[data-theme="cards"] .tx-row:first-child { margin-top: .25rem; }
[data-theme="cards"] .tx-row:hover { background: var(--indigo-50); }
[data-theme="cards"] .tx-icon { border-radius: 50%; }
[data-theme="cards"] .list-group-flush > .list-group-item { border: 0; }
[data-theme="cards"] .list-group-item.bg-light { background: transparent !important; padding-bottom: 0; }

[data-theme="cards"] .stat .v { font-size: 1.35rem; }
[data-theme="cards"] .row > .col-4:nth-child(1) > .stat { background: var(--mint-50); }
[data-theme="cards"] .row > .col-4:nth-child(2) > .stat { background: var(--coral-50); }
[data-theme="cards"] .row > .col-4:nth-child(3) > .stat { background: var(--indigo-50); }
[data-theme="cards"] .segmented { border: 0; box-shadow: 0 2px 8px rgba(28, 30, 58, .06); }
[data-theme="cards"] .segmented a.on { background: var(--indigo); }
[data-theme="cards"] .fab { border-radius: 50%; }


/* =========================================================
   Icon danh mục (Font Awesome) — ô tô nhạt bằng màu danh mục
   ========================================================= */
.cat-icon {
  --c: #9aa0bf;
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 11px;
  background: color-mix(in srgb, var(--c) 15%, transparent);
  color: var(--c); font-size: .95rem; vertical-align: middle;
}
.cat-icon.sm { width: 26px; height: 26px; border-radius: 8px; font-size: .75rem; margin-right: .5rem; }
.cat-icon.lg { width: 52px; height: 52px; border-radius: 16px; font-size: 1.4rem; }
[data-theme="classic"] .cat-icon { border-radius: 4px; }
[data-theme="cards"] .cat-icon { border-radius: 50%; }

/* Bảng chọn icon */
.icon-picker { position: relative; max-height: 340px; overflow-y: auto; padding-right: .25rem; }
.icon-picker .grp { font-size: .78rem; color: var(--muted); font-weight: 600; margin: .75rem 0 .35rem; }
.icon-picker .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.icon-picker label {
  display: grid; place-items: center; height: 42px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface);
}
.icon-picker label:hover { border-color: var(--indigo-200); color: var(--ink); }
.icon-picker .btn-check:checked + label { border: 2px solid var(--pick, var(--indigo)); color: var(--pick, var(--indigo)); background: color-mix(in srgb, var(--pick, var(--indigo)) 10%, transparent); }
.icon-picker .btn-check:focus-visible + label { outline: 3px solid var(--indigo-200); outline-offset: 1px; }
.cat-preview { display: flex; align-items: center; gap: .9rem; padding: .9rem 1rem; border-radius: var(--r-panel); background: var(--mist); }

/* =========================================================
   Trang giới thiệu & trang pháp lý (công khai)
   ========================================================= */
.landing-hero { padding: 2.5rem 0 3rem; }
.landing-title { font-size: clamp(2rem, 4.5vw, 3.1rem); font-weight: 800; line-height: 1.12; letter-spacing: -.03em; max-width: 15ch; }
.landing-lead { font-size: 1.12rem; color: var(--muted); max-width: 46ch; margin: 1rem 0 1.6rem; }

.chat-demo {
  background: #e7edf3; border-radius: var(--r-hero); padding: 1rem 1rem 1.25rem;
  display: flex; flex-direction: column; gap: .55rem; max-width: 440px; margin-left: auto;
  border: 1px solid var(--line);
}
.chat-head { font-weight: 700; color: var(--ink); padding: .2rem .3rem .5rem; font-size: .92rem; }
.chat-head .fa-telegram { color: #229ed9; margin-right: .3rem; }
.msg { max-width: 82%; padding: .55rem .8rem; border-radius: 14px; font-size: .92rem; line-height: 1.4; box-shadow: 0 1px 1px rgba(28,30,58,.06); }
.msg.me { align-self: flex-end; background: #e1f7c9; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.msg.photo span { color: var(--muted); }
.msg.photo .fa-image { color: var(--muted); margin-right: .3rem; }

.landing-section { padding: 2rem 0; border-top: 1px solid var(--line); }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 1.2rem; height: 100%; }
.feature h3 { font-size: 1.02rem; font-weight: 700; margin: .8rem 0 .35rem; }
.feature p { color: var(--muted); margin: 0; font-size: .93rem; }

.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: .9rem; max-width: 760px; }
.steps li { counter-increment: s; position: relative; padding-left: 3rem; color: var(--muted); }
.steps li b { color: var(--ink); }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: -.1rem;
  width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--indigo-50); color: var(--indigo); font-weight: 800;
}

.landing-cta { background: var(--indigo-deep); color: #fff; border-radius: var(--r-hero); padding: 2rem; margin: 1.5rem 0 1rem; text-align: center; }
.landing-cta h2 { color: #fff; }
.landing-cta p { color: rgba(255,255,255,.75); }

.legal { max-width: 74ch; margin: 0 auto; padding-bottom: 2rem; }
.legal h1 { font-size: 1.9rem; margin-bottom: .3rem; }
.legal .updated { color: var(--muted); margin-bottom: 1.5rem; }
.legal h2 { font-size: 1.15rem; margin: 1.8rem 0 .6rem; }
.legal p, .legal li { line-height: 1.7; }
.legal ul { padding-left: 1.2rem; }
.legal .note { background: var(--indigo-50); border-radius: var(--r-ctl); padding: .9rem 1rem; }

@media (max-width: 991.98px) { .chat-demo { margin: 0 auto; } }

/* Thanh tiến trình khi chuyển trang */
#navProgress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 2000;
  background: var(--indigo); opacity: 0; pointer-events: none;
  box-shadow: 0 0 8px rgba(59, 63, 216, .5);
}
#navProgress.on { opacity: 1; width: 85%; transition: width 8s cubic-bezier(.1, .7, .2, 1), opacity .15s; }
[data-theme="classic"] #navProgress { background: var(--sun); box-shadow: none; }
@media (prefers-reduced-motion: reduce) {
  #navProgress.on { width: 100%; transition: none; }
}

/* =========================================================
   ĐIỆN THOẠI (ưu tiên iPhone 12 Pro: 390 x 844, có tai thỏ & thanh Home)
   ========================================================= */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
.topbar { padding-top: env(safe-area-inset-top); }

/* Thanh điều hướng dưới đáy */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
  display: flex; align-items: flex-end; justify-content: space-around;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
}
.bn-item {
  flex: 1; min-width: 0; min-height: 50px; padding: 4px 0 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 10.5px; font-weight: 600; text-decoration: none !important;
  background: none; border: 0;
}
.bn-item i { font-size: 1.2rem; }
.bn-item.active { color: var(--indigo); }
.bn-add {
  flex: none; width: 56px; height: 56px; margin: -22px 6px 2px; border-radius: 50%;
  display: grid; place-items: center; color: #fff !important; font-size: 1.4rem; text-decoration: none !important;
  background: var(--indigo); box-shadow: 0 8px 20px rgba(59, 63, 216, .35); border: 4px solid var(--mist);
}
[data-theme="classic"] .bottom-nav { background: rgba(255,255,255,.97); }
[data-theme="classic"] .bn-add { border-radius: 14px; }

/* Bảng "Thêm" trượt từ dưới lên */
.more-sheet.offcanvas-bottom {
  height: auto; max-height: 85vh; border-radius: 20px 20px 0 0; border: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.more-sheet .offcanvas-header::before {
  content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 4px; border-radius: 2px; background: var(--line);
}
.more-sheet .offcanvas-header { position: relative; padding-top: 1.4rem; }
.sheet-group { background: var(--mist); border-radius: 14px; margin-bottom: .75rem; overflow: hidden; }
.sheet-group:empty { display: none; }
.sheet-group a {
  display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem; min-height: 48px;
  color: var(--ink); font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--line);
}
.sheet-group a:last-child { border-bottom: 0; }
.sheet-group a i { width: 20px; text-align: center; color: var(--indigo); }

/* Danh sách giao dịch dạng thẻ (điện thoại) */
.day-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: .9rem .25rem .35rem; font-size: .82rem; color: var(--muted); font-weight: 600;
}
.day-head .sum { font-variant-numeric: tabular-nums; font-weight: 600; }
.tx-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.tx-list .tx-row { padding: .8rem .9rem; }
.tx-list .tx-row .tx-icon { width: 40px; height: 40px; }
[data-theme="cards"] .tx-list { border: 0; background: transparent; }
[data-theme="cards"] .tx-list .tx-row { margin: 0 0 .5rem; background: var(--surface); box-shadow: 0 4px 14px rgba(28,30,58,.05); }

/* Bảng tự đổi thành thẻ trên màn hình hẹp: thêm class table-stack và data-label cho từng ô */
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { border: 0 !important; padding: .2rem 0 !important; text-align: left !important; background: transparent !important; }
  .table-stack td[data-label]::before {
    content: attr(data-label); display: block; font-size: .72rem; font-weight: 600; color: var(--muted); margin-bottom: .1rem;
  }
  .table-stack td:empty { display: none; }
}

@media (max-width: 991.98px) {
  /* iPhone tự phóng to khi chạm vào ô nhập có chữ nhỏ hơn 16px -> giữ tối thiểu 16px */
  .form-control, .form-select, .form-control-sm, .form-select-sm, input, select, textarea { font-size: 16px !important; }
  .fab { display: none; }
}

@media (max-width: 767.98px) {
  html { font-size: 15px; }
  body > .page { padding-top: 1rem !important; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .container { padding-left: 14px; padding-right: 14px; }
  .topbar .navbar { padding-top: .45rem; padding-bottom: .45rem; }
  .brand { font-size: 1.05rem; }
  .org-chip { max-width: 210px; padding: .25rem .65rem .25rem .3rem !important; }
  .org-chip .org-type { display: none; }

  .page-head { margin-bottom: 1rem; }
  .page-head h1 { font-size: 1.35rem; }
  .page-head .sub { font-size: .85rem; }
  .page-head > .d-flex { width: 100%; }
  .page-head > .d-flex > .btn { flex: 1; }

  .card { --bs-card-spacer-x: 1rem; --bs-card-spacer-y: .9rem; }
  .card-body.p-4 { padding: 1.1rem !important; }
  .btn { min-height: 42px; }
  .btn-sm { min-height: 34px; }

  /* Tổng quan */
  .balance-hero { padding: 1.15rem 1.1rem 1rem; border-radius: 18px; }
  .balance-hero .balance { font-size: 2.1rem; }
  .balance-hero .hero-actions { display: none; }
  .split-legend { gap: 1rem; }
  .split-legend .v { font-size: 1rem; }
  [data-theme="cards"] .split-legend { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  [data-theme="cards"] .split-legend > div { padding: .7rem .65rem; border-radius: 14px; }
  [data-theme="cards"] .split-legend .v { font-size: 1rem; }
  .dash-filter { flex-direction: column; align-items: stretch !important; }
  .dash-filter .segmented { display: flex; }
  .dash-filter .segmented a { flex: 1; text-align: center; }
  .dash-filter .dates { width: 100%; }
  .dash-filter .dates input { flex: 1; min-width: 0; }

  /* Thu chi */
  .stat { padding: .6rem .7rem; }
  .stat .k { font-size: .72rem; }
  .stat .v { font-size: .95rem; }
  .filter-bar { padding: .8rem; }

  /* Form nhập: nút Lưu dính đáy màn hình */
  .form-actions {
    position: sticky; bottom: 0; z-index: 5;
    margin: 1rem -1.1rem -1.1rem; padding: .75rem 1.1rem calc(.75rem + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .form-actions .btn { flex: 1; }
  .form-actions .btn-link { flex: 0 0 auto; }

  .auth-form { padding: 1.6rem 1.25rem; }
  .auth-wrap { min-height: auto; padding: .5rem 0 1.5rem; }
}


/* ===== Hiệu ứng chuyển trang (View Transitions: Safari 18.2+, Chrome 126+) =====
   Thanh trên và menu dưới đứng yên, chỉ phần nội dung trượt/mờ.
   Tên vùng chỉ được gán trong lúc chuyển trang (html.vt) để không ảnh hưởng modal/dropdown. */
@view-transition { navigation: auto; }

html.vt .topbar { view-transition-name: topbar; }
html.vt .bottom-nav { view-transition-name: bottomnav; }
html.vt main { view-transition-name: page; }

::view-transition-group(topbar),
::view-transition-group(bottomnav) { animation: none; z-index: 2; }
::view-transition-old(topbar), ::view-transition-new(topbar),
::view-transition-old(bottomnav), ::view-transition-new(bottomnav) { animation-duration: .18s; }

::view-transition-group(page) { animation-duration: .3s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(page) { animation: vt-fade-out .16s ease-in both; }
::view-transition-new(page) { animation: vt-rise-in .3s cubic-bezier(.2, .8, .2, 1) both; }

/* Chuyển giữa các mục của menu dưới: trượt ngang theo hướng */
html[data-vt-dir="fwd"]::view-transition-old(page)  { animation: vt-out-left .22s ease-in both; }
html[data-vt-dir="fwd"]::view-transition-new(page)  { animation: vt-in-right .32s cubic-bezier(.2, .8, .2, 1) both; }
html[data-vt-dir="back"]::view-transition-old(page) { animation: vt-out-right .22s ease-in both; }
html[data-vt-dir="back"]::view-transition-new(page) { animation: vt-in-left .32s cubic-bezier(.2, .8, .2, 1) both; }

@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-rise-in  { from { opacity: 0; transform: translateY(10px); } }
@keyframes vt-out-left  { to   { opacity: 0; transform: translateX(-28px); } }
@keyframes vt-in-right  { from { opacity: 0; transform: translateX(36px); } }
@keyframes vt-out-right { to   { opacity: 0; transform: translateX(28px); } }
@keyframes vt-in-left   { from { opacity: 0; transform: translateX(-36px); } }

/* Trình duyệt cũ (không có View Transitions): nội dung hiện dần nhẹ */
html.no-vt main { animation: vt-rise-in .25s ease-out both; }

/* Menu dưới: phản hồi chạm + ô sáng sau icon đang chọn */
.bn-item i {
  padding: 3px 16px; border-radius: 999px;
  transition: background-color .2s ease, color .2s ease, transform .15s ease;
}
.bn-item.active i { background: var(--indigo-50, rgba(59, 63, 216, .1)); }
.bn-item:active i { transform: scale(.86); }
.bn-add { transition: transform .15s ease, box-shadow .15s ease; }
.bn-add:active { transform: scale(.9); box-shadow: 0 4px 12px rgba(59, 63, 216, .3); }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  html.no-vt main { animation: none; }
  .bn-item i, .bn-add { transition: none; }
}

/* Nút đang gửi: khóa + vòng xoay (spinner-border do site.js chèn vào) */
.is-busy { pointer-events: none; }
.btn.is-busy:disabled { opacity: .8; }
.is-busy .spinner-border-sm { --bs-spinner-width: .95em; --bs-spinner-height: .95em; --bs-spinner-border-width: .15em; vertical-align: -.12em; }
