/* MG Aufwandsübersicht
   Layout: ein Kontoauszug – Kopf mit Zeitraum, Summenzeile, zwei Aufschlüsselungen, dann das Buchungsjournal */
:root {
  --bg: #f4f6f6;
  --surface: #ffffff;
  --fg: #16201f;
  --muted: #5d6b69;
  --line: #d9e0df;
  --accent: #0d6e6a;
  --accent-soft: #d6ebe9;
  --plan: #9a7b1c;
  --plan-soft: #f3ecd4;
  --billed: #3d4f8a;
  --billed-soft: #dfe3f2;
  --danger: #b0322a;
  --ok: #1f6b3a;
  --display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Bewusst keine Google Fonts: Schriften werden nicht von Dritt-Servern geladen (DSGVO). */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101615; --surface: #172020; --fg: #e4ecea; --muted: #94a5a2; --line: #2b3837;
    --accent: #4fb8b1; --accent-soft: #173a38; --plan: #d6b452; --plan-soft: #3a3218;
    --billed: #8fa2e0; --billed-soft: #222a45; --danger: #ef7a70; --ok: #7fd39b; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--body); }
img { max-width: 100%; }
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 20px; padding-block: 20px 64px; display: grid; gap: 28px; }
.narrow { max-width: 440px; margin: 0 auto; padding-inline: 20px; padding-block: 48px; display: grid; gap: 16px; }
h1, h2 { font-family: var(--display); text-wrap: balance; margin: 0; }
h1 { font-size: clamp(28px, 4.5vw, 42px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
h2 { font-size: 18px; font-weight: 600; }
p { margin: 0; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
button, select, input, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select, input, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-width: 0; }

.btn { display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 8px 14px; font-weight: 500; color: var(--fg); text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn.ghost { background: transparent; border-color: transparent; padding: 6px 8px; color: var(--muted); }
.btn.ghost:hover { color: var(--fg); }
.btn.danger { color: var(--danger); }
.linklike { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }

.userbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.userbar strong { color: var(--fg); font-weight: 600; }
.userbar-links { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }

header.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
header.top .titles { display: grid; gap: 6px; min-width: 0; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.field-inline { display: flex; align-items: center; gap: 8px; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stat { background: var(--surface); padding: 18px 20px; display: grid; gap: 4px; align-content: start; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 500; letter-spacing: -0.01em; }
.stat .sub { font-size: 13px; color: var(--muted); }
.meter { height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; margin-top: 6px; display: flex; }
.meter span { display: block; height: 100%; width: 0; }
.meter .m-done { background: var(--accent); }
.meter .m-plan { background: var(--plan); opacity: .7; }
.meter.over .m-done { background: var(--danger); }
.budget-edit { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.budget-edit input { width: 120px; }

.breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: grid; gap: 14px; min-width: 0; align-content: start; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; }
.bar-row .track { grid-column: 1 / -1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.bar-row .track span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.empty-note { color: var(--muted); font-size: 14px; }

.journal { display: grid; gap: 12px; }
.journal-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
td.r, th.r { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); border-bottom: 0; }
.desc { max-width: 340px; }
.desc small { display: block; color: var(--muted); }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.chip.geplant { background: var(--plan-soft); color: var(--plan); }
.chip.erbracht { background: var(--accent-soft); color: var(--accent); }
.chip.abgerechnet { background: var(--billed-soft); color: var(--billed); }
.row-actions { white-space: nowrap; text-align: right; }
.inline-confirm { display: inline-block; }
.inline-confirm summary { list-style: none; display: inline-block; }
.inline-confirm summary::-webkit-details-marker { display: none; }

.empty-state { padding: 36px 20px; text-align: center; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.empty-state strong { color: var(--fg); font-family: var(--display); font-size: 18px; font-weight: 600; }

dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--fg); padding: 0; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 20, 20, .45); }
.form { display: grid; gap: 14px; padding: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.form label, .form-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.form label > *, .form-grid label > * { color: var(--fg); font-weight: 400; }
.mode { display: grid; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; width: max-content; max-width: 100%; }
.seg button { border: 0; background: var(--surface); padding: 7px 12px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--surface); }
.computed { font-size: 14px; color: var(--muted); }
.form-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.form-actions .right { display: flex; gap: 8px; margin-left: auto; }
.error { color: var(--danger); font-size: 14px; }
.ok { color: var(--ok); font-size: 14px; }
.notice { font-size: 13px; color: var(--muted); }
.pw-box code { font-size: 20px; user-select: all; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px; }
@media (prefers-reduced-motion: no-preference) { .meter span, .bar-row .track span { transition: width .4s ease; } }
.align-end { align-self: end; }

/* Budget-Töpfe im Gesamtblick */
.pots { display: grid; gap: 8px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.pot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: 13px; }
.pot .num { color: var(--fg); }
.pot .meter { grid-column: 1 / -1; margin-top: 2px; }
.meter.small { height: 5px; }
.meter.none { background: var(--bg); }
/* Rubrik-Umschalter */
#area-tabs button { white-space: nowrap; }
