:root {
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --border: #e4e6eb;
  --text: #1c1e21;
  --muted: #767a82;
  --accent: #2563eb;
  --accent-bg: #eef2ff;
  --good: #1a9e5c;
  --warn: #d97706;
  --bad: #dc2626;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 1px 8px rgba(0,0,0,0.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card-bg: #191c22;
    --border: #2a2d35;
    --text: #eceef1;
    --muted: #9096a2;
    --accent: #6d9bff;
    --accent-bg: #1c2540;
    --good: #34d399;
    --warn: #fbbf24;
    --bad: #f87171;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 1px 8px rgba(0,0,0,0.25);
  }
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 24px 16px 64px;
}
.wrap { max-width: 720px; margin: 0 auto; }
.hidden { display: none !important; }
header { margin-bottom: 20px; }
header h1 { font-size: 20px; margin: 0 0 4px; }
.muted { color: var(--muted); font-size: 12.5px; margin: 0; }

.grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr 1fr; } }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card h2 { font-size: 14px; margin: 0 0 12px; }

label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; }
input[type="text"], input[type="password"] {
  width: 100%; padding: 9px 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font-family: inherit;
}
button {
  margin-top: 14px; padding: 9px 18px; font-size: 14px; font-weight: 600;
  border: none; border-radius: 999px; background: var(--accent); color: white; cursor: pointer;
}
button:hover { opacity: 0.9; }
.link-button {
  background: none; color: var(--muted); font-weight: 400; font-size: 12px;
  text-decoration: underline; padding: 0; margin-top: 8px;
}
.error { color: var(--bad); font-size: 13px; margin-top: 10px; }

.total-spend { display: flex; justify-content: space-between; align-items: baseline; }
.total-spend .label { color: var(--muted); font-size: 13px; }
.total-spend .value { font-size: 26px; font-weight: 700; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 22px; font-weight: 700; }

.budget-group .head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.budget-group .head .name { font-weight: 600; }
.progress-track {
  height: 8px; border-radius: 999px; background: var(--accent-bg); overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 999px; background: var(--good); }
.progress-fill.warn { background: var(--warn); }
.progress-fill.bad { background: var(--bad); }
.budget-group .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

.other-row { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.other-row:last-child { border-bottom: none; }

#trend svg { width: 100%; height: auto; }
