:root {
  --bg: #f5f7fb;
  --card: #fff;
  --primary: #2563eb;
  --income: #16a34a;
  --expense: #ef4444;
  --text: #0f172a;
  --muted: #6b7280;
  --border: #e5e7eb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "SF Pro Display", "PingFang SC", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); }

#app { max-width: 1100px; margin: 0 auto; padding: 16px; }
.hidden { display: none !important; }

.app-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.brand { font-size: 24px; font-weight: 700; }
.user-info { display: flex; align-items: center; gap: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}
.form label { display: block; margin: 8px 0; font-size: 14px; }
.form input, .form select {
  width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--border);
}
.form button { width: 100%; margin-top: 12px; }
.message { margin-top: 8px; color: var(--expense); font-size: 13px; min-height: 16px; }

button {
  cursor: pointer;
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
}
button.ghost { background: transparent; color: var(--primary); border: 1px solid var(--border); }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.tabs button { background: #e0e7ff; color: #1e40af; border: none; }
.tabs button.active { background: var(--primary); color: #fff; }
.tab { display: none; }
.tab.active { display: block; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters label { font-size: 12px; color: var(--muted); }
.filters select, .filters input { min-width: 120px; }

.stat-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stat-card .big { font-size: 28px; font-weight: 700; }
.stat-card .muted { color: var(--muted); font-size: 14px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; display: flex; justify-content: space-between; align-items: center; }
.item .meta { color: var(--muted); font-size: 12px; }
.item .amount.income { color: var(--income); }
.item .amount.expense { color: var(--expense); }
.item .actions { display: flex; gap: 8px; }
.danger { color: var(--expense); border-color: var(--expense); }

.chart-card { margin-top: 8px; }
.legend { display: flex; gap: 12px; align-items: center; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.dot.income { background: var(--income); }
.dot.expense { background: var(--expense); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 8px; }
.stat-row .label { color: var(--muted); font-size: 12px; }
.stat-row .value { font-weight: 700; font-size: 16px; }

.row { display: flex; align-items: center; justify-content: space-between; }
.label { color: var(--muted); font-size: 12px; }
.mono { font-family: "SF Mono", "Menlo", monospace; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
}
.modal .modal-content {
  background: #fff; border-radius: 12px; padding: 16px; width: min(420px, 90%);
  box-shadow: 0 16px 40px rgba(0,0,0,0.2);
}
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; }

@media (max-width: 640px) {
  .filters { flex-direction: column; align-items: flex-start; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
}
