:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef4ff;
  --text: #111827;
  --muted: #6b7280;
  --border: #dfe5ef;
  --accent: #2563eb;
  --accent-2: #14b8a6;
  --danger: #dc2626;
  --success: #059669;
  --warning: #b45309;
  --shadow: 0 12px 34px rgba(15, 23, 42, .08);
  --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
.app-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #0f172a; color: #e5e7eb; padding: 24px 18px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 800; font-size: 20px; margin-bottom: 28px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent-2); color: #062522; }
.nav { display: grid; gap: 4px; }
.nav a { color: #cbd5e1; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.main { min-width: 0; padding: 28px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.topbar h1, .auth-panel h1 { margin: 0; font-size: 32px; line-height: 1.15; letter-spacing: 0; }
.muted { color: var(--muted); margin: 0 0 6px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.button, button { border: 1px solid var(--border); background: var(--surface); color: var(--text); min-height: 40px; padding: 10px 14px; border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 14px; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.ghost { background: transparent; }
.button.full { width: 100%; }
.icon-button { width: 40px; padding: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi, .panel, .account-card, .auth-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi { padding: 18px; }
.kpi span { color: var(--muted); display: block; font-size: 13px; margin-bottom: 10px; }
.kpi strong { font-size: 26px; letter-spacing: 0; }
.success { color: var(--success); }
.danger { color: var(--danger); }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.panel { padding: 18px; min-width: 0; }
.panel.wide { grid-column: span 2; }
.panel h2, .account-card h2 { margin: 0 0 14px; font-size: 18px; }
.row { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row small { display: block; color: var(--muted); margin-top: 3px; }
.empty { color: var(--muted); text-align: center; padding: 18px; }
.warning { border-left: 3px solid var(--warning); background: #fff7ed; padding: 10px; border-radius: 6px; color: #7c2d12; }
.bars { display: grid; gap: 12px; }
.bars div { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; align-items: center; gap: 10px; font-size: 13px; }
.bars b { display: block; height: 8px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; background: #f8fafc; }
.data-table th, .data-table td { padding: 12px; border-bottom: 1px solid var(--border); }
.amount { font-weight: 800; white-space: nowrap; }
.type { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #e0f2fe; color: #075985; font-size: 12px; }
.type.expense, .type.bill_payment, .type.credit_payment { background: #fee2e2; color: #991b1b; }
.type.income { background: #dcfce7; color: #166534; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 10px; margin-bottom: 16px; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font: inherit; background: #fff; }
.form p { display: grid; gap: 6px; margin: 0 0 14px; }
.form label { font-weight: 700; font-size: 14px; }
.form-panel { max-width: 760px; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.account-card { padding: 18px; display: grid; gap: 12px; }
.account-card > strong { font-size: 28px; }
.progress { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 8px; vertical-align: -2px; }
.pagination { display: flex; justify-content: center; gap: 14px; margin: 18px 0; color: var(--muted); }
.auth-layout { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 30% 20%, #dbeafe 0, transparent 32%), var(--bg); }
.auth-panel { width: min(460px, 100%); padding: 28px; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; color: var(--accent); font-weight: 700; }
.messages { margin-bottom: 16px; }
.message { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; padding: 12px; border-radius: 8px; }
.mobile-nav { display: none; }
canvas { width: 100%; min-height: 220px; background: linear-gradient(180deg, #f8fafc, #fff); border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 18px 18px 82px; }
  .kpi-grid, .dashboard-grid, .card-grid { grid-template-columns: 1fr 1fr; }
  .panel.wide { grid-column: span 2; }
  .mobile-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--border); z-index: 10; }
  .mobile-nav a { text-align: center; padding: 12px 4px; font-size: 12px; color: var(--muted); }
}
@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar h1 { font-size: 26px; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .kpi-grid, .dashboard-grid, .card-grid, .filters { grid-template-columns: 1fr; }
  .panel.wide { grid-column: span 1; }
  .data-table { min-width: 0; }
  .data-table thead { display: none; }
  .data-table tr { display: grid; border-bottom: 1px solid var(--border); padding: 10px 0; }
  .data-table td { display: flex; justify-content: space-between; gap: 12px; border-bottom: 0; padding: 8px 0; }
  .data-table td::before { content: attr(data-label); color: var(--muted); font-weight: 700; }
  .auth-links { flex-direction: column; }
}
