:root {
  --bg: #0f1014;
  --surface: #1a1b21;
  --surface-2: #232430;
  --text: #f2f0ec;
  --text-muted: #8b8d97;
  --accent: #e2954a;
  --accent-soft: rgba(226, 149, 74, 0.16);
  --expense-color: #6fa8dc;
  --income-color: #7cc47f;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 84px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 20px 6px;
}
.topbar__icon { font-size: 20px; }
.topbar__title { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }

#app { padding: 12px 16px 0; display: flex; flex-direction: column; gap: 14px; }

.balance-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.balance-card__label { color: var(--text-muted); font-size: 14px; margin-bottom: 6px; }
.balance-card__value {
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.type-switch, .period-switch {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}
.type-switch__btn, .period-switch__btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 6px;
  border-radius: 10px;
  transition: background .15s ease, color .15s ease;
}
.type-switch__btn.is-active, .period-switch__btn.is-active {
  background: var(--surface-2);
  color: var(--accent);
}

.donut-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.donut {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: conic-gradient(var(--surface-2) 0 100%);
  position: relative;
  flex-shrink: 0;
}
.donut::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: var(--surface);
}
.donut-card__amount { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.donut-card__caption { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.category-list, .tx-list {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.tx-list__heading {
  margin: 0;
  padding: 16px 18px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.row:first-child { border-top: none; }
.row__icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.row__body { flex: 1; min-width: 0; }
.row__title { font-size: 15px; font-weight: 500; }
.row__subtitle { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.row__amount { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row__amount.is-expense { color: var(--expense-color); }
.row__amount.is-income { color: var(--income-color); }

.empty-state {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
}
.tabbar__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 0;
}
.tabbar__btn span { font-weight: 500; }
.tabbar__btn.is-active { color: var(--accent); }
