:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 16px;
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: 80px; /* Space for bottom nav */
}

.app-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 24px 20px 16px;
  border-radius: 0 0 24px 24px;
}
.app-header h1 { font-size: 1.5rem; margin-bottom: 8px; }
.balance-card {
  background: rgba(255,255,255,0.2);
  padding: 16px;
  border-radius: var(--radius);
  backdrop-filter: blur(4px);
}
.balance-card span { font-size: 0.9rem; opacity: 0.9; }
.balance-card strong { display: block; font-size: 1.8rem; margin-top: 4px; }

main { padding: 20px; }
.tab { display: none; animation: fadeIn 0.3s ease; }
.tab.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

h2 { margin-bottom: 16px; font-size: 1.4rem; }
.card {
  background: var(--card-bg);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h3 { font-size: 1.1rem; margin-bottom: 12px; color: var(--primary); }

ul { list-style: none; }
li { padding: 12px 0; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; }
li:last-child { border-bottom: none; }
.amount.expense { color: var(--danger); font-weight: bold; }
.amount.income { color: var(--success); font-weight: bold; }

form { display: grid; gap: 12px; }
input, select, button {
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 1rem;
  width: 100%;
}
button {
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s, opacity 0.2s;
}
button:active { transform: scale(0.98); }

.budget-item, .goal-item {
  background: var(--card-bg);
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.4s ease;
}
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }

.chart-container { position: relative; height: 250px; margin-top: 10px; }

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: white;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
  padding: 8px 0;
  z-index: 100;
}
.bottom-nav button {
  flex: 1;
  background: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-radius: 0;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.bottom-nav button.active { color: var(--primary); font-weight: bold; }

@media (min-width: 600px) {
  main { max-width: 500px; margin: 0 auto; }
}
