:root {
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1d2330;
  --muted: #6b7280;
  --accent: #2563eb;
  --danger: #dc2626;
  --border: #e5e7eb;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1rem; padding: .75rem 1rem; background: var(--card); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.nav { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; }
.nav a { text-decoration: none; color: var(--muted); padding: .25rem 0; }
.nav a.active { color: var(--text); font-weight: 600; border-bottom: 2px solid var(--accent); }
.container { max-width: 960px; margin: 0 auto; padding: 1rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.card.narrow { max-width: 420px; margin: 2rem auto; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, monospace; font-size: .85rem; word-break: break-all; }
.total { font-size: 2rem; font-weight: 700; margin: 0; }
.error { color: var(--danger); background: #fef2f2; border-radius: 8px; padding: .5rem .75rem; }
.row-between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.item { border-top: 1px solid var(--border); padding: .75rem 0; }
.item:first-of-type { border-top: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.form { display: grid; gap: .75rem; }
.form label { display: grid; gap: .25rem; font-size: .9rem; }
input, select, textarea { font: inherit; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: 8px; width: 100%; }
button, .button {
  font: inherit; cursor: pointer; border: 0; border-radius: 8px; padding: .55rem 1rem;
  background: var(--accent); color: #fff; text-decoration: none; display: inline-block;
}
button.secondary, .button.secondary { background: #e8eefc; color: var(--accent); }
button.danger { background: #fde8e8; color: var(--danger); }
button.link { background: none; color: var(--muted); padding: .25rem 0; }
form.inline { display: inline; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 500; }
.num { text-align: right; white-space: nowrap; }
.sources { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); }
.bar { background: var(--border); height: 4px; border-radius: 2px; margin-top: .25rem; min-width: 60px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.balances { list-style: none; padding: 0; margin: .25rem 0 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
