:root {
  --bg: #eef1f8;
  --blob1: #a8c8ff;
  --blob2: #ffc6e0;
  --blob3: #c9b8ff;
  --blob4: #b5f0e0;
  --surface: rgba(255, 255, 255, .52);
  --surface-strong: rgba(255, 255, 255, .72);
  --field: rgba(255, 255, 255, .7);
  --ink: #1d1d1f;
  --muted: #5f6068;
  --line: rgba(255, 255, 255, .75);
  --hairline: rgba(29, 29, 31, .12);
  --accent: #0071e3;
  --accent-hover: #0062c4;
  --accent-ink: #fff;
  --accent-soft: rgba(0, 113, 227, .13);
  --warn: #c5281c;
  --warn-soft: rgba(255, 69, 58, .15);
  --amber: #8a5a00;
  --amber-soft: rgba(255, 179, 0, .22);
  --neutral-soft: rgba(29, 29, 31, .08);
  --shadow: 0 1px 1px rgba(29, 29, 31, .04), 0 18px 40px -22px rgba(40, 50, 90, .35);
  --radius: 20px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  --serif: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e14;
    --blob1: #17408f;
    --blob2: #7a2459;
    --blob3: #43308f;
    --blob4: #0f5a52;
    --surface: rgba(38, 40, 52, .5);
    --surface-strong: rgba(52, 54, 68, .7);
    --field: rgba(255, 255, 255, .08);
    --ink: #f5f5f7;
    --muted: #a9abb6;
    --line: rgba(255, 255, 255, .14);
    --hairline: rgba(255, 255, 255, .14);
    --accent: #2997ff;
    --accent-hover: #53abff;
    --accent-ink: #fff;
    --accent-soft: rgba(41, 151, 255, .2);
    --warn: #ff6961;
    --warn-soft: rgba(255, 69, 58, .22);
    --amber: #ffd060;
    --amber-soft: rgba(255, 179, 0, .2);
    --neutral-soft: rgba(255, 255, 255, .1);
    --shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 18px 40px -22px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
/* Farbiger Hintergrund, der durch die Glasflächen scheint */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(45vw 45vw at 8% 10%, var(--blob1), transparent 70%),
    radial-gradient(40vw 40vw at 92% 6%, var(--blob2), transparent 70%),
    radial-gradient(50vw 50vw at 80% 95%, var(--blob3), transparent 70%),
    radial-gradient(42vw 42vw at 12% 92%, var(--blob4), transparent 70%);
}
/* Glasflächen */
fieldset, .auth-card, .stat, .table-wrap, .sidebar, .empty, .banner, .btn, .chip {
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
}
fieldset, .auth-card, .stat, .table-wrap, .sidebar {
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .35);
}
h1 { font: 700 30px/1.12 var(--serif); letter-spacing: -0.025em; margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
p.muted { margin: 4px 0 0; }
.r { text-align: right; }
.c { text-align: center; }
.pre { white-space: pre-line; }
[hidden] { display: none !important; }

/* ---------- Formularelemente ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
label .muted { font-weight: 400; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px;
  padding: 9px 11px;
  font: 15px/1.4 var(--sans); color: var(--ink);
  background: var(--field); border: 1px solid var(--hairline); border-radius: 12px;
}
textarea { resize: vertical; min-height: 40px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip:focus-visible, .link:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
fieldset {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 16px 18px 8px; margin: 0 0 16px; min-width: 0;
}
legend { font: 700 16px var(--serif); letter-spacing: -0.01em; padding: 0 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-strong); color: var(--ink);
  font: 600 14px var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--field); border-color: var(--hairline); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary { box-shadow: 0 6px 16px -8px var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--warn); }
.btn.danger:hover { border-color: var(--warn); }
.btn.tiny { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; padding: 12px; margin-top: 4px; }
.btn:disabled { opacity: .6; cursor: default; }
.link {
  background: none; border: 0; padding: 0; color: var(--accent);
  font: inherit; text-decoration: underline; cursor: pointer;
}
.icon-btn {
  width: 34px; height: 38px; border: 0; background: none; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer; border-radius: 8px;
}
.icon-btn:hover { background: var(--warn-soft); color: var(--warn); }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 28px; padding: 32px 28px;
}
.auth-card h1 { margin-top: 18px; }
.auth-card form { margin: 22px 0 16px; }
.form-error { background: var(--warn-soft); color: var(--warn); padding: 9px 12px; border-radius: 12px; margin: 0 0 12px; font-size: 14px; }
.logo-mark {
  width: 44px; height: 44px; border-radius: 13px; color: #fff;
  background: linear-gradient(145deg, #4aa8ff, #0071e3 55%, #5e5ce6);
  box-shadow: 0 8px 18px -8px #0071e3, inset 0 1px 0 rgba(255, 255, 255, .45);
  display: grid; place-items: center; font: 700 24px var(--serif);
}
.logo-mark.small { width: 30px; height: 30px; border-radius: 9px; font-size: 17px; }

/* ---------- Rahmen ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 14px; height: calc(100vh - 28px); margin: 14px 0 14px 14px; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 26px;
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 17px var(--serif); letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  padding: 8px 12px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 500;
}
.sidebar nav a:hover { background: var(--neutral-soft); }
.sidebar nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.account { margin-top: auto; font-size: 13px; display: grid; gap: 4px; justify-items: start; }
.account span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding: 30px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Übersicht ---------- */
.banner {
  display: block; padding: 12px 16px; margin-bottom: 18px; border-radius: var(--radius);
  background: var(--amber-soft); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 500;
}
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat strong { font: 700 27px/1.2 var(--serif); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat em { font-style: normal; font-size: 13px; color: var(--muted); }
.stat.warn strong { color: var(--warn); }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input { max-width: 300px; margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font: 500 13px var(--sans); color: var(--ink); cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.filters input { border-radius: 999px; padding-left: 16px; }
table.list { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.list th.r { text-align: right; }
.list td { padding: 13px 16px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: var(--accent-soft); }
.list td a { font-weight: 600; text-decoration: none; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.entwurf { background: var(--neutral-soft); color: var(--muted); }
.badge.offen { background: var(--amber-soft); color: var(--amber); }
.badge.bezahlt { background: var(--accent-soft); color: var(--accent); }
.badge.ueberfaellig { background: var(--warn-soft); color: var(--warn); }
.empty { text-align: center; padding: 50px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); }
.empty p { margin: 0 0 14px; }

/* ---------- Editor ---------- */
.editor { display: grid; grid-template-columns: minmax(340px, 460px) minmax(0, 1fr); gap: 26px; align-items: start; }
.item {
  display: grid; grid-template-columns: 70px 90px minmax(0, 1fr) auto 34px; gap: 0 10px; align-items: end;
  padding-bottom: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--hairline);
}
.item .desc { grid-column: 1 / -1; }
.item .line-total { padding: 0 0 21px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 84px; text-align: right; }
.item .icon-btn { margin-bottom: 12px; }
.tax-row { margin-top: 16px; align-items: end; }
.sum-box { display: grid; justify-items: end; gap: 1px; padding-bottom: 12px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sum-box strong { font: 700 23px var(--serif); letter-spacing: -0.02em; color: var(--ink); }
.preview { position: sticky; top: 20px; min-width: 0; }

/* ---------- Rechnungsblatt (A4) ---------- */
.paper {
  width: 210mm; min-height: 297mm; padding: 18mm 20mm 14mm 25mm;
  background: #fff; color: #111; display: flex; flex-direction: column;
  font: 10.5pt/1.45 var(--sans);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(20, 20, 40, .14), 0 30px 60px -30px rgba(20, 20, 60, .55);
}
.doc-head { display: flex; justify-content: flex-end; min-height: 24mm; }
.doc-company { font: 600 18pt var(--serif); }
.doc-logo { max-height: 22mm; max-width: 70mm; object-fit: contain; }
.doc-top { display: flex; justify-content: space-between; gap: 10mm; margin-top: 6mm; min-height: 40mm; }
.doc-sender { font-size: 7pt; color: #555; border-bottom: .5pt solid #999; padding-bottom: 1mm; margin-bottom: 3mm; min-height: 4mm; }
.doc-to { width: 85mm; }
.doc-name { font-weight: 600; }
.doc-meta { border-collapse: collapse; align-self: flex-start; font-size: 9.5pt; }
.doc-meta td { padding: .6mm 0 .6mm 6mm; }
.doc-meta td:first-child { color: #555; padding-left: 0; }
.doc-meta td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.doc-title { font: 600 17pt var(--serif); margin: 8mm 0 4mm; }
.doc-intro { margin: 0 0 6mm; }
.doc-items { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.doc-items th { font-size: 8.5pt; text-transform: uppercase; letter-spacing: .04em; color: #555; text-align: left; padding: 2mm 2mm; border-bottom: 1pt solid #111; }
.doc-items th.r { text-align: right; }
.doc-items th.c { text-align: center; }
.doc-items td { padding: 2.2mm 2mm; border-bottom: .5pt solid #ccc; vertical-align: top; }
.doc-items td.r { white-space: nowrap; }
.doc-items tr { break-inside: avoid; }
.doc-sum { margin: 4mm 0 0 auto; border-collapse: collapse; min-width: 75mm; font-variant-numeric: tabular-nums; break-inside: avoid; }
.doc-sum td { padding: 1mm 2mm; }
.doc-sum .total td { font-weight: 700; font-size: 12pt; border-top: 1pt solid #111; border-bottom: 2.5pt double #111; padding-top: 2mm; padding-bottom: 2mm; }
.doc-notes { margin-top: 8mm; break-inside: avoid; }
.doc-notes p { margin: 0 0 3mm; }
.doc-foot {
  margin-top: auto; padding-top: 4mm; border-top: .5pt solid #999;
  display: flex; gap: 6mm; justify-content: space-between;
  font-size: 7.5pt; line-height: 1.5; color: #444; break-inside: avoid;
}
.doc-foot strong { color: #111; }

/* ---------- Einstellungen ---------- */
.settings { max-width: 640px; margin-bottom: 30px; }
.logo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.logo-row img { max-height: 56px; max-width: 200px; border: 1px solid var(--hairline); border-radius: 10px; padding: 4px; background: #fff; }

/* ---------- Hinweis ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: rgba(29, 29, 31, .82); color: #fff; padding: 10px 20px; border-radius: 999px;
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px); z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--warn); color: #fff; }

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 1100px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 10px 16px; padding: 12px 16px; margin: 10px 10px 0; border-radius: 22px;
  }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .account { margin: 0 0 0 auto; }
  .account span { display: none; }
  .main { padding: 20px 16px 50px; }
  .stats, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .item { grid-template-columns: 1fr 1fr; }
  .item .line-total { text-align: left; padding-bottom: 12px; align-self: center; }
  .item .icon-btn { justify-self: end; }
}

/* ---------- Druck / PDF ---------- */
@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  body::before { display: none; }
  .sidebar, .no-print, #toast { display: none !important; }
  .shell, .editor { display: block; }
  .main { padding: 0; }
  .preview { position: static; }
  .paper { zoom: 1 !important; box-shadow: none; border-radius: 0; width: 210mm; }
}

/* ---------- Zahlungserinnerungen ---------- */
.reminders {
  margin-bottom: 22px; padding: 18px 20px 8px;
  background: linear-gradient(135deg, var(--amber-soft), transparent 70%), var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.reminders h2 { font: 700 18px var(--serif); letter-spacing: -0.015em; margin: 0; }
.reminders > .muted { margin-bottom: 8px; }
.reminder-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 12px 0; border-top: 1px solid var(--hairline);
}
.hint { font-size: 13px; margin: 0 0 12px; }

/* ---------- Animationen ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(26px) scale(.92); filter: blur(10px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes drift { from { transform: translate(-3%, -2%) rotate(0deg) scale(1); } to { transform: translate(3%, 3%) rotate(8deg) scale(1.08); } }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 6px 16px -8px var(--accent), 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 6px 16px -8px var(--accent), 0 0 0 9px transparent; } }
@keyframes sheen { from { transform: translateX(-130%) skewX(-20deg); } to { transform: translateX(330%) skewX(-20deg); } }
@keyframes float { from { transform: translateY(0); } to { transform: translateY(-6px); } }

/* Hintergrund wandert langsam */
body::before { inset: -15%; animation: drift 26s ease-in-out infinite alternate; }

/* Seiteninhalt gleitet gestaffelt herein */
.main > * { animation: rise .55s cubic-bezier(.2, .8, .2, 1) backwards; }
.main > *:nth-child(2) { animation-delay: .06s; }
.main > *:nth-child(3) { animation-delay: .12s; }
.main > *:nth-child(4) { animation-delay: .18s; }
.main > *:nth-child(5) { animation-delay: .24s; }
.stat { animation: rise .55s cubic-bezier(.2, .8, .2, 1) backwards; }
.stat:nth-child(1) { animation-delay: .12s; }
.stat:nth-child(2) { animation-delay: .19s; }
.stat:nth-child(3) { animation-delay: .26s; }
.editor-form fieldset, .settings fieldset { animation: rise .5s cubic-bezier(.2, .8, .2, 1) backwards; }
.editor-form fieldset:nth-child(2), .settings fieldset:nth-child(2) { animation-delay: .07s; }
.editor-form fieldset:nth-child(3), .settings fieldset:nth-child(3) { animation-delay: .14s; }
.editor-form fieldset:nth-child(4), .settings fieldset:nth-child(4) { animation-delay: .21s; }
.paper { animation: pop .7s .1s cubic-bezier(.2, .8, .2, 1) backwards; }
.item.enter { animation: rise .35s cubic-bezier(.2, .8, .2, 1); }
.list tbody tr { animation: rise .4s cubic-bezier(.2, .8, .2, 1) backwards; }
.list tbody tr:nth-child(2) { animation-delay: .04s; }
.list tbody tr:nth-child(3) { animation-delay: .08s; }
.list tbody tr:nth-child(4) { animation-delay: .12s; }
.list tbody tr:nth-child(n+5) { animation-delay: .16s; }

/* Anmeldung */
.auth-card { animation: pop .8s cubic-bezier(.2, .8, .2, 1) backwards; }
.auth-card.shake { animation: shake .45s ease-in-out; }
.auth-card .logo-mark { animation: float 3.2s ease-in-out infinite alternate; }

/* Bedienelemente reagieren weich */
.btn, .chip, .icon-btn, .sidebar nav a, .stat, .badge, .link {
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), background-color .2s, border-color .2s, box-shadow .25s, color .2s;
}
input, select, textarea { transition: border-color .2s, box-shadow .25s, background-color .2s; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 5px var(--accent-soft); }
.btn:hover, .chip:hover { transform: translateY(-1px); }
.btn:active, .chip:active, .icon-btn:active { transform: scale(.95); }
.stat:hover { transform: translateY(-3px); }
.sidebar nav a:hover { transform: translateX(3px); }
.list tbody tr { transition: background-color .2s; }

/* Lichtstreifen über dem Hauptbutton */
.btn.primary { position: relative; overflow: hidden; }
.btn.primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  transform: translateX(-130%) skewX(-20deg); pointer-events: none;
}
.btn.primary:hover::after { animation: sheen .8s ease; }
.btn.primary.pulse { animation: pulse 1.6s ease-in-out infinite; }

#toast { transition: opacity .25s, transform .45s cubic-bezier(.3, 1.5, .5, 1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  *, *::before, *::after { animation: none !important; }
  body::before, body::after { display: none; }
}

/* ---------- Animationen, deutlich sichtbar ---------- */
@keyframes rise-big { from { opacity: 0; transform: translateY(46px) scale(.96); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes slide-row { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }
@keyframes drift-big { 0% { transform: translate(-6%, -4%) rotate(0deg) scale(1); } 50% { transform: translate(5%, 4%) rotate(14deg) scale(1.15); } 100% { transform: translate(-3%, 6%) rotate(-10deg) scale(1.05); } }
@keyframes orbit { 0% { transform: translate(0, 0) scale(1); } 25% { transform: translate(34vw, 12vh) scale(1.25); } 50% { transform: translate(52vw, 48vh) scale(.9); } 75% { transform: translate(14vw, 56vh) scale(1.2); } 100% { transform: translate(0, 0) scale(1); } }
@keyframes sweep { from { transform: translateX(-160%) skewX(-18deg); } to { transform: translateX(460%) skewX(-18deg); } }
@keyframes nav-pop { 0% { transform: scale(.9); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes blink { 0%, 100% { box-shadow: 0 0 0 0 var(--warn-soft); } 50% { box-shadow: 0 0 0 7px transparent; } }
@keyframes wobble { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }

/* Hintergrund: Farbflächen wandern sichtbar, dazu eine leuchtende Kugel auf Rundkurs */
body::before { animation: drift-big 18s ease-in-out infinite alternate; }
body::after {
  content: ""; position: fixed; z-index: -1; left: 8vw; top: 6vh; width: 34vw; height: 34vw; border-radius: 50%;
  background: radial-gradient(circle, var(--blob1), var(--blob3) 45%, transparent 70%);
  filter: blur(50px); opacity: .75; pointer-events: none;
  animation: orbit 32s ease-in-out infinite;
}

/* Seitenwechsel: Inhalte fliegen deutlich und nacheinander herein */
.main > * { animation: rise-big .8s cubic-bezier(.16, 1, .3, 1) backwards; }
.main > *:nth-child(2) { animation-delay: .1s; }
.main > *:nth-child(3) { animation-delay: .2s; }
.main > *:nth-child(4) { animation-delay: .3s; }
.main > *:nth-child(5) { animation-delay: .4s; }
.stat { animation: rise-big .8s cubic-bezier(.16, 1, .3, 1) backwards; }
.stat:nth-child(1) { animation-delay: .2s; }
.stat:nth-child(2) { animation-delay: .32s; }
.stat:nth-child(3) { animation-delay: .44s; }
.editor-form fieldset, .settings fieldset { animation: rise-big .75s cubic-bezier(.16, 1, .3, 1) backwards; }
.editor-form fieldset:nth-child(2), .settings fieldset:nth-child(2) { animation-delay: .12s; }
.editor-form fieldset:nth-child(3), .settings fieldset:nth-child(3) { animation-delay: .24s; }
.editor-form fieldset:nth-child(4), .settings fieldset:nth-child(4) { animation-delay: .36s; }
.list tbody tr { animation: slide-row .6s cubic-bezier(.16, 1, .3, 1) backwards; }
.list tbody tr:nth-child(1) { animation-delay: .35s; }
.list tbody tr:nth-child(2) { animation-delay: .43s; }
.list tbody tr:nth-child(3) { animation-delay: .51s; }
.list tbody tr:nth-child(4) { animation-delay: .59s; }
.list tbody tr:nth-child(n+5) { animation-delay: .67s; }
.reminder-row { animation: slide-row .6s .45s cubic-bezier(.16, 1, .3, 1) backwards; }
.paper { animation: pop 1s .15s cubic-bezier(.16, 1, .3, 1) backwards; }
.sidebar nav a.on { animation: nav-pop .45s cubic-bezier(.2, .8, .2, 1); }
.sidebar .logo-mark { animation: float 2.6s ease-in-out infinite alternate; }
.brand:hover .logo-mark { animation: wobble .5s ease-in-out; }

/* Lichtstreifen wandert über Glaskarten und Hauptbuttons */
.stat, .reminders { position: relative; overflow: hidden; }
.stat::after, .reminders::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .28), transparent);
  transform: translateX(-160%) skewX(-18deg); pointer-events: none;
  animation: sweep 1.4s .9s ease-out 1;
}
.stat:hover::after { animation: sweep .9s ease-out 1; }
.btn.primary::after { animation: sheen 4.5s 1.2s ease-in-out infinite; }
.btn.primary:hover::after { animation: sheen .8s ease; }

/* Kräftigere Reaktion auf Maus und Klick */
.stat:hover { transform: translateY(-7px) scale(1.02); }
.btn:hover, .chip:hover { transform: translateY(-2px) scale(1.03); }
.btn:active, .chip:active { transform: scale(.92); }
.list tbody tr { transition: background-color .2s, transform .25s cubic-bezier(.2, .8, .2, 1); }
.list tbody tr:hover { transform: translateX(6px); }
.badge.ueberfaellig { animation: blink 1.8s ease-in-out infinite; }
fieldset { transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s; }
fieldset:focus-within { transform: scale(1.012); box-shadow: var(--shadow), 0 0 0 1px var(--accent-soft), 0 24px 50px -30px var(--accent); }

/* ---------- Anmeldung V3: Glassy Login Form mit Splitter-Animation ---------- */
.auth {
  --ink: #eaf3ff; --muted: #8ea4c8; --neon: #2f8bff; --neon-soft: #6cc4ff; --hairline: rgba(120, 185, 255, .28);
  --cut: 46px;
  position: relative; overflow: hidden; isolation: isolate; color: var(--ink); color-scheme: dark;
  background: radial-gradient(130% 100% at 70% 110%, #082a5e 0%, #040d22 42%, #010308 100%);
}

/* Hintergrund: geschwungene blaue Chrom-Streifen */
.auth-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.auth-bg span {
  position: absolute; left: 50%; top: 50%; width: 190vmax; height: 70vmax; margin: -35vmax 0 0 -95vmax;
  border-radius: 50%; border-top: 3px solid rgba(120, 200, 255, .85);
  box-shadow: 0 -26px 70px -14px rgba(47, 139, 255, .6), inset 0 30px 60px -30px rgba(47, 139, 255, .35);
  filter: blur(1.2px); opacity: .8; animation: auth-streak 16s ease-in-out infinite alternate;
}
.auth-bg span:nth-child(1) { --r: -28deg; --y: -6vmax; }
.auth-bg span:nth-child(2) { --r: -22deg; --y: 16vmax; opacity: .5; animation-duration: 21s; animation-delay: -6s; }
.auth-bg span:nth-child(3) { --r: -34deg; --y: -30vmax; opacity: .45; animation-duration: 19s; animation-delay: -11s; }
.auth-bg span:nth-child(4) { --r: 152deg; --y: 8vmax; opacity: .55; animation-duration: 24s; animation-delay: -3s; }
.auth-bg span:nth-child(5) { --r: 160deg; --y: -18vmax; opacity: .35; animation-duration: 18s; animation-delay: -9s; }
@keyframes auth-streak {
  from { transform: translateY(var(--y)) rotate(var(--r)) scale(1); }
  to { transform: translateY(calc(var(--y) + 5vmax)) rotate(calc(var(--r) + 5deg)) scale(1.06); }
}

/* Karte: nur Träger, das Glas liegt in .auth-glass */
.auth-card {
  position: relative; width: min(430px, calc(100vw - 32px)); max-width: none; padding: 0; overflow: visible;
  background: none; border: 0; border-radius: 0; box-shadow: none; animation: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  transition: height .45s cubic-bezier(.4, 0, .2, 1), opacity .45s, transform .45s, filter .45s;
}
.auth-card.enter { animation: pop .9s cubic-bezier(.16, 1, .3, 1) backwards; }
.auth-card.burst { opacity: 0; transform: scale(1.08); filter: blur(12px); }
/* blauer Schein hinter der Scheibe */
.auth-card::before {
  content: ""; position: absolute; inset: 8%; z-index: -1; border-radius: 40%;
  background: rgba(47, 139, 255, .55); filter: blur(60px); opacity: .55;
}

/* Milchglas-Scheibe mit abgeschrägten Ecken oben links und unten rechts */
.auth-glass {
  position: absolute; inset: 0; border-radius: 26px;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  background: linear-gradient(155deg, rgba(130, 185, 255, .17), rgba(14, 36, 84, .3) 40%, rgba(6, 16, 40, .44));
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: inset 0 0 0 1px rgba(170, 215, 255, .36), inset 0 1px 0 rgba(255, 255, 255, .25), inset 0 0 60px rgba(47, 139, 255, .12);
}
/* Kanten entlang der beiden Schrägen */
.auth-glass::before, .auth-glass::after {
  content: ""; position: absolute; width: calc(var(--cut) * 1.4142); height: 1px; rotate: -45deg;
  background: rgba(170, 215, 255, .5);
}
.auth-glass::before { left: 1px; top: calc(var(--cut) + 1px); transform-origin: 0 0; }
.auth-glass::after { right: 1px; bottom: calc(var(--cut) + 1px); transform-origin: 100% 100%; }

/* Die zwei Glassplitter in den Ecken */
.shard {
  position: absolute; z-index: 2; left: 0; top: 0; width: var(--cut); height: var(--cut);
  translate: 0 0; pointer-events: none;
  transition: left .3s cubic-bezier(.34, 1.45, .64, 1), top .3s cubic-bezier(.34, 1.45, .64, 1),
    translate .3s cubic-bezier(.34, 1.45, .64, 1), scale .3s cubic-bezier(.34, 1.45, .64, 1), filter .3s;
}
.shard.b { left: calc(100% - var(--cut)); top: calc(100% - var(--cut)); }
.shard::before, .shard::after {
  content: ""; position: absolute; inset: 0; border-radius: 10px; clip-path: polygon(0 0, 84% 0, 0 84%);
}
.shard.b::before, .shard.b::after { clip-path: polygon(100% 16%, 100% 100%, 16% 100%); }
.shard::before { background: linear-gradient(135deg, rgba(215, 232, 255, .5), rgba(120, 165, 225, .16)); }
.shard::after { background: linear-gradient(135deg, #9bd8ff, #2f8bff 55%, #0d55dd); opacity: 0; transition: opacity .2s; }

/* Ring-Welle um das Quadrat */
.auth-ring {
  position: absolute; z-index: 1; left: 50%; top: 50%; width: 70px; height: 70px; margin: -35px 0 0 -35px;
  border-radius: 50%; border: 2px solid rgba(120, 200, 255, .9); opacity: 0; pointer-events: none;
  box-shadow: 0 0 26px rgba(47, 139, 255, .85), inset 0 0 26px rgba(47, 139, 255, .5);
}

/* --- Ablauf des Wechsels: out → shards → merge → ripple → in --- */
/* out: Inhalt verschwindet, übrig bleibt die leere Glasscheibe */
.auth-card[data-phase]:not([data-phase="in"]) .auth-inner { opacity: 0; filter: blur(6px); pointer-events: none; }
/* shards: Splitter werden blau und fliegen zur Mitte */
.auth-card[data-phase="shards"] .shard::after, .auth-card[data-phase="merge"] .shard::after,
.auth-card[data-phase="ripple"] .shard::after { opacity: 1; }
.auth-card[data-phase="shards"] .shard, .auth-card[data-phase="merge"] .shard {
  left: 50%; top: 50%; scale: 1.2; filter: drop-shadow(0 0 14px rgba(47, 139, 255, .95));
}
.auth-card[data-phase="shards"] .shard.a { translate: calc(-50% - 7px) calc(-50% - 7px); }
.auth-card[data-phase="shards"] .shard.b { translate: calc(-50% + 7px) calc(-50% + 7px); }
/* merge: beide Hälften schließen sich zum leuchtenden Quadrat */
.auth-card[data-phase="merge"] .shard { scale: 1.35; filter: drop-shadow(0 0 22px rgba(108, 196, 255, 1)); }
.auth-card[data-phase="merge"] .shard.a { translate: calc(-50% - 2px) calc(-50% - 2px); }
.auth-card[data-phase="merge"] .shard.b { translate: calc(-50% + 2px) calc(-50% + 2px); }
.auth-card[data-phase="merge"] .auth-ring { animation: auth-ring-in .2s ease-out forwards; }
/* ripple: Ring breitet sich bis zum Kartenrand aus, Splitter kehren zurück */
.auth-card[data-phase="ripple"] .shard { filter: drop-shadow(0 0 12px rgba(47, 139, 255, .9)); }
.auth-card[data-phase="ripple"] .auth-ring, .auth-card[data-phase="in"] .auth-ring { animation: auth-ring-out .6s ease-out forwards; }
/* in: Lichtreflex über die Ecke oben links */
.auth-card[data-phase="in"] .shard.a { animation: auth-sweep .45s ease-out; }
@keyframes auth-ring-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1.25); } }
@keyframes auth-ring-out { from { opacity: 1; transform: scale(1.25); } to { opacity: 0; transform: scale(7); } }
@keyframes auth-sweep { 0% { filter: brightness(1); } 40% { filter: brightness(2.6) drop-shadow(0 0 10px #fff); } 100% { filter: brightness(1); } }

/* Inhalt der Karte */
.auth-inner { position: relative; z-index: 1; padding: 30px 30px 24px; text-align: left; transition: opacity .2s, filter .2s; }
.auth-inner.entering > *, .auth-inner.entering form > * { animation: auth-field .5s cubic-bezier(.4, 0, .2, 1) backwards; }
.auth-inner.entering > :nth-child(1) { animation-delay: .02s; }
.auth-inner.entering > :nth-child(3) { animation-delay: .3s; }
.auth-inner.entering > :nth-child(4) { animation-delay: .35s; }
.auth-inner.entering form > :nth-child(1) { animation-delay: .07s; }
.auth-inner.entering form > :nth-child(2) { animation-delay: .12s; }
.auth-inner.entering form > :nth-child(3) { animation-delay: .17s; }
.auth-inner.entering form > :nth-child(4) { animation-delay: .22s; }
.auth-inner.entering form > :nth-child(n+5) { animation-delay: .26s; }
@keyframes auth-field { from { opacity: 0; transform: translateY(10px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

.auth-head { padding-left: 24px; margin-bottom: 18px; }
.auth-head h1 { margin: 0; font-size: 25px; color: #fff; }
.auth-head h1 span { color: var(--neon-soft); text-shadow: 0 0 22px rgba(47, 139, 255, .8); }
.auth-head p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.auth-inner form { margin: 0 0 14px; }
.auth-inner label { color: var(--muted); font-size: 12px; margin-bottom: 11px; }
.auth-inner input.ico {
  padding: 11px 14px 11px 40px; border-radius: 12px; color: var(--ink);
  background: rgba(8, 20, 48, .5) no-repeat 13px center / 17px; border: 1px solid var(--hairline);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
}
.auth-inner input.ico:focus {
  outline: none; border-color: var(--neon-soft);
  box-shadow: 0 0 0 3px rgba(47, 139, 255, .22), 0 0 22px -2px rgba(47, 139, 255, .8);
}
.auth-inner input.ico-mail { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ea4c8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3C/svg%3E"); }
.auth-inner input.ico-lock { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ea4c8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E"); }
.auth-inner input.ico-user { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ea4c8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E"); }
.auth-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 12px; font-size: 12px; }
.auth-check { display: flex; align-items: center; gap: 7px; margin: 0; font-weight: 500; cursor: pointer; }
.auth-check input { display: inline-block; width: 15px; height: 15px; margin: 0; padding: 0; accent-color: var(--neon); }
.auth-row .link, .auth-switch .link { color: var(--neon-soft); text-decoration: none; font-weight: 600; }
.auth-row .link:hover, .auth-switch .link:hover { text-shadow: 0 0 12px var(--neon); }
.auth-inner .btn.primary {
  margin-top: 2px; padding: 12px; border-radius: 12px; border: 1px solid rgba(170, 215, 255, .6);
  background: linear-gradient(180deg, #58b4ff, #1a73f0);
  box-shadow: 0 0 26px -2px rgba(47, 139, 255, .95), 0 14px 30px -14px #1466e8, inset 0 1px 0 rgba(255, 255, 255, .5);
}
.auth-inner .btn.primary:hover { background: linear-gradient(180deg, #7cc6ff, #2a82ff); border-color: #d6ecff; }
.auth-inner .form-error { border-radius: 12px; text-align: center; background: rgba(255, 69, 58, .16); color: #ff9a94; }

/* Alternative Anmeldewege */
.auth-divider { display: flex; align-items: center; gap: 12px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--hairline), transparent); }
.auth-alt-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 0; }
.auth-alt-btn svg { width: 16px; height: 16px; flex: none; }
.auth-alt-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 6px; border-radius: 10px; cursor: pointer; font: 500 13px var(--sans); color: var(--ink);
  background: rgba(120, 180, 255, .08); border: 1px solid var(--hairline);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), border-color .2s, box-shadow .25s, background-color .2s;
}
.auth-alt-btn:hover { transform: translateY(-2px); border-color: var(--neon-soft); background: rgba(120, 180, 255, .16); box-shadow: 0 0 18px -4px var(--neon); }
.auth-alt-btn:focus-visible { outline: 2px solid var(--neon-soft); outline-offset: 2px; }
.auth-switch { margin: 12px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

@media (max-width: 400px) {
  .auth { --cut: 38px; }
  .auth-inner { padding: 26px 20px 20px; }
  .auth-two { grid-template-columns: 1fr; }
  .auth-alt-row { margin-inline: 0; }
}

/* ---------- SMS-Code: Glassy OTP – Orbit & Merge ---------- */
@property --otp-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.otp { --acc: var(--neon, #2f8bff); --acc2: var(--neon-soft, #6cc4ff); --ok: #3ee07f; --ok2: #1fb85f; --bad: #ff5a52;
  text-align: center; position: relative; }
.otp-icon {
  width: 38px; height: 38px; margin: 0 auto 14px; border-radius: 11px; display: grid; place-items: center;
  border: 1px solid rgba(108, 196, 255, .5); background: rgba(47, 139, 255, .12); color: var(--acc2);
  transition: color .5s, border-color .5s, background-color .5s;
}
.otp-icon svg { width: 18px; height: 18px; }
.otp.ok .otp-icon { border-color: rgba(62, 224, 127, .5); background: rgba(62, 224, 127, .1); color: var(--ok); }
.otp-titles { position: relative; height: 64px; }
.otp-t { position: absolute; inset: 0; transition: opacity .45s, filter .45s, transform .45s; }
.otp-t h1 { margin: 0; font-size: 24px; color: #fff; }
.otp-t h1 span { color: var(--acc2); text-shadow: 0 0 22px rgba(47, 139, 255, .8); }
.otp-t p { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.otp-t p b { color: var(--ink); font-weight: 600; white-space: nowrap; }
.otp-t.ok h1 span { color: var(--ok); text-shadow: 0 0 22px rgba(62, 224, 127, .6); }
.otp-t.ok { opacity: 0; filter: blur(8px); transform: translateY(6px); }
.otp.ok .otp-t.base { opacity: 0; filter: blur(8px); transform: translateY(-6px); }
.otp.ok .otp-t.ok { opacity: 1; filter: none; transform: none; }

.otp-stage { --bw: 46px; position: relative; height: 160px; margin: 14px 0 8px; cursor: text; }
.otp-stage::before {  /* grüner Schein bei Erfolg */
  content: ""; position: absolute; inset: -20px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(closest-side, rgba(62, 224, 127, .22), transparent); transition: opacity .8s;
}
.otp.ok .otp-stage::before { opacity: 1; }
.otp-stage.shake { animation: shake .45s ease-in-out; }
.otp-orbit { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.otp-box {
  position: absolute; left: calc(var(--bw) / -2); top: -26px; width: var(--bw); height: 52px; border-radius: 12px;
  display: grid; place-items: center; font-size: 22px; font-weight: 600; color: #fff;
  background: rgba(8, 20, 48, .5); box-shadow: inset 0 0 0 1px var(--hairline, rgba(255, 255, 255, .14));
  transition: box-shadow .2s, opacity .2s;
}
.otp-box.active { box-shadow: inset 0 0 0 1.5px var(--acc2), 0 0 18px rgba(47, 139, 255, .45); }
.otp-box.active:empty::after, .otp-box.active .d:empty::after {
  content: ""; display: block; width: 2px; height: 22px; background: var(--acc2); animation: otp-blink 1s steps(1) infinite;
}
@keyframes otp-blink { 50% { opacity: 0; } }
/* rotierender Kantenglow während der Prüfung */
.otp-box::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; opacity: 0; transition: opacity .3s;
  background: conic-gradient(from var(--otp-a), transparent 0 55%, var(--acc) 75%, var(--acc2) 85%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: otp-spin 1.1s linear infinite;
}
@keyframes otp-spin { to { --otp-a: 360deg; } }
.otp-stage.verifying .otp-box::before { opacity: 1; }
.otp-box .d { transition: opacity .25s; }
.otp-box.merged { box-shadow: inset 0 0 0 2px var(--acc2), 0 0 24px rgba(47, 139, 255, .7); }
.otp-box.merged::before { opacity: 0; }
.otp-box.green { box-shadow: inset 0 0 0 2px var(--ok), 0 0 26px rgba(62, 224, 127, .5); background: rgba(62, 224, 127, .08); transition: box-shadow .35s; }
.otp-stage.bad .otp-box { box-shadow: inset 0 0 0 1.5px var(--bad), 0 0 18px rgba(255, 90, 82, .45); }
.otp-check { width: 24px; height: 24px; stroke: var(--ok); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 30; stroke-dashoffset: 30; }
.otp-box.green .otp-check { animation: otp-draw .45s .35s ease-out forwards; }
@keyframes otp-draw { to { stroke-dashoffset: 0; } }
.otp-ring {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px; border-radius: 50%;
  border: 2px solid var(--ok); opacity: 0; pointer-events: none;
  box-shadow: 0 0 24px rgba(62, 224, 127, .4), inset 0 0 24px rgba(62, 224, 127, .15);
}
.otp-ring.go { animation: otp-ring 1.1s cubic-bezier(.2, .7, .2, 1) forwards; }
@keyframes otp-ring { 0% { opacity: 0; transform: scale(.5); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(2.6); } }
.otp-spark { position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 6px var(--ok); opacity: 0; pointer-events: none; }

.otp .otp-error { margin: 0 0 10px; }
.otp-resend { margin: 0 0 14px; font-size: 12px; color: var(--muted); }
.otp-resend .link { color: var(--acc2); font-weight: 600; text-decoration: none; }
.otp-resend .link:disabled { color: var(--muted); cursor: default; }
.otp-resend .link b { color: var(--acc2); }
.otp-back-row { margin: 12px 0 0; font-size: 12px; }
.otp-back-row .link { color: var(--muted); text-decoration: none; }
.otp-back-row .link:hover { color: var(--ink); }
.otp .otp-btn { display: flex; align-items: center; justify-content: center; gap: 8px; transition: background .5s, box-shadow .5s, border-color .5s; }
.otp .otp-btn:disabled { opacity: 1; cursor: default; }
.otp .otp-btn svg { width: 16px; height: 16px; }
.otp.ok .otp-btn, .otp.ok .otp-btn:hover {
  background: linear-gradient(90deg, var(--ok2), var(--ok)); color: #04220f; border-color: rgba(160, 255, 200, .6);
  box-shadow: 0 8px 26px rgba(62, 224, 127, .35);
}
.otp-sp { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: otp-rot .7s linear infinite; }
@keyframes otp-rot { to { transform: rotate(360deg); } }
.otp-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

/* SMS-Code als Overlay in den Einstellungen */
.otp-modal { position: fixed; inset: 0; z-index: 50; overflow-y: auto; animation: otp-fade .35s ease-out; }
.otp-modal.closing { opacity: 0; transition: opacity .35s; }
@keyframes otp-fade { from { opacity: 0; } }
.twofa-status { margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.twofa-status.on { color: var(--ink); }
.twofa-status.on::before { content: "● "; color: #2fbf71; }

@media (prefers-reduced-motion: reduce) {
  .otp *, .otp *::before, .otp *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Kunden ---------- */
.contact-layout { display: grid; grid-template-columns: minmax(0, 640px) minmax(260px, 1fr); gap: 24px; align-items: start; }
.contact-layout .settings { max-width: none; margin: 0; }
.contact-side h2 { font-size: 16px; margin: 4px 0 10px; }
.contact-side .stats.one { grid-template-columns: 1fr 1fr; margin-bottom: 18px; }
.contact-side .stat strong { font-size: 21px; }
.contact-side .list td { white-space: normal; vertical-align: top; }
.contact-side .badge { margin-top: 4px; }
.small { font-size: 12px; }
.list td .small { font-weight: 400; }
.import-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cust-save { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-top: 2px; }
.cust-save[hidden] { display: none; }
@media (max-width: 1100px) {
  .contact-layout { grid-template-columns: 1fr; }
}

/* ---------- GiroCode & Leistungsnachweis auf der Rechnung ---------- */
.doc-notes.with-qr { display: flex; gap: 8mm; align-items: flex-start; justify-content: space-between; }
.doc-qr { margin: 0; width: 27mm; flex: none; text-align: center; }
.doc-qr .qr { width: 27mm; height: 27mm; display: block; }
.doc-qr figcaption { font-size: 6.5pt; line-height: 1.3; color: #555; margin-top: 1mm; }
.doc-proof { margin-top: 6mm; break-inside: auto; }
.doc-proof h2 { font: 600 11pt var(--serif); margin: 0 0 2mm; }
.doc-proof tfoot td { font-weight: 600; padding: 2mm; border-top: 1pt solid #111; }

/* ---------- Übersicht: Einblicke (Prognose & Steuer-Topf) ---------- */
:root { --s-free: #0071e3; --s-res: #7b5cd6; --s-tax: #c27c00; --good: #1f8f4e; --warning: #b07800; --serious: #c4561b; --critical: #c5281c; }
@media (prefers-color-scheme: dark) {
  :root { --s-free: #2997ff; --s-res: #a48bff; --s-tax: #f0b240; --good: #3ecf7a; --warning: #ffcf5a; --serious: #ff9d5c; --critical: #ff6961; }
}
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 22px; }
.insight {
  padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%); box-shadow: var(--shadow);
}
.insight h2 { font: 700 17px var(--serif); letter-spacing: -0.015em; margin: 0; }
.insight h3 { font-size: 14px; margin: 16px 0 8px; }
.insight-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.hero-num { text-align: right; display: grid; }
.hero-num strong { font: 700 24px/1.1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.hero-num span { font-size: 12px; color: var(--muted); }
.small { font-size: 12px; }

/* Wochen-Balken: eine Reihe, Basislinie, Tooltip beim Zeigen */
.bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; height: 130px; align-items: end;
  border-bottom: 1px solid var(--hairline); padding-top: 18px; margin-bottom: 26px; }
.bar-col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; outline: none; cursor: default; }
.bar-col::before { content: ""; position: absolute; inset: 0 -3px -26px; }  /* größere Trefferfläche */
.bar { width: min(26px, 100%); background: var(--s-free); border-radius: 4px 4px 0 0; transition: height .6s cubic-bezier(.2, .8, .2, 1), filter .2s; }
.bar-col.tip .bar, .bar-col:focus-visible .bar { filter: brightness(1.15); box-shadow: 0 0 0 2px var(--accent-soft); }
.bar-val { position: absolute; top: -17px; font-size: 11px; font-weight: 600; white-space: nowrap; color: var(--ink); }
.bar-lbl { position: absolute; bottom: -20px; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.bar-col.tip::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 3;
  background: var(--ink); color: var(--bg); font-size: 12px; padding: 6px 9px; border-radius: 8px; white-space: nowrap; pointer-events: none;
}
.bar-col:first-child.tip::after { left: 0; transform: none; }
.bar-col:last-child.tip::after { left: auto; right: 0; transform: none; }
.exp-list { list-style: none; margin: 10px 0 0; padding: 0; }
.exp-list li { padding: 8px 0; border-top: 1px solid var(--hairline); font-size: 14px; }
.exp-amt { float: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.table-view { margin-top: 8px; font-size: 13px; }
.table-view summary { cursor: pointer; color: var(--muted); }
.table-view table { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.table-view td, .table-view th { padding: 4px 6px; border-bottom: 1px solid var(--hairline); text-align: left; }
.table-view .r { text-align: right; }

/* Steuer-Topf: gestapelter Balken mit 2px-Abstand, Legende mit Werten */
.stack { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--neutral-soft); }
.stack i { display: block; height: 100%; transition: width .7s cubic-bezier(.2, .8, .2, 1); }
.s-free { background: var(--s-free); } .s-res { background: var(--s-res); } .s-tax { background: var(--s-tax); }
.legend { list-style: none; margin: 12px 0 8px; padding: 0; font-size: 13.5px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.legend li i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend li b { margin-left: auto; font-variant-numeric: tabular-nums; }
.legend li.sum { border-top: 1px solid var(--hairline); margin-top: 4px; padding-top: 8px; color: var(--muted); }
.legend li.sum b { color: var(--ink); }
.meter { height: 10px; border-radius: 5px; background: var(--neutral-soft); overflow: hidden; }
.meter.thin { height: 5px; margin-top: 6px; }
.meter i { display: block; height: 100%; border-radius: inherit; }
.meter i.good { background: var(--good); } .meter i.warning { background: var(--warning); }
.meter i.serious { background: var(--serious); } .meter i.critical { background: var(--critical); }
.meter-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.status { font-size: 13px; margin: 8px 0; display: flex; gap: 8px; align-items: baseline; }
.status b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 11px; flex: none; }
.status.good b { background: var(--good); } .status.warning b { background: var(--warning); color: #241800; }
.status.serious b { background: var(--serious); } .status.critical b { background: var(--critical); }

/* ---------- Schnell-Rechnung ---------- */
.quick {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; padding: 8px 8px 8px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%); box-shadow: var(--shadow);
}
.quick:focus-within { box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft); }
.quick-ico { font-size: 16px; }
.quick input { flex: 1 1 260px; margin: 0; border: 0; background: transparent; box-shadow: none; padding: 8px 4px; }
.quick input:focus { box-shadow: none; outline: none; }
.quick-mic { border: 0; background: var(--neutral-soft); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 16px; }
.quick-mic.on { background: var(--warn-soft); animation: blink 1.2s ease-in-out infinite; }
.quick-preview { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 2px; }
.quick-preview:empty { display: none; }
.qchip { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); }
.qchip.ok { background: rgba(31, 143, 78, .16); }
.qchip.warn { background: var(--amber-soft); }

/* ---------- Kundenlink im Editor ---------- */
.share-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.share-row input { flex: 1 1 220px; margin: 0; font-size: 13px; }
.share-status { font-size: 13px; margin: 10px 0 6px; color: var(--muted); }
.share-status.seen { color: var(--ink); }
.share-status.seen::before { content: "◉ "; color: var(--accent); }
.share-status.paid { color: var(--good); font-weight: 600; }
.share-status.paid::before { content: "✓ "; }
.reports { background: linear-gradient(135deg, rgba(31, 143, 78, .16), transparent 70%), var(--surface); }
.pay-behavior { font-size: 13px; color: var(--muted); margin: 0 0 14px; }

/* ---------- Daueraufträge ---------- */
.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.rec-card {
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%); box-shadow: var(--shadow);
}
.rec-card.paused { opacity: .7; }
.rec-card header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.rec-card header a { text-decoration: none; color: var(--ink); }
.rec-card header .muted { display: block; }
.rec-meta { margin: 10px 0 2px; }
.log-quick { display: grid; grid-template-columns: 130px 1fr 64px auto; gap: 6px; margin-top: 12px; align-items: center; }
.log-quick input { margin: 0; padding: 7px 9px; font-size: 13px; }
.log-quick.vertical { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
.log-quick.vertical .grid2 { gap: 8px; }
.log-list { list-style: none; padding: 0; margin: 0 0 18px; }
.log-list li { position: relative; padding: 8px 34px 8px 0; border-top: 1px solid var(--hairline); font-size: 14px; }
.log-list .icon-btn { position: absolute; right: 0; top: 8px; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
.check-row input { width: auto; margin: 0; }
@media (max-width: 560px) {
  .log-quick { grid-template-columns: 1fr 70px; }
  .log-quick input[name="text"] { grid-column: 1 / -1; order: -1; }
}

/* ---------- Kundenportal ---------- */
.portal { max-width: 860px; margin: 0 auto; padding: 28px 16px 60px; }
.portal-loading { text-align: center; color: var(--muted); padding: 60px 0; }
.portal-preview { background: var(--amber-soft); border-radius: 12px; padding: 8px 14px; font-size: 13px; }
.portal-card {
  padding: 22px 24px; margin-bottom: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%); box-shadow: var(--shadow);
}
.portal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.portal-head h1 { margin: 2px 0 0; font: 700 24px var(--serif); letter-spacing: -0.02em; }
.portal-head p { margin: 0; }
.portal-status { padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.portal-status.offen { background: var(--accent-soft); color: var(--accent); }
.portal-status.ueberfaellig { background: var(--warn-soft); color: var(--warn); }
.portal-status.bezahlt, .portal-status.gemeldet { background: rgba(31, 143, 78, .16); color: var(--good); }
.portal-amount { margin: 14px 0 18px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.portal-amount strong { font: 700 38px/1 var(--serif); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.portal-pay { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.portal-qr { margin: 0; width: 180px; flex: none; }
.portal-qr .qr { width: 180px; height: 180px; border-radius: 10px; display: block; }
.portal-qr figcaption { font-size: 12px; color: var(--muted); margin-top: 8px; }
.pay-details { flex: 1 1 280px; }
.pay-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.pay-row span { color: var(--muted); }
.pay-row b { font-variant-numeric: tabular-nums; word-break: break-all; }
.portal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.portal-paper { display: flex; justify-content: center; }
@media (max-width: 560px) {
  .portal-qr, .portal-qr .qr { width: 100%; max-width: 240px; height: auto; }
  .pay-row { grid-template-columns: 1fr auto; }
  .pay-row span { grid-column: 1 / -1; }
}
@media print {
  .portal { padding: 0; max-width: none; }
  .portal-card, .portal-preview { display: none !important; }
}
.insight-head > div:first-child { flex: 1 1 220px; }
.hero-num { margin-left: auto; }
@media (max-width: 560px) {
  .quick { border-radius: 22px; }
  .quick input { flex-basis: calc(100% - 60px); }
  .quick .btn { flex: 1; }
}

/* ---------- Assistenten: liegen gebliebenes Geld, Betrugswarnung, Vorab-Erinnerung ---------- */
.reminders.missed { background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface); }
.reminders.pre { background: var(--surface); }
.reminders.fraud { background: linear-gradient(135deg, var(--warn-soft), transparent 75%), var(--surface); border-color: var(--warn); }
.reminders.fraud h2 { color: var(--warn); }
.missed-sum { font-size: 14px; font-weight: 600; color: var(--accent); margin-left: 8px; white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: 6px; }
.reminder-row > div:first-child { flex: 1 1 260px; min-width: 0; }
.term-hint { font-size: 13px; margin: -4px 0 12px; padding: 8px 12px; border-radius: 12px; background: var(--amber-soft); color: var(--ink); }
.term-hint[hidden] { display: none; }

/* ---------- Preiserhöhungs-Assistent ---------- */
.raise-box { padding: 16px 18px; margin-bottom: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%); box-shadow: var(--shadow); }
.raise-box.stale { border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft); }
.raise-box.planned { background: linear-gradient(135deg, rgba(31, 143, 78, .16), transparent 70%), var(--surface); }
.raise-box h2 { margin: 0 0 6px; }
.raise-box p { margin: 0 0 10px; }
.raise-box textarea { font-size: 13px; }
.raise-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; margin-bottom: 8px; }
.raise-table th { text-align: left; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 4px 0; }
.raise-table td { padding: 5px 0; border-top: 1px solid var(--hairline); }
.raise-table .r { text-align: right; }
.raise-gain { font-size: 14px; }
.rec-flag { font-size: 12.5px; margin: 8px 0 0; padding: 5px 10px; border-radius: 10px; }
.rec-flag.stale { background: var(--accent-soft); }
.rec-flag.stale a { color: var(--accent); text-decoration: none; font-weight: 600; }
.rec-flag.planned { background: rgba(31, 143, 78, .16); color: var(--good); font-weight: 600; }
.letter-print { display: none; }
@media print {
  body.print-letter .main > :not(.letter-print) { display: none !important; }
  body.print-letter .letter-print { display: block; }
}

/* ---------- Echtheits-Check ---------- */
.doc-qrs { display: flex; gap: 5mm; flex: none; }
.doc-qr figcaption b { font-weight: 600; color: #111; word-break: break-all; }
.verify-card h1 { font: 700 24px var(--serif); letter-spacing: -0.02em; margin: 10px 0 0; }
.verify-card h2 { font: 700 17px var(--serif); margin: 0 0 6px; }
.verify-card .pay-details { margin-top: 14px; }
.verify-card .pay-row { grid-template-columns: 130px 1fr; }
.verify-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.verify-badge b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 13px; }
.verify-badge.ok { background: rgba(31, 143, 78, .16); color: var(--good); }
.verify-badge.ok b { background: var(--good); }
.verify-badge.bad { background: var(--warn-soft); color: var(--warn); }
.verify-badge.bad b { background: var(--warn); }
.verify-iban { font-size: 16px; letter-spacing: .02em; }
.verify-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 16px; }
.verify-form label { flex: 1 1 260px; margin: 0; }
.verify-form input { font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.verify-note { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.verify-note.good { background: rgba(31, 143, 78, .16); }
.verify-note.warn { background: var(--amber-soft); }
.verify-note.bad { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.small-print { font-size: 13px; }
.small-print p { margin: 0; }
@media (max-width: 560px) {
  .verify-card .pay-row { grid-template-columns: 1fr; gap: 2px; }
  .doc-qrs { gap: 3mm; }
}
.raise-table .r { padding-left: 12px; white-space: nowrap; }
.raise-box .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.raise-box .actions { margin-bottom: 10px; }
