:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2d3148;
  --text: #e2e8f0;
  --text-muted: #718096;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --income: #22c55e;
  --expense: #ef4444;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 360px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.login-card .subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }

/* Forms */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; color: var(--text-muted); }
.field input, .field select { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.75rem; color: var(--text); font-size: 0.9rem; }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.75rem; color: var(--text); font-size: 0.9rem; resize: vertical; }

/* Buttons */
.btn-primary { background: var(--accent); color: #fff; border: none; border-radius: var(--radius); padding: 0.6rem 1.25rem; font-size: 0.9rem; font-weight: 600; cursor: pointer; width: 100%; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 1rem; font-size: 0.875rem; cursor: pointer; }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); border-radius: var(--radius); padding: 0.25rem 0.6rem; font-size: 0.8rem; cursor: pointer; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* App layout */
.app-layout { display: flex; height: 100vh; }
.sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 1.5rem 0; flex-shrink: 0; }
.sidebar-brand { font-size: 1.1rem; font-weight: 700; padding: 0 1.25rem 1.25rem; border-bottom: 1px solid var(--border); }
.sidebar-nav { flex: 1; padding: 0.75rem 0; }
.nav-item { display: block; padding: 0.6rem 1.25rem; color: var(--text-muted); font-size: 0.875rem; font-weight: 500; cursor: pointer; border-left: 3px solid transparent; transition: all 0.15s; }
.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item.active { color: var(--text); border-left-color: var(--accent); background: var(--surface2); }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.content { flex: 1; overflow-y: auto; padding: 1.5rem 2rem; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.375rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-value.income { color: var(--income); }
.stat-value.expense { color: var(--expense); }
.stat-value.net-pos { color: var(--success); }
.stat-value.net-neg { color: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { text-align: left; padding: 0.5rem 0.75rem; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* Progress bars */
.progress-bar-wrap { background: var(--surface2); border-radius: 99px; height: 8px; overflow: hidden; margin: 0.5rem 0; }
.progress-bar-fill { background: var(--accent); height: 100%; border-radius: 99px; transition: width 0.3s; }

/* Fund cards */
.fund-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.fund-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.fund-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }
.fund-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }

/* Filters row */
.filters { display: flex; gap: 0.75rem; margin-bottom: 1rem; align-items: flex-end; flex-wrap: wrap; }
.filters .field { margin-bottom: 0; }
.filters label { font-size: 0.75rem; }
.filters input, .filters select { padding: 0.4rem 0.6rem; font-size: 0.85rem; }

/* Misc */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-title { font-size: 1.25rem; font-weight: 700; }
.error-msg { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.75rem; }
.hidden { display: none !important; }
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 99px; font-size: 0.75rem; font-weight: 500; }
.badge-income { background: rgba(34,197,94,0.15); color: var(--income); }
.badge-expense { background: rgba(239,68,68,0.15); color: var(--expense); }
.tag { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.form-inline { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1.25rem; }
.form-inline .field { margin-bottom: 0; }
.section-title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-muted); }
.pagination { display: flex; gap: 0.5rem; margin-top: 1rem; align-items: center; font-size: 0.85rem; color: var(--text-muted); }
