/* ── Variables ────────────────────────────────────────── */
:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1c2128;
  --muted: #656d76;
  --accent: #146356;
  --accent-hover: #0f4f44;
  --accent-light: #e6f4f0;
  --danger: #d1242f;
  --danger-bg: #fff1f2;
  --danger-border: #fecdd3;
  --success: #1a7f37;
  --success-bg: #dafbe1;
  --border: #d0d7de;
  --border-light: #e8ecf0;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --radius: 10px;
  --radius-lg: 14px;
}

/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.navbar-brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -.02em;
}
.navbar-links {
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.navbar-links a:hover {
  background: var(--accent-light);
  color: var(--accent);
}
.navbar-user {
  font-size: .8rem;
  color: var(--muted);
  margin-right: 8px;
}

/* ── Layout ───────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px;
}
.narrow { max-width: 440px; }

/* ── Page Header ──────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
}
.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Grid ─────────────────────────────────────────────── */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 700px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

/* ── Category Cards (Dashboard) ───────────────────────── */
.cat-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.cat-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow .2s, transform .15s;
}
.cat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.cat-card-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 10px;
}
.cat-card-row {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.cat-card-progress {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}
.cat-card-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .4s ease;
}

/* ── Accordion (details/summary) ──────────────────────── */
details.accordion {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
details.accordion + details.accordion {
  margin-top: 12px;
}
details.accordion summary {
  padding: 16px 20px;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background .15s;
}
details.accordion summary:hover {
  background: var(--accent-light);
}
details.accordion summary::-webkit-details-marker { display: none; }
details.accordion summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--muted);
  transition: transform .2s;
}
details.accordion[open] summary::after {
  content: "\2212"; /* minus sign */
}
details.accordion[open] summary {
  border-bottom: 1px solid var(--border-light);
}
.accordion-body {
  padding: 16px 20px 20px;
}

/* ── Forms ─────────────────────────────────────────────── */
.field {
  margin-bottom: 14px;
}
.field-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: .9rem;
  color: var(--text);
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20,99,86,.12);
}
input::placeholder { color: #adb5bd; }

label {
  display: block;
  margin: 0;
}

/* ── Buttons ──────────────────────────────────────────── */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
}
button {
  background: var(--accent);
  color: #fff;
}
button:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(20,99,86,.25);
}
button:active {
  transform: scale(.98);
}
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* ── Stat Pills (category detail header) ──────────────── */
.stat-row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
}
.stat-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}

/* ── Lists ────────────────────────────────────────────── */
.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.list li {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  font-size: .88rem;
}

/* ── Transaction rows ─────────────────────────────────── */
.txn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.txn-date {
  color: var(--muted);
  font-size: .8rem;
  min-width: 90px;
}
.txn-note {
  flex: 1;
  color: var(--muted);
  font-size: .82rem;
}
.txn-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: 4px;
}
.txn-badge.topup {
  background: var(--success-bg);
  color: var(--success);
}
.txn-badge.spend {
  background: var(--danger-bg);
  color: var(--danger);
}
.txn-amount {
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
}
.txn-amount.positive { color: var(--success); }
.txn-amount.negative { color: var(--danger); }

/* ── Wishlist ─────────────────────────────────────────── */
.wish-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.wish-details {
  flex: 1;
  min-width: 0;
}
.wish-name {
  font-weight: 600;
}
.wish-price {
  color: var(--muted);
  font-size: .85rem;
}
.wish-status {
  font-size: .78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.wish-status.ok {
  background: var(--success-bg);
  color: var(--success);
}
.wish-status.wait {
  color: var(--muted);
  font-weight: 400;
}
.wish-move-buttons {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.move-form {
  margin: 0;
  padding: 0;
  line-height: 1;
}
.btn-move {
  width: 26px;
  height: 22px;
  padding: 0;
  font-size: .8rem;
  font-weight: 400;
  line-height: 1;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}
.btn-move:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Error / Alert ────────────────────────────────────── */
.error {
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: .88rem;
  font-weight: 500;
}

/* ── Empty state ──────────────────────────────────────── */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 16px;
  font-size: .9rem;
}

/* ── Auth page centering ──────────────────────────────── */
.auth-wrap {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.auth-card h1 {
  font-size: 1.5rem;
  margin: 0 0 4px;
}
.auth-card .tagline {
  color: var(--muted);
  font-size: .9rem;
  margin: 0 0 24px;
}
.auth-card form {
  text-align: left;
}
.auth-card .alt {
  margin-top: 16px;
  font-size: .85rem;
  color: var(--muted);
}
.auth-card .alt a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.auth-card .alt a:hover { text-decoration: underline; }

/* ── Links ────────────────────────────────────────────── */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Utility ──────────────────────────────────────────── */
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-md { margin-bottom: 16px; }
.section-title {
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin: 0 0 12px;
}
