/* ═══════════════════════════════════════════════════════════
   RESET & VARIABLEN
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f1117;
  --surface:  #1a1d27;
  --surface2: #23263a;
  --border:   #2e3150;
  --accent:   #4f6ef7;
  --accent2:  #7c3aed;
  --green:    #22c55e;
  --red:      #ef4444;
  --yellow:   #f59e0b;
  --text:     #e8eaf0;
  --text2:    #8891aa;
  --radius:   14px;
  --shadow:   0 4px 24px rgba(0,0,0,.45);
  --header-h: 60px;
  --drawer-w: 280px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100dvh;
}

h1 { font-size: 1.15rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════
   DRAWER / SEITENMENÜ
   ═══════════════════════════════════════════════════════════ */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 390;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.drawer-overlay.open { opacity: 1; pointer-events: all; }

.drawer {
  position: fixed;
  top: 0; left: 0;
  height: 100dvh;
  width: var(--drawer-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 400;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .95rem;
  flex-shrink: 0;
}

.drawer-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  width: 30px; height: 30px;
  border-radius: 7px;
  cursor: pointer;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
}

.drawer-body {
  padding: 10px 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.drawer-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.drawer-item:hover  { background: var(--surface2); color: var(--text); }
.drawer-item.active { background: var(--accent); color: #fff; }

.drawer-item-icon { font-size: 1rem; flex-shrink: 0; }
.drawer-item-label { flex: 1; }

.drawer-section { margin-top: 4px; }

.drawer-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--text);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.drawer-section-header:hover { background: var(--surface2); }

.section-chevron {
  font-size: .72rem;
  color: var(--text2);
  transition: transform .2s;
}
.section-chevron.open { transform: rotate(180deg); }

.drawer-section-items {
  padding-left: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.drawer-section-items.collapsed { display: none; }

.drawer-sub-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px 9px 28px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: .84rem;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.drawer-sub-item:hover  { background: var(--surface2); color: var(--text); }
.drawer-sub-item.active { background: rgba(79,110,247,.18); color: var(--accent); font-weight: 600; }

.drawer-sub-amount { font-size: .8rem; color: var(--text2); font-weight: 500; }
.drawer-sub-item.active .drawer-sub-amount { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════ */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
  height: var(--header-h);
  display: flex;
  flex-direction: row;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Hamburger + Back-Button links nebeneinander */
.header-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Monat absolut zentriert – unabhängig von der Breite der Seitenelemente */
.month-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Actions auf die rechte Seite schieben */
.header-actions {
  margin-left: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Gemeinsamer Stil für Hamburger, Back-Button und Header-Actions */
.hamburger,
.back-btn,
.header-actions button,
.logout-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
}

.hamburger {
  width: 36px; height: 36px;
  font-size: 1.1rem;
}
.hamburger:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.back-btn {
  width: 36px; height: 36px;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
}
.back-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.header-actions button,
.logout-btn {
  width: 36px; height: 36px;
  font-size: 1rem;
  color: var(--text2);
}
.logout-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }

.month-nav button {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.month-nav button:hover { background: var(--accent); }

#monthLabel {
  font-size: .88rem;
  font-weight: 600;
  min-width: 110px;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════ */
.layout {
  display: flex;
  flex-direction: column;
  padding: 14px 14px 100px;
  gap: 14px;
  max-width: 640px;
  margin: 0 auto;
}

.sidebar-panel { display: flex; flex-direction: column; gap: 12px; }
.pc-actions    { display: none; }
.main-panel    { display: flex; flex-direction: column; gap: 10px; }

/* ═══════════════════════════════════════════════════════════
   BUDGET-KARTE (Sidebar Hero-Card)
   ═══════════════════════════════════════════════════════════ */
.budget-card {
  background: linear-gradient(135deg, #1e2235 0%, #16192b 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.budget-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.budget-label  { color: var(--text2); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.budget-amount { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin-top: 2px; }
.budget-spent  { font-size: .82rem; color: var(--text2); margin-top: 4px; }

.budget-edit-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: .78rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .15s;
}
.budget-edit-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.progress-wrap {
  background: var(--surface2);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}
.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: var(--green);
  transition: width .6s cubic-bezier(.4,0,.2,1), background .3s;
}
.progress-bar.warn   { background: var(--yellow); }
.progress-bar.danger { background: var(--red); }

.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box  { background: var(--surface2); border-radius: 10px; padding: 12px 14px; }
.stat-box .label { font-size: .72rem; color: var(--text2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.stat-box .value { font-size: 1.15rem; font-weight: 700; }
.stat-box .value.green { color: var(--green); }
.stat-box .value.red   { color: var(--red); }

/* ═══════════════════════════════════════════════════════════
   UPLOAD-STATUS & SPINNER
   ═══════════════════════════════════════════════════════════ */
.upload-status {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: none;
  align-items: center;
  gap: 12px;
  font-size: .88rem;
}
.upload-status.active  { display: flex; }
.upload-status.success { border-color: var(--green); color: var(--green); }
.upload-status.error   { border-color: var(--red);   color: var(--red); }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   AUSGABENLISTE (Budget-Ansicht)
   ═══════════════════════════════════════════════════════════ */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  cursor: pointer;
  user-select: none;
}
.section-header h2 { display: flex; align-items: center; gap: 8px; }
.chevron { transition: transform .25s; font-size: .8rem; color: var(--text2); }
.chevron.open { transform: rotate(180deg); }

.filter-bar { display: flex; gap: 8px; }
.filter-bar input,
.filter-bar select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .85rem;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.filter-bar input:focus,
.filter-bar select:focus  { border-color: var(--accent); }
.filter-bar input         { flex: 1; }
.filter-bar input::placeholder { color: var(--text2); }
.filter-bar select option { background: var(--surface); }

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

.expense-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color .15s;
}
.expense-item:hover { border-color: var(--accent); }

.expense-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.expense-info    { flex: 1; min-width: 0; }
.expense-desc    { font-size: .9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expense-meta    { font-size: .75rem; color: var(--text2); margin-top: 3px; }
.expense-right   { text-align: right; flex-shrink: 0; }
.expense-amount  { font-size: 1rem; font-weight: 700; }
.expense-actions { display: flex; gap: 6px; margin-top: 6px; justify-content: flex-end; }

.btn-icon {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.btn-icon:hover        { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-icon.delete:hover { background: var(--red);    color: #fff; border-color: var(--red); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text2); font-size: .9rem; }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 10px; }

.load-more-btn {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 13px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .85rem;
  transition: all .15s;
}
.load-more-btn:hover { border-color: var(--accent); color: var(--text); }

.receipt-dot { font-size: .8rem; }

/* ═══════════════════════════════════════════════════════════
   FINANZ-PANEL (Einkommen / Sparen)
   ═══════════════════════════════════════════════════════════ */
#financialPanel { display: flex; flex-direction: column; gap: 12px; }

.fin-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fin-summary-item:last-child { grid-column: 1 / -1; }
.fin-summary-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}

.fin-label { font-size: .7rem; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.fin-value { font-size: 1rem; font-weight: 700; }
.fin-value.green  { color: var(--green); }
.fin-value.red    { color: var(--red); }
.fin-value.yellow { color: var(--yellow); }

.fin-section-title {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text2);
  padding: 4px 2px;
}

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

.fin-breakdown-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color .15s;
}
.fin-breakdown-item.active { border-color: var(--accent); background: rgba(79,110,247,.07); }

.fin-breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.fin-breakdown-name            { font-size: .9rem; font-weight: 600; }
.fin-breakdown-amount          { font-size: 1rem; font-weight: 700; }
.fin-breakdown-amount.green    { color: var(--green); }

.fin-bar-wrap {
  background: var(--surface2);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.fin-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.fin-bar.green  { background: linear-gradient(90deg, #16a34a, var(--green)); }
.fin-bar.yellow { background: linear-gradient(90deg, #d97706, var(--yellow)); }

.fin-breakdown-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: .75rem;
  color: var(--text2);
}

.fin-potential-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fin-potential-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .88rem;
}
.fin-potential-row .label { color: var(--text2); }
.fin-potential-row .value { font-weight: 600; }
.fin-potential-divider { border: none; border-top: 1px solid var(--border); margin: 2px 0; }

/* ═══════════════════════════════════════════════════════════
   PLANUNGS-KARTEN & DETAIL (Sparen / Einkommen)
   ═══════════════════════════════════════════════════════════ */
.planning-card {
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.planning-card:hover  { border-color: var(--accent); }
.planning-card:active { transform: scale(.98); }

.planning-tap-hint {
  font-size: .72rem;
  color: var(--accent);
  margin-top: 8px;
  text-align: right;
  opacity: .7;
}

.planning-beschreibung {
  background: var(--surface2);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .88rem;
  line-height: 1.7;
}

.zf-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   AUSGABEN-DETAIL MODAL
   ═══════════════════════════════════════════════════════════ */
.detail-meta {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 4px;
}
.detail-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-actions { display: flex; gap: 8px; }

.receipt-text {
  background: var(--surface2);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .82rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Inter', monospace;
  max-height: 300px;
  overflow-y: auto;
}

.receipt-img-link { display: block; }
.receipt-img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-height: 280px;
  object-fit: contain;
}

/* ═══════════════════════════════════════════════════════════
   GESAMT-ÜBERSICHT
   ═══════════════════════════════════════════════════════════ */
#gesamtPanel { display: flex; flex-direction: column; gap: 12px; }

.ov-kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ov-kpi-rest { grid-column: 1 / -1; }

.ov-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}
.ov-kpi-label { font-size: .7rem; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.ov-kpi-value       { font-size: 1rem; font-weight: 700; }
.ov-kpi-value.green { color: var(--green); }
.ov-kpi-value.red   { color: var(--red); }

/* Budget-Karten in der Übersicht */
.ov-budget-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.ov-budget-card:hover  { border-color: var(--accent); transform: translateY(-1px); }
.ov-budget-card:active { transform: translateY(0); }

.ov-bc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}
.ov-bc-left         { display: flex; align-items: center; gap: 8px; }
.ov-bc-icon         { font-size: 1.15rem; }
.ov-bc-name         { font-size: .9rem; font-weight: 600; }
.ov-bc-remaining    { font-size: .85rem; font-weight: 700; white-space: nowrap; }
.ov-bc-remaining.green { color: var(--green); }
.ov-bc-remaining.red   { color: var(--red); }
.ov-bc-meta { display: flex; justify-content: space-between; font-size: .72rem; color: var(--text2); margin-top: 7px; }

/* Ausgabenliste in der Übersicht */
.ov-exp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: border-color .15s;
}
.ov-exp-item:hover { border-color: var(--accent); }

.ov-exp-icon  { font-size: 1.25rem; flex-shrink: 0; width: 28px; text-align: center; }
.ov-exp-body  { flex: 1; min-width: 0; }
.ov-exp-desc  { font-size: .88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-exp-meta  { margin-top: 3px; }
.ov-exp-right { text-align: right; flex-shrink: 0; }
.ov-exp-amount { font-size: .92rem; font-weight: 700; color: var(--red); }
.ov-exp-date   { font-size: .71rem; color: var(--text2); margin-top: 2px; }

.ov-cat-badge {
  display: inline-block;
  background: rgba(255,255,255,.07);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: .68rem;
  color: var(--text2);
  letter-spacing: .02em;
}

/* Sparziele in der Übersicht (schlicht) */
.ov-item-list    { display: flex; flex-direction: column; gap: 8px; }
.ov-list-item    { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.ov-empty        { color: var(--text2); font-size: .85rem; padding: 6px 0; }

.ov-savings-simple { display: flex; align-items: center; gap: 12px; padding: 11px 14px; }

.ov-sav-icon {
  width: 40px; height: 40px;
  background: var(--surface2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.ov-sav-info    { flex: 1; min-width: 0; }
.ov-sav-name    { font-size: .88rem; font-weight: 600; }
.ov-sav-total   { font-size: .74rem; color: var(--text2); margin-top: 2px; }
.ov-sav-monthly { font-size: .9rem; font-weight: 700; color: var(--green); white-space: nowrap; }
.ov-sav-period  { font-size: .72rem; font-weight: 400; color: var(--text2); }

/* ═══════════════════════════════════════════════════════════
   SPARZIEL-KARTEN (Sparen-Ansicht)
   ═══════════════════════════════════════════════════════════ */
.savings-goal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color .15s, transform .1s;
}
.savings-goal-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity .2s;
}
.savings-goal-card:hover        { border-color: var(--accent); }
.savings-goal-card:hover::after { opacity: 1; }
.savings-goal-card:active       { transform: scale(.98); }

.sgc-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sgc-icon {
  width: 48px; height: 48px;
  background: var(--surface2);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.sgc-info    { flex: 1; min-width: 0; }
.sgc-name    { font-size: .95rem; font-weight: 600; margin-bottom: 4px; }
.sgc-monthly { font-size: 1.1rem; font-weight: 700; color: var(--green); white-space: nowrap; }
.sgc-period  { font-size: .7rem; font-weight: 400; color: var(--text2); }

.sgc-progress-wrap {
  background: var(--surface2);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}
.sgc-progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .6s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}

.sgc-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.sgc-stat  { text-align: center; }
.sgc-stat-label { font-size: .65rem; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.sgc-stat-value { font-size: .9rem; font-weight: 700; }
.sgc-stat-value.green { color: var(--green); }

.sgc-desc {
  font-size: .78rem;
  color: var(--text2);
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════
   BUCHUNGS-LISTE (Transaktionen)
   ═══════════════════════════════════════════════════════════ */
.txn-list  { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.txn-item  { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface2); border-radius: 10px; }
.txn-icon  { font-size: 1.1rem; flex-shrink: 0; width: 24px; text-align: center; }
.txn-info  { flex: 1; min-width: 0; }
.txn-title { font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-meta  { font-size: .72rem; color: var(--text2); margin-top: 2px; }
.txn-amount { font-size: .9rem; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.txn-amount.green { color: var(--green); }
.txn-amount.red   { color: var(--red); }

/* ═══════════════════════════════════════════════════════════
   FAB (nur Mobile)
   ═══════════════════════════════════════════════════════════ */
.fab-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  z-index: 200;
}
.fab {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.45rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
  transition: transform .15s;
}
.fab:active    { transform: scale(.92); }
.fab.primary   { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.fab.secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text); }

/* ═══════════════════════════════════════════════════════════
   MODALS & FORMULARE
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px 36px;
  width: 100%;
  max-width: 600px;
  transform: translateY(40px);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .8rem; color: var(--text2); margin-bottom: 6px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group select option   { background: var(--surface2); }
.form-group textarea        { resize: vertical; min-height: 70px; font-family: inherit; }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  color: #fff;
  padding: 14px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: opacity .15s;
}
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════
   TOAST-BENACHRICHTIGUNGEN
   ═══════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: .85rem;
  box-shadow: var(--shadow);
  animation: toastIn .25s ease, toastOut .25s ease 2.5s forwards;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red);   color: var(--red); }

@keyframes toastIn  { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ═══════════════════════════════════════════════════════════
   ANIMATIONEN (Listen-Fade-In, gestaffelt)
   ═══════════════════════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Subtiler gestaffelter Auftritt für Karten in der Übersicht und Listen */
.ov-budget-card,
.ov-exp-item,
.ov-list-item,
.savings-goal-card,
.fin-breakdown-item,
.expense-item,
.txn-item {
  animation: fadeInUp .35s cubic-bezier(.4,0,.2,1) both;
}

/* Stagger über data-i / nth-child für die ersten ~10 Karten */
.ov-budget-card:nth-child(1),
.ov-exp-item:nth-child(1),
.savings-goal-card:nth-child(1) { animation-delay: .02s; }
.ov-budget-card:nth-child(2),
.ov-exp-item:nth-child(2),
.savings-goal-card:nth-child(2) { animation-delay: .06s; }
.ov-budget-card:nth-child(3),
.ov-exp-item:nth-child(3),
.savings-goal-card:nth-child(3) { animation-delay: .10s; }
.ov-budget-card:nth-child(4),
.ov-exp-item:nth-child(4),
.savings-goal-card:nth-child(4) { animation-delay: .14s; }
.ov-budget-card:nth-child(5),
.ov-exp-item:nth-child(5),
.savings-goal-card:nth-child(5) { animation-delay: .18s; }
.ov-budget-card:nth-child(6),
.ov-exp-item:nth-child(6) { animation-delay: .22s; }
.ov-budget-card:nth-child(7),
.ov-exp-item:nth-child(7) { animation-delay: .26s; }
.ov-budget-card:nth-child(n+8),
.ov-exp-item:nth-child(n+8) { animation-delay: .30s; }

/* Panel-Wechsel (Gesamt / Budget / Sparen / Einkommen) sanft einblenden */
#gesamtPanel,
#financialPanel,
.expense-list {
  animation: fadeInUp .25s ease both;
}

/* Reduce motion: alle Animationen abschalten */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   PC-LAYOUT  (ab 768 px)
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  body { padding-bottom: 0; }

  .layout {
    flex-direction: row;
    align-items: flex-start;
    max-width: 1100px;
    padding: 24px 24px 40px;
    gap: 24px;
  }

  .sidebar-panel {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-h) + 16px);
  }

  .pc-actions { display: flex; flex-direction: column; gap: 10px; }

  .btn-pc {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 13px 16px;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all .15s;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .btn-pc:hover { border-color: var(--accent); background: var(--surface2); }
  .btn-pc.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-color: transparent;
    color: #fff;
  }
  .btn-pc.primary:hover { opacity: .88; }

  .main-panel      { flex: 1; min-width: 0; }
  .fab-container   { display: none; }
  .budget-amount   { font-size: 1.7rem; }

  .modal-overlay { align-items: center; }
  .modal {
    border-radius: var(--radius);
    max-width: 480px;
    transform: translateY(20px) scale(.97);
    padding: 28px 28px 32px;
  }
  .modal-overlay.open .modal { transform: translateY(0) scale(1); }

  .expense-item { padding: 14px 18px; }
  .app-header   { padding: 0 24px; }
  #monthLabel   { min-width: 150px; font-size: 1rem; }

  .ov-kpi-row  { grid-template-columns: repeat(3, 1fr); }
  .ov-kpi-rest { grid-column: auto; }
  .ov-kpi-value { font-size: 1.1rem; }
}
