/* ── APP SHELL ────────────────────────────────────────────────────────────── */
.app-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
}

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}
.sidebar-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
  letter-spacing: -0.5px;
  padding: 0 24px 32px;
}
.sidebar-nav { flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.nav-item:hover { color: var(--fg); background: rgba(255,255,255,0.03); }
.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-glow);
}
.nav-icon { font-size: 12px; }
.sidebar-footer { padding: 20px 24px 0; }
.demo-badge {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 100px;
  font-size: 11px;
  color: #fbbf24;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* ── MAIN CONTENT ────────────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  margin-left: 220px;
  padding: 32px 40px 60px;
  max-width: 1200px;
}

/* ── HEADER ──────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}
.page-sub { font-size: 13px; color: var(--fg-muted); }
.header-actions { display: flex; gap: 10px; align-items: center; }

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn-primary {
  padding: 9px 20px;
  background: var(--accent);
  color: #0a0a0c;
  border: none;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  padding: 9px 20px;
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-secondary:hover { color: var(--fg); border-color: rgba(255,255,255,0.2); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.w-full { width: 100%; }
.mt-16 { margin-top: 16px; }

/* ── KPI CARDS ───────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.kpi-label {
  font-size: 12px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-weight: 500;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--fg);
}
.kpi-value.accent { color: var(--accent); }
.kpi-value.negative { color: #f87171; }
.kpi-sub { font-size: 12px; color: var(--fg-muted); margin-top: 6px; }

/* ── CARDS ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.card-sub { font-size: 13px; color: var(--fg-muted); }
.card-link { font-size: 13px; color: var(--accent); text-decoration: none; }
.card-link:hover { opacity: 0.8; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── CATEGORY LIST ───────────────────────────────────────────────────────── */
.category-list { display: flex; flex-direction: column; gap: 12px; }
.category-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.category-info { display: flex; align-items: center; gap: 8px; min-width: 160px; }
.category-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.category-name { font-size: 14px; font-weight: 500; text-transform: capitalize; }
.category-count { font-size: 12px; color: var(--fg-muted); }
.category-right { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: flex-end; }
.category-bar-wrap { width: 80px; height: 4px; background: var(--border); border-radius: 2px; }
.category-bar { height: 4px; background: var(--accent); border-radius: 2px; transition: width 0.3s; }
.category-amount { font-size: 14px; font-weight: 600; font-family: var(--font-display); min-width: 80px; text-align: right; }

/* Category color dots */
.cat-meals { background: #fb923c; }
.cat-travel { background: #60a5fa; }
.cat-software { background: var(--accent); }
.cat-office { background: #a78bfa; }
.cat-advertising { background: #f472b6; }
.cat-professional_services { background: #fbbf24; }
.cat-utilities { background: #94a3b8; }
.cat-payroll { background: #34d399; }
.cat-revenue { background: #4ade80; }
.cat-other { background: #475569; }

/* ── TRANSACTION LIST ────────────────────────────────────────────────────── */
.tx-list { display: flex; flex-direction: column; }
.tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.tx-row:last-child { border-bottom: none; }
.tx-name { font-size: 14px; font-weight: 500; }
.tx-meta { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.tx-cat {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.3px;
  background: var(--accent-glow);
  color: var(--accent);
}
.tx-amount { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: #f87171; }
.tx-amount.income { color: var(--accent); }

/* ── P&L CHART ───────────────────────────────────────────────────────────── */
.pnl-chart { padding: 8px 0 4px; }
.pnl-bars { display: flex; gap: 24px; align-items: flex-end; height: 140px; padding-bottom: 8px; }
.pnl-bar-group { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pnl-bar-pair { display: flex; gap: 4px; align-items: flex-end; }
.pnl-bar {
  width: 20px;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
}
.income-bar { background: var(--accent); opacity: 0.85; }
.expense-bar { background: #f87171; opacity: 0.75; }
.pnl-bar-label { font-size: 11px; color: var(--fg-muted); font-family: var(--font-display); }
.pnl-legend { display: flex; gap: 20px; margin-top: 12px; font-size: 13px; color: var(--fg-muted); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.legend-dot.income { background: var(--accent); }
.legend-dot.expense { background: #f87171; }

/* ── ACCOUNTS ────────────────────────────────────────────────────────────── */
.accounts-list { display: flex; flex-direction: column; gap: 12px; }
.account-row { display: flex; align-items: center; gap: 14px; }
.account-icon { font-size: 22px; }
.account-name { font-size: 15px; font-weight: 600; }
.account-meta { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.account-info { flex: 1; }
.status-badge {
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.status-badge.active { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(52,211,153,0.2); }
.status-badge.inactive { background: rgba(255,255,255,0.05); color: var(--fg-muted); border: 1px solid var(--border); }

/* ── EMPTY STATE ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-muted);
  font-size: 15px;
  line-height: 1.7;
}
.accent-link { color: var(--accent); text-decoration: none; }

/* ── MODAL ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 420px;
  max-width: 90vw;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--fg); }
.modal-desc { font-size: 14px; color: var(--fg-muted); margin-bottom: 20px; line-height: 1.6; }
.demo-banks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.demo-bank-btn {
  padding: 14px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}
.demo-bank-btn:hover { border-color: var(--accent); background: var(--accent-glow); }
.demo-bank-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── TRANSACTION TABLE ───────────────────────────────────────────────────── */
.table-card { padding: 0; overflow: hidden; }
.tx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tx-table thead tr { border-bottom: 1px solid var(--border); }
.tx-table th {
  padding: 14px 20px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255,255,255,0.02);
}
.tx-table td { padding: 13px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tx-table tbody tr:last-child td { border-bottom: none; }
.tx-table tbody tr:hover { background: rgba(255,255,255,0.015); }
.tx-date { color: var(--fg-muted); font-size: 13px; white-space: nowrap; }
.tx-name-cell { font-weight: 500; }
.tx-name-sub { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.tx-account { font-size: 13px; color: var(--fg-muted); }
.tx-amount-cell { font-family: var(--font-display); font-weight: 600; color: #f87171; }
.tx-amount-cell.income { color: var(--accent); }
.text-right { text-align: right; }

/* Category select in table */
.cat-select {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.cat-select:hover { border-color: rgba(255,255,255,0.2); }
.cat-select.cat-meals { border-color: #fb923c40; color: #fb923c; }
.cat-select.cat-travel { border-color: #60a5fa40; color: #60a5fa; }
.cat-select.cat-software { border-color: rgba(52,211,153,0.3); color: var(--accent); }
.cat-select.cat-office { border-color: #a78bfa40; color: #a78bfa; }
.cat-select.cat-advertising { border-color: #f472b640; color: #f472b6; }
.cat-select.cat-professional_services { border-color: #fbbf2440; color: #fbbf24; }
.cat-select.cat-utilities { border-color: #94a3b840; color: #94a3b8; }
.cat-select.cat-payroll { border-color: #34d39940; color: #34d399; }
.cat-select.cat-revenue { border-color: #4ade8040; color: #4ade80; }

/* ── FILTERS ─────────────────────────────────────────────────────────────── */
.filter-form { display: flex; gap: 10px; }
.filter-select {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
}
.filter-select:hover { border-color: rgba(255,255,255,0.2); }

/* ── SUMMARY BAR ─────────────────────────────────────────────────────────── */
.summary-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.summary-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s;
}
.summary-pill:hover { border-color: var(--accent); }
.pill-name { text-transform: capitalize; font-weight: 500; }
.pill-amount { font-family: var(--font-display); font-weight: 700; color: var(--accent); }

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .app-main { margin-left: 0; padding: 20px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .app-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
}
