/* ============================================
   Familienplaner – Glass Admin Theme
   Inspired by TemplateMo 607 Glass Admin
   https://templatemo.com/tm-607-glass-admin
============================================ */

/* ── Breathing Font ──────────────────────────────────────────────── */
@font-face {
  font-family: 'Breathing';
  src: url('/fonts/Breathing.woff') format('woff'),
       url('/fonts/Breathing.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ── Design Tokens (Dark Default) ────────────────────────────────── */
:root {
  /* Primary Colors */
  --primary: #6B8AFF;
  --primary-light: #8DA6FF;
  --primary-dark: #4068FF;
  --primary-bg: rgba(64, 104, 255, 0.15);

  /* Glass Colors */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-bg-solid: rgba(15, 20, 30, 0.85);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: rgba(0, 0, 0, 0.3);
  --glass-hover: rgba(255, 255, 255, 0.08);

  /* Background – Deep Space */
  --bg: #0a0d14;
  --bg-gradient-1: #0d1420;
  --bg-gradient-2: #131d2e;
  --bg-gradient-3: #1a2840;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-hover: rgba(255, 255, 255, 0.08);

  /* Text */
  --text: #f5f5f4;
  --text-secondary: rgba(245, 245, 244, 0.7);
  --text-muted: rgba(245, 245, 244, 0.4);
  --text-faint: rgba(245, 245, 244, 0.2);

  /* Borders */
  --border: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.05);

  /* Status Colors */
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.15);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --warning: #eab308;
  --star-color: #F5C518;
  --priority-high: #dc2626;
  --priority-medium: #eab308;
  --priority-low: #22c55e;

  /* Accent */
  --accent-secondary: #d4a574;
  --accent-coral: #e07a5f;

  /* Layout */
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 40px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 60px rgba(0, 0, 0, 0.5);
  --sidebar-width: 240px;
  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;
}

/* ── Light Mode ─────────────────────────────────────────────────── */
[data-theme="light"] {
  --primary: #4068FF;
  --primary-light: #6B8AFF;
  --primary-dark: #2D4FE0;
  --primary-bg: rgba(64, 104, 255, 0.1);

  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-bg-solid: rgba(240, 243, 250, 0.9);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.1);
  --glass-hover: rgba(255, 255, 255, 0.8);

  --bg: #eef1f8;
  --bg-gradient-1: #e4e9f5;
  --bg-gradient-2: #edf1fa;
  --bg-gradient-3: #f5f7fc;
  --bg-card: rgba(255, 255, 255, 0.6);
  --bg-hover: rgba(255, 255, 255, 0.8);

  --text: #1a1a2e;
  --text-secondary: rgba(26, 26, 46, 0.78);
  --text-muted: rgba(26, 26, 46, 0.52);
  --text-faint: rgba(26, 26, 46, 0.25);

  --border: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.04);

  --danger-bg: rgba(220, 38, 38, 0.08);
  --success-bg: rgba(34, 197, 94, 0.08);

  --shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .orb { opacity: 0.12; }
[data-theme="light"] .glass-card::before,
[data-theme="light"] .card::before {
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.03), transparent);
}

/* ── Accent Colors ──────────────────────────────────────────────── */
[data-accent="red"] {
  --primary: #EF5350; --primary-light: #E57373;
  --primary-dark: #E53935; --primary-bg: rgba(229, 57, 53, 0.15);
}
[data-theme="light"][data-accent="red"] {
  --primary: #E53935; --primary-light: #EF5350;
  --primary-dark: #C62828; --primary-bg: rgba(229, 57, 53, 0.1);
}
[data-accent="purple"] {
  --primary: #CE93D8; --primary-light: #E1BEE7;
  --primary-dark: #AB47BC; --primary-bg: rgba(171, 71, 188, 0.15);
}
[data-theme="light"][data-accent="purple"] {
  --primary: #7B1FA2; --primary-light: #9C27B0;
  --primary-dark: #6A1B9A; --primary-bg: rgba(123, 31, 162, 0.1);
}
[data-accent="green"] {
  --primary: #66BB6A; --primary-light: #81C784;
  --primary-dark: #43A047; --primary-bg: rgba(67, 160, 71, 0.15);
}
[data-theme="light"][data-accent="green"] {
  --primary: #2E7D32; --primary-light: #43A047;
  --primary-dark: #1B5E20; --primary-bg: rgba(46, 125, 50, 0.1);
}

/* Theme Picker */
.theme-picker {
  display: flex; gap: 12px; padding: 8px 0;
}
.theme-option {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 2px solid transparent; transition: all var(--transition);
}
.theme-option:hover { background: var(--glass-hover); }
.theme-option.active { border-color: var(--primary); background: var(--primary-bg); }
.theme-swatch {
  width: 32px; height: 32px; border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.theme-option span { font-size: 11px; font-weight: 500; color: var(--text-secondary); }

/* ── PWA Standalone Mode ─────────────────────────────────────────── */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); }
  .sidebar { top: env(safe-area-inset-top); }
  .login-page { padding-top: env(safe-area-inset-top); }
}
@media (display-mode: standalone) and (max-width: 480px) {
  .sidebar { padding-bottom: env(safe-area-inset-bottom); }
  .main-content { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
}

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

/* ── Focus Visible (Keyboard Navigation) ────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}
.btn:focus-visible,
.nav-item:focus-visible,
.profile-trigger:focus-visible,
.btn-toggle:focus-visible,
.chat-sidebar-item:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

/* ── Reset & Base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* ── Animated Glass Background ───────────────────────────────────── */
.glass-background {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -2;
  background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 50%, var(--bg-gradient-3) 100%);
}

.glass-background::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(64, 104, 255, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(107, 138, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 80%, rgba(212, 165, 116, 0.06) 0%, transparent 50%);
}

/* Custom Background Image */
.glass-background.has-custom-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.glass-background.has-custom-bg::before {
  background: rgba(0, 0, 0, 0.3);
}

.glass-background.has-custom-bg ~ .orb {
  opacity: 0 !important;
}

/* Floating Orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  z-index: -1;
  animation: orbFloat 20s ease-in-out infinite;
  pointer-events: none;
  will-change: transform;
  contain: strict;
}

.orb-1 {
  width: 400px; height: 400px;
  background: var(--primary);
  top: 10%; left: 10%;
  animation-delay: 0s;
}

.orb-2 {
  width: 350px; height: 350px;
  background: var(--accent-secondary);
  top: 60%; right: 10%;
  animation-delay: -5s;
}

.orb-3 {
  width: 300px; height: 300px;
  background: var(--accent-coral);
  bottom: 10%; left: 30%;
  animation-delay: -10s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(20px, 10px) scale(1.02); }
}

/* ── Login Page ─────────────────────────────────────────────────── */
.login-page {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 5000;
}

.login-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 90%; max-width: 420px;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-title { font-family: 'Breathing', cursive; font-size: 32px; font-weight: 400; margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }

.login-card .form-group { text-align: left; }

.login-remember {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary);
  margin: 12px 0 16px; cursor: pointer;
}

.login-remember input { accent-color: var(--primary); width: 16px; height: 16px; }

.login-error {
  font-size: 12px; color: var(--danger);
  min-height: 18px; margin-bottom: 8px;
}

.login-btn {
  width: 100%; padding: 14px;
  font-size: 15px; font-weight: 500;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  box-shadow: 0 8px 24px rgba(64, 104, 255, 0.3);
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(64, 104, 255, 0.4);
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: all 0.3s ease;
  overflow-y: auto;
}

.sidebar {
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

.sidebar-header {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 8px;
}

.sidebar-header .logo { font-size: 26px; }
.sidebar-header h1 {
  font-family: 'Breathing', cursive; font-size: 22px; font-weight: 400;
  background: linear-gradient(135deg, var(--primary-light), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.sidebar-spacer { flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  transition: all var(--transition);
  position: relative;
}

.nav-item:hover { background: var(--glass-hover); color: var(--text); }
.nav-item.active { background: var(--glass-hover); color: var(--text); }
.nav-icon { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; opacity: 0.8; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 12px 16px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--glass-border);
  text-align: center;
}

/* ── Profile Floating (top-right) ────────────────────────────────── */
.profile-floating {
  position: fixed;
  top: 10px;
  right: 16px;
  z-index: 200;
  display: flex;
  align-items: center;
}

.profile-trigger {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  border-radius: 10px; cursor: pointer; transition: all var(--transition);
  background: var(--glass-bg-solid); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}
.profile-trigger:hover { background: var(--glass-hover); }

.profile-avatar {
  width: 30px; height: 30px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 16px;
  overflow: hidden;
}
.profile-avatar img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
}

.profile-username { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.profile-chevron { font-size: 10px; color: var(--text-muted); }

.profile-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 6px;
  background: var(--glass-bg); backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); min-width: 180px;
  z-index: 300; display: none; overflow: hidden;
}
.profile-dropdown.active { display: block; animation: fadeInUp 0.15s ease-out; }

.profile-dropdown-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  font-size: 13px; cursor: pointer; transition: all var(--transition);
  color: var(--text-secondary);
}
.profile-dropdown-item:hover { background: var(--glass-hover); color: var(--text); }
.profile-dropdown-danger { color: var(--danger); }
.profile-dropdown-danger:hover { background: var(--danger-bg); }

.profile-dropdown-divider {
  height: 1px; background: var(--border-light); margin: 2px 0;
}

/* ── Main Content ────────────────────────────────────────────────── */
#app-container { width: 100%; }

.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  padding: 28px 32px;
  min-height: 100vh;
  overflow-x: hidden;
}

.page { display: none; }
.page.active { display: block; animation: fadeInUp 0.4s ease-out; }

#page-calendar.active {
  display: flex; flex-direction: column;
  height: calc(100vh - 56px);
}
#page-calendar #calendar-container {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
}
#page-calendar .calendar-grid {
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 { font-size: 24px; font-weight: 600; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 60px;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 4px 15px rgba(64, 104, 255, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(64, 104, 255, 0.35);
}

.btn-ghost {
  background: transparent; color: var(--text-secondary); padding: 8px 12px;
}
.btn-ghost:hover { background: var(--glass-hover); color: var(--text); }

.btn-small { padding: 6px 12px; font-size: 12px; }

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #ef4444);
  color: #fff;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.25);
}
.btn-danger:hover { box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35); }

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

.btn-icon {
  width: 34px; height: 34px; padding: 0; border-radius: 10px; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer; color: var(--text-muted);
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--glass-hover); color: var(--text); }
.btn-icon.star-btn:hover { background: rgba(245, 197, 24, 0.15); color: var(--star-color); }
.btn-icon.delete-btn:hover { background: var(--danger-bg); color: var(--danger); }

/* View Toggle */
.view-toggle {
  display: flex;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.btn-toggle {
  padding: 6px 14px;
  border-radius: 8px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.btn-toggle.active {
  background: var(--glass-hover);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(64, 104, 255, 0.15);
}
.btn-toggle:hover:not(.active) { color: var(--text); }

/* ── Cards (Glass) ──────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

.card:hover {
  background: var(--glass-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

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

.card-header h3 { font-size: 16px; font-weight: 600; }

/* ── Forms (Glass) ────────────────────────────────────────────────── */
.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%; padding: 12px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; color: var(--text);
  transition: all var(--transition);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary-light);
  box-shadow: 0 0 20px rgba(64, 104, 255, 0.15);
}

.form-group input::placeholder, .form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.filter-select {
  padding: 10px 14px;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; color: var(--text-secondary);
  transition: all var(--transition);
}

.filter-select:focus {
  outline: none; border-color: var(--primary-light);
  box-shadow: 0 0 15px rgba(64, 104, 255, 0.12);
}

/* ── Modal (Glass) ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 1000;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%; max-width: 700px;
  max-height: 90vh; overflow-y: auto;
  position: relative;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

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

.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close { font-size: 20px; line-height: 1; padding: 2px 6px !important; }
.modal-body { padding: 16px 24px 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ── Calendar ────────────────────────────────────────────────────── */
.calendar-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-bottom: 16px;
}

.calendar-nav h3 { font-size: 16px; font-weight: 600; min-width: 200px; text-align: center; }

/* Month view */
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px;
  background: var(--glass-border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  width: 100%;
}

.calendar-day-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 10px; text-align: center; font-size: 12px; font-weight: 600;
}

.calendar-day {
  background: var(--glass-bg-solid);
  min-height: 90px; padding: 6px;
  cursor: pointer; transition: all var(--transition);
  overflow: hidden; min-width: 0;
}

.calendar-day:hover { background: var(--glass-hover); }
.calendar-day.other-month { background: rgba(0,0,0,0.1); color: var(--text-faint); }
.calendar-day.today { background: var(--primary-bg); }

.calendar-day .day-number { font-size: 12px; font-weight: 600; margin-bottom: 3px; }

.calendar-day.today .day-number {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  box-shadow: 0 4px 12px rgba(64, 104, 255, 0.3);
}

.calendar-event {
  font-size: 10px; padding: 2px 5px; border-radius: 4px; margin-bottom: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #fff; cursor: pointer;
}

[data-theme="light"] .calendar-day.other-month { background: rgba(0,0,0,0.03); }

/* Week view */
.calendar-week-grid {
  display: grid; grid-template-columns: 60px repeat(7, 1fr); gap: 1px;
  background: var(--glass-border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}

.week-time-label {
  background: var(--glass-bg); padding: 4px; font-size: 10px;
  color: var(--text-muted); text-align: right; height: 48px;
  display: flex; align-items: flex-start; justify-content: flex-end; padding-right: 8px;
}

.week-day-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 8px 4px; text-align: center; font-size: 11px; font-weight: 600;
}

.week-day-header.today-col {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.week-cell {
  background: var(--glass-bg); min-height: 48px; padding: 2px;
  cursor: pointer; transition: background var(--transition); position: relative;
}
.week-cell:hover { background: var(--primary-bg); }

.week-event {
  font-size: 10px; padding: 2px 4px; border-radius: 4px;
  color: #fff; margin-bottom: 1px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Day view */
.calendar-day-view {
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}

.day-view-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 12px 16px; font-size: 14px; font-weight: 600;
}

.day-view-hours { display: flex; flex-direction: column; }

.day-hour-row {
  display: flex; border-bottom: 1px solid var(--border-light);
  min-height: 56px; cursor: pointer; transition: background var(--transition);
}
.day-hour-row:hover { background: var(--primary-bg); }

.day-hour-label {
  width: 70px; padding: 8px; font-size: 12px;
  color: var(--text-muted); text-align: right; flex-shrink: 0;
  border-right: 1px solid var(--border-light);
}

.day-hour-content { flex: 1; padding: 4px 8px; }

.day-event {
  font-size: 12px; padding: 4px 8px; border-radius: 6px;
  color: #fff; margin-bottom: 2px; cursor: pointer;
}

/* Day multi-column view */
.day-multi-view {
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow); overflow-x: auto;
}

.day-multi-header {
  display: grid; position: sticky; top: 0; z-index: 2;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; border-radius: var(--radius) var(--radius) 0 0;
}

.day-multi-col-header {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 6px; font-size: 12px; font-weight: 600; text-align: center;
}

.day-multi-row {
  display: grid; min-height: 56px;
  border-bottom: 1px solid var(--border-light);
}

.day-multi-cell {
  padding: 4px 6px; border-left: 1px solid var(--border-light);
  cursor: pointer; transition: background var(--transition);
}
.day-multi-cell:hover { background: var(--primary-bg); }

/* External calendar events */
.calendar-event.external,
.week-event.external,
.day-event.external {
  border-left: 2px dashed rgba(255,255,255,0.6);
  opacity: 0.85;
}

/* ── Tasks ───────────────────────────────────────────────────────── */
.tasks-filter-bar {
  display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}

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

.task-card {
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  transition: all var(--transition);
}

.task-card:hover {
  background: var(--glass-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

.task-card.completed { opacity: 0.6; }
.task-card.completed .task-title { text-decoration: line-through; }

.task-checkbox {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--text-faint); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0;
  font-size: 12px; color: transparent;
}

.task-checkbox:hover { border-color: var(--primary); }
.task-checkbox.checked {
  background: linear-gradient(135deg, var(--success), #34d399);
  border-color: var(--success); color: #fff;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.task-card .task-info { flex: 1; min-width: 0; }
.task-card .task-title { font-size: 14px; font-weight: 500; }
.task-card .task-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; margin-top: 3px; }

.task-priority-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.task-priority-dot.high { background: var(--priority-high); box-shadow: 0 0 8px var(--priority-high); }
.task-priority-dot.medium { background: var(--priority-medium); box-shadow: 0 0 8px var(--priority-medium); }
.task-priority-dot.low { background: var(--priority-low); box-shadow: 0 0 8px var(--priority-low); }

.task-stars-badge {
  display: flex; align-items: center; gap: 3px;
  font-size: 13px; font-weight: 600; color: var(--star-color); white-space: nowrap;
}

.task-card .task-actions { display: flex; gap: 2px; }

/* ── Rewards ─────────────────────────────────────────────────────── */
.rewards-layout {
  display: grid; grid-template-columns: 280px 1fr 280px; gap: 16px;
}

.members-stars-list { display: flex; flex-direction: column; gap: 10px; }

.member-star-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
}

.member-star-row .member-emoji { font-size: 32px; }
.member-star-row .member-emoji img { width: 36px !important; height: 36px !important; }
.member-star-row .member-info { flex: 1; }
.member-star-row .member-name { font-weight: 600; font-size: 13px; }

.star-count {
  display: flex; align-items: center; gap: 3px;
  font-family: 'Space Mono', monospace;
  font-size: 18px; font-weight: 700; color: var(--star-color);
}

.star-count .star-icon { font-size: 18px; }

.star-adjust {
  display: flex; gap: 2px; margin-left: 6px;
}

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

.reward-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
}

.reward-item .reward-emoji { font-size: 24px; flex-shrink: 0; }
.reward-item .reward-info { flex: 1; min-width: 0; }
.reward-item .reward-title { font-size: 13px; font-weight: 500; }
.reward-item .reward-desc { font-size: 11px; color: var(--text-muted); }

.reward-cost {
  display: flex; align-items: center; gap: 3px;
  font-family: 'Space Mono', monospace;
  font-weight: 600; color: var(--star-color); white-space: nowrap; font-size: 13px;
}

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

.reward-recurring-badge {
  font-size: 10px; background: var(--primary-bg); color: var(--primary);
  padding: 2px 8px; border-radius: 6px; font-weight: 500;
}

.redemption-item {
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  font-size: 12px; color: var(--text-secondary);
}

.redemption-item .redemption-member { font-weight: 600; color: var(--text); }

/* Star Log */
.star-log-list { max-height: 400px; overflow-y: auto; }
.star-log-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; flex-wrap: wrap;
}
.star-log-member { font-weight: 600; color: var(--text); white-space: nowrap; }
.star-log-reason { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star-log-amount { white-space: nowrap; font-family: 'Space Mono', monospace; }
.star-log-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; margin-left: auto; }

/* ── Meals ───────────────────────────────────────────────────────── */
.meals-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-bottom: 16px;
}

.meals-nav h3 { font-size: 15px; font-weight: 600; min-width: 260px; text-align: center; }

.meals-grid {
  display: grid; grid-template-columns: 90px repeat(7, 1fr); gap: 1px;
  background: var(--glass-border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}

.meals-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 10px 6px; text-align: center; font-size: 12px; font-weight: 600;
}

.meals-header.corner {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

[data-theme="light"] .meals-header.corner {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.meals-row-label {
  background: var(--glass-bg-solid); padding: 8px 6px; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  color: var(--text-secondary); gap: 2px;
}

.meals-cell {
  background: var(--glass-bg-solid); padding: 6px; min-height: 70px;
  cursor: pointer; transition: background var(--transition);
}

.meals-cell:hover { background: var(--glass-hover); }

.meal-entry {
  font-size: 11px; padding: 3px 6px;
  background: var(--primary-bg); color: var(--primary);
  border-radius: 6px; margin-bottom: 3px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: all var(--transition);
}

.meal-entry:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
}

/* ── Recipes (Standalone) ────────────────────────────────────────── */
.recipe-search-bar { margin-bottom: 20px; }

.recipes-grid-full {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
}

.recipe-card-full {
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; transition: all 0.3s ease;
  position: relative;
}

.recipe-card-full:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.15);
}

.recipe-card-img {
  height: 140px; overflow: hidden;
  background: var(--glass-bg);
  display: flex; align-items: center; justify-content: center;
}
.recipe-card-img img { width: 100%; height: 100%; object-fit: cover; }
.recipe-card-no-img { font-size: 40px; color: var(--text-faint); }

.recipe-card-body { padding: 16px; }
.recipe-card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.recipe-card-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.recipe-card-preview { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Recipes in meals page (small cards) */
.recipes-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }

.recipe-card {
  background: var(--glass-bg-solid); border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px; cursor: pointer; transition: all var(--transition);
}

.recipe-card:hover { background: var(--glass-hover); box-shadow: var(--shadow); }
.recipe-card .recipe-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.recipe-card .recipe-preview { font-size: 11px; color: var(--text-muted); }

.quick-add-input {
  flex: 1; padding: 12px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 14px;
  transition: all var(--transition);
  color: var(--text);
}

.quick-add-input::placeholder { color: var(--text-muted); }

.quick-add-input:focus {
  outline: none; border-color: var(--primary-light);
  box-shadow: 0 0 20px rgba(64, 104, 255, 0.15);
}

/* ── Shopping (KitchenOwl-Style Glass) ───────────────────────────── */
.shopping-add-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: var(--shadow); padding: 6px 18px;
  margin-bottom: 16px; position: relative;
}

.shopping-search-icon { font-size: 16px; color: var(--text-muted); flex-shrink: 0; }

.shopping-search-input {
  flex: 1; border: none; background: none; outline: none;
  font-family: inherit; font-size: 15px; color: var(--text);
  padding: 10px 4px;
}

.shopping-search-input::placeholder { color: var(--text-faint); }

.shopping-count { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.shopping-suggestions {
  display: none; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px; padding: 0 4px;
}

.shopping-suggestions.active { display: flex; }

.shopping-suggestions .suggestion-header {
  width: 100%; font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1px; padding: 4px 0;
}

.suggestion-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 13px; cursor: pointer;
  transition: all var(--transition); color: var(--text);
}

.suggestion-chip:hover {
  background: var(--primary-bg); border-color: var(--primary);
  color: var(--primary);
}

.suggestion-chip .chip-icon { font-size: 15px; }

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

.shopping-category {
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}

.shopping-category-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1px; cursor: pointer;
  user-select: none;
}

.shopping-category-header .cat-count {
  font-weight: 400; color: var(--text-faint);
}

.shopping-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-top: 1px solid var(--border-light);
  transition: background var(--transition);
}

.shopping-item:hover { background: var(--glass-hover); }

.shopping-item .shop-checkbox {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--text-faint); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0;
  font-size: 12px; color: transparent; background: transparent;
}

.shopping-item .shop-checkbox:hover { border-color: var(--primary); }

.shopping-item .shop-checkbox.checked {
  background: linear-gradient(135deg, var(--success), #34d399);
  border-color: var(--success); color: #fff;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.shop-item-info { flex: 1; min-width: 0; }
.shop-item-name { font-size: 14px; font-weight: 500; }
.shop-item-name.checked { text-decoration: line-through; color: var(--text-muted); font-weight: 400; }

.shop-item-qty {
  font-size: 12px; color: var(--text-muted); margin-top: 1px;
}

.shop-quantity-inline {
  width: 70px; padding: 4px 8px;
  background: var(--glass-bg);
  border: 1px solid transparent;
  border-radius: 8px; font-family: inherit; font-size: 12px;
  text-align: center; color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition);
}

.shop-quantity-inline:hover { border-color: var(--glass-border); }
.shop-quantity-inline:focus {
  outline: none; border-color: var(--primary-light);
  box-shadow: 0 0 12px rgba(64, 104, 255, 0.12);
}

.shopping-item .shop-delete {
  opacity: 0; transition: opacity var(--transition);
}

.shopping-item:hover .shop-delete { opacity: 1; }

.shopping-checked-section { margin-top: 8px; }

.shopping-checked-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; user-select: none;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.shopping-checked-toggle .toggle-arrow {
  transition: transform var(--transition); font-size: 10px;
}

.shopping-checked-toggle .toggle-arrow.open { transform: rotate(90deg); }

.shopping-checked-items { display: none; }
.shopping-checked-items.open { display: block; }

/* ── Shopping Erweiterungen ──────────────────────────────────────── */

.shop-item-price {
  font-size: 13px; color: var(--text-muted); white-space: nowrap;
  margin-left: auto; margin-right: 4px;
}

.suggestion-linked {
  color: #28a745; font-size: 11px; margin-left: 4px;
}

.stock-badge {
  display: inline-block; font-size: 11px; padding: 1px 6px;
  border-radius: 8px; margin-left: 6px; font-weight: 500;
}

/* Alias chips in product edit */
#pe-aliases { display: flex; flex-wrap: wrap; gap: 6px; }
.alias-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 3px 10px; font-size: 12px; color: var(--text);
}
.alias-remove {
  cursor: pointer; opacity: 0.5; font-size: 10px; margin-left: 2px;
}
.alias-remove:hover { opacity: 1; color: #d9534f; }

.stock-available { background: #d4edda; color: #155724; }
.stock-partial { background: #fff3cd; color: #856404; }

/* ── Haushaltsbuch ──────────────────────────────────────────────── */

.household-month-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; font-weight: 600; font-size: 15px;
  color: var(--text-muted); margin-top: 8px;
}

.household-month-sum { font-size: 14px; color: var(--primary); }

.household-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; margin: 4px 0;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer; transition: transform var(--transition);
}

.household-card:hover { transform: translateY(-1px); }

.household-card-left { display: flex; flex-direction: column; gap: 2px; }
.household-card-date { font-size: 13px; color: var(--text-muted); }
.household-card-store { font-weight: 500; }
.household-card-buyer { font-size: 12px; color: var(--text-muted); }

.household-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.household-card-amount { font-weight: 600; font-size: 16px; }

.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: 10px; font-weight: 500;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }

.household-detail-meta { margin-bottom: 12px; }

.household-lines-table { overflow-x: auto; }

.household-lines-table table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}

.household-lines-table th, .household-lines-table td {
  padding: 6px 8px; text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.household-lines-table th { font-weight: 600; font-size: 12px; color: var(--text-muted); }

.household-lines-table input, .household-lines-table select {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: 4px; padding: 4px 6px; font-size: 13px; color: var(--text);
}

.receipt-upload-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 20px; border: 2px dashed var(--glass-border);
  border-radius: var(--radius); cursor: pointer;
  transition: all var(--transition); text-align: center;
}

.receipt-upload-zone:hover { border-color: var(--primary); background: var(--primary-bg, rgba(64,104,255,0.06)); }

.receipt-upload-icon { font-size: 40px; margin-bottom: 8px; }
.receipt-upload-text { font-weight: 600; font-size: 15px; color: var(--text); }
.receipt-upload-hint { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.receipt-upload-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0; color: var(--text-muted); font-size: 13px;
}

.receipt-upload-divider::before, .receipt-upload-divider::after {
  content: ''; flex: 1; border-top: 1px solid var(--glass-border);
}

.ocr-status-area { text-align: center; padding: 32px 20px; }

.line-unconfirmed { opacity: 0.7; background: rgba(255, 193, 7, 0.08); }

.ocr-hint {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  margin-bottom: 8px; border-radius: var(--radius-sm, 8px);
  background: rgba(255, 193, 7, 0.12); font-size: 13px; color: var(--text);
}

.ocr-hint.ocr-error { background: rgba(220, 53, 69, 0.12); color: #d9534f; }

.ocr-spinner {
  font-size: 13px; color: var(--text-muted);
  animation: ocr-pulse 1.2s ease-in-out infinite;
}

@keyframes ocr-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.product-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--card-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: 150px; overflow-y: auto;
}

.product-dropdown-item {
  padding: 8px 12px; cursor: pointer; font-size: 13px;
}

.product-dropdown-item:hover { background: var(--glass-bg); }

/* ── Haushaltsbuch Layout & Stats ──────────────────────────────── */

.household-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.household-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.household-stat-card {
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.household-stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid var(--glass-border);
}

.household-stat-highlight {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.household-stat-card-body {
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.household-stat-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.household-stat-bar-label {
  width: 72px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.household-stat-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(128, 128, 128, 0.12);
  border-radius: 4px;
  overflow: hidden;
}

.household-stat-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.4s ease;
}

.household-stat-bar.bar-current {
  background: linear-gradient(90deg, var(--primary), #6c8cff);
}

.household-stat-bar.bar-category {
  background: #f59e0b;
}

.household-stat-bar.bar-store {
  background: #10b981;
}

.household-stat-bar-value {
  width: 64px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  color: var(--text);
}

@media (max-width: 768px) {
  .household-layout {
    grid-template-columns: 1fr;
  }
  .household-stats {
    order: -1;
  }
}

/* ── Vorratskammer ──────────────────────────────────────────────── */

.pantry-tabs {
  display: flex; gap: 8px; padding: 8px 0; overflow-x: auto;
}

.pantry-tab {
  padding: 8px 16px; border-radius: 20px; border: 1px solid var(--glass-border);
  background: var(--glass-bg); cursor: pointer; font-size: 14px;
  white-space: nowrap; transition: all var(--transition);
}

.pantry-tab.active {
  background: var(--primary); color: white; border-color: var(--primary);
}

.pantry-category-header {
  padding: 10px 18px; font-weight: 600; font-size: 13px;
  color: var(--text-muted); margin-top: 8px;
}

.pantry-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; margin: 2px 0;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
}

.pantry-item-name { font-weight: 500; cursor: pointer; }
.pantry-item-name:hover { text-decoration: underline; }

.pantry-stock-controls {
  display: flex; align-items: center; gap: 8px;
}

.pantry-stock-controls .btn-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  font-size: 18px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}

.pantry-stock-value { font-weight: 500; min-width: 60px; text-align: center; }

/* ── Pantry Split-Layout ──────────────────────────────────────── */

.pantry-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 140px);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.pantry-list-side {
  width: 50%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--glass-border);
  overflow-y: auto;
}

.pantry-detail-side {
  width: 50%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px;
}

.pantry-detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pantry-item.active {
  background: rgba(64,104,255,0.1);
  border-color: var(--primary);
}

/* ── Pantry Modal + Barcode ─────────────────────────────────────── */

.pantry-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5); display: flex;
  align-items: center; justify-content: center;
}

.pantry-modal-overlay.hidden { display: none; }

.pantry-modal {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border-radius: var(--radius, 12px); color: var(--text);
  box-shadow: var(--shadow-lg); width: 90%; max-width: 440px;
  overflow: hidden;
}

.pantry-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--glass-border);
  color: var(--text);
}

.pantry-modal-header h3 { margin: 0; font-size: 16px; color: var(--text); }

.pantry-modal-body { padding: 16px 20px; color: var(--text); }

.pantry-modal-body input,
.pantry-modal-body select,
.pantry-modal-body textarea {
  background: var(--glass-bg); color: var(--text);
  border: 1px solid var(--glass-border); border-radius: var(--radius-sm, 8px);
  padding: 10px 14px; font-family: inherit; font-size: 14px;
  width: 100%; box-sizing: border-box;
}

.pantry-modal-body input::placeholder { color: var(--text-secondary); }

.pantry-modal-body input:focus,
.pantry-modal-body select:focus {
  outline: none; border-color: var(--primary-light, var(--primary));
}

.pantry-modal-body label { color: var(--text); }

.pantry-modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 20px; border-top: 1px solid var(--glass-border);
}

.pantry-product-row { display: flex; gap: 8px; align-items: flex-start; }

.pantry-product-input-wrap { flex: 1; position: relative; }

.pantry-product-input-wrap input { width: 100%; }

.stock-suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
  background: var(--glass-bg-solid); border: 1px solid var(--glass-border);
  border-radius: 0 0 var(--radius, 8px) var(--radius, 8px);
  box-shadow: var(--shadow-lg); max-height: 200px; overflow-y: auto;
  color: var(--text);
}

.stock-suggestions.hidden { display: none; }

.stock-suggestion-item {
  padding: 8px 12px; cursor: pointer; font-size: 14px;
  border-bottom: 1px solid var(--glass-border); color: var(--text);
}

.stock-suggestion-item:hover { background: var(--glass-hover); }

.stock-suggestion-item .text-muted { color: var(--text-muted, #999); font-size: 12px; }

.stock-suggestion-create { color: var(--primary, #4068FF); font-weight: 500; }

/* Barcode Scanner */
#barcode-overlay { z-index: 1100; }

.barcode-scanner {
  background: #000; border-radius: var(--radius, 12px); overflow: hidden;
  width: 90%; max-width: 440px;
}

.barcode-scanner-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: rgba(255,255,255,0.1);
}

.barcode-scanner-header h3 { margin: 0; color: #fff; font-size: 15px; }
.barcode-scanner-header .btn-icon { color: #fff; font-size: 22px; }

#barcode-video { width: 100%; display: block; }

.barcode-hint {
  text-align: center; padding: 10px; color: rgba(255,255,255,0.7);
  font-size: 13px;
}

/* ── Quick Scan Modal ────────────────────────────────────────────── */
.quick-scan-modal {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border-radius: var(--radius, 12px); color: var(--text);
  box-shadow: var(--shadow-lg); width: 95%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column;
}

.quick-scan-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--glass-border);
}
.quick-scan-header h3 { margin: 0; font-size: 16px; color: var(--text); }
.quick-scan-header .btn-icon { font-size: 22px; }

.quick-scan-video-wrap {
  background: #000; position: relative;
}
.quick-scan-video-wrap.hidden { display: none; }
#quick-scan-video { width: 100%; display: block; max-height: 240px; object-fit: cover; }

.quick-scan-status {
  padding: 10px 20px; font-weight: 500; font-size: 14px;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text);
}
.quick-scan-status.hidden { display: none; }
.quick-scan-status-success {
  background: rgba(40, 167, 69, 0.15); color: #28a745;
}
.quick-scan-status-new {
  background: rgba(255, 193, 7, 0.15); color: #e0a800;
}

.quick-scan-step.hidden { display: none; }

.quick-scan-step-header {
  padding: 12px 20px; font-weight: 600; font-size: 14px;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text); background: var(--glass-hover, rgba(255,255,255,0.03));
}

.quick-scan-form {
  padding: 12px 20px 16px;
}
.quick-scan-form .form-group { margin-bottom: 10px; }
.quick-scan-form label {
  display: block; font-size: 12px; font-weight: 500;
  margin-bottom: 4px; color: var(--text-secondary);
}
.quick-scan-form input,
.quick-scan-form select {
  background: var(--glass-bg); color: var(--text);
  border: 1px solid var(--glass-border); border-radius: var(--radius-sm, 8px);
  padding: 9px 12px; font-family: inherit; font-size: 14px;
  width: 100%; box-sizing: border-box;
}
.quick-scan-form input:focus,
.quick-scan-form select:focus {
  outline: none; border-color: var(--primary-light, var(--primary));
}
.quick-scan-form input[readonly] {
  opacity: 0.7; cursor: default;
}
.quick-scan-form input::placeholder { color: var(--text-secondary); }

.quick-scan-product-display {
  padding: 10px 14px; margin-bottom: 12px;
  background: rgba(40, 167, 69, 0.1); border: 1px solid rgba(40, 167, 69, 0.3);
  border-radius: var(--radius-sm, 8px); font-weight: 600; font-size: 15px;
  color: var(--text);
}

/* ── Photos ──────────────────────────────────────────────────────── */
.photos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.photo-card {
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  cursor: pointer; transition: all 0.3s ease;
  position: relative;
}

.photo-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.photo-card img {
  width: 100%; height: 180px; object-fit: cover; display: block;
}

.photo-card .photo-overlay {
  position: absolute; top: 6px; right: 6px; display: none;
}

.photo-card:hover .photo-overlay { display: flex; gap: 4px; }

.photo-card .photo-caption {
  padding: 10px 12px; font-size: 12px; color: var(--text-secondary);
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  display: none; align-items: center; justify-content: center;
  z-index: 2000;
}

.lightbox.active { display: flex; }

.lightbox img {
  max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: 8px;
}

.lightbox-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: none; color: white; font-size: 28px;
  cursor: pointer; z-index: 10;
}

.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.15);
  color: white;
  font-size: 24px; padding: 12px 16px; cursor: pointer; border-radius: 12px;
  transition: all var(--transition);
}

.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-caption { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: white; font-size: 14px; text-align: center; }

/* ── Screensaver ─────────────────────────────────────────────────── */
.screensaver-overlay {
  position: fixed; inset: 0; background: #000;
  display: none; align-items: center; justify-content: center;
  z-index: 3000; cursor: pointer;
}

.screensaver-overlay.active { display: flex; }

.screensaver-overlay img {
  max-width: 100vw; max-height: 100vh; object-fit: contain;
  transition: opacity 0.5s ease;
}

.screensaver-caption {
  position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.7); font-size: 16px; text-align: center;
}

/* Ken Burns animations for grid screensaver */
.screensaver-grid-cell img { transition: opacity 0.4s ease; }
@keyframes kenBurns1 {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.2) translate(-3%, -2%); }
}
@keyframes kenBurns2 {
  0% { transform: scale(1.1) translate(2%, 1%); }
  100% { transform: scale(1) translate(-1%, 2%); }
}
@keyframes kenBurns3 {
  0% { transform: scale(1) translate(1%, 2%); }
  100% { transform: scale(1.15) translate(2%, -3%); }
}
@keyframes kenBurns4 {
  0% { transform: scale(1.15) translate(-2%, -1%); }
  100% { transform: scale(1.05) translate(1%, 3%); }
}

/* ── Settings (Glass Admin Style) ────────────────────────────────── */
.settings-content {
  max-width: 100%;
}

.settings-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
}

.settings-nav-card {
  position: sticky;
  top: 28px;
  height: fit-content;
}

.settings-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.settings-nav-item {
  margin-bottom: 4px;
}

.settings-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.settings-nav-link:hover {
  background: var(--glass-hover);
  color: var(--text);
}

.settings-nav-link.active {
  background: var(--primary-bg);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  padding-left: 15px;
}

.settings-nav-link .nav-icon {
  font-size: 18px;
  opacity: 0.7;
}

.settings-nav-link.active .nav-icon,
.settings-nav-link:hover .nav-icon {
  opacity: 1;
}

.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
  animation: settingsFadeIn 0.3s ease;
}

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

/* Mobile Settings Tab Bar (visible when sidebar nav is hidden) */
.settings-mobile-tabs {
  display: none;
  overflow-x: auto;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  scrollbar-width: none;
}

.settings-mobile-tabs::-webkit-scrollbar { display: none; }

.settings-mobile-tab {
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  border: none;
  background: none;
}

.settings-mobile-tab:hover {
  background: var(--glass-hover);
  color: var(--text);
}

.settings-mobile-tab.active {
  background: var(--primary-bg);
  color: var(--primary);
}

.settings-card { padding: 24px; margin-bottom: 20px; }

/* ── Users Table (Synology-Style) ─────────────────────────────── */
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.users-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.users-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.users-table tbody tr:hover {
  background: var(--bg-hover);
}
.users-table td {
  padding: 10px;
  vertical-align: middle;
}
.user-avatar {
  font-size: 22px;
  text-align: center;
  width: 40px;
}
.user-name {
  font-weight: 600;
}
.user-role-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.role-admin { background: var(--primary-bg); color: var(--primary); }
.role-parent { background: var(--success-bg); color: var(--success); }
.role-child { background: rgba(234, 179, 8, 0.15); color: var(--warning); }
.user-actions {
  display: flex;
  gap: 4px;
}

/* Perm Groups in Edit Modal */
.perm-group {
  margin-bottom: 12px;
}
.perm-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.perm-group-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.perm-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--glass-bg);
  cursor: pointer;
  transition: background var(--transition);
}
.perm-checkbox:hover {
  background: var(--bg-hover);
}
.perm-checkbox input[type="checkbox"] {
  width: 13px;
  height: 13px;
}

/* Responsive: Cards layout under 600px */
@media (max-width: 600px) {
  .users-table,
  .users-table thead,
  .users-table tbody,
  .users-table tr,
  .users-table td {
    display: block;
  }
  .users-table thead { display: none; }
  .users-table tbody tr {
    background: var(--glass-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .users-table td { padding: 0; border: none; }
  .user-avatar { width: auto; font-size: 28px; }
  .user-name { flex: 1; font-size: 14px; }
  .user-actions { margin-left: auto; }
}

.settings-section {
  margin-bottom: 28px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
}

.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
}

.settings-row:last-child { border-bottom: none; }

.settings-label { font-size: 14px; font-weight: 500; }

.settings-label-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle Switch (Glass) */
.toggle-switch {
  position: relative; display: inline-block;
  width: 50px; height: 26px; cursor: pointer;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute; inset: 0;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  transition: all var(--transition);
}

.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: var(--text-secondary); border-radius: 50%;
  transition: all var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-color: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
  background: white;
}

/* ── Members Grid (Family) ──────────────────────────────────────── */
.members-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px;
}

.member-card {
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; text-align: center; position: relative;
  transition: all 0.3s ease;
}

.member-card:hover {
  background: var(--glass-hover);
  transform: translateY(-2px);
}

.member-card .member-emoji { font-size: 56px; margin-bottom: 8px; }
.member-card .member-emoji img { width: 56px !important; height: 56px !important; }
.member-card .member-name { font-size: 15px; font-weight: 600; }

.member-card .member-color {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-top: 6px;
  box-shadow: 0 0 8px currentColor;
}

.member-card .member-delete { position: absolute; top: 8px; right: 8px; }
.member-card .member-edit { position: absolute; top: 8px; left: 8px; }

/* ── Notification Overlay ────────────────────────────────────────── */
.notification-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 4000;
}
.notification-overlay.active { display: flex; }
.notification-overlay #confetti-canvas {
  position: absolute; inset: 0;
  pointer-events: none; display: none;
}
.notification-card {
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 36px;
  max-width: 400px; width: 90%;
  text-align: center;
  animation: notifPop 0.3s ease;
  position: relative; z-index: 1;
}

.notification-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

@keyframes notifPop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.notification-icon {
  width: 60px; height: 60px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin: 0 auto 16px; color: #fff;
}
.notification-title { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.notification-time { font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; }
.notification-member { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.notification-notes {
  font-size: 12px; color: var(--text-secondary);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px; margin: 10px 0; text-align: left;
}
.notification-dismiss { margin-top: 16px; width: 100%; padding: 14px; font-size: 15px; }
.notification-birthday-name { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.notification-birthday-age { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.notification-wish { font-size: 15px; color: var(--warning); margin-bottom: 8px; }

/* Checkbox Label for Event Modal */
.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer; padding: 4px 0;
}
.checkbox-label input { accent-color: var(--primary); width: 16px; height: 16px; }

/* ── Contacts (Split Layout) ────────────────────────────────────── */
#page-contacts.active {
  position: fixed;
  top: 0; left: var(--sidebar-width); right: 0; bottom: 0;
  padding: 0; margin: 0; z-index: 50;
}
.contacts-layout {
  display: flex; height: 100%;
  border-radius: 0; overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.contacts-sidebar {
  width: 38%; min-width: 300px; max-width: 440px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--glass-border);
}
.contacts-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
}
.contacts-sidebar-header h3 { margin: 0; font-size: 20px; font-weight: 700; }
.contacts-sidebar-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--glass-border);
}
.contacts-sidebar-search input {
  width: 100%; padding: 8px 14px; border-radius: 20px;
  border: 1px solid var(--glass-border); background: var(--bg);
  color: var(--text); font-size: 13px; outline: none; box-sizing: border-box;
}
.contacts-sidebar-search input:focus { border-color: var(--primary); }
.contacts-sidebar-list {
  flex: 1; overflow-y: auto; padding: 0;
  scrollbar-width: thin; scrollbar-color: var(--glass-border) transparent;
}
.contacts-section-title {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 12px 16px 6px; margin: 0;
}
.contact-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(128,128,128,0.08);
}
.contact-list-item:hover { background: var(--glass-hover); }
.contact-list-item.active { background: var(--glass-hover); }
.contact-list-item .contact-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.contact-list-item-info { flex: 1; min-width: 0; }
.contact-list-item-name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-list-item-sub {
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-list-item.birthday-today {
  border-left: 3px solid var(--warning);
}

/* Detail-Bereich */
.contacts-detail {
  flex: 1; display: flex; flex-direction: column;
  overflow-y: auto;
}
.contacts-detail-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.contact-detail-view { padding: 32px; animation: fadeInUp 0.2s ease-out; }
.contact-detail-header {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid var(--glass-border);
}
.contact-detail-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; flex-shrink: 0;
}
.contact-detail-name { font-size: 24px; font-weight: 700; }
.contact-detail-actions { margin-left: auto; display: flex; gap: 8px; }
.contact-detail-fields { display: flex; flex-direction: column; gap: 16px; }
.contact-detail-field {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.contact-detail-field-icon {
  font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; padding-top: 2px;
}
.contact-detail-field-content { flex: 1; }
.contact-detail-field-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px;
}
.contact-detail-field-value { font-size: 15px; color: var(--text); }
.contact-detail-field-value a { color: var(--primary-light); text-decoration: none; }
.contact-detail-field-value a:hover { text-decoration: underline; }

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes star-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.star-animate { animation: star-pop 0.4s ease; }

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

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

.fade-in { animation: fadeIn 0.3s ease; }

@keyframes checkPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.check-animate { animation: checkPop 0.3s ease; }

/* ── Empty States ────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 32px 20px; color: var(--text-muted); font-size: 13px;
}

.empty-state .empty-icon { font-size: 36px; margin-bottom: 8px; }

/* ── Emoji Picker ────────────────────────────────────────────────── */
.emoji-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
}

.emoji-opt {
  font-size: 24px; cursor: pointer; padding: 4px; border-radius: 8px;
  border: 2px solid transparent; transition: all var(--transition);
  line-height: 1;
}

.emoji-opt:hover { border-color: var(--text-faint); background: var(--glass-hover); }
.emoji-opt.selected { border-color: var(--primary); background: var(--primary-bg); }

/* ── Child Dashboard ─────────────────────────────────────────────── */
.child-dashboard {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px;
}

.child-dashboard-header {
  display: flex; align-items: center; gap: 16px;
  padding: 24px;
  margin-bottom: 20px;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow); flex-wrap: wrap;
}

.child-avatar { flex-shrink: 0; }
.child-greeting { flex: 1; }
.child-greeting h2 { font-size: 20px; font-weight: 700; }

.child-stars-display {
  font-family: 'Space Mono', monospace;
  font-size: 24px; font-weight: 700; color: var(--star-color);
  display: flex; align-items: center; gap: 6px;
}

.child-dashboard-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

.child-card-wide { grid-column: 1 / -1; }

.child-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 13px;
  border-bottom: 1px solid var(--border-light);
}

.child-item:last-child { border-bottom: none; }

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

.child-item-stars {
  margin-left: auto; color: var(--star-color); font-size: 12px; font-weight: 600;
  font-family: 'Space Mono', monospace;
}

/* ── Admin Dashboard ─────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 0 4px;
}

.dashboard-card .card-header h3 { font-size: 14px; }
.dashboard-card .card-header { display: flex; align-items: center; justify-content: space-between; }
.dashboard-card[draggable="true"] { cursor: grab; transition: transform 0.15s, box-shadow 0.15s; }
.dashboard-card[draggable="true"]:active { cursor: grabbing; }
.dashboard-card.drag-over { outline: 2px dashed var(--accent); outline-offset: 2px; transform: scale(1.02); }
.dashboard-customize-card { border: 2px dashed var(--border-light); }

/* Widget Sizes */
.dashboard-card-small { grid-column: span 1; }
.dashboard-card-medium { grid-column: span 2; }
.dashboard-card-large { grid-column: span 2; grid-row: span 2; }
.dashboard-card-large .card-header h3 { font-size: 16px; }

.dashboard-resize-btn {
  width: 24px; height: 24px; border: none; background: transparent;
  cursor: pointer; color: var(--text-muted); font-size: 14px;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0;
}
.dashboard-resize-btn:hover { background: var(--glass-hover); color: var(--text); }

.dashboard-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 13px;
  border-bottom: 1px solid var(--border-light);
}
.dashboard-item:last-child { border-bottom: none; }
.dashboard-item-done { opacity: 0.5; }
.dashboard-item-done .dashboard-item-title { text-decoration: line-through; }

.dashboard-item-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dashboard-item-time {
  font-family: 'Space Mono', monospace;
  font-size: 12px; color: var(--text-muted); font-weight: 500; min-width: 40px;
}
.dashboard-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-item-stars {
  color: var(--star-color); font-size: 12px; font-weight: 600; white-space: nowrap;
  font-family: 'Space Mono', monospace;
}
.dashboard-item-meta {
  font-size: 11px; color: var(--text-muted); white-space: nowrap;
}

.dashboard-member-badge {
  font-size: 10px; color: #fff; padding: 2px 8px; border-radius: 10px;
  white-space: nowrap; flex-shrink: 0;
}

.dashboard-meal-img {
  width: 32px; height: 32px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}

.dashboard-stat {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 12px; justify-content: center;
}
.dashboard-stat-icon { font-size: 28px; }
.dashboard-stat-number {
  font-family: 'Space Mono', monospace;
  font-size: 28px; font-weight: 700; color: var(--primary);
}
.dashboard-stat-label { font-size: 13px; color: var(--text-muted); }

/* ── Kinder-Dashboard Farben ─────────────────────────────────────── */
.child-dashboard[data-child-theme="babyblue"] {
  --child-bg: rgba(66, 165, 245, 0.08);
  --child-border: rgba(66, 165, 245, 0.3);
  --child-accent: #42A5F5;
  --child-card-bg: var(--glass-bg);
}
.child-dashboard[data-child-theme="rosa"] {
  --child-bg: rgba(236, 64, 122, 0.08);
  --child-border: rgba(236, 64, 122, 0.3);
  --child-accent: #EC407A;
  --child-card-bg: var(--glass-bg);
}

.child-dashboard[data-child-theme] {
  background: var(--child-bg);
}
.child-dashboard[data-child-theme] .child-dashboard-header {
  background: var(--child-card-bg);
  border: 1px solid var(--child-border);
}
.child-dashboard[data-child-theme] .child-card {
  background: var(--child-card-bg);
  border: 1px solid var(--child-border);
}
.child-dashboard[data-child-theme] .child-card .card-header h3 {
  color: var(--child-accent);
}

/* ── Sidebar Drag Reorder ────────────────────────────────────────── */
.sidebar-dragging {
  opacity: 0.7;
  background: var(--primary-bg) !important;
  box-shadow: var(--shadow-md);
  z-index: 10;
}
.sidebar-drag-placeholder {
  background: var(--primary-bg);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-sm);
  margin: 2px 0;
  opacity: 0.5;
}

/* ── Chat (WhatsApp-Style Layout) ─────────────────────────────── */
#page-chat.active {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  padding: 0;
  margin: 0;
  z-index: 50;
}
.chat-layout {
  display: flex;
  height: 100%;
  border-radius: 0;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ── Chat Sidebar (1/3) ──────────────────────────────────────── */
.chat-sidebar {
  width: 33%; min-width: 260px; max-width: 380px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--glass-border);
  background: var(--glass-bg);
}
.chat-sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
}
.chat-sidebar-header h3 {
  margin: 0; font-size: 20px; font-weight: 700;
}
.chat-sidebar-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--glass-border);
}
.chat-sidebar-search input {
  width: 100%; padding: 8px 14px; border-radius: 20px;
  border: 1px solid var(--glass-border); background: var(--bg);
  color: var(--text); font-size: 13px; outline: none;
  box-sizing: border-box;
}
.chat-sidebar-search input:focus { border-color: var(--primary); }
.chat-sidebar-list {
  flex: 1; overflow-y: auto;
}
.chat-sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(128,128,128,0.08);
}
.chat-sidebar-item:hover { background: var(--glass-hover); }
.chat-sidebar-item.active { background: var(--glass-hover); }
.chat-sidebar-item.chat-item-hidden { opacity: 0.45; font-style: italic; }
.chat-sidebar-item-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white; flex-shrink: 0;
  overflow: hidden;
}
.chat-sidebar-item-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.chat-sidebar-item-info {
  flex: 1; min-width: 0;
}
.chat-sidebar-item-name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-sidebar-item-preview {
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.chat-sidebar-item-time {
  font-size: 11px; color: var(--text-muted); flex-shrink: 0;
}

/* ── Chat Main (2/3) ─────────────────────────────────────────── */
.chat-main {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0;
}
.chat-main-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
}
.chat-back-btn {
  display: none; background: none; border: none;
  font-size: 18px; cursor: pointer; color: var(--text);
  padding: 4px 8px;
}
.chat-main-header-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; background: var(--primary); color: white;
  flex-shrink: 0; overflow: hidden;
}
.chat-main-header-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.chat-main-header-info { flex: 1; min-width: 0; }
.chat-main-header-name { font-size: 16px; font-weight: 600; }
.chat-main-header-status { font-size: 12px; color: var(--text-muted); }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px 24px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-bubble-wrapper {
  display: flex; gap: 8px; max-width: 65%; animation: fadeSlideIn 0.2s ease;
}
.chat-bubble-wrapper.chat-own {
  align-self: flex-end; flex-direction: row-reverse;
}
.chat-bubble-wrapper.chat-other {
  align-self: flex-start;
}
.chat-avatar {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 14px; color: white; flex-shrink: 0;
  margin-top: 2px;
}
.chat-bubble {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: 12px 12px 12px 4px; padding: 8px 12px;
  max-width: 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.chat-own .chat-bubble {
  background: var(--primary); color: white; border-color: transparent;
  border-radius: 12px 12px 4px 12px;
}
.chat-own .chat-bubble .chat-time { color: rgba(255,255,255,0.7); }
.chat-sender { font-size: 11px; font-weight: 600; margin-bottom: 2px; }
.chat-text { font-size: 14px; line-height: 1.5; word-break: break-word; }
.chat-time { font-size: 10px; color: var(--text-muted); text-align: right; margin-top: 4px; }
.chat-deleted-text { font-style: italic; opacity: 0.5; font-size: 13px; }
.chat-context-backdrop {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 8999;
}
.chat-context-menu {
  position: fixed; z-index: 9000;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border); border-radius: 10px;
  box-shadow: var(--shadow-lg); overflow: hidden; min-width: 160px;
  animation: fadeInUp 0.15s ease;
}
.chat-context-menu-item {
  padding: 10px 16px; cursor: pointer; font-size: 14px;
  transition: background 0.1s;
}
.chat-context-menu-item:hover { background: var(--glass-hover); }
.chat-context-menu-item:not(:last-child) { border-bottom: 1px solid var(--glass-border); }
.chat-editing .chat-bubble { outline: 2px solid var(--primary); outline-offset: 2px; }
.chat-highlighted .chat-bubble { animation: chatHighlight 3s ease; }
@keyframes chatHighlight {
  0%, 20% { background: var(--primary-bg); }
  100% { background: var(--glass-bg); }
}
.chat-own.chat-highlighted .chat-bubble {
  animation: chatHighlightOwn 3s ease;
}
@keyframes chatHighlightOwn {
  0%, 20% { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}
.chat-image img {
  max-width: 300px; max-height: 240px; border-radius: 8px; cursor: pointer;
  object-fit: cover; display: block;
}
.chat-voice audio { max-width: 260px; height: 36px; }
.chat-file a { text-decoration: none; }
.chat-input-bar {
  display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px;
  border-top: 1px solid var(--glass-border); background: var(--glass-bg-solid);
}
.chat-input-wrapper {
  flex: 1; display: flex; align-items: center;
  background: var(--bg); border: 1px solid var(--glass-border);
  border-radius: 24px; padding: 4px 6px 4px 16px; gap: 2px;
  min-height: 42px;
}
.chat-text-input {
  flex: 1; border: none; background: none;
  font-size: 15px; color: var(--text); outline: none;
  padding: 6px 0; min-width: 0;
}
.chat-text-input::placeholder { color: var(--text-muted); }
.chat-input-icon {
  background: none; border: none; cursor: pointer;
  font-size: 20px; padding: 4px 6px; flex-shrink: 0;
  opacity: 0.6; transition: opacity 0.15s;
}
.chat-input-icon:hover { opacity: 1; }
.chat-action-btn {
  width: 46px; height: 46px; border-radius: 50%; border: none;
  background: var(--primary); color: white; font-size: 20px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s, transform 0.1s;
}
.chat-action-btn:hover { filter: brightness(1.1); }
.chat-action-btn:active { transform: scale(0.95); }
.chat-action-btn.recording { background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.chat-action-btn.send-mode { background: var(--primary); }

/* Anhang-Panel */
.chat-attach-panel {
  border-top: 1px solid var(--glass-border);
  background: var(--glass-bg-solid);
  padding: 16px; animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.chat-attach-grid {
  display: flex; justify-content: center; gap: 24px; flex-wrap: wrap;
}
.chat-attach-option {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer;
}
.chat-attach-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: white; transition: transform 0.15s;
}
.chat-attach-option:hover .chat-attach-icon { transform: scale(1.1); }
.chat-attach-option span { font-size: 12px; color: var(--text-muted); }
.chat-attach-btn, .chat-voice-btn { font-size: 20px; background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-muted); transition: color 0.15s; }
.chat-attach-btn:hover, .chat-voice-btn:hover { color: var(--primary); }
.chat-voice-btn.recording { color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.chat-load-more { align-self: center; margin: 8px 0; }

/* Chat Badge */
.chat-badge {
  position: absolute; top: 2px; right: 2px; background: var(--danger);
  color: white; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.nav-item { position: relative; }

/* ── Touch Long-Press ────────────────────────────────────────────── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (pointer: coarse) {
  .task-actions, .reward-actions, .contact-card-actions,
  .shop-delete, .recipe-card-actions {
    display: none !important;
  }
  .longpress-active .task-actions,
  .longpress-active .reward-actions,
  .longpress-active .contact-card-actions,
  .longpress-active .shop-delete,
  .longpress-active .recipe-card-actions {
    display: flex !important;
    animation: fadeSlideIn 0.2s ease;
  }
}

/* Recipe card actions (on card) */
.recipe-card-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 4px;
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 4px;
  opacity: 0; transition: opacity var(--transition);
}
.recipe-card-full { position: relative; }
.recipe-card-full:hover .recipe-card-actions { opacity: 1; }

/* ── Global Search ──────────────────────────────────────────────── */
.search-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 15vh; z-index: 5000;
}
.search-modal {
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 90%; max-width: 540px;
  overflow: hidden;
}
.search-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--glass-border);
}
.search-icon { font-size: 18px; color: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; background: none; outline: none;
  font-family: inherit; font-size: 16px; color: var(--text);
}
.search-input::placeholder { color: var(--text-faint); }
.search-kbd {
  font-family: 'Space Mono', monospace;
  font-size: 10px; background: var(--glass-bg); padding: 3px 8px;
  border-radius: 6px; border: 1px solid var(--glass-border);
  color: var(--text-muted);
}
.search-results {
  max-height: 400px; overflow-y: auto; padding: 8px;
}
.search-hint {
  padding: 24px; text-align: center; font-size: 13px; color: var(--text-muted);
}
.search-group-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; padding: 8px 8px 4px;
  letter-spacing: 1px;
}
.search-result-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--transition);
}
.search-result-item:hover, .search-result-item.active {
  background: var(--primary-bg);
}
.search-result-title { flex: 1; font-size: 14px; }
.search-result-title mark { background: var(--warning); color: var(--text); border-radius: 2px; padding: 0 2px; }
.search-result-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── Toast Notifications ────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column-reverse; gap: 8px;
  z-index: 6000; max-width: 400px;
}
@media (max-width: 480px) {
  .toast-container { bottom: 64px; right: 8px; left: 8px; max-width: none; }
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-radius: var(--radius-sm);
  background: var(--glass-bg-solid);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  font-size: 13px; color: var(--text);
  animation: toastSlideIn 0.3s ease;
}
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-message { flex: 1; }
.toast-undo, .toast-action {
  background: none; border: none; color: var(--primary-light);
  font-weight: 600; font-size: 12px; cursor: pointer;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
}
.toast-undo:hover, .toast-action:hover { background: var(--primary-bg); }
.toast-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 2px 4px; font-size: 14px;
}
.toast-exit { animation: toastSlideOut 0.3s ease forwards; }
@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ── Star Confetti Animation ────────────────────────────────────── */
@keyframes starFloat {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-120px) rotate(360deg); opacity: 0; }
}
.star-confetti {
  position: fixed; pointer-events: none; z-index: 7000;
  font-size: 20px; animation: starFloat 1s ease-out forwards;
}

/* ── Responsive ──────────────────────────────────────────────────── */

body { overflow-x: hidden; }
.main-content { overflow-x: hidden; }

/* Grosse Bildschirme */
@media (min-width: 1400px) {
  .calendar-day { min-height: 110px; }
}

@media (max-width: 1100px) {
  .rewards-layout { grid-template-columns: 1fr 1fr; }
  .rewards-completed-card { grid-column: 1 / -1; }
  .settings-grid { grid-template-columns: 200px 1fr; }
}

/* Tablet Portrait */
@media (max-width: 900px) {
  .meals-grid { grid-template-columns: 60px repeat(7, 1fr); }
  .calendar-day { min-height: 70px; padding: 4px; }
  .recipes-grid-full { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .rewards-layout { grid-template-columns: 1fr; }
  .meals-header, .week-day-header { font-size: 10px; }
  .dashboard-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-card-large { grid-column: span 2; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav-card { display: none; }
  .settings-mobile-tabs { display: flex; }
}

/* Mobil */
@media (max-width: 768px) {
  .sidebar { width: 52px; overflow: hidden; }
  .sidebar-header h1, .nav-label { display: none; }
  .sidebar-header { justify-content: center; padding: 12px 6px; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-icon { font-size: 20px; }
  .main-content { margin-left: 52px; width: calc(100% - 52px); padding: 10px; }
  #page-chat.active, #page-contacts.active { left: 52px; }
  .page-header h2 { font-size: 18px; }
  .header-actions { flex-wrap: wrap; }
  .calendar-grid, .meals-grid { font-size: 11px; }
  .calendar-day { min-height: 60px; padding: 3px; }
  .calendar-event { font-size: 10px; }
  .calendar-nav { flex-wrap: wrap; gap: 4px; }
  .meals-grid {
    grid-template-columns: 55px repeat(7, 1fr);
    overflow-x: auto;
  }
  .meals-grid > * { min-width: 0; }
  .photos-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .contacts-sidebar { max-width: 360px; }
  .view-toggle { display: none; }
  .recipes-grid-full { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .calendar-event, .meal-entry, .week-event { max-width: 60px; }
  .child-dashboard-grid { grid-template-columns: 1fr; }
  .child-dashboard { padding: 14px; }
  .modal { width: min(95vw, 500px); max-height: 90vh; }
  .task-card { padding: 10px 12px; gap: 8px; }
  .task-meta { flex-wrap: wrap; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-card-large { grid-column: span 2; }
  .day-hour-label { width: 40px; font-size: 10px; padding: 4px; }
  .calendar-week-grid { grid-template-columns: 40px repeat(7, 1fr); }
}

/* Zwischen-Breakpoint für große Phones / kleine Tablets */
@media (max-width: 600px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-card-small, .dashboard-card-medium, .dashboard-card-large { grid-column: span 1; grid-row: span 1; }
  .modal { width: min(95vw, 420px); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .photos-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .recipes-grid-full { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  #page-contacts.active { left: 0; bottom: 56px; }
  .contacts-sidebar { width: 100%; max-width: none; min-width: 0; border-right: none; }
  .contacts-detail { display: none; }
  .contacts-layout.show-detail .contacts-sidebar { display: none; }
  .contacts-layout.show-detail .contacts-detail { display: flex; }
  .pantry-layout { flex-direction: column; height: auto; }
  .pantry-list-side { width: 100%; border-right: none; border-bottom: 1px solid var(--glass-border); }
  .pantry-detail-side { width: 100%; display: none; }
  .pantry-layout.show-detail .pantry-list-side { display: none; }
  .pantry-layout.show-detail .pantry-detail-side { display: flex; }
  .calendar-event, .meal-entry, .week-event { max-width: 50px; font-size: 10px; }
  .page-header h2 { font-size: 16px; }
  .header-actions { gap: 4px; flex-wrap: wrap; }
}

/* Sidebar-Tooltips bei Icon-only Mode */
@media (min-width: 481px) and (max-width: 768px) {
  .nav-item { position: relative; }
  .nav-item:hover .nav-label,
  .nav-item:focus .nav-label {
    display: block !important;
    position: absolute;
    left: 52px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--glass-bg-solid);
    border: 1px solid var(--glass-border);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }
}

/* Touch-Target-Optimierung */
@media (pointer: coarse) {
  .btn, .nav-item, .task-card, .shopping-item, .filter-select,
  .settings-mobile-tab, .calendar-day, .recipe-card {
    min-height: 44px;
  }
  .nav-item { min-height: 44px; display: flex; align-items: center; }
  .shopping-item { min-height: 44px; display: flex; align-items: center; }
}

/* Kleine Phones / Bottom Navigation */
@media (max-width: 480px) {
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    width: 100% !important; height: 56px;
    flex-direction: row;
    border-right: none; border-top: 1px solid var(--glass-border);
    z-index: 200;
    backdrop-filter: blur(20px);
  }
  .sidebar-header, .sidebar-footer, .sidebar-spacer { display: none; }
  .sidebar-nav {
    flex-direction: row; padding: 0; gap: 0;
    overflow-x: auto; align-items: center;
    justify-content: space-around; width: 100%;
  }
  .nav-item {
    flex-direction: column; padding: 6px 4px; gap: 2px;
    min-width: 0; flex-shrink: 0;
  }
  .nav-icon { font-size: 18px; width: auto; }
  .nav-label { display: block !important; font-size: 9px; line-height: 1; }
  .main-content {
    margin-left: 0 !important; margin-bottom: 56px;
    width: 100% !important; padding: 8px; max-width: 100vw;
  }
  .profile-username { display: none; }
  .profile-floating { top: 6px; right: 8px; }
  .calendar-event { max-width: 45px; font-size: 9px; }
  .modal { width: 95%; max-width: none; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .shopping-add-bar { border-radius: 16px; padding: 4px 12px; }
  .page-header { gap: 8px; }
  .page-header h2 { font-size: 16px; }
  .header-actions { gap: 4px; flex-wrap: wrap; }
  .btn { padding: 8px 12px; font-size: 12px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  #page-chat.active { left: 0; bottom: 56px; }
  .chat-layout { height: 100%; flex-direction: column; }
  .chat-sidebar { width: 100%; max-width: none; min-width: 0; border-right: none; border-bottom: 1px solid var(--glass-border); }
  .chat-main { display: none; flex-direction: column; height: 100%; }
  .chat-layout.chat-show-main .chat-sidebar { display: none; }
  .chat-layout.chat-show-main .chat-main { display: flex; }
  .chat-layout.chat-show-main .chat-back-btn { display: block; }
  .chat-input-bar { position: static; flex-shrink: 0; padding: 8px 12px; }
  .chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 10px; }
  .chat-bubble-wrapper { max-width: 85%; }
  .chat-image img { max-width: 100%; max-height: 200px; }
  .chat-voice audio { max-width: 100%; }
  .chat-bubble { max-width: 100%; overflow: hidden; word-break: break-word; }
  .chat-main-header { padding: 10px 12px; }
  .meals-grid {
    grid-template-columns: 45px repeat(7, 1fr);
    font-size: 10px;
  }
  .recipes-grid-full { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  #page-contacts.active { left: 0; bottom: 56px; }
  .contacts-sidebar { width: 100%; max-width: none; min-width: 0; border-right: none; }
  .contacts-detail { display: none; }
  .contacts-layout.show-detail .contacts-sidebar { display: none; }
  .contacts-layout.show-detail .contacts-detail { display: flex; }
  .pantry-layout { flex-direction: column; height: auto; }
  .pantry-list-side { width: 100%; border-right: none; border-bottom: 1px solid var(--glass-border); }
  .pantry-detail-side { width: 100%; display: none; }
  .pantry-layout.show-detail .pantry-list-side { display: none; }
  .pantry-layout.show-detail .pantry-detail-side { display: flex; }
  .shopping-item { padding: 10px 12px; }
  .child-dashboard-header {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  .child-greeting h2 { font-size: 16px; }
  .child-stars-display { font-size: 20px; }
  .child-card { padding: 12px; }
  .child-item { font-size: 12px; padding: 6px 10px; }
  .settings-content { max-width: 100%; }
  .settings-row { flex-wrap: wrap; }
  .theme-picker { flex-wrap: wrap; gap: 8px; }
  .members-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .member-card { padding: 14px; }
  .calendar-day { min-height: 40px; }
}

/* ── Backdrop-Filter Fallback ────────────────────────────────────── */
/* Solidere Hintergründe wenn backdrop-filter nicht unterstützt wird  */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card, .modal, .sidebar, .login-card, .profile-dropdown,
  .pantry-layout, .pantry-modal, .quick-scan-modal,
  .contacts-layout, .chat-layout, .chat-main-header,
  .notification-card, .search-modal {
    background: var(--bg) !important;
    border-color: var(--border) !important;
  }
}

/* ── Global Scrollbar (Firefox + Webkit) ─────────────────────────── */
.chat-messages, .chat-sidebar-list, .modal-body {
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}
.chat-messages::-webkit-scrollbar,
.chat-sidebar-list::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-track,
.chat-sidebar-list::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb,
.chat-sidebar-list::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}
.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-sidebar-list::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}
