/* FinanceApp v3.0 — Clean, Bootstrap-compatible */
:root {
  --p:      #4f46e5;
  --pd:     #3730a3;
  --pbg:    #eef2ff;
  --s:      #10b981;
  --sbg:    #d1fae5;
  --d:      #ef4444;
  --dbg:    #fee2e2;
  --w:      #f59e0b;
  --wbg:    #fef3c7;
  --i:      #3b82f6;
  --ibg:    #dbeafe;
  --sw:     255px;
  --hh:     60px;
  --bg:     #f1f5f9;
  --sur:    #ffffff;
  --tx:     #1e293b;
  --txm:    #64748b;
  --txl:    #94a3b8;
  --br:     #e2e8f0;
  --brl:    #f8fafc;
  --r:      12px;
  --rs:     8px;
  --sh:     0 1px 3px rgba(0,0,0,.08);
  --shm:    0 4px 12px rgba(0,0,0,.1);
  --shl:    0 8px 24px rgba(0,0,0,.12);
  --fn:     'Inter', system-ui, sans-serif;
}
[data-theme="dark"] {
  --bg:  #0f172a; --sur: #1e293b; --tx: #f1f5f9;
  --txm: #94a3b8; --txl: #64748b; --br: #334155; --brl: #1e293b;
  --pbg: #1e1b4b; --sbg: #064e3b; --dbg: #450a0a; --wbg: #451a03; --ibg: #0c1a2e;
}

/* ── Base ──────────────────────────────────────────────────── */
body { font-family: var(--fn); background: var(--bg) !important; color: var(--tx) !important; -webkit-font-smoothing: antialiased; }
a { color: var(--p); text-decoration: none; }
a:hover { color: var(--pd); }

/* ── Layout ────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sw);
  background: var(--sur);
  border-right: 1px solid var(--br);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; /* MUST stay below Bootstrap modal 1040+ */
  overflow-y: auto; overflow-x: hidden;
  transition: transform .25s ease;
}
.sidebar-brand {
  padding: 15px 18px;
  border-bottom: 1px solid var(--br);
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px; color: var(--p);
  flex-shrink: 0;
}
.sidebar-brand .brand-icon {
  width: 34px; height: 34px;
  background: var(--p); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; flex-shrink: 0;
}
.sidebar-nav { padding: 8px 8px; flex: 1; }
.nav-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--txl);
  padding: 10px 10px 3px; margin-top: 2px;
}

/* Regular nav link */
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; border-radius: var(--rs);
  color: var(--txm); font-weight: 500; font-size: 13.5px;
  text-decoration: none; margin-bottom: 1px;
  position: relative; background: transparent;
  transition: background .15s, color .15s;
}
.sidebar-nav .nav-link i { font-size: 15px; width: 17px; text-align: center; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { background: var(--pbg); color: var(--p); }
.sidebar-nav .nav-link.active { background: var(--pbg); color: var(--p); font-weight: 600; }
.sidebar-nav .nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 5px; bottom: 5px;
  width: 3px; background: var(--p); border-radius: 0 3px 3px 0;
}

/* ── Sidebar Dropdown ──────────────────────────────────────── */
.nav-dropdown { margin-bottom: 1px; }

.nav-dropdown-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 8px 12px; border-radius: var(--rs);
  background: transparent; border: none; cursor: pointer;
  color: var(--txm); font-weight: 500; font-size: 13.5px;
  font-family: var(--fn); transition: background .15s, color .15s;
}
.nav-dropdown-toggle:hover { background: var(--pbg); color: var(--p); }
.nav-dropdown-toggle.active { color: var(--p); font-weight: 600; }

.nav-chevron {
  font-size: 11px; transition: transform .2s ease; flex-shrink: 0;
}
.nav-dropdown.open .nav-chevron { transform: rotate(90deg); }

.nav-dropdown-menu {
  display: none; padding: 3px 0 3px 28px; overflow: hidden;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }

.nav-sub-link {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-radius: var(--rs);
  color: var(--txm); font-size: 13px; font-weight: 500;
  text-decoration: none; margin-bottom: 1px;
  transition: background .15s, color .15s;
}
.nav-sub-link i { font-size: 13px; width: 15px; text-align: center; flex-shrink: 0; }
.nav-sub-link:hover { background: var(--pbg); color: var(--p); }
.nav-sub-link.active { background: var(--pbg); color: var(--p); font-weight: 600; }

/* Sidebar footer */
.sidebar-footer { padding: 10px; border-top: 1px solid var(--br); flex-shrink: 0; }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--rs); }
.sidebar-user .avatar {
  width: 32px; height: 32px; background: var(--p); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-weight: 600; font-size: 13px; color: var(--tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; color: var(--txm); text-transform: capitalize; }

/* ── Main Content ──────────────────────────────────────────── */
.main-content { margin-left: var(--sw); flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

/* ── Top Header ────────────────────────────────────────────── */
.top-header {
  height: var(--hh); background: var(--sur); border-bottom: 1px solid var(--br);
  display: flex; align-items: center; padding: 0 22px; gap: 12px;
  position: sticky; top: 0; z-index: 99; box-shadow: var(--sh);
}
.header-title { font-size: 15px; font-weight: 600; flex: 1; color: var(--tx); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.btn-icon {
  width: 34px; height: 34px; border: none; background: var(--bg);
  border-radius: var(--rs); display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--txm); font-size: 15px; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--pbg); color: var(--p); }

/* ── Page Content ──────────────────────────────────────────── */
.page-content { padding: 22px; flex: 1; }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.page-header h1 { font-size: 19px; font-weight: 700; margin: 0; color: var(--tx); display: flex; align-items: center; gap: 8px; }
.page-header p { color: var(--txm); margin: 2px 0 0; font-size: 13px; }

/* ── Data Card (tables) ────────────────────────────────────── */
.data-card { background: var(--sur); border: 1px solid var(--br); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; }
.data-card-header {
  padding: 12px 18px; border-bottom: 1px solid var(--br);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 13.5px; background: var(--sur);
}

/* ── Form Card (add/edit pages) ────────────────────────────── */
.form-card {
  background: var(--sur); border: 1px solid var(--br);
  border-radius: var(--r); box-shadow: var(--sh);
  padding: 28px; max-width: 780px;
}
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--br); margin-top: 8px; }
.req { color: var(--d); }

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-card {
  background: var(--sur); border: 1px solid var(--br); border-radius: var(--r);
  padding: 18px; display: flex; align-items: flex-start; gap: 14px;
  box-shadow: var(--sh); position: relative; overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.stat-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--sc, var(--p)); border-radius: var(--r) var(--r) 0 0;
}
.stat-card:hover { box-shadow: var(--shm); transform: translateY(-2px); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; background: var(--si, var(--pbg)); color: var(--sc, var(--p)); }
.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 10px; color: var(--txm); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.stat-value { font-size: 21px; font-weight: 700; margin: 3px 0 2px; line-height: 1.2; color: var(--tx); }
.stat-sub { font-size: 11px; color: var(--txl); }
.stat-success { --sc: var(--s); --si: var(--sbg); }
.stat-danger  { --sc: var(--d); --si: var(--dbg); }
.stat-warning { --sc: var(--w); --si: var(--wbg); }
.stat-info    { --sc: var(--i); --si: var(--ibg); }

/* ── Bootstrap Table overrides ─────────────────────────────── */
.table { font-size: 13px; }
.table thead th {
  background: var(--bg) !important; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; color: var(--txm) !important;
  border-bottom: 1px solid var(--br) !important; padding: 10px 14px !important; white-space: nowrap;
}
.table tbody td { padding: 10px 14px !important; vertical-align: middle; color: var(--tx) !important; border-color: var(--brl) !important; }
.table-hover tbody tr:hover td { background: var(--bg) !important; }

/* ── Status Badge ──────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.status-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-completed { background: var(--sbg); color: #065f46; }
.status-pending   { background: var(--wbg); color: #92400e; }
.status-partial   { background: var(--ibg); color: #1e40af; }
.status-draft     { background: #f1f5f9;    color: #64748b; }
.status-finalized { background: var(--sbg); color: #065f46; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-label { font-weight: 500; font-size: 13px; margin-bottom: 5px; color: var(--tx); }
.form-control, .form-select {
  border-color: var(--br) !important; border-radius: var(--rs) !important;
  font-size: 13.5px !important; background: var(--sur) !important; color: var(--tx) !important; font-family: var(--fn) !important;
}
.form-control:focus, .form-select:focus {
  border-color: var(--p) !important; box-shadow: 0 0 0 3px rgba(79,70,229,.12) !important;
  background: var(--sur) !important; color: var(--tx) !important;
}
.form-control::placeholder { color: var(--txl) !important; }
.input-group-text { background: var(--bg) !important; border-color: var(--br) !important; color: var(--txm) !important; font-size: 13px !important; }
.form-text { font-size: 12px; color: var(--txm); margin-top: 4px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn { border-radius: var(--rs) !important; font-weight: 500 !important; font-size: 13px !important; font-family: var(--fn) !important; display: inline-flex !important; align-items: center !important; gap: 5px !important; }
.btn-primary { background: var(--p) !important; border-color: var(--p) !important; }
.btn-primary:hover { background: var(--pd) !important; border-color: var(--pd) !important; }
.btn-success { background: var(--s) !important; border-color: var(--s) !important; }
.btn-success:hover { background: #059669 !important; border-color: #059669 !important; }
.btn-danger  { background: var(--d) !important; border-color: var(--d) !important; }
.btn-danger:hover  { background: #dc2626 !important; border-color: #dc2626 !important; }
.btn-sm  { padding: 5px 11px !important; font-size: 12px !important; }
.btn-xs  { padding: 3px 8px !important; font-size: 11px !important; }
.btn-lg  { padding: 10px 22px !important; font-size: 14px !important; }

/* ── Filter Bar ────────────────────────────────────────────── */
.filter-bar { background: var(--sur); border: 1px solid var(--br); border-radius: var(--r); padding: 14px 18px; box-shadow: var(--sh); }

/* ── Bootstrap Card overrides ──────────────────────────────── */
.card { background: var(--sur) !important; border-color: var(--br) !important; border-radius: var(--r) !important; }
.card-header { background: var(--sur) !important; border-color: var(--br) !important; font-weight: 600; }
.card-body { padding: 18px !important; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert { border-radius: var(--rs) !important; border: none !important; font-size: 13.5px; }

/* ── Pagination ────────────────────────────────────────────── */
.pagination .page-link { border-color: var(--br) !important; color: var(--txm) !important; background: var(--sur) !important; font-size: 12px; }
.pagination .page-item.active .page-link { background: var(--p) !important; border-color: var(--p) !important; color: #fff !important; }

/* ── Login ─────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 60%, #2563eb 100%); padding: 20px; }
.login-card { background: #fff; border-radius: 18px; padding: 38px; width: 100%; max-width: 410px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo .logo-icon { width: 56px; height: 56px; background: var(--p); border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; color: #fff; margin-bottom: 10px; }
.login-logo h1 { font-size: 21px; font-weight: 700; color: #1e293b; margin: 0; }
.login-logo p  { color: #64748b; font-size: 13px; margin: 3px 0 0; }

/* ── Sidebar toggle (mobile) ───────────────────────────────── */
.sidebar-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--tx); padding: 4px; border-radius: var(--rs); }

/* ── Charts ────────────────────────────────────────────────── */
.chart-container { position: relative; }

/* ── Utilities ─────────────────────────────────────────────── */
.fw-600 { font-weight: 600 !important; }
.text-success { color: var(--s) !important; }
.text-danger  { color: var(--d) !important; }
.text-warning { color: var(--w) !important; }
.text-primary { color: var(--p) !important; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--br); border-radius: 3px; }

/* ── Animation ─────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.fade-in { animation: fadeUp .22s ease forwards; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); z-index: 500; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shl); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; align-items: center; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 499; }
  .sidebar-overlay.show { display: block; }
}
@media (max-width: 576px) {
  .page-content { padding: 14px; }
  .stat-value { font-size: 18px; }
  .top-header { padding: 0 14px; }
  .form-card { padding: 18px; }
}

/* ── Dark Mode ─────────────────────────────────────────────── */
[data-theme="dark"] .table thead th { background: #0f172a !important; }
[data-theme="dark"] .table-hover tbody tr:hover td { background: #0f172a !important; }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select { background: #0f172a !important; color: #f1f5f9 !important; border-color: #334155 !important; }
[data-theme="dark"] .form-control::placeholder { color: #475569 !important; }
[data-theme="dark"] .input-group-text { background: #0f172a !important; border-color: #334155 !important; color: #64748b !important; }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1); }
[data-theme="dark"] .login-card { background: #1e293b; }
[data-theme="dark"] .login-logo h1 { color: #f1f5f9; }
[data-theme="dark"] .login-logo p  { color: #94a3b8; }
[data-theme="dark"] .status-completed { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .status-pending   { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .status-partial   { background: #0c1a2e; color: #93c5fd; }

/* ============================================================
   List Page Components — v3.1
   ============================================================ */

/* ── Summary Pills ─────────────────────────────────────────── */
.summary-pill {
  background: var(--sur);
  border: 1px solid var(--br);
  border-radius: var(--r);
  padding: 14px 18px;
  box-shadow: var(--sh);
  position: relative;
  overflow: hidden;
}
.summary-pill::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--r) var(--r) 0 0;
}
.summary-pill.success::before { background: var(--s); }
.summary-pill.danger::before  { background: var(--d); }
.summary-pill.warning::before { background: var(--w); }
.summary-pill.info::before    { background: var(--i); }
.summary-pill.primary::before { background: var(--p); }

.sp-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--txm);
  margin-bottom: 6px;
}
.sp-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--tx);
  line-height: 1;
}

/* ── Section Card ──────────────────────────────────────────── */
.section-card {
  background: var(--sur);
  border: 1px solid var(--br);
  border-radius: var(--r);
  box-shadow: var(--sh);
  overflow: hidden;
}
.section-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--br);
  background: var(--sur);
}
.sch-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sch-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sch-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--tx);
}
.sch-sub {
  font-size: 12px;
  color: var(--txm);
}

/* ── Count Badge ───────────────────────────────────────────── */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.count-badge.success  { background: var(--sbg); color: #065f46; }
.count-badge.danger   { background: var(--dbg); color: #991b1b; }
.count-badge.warning  { background: var(--wbg); color: #92400e; }
.count-badge.primary  { background: var(--pbg); color: var(--pd); }

/* ── List Table ────────────────────────────────────────────── */
.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.list-table thead tr {
  background: var(--brl);
}
.list-table thead th {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--txm);
  border-bottom: 1px solid var(--br);
  white-space: nowrap;
}
.list-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--brl);
  vertical-align: middle;
  color: var(--tx);
}
.list-table tbody tr:last-child td { border-bottom: none; }
.list-table tbody tr { transition: background .12s; }
.list-table tbody tr:hover td { background: var(--brl); }

/* ── Cell helpers ──────────────────────────────────────────── */
.cell-main { font-weight: 500; color: var(--tx); }
.cell-sub  { font-size: 11px; color: var(--txm); margin-top: 2px; }
.row-id    { font-size: 12px; color: var(--txl); font-weight: 500; }

/* ── Amount styles ─────────────────────────────────────────── */
.amount-positive { color: #059669; font-weight: 600; }
.amount-negative { color: #dc2626; font-weight: 600; }
.amount-neutral  { color: var(--tx); font-weight: 600; }
.amount-transfer { color: var(--p); }

/* ── Date chip ─────────────────────────────────────────────── */
.date-chip {
  display: inline-block;
  padding: 2px 8px;
  background: var(--brl);
  border: 1px solid var(--br);
  border-radius: 6px;
  font-size: 12px;
  color: var(--txm);
  white-space: nowrap;
}
.date-chip.warning {
  background: var(--wbg);
  border-color: #fcd34d;
  color: #92400e;
}

/* ── Status Pill ───────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-completed { background: var(--sbg); color: #065f46; }
.status-pending   { background: var(--wbg); color: #92400e; }
.status-partial   { background: var(--ibg); color: #1e40af; }
.status-draft     { background: #f1f5f9;    color: #64748b; }
.status-finalized { background: var(--sbg); color: #065f46; }

/* ── Type chip ─────────────────────────────────────────────── */
.type-chip {
  display: inline-block;
  padding: 2px 9px;
  background: var(--pbg);
  color: var(--p);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

/* ── Transfer account cell ─────────────────────────────────── */
.transfer-account {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}
.transfer-account.from { color: #dc2626; }
.transfer-account.from i { font-size: 12px; }
.transfer-account.to   { color: #059669; }
.transfer-account.to i { font-size: 12px; }

/* ── Action buttons ────────────────────────────────────────── */
.action-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.action-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  background: transparent;
  text-decoration: none;
}
.action-btn.edit {
  border-color: #c7d2fe;
  color: var(--p);
}
.action-btn.edit:hover {
  background: var(--p);
  border-color: var(--p);
  color: #fff;
}
.action-btn.delete {
  border-color: #fecaca;
  color: var(--d);
}
.action-btn.delete:hover {
  background: var(--d);
  border-color: var(--d);
  color: #fff;
}

/* ── Filter Panel ──────────────────────────────────────────── */
.filter-panel {
  background: var(--sur);
  border: 1px solid var(--br);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--sh);
}
.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 130px;
}
.filter-field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--txm);
}
.filter-actions {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  flex-shrink: 0;
}

/* ── Table footer (pagination) ─────────────────────────────── */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--br);
  background: var(--sur);
}

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--txm);
}
.empty-state i {
  font-size: 40px;
  color: var(--txl);
  display: block;
  margin-bottom: 12px;
}
.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--txm);
}

/* ── Dark mode for new components ──────────────────────────── */
[data-theme="dark"] .list-table thead tr { background: #0f172a; }
[data-theme="dark"] .list-table thead th { color: var(--txm); border-color: var(--br); }
[data-theme="dark"] .list-table tbody td { border-color: #1e293b; }
[data-theme="dark"] .list-table tbody tr:hover td { background: #0f172a; }
[data-theme="dark"] .date-chip { background: #0f172a; border-color: var(--br); }
[data-theme="dark"] .summary-pill { background: var(--sur); border-color: var(--br); }
[data-theme="dark"] .section-card { background: var(--sur); border-color: var(--br); }
[data-theme="dark"] .section-card-head { background: var(--sur); border-color: var(--br); }
[data-theme="dark"] .filter-panel { background: var(--sur); border-color: var(--br); }
[data-theme="dark"] .table-footer { background: var(--sur); border-color: var(--br); }
[data-theme="dark"] .status-completed { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .status-pending   { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .status-partial   { background: #0c1a2e; color: #93c5fd; }
[data-theme="dark"] .type-chip { background: #1e1b4b; color: #a5b4fc; }
[data-theme="dark"] .action-btn.edit  { border-color: #3730a3; color: #a5b4fc; }
[data-theme="dark"] .action-btn.delete { border-color: #7f1d1d; color: #fca5a5; }

/* ============================================================
   Tab System — v3.2
   ============================================================ */

/* ── Tab Navigation Bar ────────────────────────────────────── */
.tab-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--sur);
  border: 1px solid var(--br);
  border-bottom: none;
  border-radius: var(--r) var(--r) 0 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--txm);
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
  font-family: var(--fn);
  position: relative;
}
.tab-btn:hover {
  color: var(--p);
  background: var(--pbg);
}
.tab-btn.active {
  color: var(--p);
  border-bottom-color: var(--p);
  font-weight: 600;
  background: var(--pbg);
}
.tab-btn i { font-size: 14px; }

/* ── Tab Count Badge ───────────────────────────────────────── */
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.tab-count.success  { background: var(--sbg); color: #065f46; }
.tab-count.danger   { background: var(--dbg); color: #991b1b; }
.tab-count.warning  { background: var(--wbg); color: #92400e; }
.tab-count.primary  { background: var(--pbg); color: var(--pd); }
.tab-count.secondary{ background: #f1f5f9;    color: #64748b; }

/* ── Tab Panels Container ──────────────────────────────────── */
.tab-panels {
  background: var(--sur);
  border: 1px solid var(--br);
  border-radius: 0 0 var(--r) var(--r);
  overflow: hidden;
}

/* ── Tab Panel ─────────────────────────────────────────────── */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
  animation: fadeUp .18s ease forwards;
}

/* ── Filter bar inside tab ─────────────────────────────────── */
.tab-filter-bar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--br);
  background: var(--brl);
}

/* ── Table total row ───────────────────────────────────────── */
.table-total-row td {
  background: var(--brl) !important;
  border-top: 2px solid var(--br) !important;
  padding: 10px 16px !important;
  font-size: 13px;
}

/* ── Dark mode tabs ────────────────────────────────────────── */
[data-theme="dark"] .tab-nav    { background: var(--sur); border-color: var(--br); }
[data-theme="dark"] .tab-btn    { color: var(--txm); }
[data-theme="dark"] .tab-btn:hover  { background: #1e1b4b; }
[data-theme="dark"] .tab-btn.active { background: #1e1b4b; }
[data-theme="dark"] .tab-panels { background: var(--sur); border-color: var(--br); }
[data-theme="dark"] .tab-filter-bar { background: #0f172a; border-color: var(--br); }
[data-theme="dark"] .table-total-row td { background: #0f172a !important; border-color: var(--br) !important; }
[data-theme="dark"] .tab-count.secondary { background: #1e293b; color: #94a3b8; }

/* ============================================================
   Account Cards & Admin Components — v3.3
   ============================================================ */

/* ── Account Card ──────────────────────────────────────────── */
.account-card {
  background: var(--sur);
  border: 1px solid var(--br);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--sh);
  transition: box-shadow .2s, transform .2s;
  height: 100%;
}
.account-card:hover { box-shadow: var(--shm); transform: translateY(-2px); }
.account-card.inactive { opacity: .65; }

.ac-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.ac-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
}
.ac-info { flex: 1; min-width: 0; }
.ac-name { font-weight: 600; font-size: 14px; color: var(--tx); }
.ac-type { font-size: 11px; color: var(--txm); text-transform: capitalize; margin-top: 2px; }
.ac-status { flex-shrink: 0; }

.ac-balance {
  background: var(--brl);
  border-radius: var(--rs);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.ac-balance-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--txm); margin-bottom: 4px; }
.ac-balance-value { font-size: 22px; font-weight: 700; line-height: 1; }
.ac-balance-value.positive { color: #059669; }
.ac-balance-value.negative { color: #dc2626; }

.ac-desc { font-size: 12px; color: var(--txm); margin-bottom: 12px; line-height: 1.5; }

.ac-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--br);
}
.ac-id { font-size: 11px; color: var(--txl); }

/* ── Type Preview Box ──────────────────────────────────────── */
.type-preview-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--br);
  border-radius: var(--rs);
  font-size: 13.5px;
  color: var(--txm);
  background: var(--bg);
  min-height: 40px;
  transition: all .2s;
}
.type-preview-box i { font-size: 16px; }

/* ── Type Guide List ───────────────────────────────────────── */
.type-guide-list { display: flex; flex-direction: column; gap: 14px; }
.tg-item { display: flex; align-items: flex-start; gap: 12px; }
.tg-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.tg-name { font-weight: 600; font-size: 13px; color: var(--tx); }
.tg-desc { font-size: 12px; color: var(--txm); margin-top: 2px; line-height: 1.4; }

/* ── Dark mode account cards ───────────────────────────────── */
[data-theme="dark"] .account-card { background: var(--sur); border-color: var(--br); }
[data-theme="dark"] .ac-balance { background: #0f172a; }
[data-theme="dark"] .type-preview-box { background: #0f172a; border-color: var(--br); }

/* ── Account Info Bar ──────────────────────────────────────── */
.acc-info-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding: 7px 12px;
  background: var(--pbg);
  border: 1px solid var(--primary-mid, #c7d2fe);
  border-radius: var(--rs);
  font-size: 12.5px;
  color: var(--tx);
  animation: fadeUp .15s ease;
}
.acc-info-bar i { color: var(--p); font-size: 13px; }
[data-theme="dark"] .acc-info-bar {
  background: #1e1b4b;
  border-color: #3730a3;
}
