/**
 * main.css - MODERN DESIGN SYSTEM
 * 
 * Fresh, minimalistisch, 2025er Style
 * Glassmorphism, Gradients, moderne Typography
 */

/* ========================
   RESET & ROOT
   ======================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

:root {
  /* Moderne Farbpalette */
  --color-primary: #f16521;        /* Vibrant Orange */
  --color-primary-dark: #e05a1a;
  --color-primary-light: #fef0e8;
  --color-primary-rgb: 241, 101, 33; /* Für rgba() */
  --color-secondary: #f59e0b;      /* Warm Amber */
  --color-success: #10b981;
  --color-error: #ef4444;
  --color-warning: #f59e0b;

  --color-dark: #0f172a;           /* Dark Navy */
  --color-text: #1e293b;
  --color-text-light: #64748b;
  --color-bg: #f8fafc;
  --color-bg-card: #ffffff;
  --color-border: #e2e8f0;

  /* Semantische Flächen-, Text- und Rahmenfarben für Modulinhalte (Dark-Mode-fähig).
     Light-Werte entsprechen den bisher meistgenutzten festen Hexwerten der Module. */
  --color-bg-subtle: #f8fafc;        /* dezente Flächen: Tabellenköpfe, Zebra-Zeilen, Info-Boxen */
  --color-bg-hover: #f1f5f9;         /* Hover-Flächen, inaktive Chips, Trennflächen */
  --color-text-secondary: #475569;   /* Sekundärtext, etwas heller als --color-text */
  --color-text-muted: #94a3b8;       /* Hinweise, Platzhalter, Meta-Angaben */
  --color-border-light: #f1f5f9;     /* feine Trennlinien innerhalb von Karten */
  --color-border-strong: #cbd5e1;    /* Eingabefelder, betonte Rahmen */

  /* Statusfarben: Akzent (Buttons/Rahmen/Icons), helle Fläche (-bg) und Text auf dieser Fläche (-text) */
  --color-danger: #dc2626;
  --color-danger-bg: #fee2e2;
  --color-danger-text: #991b1b;
  --color-success-bg: #dcfce7;
  --color-success-text: #166534;
  --color-warning-bg: #fef3c7;
  --color-warning-text: #92400e;
  --color-info: #3b82f6;
  --color-info-bg: #dbeafe;
  --color-info-text: #1e40af;

  /* Z-Index System (aufsteigend, keine Überlappungen) */
  --z-base: 1;
  --z-sticky: 10;            /* Sticky Headers innerhalb von Content */
  --z-navbar: 100;            /* Navigation Bar */
  --z-dropdown: 1000;         /* Dropdowns, Autocomplete */
  --z-modal-backdrop: 9000;   /* Modal Overlay/Backdrop */
  --z-modal: 9010;            /* Modal Content Level 1 */
  --z-modal-2: 9020;          /* Modal Level 2 (über erstem Modal) */
  --z-modal-top: 9030;        /* Höchste Modal-Ebene (Confirm, Alert) */
  --z-notification: 9500;     /* Toast/Notification */
  --z-mobile-nav: 9800;       /* Mobile Navigation Drawer */
  --z-loading: 9999;          /* Loading Overlay */
  --z-skip-link: 99999;       /* Accessibility Skip-Link (immer ganz oben) */

  /* Abstände */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --modal-radius: 16px;         /* Eckenradius aller Dialog-Boxen (modal-stack.css + Modul-Dialoge) */

  /* Schatten */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px 0 rgba(var(--color-primary-rgb), 0.08);
  --shadow-lg: 0 12px 32px 0 rgba(var(--color-primary-rgb), 0.12);
  --shadow-xl: 0 20px 48px 0 rgba(var(--color-primary-rgb), 0.15);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  --font-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* ========================
   BODY & BASE
   ======================== */

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: linear-gradient(135deg, var(--color-bg) 0%, #f1f5f9 100%);
  min-height: 100vh;
}

/* ========================
   LOGIN PAGE - MODERN
   ======================== */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, var(--color-primary) 0%, #f59e0b 50%, #10b981 100%);
  background-attachment: fixed;
  padding: var(--spacing-lg);
  position: fixed;
  top: 0;
  left: 0;
  overflow: hidden;
  z-index: var(--z-loading);
}

/* Animated background elements */
.login-page::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  top: -100px;
  left: -100px;
  animation: float 6s ease-in-out infinite;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  bottom: -50px;
  right: -50px;
  animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(20px); }
}

.login-card {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-xl);
  padding: var(--spacing-2xl);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.5s ease-out;
}

/* slideUp → animations.css */

.login-card h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary) 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--spacing-sm);
  letter-spacing: -0.5px;
}

/* Logo statt Schriftzug (Installation mit branding/logo.*, api/branding.php) */
.login-card .login-logo {
  display: block;
  max-width: 240px;
  max-height: 96px;
  margin: 0 auto var(--spacing-md);
}

.brand-logo.brand-logo-img {
  background: none;
  box-shadow: none;
  overflow: hidden;
  padding: 0;
}

.brand-logo.brand-logo-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.login-card .subtitle {
  color: var(--color-text-light);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: var(--spacing-xl);
  letter-spacing: 0.3px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  padding: var(--spacing-md) var(--spacing-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font-sans);
  background: rgba(248, 250, 252, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--color-text);
}

.form-group input::placeholder {
  color: var(--color-text-light);
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
  transform: translateY(-2px);
}

/* ── Required Field Markers ── */
.form-group.required label::after,
label.required::after {
  content: ' *';
  color: var(--color-error);
  font-weight: 700;
}

/* ── Inline Field Errors ── */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
  border-color: var(--color-error);
  background: #fef2f2;
}

.form-group.has-error input:focus,
.form-group.has-error select:focus,
.form-group.has-error textarea:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.field-error {
  font-size: 0.8rem;
  color: var(--color-error);
  margin-top: 2px;
  display: none;
}

.form-group.has-error .field-error {
  display: block;
}

/* ── Money / Currency Fields ── */
.field-money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#login-error {
  padding: var(--spacing-md);
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #991b1b;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 4px solid #dc2626;
  animation: slideDown 0.3s ease-out;
}

/* slideDown → animations.css */

/* ========================
   BUTTONS
   ======================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0.3px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(var(--color-primary-rgb), 0.1);
  color: var(--color-primary);
  border: 2px solid transparent;
}

.btn-secondary:hover {
  background: rgba(var(--color-primary-rgb), 0.2);
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-error) 0%, #dc2626 100%);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-sm {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.85rem;
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-border);
}

.btn-outline:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.btn-logout {
  background: linear-gradient(135deg, var(--color-error) 0%, #dc2626 100%);
  color: white;
}

.btn-logout:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Login-spezifisch: volle Breite */
.login-form .btn-primary {
  width: 100%;
}

/* ========================
   APP CONTAINER
   ======================== */

.app-container {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-bg) 0%, #f1f5f9 100%);
  /* Breiten der Sidebar / Höhe der Kopfzeile — Module rechnen mit --topbar-h (vorher fix 80px) */
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 64px;
}

/* ========================
   SIDEBAR (Bereiche)
   Flache Navigation: Bereich → Seite → Dialog. Buttons behalten
   .tab-btn[data-tab], weil Module darüber Deep-Links auslösen
   (z. B. reminder-service → Termine).
   ======================== */

.app-sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-card);
  border-right: 1px solid var(--color-border);
  z-index: calc(var(--z-navbar) + 1);
  transition: flex-basis 0.2s ease, width 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-h);
  padding: 12px 10px 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.brand-logo {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.brand-name {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-toggle {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-light);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.2s ease;
}

.sidebar-toggle:hover {
  background: rgba(var(--color-primary-rgb), 0.08);
  color: var(--color-primary);
}

.tab-navigation {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 10px 16px;
  overflow-y: auto;
  overflow-x: hidden;
}

.app-sidebar .tab-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-sidebar .tab-btn .nav-icon {
  flex: 0 0 24px;
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.app-sidebar .tab-btn .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar .tab-btn:hover {
  background: rgba(var(--color-primary-rgb), 0.08);
  color: var(--color-primary);
}

.app-sidebar .tab-btn.active {
  background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.14) 0%, rgba(var(--color-primary-rgb), 0.06) 100%);
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--color-primary);
}

/* Fußzeile: Erinnerungs-Glocke, Admin-Toggle, Abmelden */
.sidebar-footer {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 12px;
  border-top: 1px solid var(--color-border);
}

.sidebar-footer .reminder-wrapper {
  position: static;
}

/* Dropdown öffnet rechts neben der Sidebar, unten bündig */
.sidebar-footer .reminder-dropdown {
  top: auto;
  bottom: 0;
  left: calc(100% + 8px);
  right: auto;
}

.sidebar-footer #logout-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.85rem;
}

/* Eingeklappt: nur Icons */
.app-container.sidebar-collapsed {
  --sidebar-w: var(--sidebar-w-collapsed);
}

.app-container.sidebar-collapsed .brand-name,
.app-container.sidebar-collapsed .nav-label {
  display: none;
}

.app-container.sidebar-collapsed .sidebar-brand {
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
}

.app-container.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.app-container.sidebar-collapsed .app-sidebar .tab-btn {
  justify-content: center;
  gap: 0;
  padding-left: 0;
  padding-right: 0;
}

.app-container.sidebar-collapsed .sidebar-footer {
  flex-direction: column;
  padding: 12px 8px;
}

.app-container.sidebar-collapsed .sidebar-footer #logout-btn {
  margin-left: 0;
  padding: var(--spacing-sm);
}

/* Mobil-Backdrop (nur im Drawer-Modus sichtbar, s. Media Query) */
.sidebar-backdrop {
  display: none;
}

/* ========================
   HAUPTSPALTE + KOPFZEILE
   ======================== */

.app-main {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-navbar);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  min-height: var(--topbar-h);
  padding: 0 var(--spacing-lg);
  background: var(--color-bg-card);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.help-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--color-primary-rgb), 0.2);
  border-radius: var(--radius-full);
  background: rgba(var(--color-primary-rgb), 0.08);
  color: var(--color-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.help-btn:hover {
  background: rgba(var(--color-primary-rgb), 0.16);
}

/* Hamburger in der Kopfzeile: nur im Drawer-Modus sichtbar (Media Query weiter unten) */
.mobile-menu-btn {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: var(--spacing-sm);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:active {
  background: var(--color-primary-dark);
}

/* ========================
   LEGACY: horizontale Tab-Leiste
   Die App-Navigation ist seit der Sidebar nicht mehr .tabs-nav; die Regeln
   bleiben, weil Modul-Dialoge die Klasse noch nutzen (Termine-Dialog, Presse).
   ======================== */

.tabs-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-navbar);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.tabs-nav .tab-btn {
  background: rgba(var(--color-primary-rgb), 0.08);  /* ← Subtile Purple statt Weiß */
  color: var(--color-text-light);
  border: 1px solid rgba(var(--color-primary-rgb), 0.1);  /* ← Border hinzugefügt */
  border-radius: var(--radius-full);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  position: relative;
}

.tabs-nav .tab-btn:hover {
  background: rgba(var(--color-primary-rgb), 0.15);  /* ← Etwas dunkler */
  border-color: rgba(var(--color-primary-rgb), 0.2);
  color: var(--color-primary);
}

.tabs-nav .tab-btn.active {
  color: white;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border-color: var(--color-primary);
}



/* Admin Toggle */
.admin-toggle {
  background: rgba(var(--color-primary-rgb), 0.08);
  border: 1px solid rgba(var(--color-primary-rgb), 0.1);
  border-radius: var(--radius-full);
  padding: var(--spacing-sm);
  cursor: pointer;
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.admin-toggle:hover {
  background: rgba(var(--color-primary-rgb), 0.15);
  color: var(--color-primary);
}

.admin-toggle.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: white;
  border-color: var(--color-primary);
}

/* Reminder Bell */
.reminder-wrapper {
  position: relative;
}

.reminder-bell {
  background: rgba(var(--color-primary-rgb), 0.08);
  border: 1px solid rgba(var(--color-primary-rgb), 0.1);
  border-radius: var(--radius-full);
  padding: var(--spacing-sm);
  cursor: pointer;
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s ease;
}

.reminder-bell:hover {
  background: rgba(var(--color-primary-rgb), 0.15);
  color: var(--color-primary);
}

.reminder-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.reminder-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown, 100);
}

.reminder-empty {
  padding: var(--spacing-lg);
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.9rem;
}

.reminder-item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
}

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

.reminder-icon {
  flex-shrink: 0;
}

.reminder-text {
  color: var(--color-text);
  line-height: 1.4;
}

#logout-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border-radius: var(--radius-full);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-weight: 600;
}

#logout-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ========================
   MAIN CONTENT
   ======================== */

.content {
  flex: 1;
  min-width: 0;
  padding: var(--spacing-xl);
  background: transparent;
  /* Kein eigener Scrollbereich: das Fenster scrollt. Mit overflow-y:auto wäre .content der
     Bezugsrahmen für position:sticky und die Reiterleiste der Bereiche (top: --topbar-h)
     hinge 64 px tief im Inhalt, statt unter der Kopfzeile stehen zu bleiben (23.10.2026). */
  overflow: visible;
}

.content > * {
  max-width: 1400px;
  margin: 0 auto;
}

/* ========================
   TYPOGRAPHY
   ======================== */

h1, h2, h3, h4, h5, h6 {
  color: var(--color-text);
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
  font-weight: 700;
  letter-spacing: -0.5px;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.2rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: var(--spacing-md);
  color: var(--color-text-light);
  line-height: 1.7;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.25s ease;
  border-bottom: 2px solid transparent;
}

a:hover {
  border-bottom-color: var(--color-primary);
}

/* ========================
   FORMS
   ======================== */

input,
select,
textarea {
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-card);
  transition: all 0.25s ease;
  color: var(--color-text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}

textarea {
  resize: vertical;
  min-height: 100px;
  font-family: var(--font-mono);
}

/* ========================
   ALERTS
   ======================== */

.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  font-weight: 500;
  border-left: 4px solid;
  animation: slideDown 0.3s ease-out;
}

.alert-error {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #991b1b;
  border-left-color: #dc2626;
}

.alert-success {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  border-left-color: #16a34a;
}

.alert-info {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e3a8a;
  border-left-color: #2563eb;
}

.alert-warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-left-color: #d97706;
}

/* ========================
   LOADING OVERLAY
   ======================== */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: var(--z-loading);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
  text-align: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Spinner-Variante für hellen Hintergrund (innerhalb von Modulen) */
.spinner-module {
  width: 40px;
  height: 40px;
  border: 4px solid #f0f0f0;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Kleiner Inline-Spinner */
.spinner-small,
.mini-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* spin → animations.css */

.loading-content h2 {
  color: white;
  font-size: 1.3rem;
}

.loading-content p {
  color: rgba(255, 255, 255, 0.8);
}

/* ========================
   UTILITIES
   ======================== */

.container {

  padding: 0 var(--spacing-lg);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.hidden { display: none !important; }
.invisible { visibility: hidden !important; }

/* ========================
   RESPONSIVE
   ======================== */

@media (max-width: 768px) {
  :root {
    font-size: 15px;
  }

  .login-card {
    padding: var(--spacing-xl);
  }

  .login-card h1 {
    font-size: 2rem;
  }

  .content {
    padding: var(--spacing-lg);
  }

  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.2rem; }
}

/* Mobil/Tablet: Sidebar als Drawer über den Hamburger in der Kopfzeile */
@media (max-width: 768px) {
  .app-container {
    --topbar-h: 56px;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .sidebar-toggle {
    display: none;
  }

  .app-sidebar,
  .app-container.sidebar-collapsed .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    height: auto;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: var(--z-mobile-nav);
  }

  .app-container.sidebar-open .app-sidebar {
    transform: none;
    box-shadow: var(--shadow-xl);
  }

  /* Eingeklappt-Zustand vom Desktop spielt im Drawer keine Rolle */
  .app-container.sidebar-collapsed .brand-name,
  .app-container.sidebar-collapsed .nav-label {
    display: revert;
  }
  .app-container.sidebar-collapsed .sidebar-brand {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 10px 12px 16px;
  }
  .app-container.sidebar-collapsed .app-sidebar .tab-btn {
    justify-content: flex-start;
    gap: 12px;
    padding: 9px 12px;
  }
  .app-container.sidebar-collapsed .sidebar-footer {
    flex-direction: row;
    padding: 12px;
  }
  .app-container.sidebar-collapsed .sidebar-footer #logout-btn {
    margin-left: auto;
    padding: var(--spacing-sm) var(--spacing-md);
  }

  /* Bereiche ohne Mobile*-Recht im Drawer ausblenden */
  .app-sidebar .tab-btn.mobile-hidden,
  .area-subnav-btn.mobile-hidden {
    display: none;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: calc(var(--z-mobile-nav) - 1);
    animation: fadeIn 0.2s ease;
  }

  .app-container.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .sidebar-footer .reminder-dropdown {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 76px;
    width: auto;
  }

  .app-topbar {
    padding: 0 var(--spacing-md);
    gap: var(--spacing-sm);
  }

  .topbar-title {
    font-size: 1.05rem;
  }
}

@media (max-width: 640px) {
  /* Hub randlos zur kleineren Polsterung, sonst ragt die Reiterleiste seitlich hinaus */
  .content > .area-hub {
    margin: calc(-1 * var(--spacing-md));
    width: calc(100% + 2 * var(--spacing-md));
  }

  .content {
    padding: var(--spacing-md);
  }
}

@media (max-width: 480px) {
  .login-page {
    padding: var(--spacing-md);
  }

  .login-card {
    padding: var(--spacing-lg);
  }

  .login-card h1 {
    font-size: 1.8rem;
  }
}

/* ========================
   DARK MODE READY
   ======================== */

@media (prefers-color-scheme: dark) {
  :root {
    --color-text: #f1f5f9;
    --color-text-light: #cbd5e1;
    --color-bg: #0f172a;
    --color-bg-card: #1e293b;
    --color-border: #334155;

    /* Primär-Tönung dunkel (helles Orange-Pastell wäre mit heller Schrift unlesbar) */
    --color-primary-light: #3a2314;

    /* Flächen: Karte #1e293b < subtle < hover (im Dunkeln = erhöht = heller) */
    --color-bg-subtle: #243044;
    --color-bg-hover: #2c3b54;
    --color-text-secondary: #dbe3ee;
    --color-text-muted: #94a3b8;
    --color-border-light: #293650;
    --color-border-strong: #475569;

    /* Statusflächen dunkel getönt, Statustext hell (Pastelltöne der 300er-Stufe) */
    --color-danger: #ef4444;
    --color-danger-bg: #3f1d1d;
    --color-danger-text: #fca5a5;
    --color-success-bg: #14301f;
    --color-success-text: #86efac;
    --color-warning-bg: #3b2a0c;
    --color-warning-text: #fcd34d;
    --color-info: #3b82f6;
    --color-info-bg: #1e2a47;
    --color-info-text: #93c5fd;
  }

  body {
    background: linear-gradient(135deg, #0f172a 0%, #1a1f35 100%);
  }

  .login-card {
    background: rgba(30, 41, 59, 0.95);
  }

  .form-group input {
    background: rgba(15, 23, 42, 0.5);
    border-color: #334155;
    color: #f1f5f9;
  }

  .form-group input:focus {
    background: #1e293b;
    border-color: var(--color-primary);
  }
}


/* ========================
Progressbar Login
   ======================== */


/* Progress Bar Styles */
.progress-container {
  margin: 2rem 0;
  width: 100%;
  max-width: 300px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #f59e0b);
  border-radius: 4px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(var(--color-primary-rgb), 0.5);
}

.progress-text {
  text-align: center;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.loading-detail {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 1rem;
  min-height: 20px;
}

/* ========================
   ONLINE-INDICATOR
   Kleines Widget unten rechts
   ======================== */

.online-indicator {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: var(--z-dropdown, 1000);
  font-family: var(--font-sans, 'Inter', sans-serif);
}

.online-indicator-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-full, 9999px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.online-indicator-toggle:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
  50% { box-shadow: 0 0 12px rgba(34, 197, 94, 0.8); }
}

.online-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text, #1e293b);
  white-space: nowrap;
}

.online-indicator-list {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 8px 0;
  animation: fadeInUp 0.15s ease;
}

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

.online-indicator.expanded .online-indicator-list {
  display: block;
}

.online-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 0.82rem;
  color: var(--color-text, #1e293b);
  white-space: nowrap;
}

.online-user.is-me {
  font-weight: 600;
  color: var(--color-primary, #f16521);
}

.online-dot-sm {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.online-empty {
  color: var(--color-text-light, #94a3b8);
  font-style: italic;
}

/* ========================
   SKIP-LINK (Accessibility)
   ======================== */

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--spacing-md);
  background: var(--color-primary);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  z-index: var(--z-skip-link);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: var(--spacing-sm);
}

/* ========================
   MOBILE DRAWER (Sidebar, Regeln in der 768px-Media-Query oben)
   ======================== */

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

body.mobile-menu-open {
  overflow: hidden;
}

/* ========================
   BEREICHS-HUB (src/components/area-hub.js)
   Sub-Navigation oben im Bereich, Inhalt darunter. Der Hub füllt die
   Content-Fläche randlos; .area-content übernimmt die Rolle von .content
   (Padding + 1400px), damit Module mit negativen Rändern bündig bleiben.
   ======================== */

.content > .area-hub {
  max-width: none;
  margin: calc(-1 * var(--spacing-xl));
  width: calc(100% + 2 * var(--spacing-xl));
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--topbar-h, 80px));
}

.area-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px var(--spacing-lg) 0;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  /* Bleibt beim Scrollen unter der Kopfzeile stehen (User-Wunsch 23.10.2026) */
  position: sticky;
  top: var(--topbar-h);
  z-index: calc(var(--z-navbar) - 1);
}

.area-subnav--single {
  display: none;
}

.area-subnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 11px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: none;
  color: var(--color-text-light);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.area-subnav-btn:hover {
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.06);
}

.area-subnav-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.area-subnav-icon {
  font-size: 1rem;
  line-height: 1;
}

.area-content {
  flex: 1;
  min-width: 0;
  padding: var(--spacing-xl);
}

.area-content > * {
  max-width: 1400px;
  margin: 0 auto;
}

/* Eingebettetes Einstellungs-Panel (z. B. Preise mit 14 Spalten) */
.area-content > .area-panel {
  overflow-x: auto;
}

.area-empty {
  padding: var(--spacing-xl);
  color: var(--color-text-light);
  text-align: center;
}

/* Gruppen-Trenner in der Reiterleiste (Finanzen: Ausgaben · Einnahmen …, Marketing) */
.area-subnav-group-label {
  align-self: center;
  margin: 0 2px 2px 10px;
  padding-left: 12px;
  border-left: 1px solid var(--color-border);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-light);
  opacity: 0.75;
  white-space: nowrap;
}

.area-subnav-group-label:first-child {
  margin-left: 0;
  padding-left: 4px;
  border-left: none;
}

/* Angehefteter Eintrag (Marketing › Übersicht) */
.area-subnav-btn--pinned {
  font-weight: 700;
}

/* Zähler/Badge an einem Reiter */
.area-subnav-badge {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 9px;
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

/* Zweistufige Leiste (Einstellungen): Zeile 1 Gruppen, Zeile 2 Seiten der aktiven Gruppe */
.area-subnav--tiers {
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.area-subnav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px var(--spacing-lg) 0;
}

.area-subnav-groups {
  border-bottom: 1px solid var(--color-border);
}

.area-subnav-group-btn {
  padding: 8px 14px 10px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: none;
  color: var(--color-text-light);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.area-subnav-group-btn:hover {
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.06);
}

.area-subnav-group-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.area-subnav-pages {
  padding-top: 4px;
}

.area-subnav-pages[hidden] {
  display: none;
}

.area-subnav-pages .area-subnav-btn {
  font-size: 0.85rem;
}

/* Breadcrumb „Bereich › Gruppe › Seite" (Einstellungen) */
.area-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px var(--spacing-xl) 0;
  font-size: 0.85rem;
  color: var(--color-text-light);
}

.area-breadcrumb-sep {
  opacity: 0.5;
}

.area-breadcrumb-current {
  color: var(--color-primary);
  font-weight: 600;
}

/* Flächen eines Bereichsmoduls (Shows: #subtab-termine) und die Modul-Fläche des Hubs */
.area-content > .area-pane[hidden] {
  display: none;
}

@media (max-width: 768px) {
  .content > .area-hub {
    margin: calc(-1 * var(--spacing-lg));
    width: calc(100% + 2 * var(--spacing-lg));
  }

  .area-subnav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px var(--spacing-md) 0;
  }

  .area-subnav-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 12px 10px;
  }

  .area-subnav-group-label {
    flex-shrink: 0;
  }

  .area-subnav--tiers {
    overflow: visible;
  }

  .area-subnav-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px var(--spacing-md) 0;
  }

  .area-subnav-group-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .area-breadcrumb {
    padding: 10px var(--spacing-lg) 0;
  }

  .area-content {
    padding: var(--spacing-lg);
  }
}

@media (max-width: 640px) {
  .content > .area-hub {
    margin: calc(-1 * var(--spacing-md));
    width: calc(100% + 2 * var(--spacing-md));
  }

  .area-content {
    padding: var(--spacing-md);
  }
}

/* ========================
   HUB-LADEANZEIGE
   Gemeinsam für Bereichs-Hubs und Einstellungs-Panels (Finanzen/Termine
   bringen dieselben Regeln in ihrem CSS mit).
   ======================== */

.hub-subtab-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
}

.hub-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--color-primary, #f16521);
  border-radius: 50%;
  animation: hubSpin 0.7s linear infinite;
}

@keyframes hubSpin {
  to { transform: rotate(360deg); }
}
/* ═══════════════════════════════════════════════════════════════
   HUB SUB-NAVIGATION
   Shared pattern for hub modules (Finanzen, etc.)
   ═══════════════════════════════════════════════════════════════ */

.hub-subnav {
  display: flex;
  gap: 2px;
  padding: 16px 24px 0;
  border-bottom: 2px solid #ece8e4;
  background: #fafafa;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.hub-subnav-btn {
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  padding: 9px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  margin-bottom: -2px;
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.01em;
}

.hub-subnav-btn:hover {
  color: var(--color-primary, #f16521);
  background: #fff5f0;
}

.hub-subnav-btn.active {
  color: var(--color-primary, #f16521);
  background: #fff;
  border-color: #ece8e4;
  border-bottom-color: #fff;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.04);
}

.hub-subtab-content {
  padding-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — am Ende damit alle vorherigen Regeln überschrieben werden
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {

  /* Allgemein: Tabellen horizontal scrollbar machen */
  .content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* Grids auf mobile zu Spalte */
  .allgemein-grid,
  .info-grid-2col {
    grid-template-columns: 1fr !important;
  }
}
