/* =========================================================================
   Finanzplaner – Designsystem
   Ruhige, kühle Grundfläche, Petrol als einzige Akzentfarbe, Grün/Rot nur
   für Geldflüsse. Beträge mit abgesetzten Nachkommastellen als Erkennungsmerkmal.
   ========================================================================= */

[hidden] { display: none !important; }

:root {
  color-scheme: light;
  --bg: #F2F4F3;
  --surface: #FFFFFF;
  --surface-2: #F7F9F8;
  --surface-3: #EDF1EF;
  --ink: #15202A;
  --ink-2: #56636F;
  --ink-3: #85919C;
  --line: #E1E6E4;
  --line-strong: #CDD5D2;
  --primary: #0E5A63;
  --primary-hover: #0B4A52;
  --primary-ink: #FFFFFF;
  --primary-soft: #E2EFEE;
  --primary-tint: #CFE4E2;
  --income: #1E7650;
  --income-soft: #E3F2EA;
  --expense: #B03F37;
  --expense-soft: #F8E7E5;
  --warn: #B9650F;
  --warn-soft: #FBEEDC;
  --notice: #8C7A12;
  --notice-soft: #F6F1D6;
  --hero: #0E4F57;
  --hero-ink: #F2FAF9;
  --hero-ink-2: #A9CFCB;
  --shadow-1: 0 1px 2px rgba(18, 38, 44, .05);
  --shadow-2: 0 2px 6px rgba(18, 38, 44, .06), 0 1px 2px rgba(18, 38, 44, .04);
  --shadow-3: 0 18px 50px rgba(10, 30, 36, .18), 0 4px 12px rgba(10, 30, 36, .08);
  --focus: 0 0 0 3px rgba(14, 90, 99, .28);
  --r-xl: 20px;
  --r-lg: 16px;
  --r-md: 11px;
  --r-sm: 8px;
  --sidebar: 248px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter Display", "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Display", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: 180ms;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1417;
  --surface: #151D21;
  --surface-2: #1A2328;
  --surface-3: #212C31;
  --ink: #E5ECEE;
  --ink-2: #A1AEB6;
  --ink-3: #75838C;
  --line: #243036;
  --line-strong: #33424A;
  --primary: #4FB0B9;
  --primary-hover: #66C0C8;
  --primary-ink: #082528;
  --primary-soft: #18343A;
  --primary-tint: #1F4950;
  --income: #4CBE8B;
  --income-soft: #15302A;
  --expense: #E8786E;
  --expense-soft: #3A2022;
  --warn: #E59B4E;
  --warn-soft: #382A18;
  --notice: #D2BE58;
  --notice-soft: #312D17;
  --hero: #12373D;
  --hero-ink: #E9F6F5;
  --hero-ink-2: #8FBDB8;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-3: 0 18px 50px rgba(0, 0, 0, .55);
  --focus: 0 0 0 3px rgba(79, 176, 185, .35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 var(--font); letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); color: var(--ink); }
h1 { font-size: 26px; line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 17px; line-height: 1.3; font-weight: 620; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num, .amt { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.pos { color: var(--income); }
.neg { color: var(--expense); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

/* Betrag: Nachkommastellen und Währung kleiner und gedämpft */
.amt { white-space: nowrap; font-weight: 600; letter-spacing: -0.01em; }
.amt .dec { font-size: .72em; font-weight: 500; opacity: .62; margin-left: .04em; }
.amt.lg { font-size: 28px; font-weight: 650; letter-spacing: -0.025em; }
.amt.xl { font-size: 40px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.05; }

/* ---------------------------------------------------------------- Layout */
.app { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 22px 14px 18px; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; }
.brand-mark svg { width: 17px; height: 17px; stroke-width: 2.2; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-md); color: var(--ink-2); font-weight: 520;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.nav a[aria-current="page"] svg { stroke-width: 2.1; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 12px; }
.sidebar-foot { margin-top: auto; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); display: flex; gap: 8px; }
.sidebar-foot svg { width: 16px; height: 16px; margin-top: 2px; color: var(--primary); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 64px;
  padding: 10px 32px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent; transition: border-color var(--dur);
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.topbar .crumbs strong { color: var(--ink); font-weight: 600; font-size: 15px; }
.topbar .spacer { flex: 1; }
.topbar .mobile-brand { display: none; }
.content { padding: 8px 32px 48px; width: 100%; max-width: 1320px; margin: 0 auto; }
.page { animation: pageIn 220ms var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 12px 0 22px; }
.page-head .lead { margin-top: 4px; color: var(--ink-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.demo-banner {
  display: flex; align-items: center; gap: 12px; padding: 10px 32px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; font-weight: 520; flex-wrap: wrap;
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
}
.demo-banner .btn { margin-left: auto; }

/* Mobile Navigation */
.bottom-nav { display: none; }

/* ---------------------------------------------------------------- Karten */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head .link { font-size: 13px; font-weight: 550; display: inline-flex; align-items: center; gap: 2px; }
.card-head .link svg { width: 15px; height: 15px; }
.card.flush { padding: 0; }
.card.flush .card-head { padding: 18px 20px 0; }

.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.dash { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }

/* Hero (Kontostand) */
.hero {
  grid-column: span 12; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 0;
  background: var(--hero); color: var(--hero-ink); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-2);
}
.hero-main { padding: 26px 28px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.hero-main .label { color: var(--hero-ink-2); font-size: 13.5px; font-weight: 520; }
.hero-main .amt.xl { color: var(--hero-ink); }
.hero-main .delta { font-size: 13.5px; color: var(--hero-ink-2); }
.hero-main .delta b { color: var(--hero-ink); font-weight: 600; }
.hero-accounts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 13px; color: var(--hero-ink-2); }
.hero-accounts span b { color: var(--hero-ink); font-weight: 600; }
.hero-flow { padding: 22px 26px; background: rgba(255, 255, 255, .055); display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; align-content: center; border-left: 1px solid rgba(255, 255, 255, .08); }
.hero-flow .k { font-size: 12.5px; color: var(--hero-ink-2); display: flex; align-items: center; gap: 6px; }
.hero-flow .k svg { width: 14px; height: 14px; }
.hero-flow .v { font-size: 19px; font-weight: 640; letter-spacing: -0.015em; margin-top: 2px; color: var(--hero-ink); }
.hero-flow .c { font-size: 12px; color: var(--hero-ink-2); margin-top: 1px; }
.hero-flow .full { grid-column: span 2; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .1); }

/* Kennzahlen */
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--ink-2); font-size: 13.5px; font-weight: 520; }
.kpi .kpi-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.kpi .kpi-ico svg { width: 16px; height: 16px; }
.kpi .kpi-ico.income { background: var(--income-soft); color: var(--income); }
.kpi .kpi-ico.expense { background: var(--expense-soft); color: var(--expense); }
.kpi .kpi-ico.primary { background: var(--primary-soft); color: var(--primary); }
.kpi .kpi-val { font-size: 25px; margin-top: 4px; }
.kpi .kpi-foot { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 19px; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12px; padding: 1px 7px 1px 5px; border-radius: 999px; }
.trend svg { width: 13px; height: 13px; stroke-width: 2.2; }
.trend.good { background: var(--income-soft); color: var(--income); }
.trend.bad { background: var(--expense-soft); color: var(--expense); }
.trend.flat { background: var(--surface-3); color: var(--ink-2); }

/* ---------------------------------------------------------------- Buttons */
.btn {
  --b-bg: var(--surface); --b-fg: var(--ink); --b-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 15px; border-radius: var(--r-md);
  background: var(--b-bg); color: var(--b-fg); border: 1px solid var(--b-bd); font-weight: 560; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur), color var(--dur), transform 120ms, box-shadow var(--dur);
  -webkit-tap-highlight-color: transparent; text-decoration: none !important; user-select: none;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { --b-bg: var(--primary); --b-fg: var(--primary-ink); --b-bd: var(--primary); box-shadow: 0 1px 2px rgba(14, 90, 99, .25); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { --b-bg: var(--expense); --b-fg: #fff; --b-bd: var(--expense); }
.btn.danger:hover { filter: brightness(.95); background: var(--expense); }
.btn.ghost { --b-bg: transparent; --b-bd: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.soft { --b-bg: var(--primary-soft); --b-fg: var(--primary); --b-bd: transparent; }
.btn.soft:hover { background: var(--primary-tint); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.icon { padding: 0; width: 40px; }
.btn.sm.icon { width: 32px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.block { width: 100%; }

/* Segment-Schalter */
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-md); padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 540; color: var(--ink-2); cursor: pointer; white-space: nowrap; min-height: 32px; transition: background var(--dur), color var(--dur); }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button svg { width: 15px; height: 15px; flex: none; }
.seg button:disabled { cursor: not-allowed; opacity: .55; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg.type button[aria-pressed="true"][data-value="income"] { color: var(--income); }
.seg.type button[aria-pressed="true"][data-value="expense"] { color: var(--expense); }
.seg.type button[aria-pressed="true"][data-value="transfer"] { color: var(--primary); }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }

/* ---------------------------------------------------------------- Formulare */
.form { display: flex; flex-direction: column; gap: 16px; }
.form .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 560; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.field .err { font-size: 12.5px; color: var(--expense); font-weight: 520; display: none; }
.field.invalid .err { display: block; }
.field.invalid .input { border-color: var(--expense); }
.input {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface);
  transition: border-color var(--dur), box-shadow var(--dur); appearance: none; -webkit-appearance: none;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
textarea.input { min-height: 72px; resize: vertical; }
select.input { padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385919C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input.amount-input { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; min-height: 62px; padding: 8px 46px 8px 14px; font-variant-numeric: tabular-nums; }
.amount-wrap { position: relative; }
.amount-wrap .cur { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 600; color: var(--ink-3); pointer-events: none; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 17px; height: 17px; }
.input-icon .input { padding-left: 38px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.more-toggle { align-self: flex-start; }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-section[hidden] { display: none; }

/* Kategorie-Auswahl als Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px 6px 8px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 13px; font-weight: 520; cursor: pointer; color: var(--ink-2); min-height: 34px; transition: all var(--dur);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip .dot { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; color: #fff; }
.chip .dot svg { width: 13px; height: 13px; stroke-width: 2.2; }
.chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--primary); }
.chip.static { cursor: default; }

/* Icon- und Farbwahl */
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.picker-grid button { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.picker-grid button[aria-pressed="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); color: var(--primary); background: var(--primary-soft); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }

/* ---------------------------------------------------------------- Listen */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; color: #fff; }
.avatar svg { width: 18px; height: 18px; stroke-width: 2; }
.avatar.sm { width: 32px; height: 32px; border-radius: 9px; }
.avatar.sm svg { width: 16px; height: 16px; }
.avatar.transfer { background: var(--primary-soft); color: var(--primary); }

/* Buchungsliste */
.tx-group { margin-bottom: 4px; }
.tx-date { position: sticky; top: 64px; z-index: 2; display: flex; justify-content: space-between; padding: 14px 20px 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); background: var(--surface); }
.tx-date .sum { font-variant-numeric: tabular-nums; font-weight: 550; }
.tx {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 10px 20px; cursor: pointer;
  transition: background var(--dur);
}
.tx:hover, .tx:focus-visible { background: var(--surface-2); }
.tx:focus-visible { box-shadow: inset var(--focus); border-radius: 0; }
.tx .desc { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .sub { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tx .val { text-align: right; font-size: 15px; }
.tx .val.income { color: var(--income); }
.tx .val.transfer { color: var(--ink-2); }
.tx .tx-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--dur); }
.tx:hover .tx-actions, .tx:focus-within .tx-actions { opacity: 1; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--income-soft); color: var(--income); }
.badge.bad { background: var(--expense-soft); color: var(--expense); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.badge svg { width: 12px; height: 12px; }

/* Toolbar & Filter */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 260px; }
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; padding: 16px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); animation: fadeDown 180ms var(--ease); }
.filters[hidden] { display: none; }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.summary-bar { display: flex; gap: 22px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.summary-bar b { font-weight: 620; font-size: 15px; color: var(--ink); display: block; }
.pager { display: flex; justify-content: center; padding: 16px; }

/* ---------------------------------------------------------------- Fortschritt */
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; position: relative; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width 500ms var(--ease); }
.progress.ok > span { background: var(--primary); }
.progress.notice > span { background: var(--notice); }
.progress.warning > span { background: var(--warn); }
.progress.over > span { background: var(--expense); }
.progress.lg { height: 10px; }
.level-text.notice { color: var(--notice); } .level-text.warning { color: var(--warn); } .level-text.over { color: var(--expense); } .level-text.ok { color: var(--ink-3); }

.budget-row { display: flex; flex-direction: column; gap: 7px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.budget-row:last-child { border-bottom: 0; }
.budget-row .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.budget-row .name { font-weight: 560; display: flex; gap: 8px; align-items: center; min-width: 0; }
.budget-row .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.budget-row .foot { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); }

.budget-card .big { display: flex; align-items: baseline; gap: 6px; margin: 12px 0 10px; flex-wrap: wrap; }
.budget-card .history { display: flex; align-items: flex-end; gap: 6px; height: 40px; margin-top: 14px; }
.budget-card .history span { flex: 1; border-radius: 4px 4px 2px 2px; background: var(--primary-tint); min-height: 3px; position: relative; }
.budget-card .history span.over { background: color-mix(in srgb, var(--expense) 55%, transparent); }
.budget-card .history span.current { background: var(--primary); }
.budget-card .history span.current.over { background: var(--expense); }

/* Sparziele */
.goal-card { display: flex; flex-direction: column; gap: 12px; }
.goal-card .head { display: flex; gap: 12px; align-items: center; }
.ring { --p: 0; --c: var(--primary); width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring::before { content: ""; grid-area: 1 / 1; width: 50px; height: 50px; border-radius: 50%; background: var(--surface); }
.ring span { grid-area: 1 / 1; z-index: 1; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.goal-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.goal-stats div { background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 10px; }
.goal-stats .k { font-size: 11.5px; color: var(--ink-3); }
.goal-stats .v { font-size: 14px; font-weight: 600; }
.forecast { font-size: 13px; padding: 9px 11px; border-radius: var(--r-sm); display: flex; gap: 8px; align-items: flex-start; }
.forecast svg { width: 16px; height: 16px; margin-top: 2px; }
.forecast.on_track { background: var(--income-soft); color: var(--income); }
.forecast.tight { background: var(--warn-soft); color: var(--warn); }
.forecast.behind, .forecast.overdue { background: var(--expense-soft); color: var(--expense); }

/* Konten */
.account-card { display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.account-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--acc, var(--primary)); }
.breakdown { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 13.5px; margin-top: 8px; }
.breakdown .total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 650; }

/* ---------------------------------------------------------------- Diagramme */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .zero-line { stroke: var(--line-strong); }
.chart .hover-line { stroke: var(--ink-3); stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--ink); color: var(--surface); padding: 8px 10px; border-radius: 9px; font-size: 12.5px;
  box-shadow: var(--shadow-3); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity 120ms;
}
.chart-tip.show { opacity: 1; }
.chart-tip .t { font-weight: 600; margin-bottom: 3px; }
.chart-tip .r { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.chart-tip .sw { width: 8px; height: 8px; border-radius: 2px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-wrap { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; align-items: center; }
.donut-legend { display: flex; flex-direction: column; gap: 2px; }
.donut-legend button { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; border: 0; background: transparent; text-align: left; cursor: pointer; font-size: 13.5px; }
.donut-legend button:hover, .donut-legend button.hl { background: var(--surface-2); }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .p { color: var(--ink-3); font-size: 12px; width: 42px; text-align: right; }
.donut-center { font-variant-numeric: tabular-nums; }
.bar-h { display: flex; flex-direction: column; gap: 10px; }
.bar-h .r { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13.5px; }
.bar-h .r .progress { grid-column: span 2; height: 6px; }

/* Hinweise */
.notice-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); font-size: 13.5px; color: var(--ink-2); }
.notice-box svg { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--primary); }
.notice-box.warn { background: var(--warn-soft); color: var(--warn); }
.notice-box.warn svg { color: var(--warn); }
.notice-box.danger { background: var(--expense-soft); color: var(--expense); }
.notice-box.danger svg { color: var(--expense); }

/* Leere Zustände & Onboarding */
.empty { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--ink-2); }
.empty .ico { width: 52px; height: 52px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 6px; }
.empty .ico svg { width: 24px; height: 24px; }
.empty h3 { color: var(--ink); font-size: 16px; }
.empty p { max-width: 380px; font-size: 14px; }
.empty .row { margin-top: 10px; justify-content: center; }
.empty.compact { padding: 22px 10px; }

.onboarding { grid-column: span 12; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 0; overflow: hidden; padding: 0; }
.onboarding .intro { padding: 32px; background: var(--hero); color: var(--hero-ink); display: flex; flex-direction: column; gap: 10px; }
.onboarding .intro h2 { color: var(--hero-ink); font-size: 24px; letter-spacing: -0.02em; }
.onboarding .intro p { color: var(--hero-ink-2); }
.onboarding .steps { padding: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.step { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; transition: border-color var(--dur), background var(--dur); }
.step:hover { border-color: var(--primary); background: var(--surface-2); }
.step .avatar { width: 36px; height: 36px; }
.step b { display: block; font-weight: 600; margin-bottom: 2px; }
.step span { font-size: 13px; color: var(--ink-2); }

/* ---------------------------------------------------------------- Dialoge */
dialog.dlg {
  border: 0; padding: 0; margin: auto; width: min(560px, calc(100vw - 32px)); max-height: min(88vh, 860px); border-radius: var(--r-xl); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-3); overflow: hidden; display: flex; flex-direction: column;
}
dialog.dlg:not([open]) { display: none; }
dialog.dlg.wide { width: min(820px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: rgba(9, 22, 26, .42); backdrop-filter: blur(2px); }
dialog.dlg[open] { animation: dlgIn 200ms var(--ease); }
dialog.dlg[open]::backdrop { animation: fadeIn 200ms var(--ease); }
dialog.dlg.closing { animation: dlgOut 150ms var(--ease) forwards; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes dlgOut { to { opacity: 0; transform: translateY(6px) scale(.985); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.dlg-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.dlg-head h2 { flex: 1; font-size: 18px; }
.dlg-body { padding: 4px 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.dlg-foot .left { margin-right: auto; display: flex; gap: 6px; }
.grabber { display: none; }

/* Toasts */
.toasts { position: fixed; z-index: 1000; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 420px; padding: 12px 14px; border-radius: 12px;
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-3); font-size: 14px; animation: toastIn 220ms var(--ease);
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.success svg { color: #6FD3A4; }
.toast.error svg { color: #F29A92; }
.toast .btn { margin-left: auto; --b-bg: transparent; --b-fg: var(--surface); --b-bd: transparent; min-height: 28px; }
.toast.out { animation: toastOut 180ms var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* Tabellen (Import-Vorschau) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-weight: 600; color: var(--ink-2); background: var(--surface-2); position: sticky; top: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tr.bad td { color: var(--expense); }
.tbl tr.dup td { color: var(--ink-3); }

/* Einstellungen */
.settings-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { padding: 8px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 520; }
.settings-nav a:hover { background: var(--surface-3); text-decoration: none; }
.settings-section { scroll-margin-top: 84px; }
.settings-section .card + .card { margin-top: 12px; }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 300px); gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .t { font-weight: 560; }
.setting .d { font-size: 13px; color: var(--ink-3); }
.danger-zone { border-color: color-mix(in srgb, var(--expense) 35%, var(--line)); }

.mini-table { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; font-size: 13.5px; }

/* ---------------------------------------------------------------- Responsiv */
@media (max-width: 1180px) {
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-8, .span-7, .span-5, .span-4 { grid-column: span 12; }
  .span-6 { grid-column: span 6; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: calc(8px + var(--safe-top)) 16px 8px; min-height: 56px; }
  .topbar .mobile-brand { display: flex; }
  .topbar .crumbs { display: none; }
  .content { padding: 4px 16px calc(96px + var(--safe-bottom)); }
  .demo-banner { padding: 10px 16px; }
  .tx-date { top: calc(56px + var(--safe-top)); }
  .hero { grid-template-columns: 1fr; }
  .hero-flow { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .08); }
  .span-6 { grid-column: span 12; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .settings-nav a { white-space: nowrap; }
  .onboarding { grid-template-columns: 1fr; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    padding: 6px 8px calc(6px + var(--safe-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-top: 1px solid var(--line);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; border: 0; background: none; cursor: pointer;
    color: var(--ink-3); font-size: 11px; font-weight: 560; border-radius: 12px; text-decoration: none; -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav svg { width: 22px; height: 22px; }
  .bottom-nav [aria-current="page"] { color: var(--primary); }
  .bottom-nav .fab { color: var(--primary-ink); }
  .bottom-nav .fab span.fab-btn { width: 50px; height: 50px; border-radius: 16px; background: var(--primary); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(14, 90, 99, .35); margin-top: -18px; }
  .bottom-nav .fab svg { width: 24px; height: 24px; stroke-width: 2.4; }

  dialog.dlg, dialog.dlg.wide {
    width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 22px 22px 0 0;
    padding-bottom: var(--safe-bottom);
  }
  dialog.dlg[open] { animation: sheetIn 260ms var(--ease); }
  dialog.dlg.closing { animation: sheetOut 180ms var(--ease) forwards; }
  @keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
  @keyframes sheetOut { to { transform: translateY(100%); } }
  .grabber { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 8px auto 0; }
  .dlg-head { padding-top: 10px; }
  .dlg-foot .btn { flex: 1; }
  .dlg-foot .left { width: 100%; margin: 0; order: 2; justify-content: center; }
  .toasts { left: 16px; right: 16px; bottom: calc(84px + var(--safe-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  .tx .tx-actions { display: none; }
  .tx { grid-template-columns: 38px minmax(0, 1fr) auto; padding: 10px 16px; gap: 12px; }
  .tx-date { padding: 14px 16px 6px; }
  .summary-bar { padding: 12px 16px; gap: 16px; }
  .setting { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 640px) {
  h1 { font-size: 22px; }
  .page-head { margin: 6px 0 16px; align-items: flex-start; }
  .page-head .actions { width: 100%; }
  .page-head .actions .seg { flex: 1; }
  .grid { gap: 12px; }
  .card { padding: 16px; border-radius: 14px; }
  .card.flush .card-head { padding: 16px 16px 0; }
  .kpi .kpi-val { font-size: 21px; }
  .amt.xl { font-size: 34px; }
  .hero-main { padding: 22px 20px; }
  .hero-flow { padding: 18px 20px; }
  .filters { grid-template-columns: 1fr 1fr; padding: 14px; }
  .form .cols { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .donut-wrap .donut-legend { width: 100%; }
  .onboarding .steps { grid-template-columns: 1fr; }
  .onboarding .intro { padding: 24px 20px; }
  .goal-stats { grid-template-columns: 1fr 1fr 1fr; }
  .hide-sm { display: none !important; }
}
@media (max-width: 380px) {
  .grid.kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .kpi-val { font-size: 18px; }
  .kpi .kpi-ico { display: none; }
  .filters { grid-template-columns: 1fr; }
}
@media (min-width: 901px) { .show-sm { display: none !important; } }


/* ---------------------------------------------------------------- Ergänzungen: Kategorien, Konten, Auswertungen, Einstellungen */
.avatar.lg { width: 52px; height: 52px; border-radius: 15px; }
.avatar.lg svg { width: 24px; height: 24px; }
.list-item.is-archived .avatar { filter: grayscale(.85); opacity: .6; }
.list-item.is-archived .title { color: var(--ink-2); }
.cat-figures { text-align: right; min-width: 92px; }
.section-title { font-size: 15px; font-weight: 620; color: var(--ink-2); margin: 28px 2px 12px; }
.sub-h { font-size: 13.5px; font-weight: 620; color: var(--ink-2); margin: 18px 0 8px; }
.dot-sw { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
details.calc { margin-top: 4px; }
details.calc summary { cursor: pointer; font-size: 12.5px; color: var(--ink-3); list-style: none; display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; }
details.calc summary::-webkit-details-marker { display: none; }
details.calc summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur) var(--ease); margin-right: 4px; }
details.calc[open] summary::before { transform: rotate(45deg); }
details.calc summary:hover { color: var(--ink); }
.cat-bar { color: var(--ink); text-decoration: none; border-radius: var(--r-sm); padding: 4px; margin: -4px; }
.cat-bar:hover { background: var(--surface-2); text-decoration: none; }
.cat-bar .rank { width: 18px; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; flex: none; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 34px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.file-btn { cursor: pointer; }
.file-btn:focus-within { box-shadow: var(--focus); }
.setting .err:empty { display: none; }
.setting.invalid .input { border-color: var(--expense); }
.setting .err { color: var(--expense); font-size: 12.5px; margin-top: 4px; }
kbd { font: 600 11.5px var(--font); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-strong); background: var(--surface-2); }
code { font-size: 12.5px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.rec-item { align-items: flex-start; }
.rec-item .title { white-space: normal; }
.an-kpis .kpi-val { font-size: 22px; }
@media (max-width: 640px) {
  .rec-item { flex-wrap: wrap; }
  .rec-item > div:last-child { width: 100%; display: flex; justify-content: space-between; align-items: center; padding-left: 50px; }
  .cat-figures { display: none; }
}


/* ---------------------------------------------------------------- Anmeldung */
.auth-screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: calc(24px + var(--safe-top)) 18px calc(24px + var(--safe-bottom)); background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 30px 28px; }
.auth-card h1 { font-size: 24px; margin: 22px 0 6px; letter-spacing: -.01em; }
.auth-card > p { margin: 0 0 20px; }
.auth-card .form { gap: 16px; }
.auth-card .btn.primary { width: 100%; justify-content: center; min-height: 46px; font-size: 15px; }
.auth-brand { padding: 0; }
.auth-help { margin-top: 18px; }
.auth-help p { margin: 8px 0 0; line-height: 1.6; }
.auth-foot { display: flex; align-items: center; gap: 6px; }
.auth-foot svg { width: 13px; height: 13px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; }
.pw-wrap .btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.code-input { font-size: 18px; letter-spacing: .14em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .auth-card { padding: 24px 20px; border-radius: var(--r-lg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .demo-banner, .toasts { display: none !important; }
  .app { display: block; }
}
