/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #3b82f6;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --card-bg: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --income: #10b981;
  --income-bg: #ecfdf5;
  --expense: #ef4444;
  --expense-bg: #fef2f2;
  --accent: #3b82f6;
  --accent-bg: #eff6ff;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 240px;
  --header-height: 64px;
  --transition: 0.2s ease;
}

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

html { font-size: 16px; height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; cursor: pointer; }
button { cursor: pointer; font-family: inherit; }

/* ── Universal form control baseline ─────────────────────────── */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
select,
textarea {
  font-family: inherit;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--card-bg);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ── Custom select / dropdown styling ────────────────────────── */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

/* ── Hide number-spinner arrows globally ─────────────────────── */
input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.text-income { color: var(--income); }
.text-expense { color: var(--expense); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: #2563eb; transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-danger {
  background: var(--expense);
  color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-secondary); color: var(--text-primary); }

.btn-success {
  background: var(--income);
  color: white;
}
.btn-success:hover { background: #059669; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 7px; border-radius: 6px; background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-icon:hover { background: var(--bg-secondary); color: var(--text-primary); }
.btn-full { width: 100%; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.error-msg { color: var(--expense); font-size: 13px; padding: 8px 12px; background: var(--expense-bg); border-radius: 6px; margin-bottom: 12px; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  padding: 20px;
}

.login-container { width: 100%; max-width: 400px; }

.login-logo {
  text-align: center;
  margin-bottom: 32px;
  color: white;
}

.logo-icon {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin: 0 auto 16px;
  box-shadow: 0 8px 32px rgba(59,130,246,0.4);
}

.login-logo h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.login-logo p { color: rgba(255,255,255,0.6); font-size: 14px; }

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.login-card h2 { font-size: 20px; font-weight: 600; margin-bottom: 24px; }


/* Editable pct input in apartment */
.participant-pct-editable {
  width: 10%;
  padding: 4px 6px;
  text-align: center;
  font-weight: 600;
  color: var(--accent);
  -moz-appearance: textfield;
}
.participant-pct-editable::-webkit-inner-spin-button,
.participant-pct-editable::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
#app {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
#sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-close { display: none; background: none; border: none; color: var(--sidebar-text); font-size: 18px; padding: 4px; cursor: pointer; margin-left: auto; }

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: rgba(255,255,255,0.05);
}

.user-avatar {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: white; font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-details span:first-child { color: white; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--sidebar-text); font-size: 11px; }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active { background: var(--sidebar-active); color: white; }
.nav-icon { display: flex; align-items: center; flex-shrink: 0; }
.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #334155;
  padding: 12px 12px 4px;
  margin-top: 2px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,0.15); color: #fca5a5; }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* MAIN WRAPPER */
#main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* HEADER */
#top-header {
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 6px;
}
.hamburger:hover { background: var(--bg-secondary); }

#top-header h1 { font-size: 18px; font-weight: 600; flex: 1; }

.header-right {
  color: var(--text-muted);
  font-size: 13px;
}

/* MAIN CONTENT */
#main-content { flex: 1; padding: 24px; }

.page { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-value.income { color: var(--income); }
.stat-value.expense { color: var(--expense); }

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-icon.green { background: var(--income-bg); color: var(--income); }
.stat-icon.red { background: var(--expense-bg); color: var(--expense); }
.stat-icon.blue { background: var(--accent-bg); color: var(--accent); }
.stat-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }

/* ============================================================
   PAGE: DASHBOARD
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.account-list, .investment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-item, .investment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  gap: 12px;
}

.account-item:hover, .investment-item:hover {
  background: #e8edf5;
}

.account-name, .investment-name {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

.account-type, .investment-type {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--border);
  padding: 2px 8px;
  border-radius: 20px;
}

.account-balance, .investment-value {
  font-size: 15px;
  font-weight: 600;
}

.item-actions { display: flex; gap: 4px; }

.chart-container {
  position: relative;
  height: 260px;
}

/* ============================================================
   PAGE: WOHNUNG
   ============================================================ */
.participant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.participant-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  padding: 20px;
  text-align: center;
  transition: border-color var(--transition);
}

.participant-card.active { border-color: var(--accent); }

.participant-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: white;
  margin: 0 auto 12px;
}

.participant-name { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.participant-pct { font-size: 28px; font-weight: 700; color: var(--accent); }
.participant-pct-label { font-size: 12px; color: var(--text-muted); }
.participant-pct-input { width: 80px; text-align: center; font-size: 18px; font-weight: 600; border: 1.5px solid var(--border); border-radius: 8px; padding: 6px; outline: none; }
.participant-pct-input:focus { border-color: var(--accent); }

.cost-table {
  width: 100%;
  border-collapse: collapse;
}

.cost-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.cost-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.cost-table tr:last-child td { border-bottom: none; }
.cost-table tr:hover td { background: var(--bg-secondary); }

.cost-table .amount { font-weight: 600; white-space: nowrap; }

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.summary-table-wrapper {
  overflow-x: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-blue { background: var(--accent-bg); color: var(--accent); }
.badge-green { background: var(--income-bg); color: var(--income); }
.badge-red { background: var(--expense-bg); color: var(--expense); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }
.badge-gray { background: var(--bg-secondary); color: var(--text-secondary); }

/* ============================================================
   PAGE: RECURRING
   ============================================================ */
.year-nav, .month-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.year-nav .nav-btn, .month-nav .nav-btn {
  width: 34px; height: 34px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.year-nav .nav-btn:hover, .month-nav .nav-btn:hover { background: var(--accent); border-color: var(--accent); color: white; }
.year-nav .nav-label, .month-nav .nav-label { font-size: 18px; font-weight: 600; min-width: 100px; text-align: center; }

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.recurring-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.recurring-item:last-child { border-bottom: none; }
.recurring-item:hover { background: var(--bg-secondary); border-radius: 8px; }

.recurring-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.recurring-info { flex: 1; min-width: 0; }
.recurring-name { font-size: 14px; font-weight: 500; }
.recurring-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.recurring-amount { font-size: 15px; font-weight: 600; white-space: nowrap; }

.summary-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 16px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 4px 0;
}
.summary-row.total { font-weight: 700; font-size: 15px; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }

/* ============================================================
   PAGE: MONTHLY
   ============================================================ */
.expense-section { margin-bottom: 20px; }

.expense-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
}

.expense-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.expense-section-total { font-size: 14px; font-weight: 600; }

.expense-items {
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
}

.expense-item {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  transition: background var(--transition);
}
.expense-item:last-child { border-bottom: none; }
.expense-item:hover { background: var(--bg-secondary); }

.expense-item-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.expense-item-name { flex: 1; font-size: 14px; }
.expense-item-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.expense-item-amount { font-size: 14px; font-weight: 600; white-space: nowrap; }

.add-item-row {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  border-top: 1px dashed var(--border);
}
.add-item-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 4px 0;
  transition: color var(--transition);
}
.add-item-btn:hover { color: var(--accent); }

/* Monthly summary bar */
.monthly-summary-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
}
.monthly-summary-bar.msb-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.monthly-summary-bar > div {
  background: var(--card-bg);
  padding: 16px 20px;
  text-align: center;
}
.msb-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.msb-value { font-size: 22px; font-weight: 700; }

/* Savings section separator */
.savings-section-wrapper {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px dashed rgba(14,165,233,0.3);
}
.savings-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #0ea5e9;
  margin-bottom: 8px;
}

/* Category dot colors */
.dot-blue { background: #3b82f6; }
.dot-green { background: #10b981; }
.dot-orange { background: #f97316; }
.dot-purple { background: #8b5cf6; }
.dot-pink { background: #ec4899; }
.dot-teal { background: #14b8a6; }
.dot-yellow { background: #eab308; }
.dot-gray { background: #94a3b8; }

/* ============================================================
   MODAL
   ============================================================ */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}

#modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
  margin-bottom: 20px;
}

.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); padding: 4px 8px; border-radius: 6px; transition: all var(--transition); }
.modal-close:hover { background: var(--bg-secondary); color: var(--text-primary); }

#modal-body { padding: 0 24px 24px; }

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
}

.toast {
  background: var(--text-primary);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.toast.success { background: var(--income); }
.toast.error { background: var(--expense); }

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

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state svg { opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close { display: block; }
  #main-wrapper { margin-left: 0; }
  .hamburger { display: flex; }
  #main-content { padding: 16px; }
  #top-header { padding: 0 16px; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-value { font-size: 20px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .two-col-grid { grid-template-columns: 1fr; }
  .participant-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .monthly-summary-bar { grid-template-columns: 1fr; gap: 0; }
  .monthly-summary-bar > div { border-bottom: 1px solid var(--border); }
  .monthly-summary-bar > div:last-child { border-bottom: none; }

  #modal { max-width: 100%; border-radius: var(--radius-md); }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .participant-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header-left h2 { font-size: 22px; font-weight: 700; }
.page-header-left p { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

/* Tabs */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.tab-btn.active {
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   SPLIT SLIDER (Wohnung drag-to-adjust)
   ============================================================ */
.split-slider {
  position: relative;
  height: 52px;
  border-radius: var(--radius-md);
  overflow: hidden;
  user-select: none;
  touch-action: pan-y;
  box-shadow: var(--shadow-sm);
  background: var(--border);
}

.split-segment {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  transition: none;
}

.split-seg-name {
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split-handle {
  position: absolute;
  top: 0;
  width: 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: col-resize;
  transform: translateX(-50%);
  z-index: 10;
}

.split-handle-line {
  width: 3px;
  height: 70%;
  background: rgba(255,255,255,0.85);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
  transition: height 0.15s ease;
}

.split-handle:hover .split-handle-line { height: 85%; width: 4px; }

/* ============================================================
   APARTMENT — Participant Name Grid
   ============================================================ */
.participant-name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.participant-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.participant-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.15s ease;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}
.participant-color-dot:hover { transform: scale(1.2); }

.participant-name-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  min-width: 0;
}
.participant-name-input:focus { color: var(--accent); }
.participant-user-select {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  cursor: pointer;
}

.participant-pct-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--card-bg);
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
  min-width: 40px;
  text-align: center;
}

/* ============================================================
   RECURRING — Sections
   ============================================================ */
.section-header-main {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.section-total {
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
}

.rec-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--card-bg);
}

.rec-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.rec-section-header:hover { background: #e8edf5; }

.rec-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.rec-section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rec-section-icon { display: flex; align-items: center; }
.rec-section-amount { font-size: 13px; font-weight: 600; }

.rec-section-body { overflow: hidden; }
.rec-section-body.collapsed { display: none; }

.rec-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  transition: background var(--transition);
}
.rec-item:hover { background: var(--bg-secondary); }

.rec-item-indicator {
  width: 3px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

.rec-item-info { flex: 1; min-width: 0; }
.rec-item-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-item-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rec-item-amount { font-size: 14px; font-weight: 600; white-space: nowrap; }
.rec-empty { padding: 10px 14px; font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--border); }

/* Laufzeit fields in item modal */
.laufzeit-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.laufzeit-group { flex: 1; }
.laufzeit-label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 6px; color: var(--text-primary); }
.laufzeit-inputs { display: flex; gap: 6px; }
.laufzeit-month {
  flex: 1;
}
.laufzeit-year {
  width: 70px;
}
.laufzeit-arrow { font-size: 18px; color: var(--text-muted); padding-bottom: 8px; flex-shrink: 0; }

/* Laufzeit badge in item meta */
.laufzeit-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(99,102,241,0.1);
  color: #6366f1;
  letter-spacing: 0.02em;
}

/* Inactive items (outside laufzeit) */
.rec-item-inactive { opacity: 0.45; }

/* Apartment-derived items in recurring */
.rec-item-apt { opacity: 0.9; }
.apt-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(20,184,166,0.12);
  color: #14b8a6;
  margin-left: 5px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}


/* Calendar section headers */
.cal-section-header td {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 8px 12px 6px;
}
.cal-section-income td  { background: rgba(16,185,129,0.07); color: var(--income); border-top: 2px solid rgba(16,185,129,0.2); }
.cal-section-expense td { background: rgba(239,68,68,0.06);  color: var(--expense); border-top: 2px solid rgba(239,68,68,0.15); }

.cal-cat-header td {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 5px 12px 4px;
}

/* Calendar totals rows */
.cal-totals-row td {
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}
.cal-totals-row:first-of-type td { border-top: 2px solid var(--border); }
.cal-diff-row td {
  background: var(--card-bg);
  border-top: 2px solid var(--border) !important;
  font-size: 13px;
}

/* Calendar yearly summary bar */
.cal-yearly-summary {
  display: flex;
  align-items: center;
  gap: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.cal-yearly-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  gap: 4px;
}
.cal-yearly-sep {
  width: 1px;
  height: 40px;
  background: var(--border);
}
.cal-yearly-label { font-size: 12px; color: var(--text-muted); }
.cal-yearly-value { font-size: 18px; font-weight: 700; }
.cal-yearly-total { font-size: 22px; }

/* ============================================================
   PEOPLE PAGE
   ============================================================ */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.people-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.people-card:hover { box-shadow: var(--shadow-md); }
.people-card-self { border-color: var(--accent); }

.people-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.people-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}
.people-avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-upload-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto;
  cursor: pointer;
  border-radius: 50%;
}
.avatar-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.avatar-upload-wrap:hover .avatar-upload-overlay { opacity: 1; }

.people-info { flex: 1; min-width: 0; }
.people-name { font-size: 15px; font-weight: 600; }
.people-username { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.people-badges { display: flex; gap: 4px; flex-wrap: wrap; align-self: flex-start; }

.people-meta {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-bottom: 12px;
}

.people-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 768px) {
  .people-grid { grid-template-columns: 1fr; }
  .participant-name-grid { grid-template-columns: 1fr; }
}

/* ─── Kontostand (monthly) ───────────────────────────────────── */
.kontostand-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 24px;
  align-items: start;
  padding: 4px 0 8px;
}

.kontostand-accounts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kontostand-account-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.kontostand-account-name {
  font-weight: 500;
  flex: 1;
}

.kontostand-account-type {
  font-size: 11px;
}

.kontostand-account-balance {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kontostand-summary {
  min-width: 220px;
  border-left: 1px solid var(--border);
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kontostand-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.kontostand-total-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kontostand-sep {
  height: 1px;
  background: var(--border);
}

/* ─── Recurring items in monthly view ────────────────────────── */
.rec-monthly-section .expense-section-header {
  border-radius: 8px 8px 0 0;
}

.rec-monthly-pending {
  background: rgba(255,255,255,0.02);
}

.rec-monthly-confirmed {
  opacity: 0.65;
}

.rec-pending-badge {
  font-size: 11px;
  font-weight: 600;
  color: #f97316;
  background: rgba(249,115,22,0.12);
  border-radius: 99px;
  padding: 2px 8px;
}

.btn-xs {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.rec-confirm-btn {
  transition: opacity 0.15s;
}

.rec-confirm-btn:hover { opacity: 0.85; }

.rec-dismiss-btn {
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0.7;
}

.rec-dismiss-btn:hover {
  color: var(--expense);
  opacity: 1;
}

/* ─── Apartment list ─────────────────────────────────────────── */
.apt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 2px;
}

.apt-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.apt-list-item:hover { background: var(--bg-secondary); }

.apt-list-selected {
  border-color: var(--accent);
  background: rgba(99,102,241,0.06);
}

.apt-list-main { flex: 1; min-width: 0; }

.apt-list-name {
  font-size: 14px;
  font-weight: 600;
}

.apt-list-dates {
  font-size: 12px;
  margin-top: 2px;
}

.apt-date-month { flex: 1.4; min-width: 0; }
.apt-date-year  { flex: 1; min-width: 0; }

.apt-active-badge {
  font-size: 11px;
  font-weight: 600;
  color: #22c55e;
  background: rgba(34,197,94,0.12);
  border-radius: 99px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ── Apartment view tabs ─────────────────────────────────────── */
.apt-view-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}
.apt-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.apt-tab.active {
  background: white;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.apt-tab:hover:not(.active) { color: var(--text-primary); }

/* ── Sammelbuchung ───────────────────────────────────────────── */
.sammelbuchung-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--accent-bg);
  border: 1.5px solid rgba(59,130,246,0.18);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.sammelbuchung-confirmed {
  background: #f0fdf4;
  border-color: rgba(34,197,94,0.2);
}
.sammelbuchung-icon {
  color: var(--accent);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.sammelbuchung-confirmed .sammelbuchung-icon { color: #22c55e; }
.sammelbuchung-info {
  flex: 1;
  min-width: 0;
}
.sammelbuchung-name {
  font-weight: 600;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sammelbuchung-items {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.sammelbuchung-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  color: var(--text-secondary);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  margin-left: 2px;
  vertical-align: middle;
}
.sammelbuchung-amount {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.sammelbuchung-amount-done {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* ── Participant income grid ─────────────────────────────────── */
.participant-income-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.participant-income-col {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.participant-income-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.participant-income-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}
.participant-income-row:last-of-type { border-bottom: none; }

/* ── Einkaufsliste ─────────────────────────────────────── */

/* Quick article tiles */
.quick-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
  padding: 4px 16px 16px;
}
.quick-article-btn {
  --qa-color: #6b7280;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--qa-color) 35%, transparent);
  background: color-mix(in srgb, var(--qa-color) 10%, var(--bg-card));
  color: var(--qa-color);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  width: 100%;
  text-align: center;
}
.quick-article-btn:hover {
  background: color-mix(in srgb, var(--qa-color) 18%, var(--bg-card));
  border-color: color-mix(in srgb, var(--qa-color) 55%, transparent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--qa-color) 25%, transparent);
}
.quick-article-btn:active {
  transform: scale(0.95);
  box-shadow: none;
}
.quick-article-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}
.quick-article-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.quick-article-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
  hyphens: auto;
  color: var(--text-primary);
}
.quick-article-amount {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1;
}

/* Icon picker in quick-article form */
.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.icon-picker-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.icon-picker-btn:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.icon-picker-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.shopping-quick-add {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.shopping-quick-add form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.shopping-quick-add .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 120px;
}
.shopping-due-alert {
  background: linear-gradient(135deg, #1e3a5f, #1a2a4a);
  border: 1px solid #3b82f6;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.shopping-category-section {
  margin-bottom: 16px;
}
.shopping-category-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.shopping-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: opacity 0.15s;
}
.shopping-item.checked {
  opacity: 0.45;
}
.shopping-item-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.shopping-item-check.done {
  background: var(--accent);
}
.shopping-item-name {
  flex: 1;
  font-size: 14px;
}
.shopping-item.checked .shopping-item-name {
  text-decoration: line-through;
}
.shopping-item-amount {
  font-size: 12px;
  color: var(--text-muted);
}
.shopping-item-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.shopping-item:hover .shopping-item-actions {
  opacity: 1;
}
.shopping-checked-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.recurring-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.recurring-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--accent-bg);
  color: var(--accent);
}

/* ── Rezepte ──────────────────────────────────────────── */
.filter-btn {
  padding: 5px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-btn:hover {
  background: var(--bg-secondary);
}
.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 800px) {
  .recipe-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .recipe-grid { grid-template-columns: 1fr; }
}
.recipe-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s;
}
.recipe-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.recipe-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.recipe-category-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--accent-bg);
  color: var(--accent);
}
.recipe-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.recipe-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.recipe-card-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
}
.ing-row { display: flex; gap: 8px; margin-bottom: 6px; }

/* ── Wochenplaner ──────────────────────────────────────── */
.week-planner-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.wp-header-row,
.wp-row {
  display: grid;
  grid-template-columns: 100px repeat(7, 1fr);
}
.wp-header-row {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.wp-row {
  border-bottom: 1px solid var(--border);
}
.wp-row:last-child {
  border-bottom: none;
}
.wp-header-empty {
  padding: 10px;
  border-right: 1px solid var(--border);
}
.wp-day-header {
  padding: 10px 6px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.wp-day-header:last-child {
  border-right: none;
}
.wp-day-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}
.wp-day-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.wp-meal-label {
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
}
.wp-cell {
  padding: 10px 8px;
  min-height: 82px;
  border-right: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  position: relative;
}
.wp-cell:last-child {
  border-right: none;
}
.wp-cell:hover {
  background: var(--bg-secondary);
}
.wp-cell-filled {
  background: rgba(59, 130, 246, 0.09);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px 8px;
  position: relative;
}
.wp-cell-filled:hover {
  background: rgba(59, 130, 246, 0.16);
}
.wp-add-hint {
  font-size: 22px;
  color: var(--border);
  line-height: 1;
}
.wp-meal-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  text-align: center;
  width: 100%;
}
.wp-clear-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 3px;
  border-radius: 4px;
  line-height: 1;
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.12s, color 0.12s;
}
.wp-cell-filled:hover .wp-clear-btn {
  opacity: 1;
}
.wp-clear-btn:hover {
  background: rgba(239,68,68,0.12);
  color: #ef4444;
}

/* Badge in Laufende Kosten */
.sammelbuchung-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}
