/* ============================================================
   FinTrack – Personal Finance App
   High Contrast Black & White Standard (Độ tương phản cao)
   ============================================================ */

:root {
  /* ── High Contrast Palette ── */
  --bg-base:        #f8f8f8;
  --bg-surface:     #ffffff;
  --bg-muted:       #f0f0f0;
  --bg-hover:       #e8e8e8;

  --border:         #000000;          /* Rõ nét màu đen mảnh */
  --border-strong:  #000000;
  --border-card:    #000000;

  /* Accent & Neutral Black */
  --accent:         #000000;
  --accent-light:   #f0f0f0;
  --accent-mid:     #222222;
  --accent-dark:    #000000;

  /* Semantic Colors for Amounts */
  --income-color:   #16A34A;          /* Xanh lá đậm */
  --income-bg:      #ffffff;
  --expense-color:  #DC2626;          /* Đỏ đậm */
  --expense-bg:     #ffffff;
  --cashback-color: #16A34A;

  /* Text – Toàn bộ đen tuyền #000000 */
  --text-primary:   #000000;
  --text-secondary: #000000;
  --text-muted:     #000000;
  --text-inverse:   #ffffff;

  /* Layout */
  --sidebar-w:      240px;
  --topbar-h:       64px;

  /* Radius */
  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  10px;
  --radius-xl:  12px;

  /* Typography – Font hệ thống đậm nét */
  --font: Arial, Helvetica, 'Segoe UI', sans-serif;
}

/* ──────────────────────────────────────────────────────────
   Reset & Base Typography
────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: #000000;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, th, strong, b {
  color: #000000;
  font-weight: 600;
}

a {
  color: #000000;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: var(--font);
  border: none;
  background: none;
  color: #000000;
}

input, select, textarea {
  font-family: var(--font);
  color: #000000;
}

canvas {
  display: block;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #ffffff;
  border-left: 1px solid #000000;
}
::-webkit-scrollbar-thumb {
  background: #000000;
}

/* Card Surface */
.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* ──────────────────────────────────────────────────────────
   App Shell & Sidebar
────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.2s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 38px; height: 38px;
  background: #000000;
  color: #ffffff;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  border: 1px solid #000000;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #000000;
  letter-spacing: -0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: #000000;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-muted);
  border-color: #000000;
  color: #000000;
}

.nav-item.active {
  background: #000000;
  color: #ffffff;
  font-weight: 600;
  border-color: #000000;
}

.nav-item.active .nav-icon,
.nav-item.active .nav-label {
  color: #ffffff;
}

.nav-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.nav-label {
  white-space: nowrap;
}

.sidebar-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.sidebar-time {
  font-size: 1.45rem;
  font-weight: 700;
  color: #000000;
  letter-spacing: -0.5px;
}

.sidebar-date {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
  margin-top: 0.2rem;
}

/* ──────────────────────────────────────────────────────────
   Main Content & Topbar
────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky; top: 0;
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 2rem;
  z-index: 90;
}

.btn-menu {
  display: none;
  width: 38px; height: 38px;
  background: #ffffff;
  border: 1px solid #000000;
  border-radius: var(--radius-sm);
  color: #000000;
  font-size: 1.15rem;
  font-weight: 700;
  align-items: center; justify-content: center;
}

.topbar-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #000000;
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-reset-data {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  background: #ffffff;
  color: #000000;
  border: 1px solid #000000;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-reset-data:hover {
  background: var(--bg-hover);
  color: #000000;
}

.btn-reset-data:active {
  background: #d4d4d4;
}

.btn-reset-icon {
  font-size: 14px;
  font-weight: 700;
}

.btn-add-tx {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  background: #000000;
  color: #ffffff;
  border: 1px solid #000000;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-add-tx:hover {
  background: #222222;
}

.btn-add-tx span {
  font-size: 1.25rem;
  line-height: 1;
}

/* ──────────────────────────────────────────────────────────
   Pages
────────────────────────────────────────────────────────── */
.page {
  display: none;
  padding: 2rem 2rem 3rem;
  flex: 1;
}
.page.active {
  display: block;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #000000;
  letter-spacing: -0.2px;
}

.section-meta {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
}

.link-all {
  font-size: 14px;
  color: #000000;
  font-weight: 600;
  text-decoration: underline;
}

/* ──────────────────────────────────────────────────────────
   Summary Cards (Tổng quan: Số dư, Tổng thu, Tổng chi)
────────────────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.summary-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
}

.card-label {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #000000;
}

.card-value {
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: #000000;
  margin: 0.5rem 0 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.card-sub {
  font-size: 14px;
  font-weight: 500;
  color: #000000;
}

/* ──────────────────────────────────────────────────────────
   Dashboard Body (Biểu đồ tròn + Chú thích + Thẻ Accordion)
────────────────────────────────────────────────────────── */
.dashboard-body {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
  align-items: start;
}

.analytics-section {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
}

/* Donut Chart on Left, Legend on Right */
.donut-analytics-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2rem;
  padding: 0.5rem 0 1.25rem;
}

.donut-chart-box {
  width: 220px;
  height: 220px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-chart-box canvas {
  width: 220px;
  height: 220px;
}

.donut-legend-box {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 15px;
  font-weight: 600;
  color: #000000;
  line-height: 1.4;
}

.donut-legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid #000000;
  flex-shrink: 0;
}

.donut-legend-bullet {
  font-size: 16px;
  font-weight: 700;
  color: #000000;
  flex-shrink: 0;
}

.donut-legend-text {
  font-size: 15px;
  font-weight: 600;
  color: #000000;
  word-break: break-word;
}

.donut-empty {
  padding: 1.5rem 0;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  color: #000000;
}

/* Thẻ gập/mở phẳng nhóm danh mục (Accordion ngân hàng) */
.category-accordion-wrap {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.accordion-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.85rem;
}

.category-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.acc-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  overflow: hidden;
}

.acc-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.15rem;
  background: #ffffff;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: background 0.15s ease;
}

.acc-header:hover {
  background: var(--bg-muted);
}

.acc-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.acc-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.acc-label {
  font-size: 15px;
  font-weight: 600;
  color: #000000;
  white-space: nowrap;
}

.acc-count {
  font-size: 14px;
  font-weight: 500;
  color: #000000;
  white-space: nowrap;
}

.acc-header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.acc-total {
  font-size: 15px;
  font-weight: 600;
  color: #000000;
  font-variant-numeric: tabular-nums;
}

.acc-chevron {
  font-size: 13px;
  font-weight: 700;
  color: #000000;
  width: 16px;
  text-align: center;
}

.acc-body {
  display: none;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.acc-item.open .acc-body {
  display: block;
}

.acc-body-content {
  display: flex;
  flex-direction: column;
}

.acc-tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.acc-tx-row:last-child {
  border-bottom: none;
}

.acc-tx-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.acc-tx-desc {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
  line-height: 1.4;
}

.acc-tx-meta {
  font-size: 14px;
  font-weight: 500;
  color: #000000;
}

.acc-tx-amount {
  font-size: 15px;
  font-weight: 600;
  color: var(--expense-color); /* #DC2626 */
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ──────────────────────────────────────────────────────────
   Recent List (Giao dịch gần đây)
────────────────────────────────────────────────────────── */
.recent-section {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}

.recent-list {
  display: flex;
  flex-direction: column;
}

.rl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.rl-row:last-child {
  border-bottom: none;
}

.rl-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.rl-name {
  font-size: 15px;
  font-weight: 600;
  color: #000000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rl-meta {
  font-size: 14px;
  font-weight: 500;
  color: #000000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rl-amount {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  text-align: right;
}

.rl-exp {
  color: var(--expense-color); /* #DC2626 */
}

.rl-inc {
  color: var(--income-color);  /* #16A34A */
}

/* ──────────────────────────────────────────────────────────
   Payment Breakdown (Phương thức thanh toán)
────────────────────────────────────────────────────────── */
.payment-breakdown {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
}

.payment-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.payment-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  background: #ffffff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.pay-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
}

.pay-info {
  flex: 1;
}

.pay-label {
  font-size: 14px;
  color: #000000;
  font-weight: 600;
}

.pay-amount {
  font-size: 16px;
  font-weight: 600;
  margin-top: 0.15rem;
  color: #000000;
  font-variant-numeric: tabular-nums;
}

.pay-bar-wrap {
  width: 120px;
  height: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.pay-bar {
  height: 100%;
  background: #000000;
  transition: width 0.4s ease;
}

/* ──────────────────────────────────────────────────────────
   Transactions Page (Bảng Giao Dịch Chuẩn Sao Kê Ngân Hàng)
────────────────────────────────────────────────────────── */
.page-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.filter-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-select, .search-input {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #000000;
  padding: 0.6rem 0.95rem;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease;
}

.filter-select:focus, .search-input:focus {
  border-color: #000000;
  outline: 2px solid #000000;
}

.filter-select option {
  background: #ffffff;
  color: #000000;
  font-size: 14px;
}

.search-wrap {
  margin-left: auto;
}

.search-input {
  width: 240px;
}

.transaction-table-wrap {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.transaction-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.transaction-table thead tr {
  background: #f5f5f5;
  border-bottom: 2px solid var(--border);
}

.transaction-table th {
  text-align: left;
  padding: 1rem 1.25rem;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #000000;
  white-space: nowrap;
}

.transaction-table th.text-right {
  text-align: right;
}

.tx-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
}

.tx-row:last-child {
  border-bottom: none;
}

.tx-row:hover {
  background: var(--bg-muted);
}

.tx-row td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
  color: #000000;
  font-size: 15px;
}

.tx-cell-date {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
  white-space: nowrap;
  width: 120px;
}

.tx-cell-desc {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tx-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #000000;
  line-height: 1.4;
}

.tx-note {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #000000;
  line-height: 1.3;
}

.tx-cat-badge, .tx-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: #000000;
  white-space: nowrap;
}

/* Inline Edit Select Dropdown (Menu chọn trực tiếp) */
.tx-inline-select {
  appearance: none;
  -webkit-appearance: none;
  background: #ffffff url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") no-repeat right 0.65rem center / 12px;
  border: 1px solid #000000;
  border-radius: var(--radius-sm);
  color: #000000;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  cursor: pointer;
  outline: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  max-width: 100%;
}

.tx-inline-select:hover {
  background-color: var(--bg-muted);
}

.tx-inline-select:focus {
  border-color: #000000;
  outline: 2px solid #000000;
}

.tx-inline-select option {
  background: #ffffff;
  color: #000000;
  font-size: 14px;
  font-weight: 500;
  padding: 0.4rem;
}

.tx-cell-amount {
  text-align: right;
  white-space: nowrap;
}

.tx-amt {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.tx-amt--income {
  color: var(--income-color);   /* #16A34A */
}

.tx-amt--expense {
  color: var(--expense-color);  /* #DC2626 */
}

.tx-cashback-hint {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #000000;
  margin-top: 0.15rem;
}

.tx-cell-action {
  width: 44px;
  text-align: center;
}

.btn-delete-tx {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #000000;
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-delete-tx:hover {
  background: var(--expense-color);
  color: #ffffff;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #000000;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.empty-state p {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 1.25rem;
  color: #000000;
}

.btn-add-first {
  padding: 0.65rem 1.35rem;
  background: #000000;
  color: #ffffff;
  border: 1px solid #000000;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-add-first:hover {
  background: #222222;
}

/* ──────────────────────────────────────────────────────────
   Cards Page (Thẻ tín dụng)
────────────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.5rem;
}

.credit-card {
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.75rem 1.5rem;
  position: relative;
  background: #ffffff;
  border: 2px solid var(--border);
  color: #000000;
  min-height: 180px;
}

.card-bank {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #000000;
}

.card-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
  color: #000000;
}

.card-number {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  font-family: monospace;
  color: #000000;
  margin-top: 0.35rem;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 1.35rem;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.card-cashback-rate {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
}

.card-cashback-val {
  font-size: 1.15rem;
  font-weight: 600;
  color: #000000;
}

.card-total-cb {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
  margin-top: 0.15rem;
}

.card-delete {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 28px; height: 28px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: #000000;
  font-size: 14px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-delete:hover {
  background: var(--expense-color);
  color: #ffffff;
}

.card-perks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.perk-tag {
  padding: 0.25rem 0.65rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: #000000;
}

.add-card-form {
  padding: 1.75rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.form-group {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-group.form-group-full {
  flex: 100%;
  min-width: 100%;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
}

.form-group small {
  font-size: 14px;
  font-weight: 500;
  color: #000000;
}

.form-control {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #000000;
  padding: 0.65rem 0.95rem;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  width: 100%;
}

.form-control:focus {
  border-color: #000000;
  outline: 2px solid #000000;
}

.form-color {
  padding: 0.3rem 0.4rem;
  height: 42px;
  cursor: pointer;
}

.perks-builder {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.perk-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.perk-row select, .perk-row input {
  flex: 1;
}

.perk-row .btn-remove-perk {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #000000;
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

.perk-row .btn-remove-perk:hover {
  background: var(--expense-color);
  color: #ffffff;
}

/* Nút quản lý ngân hàng & Danh sách ngân hàng linh hoạt */
.btn-manage-bank {
  background: #ffffff;
  border: 1px solid var(--border);
  color: #000000;
  font-size: 13px;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-manage-bank:hover {
  background: #000000;
  color: #ffffff;
}

.custom-bank-input-wrap {
  animation: fadeIn 0.15s ease;
}

.bank-manage-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border: 1px solid var(--border);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.bank-manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: #ffffff;
  gap: 0.75rem;
}

.bank-manage-item .bank-name {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
  flex: 1;
}

.bank-manage-item .bank-name small {
  font-size: 12px;
  font-weight: 500;
  color: #000000;
  margin-left: 0.35rem;
}

.btn-delete-bank {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: #ffffff;
  color: #000000;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-delete-bank:hover {
  background: var(--expense-color);
  color: #ffffff;
  border-color: var(--expense-color);
}

/* ──────────────────────────────────────────────────────────
   Cashback Page
────────────────────────────────────────────────────────── */
.cashback-hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2.25rem 2rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.cashback-hero-icon {
  font-size: 3rem;
  flex-shrink: 0;
}

.cashback-hero-label {
  font-size: 14px;
  color: #000000;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cashback-hero-value {
  font-size: 2.5rem;
  font-weight: 600;
  color: #000000;
  letter-spacing: -1px;
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.cashback-by-card {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.cashback-card-item {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.cashback-card-color {
  width: 6px;
  height: 52px;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.cashback-card-info .label {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
}

.cashback-card-info .value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--income-color);
  font-variant-numeric: tabular-nums;
}

.cashback-card-info .name {
  font-size: 15px;
  font-weight: 600;
  color: #000000;
}

/* Cashback Statement Table */
.cashback-table-wrap {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.cashback-table-header {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 180px;
  gap: 1.25rem;
  padding: 0.85rem 1.25rem;
  background: #f5f5f5;
  border-bottom: 2px solid #000000;
  align-items: center;
}

.cb-th {
  font-size: 13px;
  font-weight: 700;
  color: #000000;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cb-th.cb-col-date {
  text-align: left;
}

.cb-th.cb-col-desc {
  text-align: left;
}

.cb-th.cb-col-amount {
  text-align: right;
}

.cashback-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #ffffff;
}

.cashback-list-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 180px;
  gap: 1.25rem;
  align-items: center;
  background: #ffffff;
  border: none;
  border-bottom: 1px solid #000000;
  border-radius: 0;
  padding: 0.9rem 1.25rem;
  transition: background 0.15s ease;
}

.cashback-list-item:last-child {
  border-bottom: none;
}

.cashback-list-item:hover {
  background: var(--bg-muted);
}

.cb-item-date {
  font-size: 14px;
  font-weight: 700;
  color: #000000;
  text-align: left;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cb-item-info,
.cashback-list-item > div:nth-child(2) {
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.cb-item-desc {
  font-size: 15px;
  font-weight: 600;
  color: #000000;
  text-align: left;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-item-card {
  font-size: 13px;
  font-weight: 500;
  color: #000000;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-item-amount {
  font-size: 16px;
  font-weight: 700;
  color: #16A34A;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ──────────────────────────────────────────────────────────
   Report Page (Báo cáo)
────────────────────────────────────────────────────────── */
.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.report-card {
  padding: 1.75rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.report-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: #000000;
  margin-bottom: 1.5rem;
}

.report-card canvas {
  width: 100% !important;
}

.report-stats {
  grid-column: 1 / -1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-item {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.stat-label {
  font-size: 14px;
  color: #000000;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 600;
  margin-top: 0.5rem;
  color: #000000;
  font-variant-numeric: tabular-nums;
}

/* ──────────────────────────────────────────────────────────
   Modal (Hộp thoại Thêm Giao Dịch & Xác Nhận)
────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 1rem;
}

.modal-overlay.open {
  opacity: 1; pointer-events: all;
}

.modal {
  width: 100%; max-width: 580px; max-height: 90vh;
  display: flex; flex-direction: column;
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  transform: translateY(8px);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal {
  transform: none;
}

.modal-sm {
  max-width: 380px;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #000000;
}

.btn-close {
  width: 32px; height: 32px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: #000000;
  font-size: 14px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-close:hover {
  background: #000000;
  color: #ffffff;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; gap: 0.75rem; justify-content: flex-end;
  background: #ffffff;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Type Tabs */
.type-tabs {
  display: flex; gap: 0.5rem; margin-bottom: 1.5rem;
}

.type-tab {
  flex: 1; padding: 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #000000;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s ease;
}

.type-tab.active[data-type="expense"] {
  background: var(--expense-color);
  border-color: #000000;
  color: #ffffff;
}

.type-tab.active[data-type="income"] {
  background: var(--income-color);
  border-color: #000000;
  color: #ffffff;
}

.type-tab:hover:not(.active) {
  background: var(--bg-muted);
}

/* Form Grid */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}

.payment-method-tabs {
  display: flex; gap: 0.5rem;
}

.method-tab {
  flex: 1; padding: 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #000000;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.15s ease;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
}

.method-tab.active {
  background: #000000;
  border-color: #000000;
  color: #ffffff;
}

.method-tab:hover:not(.active) {
  background: var(--bg-muted);
}

.cashback-preview {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 1.25rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
}

.cashback-preview-icon {
  font-size: 1.75rem;
}

.cashback-preview-info {
  flex: 1;
}

.cashback-preview-label {
  font-size: 14px;
  color: #000000;
  font-weight: 600;
  text-transform: uppercase;
}

.cashback-preview-amount {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--income-color);
  margin-top: 0.1rem;
}

.cashback-preview-pct {
  font-size: 14px;
  font-weight: 600;
  background: #ffffff;
  color: #000000;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.85rem;
}

/* ──────────────────────────────────────────────────────────
   Buttons
────────────────────────────────────────────────────────── */
.btn-primary {
  padding: 0.65rem 1.45rem;
  background: #000000;
  color: #ffffff;
  border: 1px solid #000000;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: #222222;
}

.btn-secondary {
  padding: 0.65rem 1.25rem;
  background: #ffffff;
  border: 1px solid #000000;
  color: #000000;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-muted);
}

.btn-danger {
  padding: 0.65rem 1.25rem;
  background: var(--expense-color);
  border: 1px solid #000000;
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 14px;
}

/* ──────────────────────────────────────────────────────────
   Toast
────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
  max-width: 380px;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border: 1px solid #000000;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: #000000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  animation: toastFadeIn 0.25s ease-out forwards;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.toast-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.toast-msg {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #000000;
  line-height: 1.4;
  word-break: break-word;
}

.btn-toast-close {
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: #000000;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  margin-left: 0.5rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-toast-close:hover {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

.toast.toast-success { border-left: 5px solid var(--income-color); }
.toast.toast-error   { border-left: 5px solid var(--expense-color); }
.toast.toast-info    { border-left: 5px solid #000000; }

.toast.removing {
  opacity: 0;
  transform: translateX(25px);
  pointer-events: none;
}

@keyframes toastFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ──────────────────────────────────────────────────────────
   Responsive Layout
────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .summary-grid { grid-template-columns: 1fr 1fr 1fr; }
  .dashboard-body { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: none; box-shadow: 4px 0 16px rgba(0,0,0,0.4); }
  .main-content { margin-left: 0; }
  .btn-menu { display: flex; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .donut-analytics-container { flex-direction: column; align-items: center; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group-full { grid-column: 1; }
  .cashback-preview { grid-column: 1; }
  .cashback-table-wrap { overflow-x: auto; }
  .cashback-table-header, .cashback-list-item { min-width: 460px; }
  .topbar-actions { gap: 0.5rem; }
  .btn-reset-data .btn-reset-desc { display: none; }
  .btn-reset-data { padding: 0.55rem 0.75rem; font-size: 13px; }
  .page { padding: 1.25rem 1.25rem 2.5rem; }
  .topbar { padding: 0 1.25rem; }
}

@media (max-width: 480px) {
  .btn-add-tx { padding: 0.55rem 0.85rem; font-size: 13px; }
  .summary-grid { grid-template-columns: 1fr; }
  .page { padding: 1rem 1rem 2rem; }
}

/* ============================================================
   AUTH MODAL – High Contrast Minimalist
   ============================================================ */

/* Blur overlay khi chưa đăng nhập */
.auth-blur .sidebar,
.auth-blur .main-content {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

/* Auth overlay: full-screen lockout */
.auth-overlay {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
}
.auth-overlay.open { display: flex; }

.auth-modal {
  max-width: 420px;
  width: 92%;
  padding: 2.5rem 2rem;
  border: 2px solid #000;
  border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Logo section */
.auth-logo {
  text-align: center;
  margin-bottom: 0.25rem;
}
.auth-logo .logo-icon {
  font-size: 2.5rem;
  margin-bottom: 0.3rem;
}
.auth-brand {
  font-size: 1.6rem;
  font-weight: 800;
  color: #000;
  letter-spacing: -0.5px;
}
.auth-tagline {
  font-size: 13px;
  color: #555;
  font-weight: 500;
  margin-top: 0.2rem;
}

/* Tabs */
.auth-tabs {
  display: flex;
  border: 2px solid #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.auth-tab {
  flex: 1;
  padding: 0.6rem 1rem;
  font-size: 14px;
  font-weight: 700;
  border: none;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.auth-tab.active {
  background: #000;
  color: #fff;
}
.auth-tab:hover:not(.active) {
  background: #f0f0f0;
  color: #000;
}

/* Auth form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.btn-auth {
  width: 100%;
  padding: 0.85rem;
  font-size: 15px;
  font-weight: 700;
  margin-top: 0.25rem;
  border-radius: var(--radius-md);
}

/* Error message */
.auth-error {
  background: #fee2e2;
  border: 1.5px solid #dc2626;
  color: #dc2626;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
}

/* ============================================================
   USER INFO – Sidebar Footer
   ============================================================ */
.user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #f0f0f0;
  border: 1.5px solid #000;
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  margin-top: 0.75rem;
}
.user-avatar {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.user-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.user-email {
  font-size: 11px;
  font-weight: 700;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.btn-logout {
  font-size: 11px;
  font-weight: 700;
  color: #dc2626;
  background: none;
  border: 1.5px solid #dc2626;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-logout:hover {
  background: #dc2626;
  color: #fff;
}

/* ============================================================
   TOPBAR USER BADGE
   ============================================================ */
.topbar-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 12.5px;
  font-weight: 600;
  color: #000;
  background: #f0f0f0;
  border: 1.5px solid #000;
  border-radius: 20px;
  padding: 0.3rem 0.85rem;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

