/* ============================================
   BudgetTracker - Dark Theme Stylesheet
   ============================================ */

/* CSS Variables – Dark Mode */
:root {
  --primary: #818cf8;
  --primary-dark: #6366f1;
  --primary-light: rgba(99,102,241,0.15);
  --success: #34d399;
  --success-light: rgba(52,211,153,0.15);
  --danger: #f87171;
  --danger-light: rgba(248,113,113,0.15);
  --warning: #fbbf24;
  --warning-light: rgba(251,191,36,0.15);

  /* Dark grays – background layers */
  --gray-50:  #0f1117;
  --gray-100: #161b27;
  --gray-200: #1e2535;
  --gray-300: #2a3347;
  --gray-400: #4a5568;
  --gray-500: #718096;
  --gray-600: #a0aec0;
  --gray-700: #cbd5e0;
  --gray-800: #e2e8f0;
  --gray-900: #f7fafc;

  --bg-base:    #0f1117;
  --bg-card:    #161b27;
  --bg-elevated:#1e2535;
  --border:     #2a3347;

  --sidebar-width: 240px;
  --header-height: 60px;
  --bottom-nav-height: 65px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.5), 0 4px 10px rgba(0,0,0,0.4);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================
   LAYOUT
   ============================================ */

.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding-bottom: var(--bottom-nav-height);
}

.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.user-avatar {
  width: 30px; height: 30px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.sidebar-nav {
  list-style: none;
  padding: 0.75rem 0;
  flex: 1;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  color: var(--gray-600);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin: 0 0.5rem;
  transition: all 0.15s;
}

.sidebar-nav li a:hover {
  background: var(--bg-elevated);
  color: var(--gray-800);
}

.sidebar-nav li a.active {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-nav li a svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  color: var(--gray-500);
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  width: 100%;
}

.logout-btn:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.logout-btn svg { width: 18px; height: 18px; }

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

.sidebar-overlay.active { display: block; }

/* ============================================
   MOBILE HEADER
   ============================================ */

.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 98;
}

.mobile-logo {
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
}

.menu-toggle, .mobile-logout {
  background: none;
  border: none;
  padding: 0.4rem;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
}

.menu-toggle svg, .mobile-logout svg { width: 22px; height: 22px; }

/* ============================================
   BOTTOM NAVIGATION (Mobile)
   ============================================ */

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 98;
  padding: 0 0.5rem;
  align-items: center;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0.4rem 0.75rem;
  color: var(--gray-400);
  font-size: 0.65rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
  min-width: 50px;
}

.bottom-nav-item svg { width: 20px; height: 20px; }

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item.add-btn {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 50px; height: 50px;
  padding: 0;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.bottom-nav-item.add-btn span { display: none; }
.bottom-nav-item.add-btn svg { width: 24px; height: 24px; }

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.month-nav, .year-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
}

.month-label, .year-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-700);
  padding: 0 0.5rem;
  min-width: 120px;
  text-align: center;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.card--info {
  border-color: rgba(129,140,248,0.3);
  background: rgba(99,102,241,0.05);
}

.card--info p {
  padding: 0 1.25rem 0.5rem;
  font-size: 0.9rem;
  color: var(--gray-600);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title svg { width: 16px; height: 16px; }

/* ============================================
   STATS GRID
   ============================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stats-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.stats-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }

.stat-card--expense .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-card--income  .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card--positive .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card--negative .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-card--neutral  .stat-icon { background: var(--primary-light); color: var(--primary); }

.stat-content { flex: 1; min-width: 0; }

.stat-label {
  font-size: 0.78rem;
  color: var(--gray-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-change {
  font-size: 0.75rem;
  margin-top: 0.2rem;
  font-weight: 500;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* ============================================
   CHARTS
   ============================================ */

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.chart-container {
  padding: 1rem 1.25rem 1.25rem;
  height: 220px;
  position: relative;
}

.chart-container--donut {
  height: 180px;
}

.chart-container--tall {
  height: 280px;
}

.chart-legend {
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  flex: 1;
  color: var(--gray-600);
}

.legend-value {
  font-weight: 600;
  color: var(--gray-800);
}

/* ============================================
   TRANSACTION LIST
   ============================================ */

.transaction-list { padding: 0.5rem 0; }

.transaction-list--full { padding: 0; }

.date-separator {
  padding: 0.5rem 1.25rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}

.transaction-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.transaction-item:last-child { border-bottom: none; }
.transaction-item:hover { background: var(--bg-elevated); }

.transaction-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.transaction-icon svg { width: 18px; height: 18px; }

.transaction-details { flex: 1; min-width: 0; }

.transaction-desc {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transaction-meta {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.transaction-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  flex-shrink: 0;
}

.transaction-amount {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.transaction-amount.expense { color: var(--danger); }
.transaction-amount.income  { color: var(--success); }

.transaction-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.transaction-item:hover .transaction-actions { opacity: 1; }

.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
}

.payment-badge { font-size: 0.8rem; }
.note-indicator { cursor: help; }

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
  cursor: pointer;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--bg-elevated); }

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-full { width: 100%; justify-content: center; }

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  color: var(--gray-400);
  transition: all 0.15s;
}

.action-btn:hover { background: var(--bg-elevated); color: var(--gray-700); }
.action-btn--danger:hover { background: var(--danger-light); color: var(--danger); }
.action-btn svg { width: 14px; height: 14px; }

/* ============================================
   FORMS
   ============================================ */

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--gray-800);
  background: var(--bg-elevated);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.form-group textarea { resize: vertical; min-height: 70px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group--action {
  display: flex;
  align-items: flex-end;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 0.5rem;
}

.transaction-form { padding: 1.25rem; }

/* Type Toggle */
.type-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: var(--bg-elevated);
  padding: 0.3rem;
  border-radius: var(--radius);
}

.type-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-500);
  transition: all 0.15s;
}

.type-option input { display: none; }
.type-option svg { width: 18px; height: 18px; }

.type-option.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow);
}

/* Amount Input */
.amount-input-wrapper {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  transition: border-color 0.15s;
}

.amount-input-wrapper:focus-within {
  border-color: var(--primary);
  background: var(--bg-elevated);
}

.currency-symbol {
  font-size: 1.75rem;
  font-weight: 300;
  color: var(--gray-400);
  margin-right: 0.5rem;
}

.amount-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  font-size: 2rem !important;
  font-weight: 700 !important;
  color: var(--gray-900) !important;
  padding: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Spinner-Pfeile bei number input entfernen */
.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount-input[type=number] { -moz-appearance: textfield; }

.color-picker {
  width: 100% !important;
  height: 42px !important;
  padding: 0.2rem !important;
  cursor: pointer;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  flex-wrap: wrap;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; }

.alert-success {
  background: var(--success-light);
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-error {
  background: var(--danger-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ============================================
   PROGRESS BARS
   ============================================ */

.progress-bar {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  flex: 1;
}

.progress-bar--lg { height: 12px; }

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

.progress-fill.warning { background: var(--warning) !important; }
.progress-fill.danger  { background: var(--danger)  !important; }

/* ============================================
   BUDGET COMPONENTS
   ============================================ */

.budget-list { padding: 0.75rem 1.25rem; }

.budget-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.budget-item:last-child { border-bottom: none; }

.budget-info {
  display: flex;
  flex-direction: column;
  min-width: 140px;
}

.budget-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
}

.budget-amounts {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.budget-pct {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
  min-width: 35px;
  text-align: right;
}

/* Budget Detail */
.budget-detail-list { padding: 0.5rem 0; }

.budget-detail-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.budget-detail-item:last-child { border-bottom: none; }

.budget-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.budget-detail-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  color: var(--gray-800);
}

.budget-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.budget-icon svg { width: 16px; height: 16px; }

.budget-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.budget-status {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.budget-status--ok      { background: var(--success-light); color: #166534; }
.budget-status--warning { background: var(--warning-light); color: #92400e; }
.budget-status--danger  { background: var(--danger-light);  color: #991b1b; }

.budget-detail-footer {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--gray-500);
  flex-wrap: wrap;
}

.budget-detail-footer strong { color: var(--gray-800); }
.budget-remaining.positive { color: var(--success); }
.budget-remaining.negative { color: var(--danger); }

.budget-form { padding: 1.25rem; }

/* ============================================
   FILTER & SUMMARY
   ============================================ */

.filter-card { margin-bottom: 1rem; }

.filter-form { padding: 1rem 1.25rem; }

.filter-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-row .form-group {
  flex: 1;
  min-width: 120px;
  margin-bottom: 0;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.summary-bar {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.summary-label { color: var(--gray-500); }

.summary-value {
  font-weight: 700;
}

.summary-value.expense { color: var(--danger); }
.summary-value.income  { color: var(--success); }

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.page-info {
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* ============================================
   CATEGORIES
   ============================================ */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  padding: 1rem 1.25rem;
}

.category-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  transition: box-shadow 0.15s;
}

.category-card:hover { box-shadow: var(--shadow-md); }

.category-card-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.category-card-icon svg { width: 18px; height: 18px; }

.category-card-info { flex: 1; min-width: 0; }

.category-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-card-count {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.1rem;
}

.category-card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.color-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-form { padding: 1.25rem; }

/* ============================================
   ANALYTICS
   ============================================ */

.category-bars { padding: 1rem 1.25rem; }

.category-bar-item { margin-bottom: 1rem; }
.category-bar-item:last-child { margin-bottom: 0; }

.category-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}

.category-bar-count {
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-top: 0.2rem;
}

.payment-list { padding: 0.5rem 1.25rem 1rem; }

.payment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.payment-item:last-child { border-bottom: none; }
.payment-item span:last-child { font-weight: 600; color: var(--gray-700); }

/* ============================================
   SETTINGS / PROFILE
   ============================================ */

.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.profile-avatar {
  width: 56px; height: 56px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.profile-since {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 0.15rem;
}

.card > form { padding: 1.25rem; }

.stats-simple { padding: 0.5rem 0; }

.stats-simple-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.stats-simple-item:last-child { border-bottom: none; }
.stats-simple-label { color: var(--gray-500); }
.stats-simple-value { font-weight: 600; color: var(--gray-800); }

/* ============================================
   BADGE
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.4rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  color: var(--gray-400);
  gap: 0.75rem;
  text-align: center;
}

.empty-state svg { width: 40px; height: 40px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }
.empty-hint { font-size: 0.8rem !important; color: var(--gray-300); }

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
  background: linear-gradient(135deg, #1a1f35 0%, #0f1117 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  border: 1px solid var(--border);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-icon { font-size: 3rem; margin-bottom: 0.5rem; }

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.login-logo p { font-size: 0.875rem; color: var(--gray-400); }

.login-form .form-group { margin-bottom: 1.25rem; }

.login-form .btn-full {
  margin-top: 0.5rem;
  padding: 0.75rem;
  font-size: 1rem;
}

/* ============================================
   RESPONSIVE – TABLET
   ============================================ */

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
}

/* ============================================
   RESPONSIVE – MOBILE
   ============================================ */

@media (max-width: 768px) {
  .main-wrapper {
    margin-left: 0;
    padding-top: var(--header-height);
    padding-bottom: calc(var(--bottom-nav-height) + 0.5rem);
  }

  .main-content { padding: 1rem; }

  .mobile-header { display: flex; }
  .bottom-nav    { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }

  .sidebar.open { transform: translateX(0); }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .stat-value { font-size: 1.1rem; }
  .charts-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 1.2rem; }
  .form-row { grid-template-columns: 1fr; }
  .filter-row .form-group { min-width: 100%; }
  .transaction-actions { opacity: 1; }
  .budget-detail-footer { gap: 0.75rem; }
  .summary-bar { gap: 0.75rem; }
  .amount-input { font-size: 1.5rem !important; }
  .currency-symbol { font-size: 1.4rem; }
  .category-grid { grid-template-columns: 1fr 1fr; }
  .month-label { min-width: 90px; font-size: 0.8rem; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .stat-card { padding: 0.875rem; }
  .stat-icon { width: 36px; height: 36px; }
  .stat-value { font-size: 1rem; }
  .category-grid { grid-template-columns: 1fr; }
  .main-content { padding: 0.75rem; }
}

/* ============================================
   STREAK WIDGET
   ============================================ */

.streak-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.streak-flame { font-size: 2rem; flex-shrink: 0; }

.streak-content { flex: 1; min-width: 0; }

.streak-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.streak-label {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-top: 0.2rem;
}

.streak-dots {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-shrink: 0;
}

.streak-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  transition: transform 0.15s;
}

.streak-dot.ok       { background: var(--success); }
.streak-dot.miss     { background: var(--danger); opacity: 0.7; }
.streak-dot.today    { background: var(--primary); box-shadow: 0 0 0 3px rgba(129,140,248,0.3); }
.streak-dot.inactive { background: var(--border); }

/* ============================================
   ANALYTICS – TRENDS & HEATMAP
   ============================================ */

.trend-chart-container {
  height: 260px;
  padding: 1rem 1.25rem;
}

.trend-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.trend-legend-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.trend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.trend-name { flex: 1; color: var(--gray-700); font-weight: 500; }

.trend-arrow {
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 60px;
}

.trend-arrow.up   { color: var(--danger); }
.trend-arrow.down { color: var(--success); }
.trend-arrow.flat { color: var(--gray-500); }

.trend-last {
  font-weight: 600;
  color: var(--gray-800);
  min-width: 80px;
  text-align: right;
}

/* Treemap */
.treemap-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 1.25rem;
  align-items: flex-end;
}

.treemap-cell {
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}

.treemap-cell:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 2;
}

/* 4 Größen */
.treemap-size-1 { width: 32px;  height: 32px; }
.treemap-size-2 { width: 48px;  height: 48px; }
.treemap-size-3 { width: 64px;  height: 64px; }
.treemap-size-4 { width: 80px;  height: 80px; }

.treemap-day {
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  line-height: 1;
}

.treemap-amount {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.treemap-today {
  box-shadow: 0 0 0 2px var(--primary), 0 0 12px rgba(129,140,248,0.4);
}

.treemap-future {
  opacity: 0.25;
}

.treemap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 1.25rem 1rem;
  justify-content: flex-end;
}

/* ============================================
   MONATSABSCHLUSS
   ============================================ */

.summary-hero {
  background: linear-gradient(135deg, rgba(129,140,248,0.15) 0%, rgba(248,113,113,0.1) 100%);
  border: 1px solid rgba(129,140,248,0.2);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

.summary-hero-month {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
  margin-bottom: 0.4rem;
}

.summary-hero-amount {
  font-size: 3rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.summary-hero-sub {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.summary-budget-body { padding: 1rem 1.25rem 1.25rem; }

.summary-budget-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.budget-pct-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-700);
  min-width: 40px;
  text-align: right;
}

.summary-budget-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.summary-budget-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.summary-budget-stat .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  font-weight: 600;
}

.summary-budget-stat .value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
}

.summary-top3 { padding: 0.5rem 0; }

.summary-top3-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.summary-top3-item:last-child { border-bottom: none; }

.summary-top3-rank {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gray-300);
  min-width: 24px;
  text-align: center;
}

.summary-top3-item:nth-child(1) .summary-top3-rank { color: #fbbf24; }
.summary-top3-item:nth-child(2) .summary-top3-rank { color: var(--gray-500); }
.summary-top3-item:nth-child(3) .summary-top3-rank { color: #92400e; }

.summary-top3-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-top3-icon svg { width: 18px; height: 18px; }

.summary-top3-info { flex: 1; min-width: 0; }

.summary-top3-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-800);
}

.summary-top3-count {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 0.15rem;
}

.summary-top3-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--danger);
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .summary-budget-stats { grid-template-columns: repeat(2, 1fr); }
  .streak-dots { display: none; }
  .summary-hero-amount { font-size: 2.25rem; }
}

/* ============================================
   VAULT
   ============================================ */

.vault-hero {
  background: linear-gradient(135deg, rgba(52,211,153,0.12) 0%, rgba(129,140,248,0.12) 100%);
  border: 1px solid rgba(52,211,153,0.25);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.vault-hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem;
  text-align: center;
}

.vault-icon-big {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.vault-hero-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  margin-bottom: 0.4rem;
}

.vault-hero-amount {
  font-size: 2.75rem;
  font-weight: 800;
  color: #34d399;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.vault-hero-amount.negative { color: var(--danger); }

.vault-hero-sub {
  font-size: 0.82rem;
  color: var(--gray-500);
}

/* Monthly list */
.vault-month-list { padding: 0.25rem 0; }

.vault-month-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.vault-month-item:last-child { border-bottom: none; }
.vault-month-item:hover { background: var(--bg-elevated); }

.vault-month-total {
  background: var(--bg-elevated);
  border-top: 2px solid var(--border);
}

.vault-month-label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.vault-month-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-800);
}

.vault-month-count {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.vault-month-amount {
  font-size: 1rem;
  font-weight: 700;
  color: #34d399;
}

.vault-month-total .vault-month-amount {
  color: var(--gray-800);
}

/* ============================================
   ADD EXPENSE – TILES DESIGN
   ============================================ */

.add-card { overflow: visible; }

.amount-section {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.add-section {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.add-section:last-of-type { border-bottom: none; }

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  margin-bottom: 0.75rem;
}

.optional-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--gray-400);
  font-size: 0.7rem;
}

/* Date input */
.date-input-field {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--gray-800);
  background: var(--bg-elevated);
  outline: none;
  transition: border-color 0.15s;
}

.date-input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(129,140,248,0.15);
}

/* Category Tiles */
.category-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.6rem;
}

.category-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  position: relative;
}

.category-tile input[type="radio"] { display: none; }

.category-tile:hover {
  border-color: var(--cat-color, var(--primary));
  background: color-mix(in srgb, var(--cat-color, var(--primary)) 10%, var(--bg-elevated));
}

.category-tile.selected {
  border-color: var(--cat-color, var(--primary));
  background: color-mix(in srgb, var(--cat-color, var(--primary)) 15%, var(--bg-elevated));
  box-shadow: 0 0 0 1px var(--cat-color, var(--primary));
}

.tile-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--cat-color, var(--gray-400)) 20%, transparent);
  color: var(--cat-color, var(--gray-400));
  transition: all 0.15s;
}

.tile-icon svg { width: 18px; height: 18px; }

.category-tile.selected .tile-icon {
  background: var(--cat-color, var(--primary));
  color: #fff;
}

.tile-name {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--gray-600);
  line-height: 1.2;
  word-break: break-word;
}

.category-tile.selected .tile-name { color: var(--gray-800); font-weight: 600; }

.category-tile--none {
  --cat-color: var(--gray-400);
  opacity: 0.6;
}

.category-tile--none.selected { opacity: 1; }

/* Textarea in add form */
.add-section textarea {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--gray-800);
  background: var(--bg-elevated);
  resize: none;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.add-section textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(129,140,248,0.15);
}

.add-section textarea::placeholder { color: var(--gray-400); }

/* Submit button */
.add-submit {
  padding: 1.25rem;
}

.btn-save {
  width: 100%;
  justify-content: center;
  padding: 0.875rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius);
  gap: 0.6rem;
}

.btn-save svg { width: 20px; height: 20px; }

/* Mobile: bigger tiles */
@media (max-width: 480px) {
  .category-tiles {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0.5rem;
  }
  .tile-icon { width: 32px; height: 32px; }
  .tile-icon svg { width: 16px; height: 16px; }
  .tile-name { font-size: 0.65rem; }
}
   ============================================ */

.budget-setup-form { padding: 1.25rem; }

.budget-setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: end;
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.3rem;
}

.daily-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.daily-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.daily-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.daily-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.daily-table tbody tr:last-child { border-bottom: none; }

.daily-table tbody tr:hover { background: var(--bg-elevated); }

.daily-table td {
  padding: 0.7rem 1rem;
  vertical-align: middle;
}

/* Row states */
.row-today { background: rgba(129,140,248,0.06) !important; }
.row-today td { border-left: 3px solid var(--primary); }
.row-today td:not(:first-child) { border-left: none; }
.row-future { opacity: 0.55; }
.row-over td { }
.row-ok td { }

/* Day cell */
.day-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.day-weekday {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-500);
  min-width: 20px;
}

.day-date {
  font-weight: 500;
  color: var(--gray-800);
}

.today-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tomorrow-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--gray-500);
  border: 1px solid var(--border);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Carry cell */
.carry-cell { font-size: 0.82rem; }
.carry-cell.positive { color: var(--success); }
.carry-cell.negative { color: var(--danger); }

/* Available cell */
.available-cell { color: var(--gray-800); }

/* Spent cell */
.expense-amount { color: var(--danger); font-weight: 600; }

/* Remaining badge */
.remaining-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.remaining-badge.positive {
  background: var(--success-light);
  color: var(--success);
}

.remaining-badge.negative {
  background: var(--danger-light);
  color: var(--danger);
}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
}

.status-dot.ok     { background: var(--success); }
.status-dot.over   { background: var(--danger); }
.status-dot.future { background: var(--gray-400); }

/* Muted text */
.muted { color: var(--gray-400); font-size: 0.82rem; }

/* Table footer */
.table-footer {
  background: var(--bg-elevated);
  border-top: 2px solid var(--border);
}

.table-footer td {
  padding: 0.875rem 1rem;
  font-size: 0.9rem;
}

/* Positive / Negative text colors */
.positive { color: var(--success); }
.negative { color: var(--danger); }

/* Responsive budget setup */
@media (max-width: 768px) {
  .budget-setup-grid {
    grid-template-columns: 1fr;
  }

  .daily-table thead th:nth-child(2),
  .daily-table tbody td:nth-child(2) {
    display: none; /* Übertrag auf Mobile ausblenden */
  }

  .daily-table td, .daily-table th {
    padding: 0.6rem 0.6rem;
  }
}
