:root {
  --bg: #f5f6f8; --card: #ffffff; --text: #1d2330; --muted: #6b7384; --line: #e3e6ec;
  --accent: #2458c6; --accent-2: #e9effb; --pos: #1b7f4b; --neg: #c0392b; --warn: #a26a00;
  --radius: 10px; --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 2px 8px rgba(20, 30, 50, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171d; --card: #1d2129; --text: #e7eaf0; --muted: #9aa3b4; --line: #2e3440;
    --accent: #7ea6ff; --accent-2: #243150; --pos: #5cc98d; --neg: #ff8272; --warn: #e4b44c;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; color: var(--muted); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.mt { margin-top: 1rem; }

/* Kopfzeile */
.top { background: var(--card); border-bottom: 1px solid var(--line); margin-bottom: 1.4rem; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
nav { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
nav a { padding: .4rem .7rem; border-radius: 6px; color: var(--text); }
nav a.active, nav a:hover { background: var(--accent-2); color: var(--accent); text-decoration: none; }
.foot { color: var(--muted); font-size: .85rem; padding: 2rem 16px; }

/* Karten */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.narrow { max-width: 440px; margin: 2rem auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid .card { margin-bottom: 0; }
.grid.two { grid-template-columns: 1fr; }
.stat .label { color: var(--muted); font-size: .85rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.stat .value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: .2rem; }
.stat .value.small { font-size: 1.1rem; }
.stat .sub { color: var(--muted); font-size: .85rem; margin-top: .3rem; }
.stat .more { display: inline-block; margin-top: .5rem; font-size: .9rem; }
.stat.highlight { border-color: var(--accent); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.badge { font-size: .72rem; padding: .1rem .45rem; border-radius: 99px; background: var(--accent-2); color: var(--accent); font-weight: 600; }
.badge.pub { background: color-mix(in srgb, var(--pos) 15%, transparent); color: var(--pos); }
.badge.priv { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }

/* Meldungen */
.flash { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { border-color: var(--pos); color: var(--pos); background: color-mix(in srgb, var(--pos) 8%, var(--card)); }
.flash.err { border-color: var(--neg); color: var(--neg); background: color-mix(in srgb, var(--neg) 8%, var(--card)); }
.flash.info { border-color: var(--accent); color: var(--accent); background: var(--accent-2); }
.flash.warn { border-color: var(--warn); color: var(--warn); }

/* Formulare */
input, select, button { font: inherit; }
input:where(:not([type=checkbox]):not([type=radio]):not([type=hidden])), select {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); font-size: .95rem; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.row-form { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; }
.row-form > label { flex: 1 1 140px; }
.row-form > label.grow { flex: 3 1 220px; }
.row-form .actions { display: flex; gap: .5rem; }
.inline-form { display: flex; gap: .4rem; align-items: center; }
.inline-form input { min-width: 0; }
.inline { display: inline; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; display: flex; flex-direction: column; gap: .4rem; }
legend { font-weight: 600; padding: 0 .3rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pin { font-size: 1.5rem; letter-spacing: .4em; text-align: center; }

.btn { display: inline-block; background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 7px; padding: .5rem 1rem; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.small { padding: .3rem .7rem; font-size: .88rem; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: var(--neg); border-color: var(--neg); }
nav .btn { color: #fff; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }
button.link:hover { text-decoration: underline; }
button.link.danger { color: var(--neg); }
nav button.link { padding: .4rem .7rem; color: var(--text); }

.head-row { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.head-row h1, .head-row h2 { margin: 0; }
.filters { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.filters select { width: auto; }
.filters .yr { width: 8.5rem; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .5rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--accent); border-color: var(--accent); }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
tfoot th { color: var(--text); font-size: .9rem; text-transform: none; border-top: 2px solid var(--line); }
td.r, th.r { text-align: right; white-space: nowrap; }
td.act { white-space: nowrap; text-align: right; }
td.act > * + * { margin-left: .7rem; }
tr.future td { opacity: .6; font-style: italic; }
table.compact td { padding: .35rem .4rem; }
.barcell { width: 35%; }
.kbar { display: block; height: 8px; border-radius: 4px; min-width: 2px; }
.kbar.ausgabe { background: var(--neg); }
.kbar.einnahme { background: var(--pos); }

@media (max-width: 560px) {
  .stat .value { font-size: 1.4rem; }
  .row-form > label, .row-form > label.grow { flex-basis: 100%; }
}
