:root {
  --bg: #0f172a;
  --panel: rgba(15, 23, 42, 0.72);
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #e5eefc;
  --muted: #a8b6cf;
  --accent: #60a5fa;
  --accent-strong: #3b82f6;
  --success: #34d399;
  --danger: #fb7185;
  --shadow: 0 20px 45px rgba(2, 6, 23, 0.35);
}

body.light {
  --bg: #eef4ff;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-border: rgba(148, 163, 184, 0.24);
  --text: #0f172a;
  --muted: #475569;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --success: #059669;
  --danger: #e11d48;
  --shadow: 0 14px 35px rgba(30, 41, 59, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.18), transparent 35%),
    radial-gradient(circle at bottom right, rgba(52, 211, 153, 0.18), transparent 30%),
    var(--bg);
  color: var(--text);
}

.app-shell {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero,
.card,
.transaction-item {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0.55rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

.subtext,
.card-header p,
.transaction-meta,
label,
.pill,
.empty-state {
  color: var(--muted);
}

.dashboard {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 1.2rem;
}

.summary-grid,
.transaction-card,
.history-card {
  grid-column: 2;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.45rem;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
}

.spent strong { color: var(--danger); }
.remaining strong { color: var(--success); }

.stack { display: flex; flex-direction: column; }
.gap-sm { gap: 0.75rem; }

.input-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 0.95rem;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.04);
}

.currency {
  font-weight: 800;
  color: var(--accent);
}

input, select, button {
  font: inherit;
}

input, select {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

input::placeholder { color: var(--muted); }
select option { color: #111827; }

.transaction-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.full-width { grid-column: 1 / -1; }

.quick-buttons,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease;
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 700;
}

.secondary-btn,
.quick-buttons button,
.ghost-btn {
  background: rgba(148, 163, 184, 0.14);
  color: var(--text);
  border: 1px solid var(--panel-border);
}

.danger-btn {
  background: rgba(251, 113, 133, 0.14);
  color: var(--danger);
  border: 1px solid rgba(251, 113, 133, 0.25);
}

.ghost-btn {
  min-width: 48px;
  min-height: 48px;
  font-size: 1.1rem;
}

.inline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
}

.transaction-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.75rem;
}

.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.04);
}

.transaction-note {
  display: block;
  margin-bottom: 0.2rem;
}

.transaction-amount {
  color: var(--danger);
  white-space: nowrap;
}

.empty-state {
  padding: 1rem 0 0.25rem;
}

.hidden { display: none; }

@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .transaction-card,
  .history-card {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 1rem, 1000px);
    padding-top: 1rem;
  }

  .summary-grid,
  .transaction-form {
    grid-template-columns: 1fr;
  }

  .hero,
  .inline-header {
    flex-direction: column;
    align-items: stretch;
  }
}
