/* ============================================================================
   zttl – Design-Tokens & Komponenten
   Schriften: Inter (UI), Satoshi (Wortmarke, Titel, Beträge). Kein JetBrains Mono.
   Lime (#B3FC2B) NUR als Text/Icon auf dunklem (#222) Pill – nie auf Weiß/Honigtau.
   ============================================================================ */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f4fee5; /* honeydew */
  --border: #e7eae0;
  --text-primary: #222222;
  --text-secondary: #666666;
  --brand: #6a49fc; /* majorelle */
  --brand-press: #5a3ce0;
  --surface-dark: #222222;
  --accent-neon: #b3fc2b; /* lime – isoliert */

  --radius-card: 14px;
  /* Fallback-Defaults der verwalteten Design-Tokens (siehe src/design.js).
     /api/design-tokens.css überschreibt sie zur Laufzeit aus der DB. */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 2px rgba(34, 34, 34, 0.06);
  --shadow-soft: 0 4px 24px rgba(34, 34, 34, 0.1);

  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Satoshi', 'Inter', system-ui, sans-serif;
  --font-size-base: 16px;
  --font-size-small: 14px;
  --font-size-large: 18px;
  --font-size-heading: 24px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  --nav-h: 60px;
  --danger: #b3261e; /* destruktiv – nur für Löschen/Swipe, nicht in der Hauptpalette */

  /* Komponenten-Tokens (Stufe 2) – Fallbacks; DB überschreibt via /api/design-tokens.css. */
  /* Button-Tokens (je Button-Klasse: Hintergrund, Text, Rand, Hover, Radius). */
  --btn-primary-bg: var(--brand);
  --btn-primary-text: #ffffff;
  --btn-primary-border: transparent;
  --btn-primary-hover-bg: #5a3ce0;
  --btn-primary-radius: 14px;
  --btn-secondary-bg: var(--bg-secondary);
  --btn-secondary-text: var(--text-primary);
  --btn-secondary-border: var(--border);
  --btn-secondary-hover-bg: #eef9d8;
  --btn-secondary-radius: 12px;
  --btn-tertiary-text: var(--brand);
  --btn-tertiary-hover-text: var(--brand);
  --btn-danger-bg: var(--danger);
  --btn-danger-text: #ffffff;
  --btn-danger-border: transparent;
  --btn-danger-hover-bg: #9e211a;
  --btn-danger-radius: 12px;
  --btn-danger-quiet-text: var(--text-secondary);
  --btn-danger-quiet-hover-text: var(--danger);
  --btn-danger-quiet-hover-bg: transparent;
  --chip-bg: var(--bg-secondary);
  --chip-active-bg: #1a1a1a;
  --chip-active-text: var(--accent-neon);
  --chip-radius: 999px;
  --input-bg: #ffffff;
  --input-border: #e0e0e0;
  --input-focus-border: var(--brand);
  --input-radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100dvh; }

button, input, select, textarea { font-family: inherit; }

img { display: block; }

.hidden { display: none !important; }

/* --- Fokus-Ring (majorelle) überall sichtbar --- */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(106, 73, 252, 0.35);
  border-color: var(--brand);
}

/* ----------------------------------------------------------------------------
   Typografie-Hilfen
   ---------------------------------------------------------------------------- */
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.display { font-family: var(--font-display); letter-spacing: -0.015em; color: var(--text-primary); }
.amount { font-family: var(--font-display); font-weight: 700; color: var(--text-primary); }

/* ==========================================
   Button-Klassen (Stand: 2026-07-01)
   Vier Kategorien mit klarer Semantik:
   - .btn-primary   Haupt-Aktion
   - .btn-secondary Wichtige, nicht primäre Aktion
   - .btn-tertiary  Subtile Aktion / Text-Link
   - .btn-danger    Zerstörende Aktion
   Erweiterte Tokens folgen in einem separaten Lauf.
   .btn liefert die Basis-Geometrie (Höhe, Padding, Flex) für die soliden
   Varianten (primary/secondary/danger). .btn-tertiary und .btn-danger-quiet
   erscheinen als Text-Link und werden OHNE .btn genutzt.
   ========================================== */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  font: 600 15px/1 var(--font-ui);
  height: 46px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.12s ease, transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }
/* Jeder Button-Aspekt ist über --btn-*-Tokens steuerbar (siehe /admin/design).
   Geometrie (Höhe, Padding, Font) bleibt hardcoded in .btn. */
.btn-primary {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: 1px solid var(--btn-primary-border);
  border-radius: var(--btn-primary-radius);
}
.btn-primary:hover { background-color: var(--btn-primary-hover-bg); }
.btn-secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--btn-secondary-border);
  border-radius: var(--btn-secondary-radius);
  font-weight: 500;
}
.btn-secondary:hover { background-color: var(--btn-secondary-hover-bg); }
/* Tertiär: erscheint als Text-Link (kein Rahmen/Hintergrund, Majorelle-Text). */
.btn-tertiary {
  background: none; border: none; cursor: pointer; padding: 0;
  font: 500 13px/1 var(--font-ui); color: var(--btn-tertiary-text); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-tertiary:hover { color: var(--btn-tertiary-hover-text); text-decoration: underline; }
/* Danger: solide, zerstörende Aktion. */
.btn-danger {
  background-color: var(--btn-danger-bg);
  color: var(--btn-danger-text);
  border: 1px solid var(--btn-danger-border);
  border-radius: var(--btn-danger-radius);
}
.btn-danger:hover { background-color: var(--btn-danger-hover-bg); }
/* Dezente Danger-Variante: erscheint als ruhiger Text-Link, wird erst bei Hover rot
   (Detail-Ansicht „Beleg löschen") – bewusst zurückhaltend. Ohne .btn genutzt.
   Kompound-Selektor (.btn-danger.btn-danger-quiet) überschreibt die soliden Danger-Regeln. */
.btn-danger.btn-danger-quiet {
  background-color: transparent; border: none; cursor: pointer; padding: 6px 0; height: auto;
  font: 500 0.85rem/1 var(--font-ui); color: var(--btn-danger-quiet-text);
}
.btn-danger.btn-danger-quiet:hover {
  background-color: var(--btn-danger-quiet-hover-bg);
  color: var(--btn-danger-quiet-hover-text);
}
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

/* ----------------------------------------------------------------------------
   Login
   ---------------------------------------------------------------------------- */
.login-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px;
  background: var(--bg-primary);
  overflow-y: auto;
}
/* Karte + Release-Teaser gestapelt; margin-block:auto zentriert vertikal, erlaubt
   aber Scrollen, wenn der Inhalt höher als der Viewport ist (kein Flex-Clipping). */
.login-wrap {
  width: 100%; max-width: 360px; margin-block: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px 28px 28px;
  box-shadow: var(--shadow-card);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.login-brand img { width: 32px; height: 32px; }
.login-brand .wordmark { font-size: 18px; }
/* Neues Login-Branding: Logo + Schriftzug zentriert, darunter Marketing-Text */
.login-logo { display: block; height: 96px; width: auto; margin: 0 auto 8px; }
.login-wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 2.5rem; line-height: 1;
  color: var(--text-primary); text-align: center; letter-spacing: -0.02em; margin-bottom: 14px;
}
.login-tagline { font: 400 1rem/1.5 var(--font-ui); color: var(--text-primary); margin-bottom: 22px; }

/* Release-Teaser unter der Login-Karte (gleiche Honeydew-Karte) */
.releases-teaser {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 20px 22px; box-shadow: var(--shadow-card);
}
.releases-teaser-title { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; margin: 0 0 12px; }
.release-entry { margin-bottom: 14px; }
.release-entry:last-of-type { margin-bottom: 0; }
.release-entry h3 { font-family: var(--font-display); font-weight: 600; font-size: 1rem; margin: 0 0 4px; letter-spacing: -0.01em; }
.release-entry ul { margin: 0; padding-left: 18px; }
.release-entry li { font: 400 13px/1.45 var(--font-ui); color: var(--text-secondary); margin-bottom: 3px; }
.release-entry li strong { color: var(--text-primary); font-weight: 600; }
/* „Alle Updates ansehen →" ist ein .btn-tertiary; hier nur der Abstand zur Liste. */
.releases-teaser .btn-tertiary { margin-top: 12px; }
.login-foot {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
  font: 400 12px/1.5 var(--font-ui); color: var(--text-secondary); text-align: center;
}

/* ----------------------------------------------------------------------------
   Auth-Screens (Login / Registrieren / Passwort vergessen)
   Übertragen aus mockups/registration.html: Desktop = Split-Screen (Frames
   11D/11E/11F), Mobil = „Lila-Variante" (Frames 12A/12B/12C). Karteninhalte
   nutzen die bestehenden .field/.input/.btn/.error-box-Klassen.
   Lime (--accent-neon) wird hier bewusst als Wortmarke/Headline auf Majorelle
   eingesetzt (so vom Mockup vorgegeben; Hex auf System-Lime #b3fc2b vereinheitlicht).
   ---------------------------------------------------------------------------- */
/* Der Login-Screen-Container trägt jetzt das Majorelle-Vollflächen-Layout. */
.login-screen { padding: 0; background: var(--brand); align-items: stretch; }

.auth { display: none; width: 100%; min-height: 100dvh; }
.auth.active { display: flex; }

/* Linke Marketing-Spalte – nur Desktop. */
.auth-aside { display: none; }

/* Rechte Spalte mit der Karte (auf Majorelle zentriert). */
.auth-main {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px; overflow-y: auto;
}
.auth-card {
  width: 100%; max-width: 340px;
  background: var(--bg-secondary); border: 1px solid var(--surface-dark);
  border-radius: var(--radius-card); padding: 22px;
}
.auth-card--wide { max-width: 360px; }

/* Kompakter Kopf über der Karte (nur Mobil): Logo + Titel auf Majorelle. */
.auth-mhead { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 340px; }
.auth-mhead.center { flex-direction: column; text-align: center; gap: 8px; }
.auth-mhead img { width: 44px; height: 44px; display: block; }
.auth-mhead.center img { width: 76px; height: 76px; }
.auth-mhead-title { font: 600 19px/1.15 var(--font-display); color: #fff; letter-spacing: -0.01em; }
.auth-mhead.center .auth-mhead-title { font-size: 20px; }
.auth-mhead-sub { font: 400 12.5px/1.4 var(--font-ui); color: rgba(255, 255, 255, 0.8); margin-top: 2px; }
.auth-wordmark-lime {
  font: 700 42px/1 var(--font-display); color: var(--accent-neon); letter-spacing: 0.1px; margin-top: 6px;
}

.auth-card-title { font: 600 24px/1.2 var(--font-display); color: var(--text-primary); letter-spacing: -0.015em; }
.auth-card-sub { font: 400 14px/1.5 var(--font-ui); color: var(--text-secondary); margin-top: 6px; margin-bottom: 20px; }
.auth-hint { font: 400 11px/1.4 var(--font-ui); color: var(--text-secondary); margin-top: 6px; }
.auth-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-links-end { display: flex; justify-content: flex-end; margin-top: 8px; }
.auth-link { font: 500 12px/1 var(--font-ui); color: var(--brand); text-decoration: none; cursor: pointer; background: none; border: none; padding: 0; }
.auth-link:hover { text-decoration: underline; }
.auth-foot { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); text-align: center; font: 400 13px/1.5 var(--font-ui); color: var(--text-primary); }
.auth-foot--legal { border-top: none; padding-top: 0; margin-top: 10px; font-size: 11px; color: var(--text-secondary); }
.auth-foot .auth-link { font-weight: 600; font-size: 13px; }
.auth-section-label { font: 500 12px/1 var(--font-ui); color: var(--text-secondary); margin: 18px 0 8px; }

/* Paket-Auswahl */
.auth-plans { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.auth-plan {
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  padding: 11px 8px; text-align: center; cursor: pointer;
}
.auth-plan[aria-pressed="true"] { border: 2px solid var(--brand); padding: 10px 7px; }
.auth-plan .p-name { font: 600 12.5px/1 var(--font-ui); color: var(--text-primary); }
.auth-plan .p-price { font: 700 16px/1 var(--font-display); color: var(--text-primary); margin-top: 6px; }
.auth-plan[aria-pressed="true"] .p-price { color: var(--brand); }
.auth-plan .p-per { font: 400 10px/1 var(--font-ui); color: var(--text-secondary); margin-top: 4px; }

/* Einladungscode-Zeile */
.auth-invite { display: flex; gap: 8px; }
.auth-invite .input { flex: 1; }
.auth-free-pill { background: var(--accent-neon); padding: 1px 5px; border-radius: 4px; font-weight: 600; color: var(--text-primary); }

/* Info-Box (Passwort-vergessen) */
.auth-info { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; padding: 10px 12px; background: #fff; border: 1px solid var(--brand); border-radius: 10px; }
.auth-info .i { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); color: #fff; font: 600 10px/14px var(--font-ui); text-align: center; flex-shrink: 0; margin-top: 1px; }
.auth-info .t { font: 400 12px/1.45 var(--font-ui); color: var(--text-primary); }

/* Releases-Teaser sitzt auf dem Auth-Screen unter der Login-Karte. */
#view-login .releases-teaser { width: 100%; max-width: 340px; }

/* ---- Desktop: echtes Split-Screen (Frames 11D/11E/11F) ---- */
@media (min-width: 900px) {
  .auth-main { background: var(--brand); }
  .auth-aside {
    display: flex; flex-direction: column; justify-content: center;
    width: 520px; flex-shrink: 0; padding: 64px; position: relative;
  }
  .auth-aside img.auth-aside-logo { width: 94px; height: 94px; display: block; }
  .auth-aside-headline { font: 600 38px/1.1 var(--font-display); color: var(--accent-neon); letter-spacing: 0.1px; margin-top: 24px; }
  .auth-aside-headline.big { font-size: 42px; }
  .auth-aside-sub { font: 400 16px/1.6 var(--font-ui); color: rgba(255, 255, 255, 0.8); margin-top: 14px; max-width: 340px; }
  .auth-aside-copy { position: absolute; left: 64px; bottom: 28px; font: 400 11px/1 var(--font-ui); color: rgba(255, 255, 255, 0.6); }
  .auth-mhead { display: none; }        /* Mobil-Kopf auf Desktop ausblenden */
  .auth-card { max-width: 400px; }
  .auth-card--wide { max-width: 440px; }
  #view-login .releases-teaser { display: none; } /* Desktop: Marketing steht links */
}

/* Formularfelder */
.field { margin-bottom: 14px; }
.field label {
  display: block; font: 500 12px/1 var(--font-ui);
  color: var(--text-secondary); margin-bottom: 6px;
}
.input, .select, textarea.input {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--input-border); border-radius: var(--input-radius);
  background: var(--input-bg); color: var(--text-primary);
  font: 400 14px/1 var(--font-ui); outline: none;
}
textarea.input { height: auto; padding: 10px 12px; line-height: 1.4; resize: vertical; }
.select { appearance: none; background-image: none; }
/* Fokus-Rand der Formularfelder über Token gesteuert (überschreibt :focus-visible). */
.input:focus, .input:focus-visible, .select:focus, .select:focus-visible, textarea.input:focus, textarea.input:focus-visible {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--input-focus-border) 35%, transparent);
}

/* Fehler-Box (majorelle getönt) */
.error-box {
  display: flex; gap: 8px; align-items: flex-start;
  margin-top: 12px; padding: 10px 12px;
  background: rgba(106, 73, 252, 0.12);
  border: 1px solid rgba(106, 73, 252, 0.45);
  border-radius: var(--radius-sm);
  font: 400 12px/1.45 var(--font-ui); color: var(--text-secondary);
}
.error-box .bang {
  width: 14px; height: 14px; border-radius: 50%; background: var(--brand);
  color: #fff; font: 600 10px/14px var(--font-ui); text-align: center;
  flex-shrink: 0; margin-top: 1px;
}

/* ----------------------------------------------------------------------------
   App-Layout (Shell)
   ---------------------------------------------------------------------------- */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.main {
  flex: 1;
  /* Platz für die fixe Tab-Leiste + 16px, damit die letzte Zeile frei bleibt */
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

/* Mobile-Topbar (Marke + Abmelden) */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 10px;
}
.topbar .brand { display: flex; align-items: center; gap: 9px; background: none; border: none; padding: 0; cursor: pointer; }
.topbar .brand img { width: 29px; height: 29px; }
.topbar .brand .wordmark { font-size: 15px; }
.link-btn {
  background: none; border: none; padding: 6px 4px; cursor: pointer;
  font: 500 13px/1 var(--font-ui); color: var(--text-secondary);
}

.view { padding: 0 20px 24px; }
.view.hidden { display: none !important; }

.view-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0 12px;
}
.view-title { font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.015em; }
.view-head-right { display: flex; align-items: center; gap: 12px; }
#archiv-select-btn { flex-shrink: 0; }

/* Archiv-Auswahl-Modus: Aktions-Leiste + Karten-Checkboxen. */
.select-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 10px;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px;
}
.select-bar.hidden { display: none; }
.select-bar .sel-count { font: 600 13px/1 var(--font-ui); color: var(--text-primary); }
.select-bar .sel-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.select-bar #sel-download { height: 36px; padding: 0 16px; }
/* Checkbox links in der Karte – nur im Auswahl-Modus sichtbar. */
.card-check { display: none; }
.selecting .card-check {
  display: block; flex-shrink: 0; align-self: center;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border); background: #fff;
}
.selecting .card-trash { display: none !important; } /* im Auswahl-Modus kein Hover-Löschen */
.card-row.selected .card { box-shadow: inset 0 0 0 2px var(--brand); background: #eef9d8; }
.card-row.selected .card-check {
  border-color: var(--brand); background: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E");
  background-size: 14px; background-position: center; background-repeat: no-repeat;
}
.view-intro { color: var(--text-secondary); font: 400 14px/1.5 var(--font-ui); margin: 0 0 16px; max-width: 560px; }
.view-intro:empty { display: none; }
.muted { color: var(--text-secondary); font: 400 12px/1.4 var(--font-ui); }

/* Highlight-Pulse für „Auf der Seite ansehen" aus /admin/texts (?highlight=<key>). */
@keyframes textPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(106,73,252,0); } 50% { box-shadow: 0 0 0 6px rgba(106,73,252,0.35); } }
.text-pulse { border-radius: 8px; outline: 2px solid var(--brand); outline-offset: 2px; animation: textPulse 1s ease-in-out 3; }
.section-label {
  font: 600 11px/1 var(--font-ui); color: var(--text-secondary);
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* ----------------------------------------------------------------------------
   Navigation – Bottom-Bar (mobil) / Seitenleiste (Desktop)
   ---------------------------------------------------------------------------- */
/* Mobil: fix am unteren Rand, volle Breite, immer über dem Inhalt.
   Die 4 Tabs liegen in .nav-links (für die Desktop-Seitenleiste gebraucht) –
   deshalb wird DORT das 4-Spalten-Raster gesetzt, nicht auf .nav selbst. */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
}
.nav-brand, .nav-foot { display: none; }
.nav-links { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; }
.nav-item {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; min-height: 56px; padding: 8px 4px;
  color: var(--text-secondary);
  font: 500 11px/1.1 var(--font-ui); text-align: center;
}
.nav-item .ico { width: 22px; height: 22px; display: block; flex-shrink: 0; }
.nav-item .ico svg { width: 100%; height: 100%; display: block; }
.nav-item .lbl-count { display: none; } /* Zähler nur in der Desktop-Seitenleiste */
.nav-item[aria-current='page'] { color: var(--brand); font-weight: 600; }

/* ----------------------------------------------------------------------------
   Aufnehmen
   ---------------------------------------------------------------------------- */
.greeting { padding: 2px 0 16px; }
.greeting .display { font-weight: 600; font-size: 22px; }
.greeting .muted { margin-top: 4px; }

.capture {
  position: relative; width: 100%; aspect-ratio: 3 / 2;
  background: var(--brand); border-radius: 14px 14px 0 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; cursor: pointer; border: none; padding: 24px;
  color: #fff;
}
.capture:hover { background: var(--brand-press); }
.capture .lens {
  width: 74px; height: 74px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
  background: var(--accent-neon); box-shadow: 0 0 0 3px rgba(179, 252, 43, 0.35);
}
.capture .lens > span { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-dark); }
.capture .ttl { font: 600 19px/1 var(--font-display); letter-spacing: -0.01em; }
.capture .sub { font: 400 12px/1.4 var(--font-ui); margin-top: 8px; max-width: 240px; color: rgba(255,255,255,0.92); }
.capture .corner { position: absolute; width: 14px; height: 14px; }
.capture .c1 { left: 14px; top: 14px; border-left: 1.5px solid rgba(255,255,255,0.18); border-top: 1.5px solid rgba(255,255,255,0.18); }
.capture .c2 { right: 14px; top: 14px; border-right: 1.5px solid rgba(255,255,255,0.18); border-top: 1.5px solid rgba(255,255,255,0.18); }
.capture .c3 { left: 14px; bottom: 14px; border-left: 1.5px solid rgba(255,255,255,0.18); border-bottom: 1.5px solid rgba(255,255,255,0.18); }
.capture .c4 { right: 14px; bottom: 14px; border-right: 1.5px solid rgba(255,255,255,0.18); border-bottom: 1.5px solid rgba(255,255,255,0.18); }
.perf {
  width: 100%; height: 14px; background: var(--brand);
  -webkit-mask-image: radial-gradient(circle 7px at 14px 100%, transparent 7px, #000 7.5px);
  -webkit-mask-size: 28px 100%; -webkit-mask-repeat: repeat-x;
  mask-image: radial-gradient(circle 7px at 14px 100%, transparent 7px, #000 7.5px);
  mask-size: 28px 100%; mask-repeat: repeat-x;
}

.hint {
  margin-top: 20px; display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font: 400 12px/1.5 var(--font-ui); color: var(--text-secondary);
}
.hint .i {
  width: 18px; height: 18px; border-radius: 50%; background: var(--brand);
  color: #fff; font: 600 11px/18px var(--font-ui); text-align: center; flex-shrink: 0;
}

/* Upload-Optionen (Format/Farbmodus) + Live-Vorschau */
.upload-opts { margin-top: 16px; }
.preview-wrap {
  display: flex; justify-content: center; align-items: center;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px;
}
.preview-wrap canvas { max-width: 100%; height: auto; border-radius: 8px; display: block; }
.opt-caption { text-align: center; font: 400 11.5px/1.4 var(--font-ui); color: var(--text-secondary); margin-top: 8px; }
.seg-label { font: 500 12px/1 var(--font-ui); color: var(--text-secondary); margin: 16px 0 6px; }
/* Format-/Farbmodus-Auswahl = Chips -> über Chip-Tokens gesteuert */
.seg {
  display: flex; gap: 4px; padding: 4px;
  background: var(--chip-bg); border: 1px solid var(--border); border-radius: var(--chip-radius);
}
.seg button {
  flex: 1; border: none; background: none; cursor: pointer;
  padding: 9px 12px; border-radius: var(--chip-radius);
  font: 500 13px/1 var(--font-ui); color: var(--text-secondary);
  transition: background-color 0.12s ease, color 0.12s ease;
}
.seg button[aria-pressed='true'] { background: var(--chip-active-bg); color: var(--chip-active-text); }

/* Verarbeitungs-Banner */
.banner {
  margin-top: 14px; padding: 14px 16px; background: var(--brand);
  border-radius: 12px; display: flex; align-items: center; gap: 12px; color: #fff;
}
.banner .t { font: 500 13px/1.35 var(--font-ui); flex: 1; }
.banner .t small { display: block; font: 400 12px/1.3 var(--font-ui); color: rgba(255,255,255,0.78); margin-top: 2px; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 2.4px solid rgba(255,255,255,0.3); border-top-color: var(--surface-dark);
  animation: spin 0.9s linear infinite;
}
.spinner.dark { border-color: rgba(34,34,34,0.18); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Banner-Varianten */
.banner.error { background: #fff; border: 1px solid rgba(106,73,252,0.45); color: var(--text-primary); }
.banner.error .t { color: var(--text-primary); }

/* ----------------------------------------------------------------------------
   Karten / Listen
   ---------------------------------------------------------------------------- */
.card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; display: flex; gap: 12px;
  cursor: pointer; text-align: left; width: 100%;
  transition: box-shadow 0.12s ease;
}
.card:hover { box-shadow: var(--shadow-card); }
.card .thumb {
  width: 48px; height: 60px; border-radius: 6px; flex-shrink: 0;
  border: 1px solid var(--border); overflow: hidden;
  background: linear-gradient(135deg, #f3f4f2 0%, var(--bg-secondary) 100%);
  display: flex; align-items: center; justify-content: center;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb.pdf { background: #fff; border-color: var(--surface-dark); }
.card .thumb .pdf-tag { font: 700 8px/1 var(--font-ui); color: var(--brand); letter-spacing: 0.04em; }
.card .thumb .doc-tag { font: 700 8px/1 var(--font-ui); color: var(--text-secondary); letter-spacing: 0.04em; }
.card .body { flex: 1; min-width: 0; }
.card .body .title {
  font: 600 13px/1.3 var(--font-ui); color: var(--text-primary);
  letter-spacing: -0.005em; word-break: break-word;
}
.card .meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
/* Ergebnis-Karte (nach Upload): ganze Karte klickbar, kleiner CTA-Hinweis. */
.result-cta { display: inline-block; margin-top: 10px; font: 600 12px/1 var(--font-ui); color: var(--brand); }
.card.result-card:active, .home-recent-item:active, .home-task:active { background: #eef9d8; }

.list { display: flex; flex-direction: column; gap: 8px; }

/* Swipe-to-delete / Hover-Löschen */
.card-row { position: relative; border-radius: 12px; overflow: hidden; }
.card-row .card { position: relative; z-index: 1; border-radius: 12px; transition: transform 0.2s ease; will-change: transform; }
.card-row.swiping .card { transition: none; }
.card-delete {
  position: absolute; top: 0; right: 0; bottom: 0; width: 96px; z-index: 0;
  background: var(--danger); color: #fff; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font: 600 12px/1 var(--font-ui);
}
.card-delete svg { width: 20px; height: 20px; }
/* Slide-out beim Löschen */
.card-row.removing { transition: transform 0.25s ease, opacity 0.25s ease; transform: translateX(-110%); opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .card-row .card { transition: none; }
  .card-row.removing { transition: none; }
}
/* Desktop: Hover-Mülleimer statt Swipe */
.card-trash {
  position: absolute; top: 50%; right: 10px; transform: translateY(-50%); z-index: 2;
  display: none; background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 6px; border-radius: 8px;
}
.card-trash:hover { color: var(--brand); }
.card-trash svg { width: 18px; height: 18px; display: block; }
@media (min-width: 768px) {
  .card-row:hover .card-trash { display: inline-flex; }
  .card-row:hover .card { box-shadow: var(--shadow-card); }
}

/* ----------------------------------------------------------------------------
   Badges
   ---------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font: 500 11px/1.4 var(--font-ui); white-space: nowrap;
}
.badge-cat { background: #fff; border: 1px solid var(--border); color: var(--text-secondary); }
.badge-source { background: var(--bg-secondary); color: var(--text-primary); font-weight: 500; }
/* Steuerbereit: dunkler Pill, Lime-Text (einzig erlaubter Lime-Einsatz) */
.badge-tax { background: var(--surface-dark); color: var(--accent-neon); font-weight: 700; font-size: 10px; }
/* bitte prüfen: heller Pill, dunkler Text, kleiner majorelle Punkt (kein Lime) */
.badge-review { background: #fff; border: 1px solid var(--border); color: var(--text-primary); font-weight: 600; font-size: 10.5px; }
.badge-review .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }

/* ----------------------------------------------------------------------------
   Suche + Chips
   ---------------------------------------------------------------------------- */
.search { position: relative; margin-bottom: 10px; }
.search .ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--brand); opacity: 0.6; pointer-events: none;
}
.search input { padding-left: 36px; height: 42px; border-radius: var(--radius-md); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; -webkit-overflow-scrolling: touch; }
.chip {
  background: var(--chip-bg); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--chip-radius);
  padding: 6px 12px; font: 500 12px/1 var(--font-ui);
  white-space: nowrap; cursor: pointer; flex-shrink: 0;
}
.chip[aria-pressed='true'] { background: var(--chip-active-bg); color: var(--chip-active-text); border-color: var(--chip-active-bg); }

/* ----------------------------------------------------------------------------
   Leerer Zustand
   ---------------------------------------------------------------------------- */
.empty { padding: 40px 20px 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.empty img { width: 92px; height: 92px; margin-bottom: 18px; opacity: 0.95; }
.empty .ttl { font: 600 17px/1.3 var(--font-display); letter-spacing: -0.01em; }
.empty .txt { font: 400 13px/1.5 var(--font-ui); color: var(--text-secondary); margin-top: 8px; max-width: 280px; }
.empty .note { margin-top: 16px; font: 400 12px/1.4 var(--font-ui); color: var(--text-secondary); }

/* ----------------------------------------------------------------------------
   Beleg-Detail (Bottom-Sheet)
   ---------------------------------------------------------------------------- */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55);
  z-index: 200; display: flex; align-items: flex-end; justify-content: center;
}
/* Mobil: Bottom-Sheet, fast volle Höhe, volle Breite */
.sheet {
  width: 100vw; max-height: 95vh;
  background: var(--bg-secondary); border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  display: flex; flex-direction: column; overflow: hidden;
  animation: sheet-up 0.18s ease;
}
/* Desktop: zentriertes, deutlich größeres Modal */
@media (min-width: 768px) {
  .sheet-overlay { align-items: center; }
  .sheet {
    width: 90vw; max-width: 900px; max-height: 90vh;
    border-radius: 16px; box-shadow: var(--shadow-soft);
  }
  .sheet-handle { display: none; }
}
@keyframes sheet-up { from { transform: translateY(20px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-handle { display: flex; justify-content: center; padding: 8px 0 4px; }
.sheet-handle span { width: 36px; height: 4px; background: var(--border); border-radius: 2px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 18px 12px; }
.sheet-head .ttl { font: 600 16px/1 var(--font-display); letter-spacing: -0.01em; }
.sheet-close { background: none; border: none; font: 400 22px/1 var(--font-ui); color: var(--text-secondary); cursor: pointer; padding: 4px 8px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 0 18px 12px; }
.sheet-foot { border-top: 1px solid var(--border); padding: 12px 18px; display: flex; gap: 10px; background: var(--bg-secondary); }
.sheet-foot .btn { height: 44px; }
.sheet-foot .grow2 { flex: 2; }
.sheet-foot .grow1 { flex: 1; }
/* Lösch-Link: sichtbar, aber dezent – nicht rot, nicht prominent.
   Der Button selbst trägt .btn-danger .btn-danger-quiet (s. Button-Klassen oben). */
.sheet-delete { padding: 4px 18px 14px; background: var(--bg-secondary); }

.preview {
  position: relative;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; background: #fff; min-height: 150px;
  display: flex; align-items: center; justify-content: center;
}
.preview img { width: 100%; max-height: 320px; object-fit: contain; }
.preview iframe { width: 100%; height: 320px; border: none; }
/* Vollbild- + Download-Button (Foto + PDF): oben rechts im Vorschau-Bereich. */
.preview-max, .preview-dl {
  position: absolute; top: 8px; z-index: 3;
  width: 32px; height: 32px; cursor: pointer;
  background: rgba(255, 255, 255, 0.92); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
}
.preview-max { right: 8px; }
.preview-dl { right: 48px; } /* 8px Abstand links vom Vollbild-Button */
.preview-max:hover, .preview-dl:hover { color: var(--brand); }
.preview-dl svg { width: 18px; height: 18px; display: block; }
.pdf-max svg, .preview-max svg { width: 18px; height: 18px; display: block; }

/* Eigener PDF.js-Viewer (Seiten untereinander, kein Browser-Viewer) */
.pdf-view { position: relative; border: 1px solid var(--border); border-radius: var(--radius-md); background: #e9ece3; overflow: hidden; }
.pdf-pages { overflow-y: auto; -webkit-overflow-scrolling: touch; max-height: 48vh; padding: 12px; display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 768px) { .pdf-pages { max-height: 60vh; } }
.pdf-page { display: block; width: 100%; height: auto; background: #fff; border-radius: 2px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15); }
.pdf-loading { padding: 28px 16px; text-align: center; color: var(--text-secondary); font: 500 13px/1.4 var(--font-ui); }
.pdf-max {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 32px; height: 32px; cursor: pointer;
  background: rgba(255, 255, 255, 0.92); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-secondary); font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.pdf-max:hover { color: var(--brand); }

/* PDF-Vollbild (native Fullscreen-API; Fallback: Overlay 100vw×100vh) */
.pdf-fs { position: fixed; inset: 0; z-index: 300; background: var(--bg-secondary); overflow: auto; }
.pdf-fs.hidden { display: none; }
.pdf-fs:fullscreen { background: var(--bg-secondary); width: 100vw; height: 100vh; }
.pdf-fs-pages { max-width: 1000px; margin: 0 auto; padding: 60px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.pdf-fs-pages .pdf-page { display: block; width: 100%; height: auto; background: #fff; border-radius: 2px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2); }
.pdf-fs-pages .pdf-loading { padding: 40px 16px; text-align: center; color: var(--text-secondary); font: 500 14px/1.4 var(--font-ui); }
.pdf-fs-close {
  position: fixed; top: 14px; right: 16px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  background: #fff; border: 1px solid var(--border); color: var(--text-secondary);
  font: 400 22px/1 var(--font-ui); display: flex; align-items: center; justify-content: center;
}
.pdf-fs-close:hover { color: var(--brand); }
.preview .ph { padding: 24px; color: var(--text-secondary); font: 500 13px/1.4 var(--font-ui); text-align: center; }

/* Foto-Vollbild: Overlay mit Zoom (Pinch nativ via touch-action / Wheel) + Scroll. */
.img-fs {
  position: fixed; inset: 0; z-index: 300; background: var(--surface-dark);
  overflow: auto; touch-action: pinch-zoom;
  display: flex; align-items: center; justify-content: center;
}
.img-fs.hidden { display: none; }
.img-fs.zoomed { display: block; } /* gezoomt: oben-links verankert, in beide Richtungen scrollbar */
#img-fs-img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }

/* Mehrseiten-Anzeige unter dem PDF-Viewer im Detail. */
.pdf-pagecount { margin-top: 8px; font: 500 12px/1 var(--font-ui); color: var(--text-secondary); text-align: center; }

/* "Weitere Seite?"-Sheet nach dem Zuschneiden. */
.mp-overlay {
  position: fixed; inset: 0; z-index: 350; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.mp-overlay.hidden { display: none; }
.mp-sheet {
  width: 100vw; max-height: 85vh; background: var(--bg-secondary);
  border-radius: 18px 18px 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  display: flex; flex-direction: column; overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 768px) {
  .mp-overlay { align-items: center; }
  .mp-sheet { width: 90vw; max-width: 560px; border-radius: 16px; }
}
.mp-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.mp-title { font: 600 16px/1.2 var(--font-display); letter-spacing: -0.01em; }
.mp-thumbs { display: flex; gap: 12px; overflow-x: auto; padding: 8px 18px 14px; -webkit-overflow-scrolling: touch; }
.mp-thumb {
  position: relative; flex-shrink: 0; width: 90px; height: 116px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); background: #fff;
}
.mp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mp-num {
  position: absolute; left: 6px; bottom: 6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--surface-dark); color: #fff;
  font: 600 11px/18px var(--font-ui); text-align: center;
}
.mp-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(34, 34, 34, 0.72); color: #fff; border: none; cursor: pointer;
  font: 400 15px/1 var(--font-ui); display: flex; align-items: center; justify-content: center;
}
.mp-format { padding: 8px 18px 4px; }
.mp-format-label { display: block; font: 600 13px/1.2 var(--font-ui); margin-bottom: 6px; }
.mp-format-select {
  width: 100%; height: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font: 400 15px/1 var(--font-ui); -webkit-appearance: none; appearance: none;
}
.mp-format-hint { margin: 8px 0 0; font: 400 12px/1.4 var(--font-ui); color: var(--text-secondary); }
.mp-foot { display: flex; gap: 10px; padding: 8px 16px 16px; border-top: 1px solid var(--border); background: var(--bg-secondary); }
.mp-foot .btn { flex: 1; height: 48px; }

/* Datum (≈55%) / Betrag (≈45%): minmax(0,…) verhindert Überlauf/Überlappung. */
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 14px; }
.grid2 .field { margin-bottom: 0; min-width: 0; }
.grid2 .input, .grid2 .select { min-width: 0; max-width: 100%; }
/* Datum/Betrag und Währung/Typ liegen im selben Grid mit denselben 50/50-Spalten
   und demselben Gap. Der einzige Unterschied war das native input[type=date]:
   es behält die intrinsische Breite seines Controls und läuft – trotz
   min-width/max-width – aus der Spalte in den Betrag (kein Gap, Überlappung).
   appearance:none macht es zur normalen Box – GENAU wie die <select> bei
   Währung/Typ (.select), die genau deshalb sauber nebeneinander sitzen. */
.grid2 input[type="date"].input, .grid2 input[type="time"].input { -webkit-appearance: none; appearance: none; }
.field.full { grid-column: 1 / -1; }
.field input.input, .field select.select, .field textarea.input { height: 38px; font-weight: 500; font-size: 13px; }
.field textarea.input { height: auto; }

/* Steuer-Block */
.tax-block { margin-top: 14px; padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); }
.tax-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tax-head .lbl .h { font: 600 13px/1.2 var(--font-ui); }
.tax-head .lbl .s { font: 400 11px/1.3 var(--font-ui); color: var(--text-secondary); margin-top: 2px; }

/* Toggle */
.toggle { width: 40px; height: 23px; border-radius: 12px; background: var(--border); border: none; position: relative; cursor: pointer; flex-shrink: 0; transition: background 0.12s; }
.toggle .knob { position: absolute; left: 2px; top: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.18); transition: left 0.12s; }
.toggle[aria-checked='true'] { background: var(--brand); }
.toggle[aria-checked='true'] .knob { left: 19px; }

.tax-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.tax-fields.hidden { display: none; }

/* Fälligkeit / Erledigt-Status im Detail-Sheet */
.due-block { margin-top: 14px; }
.due-field.hidden { display: none; }
.due-row { display: flex; align-items: center; gap: 8px; }
.due-row .input { flex: 1; }
.due-remove {
  flex-shrink: 0; width: 34px; height: 38px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text-secondary); font: 400 20px/1 var(--font-ui); cursor: pointer;
}
.due-remove:hover { color: var(--danger); border-color: var(--danger); }
.due-add.hidden { display: none; }
.due-action { margin-top: 12px; }
.due-action.hidden { display: none; }
.due-action .due-done { padding: 6px 0; }

/* Termin-Bereich im Beleg-Detail */
.event-block { margin-top: 14px; }
.event-fields.hidden { display: none; }
.event-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.event-head-title { font: 600 13px/1 var(--font-ui); color: var(--text-primary); }
.event-add.hidden { display: none; }
.event-ics { margin-top: 12px; }
.event-ics.hidden { display: none; }

/* ----------------------------------------------------------------------------
   Steuer-Screen
   ---------------------------------------------------------------------------- */
.year-tabs { display: flex; gap: 8px; margin: 4px 0 14px; flex-wrap: wrap; }
.year-tab {
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  background: var(--bg-secondary); border: 1px solid var(--border);
  font: 500 13px/1 var(--font-ui); color: var(--text-secondary);
}
.year-tab[aria-pressed='true'] { background: #fff; border-color: var(--surface-dark); color: var(--text-primary); font-weight: 600; }

.total-card { padding: 16px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; }
.total-card .row { display: flex; justify-content: space-between; align-items: baseline; }
.total-card .lab { font: 500 11px/1 var(--font-ui); color: var(--text-secondary); letter-spacing: 0.04em; text-transform: uppercase; }
.total-card .sum { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1.05; letter-spacing: -0.02em; margin-top: 6px; }
.total-card .cnt { font: 600 18px/1 var(--font-ui); margin-top: 4px; text-align: right; }
.total-card .cnt-lab { font: 500 11px/1 var(--font-ui); color: var(--text-secondary); text-align: right; }

.tax-group { margin-bottom: 14px; }
.tax-group .gh { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.tax-group .gh .name { font: 600 13px/1 var(--font-ui); }
.tax-group .gh .sub { font: 600 13px/1 var(--font-ui); }
.tax-item {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 6px;
}
.tax-item .bar { width: 6px; height: 36px; background: var(--surface-dark); border-radius: 3px; flex-shrink: 0; }
.tax-item .b { flex: 1; min-width: 0; }
.tax-item .b .t1 { font: 500 12.5px/1.3 var(--font-ui); }
.tax-item .b .t2 { font: 400 11px/1.3 var(--font-ui); color: var(--text-secondary); margin-top: 2px; }
.tax-item .amt { font: 600 13px/1 var(--font-ui); }
/* Ganze Steuer-Zeile öffnet das Detail -> Desktop-Hover + Touch-Feedback. */
.tax-item:hover { box-shadow: var(--shadow-card); }
.tax-item:active { background: #eef9d8; }
.empty-groups { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px dashed var(--border); font: 400 12px/1.3 var(--font-ui); color: var(--text-secondary); }
.export-bar { display: flex; gap: 8px; margin-top: 8px; }

/* ----------------------------------------------------------------------------
   Einstellungen
   ---------------------------------------------------------------------------- */
.panel { padding: 16px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.panel-head .ico { width: 28px; height: 22px; color: var(--brand); flex-shrink: 0; }
.panel-head .h { font: 600 14px/1.2 var(--font-ui); }
.panel-head .s { font: 400 11.5px/1.3 var(--font-ui); color: var(--text-secondary); margin-top: 2px; }
.addr-row { display: flex; gap: 6px; margin-top: 8px; }
.addr-box {
  flex: 1; height: 42px; padding: 0 12px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); display: flex; align-items: center;
  font: 500 13px/1 var(--font-ui); color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.panel .desc { margin-top: 10px; font: 400 12px/1.5 var(--font-ui); color: var(--text-secondary); }
.divider { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.mini-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mini-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
/* Nur die Belege unter „zuletzt per E-Mail" sind klickbar (öffnen das Detail);
   die Mitglieder-Liste nutzt .mini-row ebenfalls, bleibt aber ohne Zeiger. */
#recent-email .mini-row { cursor: pointer; }
#recent-email .mini-row:hover { border-color: var(--brand); }
#recent-email .mini-row:active { background: #eef9d8; }
.mini-row .n { font: 500 12px/1.3 var(--font-ui); }
.mini-row .d { font: 400 11px/1 var(--font-ui); color: var(--text-secondary); }

.member { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; color: #fff; font: 600 13px/36px var(--font-ui); text-align: center; flex-shrink: 0; }
.member .who { flex: 1; min-width: 0; }
.member .n { font: 500 13px/1.2 var(--font-ui); }
.member .e { font: 400 11px/1.3 var(--font-ui); color: var(--text-secondary); margin-top: 2px; }
.pill-you { font: 500 10px/1 var(--font-ui); color: var(--brand); padding: 4px 8px; background: rgba(106,73,252,0.18); border-radius: 999px; }

/* Konto-Ansicht */
.panel-title { font: 600 15px/1.2 var(--font-ui); margin-bottom: 12px; }
.help { font: 400 11.5px/1.4 var(--font-ui); color: var(--text-secondary); margin-top: 5px; }
.form-msg { margin-top: 10px; font: 500 12px/1.4 var(--font-ui); display: none; }
.form-msg.show { display: block; }
.form-msg.ok { color: #2f7d1a; }
.form-msg.err { color: var(--brand); }
.panel .btn { margin-top: 14px; }
/* anklickbare Zeile (z.B. "Mein Konto") */
.link-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; cursor: pointer;
  padding: 14px 16px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px;
}
.link-row:hover { box-shadow: var(--shadow-card); }
a.link-row { color: inherit; text-decoration: none; }
/* Titel + Beschreibung untereinander mit klarem Abstand (sonst kleben sie aneinander). */
.link-row .lr-h { display: block; font: 600 14px/1.2 var(--font-ui); }
.link-row .lr-s { display: block; font: 400 11.5px/1.3 var(--font-ui); color: var(--text-secondary); margin-top: 4px; }
.link-row .chev { color: var(--text-secondary); flex-shrink: 0; }
/* „Zurück"-Button (#account-back) trägt .btn-tertiary (s. Button-Klassen oben). */

/* ----------------------------------------------------------------------------
   Home (Startseite) – ruhige Blöcke: Begrüßung, Prüfen, Zuletzt, Steuer-Kachel
   ---------------------------------------------------------------------------- */
.home-greet { padding: 8px 0 12px; }
.home-greet-title { font: 600 22px/1.2 var(--font-display); color: var(--text-primary); letter-spacing: -0.015em; margin: 0; }
.home-greet-sub { font: 400 13px/1.4 var(--font-ui); color: var(--text-secondary); margin-top: 4px; }

/* PDF-Glyph (Umriss + 3 Linien), Majorelle über currentColor */
.pdf-glyph { width: 18px; height: 22px; color: var(--brand); flex-shrink: 0; }
.home-pdf-btn { gap: 10px; }

/* Empty-State: großer Zettel-Tile nutzt .capture / .perf (siehe „Aufnehmen"). */

/* Dashboard: zwei Aktions-Buttons (Frame 0B) */
.home-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.home-action-primary {
  flex: 2; height: 78px; background: var(--brand); border: none; border-radius: 14px;
  color: #fff; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  text-align: left; transition: background-color 0.12s ease;
}
.home-action-primary:hover { background: var(--brand-press); }
.hap-lens {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent-neon);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(179, 252, 43, 0.28);
}
.hap-lens > span { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-dark); }
.hap-text { min-width: 0; }
.hap-title { display: block; font: 600 14.5px/1.2 var(--font-ui); }
.hap-desc { display: block; font: 400 11.5px/1.3 var(--font-ui); color: rgba(255, 255, 255, 0.78); margin-top: 3px; }
.home-action-pdf {
  flex: 1; height: 78px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 14px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--text-primary); transition: background-color 0.12s ease;
}
.home-action-pdf:hover { background: #eef9d8; }
.home-action-pdf .pdf-glyph { width: 20px; height: 24px; }
.hap-pdf-mobile { font: 500 11.5px/1 var(--font-ui); color: var(--text-primary); }
.hap-pdf-desktop { display: none; }

/* Dashboard-Container – mobil gestapelt */
.home-dash { display: flex; flex-direction: column; gap: 16px; }

/* Sektions-Kopf (Aufgaben, Zuletzt). Zähler in Mono (Haus-Regel: kein JetBrains Mono). */
.home-sec-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.home-sec-title { font: 600 15px/1 var(--font-display); color: var(--text-primary); letter-spacing: -0.01em; margin: 0; }
.home-sec-count { font: 500 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-secondary); }

/* Aufgaben-Karten */
.home-tasklist { display: flex; flex-direction: column; gap: 8px; }
.home-task {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  transition: box-shadow 0.12s ease;
}
.home-task:hover { box-shadow: var(--shadow-card); }
.ht-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ht-icon svg { width: 18px; height: 18px; }
.ht-review { background: rgba(106, 73, 252, 0.15); color: var(--brand); }
.ht-due { background: var(--brand); color: #fff; }
.ht-letter { background: var(--surface-dark); color: var(--accent-neon); }
.ht-remind { background: var(--bg-secondary); border: 1px solid var(--border); color: var(--brand); }
/* Termin-Karten: Honigtau auf Majorelle-Rand – bewusst anders als „Zu erledigen". */
.ht-event { background: var(--bg-secondary); border: 1.5px solid var(--brand); color: var(--brand); }
.home-events-all { display: inline-block; margin-top: 4px; }
.ht-body { flex: 1; min-width: 0; }
.ht-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ht-title { font: 600 13.5px/1.25 var(--font-ui); color: var(--text-primary); }
.ht-meta { font: 500 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }
.ht-meta.ht-cd-future { color: var(--brand); font-weight: 600; }
.ht-meta.ht-cd-over { color: var(--danger); font-weight: 600; }
.ht-note { display: block; font: 400 11.5px/1.4 var(--font-ui); color: var(--text-secondary); margin-top: 3px; }

/* Steuer-Kachel (klein, dezent) */
.home-tax-card {
  display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
  transition: box-shadow 0.12s ease;
}
.home-tax-card:hover { box-shadow: var(--shadow-card); }
.htx-lab { font: 600 10px/1 var(--font-ui); color: var(--text-secondary); letter-spacing: 0.06em; text-transform: uppercase; }
.htx-val { font: 600 14px/1.2 var(--font-ui); color: var(--text-primary); }

/* Zuletzt hinzugefügt */
.home-recent-list { display: flex; flex-direction: column; }
.home-recent-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; padding: 8px 0; border-top: 1px solid var(--border);
}
.home-recent-item:first-child { border-top: none; }
.home-recent-item:hover { background: #eef9d8; border-radius: 8px; }
.hr-thumb {
  width: 34px; height: 42px; border-radius: 5px; flex-shrink: 0; border: 1px solid var(--border); overflow: hidden;
  background: linear-gradient(135deg, #f3f4f2 0%, var(--bg-secondary) 100%);
  display: flex; align-items: center; justify-content: center;
}
.hr-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hr-thumb.pdf { background: #fff; border-color: var(--surface-dark); }
.hr-thumb .pdf-tag { font: 700 7px/1 var(--font-ui); color: var(--brand); letter-spacing: 0.04em; }
.hr-body { flex: 1; min-width: 0; }
.hr-title { display: block; font: 600 13px/1.3 var(--font-ui); color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-meta { display: block; font: 400 11.5px/1.3 var(--font-ui); color: var(--text-secondary); margin-top: 2px; }

/* Skeleton-Platzhalter (Ladezustand) */
.sk { background: var(--border); border-radius: 8px; opacity: 0.7; animation: skPulse 1.2s ease-in-out infinite; }
.sk-title { height: 26px; width: 60%; margin-bottom: 10px; }
.sk-line { height: 14px; width: 40%; }
.sk-actions { height: 78px; border-radius: 14px; background: var(--border); opacity: 0.6; margin-bottom: 16px; animation: skPulse 1.2s ease-in-out infinite; }
.sk-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.sk-row { height: 44px; margin: 8px 0; }
@keyframes skPulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.8; } }
@media (prefers-reduced-motion: reduce) { .sk, .sk-actions { animation: none; } }

/* Desktop: PDF wird primärer CTA (Fotografieren unpraktisch), Zwei-Spalten-Layout */
@media (min-width: 768px) {
  #view-home { max-width: 900px; }
  .home-capture-wrap { max-width: 460px; }
  .home-action-primary { display: none; }
  .home-actions { max-width: 360px; }
  .home-action-pdf { height: 56px; flex-direction: row; gap: 10px; background: var(--brand); border-color: var(--brand); color: #fff; }
  .home-action-pdf:hover { background: var(--brand-press); }
  .home-action-pdf .pdf-glyph { color: #fff; }
  .hap-pdf-mobile { display: none; }
  .hap-pdf-desktop { display: inline; font: 600 14px/1 var(--font-ui); color: #fff; }
  .home-dash { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px 20px; align-items: start; }
  .home-dash.has-tasks .home-tasks { grid-column: 1; grid-row: 1 / span 2; }
  .home-dash.has-tasks .home-tax-card { grid-column: 2; grid-row: 1; }
  .home-dash.has-tasks .home-recent { grid-column: 2; grid-row: 2; }
}

/* ----------------------------------------------------------------------------
   Toast
   ---------------------------------------------------------------------------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translateX(-50%);
  background: var(--surface-dark); color: #fff; padding: 10px 16px; border-radius: 999px;
  font: 500 13px/1 var(--font-ui); z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; }

/* ----------------------------------------------------------------------------
   Desktop (Seitenleiste, breites Layout) – Frame 09
   ---------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .app { flex-direction: row; }
  .nav {
    position: sticky; top: 0; left: 0; right: auto; bottom: auto;
    height: 100dvh; width: 224px; flex-shrink: 0;
    display: flex; flex-direction: column;
    border-top: none; border-right: 1px solid var(--border);
    padding: 22px 14px;
  }
  .nav-brand { display: flex; align-items: center; gap: 9px; padding: 0 8px 22px; background: none; border: none; cursor: pointer; text-align: left; width: 100%; }
  .nav-brand img { width: 31px; height: 31px; }
  .nav-brand .wordmark { font-size: 15px; }
  .nav-links { display: flex; flex-direction: column; gap: 2px; }
  .nav-item {
    flex-direction: row; justify-content: flex-start; gap: 10px;
    min-height: 0; padding: 9px 10px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
    width: 100%; text-align: left;
  }
  .nav-item .ico { width: 18px; height: 18px; }
  .nav-item .lbl-count { display: inline; margin-left: auto; font: 500 11px/1 var(--font-ui); color: var(--text-secondary); }
  .nav-item[aria-current='page'] { background: #fff; color: var(--text-primary); font-weight: 600; }
  .nav-foot { display: block; margin-top: auto; }
  .nav-foot .lab { font: 500 10px/1 var(--font-ui); color: var(--text-secondary); letter-spacing: 0.08em; text-transform: uppercase; padding: 0 8px 8px; }
  .nav-foot .members { display: flex; flex-direction: column; gap: 1px; padding: 0 8px; }
  .nav-foot .member-name {
    background: none; border: none; text-align: left; padding: 3px 0;
    font: 500 13px/1.35 var(--font-ui); color: var(--text-primary); cursor: default;
  }
  .nav-foot .member-name.me { cursor: pointer; }
  .nav-foot .member-name.me:hover { color: var(--brand); }
  .nav-foot .logout { margin-top: 10px; width: 100%; text-align: left; padding: 8px; }

  .topbar { display: none; }
  .main { max-width: 1100px; margin: 0 auto; padding: 24px 28px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .view { padding: 0; }
  #toast { bottom: 24px; left: auto; right: 24px; transform: none; }

  .capture-wrap { max-width: 460px; }
}

/* ----------------------------------------------------------------------------
   Crop-Editor (Stufe A – manuelle Belegecken)
   ---------------------------------------------------------------------------- */
.crop-modal {
  position: fixed; inset: 0; z-index: 400; background: var(--bg-primary);
  display: flex; flex-direction: column;
  overscroll-behavior: contain; /* iOS: keine Navigations-/Pull-Gesten durchlassen */
}
.crop-modal.hidden { display: none; }
/* Topbar: X links · Titel mittig · Drehen rechts (Grid für exakte Zentrierung) */
.crop-top {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
}
.crop-x { background: none; border: none; cursor: pointer; width: 40px; height: 40px; font: 400 26px/1 var(--font-ui); color: var(--text-primary); display: flex; align-items: center; justify-content: center; }
.crop-title { font: 600 17px/1 var(--font-display); letter-spacing: -0.01em; text-align: center; }
.crop-rotate {
  width: 40px; height: 40px; background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-primary); display: flex; align-items: center; justify-content: center; justify-self: end;
}
.crop-rotate svg { width: 20px; height: 20px; }
.crop-rotate:hover { color: var(--brand); }
/* Der Body füllt den kompletten Platz zwischen Kopf und Buttons und zentriert den
   Editor. So bleibt kein „leerer" Bereich – der freie Raum verteilt sich um den
   Rahmen herum (App-Hintergrund), statt als große schwarze Fläche. */
/* Scan-Modus-Umschalter (Farb-Scan / Schwarz-Weiß), kompakt über dem Bild. */
.crop-scan { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px 8px; }
.crop-scan-label { font: 500 12px/1 var(--font-ui); color: var(--text-secondary); }
.crop-scan .seg { margin: 0; }
.crop-body {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 6px 10px;
}
/* Dunkler, abgerundeter Rahmen, der das Foto eng umschließt (kein großer Leerraum).
   Der 22px-Innenrand gibt den Griffen an den Bildkanten Platz (HIT_R = 22px).
   max:100% begrenzt den Rahmen sicher auf den Body (kein Überlappen der Buttons). */
.crop-stage {
  position: relative; display: flex; overflow: hidden;
  max-width: 100%; max-height: 100%;
  background: var(--surface-dark); border-radius: 14px; padding: 22px;
  touch-action: none;                      /* iOS: keine Wisch-Navigation im Bildbereich */
}
/* Foto so groß wie möglich: begrenzt durch die verfügbare Fläche (Viewport minus
   Kopf/Scan-Zeile/Buttons/Ränder). Element-Box == gerendertes Foto -> Punkte passen. */
#crop-img {
  display: block; object-fit: contain; user-select: none; -webkit-user-drag: none;
  max-width: calc(100vw - 64px);
  max-height: calc(100dvh - 264px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
#crop-overlay { position: absolute; touch-action: none; } /* exakt über dem Bild positioniert (per JS) */
@media (min-width: 768px) {
  /* Desktop: sinnvoll begrenzt (nicht überdimensioniert), Rahmen zentriert. */
  #crop-img { max-width: min(calc(100vw - 64px), 620px); max-height: calc(100dvh - 264px); }
}
.crop-foot {
  display: flex; gap: 10px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
}
.crop-foot .btn { flex: 1; height: 56px; border-radius: 14px; }
.crop-foot #crop-confirm { flex: 1.35; gap: 8px; }
.crop-foot #crop-confirm svg { width: 16px; height: 16px; }
