:root {
  --bg: #0f0f11;
  --surface: #1a1a1f;
  --surface2: #222228;
  --border: #2e2e38;
  --accent: #c8f05a;
  --text: #e8e8ec;
  --muted: #6b6b7a;
  --bad: #ff6a6a;
  --good: #4ade80;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent); }

.flash-stack { padding: 16px; max-width: 480px; margin: 0 auto; }
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 8px; }
.flash-error { background: rgba(255,106,106,0.12); color: var(--bad); }

/* ── Login ───────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
}
.login-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  margin-bottom: 4px;
}
.login-sub {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 0.95rem;
}
.field {
  display: block;
  margin-bottom: 16px;
}
.field span {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: inherit;
}
.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.primary-btn {
  width: 100%;
  background: var(--accent);
  color: #0f0f11;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
}
.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font-family: inherit;
  cursor: pointer;
  font-size: 0.85rem;
}
.ghost-btn:hover { border-color: var(--muted); }

/* ── Dashboard ───────────────────────────────────────────────────────── */
.dash-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
  gap: 16px;
}
.dash-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2.4rem;
  letter-spacing: -0.02em;
}
.dash-sub { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 24px 0 14px;
}

.envelope-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.envelope-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.envelope-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), transparent 60%);
  opacity: 0.08;
  pointer-events: none;
}
.env-name {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.env-balance {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.env-budget { color: var(--muted); font-size: 0.78rem; margin-top: 2px; margin-bottom: 14px; }

.progress {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
}

/* ── Transactions ────────────────────────────────────────────────────── */
.txn-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.txn-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.txn-row:last-child { border-bottom: none; }
.txn-row.declined { opacity: 0.6; }
.txn-merchant { font-weight: 500; font-size: 0.95rem; }
.txn-meta { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.txn-amount { font-weight: 600; color: var(--bad); font-variant-numeric: tabular-nums; }
.bad { color: var(--bad); }
.empty { padding: 24px; color: var(--muted); font-size: 0.9rem; text-align: center; }

@media (max-width: 480px) {
  .envelope-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash-title { font-size: 1.8rem; }
}
