/* ============ Design-Tokens ============ */
:root {
  --bg: #060913;
  --sidebar: #0a0f1c;
  --surface: #0e1422;
  --surface-2: #131a2b;
  --border: #1d2538;
  --border-strong: #2a3450;
  --text: #e8ebf3;
  --muted: #8a93a8;
  --primary: #5b5bf6;
  --primary-hover: #6d6dff;
  --primary-soft: rgba(91, 91, 246, 0.16);
  --link: #8b8bff;
  --success: #22c55e;
  --success-text: #4ade80;
  --success-soft: rgba(34, 197, 94, 0.14);
  --warning: #eab308;
  --warning-text: #facc15;
  --warning-soft: rgba(234, 179, 8, 0.14);
  --danger: #ef4444;
  --danger-text: #f87171;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --info: #38bdf8;
  --info-text: #7dd3fc;
  --info-soft: rgba(56, 189, 248, 0.14);
  --pink: #ec4899;
  --pink-text: #f472b6;
  --pink-soft: rgba(236, 72, 153, 0.14);
  --track: #1f2740;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 252px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f5f6fb;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f4fa;
  --border: #e3e6ef;
  --border-strong: #cfd4e2;
  --text: #121726;
  --muted: #647089;
  --primary: #5151ea;
  --primary-hover: #4343d8;
  --primary-soft: rgba(81, 81, 234, 0.1);
  --link: #4f4fe0;
  --success-text: #15803d;
  --success-soft: rgba(34, 197, 94, 0.13);
  --warning-text: #a16207;
  --warning-soft: rgba(234, 179, 8, 0.16);
  --danger-text: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --info-text: #0369a1;
  --info-soft: rgba(56, 189, 248, 0.16);
  --pink-text: #be185d;
  --pink-soft: rgba(236, 72, 153, 0.12);
  --track: #e4e7f1;
  --shadow: 0 10px 30px rgba(20, 25, 45, 0.15);
  color-scheme: light;
}

/* ============ Basis ============ */
/* Schrift selbst gehostet (keine Verbindung zu Google beim Aufruf). Plus Jakarta Sans, SIL Open Font License 1.1. */
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/plus-jakarta-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/plus-jakarta-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--success-text); }
.neg { color: var(--danger-text); }

/* ============ Layout ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  transition: width .2s ease, transform .2s ease;
}
.sidebar-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 18px;
}
.brand { font-weight: 700; font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; }
.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  color: var(--muted); text-transform: uppercase;
  padding: 8px 16px 8px;
}
.nav { display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 600; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-foot .nav-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left;
  padding: 10px 12px; border-radius: var(--radius-sm); font-weight: 600; white-space: nowrap;
}
.sidebar-foot .nav-btn:hover { background: var(--surface-2); }
.storage-info { display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.storage-info .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; flex-shrink: 0; color: var(--muted);
}
.storage-info .avatar .icon { width: 16px; height: 16px; }
.storage-info div { overflow: hidden; white-space: nowrap; }
.storage-info strong { display: block; font-size: 13px; }
.recht-mini { padding: 2px 12px 0; font-size: 11px; color: var(--muted); }
.recht-mini a { color: var(--muted); }
.recht-mini a:hover { color: var(--link); }
.storage-info span { font-size: 12px; color: var(--muted); }

body.collapsed { --sidebar-w: 68px; }
body.collapsed .brand,
body.collapsed .nav-label,
body.collapsed .nav a span,
body.collapsed .sidebar-foot .nav-btn span,
body.collapsed .storage-info div, body.collapsed .recht-mini { display: none; }
body.collapsed .sidebar-head { justify-content: center; padding-inline: 8px; }
body.collapsed .nav a, body.collapsed .sidebar-foot .nav-btn { justify-content: center; }
body.collapsed #collapseBtn .icon { transform: rotate(180deg); }

.main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  padding: 16px 12px 40px 24px;
  transition: margin-left .2s ease;
}
.content { max-width: 1400px; }

.icon-btn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  padding: 6px; border-radius: 6px; display: inline-grid; place-items: center;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.danger:hover { color: var(--danger-text); background: var(--danger-soft); }

.topbar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 28px;
  /* bleibt beim Scrollen oben kleben; der Schatten in Hintergrundfarbe verdeckt den Streifen darüber */
  position: sticky; top: 8px; z-index: 24; /* über Seiteninhalt, unter mobilem Menü (25/30) und Dialogen */
  box-shadow: 0 -16px 0 12px var(--bg), 0 8px 18px -12px rgba(0, 0, 0, .6);
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.crumbs .icon { width: 15px; height: 15px; }
.crumbs strong { color: var(--text); font-weight: 600; }
#menuBtn { display: none; margin-left: -6px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ============ Karten ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
}
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 16px; }
.card-head .spacer { flex: 1; }
.card-title { font-size: 16px; font-weight: 700; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.stat { display: flex; align-items: center; gap: 16px; padding: 18px 16px; }
.stat .value { font-size: 22px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.stat .label { font-size: 12px; color: var(--muted); margin-top: 3px; }

.tile {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
}
.tile .icon { width: 20px; height: 20px; }
.tile.sm { width: 36px; height: 36px; border-radius: 9px; }
.tile.sm .icon { width: 17px; height: 17px; }
.tile-primary { background: var(--primary-soft); color: var(--link); }
.tile-warning { background: var(--warning-soft); color: var(--warning-text); }
.tile-success { background: var(--success-soft); color: var(--success-text); }
.tile-info { background: var(--info-soft); color: var(--info-text); }
.tile-danger { background: var(--danger-soft); color: var(--danger-text); }
.tile-pink { background: var(--pink-soft); color: var(--pink-text); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 6px; white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-primary { background: var(--primary-soft); color: var(--link); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-muted { background: var(--surface-2); color: var(--muted); }

.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.progress { height: 5px; background: var(--track); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s ease; }
.progress.success > div { background: var(--success); }
.progress.warning > div { background: var(--warning); }
.progress.danger > div { background: var(--danger); }

/* Ausgaben */
.budget-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.budget-row:last-child { border-bottom: 0; }
.budget-row .budget-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.budget-row .budget-head > div:nth-child(2) { flex: 1; min-width: 0; }
.kat-row { margin-bottom: 12px; }
.kat-row:last-child { margin-bottom: 0; }
.tag-head td { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 6px; padding-bottom: 6px; }
.quick-kat { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.quick-kat button { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 99px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.quick-kat button.aktiv { border-color: var(--primary); background: var(--primary-soft); color: var(--link); }

.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; }
.kv > span:first-child { color: var(--muted); }
.kv strong { font-weight: 700; }

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px;
  border: 1px solid;
}
.alert-danger { background: var(--danger-soft); border-color: rgba(239,68,68,.35); color: var(--danger-text); }
.alert-success { background: var(--success-soft); border-color: rgba(34,197,94,.35); color: var(--success-text); }
.alert-warning { background: var(--warning-soft); border-color: rgba(245,158,11,.35); color: var(--warning-text); }
.info-box { margin: 10px 0 0; padding: 10px 12px; font-size: 13px; }
.info-box p { font-size: 12px; }
.alert-info { background: var(--primary-soft); border-color: rgba(91,91,246,.35); color: var(--text); }
.alert-info .icon { color: var(--link); }
.alert p { margin: 2px 0 0; color: var(--muted); }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .tile { margin: 0 auto 12px; }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ============ Überweisungsplan ============ */
.plan-list { display: flex; flex-direction: column; }
.plan-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px 11px 8px; border-top: 1px solid var(--border); border-left: 3px solid transparent;
  cursor: pointer;
}
.plan-row:first-child { border-top: 0; }
.plan-row.disabled { cursor: default; opacity: .55; }
.plan-row input { position: absolute; opacity: 0; pointer-events: none; }
.check {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center; color: transparent;
  transition: all .15s ease;
}
.check .icon { width: 14px; height: 14px; stroke-width: 3; }
.plan-row input:checked + .check { background: var(--success); border-color: var(--success); color: #fff; }
.plan-row input:focus-visible + .check { outline: 2px solid var(--primary); outline-offset: 2px; }
.plan-row.done .plan-name { text-decoration: line-through; color: var(--muted); }
.plan-main { flex: 1; min-width: 0; }
.plan-name { font-weight: 600; }
.plan-sub { font-size: 12px; color: var(--muted); }
.plan-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.plan-status { display: flex; align-items: center; gap: 5px; font-size: 12px; margin-top: 3px; color: var(--muted); }
.plan-status .icon { width: 13px; height: 13px; flex-shrink: 0; }
.plan-status.gut { color: var(--success-text); }
.plan-status.schlecht { color: var(--danger-text); }
.icon.inline { width: 12px; height: 12px; vertical-align: -2px; }
.auto-btn { margin-left: -4px; }
.auto-btn.aktiv { color: var(--link); background: var(--primary-soft); }
.plan-row.auto .check { border-style: dashed; }
.plan-row.auto input:checked + .check { border-style: solid; }
/* Übersicht: aufklappbare Konten */
.acc-list { display: flex; flex-direction: column; }
.acc { border-top: 1px solid var(--border); border-left: 3px solid transparent; }
.acc:first-child { border-top: 0; }
.acc.ton-gut { border-left-color: var(--success); }
.acc.ton-schlecht { border-left-color: var(--danger); }
.acc.ton-warn { border-left-color: var(--warning); }
.acc.ton-warn .acc-head { background: linear-gradient(90deg, var(--warning-soft), transparent 60%); }
.plan-status.warn { color: var(--warning-text); }
/* Datenschutz: Beträge unscharf */
.geld { transition: filter .2s ease; }
.verbergen .geld { filter: blur(7px); user-select: none; }
/* Zahlen-Eingabefelder: unscharf, beim Anklicken zum Bearbeiten wieder scharf */
.verbergen input[type=number]:not(:focus) { filter: blur(5px); }
.verbergen input[type=number] { transition: filter .15s ease; }
#privacyBtn { flex-shrink: 0; }
@media (max-width: 520px) { #privacyBtn span { display: none; } }
.acc-head {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left;
  padding: 11px 6px 11px 9px; border-radius: 0;
}
.acc-head:hover { background: var(--surface-2); }
.acc.ton-schlecht .acc-head { background: linear-gradient(90deg, var(--danger-soft), transparent 60%); }
.acc-stand { text-align: right; white-space: nowrap; }
.acc-stand .num { font-weight: 700; font-size: 15px; }
.acc-chevron { color: var(--muted); transition: transform .15s ease; display: grid; }
.acc.offen .acc-chevron { transform: rotate(90deg); }
.acc-body { padding: 4px 8px 14px 12px; }
.acc-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 4px 0 10px; }
.acc-kpis > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.acc-kpis span { font-size: 11px; color: var(--muted); }
.acc-kpis strong { font-size: 14px; }
.acc-body table { font-size: 13px; }
.acc-body tr.gebucht td { color: var(--muted); }
.acc-kpis em { font-style: normal; font-size: 11px; color: var(--muted); }
.acc-body td, .acc-body th { padding: 7px 8px; }
.checklist-mini { display: block; color: var(--text); }
.checklist-mini:hover { text-decoration: none; border-color: var(--border-strong); }
@media (max-width: 768px) { .acc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.plan-empf { font-size: 11px; font-weight: 500; color: var(--muted); text-align: right; margin-top: 2px; }
.plan-row.ton-gut { border-left-color: var(--success); }
.plan-row.ton-schlecht { border-left-color: var(--danger); background: linear-gradient(90deg, var(--danger-soft), transparent 60%); }
.plan-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; font-weight: 700; }

/* ============ Tabellen ============ */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable.aktiv { color: var(--link); }
td.actions { white-space: nowrap; text-align: right; width: 1%; }
tfoot td { font-weight: 700; border-top: 1px solid var(--border-strong); border-bottom: 0; }

/* ============ Formulare & Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s ease;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger-text); border-color: rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.22); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.input, select.input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s ease;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.sm { padding: 6px 9px; }
.input-affix { position: relative; }
.input-affix .input { padding-right: 32px; }
.input-affix .affix { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row.drei { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-row.drei .input-affix .input { padding-right: 46px; }
.warn-text { color: var(--warning-text); }
/* Vermögensverlauf (Übersicht) – Farben geprüft auf Farbsehschwäche, eigene Stufen für Hell/Dunkel */
:root { --vv-gesamt: #6d6dff; --vv-privat: #d95926; --vv-gemeinsam: #199e70; }
[data-theme="light"] { --vv-gesamt: #5151ea; --vv-privat: #eb6834; --vv-gemeinsam: #1baf7a; }
.vv-legende { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin: -4px 0 8px; }
.vv-key { display: inline-flex; align-items: center; gap: 6px; }
.vv-key strong { color: var(--text); }
.vv-linie { display: inline-block; width: 14px; height: 2px; border-radius: 2px; background: var(--vv-gesamt); }
.vv-linie.vv-privat { background: var(--vv-privat); }
.vv-linie.vv-gemeinsam { background: var(--vv-gemeinsam); }
.vv-chart { position: relative; }
.vv-chart svg { display: block; overflow: visible; }
.vv-grid { stroke: var(--border); stroke-width: 1; }
.vv-achse { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.vv-strich { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke: var(--vv-gesamt); }
.vv-strich.vv-privat { stroke: var(--vv-privat); }
.vv-strich.vv-gemeinsam { stroke: var(--vv-gemeinsam); }
.vv-flaeche { fill: var(--vv-gesamt); opacity: .1; }
.vv-punkt { fill: var(--vv-gesamt); stroke: var(--surface); stroke-width: 2; }
.vv-punkt.vv-privat { fill: var(--vv-privat); }
.vv-punkt.vv-gemeinsam { fill: var(--vv-gemeinsam); }
.vv-hohl { fill: var(--surface); stroke: var(--vv-gesamt); stroke-width: 2; }
.vv-cross { stroke: var(--muted); stroke-width: 1; }
.vv-hit { fill: transparent; cursor: crosshair; outline: none; }
.vv-hit:focus-visible { stroke: var(--primary); stroke-width: 1; }
.vv-tooltip {
  position: absolute; top: 4px; pointer-events: none; z-index: 2; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow);
  padding: 8px 10px; font-size: 12px;
}
.vv-tip-kopf { font-weight: 600; margin-bottom: 4px; }
.vv-tip-zeile { display: flex; align-items: center; gap: 8px; padding: 1px 0; }
.vv-tip-zeile strong { min-width: 84px; }
.vv-tabelle { margin-top: 8px; }
.vv-tabelle > summary { cursor: pointer; color: var(--link); width: fit-content; }
/* Jahreskosten (Fixkosten-Seite) */
.jk-kats { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.jk-kat { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.jk-kat strong { margin-left: auto; }
.pille { border-radius: 99px; font-size: 12px; font-weight: 600; padding: 3px 10px; white-space: nowrap; }
.jk-balken { min-width: 60px; }
input[type=range] { width: 100%; accent-color: var(--primary); }
input[type=number]::-webkit-inner-spin-button { opacity: .4; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 200px; }

/* ============ Modal & Toast ============ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(3, 6, 14, .6); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 16px;
  animation: fade .15s ease;
}
.modal {
  width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 12px 18px 4px; }
.modal-body p { margin: 0 0 12px; color: var(--muted); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px 18px; }
@keyframes fade { from { opacity: 0; } }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); border-radius: 10px;
  padding: 10px 16px; font-weight: 600; z-index: 200;
  display: flex; align-items: center; gap: 8px;
  animation: fade .2s ease;
}
.toast .icon { color: var(--success-text); }

.overlay { display: none; }

@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--primary); } 100% { box-shadow: 0 0 0 0 transparent; } }
.flash { animation: flash 1.8s ease-out; }

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-sm .icon { width: 14px; height: 14px; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 28px 0 12px; }
.section-title .icon { color: var(--muted); }
.modal.wide { max-width: 600px; }

/* ============ Fixkosten ============ */
.fix-amount { font-size: 22px; font-weight: 800; line-height: 1.2; }
.fix-kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
  margin-bottom: 14px;
}
.fix-kpis > div {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; display: flex; flex-direction: column; min-width: 0;
}
.fix-kpis span { font-size: 12px; color: var(--muted); }
.fix-kpis strong { font-size: 16px; }
.fix-kpis em { font-style: normal; font-size: 11px; color: var(--muted); }
.fix-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px;
  font-size: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
/* klickbare Kachel (z. B. Puffer → Einstellungsfeld) */
.kpi-link {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; display: flex; flex-direction: column; min-width: 0;
  color: var(--text); cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.kpi-link:hover { text-decoration: none; border-color: var(--primary); background: var(--primary-soft); }
.kpi-link > span:first-child { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.kpi-edit, .fix-kpis .kpi-edit { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--link); }
.kpi-edit .icon { width: 12px; height: 12px; }
.puffer-zeile { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 7px 10px; margin: -4px 0 12px; }
.puffer-zeile .kpi-edit { margin-left: auto; }
.fix-kpis.drei { grid-template-columns: repeat(3, minmax(0, 1fr)); }
[data-alle-klappen] .icon { transition: transform .15s ease; }
/* Kachel „Ausgaben netto“ mit aktueller Einzahlung */
button.kpi-link { font: inherit; text-align: left; width: 100%; }
button.kpi-link.puffer-zeile { font-size: 12px; }
/* Übersicht: monatliche Verteilung */
.stat-link { display: block; color: inherit; border-radius: 14px; }
.stat-link:hover { text-decoration: none; }
.stat-link:hover .card { border-color: var(--primary); }
.stat-link > .card { height: 100%; }
.verteilung-konto { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.verteilung-konto:hover { color: var(--link); text-decoration: none; }
/* Wert aus „Du überweist“ übernommen, keine Empfehlung des Systems */
.uebernommen { display: inline-flex; flex-direction: column; align-items: flex-end; color: var(--muted); font-style: italic; line-height: 1.25; }
.uebernommen > span { display: inline-flex; align-items: center; gap: 2px; }
.uebernommen .icon { width: 12px; height: 12px; opacity: .7; }
.uebernommen em { font-size: 10px; font-style: normal; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
/* Schnell-Bearbeiten: Wert, der woanders eingestellt wird, direkt ändern */
.schnell {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 2px; margin: 0 -2px;
  border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: inherit;
  border-bottom: 1px dashed color-mix(in srgb, var(--link) 55%, transparent); border-radius: 3px;
}
.schnell:hover, .schnell:focus-visible { color: var(--link); background: var(--primary-soft); outline: none; }
.schnell .schnell-stift { width: 11px; height: 11px; color: var(--link); opacity: .55; flex-shrink: 0; }
.schnell:hover .schnell-stift { opacity: 1; }
td.r .schnell, .r .schnell { justify-content: flex-end; }
/* ============ Einklappbare Karten (alle Seiten) ============ */
.klapp-head { cursor: pointer; user-select: none; border-radius: 10px; flex-wrap: wrap; }
.klapp-head:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.klapp-head:hover > .acc-chevron { color: var(--text); }
.card[data-klapp]:not(.offen) > .klapp-head { margin-bottom: 0; }
.card[data-klapp].offen > .klapp-head > .acc-chevron { transform: rotate(90deg); }
.klapp-info { display: inline-flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.klapp-info strong { color: var(--text); }
/* gestapelt (z. B. Urlaubs-Karten): jede Angabe in eigener Zeile unter dem Titel, alle Karten gleich aufgebaut */
.klapp-info.stapel { flex-basis: 100%; flex-direction: column; align-items: flex-start; gap: 2px; }
/* Titelblock nimmt den freien Platz selbst ein (statt eines .spacer, der bei langem Untertitel in eine
   eigene leere Zeile umbrechen und die Karte höher machen würde) */
.kopf-titel { flex: 1 1 0; min-width: 0; }
.kopf-titel > .small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card[data-klapp].offen .klapp-info { display: none; }

/* ============ Historie ============ */
/* feste Leiste: eigener Kartenbereich. Der Streifen dahinter (Seitenhintergrund) deckt die Liste beim Scrollen
   vollständig ab – sie endet sichtbar genau unter dem Kasten. Der Streifen reicht 16 px unter die Kopfleiste
   (hinter deren abgerundete Ecken), damit dort nichts durchscheint; margin-top gleicht das im Fluss wieder aus. */
.hist-leiste-wrap {
  --hist-rand: 6px;
  position: sticky; top: calc(var(--topbar-h, 0px) - 16px); z-index: 20; /* unter der festen Kopfleiste (z-index 24) */
  margin: -16px calc(-1 * var(--hist-rand)) 0; padding: 26px var(--hist-rand) 10px;
  background: var(--bg);
}
/* abgerundete Oberkante der Liste an der Schnittlinie: sieht aus wie der obere Rand einer Karte, unter dem die
   Liste weiterläuft. Die Ecken außerhalb der Rundung deckt ein Schatten in Hintergrundfarbe ab (kein Durchscheinen);
   clip-path schneidet ihn oben ab, damit er nicht über den unteren Rand der Leiste reicht. */
.hist-leiste-wrap::after {
  content: ''; position: absolute; top: 100%; left: var(--hist-rand); right: var(--hist-rand); height: 14px;
  border: 1px solid var(--border); border-bottom: 0; border-radius: 14px 14px 0 0;
  box-shadow: 0 -10px 0 10px var(--bg); clip-path: inset(0 -10px); pointer-events: none;
}
.hist-leiste {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .55);
}
.hist-leiste-kopf { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.hist-leiste-kopf select { width: auto; min-width: 160px; }
.hist-datum-wahl { display: flex; align-items: center; gap: 6px; position: relative; flex-wrap: wrap; }
.hist-datum-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; margin-left: -2px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 16px; cursor: pointer;
}
.hist-datum-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.hist-datum-btn .icon { width: 15px; height: 15px; color: var(--link); }
#histDatumInput { position: absolute; left: 60px; top: 100%; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
/* zwei getrennte Bereiche: Privat | Gemeinsam */
.hist-gruppen { display: grid; grid-template-columns: 3fr 2fr; gap: 12px; }
.hist-gruppe { min-width: 0; padding: 8px; border-radius: 10px; background: var(--surface-2); }
.hist-gruppe-kopf { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 0 2px 6px; }
.hist-gruppe-kopf strong { color: var(--text); font-size: 13px; }
.hist-kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.hist-kachel {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; text-align: left; cursor: pointer; min-width: 0;
}
.hist-kachel .tile { grid-row: span 2; }
.hist-kachel-name { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-kachel strong { font-size: 14px; white-space: nowrap; }
.hist-kachel:hover, .hist-kachel.aktiv { border-color: var(--primary); background: var(--primary-soft); }
.hist-kachel strong.geschaetzt { font-style: italic; color: var(--muted); }
.hist-kachel strong.neg { color: var(--danger-text); }
.hist-liste { display: flex; flex-direction: column; gap: 14px; }
.hist-monat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 6px 14px 10px;
  /* nicht sichtbare Monate überspringt der Browser beim Layout (spart bei 2 Jahren Historie den Großteil der Zeit) */
  content-visibility: auto; contain-intrinsic-size: auto 700px;
}
.hist-monat-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
.hist-monat-kopf h3 { margin: 0; font-size: 15px; }
.hist-zeile {
  display: grid; grid-template-columns: 92px minmax(120px, 190px) 1fr auto 110px; gap: 10px; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.hist-zeile:last-child { border-bottom: 0; }
.hist-liste .hist-zeile:not(:has(.hist-konto)) { grid-template-columns: 92px 1fr auto 110px; }
.hist-datum { color: var(--muted); font-size: 12px; }
.hist-konto { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.hist-konto span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-betrag, .hist-stand { text-align: right; white-space: nowrap; }
.hist-stand { font-weight: 700; }
.hist-zeile.vergangen { opacity: .72; }
.hist-zeile.prognose .hist-stand { color: var(--muted); }
.hist-zeile.geschaetzt .hist-stand { font-style: italic; }
.hist-zeile.abgleich { color: var(--muted); font-style: italic; }
.hist-zeile.enthalten .hist-betrag { color: var(--muted); text-decoration: line-through; }
.hist-heute {
  margin: 4px 0; padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  color: var(--link); background: var(--primary-soft); border-left: 3px solid var(--primary);
}
@media (max-width: 768px) { .hist-leiste-wrap { --hist-rand: 16px; padding-top: 24px; padding-bottom: 8px; } }
/* schmal: beide Bereiche untereinander, jeweils als eigene horizontal scrollbare Reihe */
@media (max-width: 900px) {
  .hist-gruppen { grid-template-columns: 1fr; gap: 8px; }
  .hist-kacheln { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
  .hist-kachel { flex: 0 0 auto; min-width: 120px; grid-template-columns: 1fr; padding: 4px 8px; }
  .hist-kachel .tile { display: none; }
}
@media (max-width: 640px) {
  /* Handy: Datum + Konto klein in einer Zeile, darunter Text | Betrag, Stand rechts */
  .hist-zeile, .hist-liste .hist-zeile:not(:has(.hist-konto)) { grid-template-columns: auto 1fr auto; row-gap: 2px; column-gap: 8px; }
  .hist-datum { grid-column: 1; }
  .hist-konto { grid-column: 2 / -1; font-size: 11px; color: var(--muted); }
  .hist-konto .tile { display: none; }
  .hist-text { grid-column: 1 / 3; }
  .hist-betrag { grid-column: 3; }
  .hist-stand { grid-column: 3; font-size: 12px; }
}

/* Link im Dialog zur zugehörigen Seite */
.modal-weiter { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 13px; font-weight: 600; }
.modal-weiter .icon { width: 14px; height: 14px; }
.kpi-einzahlung-zeile {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
}
.fix-kpis .kpi-einzahlung-zeile span { font-size: 12px; }
.kpi-einzahlung-zeile b { font-size: 15px; font-weight: 700; }
@media (max-width: 768px) { .fix-kpis, .fix-kpis.drei { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ============ Urlaube ============ */
.pos-row { padding: 7px 2px; }
.pos-list { display: flex; flex-direction: column; gap: 8px; }
.pos-edit { display: grid; grid-template-columns: 1fr 130px auto; gap: 8px; align-items: center; }
.suggest {
  margin-top: 4px; padding: 12px 14px; border-radius: 10px;
  background: var(--primary-soft); border: 1px solid rgba(91, 91, 246, .3);
}
.suggest .icon { width: 15px; height: 15px; vertical-align: -3px; }
.suggest-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--link); }
.suggest-value { font-size: 22px; font-weight: 800; margin: 2px 0 4px; }
.suggest-value span { font-size: 13px; font-weight: 500; color: var(--muted); }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  body, body.collapsed { --sidebar-w: 252px; }
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  body.nav-open .overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 25; }
  #collapseBtn { display: none; }
  #menuBtn { display: inline-grid; }
  .main { margin-left: 0; padding: 12px 16px 32px; }
  .topbar { margin-bottom: 20px; }
  .grid-stats { gap: 10px; }
  .stat { padding: 14px 12px; gap: 12px; }
  .stat .value { font-size: 18px; }
  .tile { width: 38px; height: 38px; }
  .field-row, .field-row.drei { grid-template-columns: 1fr; }
  .toolbar select { min-width: 0; flex: 1; }
  body.collapsed .brand, body.collapsed .nav-label, body.collapsed .nav a span,
  body.collapsed .sidebar-foot .nav-btn span, body.collapsed .storage-info div, body.collapsed .recht-mini { display: revert; }
}
@media (max-width: 420px) {
  .grid-stats { grid-template-columns: 1fr; }
}

/* ============ Budget-Check ============ */
.bc-tabelle td { vertical-align: top; }
.bc-kat { cursor: pointer; }
.bc-kat:hover td { background: var(--surface-2); }
.bc-kat-titel { display: inline-flex; align-items: center; gap: 6px; }
.bc-detail > td { background: var(--surface-2); padding-top: 2px; padding-bottom: 2px; }
/* bleibt beim seitlichen Scrollen der Tabelle (Handy) sichtbar und so breit wie der Bildschirm */
.bc-detail-inhalt { position: sticky; left: 0; max-width: calc(100vw - 64px); }
.bc-eintrag, .bc-topf { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.bc-eintrag { border-bottom: 1px solid var(--border); }
.bc-eintrag:last-child { border-bottom: 0; }
.bc-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bc-betrag { display: flex; flex-direction: column; align-items: flex-end; min-width: 92px; }
.bc-sammel { opacity: .85; }
.bc-sammel .bc-name strong { font-weight: 600; }
/* Etikett (Kategorie bzw. Konto): Auswahl als farbige Pille, automatisch zugeordnet = gestrichelt */
.bc-tag {
  appearance: none; -webkit-appearance: none; border-radius: 99px; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; padding: 3px 26px 3px 10px; max-width: 240px; border: 1px solid transparent;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 13px center, right 9px center; background-size: 4px 4px; background-repeat: no-repeat;
}
.bc-tag.auto { border-style: dashed; border-color: color-mix(in srgb, currentColor 55%, transparent); }
.bc-tag option { background: var(--surface); color: var(--text); }
.kat-wohnen, .topf-vorsorge { background-color: var(--primary-soft); color: var(--link); }
.kat-mobilitaet, .topf-essen { background-color: var(--info-soft); color: var(--info-text); }
.kat-vertraege, .topf-fix { background-color: var(--warning-soft); color: var(--warning-text); }
.kat-sparen, .topf-sparen { background-color: var(--success-soft); color: var(--success-text); }
.kat-vorsorge, .topf-freizeit { background-color: var(--pink-soft); color: var(--pink-text); }
.kat-essen { background-color: var(--track); color: var(--text); }
.kat-freizeit { background-color: rgba(20, 184, 166, .16); color: #14b8a6; }
.kat-versicherung { background-color: var(--danger-soft); color: var(--danger-text); }
/* aufklappbare Zeilen: Notgroschen (ng-details), Konten und gemeinsame Konten (bc-topf-det) */
.ng-details, .bc-topf-det { border-bottom: 1px solid var(--border); }
.ng-details > summary, .bc-topf-det > summary { list-style: none; cursor: pointer; }
.ng-details > summary::-webkit-details-marker, .bc-topf-det > summary::-webkit-details-marker { display: none; }
.ng-details > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; }
.ng-details > summary > strong { white-space: nowrap; }
.ng-details > summary:hover .ng-sum-label { color: var(--text); }
.bc-topf-det > summary:hover { background: var(--surface-2); border-radius: 10px; }
.ng-sum-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); }
.ng-quelle { flex-basis: 100%; padding-left: 22px; }
.ng-pfeil { width: 16px; height: 16px; transition: transform .15s ease; flex-shrink: 0; }
.bc-kat.offen .ng-pfeil, .ng-details[open] > summary .ng-pfeil, .bc-topf-det[open] > summary .ng-pfeil { transform: rotate(90deg); }
.ng-inhalt { padding: 0 0 10px 22px; }
.bc-unter { padding: 0 0 8px 72px; }
.bc-unterkopf { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 18px 0 4px; padding-top: 14px; border-top: 1px solid var(--border); }
.bc-partner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; margin: 4px 0 6px; border-radius: 10px; background: var(--surface-2); font-size: 13px; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 99px; padding: 2px; background: var(--surface); }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; padding: 4px 14px; border-radius: 99px; cursor: pointer; }
.seg button.aktiv { background: var(--primary); color: #fff; }
@media (max-width: 640px) {
  .bc-eintrag, .bc-topf { flex-wrap: wrap; }
  .bc-eintrag .bc-tag { margin-left: 46px; }
  .bc-betrag { min-width: 0; }
  .ng-inhalt, .bc-unter { padding-left: 0; }
}

/* ============ Anmeldung (online) ============ */
[hidden] { display: none !important; }
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-brand {
  display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 48px clamp(24px, 5vw, 72px);
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #db2777 100%); color: #fff;
}
.auth-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; }
.auth-logo .icon { width: 26px; height: 26px; }
.auth-brand h1 { font-size: clamp(26px, 3vw, 38px); line-height: 1.15; letter-spacing: -.02em; }
.auth-features { display: grid; gap: 12px; max-width: 460px; }
.auth-features > div { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .12); }
.auth-features .icon { width: 20px; height: 20px; margin-top: 2px; }
.auth-features span { display: flex; flex-direction: column; font-size: 13px; opacity: .92; }
.auth-features strong { font-size: 14px; opacity: 1; }
.auth-main { display: grid; place-items: center; align-content: center; gap: 14px; padding: 32px 16px; }
.auth-privat { max-width: 420px; margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); text-align: center; }
.auth-privat a { color: var(--link); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px 24px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 22px; margin-bottom: 14px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card .fld { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.auth-card .fld > span { color: var(--muted); font-weight: 600; }
.auth-card .input { padding: 11px 12px; border-radius: 10px; }
.auth-card .input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.auth-card .input.code { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-wrap .icon-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.btn-block { width: 100%; justify-content: center; padding: 12px 14px; border-radius: 10px; }
.auth-card .btn-primary { background: linear-gradient(90deg, #5b5bf6, #8b5cf6, #ec4899); border: 0; }
.auth-card .btn-primary:hover { filter: brightness(1.08); }
.auth-card .btn-primary:disabled { opacity: .6; cursor: wait; }
.auth-err, .auth-ok { border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.auth-err { background: var(--danger-soft); color: var(--danger-text); border: 1px solid rgba(239, 68, 68, .35); }
.auth-ok { background: var(--success-soft); color: var(--success-text); border: 1px solid rgba(34, 197, 94, .35); }
.auth-text, .auth-hint { margin: 0; color: var(--muted); font-size: 13px; }
.auth-hint { margin-top: 14px; text-align: center; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 14px; font-size: 13px; }
.auth-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.auth-check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primary); flex-shrink: 0; }
.auth-schritte { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.auth-qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 12px; width: fit-content; margin: 0 auto; }
.auth-secret { font-size: 12px; color: var(--muted); }
.auth-secret summary { cursor: pointer; }
.auth-secret code, .auth-rk code, .auth-codes code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; user-select: all; }
.auth-secret code { display: block; margin-top: 6px; word-break: break-all; color: var(--text); }
.auth-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.auth-codes code, .auth-rk code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; font-size: 14px; letter-spacing: .04em; }
.auth-rk code { display: block; font-size: 15px; word-break: break-all; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { padding: 18px 16px; gap: 6px; }
  .auth-brand h1 { font-size: 18px; }
  .auth-brand h1 br { display: none; }
  .auth-features { display: none; }
  .auth-main { place-items: start center; padding: 16px; }
  .auth-card { padding: 22px 16px; }
}
/* Backup per Drag & Drop (Start nach der ersten Anmeldung) */
.auth-drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; cursor: pointer;
  padding: 22px 16px; border: 2px dashed var(--border-strong); border-radius: 12px; background: var(--surface-2);
  transition: border-color .15s ease, background .15s ease;
}
.auth-drop .icon { width: 24px; height: 24px; color: var(--link); margin-bottom: 4px; }
.auth-drop span { font-size: 12px; color: var(--muted); }
.auth-drop:hover, .auth-drop:focus-visible, .auth-drop.aktiv { border-color: var(--primary); background: var(--primary-soft); outline: none; }
.auth-drop.laedt { opacity: .6; cursor: progress; }

/* ============ Impressum / Datenschutz (eigene Seiten) ============ */
.recht-seite { height: auto; }
.recht { max-width: 760px; margin: 0 auto; padding: 32px 16px 56px; line-height: 1.6; font-size: 15px; }
.recht h1 { font-size: 28px; margin: 18px 0 6px; }
.recht h2 { font-size: 18px; margin: 28px 0 8px; }
.recht h3 { font-size: 15px; margin: 18px 0 6px; }
.recht p, .recht ul { margin: 0 0 10px; }
.recht ul { padding-left: 20px; }
.recht a { color: var(--link); }
.recht-zurueck { font-size: 14px; text-decoration: none; }
.recht-links { margin-top: 32px !important; padding-top: 14px; border-top: 1px solid var(--border); }
