/**
 * App-Core.css v2.0 - Desktop-Styles für das Haushaltsbuch
 * 
 * Kombiniert:
 * - style.css - Basis-Styles, Variablen, Layout
 * - choices-override.css - Dropdown-Fixes
 * - micro-interactions.css - UI-Animationen (reduziert)
 * - Vollständige Desktop-Tabellen-Styles
 * - components.css - Wiederverwendbare UI-Komponenten
 * 
 * NUR DESKTOP-STYLES - Mobile-Styles sind in app-mobile.css
 */

/* ======================================== */
/* ========== CSS Custom Properties ======= */
/* ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('components.css');

:root {
  /* Moderne Farbpalette */
  --primary: #6366f1;
  --primary-light: #a5b4fc;
  --primary-dark: #4f46e5;
  
  --success: #10b981;
  --success-light: #a7f3d0;
  --success-dark: #059669;
  
  --danger: #ef4444;
  --danger-light: #fca5a5;
  --danger-dark: #dc2626;
  
  --warning: #f59e0b;
  --warning-light: #fcd34d;
  
  /* Neutrale Farben */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Semantic Colors */
  --background: var(--gray-50);
  --surface: #ffffff;
  --surface-secondary: var(--gray-100);
  --border: var(--gray-200);
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-500);
  
  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  
  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  
  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 500ms ease;
}

/* ======================================== */
/* ========== Base Styles ================= */
/* ======================================== */

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--background);
  font-weight: 400;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-6) 0;
  line-height: var(--leading-tight);
}

h1 { font-size: var(--text-3xl); font-weight: 700; }
h2 { font-size: var(--text-2xl); font-weight: 600; }
h3 { font-size: var(--text-xl); font-weight: 600; }

p {
  margin: 0 0 var(--space-4) 0;
  color: var(--text-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ======================================== */
/* ========== Layout & Cards ============== */
/* ======================================== */

/* Zentrale Content-Wrapper - Symmetrisches Layout */
.content,
main {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-6); /* Symmetrisch links/rechts */
}

.dashboard-content {
  background: var(--surface);
  padding: var(--space-8);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 480px;
  margin: var(--space-12) auto; /* Nur oben/unten Margin, horizontal auto = zentriert */
  border: 1px solid var(--border);
  transition: box-shadow var(--transition-fast);
  animation: slideIn 0.3s ease-out;
}

.dashboard-content.table-container {
  max-width: 900px;
}

.dashboard-content:hover {
  box-shadow: var(--shadow-lg);
}

.info-block {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  margin: var(--space-6) 0;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: var(--space-3);
}

.info-block span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  font-size: var(--text-sm);
}

.info-block strong {
  font-weight: 700;
  font-size: var(--text-lg);
}

.info-block hr {
  border: none;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: var(--space-2) 0;
}

/* ======================================== */
/* ========== Navigation ================== */
/* ======================================== */

.main-nav {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  padding: var(--space-4) var(--space-6);
  gap: var(--space-2);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.95);
}

.main-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* ======================================== */
/* ========== Buttons & Actions =========== */
/* ======================================== */

button, .user-btn {
  background: var(--primary);
  border: none;
  color: white;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: var(--space-3) var(--space-6);
  box-shadow: var(--shadow-sm);
  margin-top: var(--space-4);
  position: relative;
  overflow: hidden;
  text-transform: none;
  letter-spacing: 0.01em;
  min-height: 44px;
  min-width: 44px;
}

button:hover, .user-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active, .user-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button:focus,
.user-btn:focus,
.icon-btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.user-btn.danger { background: var(--danger); }
.user-btn.danger:hover { background: var(--danger-dark); }
.user-btn_red { background: var(--danger); color: white; }
.user-btn_red:hover { background: var(--danger-dark); }
.user-btn.success { background: var(--success); }
.user-btn.success:hover { background: var(--success-dark); }

.user-btn.secondary {
  background: var(--gray-100);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.user-btn.secondary:hover {
  background: var(--gray-200);
  border-color: var(--gray-300);
}

/* Icon Buttons */
.icon-btn {
  position: relative;
  transition: all var(--transition-fast);
  border-radius: 50%;
  background: transparent;
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-2);
  margin: 0;
}

.icon-btn:hover {
  background: var(--gray-100);
  transform: scale(1.05);
  box-shadow: var(--shadow);
}

.mobile-action-btn {
  position: relative;
  transition: all var(--transition-fast);
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  margin: var(--space-1);
}

.mobile-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ======================================== */
/* ========== Forms & Inputs ============== */
/* ======================================== */

.dashboard-content select,
.dashboard-content input[type="text"],
.dashboard-content input[type="number"],
.dashboard-content input[type="date"],
.dashboard-content input[type="email"],
.dashboard-content input[type="password"],
input, select, textarea {
  width: 100%;
  max-width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  box-sizing: border-box;
  margin-bottom: var(--space-4);
  transition: all var(--transition-fast);
  color: var(--text-primary);
  min-height: 44px;
}

/* Spezielle Styling für "Neues Konto" Option */
select option[value="__NEW_ACCOUNT__"] {
  background: #f8f9fa;
  color: #007bff;
  font-weight: bold;
  border-top: 1px solid #dee2e6;
}

select option[value="__NEW_ACCOUNT__"]:hover {
  background: #e9ecef;
}

.dashboard-content select:focus,
.dashboard-content input:focus,
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.dashboard-content label,
label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
}

.form-checkgroup {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}

.form-checkgroup label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  min-height: 44px;
}

.form-checkgroup input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  margin: 0;
}

/* ======================================== */
/* ========== Tables & Content ============ */
/* ======================================== */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.money-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 14px;
  table-layout: fixed;
}

.money-table th {
  background: var(--surface-secondary);
  font-weight: 600;
  color: var(--text-primary);
  padding: 12px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.money-table th:first-child {
  border-top-left-radius: 8px;
}

.money-table th:last-child {
  border-top-right-radius: 8px;
}

.money-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  background: white;
  color: var(--text-secondary);
  transition: background-color var(--transition-fast);
}

.money-table tbody tr {
  transition: all var(--transition-fast);
  position: relative;
}

.money-table tbody tr:hover {
  background: var(--surface-secondary);
}

.money-table tbody tr:last-child td {
  border-bottom: none;
}

.money-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 8px;
}

.money-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 8px;
}

.money-table td.clicked {
  background: var(--success-light);
  color: var(--success-dark);
  text-decoration: line-through;
}

/* Spalten für volle Breite */
.date-cell {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 14px;
  text-align: center;
  width: 12%;
}

.amount-cell {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  text-align: right;
  white-space: nowrap;
  width: 15%;
}

.amount-value {
  font-size: 16px;
  display: inline-block;
}

.currency {
  margin-left: 4px;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: normal;
}

.category-cell {
  vertical-align: top;
  width: 20%;
}

.category-main {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.category-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.2;
}

.description-cell {
  word-wrap: break-word;
  line-height: 1.4;
  width: 33%;
}

.fix-badge {
  display: inline-block;
  background: var(--warning);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  font-weight: 600;
  vertical-align: middle;
}

.account-cell {
  font-size: 14px;
  color: var(--text-secondary);
  word-wrap: break-word;
  width: 15%;
}

.tax-cell {
  text-align: center;
  width: 8%;
}

.file-cell {
  text-align: center;
  width: 8%;
}

.file-badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.actions-cell {
  text-align: center;
  width: 10%;
}

/* Anpassung wenn Steuer-Spalte vorhanden ist */
.money-table.has-tax-column .description-cell {
  width: 25%;
}

.money-table.has-tax-column .account-cell {
  width: 12%;
}

/* Zukünftige Einträge */
.future-entry {
  opacity: 0.7;
  position: relative;
  font-style: italic;
}

.future-entry::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--warning);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.future-entry td {
  color: var(--text-muted) !important;
  font-style: italic;
  background: rgba(245, 158, 11, 0.05) !important;
}

.future-indicator {
  margin-left: 4px;
  opacity: 0.7;
  font-size: 10px;
}

/* Action Buttons */
.action-buttons {
  display: inline-block;
  white-space: nowrap;
  text-align: center;
}

.action-btn {
  display: inline-block;
  width: 32px;
  height: 32px;
  line-height: 30px;
  text-align: center;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  margin: 0 2px;
  transition: all 0.2s ease;
  vertical-align: middle;
}

.action-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.action-btn.delete-btn:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

/* Desktop Table Display */
.hide-on-compact {
  display: table-cell;
}

.desktop-table {
  display: table;
}

.mobile-table {
  display: none;
}

/* ============================================================ */
/* ===== Polierte Tabelle (geteilt: Transaktionen / Analyse / == */
/* ===== Bulk-Edit / Steuern). Gescoped via .table-wrapper--modern */
/* ===== aus includes/table_input.php — andere .money-table   == */
/* ===== bleiben unberührt.                                   == */
/* ============================================================ */
.table-wrapper--modern {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;           /* horizontaler Scroll für breite Tabellen; volle Höhe → Seite scrollt */
  background: white;
}

/* Tabellen-Kopf modern & gedämpft. KEIN position:sticky — das würde die
   Tabelle in eine höhenbegrenzte Scroll-Box zwingen und Tage abschneiden. */
.table-wrapper--modern .money-table thead th {
  background: var(--gray-50);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: none;
  box-shadow: inset 0 -1px 0 var(--gray-200);
  padding: 10px 12px;
}

/* Zellen: Haarlinien */
.table-wrapper--modern .money-table td {
  border-bottom: 1px solid var(--gray-100);
  padding: 10px 12px;
}

/* Zebra (Tages-Gruppen ausgenommen) + Hover — auf td, da Basis td bg:white setzt */
.table-wrapper--modern .money-table tbody tr:nth-child(even):not(.day-group-row) td {
  background: #f7f8fa;
}
.table-wrapper--modern .money-table tbody tr:not(.day-group-row):hover td {
  background: #eceff4;
}

/* Beträge nach Typ einfärben (ganze Zelle; Vorzeichen erbt die Farbe) */
.table-wrapper--modern .amount-cell.is-income,
.table-wrapper--modern .mobile-amount.is-income,
.table-wrapper--modern td.is-income { color: var(--success-dark); }
.table-wrapper--modern .amount-cell.is-expense,
.table-wrapper--modern .mobile-amount.is-expense,
.table-wrapper--modern td.is-expense { color: var(--danger-dark); }
.table-wrapper--modern .amount-cell.is-transfer,
.table-wrapper--modern .mobile-amount.is-transfer,
.table-wrapper--modern td.is-transfer { color: #2563eb; }

/* Soft-Pastel-Badges (ersetzen die alten gefüllten Inline-Badges) */
.table-wrapper--modern .fix-badge,
.table-wrapper--modern .var-badge,
.table-wrapper--modern .tax-badge,
.table-wrapper--modern .tag-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.68em;
  font-weight: 600;
  vertical-align: middle;
}
.table-wrapper--modern .fix-badge { background: #d1fae5; color: #065f46; }
.table-wrapper--modern .var-badge { background: #e0e7ff; color: #4338ca; }
.table-wrapper--modern .tax-badge { background: #fef3c7; color: #92400e; }
.table-wrapper--modern .tag-badge { background: #f3f4f6; color: #4b5563; }

/* Inline-editierbare Beschreibung */
.table-wrapper--modern .inline-edit-beschreibung {
  cursor: text;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
}
.table-wrapper--modern .inline-edit-beschreibung:hover {
  background: #eef2ff;
  box-shadow: inset 0 0 0 1px #c7d2fe;
}

/* Tages-Gruppen-Zeile als „Saldo-Band" — deutlich von Buchungen abgehoben (group_by_day) */
.table-wrapper--modern .day-group-row td {
  background: #eef2f7;
  border-top: 1px solid #dfe5ee;
  border-bottom: 1px solid #dfe5ee;
  border-left: 3px solid #94a3b8;
  padding: 9px 14px;
}
.table-wrapper--modern .day-group-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.table-wrapper--modern .day-group-date {
  font-weight: 800;
  font-size: 0.68rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.table-wrapper--modern .day-group-sum {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 999px;
  padding: 3px 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.74rem;
  white-space: nowrap;
}
.table-wrapper--modern .day-group-sum-label {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: #94a3b8;
}
.table-wrapper--modern .day-group-sum.is-income { color: var(--success-dark); }
.table-wrapper--modern .day-group-sum.is-expense { color: var(--danger-dark); }

/* Moderne Filterleiste der Transaktionen-Seite */
.tx-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin: 0.25rem 0 1.5rem;
}
.tx-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.tx-filter-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.tx-filter-field select,
.tx-filter-field input {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.92rem;
  background: white;
  color: var(--text-primary);
}
.tx-filter-field select:focus,
.tx-filter-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.tx-filter-search {
  flex: 1 1 220px;
}
.tx-filter-search input {
  width: 100%;
}
.tx-filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Klickbare Zeile (Transaktionen) → zentrales Aktions-Menü */
.table-wrapper--modern tr.js-row-action {
  cursor: pointer;
}
.table-wrapper--modern tr.js-row-action:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

/* Aktions-Menü (selbst-enthalten, global geladen) */
.row-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.row-menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}
.row-menu {
  position: relative;
  z-index: 1;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 360px;
  overflow: hidden;
}
.row-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--gray-200);
}
.row-menu-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-menu-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.25rem;
}
.row-menu-close:hover {
  color: var(--text-primary);
}
.row-menu-list {
  display: flex;
  flex-direction: column;
  padding: 0.4rem;
}
.row-menu-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.row-menu-item:hover {
  background: var(--gray-100);
}
.row-menu-item .icon {
  flex: 0 0 1.5rem;
  text-align: center;
  font-size: 1.1rem;
}
.row-menu-item .label {
  flex: 1 1 auto;
}
.row-menu-item.is-danger {
  color: var(--danger-dark);
}
.row-menu-item.is-danger:hover {
  background: #fee2e2;
}
/* Cashflow-Menü: „Kredit-Verknüpfung trennen"-Eintrag grün (Parität zur Fixkosten-Optik) */
.row-menu-item.is-linked .label {
  color: var(--success-dark);
}

/* ── Konto-Chip-Picker (/haushaltsbuch): häufige Konten als Chips + Suche ──── */
/* Verstecktes <select> bleibt Datenhalter — sichtbar versteckt (nicht display:none,
   damit kein Fokus-/Constraint-Validation-Problem entsteht). */
.acct-select-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.account-chip-picker {
  margin-bottom: 6px;
}
.acp-sub {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--gray-400);
  margin: 12px 0 8px;
}
.acp-sub:first-child {
  margin-top: 0;
}
.acp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.acct-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--gray-300);
  background: #fff;
  color: var(--gray-700);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}
.acct-chip:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}
.acct-chip .star {
  color: #f59e0b;
  font-size: 12px;
}
.acct-chip.is-selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.4);
}
.acct-chip.is-selected .star {
  color: #fde68a;
}
.acct-chip.muted {
  background: var(--gray-50);
  border-color: var(--gray-200);
  color: var(--gray-600);
  font-weight: 400;
}
.acct-chip.acct-add {
  border-style: dashed;
  color: var(--primary-dark);
  border-color: var(--primary);
  background: #fff;
}
.acct-chip.is-hidden {
  display: none;
}
.acp-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--gray-300);
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.acp-more .cnt {
  background: var(--gray-200);
  color: var(--gray-700);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
}
.acp-more .caret {
  transition: transform 0.15s;
}
.account-chip-picker.is-open .acp-more .caret {
  transform: rotate(180deg);
}
.acp-panel {
  display: none;
  margin-top: 10px;
}
.account-chip-picker.is-open .acp-panel {
  display: block;
}
.acp-search {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 10px;
}
.acp-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.acp-empty {
  font-size: 13px;
  color: var(--gray-400);
  padding: 4px 2px;
}

/* ── Template-Palette (/haushaltsbuch + /transactions): eingeklappt + suchbar ── */
/* In der Buchungsliste steht die Palette als eigener Block über dem Filter. */
.template-palette {
  margin-bottom: 18px;
}
.tpl-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px dashed var(--gray-300);
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.tpl-trigger:hover {
  /* background/transform/box-shadow explizit zurücksetzen: die generische Regel
     `button:hover` färbt den Chip sonst in --primary-dark — dieselbe Farbe, die
     hier der Text bekommt, der Trigger-Text wird beim Drüberfahren unsichtbar. */
  background: var(--gray-100);
  border-color: var(--primary);
  color: var(--primary-dark);
  transform: none;
  box-shadow: none;
}
.tpl-trigger .caret {
  color: var(--gray-400);
  transition: transform 0.15s;
}
.template-palette.is-open .tpl-trigger .caret {
  transform: rotate(180deg);
}
.tpl-panel {
  display: none;
  margin-top: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 12px 14px;
  /* Deckel + eigener Scroll-Kontext: sonst wächst die Liste bei vielen Vorlagen über
     den Bildschirm und die sticky Sammel-Leiste unten hat nichts, woran sie klebt. */
  max-height: 70vh;
  overflow-y: auto;
}
.template-palette.is-open .tpl-panel {
  display: block;
}
.tpl-search {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 12px;
}
.tpl-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.tpl-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--gray-400);
  margin: 6px 2px;
}
.tpl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.tpl-row:hover {
  background: var(--gray-50);
}
.tpl-ic {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex: 0 0 30px;
}
.tpl-ic.ic-exp { background: #fee2e2; }
.tpl-ic.ic-inc { background: #d1fae5; }
.tpl-ic.ic-tr { background: #dbeafe; }
.tpl-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.tpl-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-meta {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-meta .pill {
  display: inline-block;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 6px;
  padding: 0 6px;
  font-size: 11px;
  margin-left: 4px;
}
.tpl-amt {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}
.tpl-amt.amt-pos { color: var(--success-dark); }
.tpl-amt.amt-neg { color: var(--danger-dark); }
.tpl-amt.amt-tr { color: #2563eb; }
.tpl-divider {
  height: 1px;
  background: var(--gray-100);
  margin: 8px 0;
}
.tpl-cleanup {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--gray-500);
}
.tpl-cleanup a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
}
.tpl-row.is-hidden {
  display: none;
}
.tpl-empty {
  font-size: 13px;
  color: var(--gray-400);
  padding: 6px 2px;
}

/* Mehrfachauswahl: Checkbox links je Zeile + Sammelbuchungs-Leiste */
.tpl-row-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
}
.tpl-row-wrap.is-selected {
  background: var(--primary-light);
}
.tpl-row-wrap.is-hidden {
  display: none;
}
.tpl-row-wrap .tpl-row {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}
.tpl-check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0 2px 0 4px;
  cursor: pointer;
  accent-color: var(--primary);
}
/* Buchungsdatum der Sammelbuchung — nur da, wo kein #datum-Feld existiert. */
.tpl-datumzeile {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.tpl-datumzeile label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  margin: 0;
  white-space: nowrap;
}
.tpl-datumzeile input[type="date"] {
  width: auto;
  min-width: 160px;
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
}
.tpl-batchbar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 4px 4px;
  background: #fff;
  border-top: 1px solid var(--gray-200);
}
.tpl-batchbar[hidden] {
  display: none;
}
.tpl-batchcount {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}
.tpl-bookbtn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tpl-bookbtn:hover {
  background: var(--primary-dark);
}
.tpl-bookbtn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ── Typ-Segmented-Control (/haushaltsbuch): Ausgabe/Einnahme/Umbuchung anklicken ── */
.typ-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
}
.typ-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 10px;
  border-radius: var(--radius);
  border: 1.5px solid var(--gray-200);
  background: #fff;
  color: var(--gray-600);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.typ-opt:hover {
  border-color: var(--gray-300);
}
.typ-opt[data-value="Ausgabe"].is-selected {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}
.typ-opt[data-value="Einnahme"].is-selected {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #047857;
}
.typ-opt[data-value="Umbuchung"].is-selected {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.typ-opt:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
@media (max-width: 420px) {
  .typ-opt { padding: 10px 6px; font-size: 13px; gap: 5px; }
}

/* ── Flag-Toggles (Steuern/Fix/Template) + dynamische Steuer-Unterkategorie-Chips ── */
.flag-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 4px;
}
.flag-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.flag-chip:hover {
  border-color: var(--gray-300);
}
.flag-chip .chk {
  font-size: 12px;
  opacity: 0;
}
.flag-chip.is-on .chk {
  opacity: 1;
}
.flag-chip.is-on[data-on="tax"] {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}
.flag-chip.is-on[data-on="fix"] {
  background: #e0e7ff;
  border-color: #a5b4fc;
  color: #4338ca;
}
.flag-chip.is-on[data-on="tpl"] {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.flag-chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
/* Unterkategorie-Chips reuse-n .acct-chip (siehe Konto-Chip-Picker) */
.steuer-unter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

/* Absetzbare-Ausgabe-Box (Steuerersparnis) im Buchungsformular */
.steuer-absetzbar-box {
  margin-bottom: 15px;
  padding: 12px 14px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #065f46;
}

/* ======================================== */
/* ========== Error/Success Messages ====== */
/* ======================================== */

.error-box, .success-box {
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-lg);
  margin: var(--space-4) 0;
  font-weight: 500;
  position: relative;
  box-shadow: var(--shadow);
}

.error-box {
  background: var(--danger-light);
  color: var(--danger-dark);
  border: 1px solid var(--danger);
}

.success-box {
  background: var(--success-light);
  color: var(--success-dark);
  border: 1px solid var(--success);
}

/* ======================================== */
/* ========== Choices.js Overrides ======== */
/* ======================================== */

.choices {
  position: relative;
  z-index: 10;
}

.choices__inner {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-base);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4);
  transition: all var(--transition-fast);
  box-shadow: none;
  min-height: 44px;
  position: relative;
  z-index: 1;
}

.choices__inner:focus,
.choices.is-focused .choices__inner {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  outline: none;
}

.choices__list--dropdown {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  background: white !important;
  border: 1px solid var(--border) !important;
  border-top: none !important;
  border-radius: 0 0 var(--radius) var(--radius) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  z-index: 9999 !important;
  max-height: 200px !important;
  overflow-y: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  transform: none !important;
  margin-top: 0 !important;
  min-width: 100% !important;
}

.choices__list--dropdown.is-active {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 9999 !important;
}

.choices__item--choice {
  background: white !important;
  color: var(--text-primary) !important;
  padding: var(--space-3) var(--space-4) !important;
  border-bottom: 1px solid var(--border) !important;
  transition: background-color var(--transition-fast) !important;
  cursor: pointer !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
  position: relative !important;
  z-index: 1 !important;
}

.choices__item--choice:hover,
.choices__item--choice.is-highlighted {
  background: var(--surface-secondary) !important;
  color: var(--text-primary) !important;
}

.choices__item--choice:last-child {
  border-bottom: none !important;
  border-radius: 0 0 var(--radius) var(--radius) !important;
}

.choices__input {
  background: white !important;
  color: var(--text-primary) !important;
  border: none !important;
  padding: var(--space-2) var(--space-3) !important;
  font-size: var(--text-sm) !important;
  outline: none !important;
  position: relative !important;
  z-index: 1 !important;
}

.choices__placeholder {
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

.choices.is-open {
  z-index: 9999 !important;
}

.js-konto.choices,
.js-konto-von.choices,
.js-konto-zu.choices {
  z-index: 20 !important;
}

.js-konto.choices.is-open,
.js-konto-von.choices.is-open,
.js-konto-zu.choices.is-open {
  z-index: 9999 !important;
}

.dashboard-content .choices__list--dropdown {
  z-index: 9999 !important;
}

/* ======================================== */
/* ========== Animations & Keyframes ====== */
/* ======================================== */

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ======================================== */
/* ========== Settings & Accessibility ==== */
/* ======================================== */

.settings-button-group {
  display: flex;
  flex-direction: row;
  gap: var(--space-4);
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
}

/* Desktop größere Bildschirme */
@media (min-width: 1024px) {
  .dashboard-content {
    padding: var(--space-10);
  }
  
  .dashboard-content.table-container {
    max-width: 900px; 
  }
  
  .money-table th,
  .money-table td {
    padding: var(--space-4) var(--space-6);
  }
  
  .settings-button-group {
    justify-content: flex-start;
  }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
  :root {
    --border: #000000;
    --text-secondary: #000000;
  }
  
  button, .user-btn {
    border: 2px solid;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Analysis-spezifische Spaltenbreiten für bessere Platzverteilung */
.analysis-table .date-cell {
  width: 80px;
  min-width: 80px;
}

.analysis-table .amount-cell {
  width: 100px;
  min-width: 100px;
  text-align: right;
}

.analysis-table .category-cell {
  width: 20%;
  min-width: 150px;
}

.analysis-table .description-cell {
  width: auto;
  min-width: 200px;
}

.analysis-table .account-cell {
  width: 15%;
  min-width: 120px;
}

/* ======================================== */
/* ========== Journal Styles ============== */
/* ======================================== */

.nav-button.success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.nav-button.success:hover {
  background: linear-gradient(135deg, #059669 0%, var(--success) 100%);
}

.success-message {
  background: var(--success-light);
  color: var(--success-dark);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  border: 1px solid var(--success);
  text-align: center;
  font-weight: 500;
}

.error-message {
  background: var(--danger-light);
  color: var(--danger-dark);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  border: 1px solid var(--danger);
  text-align: center;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  
  .emotion-selector {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .checkbox-group {
    grid-template-columns: 1fr;
  }
  
  .date-navigation,
  .week-navigation {
    flex-direction: column;
    gap: var(--space-3);
    text-align: center;
  }
  
}

/* ======================================== */
/* ========== Fixkosten-Verwaltung ======== */
/* ======================================== */

/* Alte Fixkosten-Klassen entfernt - nicht mehr benötigt */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

/* Einklappbare Form-Sektion (HTML <details>) */
.form-collapsible {
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-secondary, rgba(0, 0, 0, 0.02));
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.form-collapsible[open] {
    padding-bottom: var(--space-4);
}

.form-collapsible > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    padding: var(--space-1) 0;
}

.form-collapsible > summary::-webkit-details-marker {
    display: none;
}

.form-collapsible > summary::before {
    content: '▸';
    display: inline-block;
    margin-right: var(--space-2);
    transition: transform var(--transition-fast);
    color: var(--text-secondary);
}

.form-collapsible[open] > summary::before {
    transform: rotate(90deg);
}

/* Sub-Modul-Kacheln (z. B. Immobilien/Krypto auf der Vermögen-Seite) */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.module-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-5) var(--space-6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.module-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.module-card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.module-card-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ======================================== */
/* ===== Kurzfristige Verbindlichkeiten == */
/* ======================================== */

.debt-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.debt-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--gray-50);
    border-left: 4px solid var(--gray-300);
    transition: transform 0.15s, box-shadow 0.15s;
}

.debt-item:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.debt-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.debt-item.debt-overdue {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.debt-item.debt-soon {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.debt-item.debt-ok {
    border-left-color: #10b981;
}

.debt-overdue-text {
    color: #dc3545;
    font-weight: 600;
}

.debt-soon-text {
    color: #f59e0b;
    font-weight: 600;
}

.debt-ok-text {
    color: #6b7280;
}

.mark-paid-btn {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 6px;
    background: #dc3545;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

.mark-paid-btn:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

.direction-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.direction-badge.direction-owed {
    background: #d1fae5;
    color: #065f46;
}

/* ── Privatdarlehen & kurzfristige Posten: ruhigere Darstellung ──────────────
   Vorher lagen Betrag (1.1rem), Stift-Button, Konto-Auswahl und „Bezahlt" in einer
   Zeile, die nicht umbrechen konnte: Auf dem Handy lief der Button aus der Karte und
   der Betrag brach hinter dem €-Zeichen um. Jetzt umbruchfähig, mit Beträgen, die
   nicht mehr größer sind als die Zeile darüber. */
.debt-item-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.debt-amount {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;   /* „5.000,00" und „€" gehören zusammen */
}

.debt-amount-owe  { color: var(--danger-dark, #b91c1c); }
.debt-amount-owed { color: var(--success-dark, #15803d); }

.debt-pay-form {
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

/* Zwei Klassen im Selektor: Die globale Formular-Regel `.dashboard-content select`
   (weiter oben) setzt width/max-width/font-size und hat Spezifität (0,1,1) — eine
   einzelne Klasse verliert dagegen. Vorher standen diese Maße als Inline-Style am
   Element und gewannen deshalb; beim Verschieben in eine Klasse muss die Spezifität
   mitkommen, sonst wird der Select unversehens 100 % breit. */
.debt-pay-form .debt-konto-select {
    width: auto;
    max-width: 150px;
    font-size: 12px;
    padding: 4px 6px;
    min-height: 0;
    margin-bottom: 0;
}

.mark-paid-btn-received {
    background: #28a745;
}

.mark-paid-btn-received:hover {
    background: #1e7e34;
}

/* Summen im Kartenkopf: zwei ruhige Chips statt zweier kräftig gefüllter Blöcke.
   Die Zahl trägt die Aussage, nicht die Farbfläche. */
.debt-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.debt-total {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.debt-total strong {
    font-variant-numeric: tabular-nums;
}

.debt-total-owe {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.debt-total-owed {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

@media (max-width: 768px) {
    .debt-item-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Die Aktionszeile bekommt die volle Kartenbreite: Betrag links, Stift rechts,
       darunter Konto-Auswahl und Bezahlt-Button nebeneinander. */
    .debt-item-actions {
        width: 100%;
    }

    .debt-item-actions .debt-amount {
        flex: 1 1 auto;
    }

    /* Konto-Auswahl und Aktions-Button teilen sich EINE Zeile. `nowrap` ist hier
       entscheidend: Beim Umbruch entscheidet Flex anhand der Inhaltsbreite, und der
       längste Kontoname im Select ist breit genug, um den Button in die nächste Zeile
       zu drängen — die Karte wurde dadurch unnötig hoch. Ohne Umbruch schrumpft der
       Select stattdessen (dafür `min-width: 0`) und beide bleiben nebeneinander. */
    .debt-pay-form {
        flex: 1 1 100%;
        flex-wrap: nowrap;
    }

    .debt-pay-form .debt-konto-select {
        flex: 1 1 auto;
        width: auto;
        max-width: none;
        min-width: 0;
        min-height: 38px;
    }

    .debt-pay-form .mark-paid-btn {
        flex: 0 0 auto;
        min-height: 38px;
    }

    /* Kartenkopf stapeln: Titel über die volle Breite, Summen-Chips darunter.
       Nebeneinander blieb dem Titel eine Restspalte, in der ihn die globale
       `hyphens: auto`-Regel zersägte („Offene Pri-vatdarlehen"). */
    .card-header:has(.debt-totals) {
        display: block;
    }

    .card-header:has(.debt-totals) .debt-totals {
        margin-top: 0.5rem;
    }
}

/* Kartenüberschriften nie silbentrennen — zwei Klassen im Selektor, weil
   app-mobile.css `hyphens: auto !important` auf Überschriften legt und später lädt. */
.card .card-header .card-title {
    hyphens: manual !important;
    -webkit-hyphens: manual !important;
}

/* ======================================== */
/* ========== Bulk Edit Checkboxes ======= */
/* ======================================== */

.transaction-checkbox {
    transform: scale(1.5);
    margin: 0.5rem;
    cursor: pointer;
}

.transaction-checkbox:hover {
    transform: scale(1.7);
    transition: transform 0.2s ease;
}

/* Select-all checkbox auch vergrößern */
#select-all {
    transform: scale(1.3);
    margin-right: 0.75rem;
    cursor: pointer;
}

#select-all:hover {
    transform: scale(1.5);
    transition: transform 0.2s ease;
}