/* ================================
   VAILLANT WP MONITORING STYLES
   ================================ */

/* Leaflet Map Tiles - Immer hell halten (auch im Dark Mode) */
#fleet-map-leaflet,
#fleet-map-leaflet .leaflet-tile-pane,
#fleet-map-leaflet .leaflet-tile-container,
#fleet-map-leaflet .leaflet-tile {
    filter: none !important;
    opacity: 1 !important;
    background: #fff !important;
}

.dark #fleet-map-leaflet .leaflet-tile-pane,
.dark #fleet-map-leaflet .leaflet-tile {
    filter: none !important;
}

/* Enhanced CSS Variables for Professional Theme */
:root {
  /* 360Volt Color Palette */
  --mulberry: #c75380;
  --blue-violet: #675cbf;
  --affair: #66447c;
  --mandy: #e64c61;
  --prim: #ecd6e2;
  --sea-pink: #eb97a6;
  --mamba: #9d7ea1;
  --froly: #f07182;
  --lavender-purple: #8474ac;

  /* 360Volt Gradient */
  --gradient-360volt: linear-gradient(135deg, #c75380 0%, #675cbf 100%);

  /* Typography - Poppins Font Stack */
  --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Text Colors - Enhanced Contrast */
  --text-primary: #0f172a;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --text-accent: var(--mulberry);

  /* Background Colors - Using 360Volt Palette */
  --bg-primary: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  --bg-secondary: linear-gradient(135deg, #f9fafb 0%, #f1f5f9 100%);
  --bg-tertiary: linear-gradient(135deg, #f3f4f6 0%, #e2e8f0 100%);

  /* Border Colors - Soft Edges */
  --border-primary: #e2e8f0;
  --border-secondary: #cbd5e1;

  /* Status Colors - Professional COP-based Palette */
  --status-optimal: #10b981;    /* Grün: COP > 3.0 */
  --status-success: #22c55e;    /* Grün: Online/Erfolg */
  --status-warning: #f59e0b;    /* Gelb/Orange: COP 2.0-3.0 */
  --status-critical: #ef4444;   /* Rot: COP < 2.0 */
  --status-info: var(--blue-violet);

  /* Accent Colors */
  --accent-primary: var(--mulberry);
  --accent-secondary: var(--blue-violet);

  /* Vaillant Brand Blue */
  --vaillant-blue: #1e40af;
  --vaillant-blue-light: #3b82f6;

  /* Spacing System */
  --space-xs: 0.5rem;   /* 8px */
  --space-sm: 0.75rem;  /* 12px */
  --space-md: 1rem;     /* 16px */
  --space-lg: 1.5rem;   /* 24px */
  --space-xl: 2rem;     /* 32px */
  --space-2xl: 3rem;    /* 48px */
}

/* Vaillant Blue Utility Class */
.text-vaillant-blue {
  color: var(--vaillant-blue);
}

.dark .text-vaillant-blue {
  color: var(--vaillant-blue-light);
}

.bg-vaillant-blue {
  background-color: var(--vaillant-blue);
}

.dark .bg-vaillant-blue {
  background-color: var(--vaillant-blue-light);
}

html {
  scroll-behavior: smooth;
  overflow-y: scroll;
}

/* Dark Mode Variables (both .dark class and data-theme support) */
.dark,
[data-theme="dark"] {
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-accent: var(--sea-pink);
  
  --bg-primary: #1e293b;
  --bg-secondary: #0f172a;
  --bg-tertiary: #334155;
  
  --border-primary: #475569;
  --border-secondary: #64748b;
  
  --status-success: #34d399;
  --status-warning: #fbbf24;
  --status-error: #f87171;
  --status-info: var(--blue-violet);
  
  --vaillant-blue: #60a5fa;
  --vaillant-blue-light: #93c5fd;
  
  --accent-primary: var(--mulberry);
  --accent-secondary: var(--blue-violet);
}

/* Enhanced Typography & Readability */
body {
  font-family: var(--font-body);
  line-height: 1.6;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.025em;
  color: var(--text-primary);
  background: var(--bg-secondary);
  background-attachment: fixed;
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  margin-top: 0;
  font-size: 2rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 1rem;
}

p, span, div {
  line-height: 1.5;
  color: var(--text-primary);
}

/* Global spacing for clear separation */
h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote {
  margin-bottom: 1rem;
}

h1, h2, h3 {
  margin-top: 1.5rem;
}

h4, h5, h6 {
  margin-top: 1rem;
}

p + p, p + ul, p + ol {
  margin-top: 0.5rem;
}

/* Specific for images and captions */
img {
  max-width: 100%;
  height: auto;
}

figcaption, .caption {
  font-size: clamp(0.75rem, 2vw, 1rem);
  line-height: 1.4;
  margin-top: 0.5rem;
  color: var(--text-secondary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

p, span, div {
  line-height: 1.5;
  color: var(--text-primary);
}

/* ================================
   KONSISTENTE THEME-AWARE UTILITY KLASSEN
   ================================ */

/* Primäre Text-Klassen - Nutzen CSS-Variablen für automatischen Dark Mode */
.text-primary { 
  color: var(--text-primary) !important; 
}

.text-secondary { 
  color: var(--text-secondary) !important; 
}

.text-muted { 
  color: var(--text-muted) !important; 
}

.text-accent {
  color: var(--text-accent) !important;
}

/* Heading-Klassen - Konsistent für alle Überschriften */
.heading-primary {
  color: var(--text-primary) !important;
  font-weight: 700;
}

.heading-secondary {
  color: var(--text-secondary) !important;
  font-weight: 600;
}

/* Paragraph-Klassen */
.paragraph-primary {
  color: var(--text-primary) !important;
  line-height: 1.6;
}

.paragraph-secondary {
  color: var(--text-secondary) !important;
  line-height: 1.5;
}

.paragraph-muted {
  color: var(--text-muted) !important;
  line-height: 1.5;
}

/* Background Utility-Klassen */
.bg-theme-primary {
  background: var(--bg-primary) !important;
}

.bg-theme-secondary {
  background: var(--bg-secondary) !important;
}

.bg-theme-tertiary {
  background: var(--bg-tertiary) !important;
}

/* Border Utility-Klassen */
.border-theme-primary {
  border-color: var(--border-primary) !important;
}

.border-theme-secondary {
  border-color: var(--border-secondary) !important;
}

/* Konsistente Card-Hintergründe */
.card-bg {
  background: #ffffff;
  border: 1px solid var(--border-primary);
}

.dark .card-bg {
  background: #1e293b;
}

/* Konsistente Section-Hintergründe */
.section-bg {
  background: #f9fafb;
}

.dark .section-bg {
  background: #0f172a;
}

/* Status Colors with CSS Variables and Glow Effects */
.status-online { 
  color: var(--status-success); 
  font-weight: 500;
  background: linear-gradient(135deg, #10b981, #059669);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.3));
}

.status-loading {
  color: var(--status-info);
  font-weight: 500;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-warning { 
  color: var(--status-warning); 
  font-weight: 500;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.3));
}

.status-error { 
  color: var(--status-error); 
  font-weight: 500; 
}

.status-offline { 
  color: var(--text-muted); 
  font-weight: 500; 
}

.status-success {
  color: var(--status-success);
  font-weight: 500;
}

.status-info {
  color: var(--status-info);
  font-weight: 500;
}

/* Background Status Colors */
.bg-status-online { 
  background-color: rgba(5, 150, 105, 0.1); 
  border-color: var(--status-success); 
  color: var(--status-success);
}

.bg-status-warning { 
  background-color: rgba(217, 119, 6, 0.1); 
  border-color: var(--status-warning); 
  color: var(--status-warning);
}

.bg-status-error { 
  background-color: rgba(220, 38, 38, 0.1); 
  border-color: var(--status-error); 
  color: var(--status-error);
}

.bg-status-offline { 
  background-color: rgba(107, 114, 128, 0.1); 
  border-color: var(--text-muted); 
  color: var(--text-muted);
}

/* Dark Mode Status Background Adjustments */
.dark .bg-status-online { 
  background-color: rgba(16, 185, 129, 0.15); 
}

.dark .bg-status-warning { 
  background-color: rgba(245, 158, 11, 0.15); 
}

.dark .bg-status-error { 
  background-color: rgba(248, 113, 113, 0.15); 
}

.dark .bg-status-offline { 
  background-color: rgba(156, 163, 175, 0.15); 
}
.dark .bg-status-error { background-color: rgba(220, 38, 38, 0.15); border-color: #f87171; }
.dark .bg-status-offline { background-color: rgba(107, 114, 128, 0.15); border-color: #9ca3af; }

/* ================================
   ENHANCED ANIMATIONS & EFFECTS
   ================================ */

.loading-spinner {
  border: 4px solid rgba(59, 130, 246, 0.1);
  border-top: 4px solid var(--accent-primary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.pulse-animation {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

/* Professional Hover Effects */
.hover-lift {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.dark .hover-lift:hover {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

/* Focus states for accessibility */
.hover-lift:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Connection Indicators with Enhanced Glow */
.online-indicator,
.offline-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-glow 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  box-shadow: 0 0 6px currentColor;
}

.online-indicator {
  background-color: var(--status-success);
  color: var(--status-success);
}

.offline-indicator {
  background-color: var(--status-error);
  color: var(--status-error);
}

@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 8px currentColor;
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
    box-shadow: 0 0 16px currentColor;
  }
}

/* Welcome Intro Animations */
.animate-fade-in-left {
  animation: fadeInLeft 0.8s ease-out;
}

.animate-fade-in-right {
  animation: fadeInRight 0.8s ease-out;
}

.animate-slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

.animation-delay-200 {
  animation-delay: 0.2s;
}

.animation-delay-300 {
  animation-delay: 0.3s;
}

.animation-delay-400 {
  animation-delay: 0.4s;
}

.animation-delay-500 {
  animation-delay: 0.5s;
}

.animation-delay-600 {
  animation-delay: 0.6s;
}

.animation-delay-700 {
  animation-delay: 0.7s;
}

.animation-delay-800 {
  animation-delay: 0.8s;
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-spin-slow {
  animation: spin 3s linear infinite;
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

/* ================================
   COMPONENT STYLES
   ================================ */

/* Device Cards */
.device-card {
  transition: all 0.2s ease;
  cursor: pointer;
}

.device-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* KPI Cards - Enhanced Professional Design */
.kpi-card {
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
  border: 1px solid rgba(226, 232, 240, 0.6);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  margin-bottom: 0;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 12px 12px 0 0;
}

.dark .kpi-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
  border-color: rgba(71, 85, 105, 0.6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.2);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
}

.dark .kpi-card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* KPI Card Color Variants - COP-based */
.kpi-card-green::before {
  background: linear-gradient(90deg, var(--status-optimal), #059669);
}

.kpi-card-blue::before {
  background: linear-gradient(90deg, var(--status-info), var(--blue-violet));
}

.kpi-card-yellow::before {
  background: linear-gradient(90deg, var(--status-warning), #d97706);
}

.kpi-card-orange::before {
  background: linear-gradient(90deg, #fb923c, #f97316);
}

.kpi-card-red::before {
  background: linear-gradient(90deg, var(--status-critical), #dc2626);
}

.kpi-card-purple::before {
  background: linear-gradient(90deg, #7c3aed, #a855f7);
}

/* KPI Values with CSS Variables for Maximum Contrast */
.kpi-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  margin: 0.5rem 0;
  letter-spacing: -0.05em;
  color: var(--text-accent);
}

.dark .kpi-value {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.kpi-label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.kpi-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Category Sections */
.category-section {
  border-radius: 16px;
  border: 2px solid;
}

.executive-summary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ================================
   DARK MODE IMPROVEMENTS
   ================================ */

/* Dark Mode Improvements - Enhanced Contrast */
.dark .text-green-600 { color: #22c55e !important; }
.dark .text-red-600 { color: #ef4444 !important; }
.dark .text-yellow-600 { color: #eab308 !important; }
.dark .text-blue-600 { color: #3b82f6 !important; }
.dark .text-orange-600 { color: #ea580c !important; }

.dark .bg-green-50 { background-color: rgba(34, 197, 94, 0.12) !important; }
.dark .bg-red-50 { background-color: rgba(239, 68, 68, 0.12) !important; }
.dark .bg-yellow-50 { background-color: rgba(234, 179, 8, 0.12) !important; }
.dark .bg-blue-50 { background-color: rgba(59, 130, 246, 0.12) !important; }
.dark .bg-orange-50 { background-color: rgba(234, 88, 12, 0.12) !important; }

/* Better Card Readability with CSS Variables - ENHANCED */
.card-readable {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  margin-left: 0;
  margin-right: 0;
  width: 100%;
  max-width: 100%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-primary);
  overflow: hidden;
  word-wrap: break-word;
  box-sizing: border-box;
  font-family: var(--font-body);
}

.dark .card-readable {
  box-shadow: 0 1px 3px rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.2);
}

.card-readable:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.06);
  border-color: var(--border-secondary);
}

.dark .card-readable:hover {
  box-shadow: 0 4px 6px rgba(0,0,0,0.2), 0 2px 4px rgba(0,0,0,0.15);
}

/* Text Overflow Prevention */
.card-readable * {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

/* Enhanced Table Readability with CSS Variables */
.table-readable {
  font-size: 0.95rem;
  line-height: 1.5;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text-primary);
}

/* Responsive Table Container */
.responsive-table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.responsive-table table {
  width: 100%;
  min-width: 800px; /* Reduced for better responsiveness */
  table-layout: auto;
  margin: 0 auto; /* Center the table */
}

.table-readable th {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 0.875rem;
  border-bottom: 2px solid var(--border-primary);
  white-space: normal;
  word-break: break-word;
}

.table-readable td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--border-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.875rem;
  max-width: 150px; /* Limit width for better readability */
}

.table-readable tbody tr:hover td {
  background-color: var(--bg-tertiary);
  transform: scale(1.001);
  transition: all 0.15s ease;
}

.dark .table-readable td {
  border-bottom-color: #4b5563;
}

/* Hide columns on tablets and smaller screens */
@media (max-width: 1279px) {
  .hide-on-tablet {
    display: none;
  }
}

/* ================================
   NAVIGATION
   ================================ */

/* Header - Professional Design */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.dark header {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
  border-bottom-color: rgba(71, 85, 105, 0.8);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

header h1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Navigation - Enhanced Professional Design */
.nav-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  flex-shrink: 0;
  min-width: fit-content;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.375rem 0.5rem;
  letter-spacing: 0.025em;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
  transition: left 0.5s;
}

.nav-btn:hover::before {
  left: 100%;
}

.nav-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.dark .nav-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.nav-btn:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.dark .nav-btn:focus {
  outline-color: #60a5fa;
}

/* Mobile Navigation - Better Touch Targets */
.mobile-nav-btn {
  min-height: 68px;
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  min-width: fit-content;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.75rem 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-bottom: 3px solid transparent;
}

.mobile-nav-btn:hover {
  background-color: rgba(59, 130, 246, 0.06);
  transform: translateY(-0.5px);
}

.dark .mobile-nav-btn:hover {
  background-color: rgba(59, 130, 246, 0.15);
}

.mobile-nav-btn i {
  font-size: 1.5rem;
  margin-bottom: 0.375rem;
  display: block;
  line-height: 1;
}

#mobile-nav {
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.dark #mobile-nav {
  background-color: rgba(31, 41, 55, 0.98);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* ================================
   PAGE CONTENT LAYOUT - FORCED CONSISTENCY
   ================================ */

/* Main container - EXPLICIT padding for ALL screen sizes */
main {
  box-sizing: border-box;
  overflow-x: hidden;
  width: 100%;
  padding: 4rem 0.75rem 0 0.75rem;
}

@media (min-width: 640px) {
  main {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (min-width: 768px) {
  main {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  main {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (min-width: 1280px) {
  main {
    padding-left: 3rem;
    padding-right: 3rem;
  }
}

@media (min-width: 1920px) {
  main {
    padding-left: 4rem;
    padding-right: 4rem;
  }
}

@media (min-width: 2560px) {
  main {
    padding-left: 5rem;
    padding-right: 5rem;
  }
}

/* Page content wrapper */
.page-content {
  box-sizing: border-box;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding-top: 0.25rem;
  padding-bottom: 0.5rem;
}

/* Für sehr große Bildschirme: max-width erhöhen */
@media (min-width: 1920px) {
  .page-content {
    max-width: 1800px;
  }
}

@media (min-width: 2560px) {
  .page-content {
    max-width: 2200px;
  }
}

/* Ensure first element doesn't push content down */
.page-content > *:first-child {
  margin-top: 0 !important;
}

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

/* Chart Overlays - Optimized for Light & Dark Mode */
.chart-overlay {
  background-color: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(4px);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
  z-index: 10;
  position: relative;
}

.dark .chart-overlay {
  background-color: rgba(31, 41, 55, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Form Elements with CSS Variables */
select, input {
  transition: all 0.2s ease-in-out;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-primary);
}

select:focus, input:focus {
  border-color: var(--status-info);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select:hover, input:hover {
  border-color: var(--border-secondary);
}

/* Enhanced Button Styling with Professional Design */
button {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.025em;
  position: relative;
  overflow: hidden;
  color: var(--text-primary);
}

/* Icon Button Consistency */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  background-color: transparent;
}

.icon-btn:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

.dark .icon-btn:hover {
  background-color: rgba(59, 130, 246, 0.2);
}

button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:hover:not(:disabled)::before {
  width: 300px;
  height: 300px;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:active:not(:disabled) {
  transform: translateY(0);
  transition-duration: 0.05s;
}

/* 360Volt Button Styles */
.btn-light {
  background-color: #ffffff;
  color: #000000;
  border: 1px solid #000000;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  transition: none;
}

.btn-light:hover {
  background-color: #000000;
  color: #ffffff;
}

.btn-dark {
  background-color: #000000;
  color: #ffffff;
  border: 1px solid #000000;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  transition: none;
}

.btn-dark:hover {
  background-color: #ffffff;
  color: #000000;
}

/* 360Volt Additional Components */
.card-360volt {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.card-360volt:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-color: var(--accent-primary);
}

.input-360volt {
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.3s ease;
}

.input-360volt:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(197, 83, 128, 0.2);
}

/* Navigation Improvements */
.nav-btn {
  color: var(--text-muted);
  transition: all 0.2s ease-in-out;
  background-color: transparent;
}

.nav-btn:hover {
  color: var(--text-primary);
  background-color: rgba(59, 130, 246, 0.05);
  border-bottom-color: rgba(59, 130, 246, 0.3);
}

.dark .nav-btn:hover {
  background-color: rgba(59, 130, 246, 0.15);
}

.nav-btn.active,
.nav-btn.text-vaillant-blue {
  color: #1e40af !important;
  font-weight: 600;
  background-color: rgba(59, 130, 246, 0.08);
}

.dark .nav-btn.active,
.dark .nav-btn.text-vaillant-blue {
  color: #60a5fa !important;
  background-color: rgba(59, 130, 246, 0.2);
}

/* Mobile Navigation Active State */
.mobile-nav-btn.text-vaillant-blue {
  background-color: rgba(59, 130, 246, 0.1);
  border-bottom-color: #1e40af;
}

.dark .mobile-nav-btn.text-vaillant-blue {
  background-color: rgba(59, 130, 246, 0.2);
  border-bottom-color: #60a5fa;
}

/* Comprehensive Tailwind Overrides for Dark Mode */
.dark .bg-gray-50 {
  background-color: #111827 !important;
}

.dark .bg-white {
  background-color: #1e293b !important;
}

.dark .bg-gray-800 {
  background-color: #1e293b !important;
  border: 1px solid #334155 !important;
}

.dark .bg-gray-700 {
  background-color: #334155 !important;
}

.dark .border-gray-200 {
  border-color: #374151 !important;
}

.dark .border-gray-300 {
  border-color: #4b5563 !important;
}

.dark .border-gray-700 {
  border-color: #374151 !important;
}

/* KONSISTENTE TEXT-FARBEN FÜR DARK MODE */
/* Diese Regeln sorgen dafür, dass Tailwind gray-Klassen im Dark Mode gut lesbar sind */

.dark .text-gray-900 {
  color: #f8fafc !important;
}

.dark .text-gray-800 {
  color: #f1f5f9 !important;
}

.dark .text-gray-700 {
  color: #e2e8f0 !important;
}

.dark .text-gray-600 {
  color: #cbd5e1 !important;
}

.dark .text-gray-500 {
  color: #94a3b8 !important;
}

.dark .text-gray-400 {
  color: #9ca3af !important;
}

.dark .text-gray-300 {
  color: #d1d5db !important;
}

.dark .text-gray-200 {
  color: #e5e7eb !important;
}

/* Explizite dark:text-white Unterstützung */
.dark .dark\:text-white {
  color: #ffffff !important;
}

.dark .dark\:text-gray-100 {
  color: #f3f4f6 !important;
}

.dark .dark\:text-gray-200 {
  color: #e5e7eb !important;
}

.dark .dark\:text-gray-300 {
  color: #d1d5db !important;
}

.dark .dark\:text-gray-400 {
  color: #9ca3af !important;
}

/* Hintergrund-Overrides für konsistente Karten */
.dark .dark\:bg-gray-800 {
  background-color: #1e293b !important;
}

.dark .dark\:bg-gray-900 {
  background-color: #0f172a !important;
}

.dark .dark\:bg-gray-700 {
  background-color: #334155 !important;
}

/* Border-Overrides */
.dark .dark\:border-gray-600 {
  border-color: #4b5563 !important;
}

.dark .dark\:border-gray-700 {
  border-color: #374151 !important;
}

/* Status Badge Color Improvements */
.dark .bg-green-100 {
  background-color: rgba(16, 185, 129, 0.2) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
}

.dark .bg-blue-100 {
  background-color: rgba(96, 165, 250, 0.2) !important;
  border: 1px solid rgba(96, 165, 250, 0.4) !important;
}

.dark .bg-red-100 {
  background-color: rgba(248, 113, 113, 0.2) !important;
  border: 1px solid rgba(248, 113, 113, 0.4) !important;
}

/* ================================
   GATEWAY DATA CONTAINER STYLES
   ================================ */

/* Gateway Data Content Containers */
#consumption-content,
#diagnostics-content,
#systems-content,
#schedules-content,
#settings-content {
  max-height: none;
  overflow-y: visible;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  line-height: 1.6;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gateway Data Cards with Better Text Handling */
#consumption-card,
#diagnostics-card,
#systems-card,
#schedules-card,
#settings-card {
  min-height: auto;
  max-height: none;
  display: flex;
  flex-direction: column;
}

#consumption-card .p-6,
#diagnostics-card .p-6,
#systems-card .p-6,
#schedules-card .p-6,
#settings-card .p-6 {
  flex: 1;
  overflow: hidden;
}

/* Data Display Improvements */
.gateway-data-item {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

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

.gateway-data-label {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: fit-content;
  flex-shrink: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.gateway-data-value {
  color: var(--text-primary);
  text-align: left;
  flex: 1;
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 0;
}

/* Scrollbar Styling */
#consumption-content::-webkit-scrollbar,
#diagnostics-content::-webkit-scrollbar,
#systems-content::-webkit-scrollbar,
#schedules-content::-webkit-scrollbar,
#settings-content::-webkit-scrollbar {
  width: 6px;
}

#consumption-content::-webkit-scrollbar-track,
#diagnostics-content::-webkit-scrollbar-track,
#systems-content::-webkit-scrollbar-track,
#schedules-content::-webkit-scrollbar-track,
#settings-content::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

#consumption-content::-webkit-scrollbar-thumb,
#diagnostics-content::-webkit-scrollbar-thumb,
#systems-content::-webkit-scrollbar-thumb,
#schedules-content::-webkit-scrollbar-thumb,
#settings-content::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 3px;
}

#consumption-content::-webkit-scrollbar-thumb:hover,
#diagnostics-content::-webkit-scrollbar-thumb:hover,
#systems-content::-webkit-scrollbar-thumb:hover,
#schedules-content::-webkit-scrollbar-thumb:hover,
#settings-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.dark .bg-yellow-100 {
  background-color: rgba(245, 158, 11, 0.2) !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
}

.dark .text-green-800 {
  color: #a7f3d0 !important;
  font-weight: 600 !important;
}

.dark .text-blue-800 {
  color: #bfdbfe !important;
  font-weight: 600 !important;
}

.dark .text-red-800 {
  color: #fecaca !important;
  font-weight: 600 !important;
}

.dark .text-yellow-800 {
  color: #fef3c7 !important;
  font-weight: 600 !important;
}

/* Color-specific Dark Mode Overrides for Better Contrast */
.dark .text-green-600 {
  color: #34d399 !important;
}

.dark .text-blue-600 {
  color: #60a5fa !important;
}

.dark .text-red-600 {
  color: #f87171 !important;
}

.dark .text-yellow-600 {
  color: #fbbf24 !important;
}

.dark .text-green-500 {
  color: #6ee7b7 !important;
}

.dark .text-blue-500 {
  color: #93c5fd !important;
}

.dark .text-red-500 {
  color: #fca5a5 !important;
}

.dark .text-yellow-500 {
  color: #fcd34d !important;
}

.dark .text-green-400 {
  color: #86efac !important;
}

.dark .text-blue-400 {
  color: #93c5fd !important;
}

.dark .text-red-400 {
  color: #fca5a5 !important;
}

.dark .text-yellow-400 {
  color: #fde047 !important;
}

.dark .text-green-300 {
  color: #a7f3d0 !important;
}

.dark .text-blue-300 {
  color: #bfdbfe !important;
}

.dark .text-red-300 {
  color: #fecaca !important;
}

.dark .text-yellow-300 {
  color: #fef3c7 !important;
}

/* Purple/Orange/Amber Color Overrides für Dark Mode */
.dark .text-purple-600 {
  color: #a78bfa !important;
}

.dark .text-purple-500 {
  color: #a78bfa !important;
}

.dark .text-purple-400 {
  color: #c4b5fd !important;
}

.dark .text-orange-600 {
  color: #fb923c !important;
}

.dark .text-orange-500 {
  color: #fb923c !important;
}

.dark .text-orange-400 {
  color: #fdba74 !important;
}

.dark .text-amber-600 {
  color: #fbbf24 !important;
}

.dark .text-amber-500 {
  color: #fbbf24 !important;
}

.dark .text-amber-400 {
  color: #fcd34d !important;
}

.dark .text-indigo-600 {
  color: #818cf8 !important;
}

.dark .text-indigo-500 {
  color: #818cf8 !important;
}

.dark .text-indigo-400 {
  color: #a5b4fc !important;
}

/* Konsistente Hintergrund-Farben für Dark Mode Cards */
.dark .bg-blue-50 {
  background-color: rgba(59, 130, 246, 0.1) !important;
}

.dark .bg-green-50 {
  background-color: rgba(34, 197, 94, 0.1) !important;
}

.dark .bg-purple-50 {
  background-color: rgba(147, 51, 234, 0.1) !important;
}

.dark .bg-yellow-50 {
  background-color: rgba(234, 179, 8, 0.1) !important;
}

.dark .bg-red-50 {
  background-color: rgba(239, 68, 68, 0.1) !important;
}

.dark .bg-orange-50 {
  background-color: rgba(249, 115, 22, 0.1) !important;
}

.dark .bg-amber-50 {
  background-color: rgba(245, 158, 11, 0.1) !important;
}

.dark .bg-indigo-50 {
  background-color: rgba(99, 102, 241, 0.1) !important;
}

/* Dark Mode Gradient Backgrounds */
.dark .from-blue-50 {
  --tw-gradient-from: rgba(59, 130, 246, 0.1) !important;
}

.dark .from-green-50 {
  --tw-gradient-from: rgba(34, 197, 94, 0.1) !important;
}

.dark .from-purple-50 {
  --tw-gradient-from: rgba(147, 51, 234, 0.1) !important;
}

.dark .from-yellow-50 {
  --tw-gradient-from: rgba(234, 179, 8, 0.1) !important;
}

.dark .from-red-50 {
  --tw-gradient-from: rgba(239, 68, 68, 0.1) !important;
}

/* Enhanced Chart Container - Dark & Light Mode */
canvas {
  background-color: transparent !important;
  max-width: 100%;
  height: auto;
}

/* Chart Container overflow control to prevent overlap */
#integrated-charts-grid {
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.dark canvas {
  background-color: transparent !important;
}

/* Global Dark Mode Background with CSS Variables */
.dark body {
  background-color: #0f172a !important;
}

.dark .bg-gray-900 {
  background-color: #0f172a !important;
}

/* Header Dark Mode Enhancement */
.dark header {
  background-color: var(--bg-primary) !important;
  border-bottom-color: var(--border-primary) !important;
}

/* Improved Shadow for Dark Mode - More Visible */
.dark .shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.8), 0 4px 6px -2px rgba(0, 0, 0, 0.6) !important;
}

.dark .shadow-md {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.4) !important;
}

.dark .shadow {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3) !important;
}

/* Improved theme-aware contrast classes */
.contrast-text {
  color: var(--text-primary);
}

.contrast-text-secondary {
  color: var(--text-secondary);
}

.contrast-bg {
  background-color: var(--bg-primary);
}

.contrast-border {
  border-color: var(--border-primary);
}

/* Focus styles for accessibility */
input:focus, select:focus, textarea:focus {
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
  outline: none;
}

.dark input:focus, .dark select:focus, .dark textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* Tooltips */
.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
}

.dark .tooltip:hover::after {
  background-color: rgba(255, 255, 255, 0.9);
  color: #1f2937;
}

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

/* Mobile First Approach */
@media (max-width: 320px) {
  body {
    font-size: 14px;
  }
  
  header h1 { 
    font-size: 1rem;
    max-width: 180px;
  }
  
  .kpi-card {
    min-height: 0;
    padding: 0.5rem 0.75rem;
  }
  
  .mobile-nav-btn {
    min-height: 60px;
    font-size: 0.875rem;
    padding: 0.5rem 0.25rem;
  }
  
  .mobile-nav-btn i {
    font-size: 1rem;
    margin-bottom: 0.25rem;
  }
  
  #mobile-nav {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }
  
  .page-content {
    padding-top: 0.5rem;
    padding-bottom: 1rem;
  }
}

@media (max-width: 640px) {
  header h1 { 
    font-size: 1.125rem;
    max-width: 200px;
  }
  
  .kpi-card {
    min-height: 0;
    padding: 0.625rem 0.75rem;
  }
  
  .chart-overlay {
    position: static !important;
    margin: 4px 0;
    display: inline-block;
    width: calc(50% - 2px);
  }
  
  .mobile-nav-btn {
    min-height: 65px;
    font-size: 0.875rem;
    padding: 0.625rem 0.375rem;
  }
  
  .mobile-nav-btn i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
  }
  
  #mobile-nav {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

@media (min-width: 640px) {
  header h1 { max-width: 300px; }
}

@media (min-width: 768px) {
  .chart-container canvas { height: 300px !important; }
}

@media (min-width: 1024px) {
  header h1 { max-width: none; }
}

/* Navigation Visibility */
@media (max-width: 1279px) {
  nav.xl\\:flex { display: none !important; }
}

@media (min-width: 1280px) {
  nav.xl\\:hidden { display: none !important; }
  #mobile-nav { display: none !important; }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  nav.hidden.lg\\:flex.xl\\:hidden { display: flex !important; }
  #mobile-nav { display: none !important; }
}

@media (max-width: 1023px) {
  nav.hidden.lg\\:flex.xl\\:hidden { display: none !important; }
  nav.xl\\:flex { display: none !important; }
}

/* Tablet Navigation (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
  .nav-btn {
    padding: 0.25rem 0.375rem;
    font-size: 0.75rem;
  }
  .nav-btn i {
    font-size: 0.75rem;
  }
}

/* Desktop Navigation (1280px+) */
@media (min-width: 1280px) {
  .nav-btn {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
  }
  .nav-btn i {
    font-size: 0.875rem;
  }
}

@media (min-width: 1536px) {
  .nav-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

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

/* Loading States */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 100;
}

.dark .loading-overlay {
  background-color: rgba(31, 41, 55, 0.8);
}

/* Scrollbars */
.scroll-container::-webkit-scrollbar,
.custom-scrollbar::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.scroll-container::-webkit-scrollbar-track,
.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 6px;
  margin: 4px;
}

.scroll-container::-webkit-scrollbar-thumb,
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
  border-radius: 6px;
  border: 2px solid #f1f5f9;
}

.scroll-container::-webkit-scrollbar-thumb:hover,
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.dark .scroll-container::-webkit-scrollbar-track,
.dark .custom-scrollbar::-webkit-scrollbar-track {
  background: #1f2937;
  border: 1px solid #374151;
}

.dark .scroll-container::-webkit-scrollbar-thumb,
.dark .custom-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%);
  border: 2px solid #1f2937;
}

.dark .scroll-container::-webkit-scrollbar-thumb:hover,
.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
}

/* Enhanced Plot Container Styling */
#integrated-charts-grid > div {
  transition: all 0.3s ease;
}

#integrated-charts-grid > div:hover {
  transform: translateY(-2px);
}

/* Timeframe Button States */
.timeframe-btn-integrated.active {
  background: rgba(255, 255, 255, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  color: white !important;
  font-weight: 700;
  transform: scale(1.05);
}

.timeframe-btn-integrated {
  transition: all 0.2s ease;
}

.timeframe-btn-integrated:hover {
  transform: translateY(-1px);
}

/* Gateway Details Section Enhancements */
#gateway-details-section {
  animation: fadeInUp 0.4s ease-out;
}

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

/* Pulsing Gateway Selector Animation - Strong glow without size change */
.gateway-selector-pulse {
  animation: pulse-selector 2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
}

@keyframes pulse-selector {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(59, 130, 246, 0);
  }
}

/* ================================
   ERROR POPUP STYLES
   ================================ */

/* Container für alle Error-Pop-ups */
.error-popup-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  pointer-events: none;
}

/* Pop-up Overlay */
.error-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: all;
}

.error-popup-visible {
  opacity: 1;
}

.error-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

/* Pop-up Content Container */
.error-popup-content {
  position: relative;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: popupSlideIn 0.3s ease-out;
}

.dark .error-popup-content {
  background: #1e293b;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

@keyframes popupSlideIn {
  from {
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Pop-up Header */
.error-popup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.dark .error-popup-header {
  border-bottom-color: #334155;
}

.error-popup-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.error-popup-title {
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
  flex: 1;
  margin: 0;
}

.dark .error-popup-title {
  color: #f8fafc;
}

.error-popup-close {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.error-popup-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.dark .error-popup-close:hover {
  background: #334155;
  color: #f8fafc;
}

/* Pop-up Body */
.error-popup-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.error-popup-message {
  color: #374151;
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 16px 0;
}

.dark .error-popup-message {
  color: #e2e8f0;
}

/* Details Section */
.error-popup-details {
  margin-top: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
}

.dark .error-popup-details {
  background: #0f172a;
  border-color: #334155;
}

.error-popup-details summary {
  cursor: pointer;
  font-weight: 500;
  color: #475569;
  font-size: 14px;
  padding: 4px;
  user-select: none;
}

.dark .error-popup-details summary {
  color: #94a3b8;
}

.error-popup-details summary:hover {
  color: #0f172a;
}

.dark .error-popup-details summary:hover {
  color: #f8fafc;
}

.error-popup-details pre {
  margin: 12px 0 0 0;
  padding: 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: #475569;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.dark .error-popup-details pre {
  background: #1e293b;
  border-color: #475569;
  color: #94a3b8;
}

/* Queue Info */
.error-popup-queue {
  margin-top: 16px;
  padding: 12px;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  color: #92400e;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dark .error-popup-queue {
  background: #422006;
  color: #fde68a;
}

/* Pop-up Footer */
.error-popup-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.dark .error-popup-footer {
  border-top-color: #334155;
  background: #0f172a;
}

/* Buttons */
.error-popup-btn {
  flex: 1;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.error-popup-btn-primary {
  background: #3b82f6;
  color: white;
}

.error-popup-btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.error-popup-btn-secondary {
  background: #e2e8f0;
  color: #475569;
}

.dark .error-popup-btn-secondary {
  background: #334155;
  color: #e2e8f0;
}

.error-popup-btn-secondary:hover {
  background: #cbd5e1;
}

.dark .error-popup-btn-secondary:hover {
  background: #475569;
}

/* Severity-spezifische Styles */
.error-popup-error .error-popup-header {
  background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
}

.dark .error-popup-error .error-popup-header {
  background: linear-gradient(135deg, #450a0a 0%, #1e293b 100%);
}

.error-popup-warning .error-popup-header {
  background: linear-gradient(135deg, #fffbeb 0%, #fff 100%);
}

.dark .error-popup-warning .error-popup-header {
  background: linear-gradient(135deg, #422006 0%, #1e293b 100%);
}

.error-popup-info .error-popup-header {
  background: linear-gradient(135deg, #eff6ff 0%, #fff 100%);
}

.dark .error-popup-info .error-popup-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%);
}

/* Responsive Anpassungen */
@media (max-width: 640px) {
  .error-popup-content {
    max-width: 95%;
    width: 95%;
    border-radius: 8px;
  }
  
  .error-popup-header,
  .error-popup-body,
  .error-popup-footer {
    padding: 16px;
  }
  
  .error-popup-title {
    font-size: 16px;
  }
  
  .error-popup-footer {
    flex-direction: column;
  }
  
  .error-popup-btn {
    width: 100%;
  }
}

/* Print Styles */
@media print {
  .no-print { display: none !important; }
  .bg-white { background: white !important; }
  .text-white { color: black !important; }
  .error-popup-container { display: none !important; }
}

/* Toast Notifications - Extrem dezent und minimalistisch */
.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast {
  background: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 8px 12px;
  max-width: 280px;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(8px);
}

.dark .toast {
  background: rgba(31, 41, 55, 0.85);
  color: rgba(243, 244, 246, 0.9);
}

.toast.toast-error {
  border-left: 2px solid rgba(239, 68, 68, 0.6);
  background: rgba(254, 242, 242, 0.85);
}

.dark .toast.toast-error {
  background: rgba(127, 29, 29, 0.5);
}

.toast.toast-warning {
  border-left: 2px solid rgba(245, 158, 11, 0.6);
  background: rgba(254, 252, 232, 0.85);
}

.dark .toast.toast-warning {
  background: rgba(120, 53, 15, 0.5);
}

.toast.toast-info {
  border-left: 2px solid rgba(59, 130, 246, 0.6);
  background: rgba(239, 246, 255, 0.85);
}

.dark .toast.toast-info {
  background: rgba(30, 58, 138, 0.5);
}

.toast-close {
  display: none;
}

/* ================================
   COLLAPSIBLE SECTIONS - ANLAGEN
   ================================ */

.section-toggle-btn {
  cursor: pointer;
  user-select: none;
}

.section-toggle-btn:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: -2px;
}

.section-content-collapsed {
  max-height: 0 !important;
  overflow: hidden;
}

.section-content-expanded {
  max-height: none;
}
/* Navigation Tab Styles */
.nav-tab-btn {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 500;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  position: relative;
}

.nav-tab-btn:hover {
  color: #374151;
  background-color: rgba(0, 0, 0, 0.02);
}

.nav-tab-btn.active {
  color: #1e40af;
  font-weight: 600;
  animation: gentle-pulse 2s ease-in-out infinite;
}

.nav-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background-color: #1e40af;
  border-radius: 2px;
}

@keyframes gentle-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(30, 64, 175, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0);
  }
}

.dark .nav-tab-btn {
  color: #9ca3af;
}

.dark .nav-tab-btn:hover {
  color: #e5e7eb;
  background-color: rgba(255, 255, 255, 0.05);
}

.dark .nav-tab-btn.active {
  color: #60a5fa;
  animation: gentle-pulse-dark 2s ease-in-out infinite;
}

/* Enhanced Data Display Styles */
.data-overview-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  transition: all 0.3s ease;
}

.dark .data-overview-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.data-category-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  margin-bottom: 4px;
}

.dark .data-category-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.data-category-header {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
}

.dark .data-category-header {
  border-bottom: 2px solid #334155;
}

.data-category-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  font-size: 12px;
}

.data-item {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
  padding: 4px 8px;
  margin-bottom: 1px;
  border-radius: 6px;
  background: rgba(255,255,255,0.6);
  transition: all 0.2s ease;
}

.dark .data-item {
  background: rgba(255,255,255,0.05);
}

.data-item:hover {
  background: rgba(59, 130, 246, 0.1);
  transform: translateX(2px);
}

.dark .data-item:hover {
  background: rgba(59, 130, 246, 0.2);
}

.data-item-label {
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.dark .data-item-label {
  color: #d1d5db;
}

.data-item-value {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.875rem;
  font-family: 'Monaco', 'Menlo', monospace;
  flex-shrink: 0;
}

.dark .data-item-value {
  color: #f3f4f6;
}

.data-metric-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
}

.dark .data-metric-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.data-metric-value {
  font-size: 20px;
  font-weight: 700;
  margin: 4px 0;
  font-family: 'Monaco', 'Menlo', monospace;
}

.data-metric-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dark .data-metric-label {
  color: #9ca3af;
}

.data-metric-unit {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 2px;
}

.dark .data-metric-unit {
  color: #6b7280;
}

/* Kompakte Varianten für Anlagenfenster */
.data-overview-card-compact {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.dark .data-overview-card-compact {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.data-category-card-compact {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.dark .data-category-card-compact {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.data-category-icon-compact {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.data-item-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.5);
}

.dark .data-item-compact {
  background: rgba(255,255,255,0.03);
}

.data-item-label-compact {
  font-weight: 500;
  color: #6b7280;
  font-size: 0.75rem;
  white-space: nowrap;
}

.dark .data-item-label-compact {
  color: #9ca3af;
}

.data-item-value-compact {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.75rem;
  font-family: 'Monaco', 'Menlo', monospace;
}

.dark .data-item-value-compact {
  color: #e5e7eb;
}

/* Ultra-kompaktes Diagnose-Layout */
.diagnostics-compact-container {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}

.dark .diagnostics-compact-container {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
}

.diagnostics-compact-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 8px;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-bottom: 1px solid #93c5fd;
}

.dark .diagnostics-compact-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  border-bottom: 1px solid #3b82f6;
}

.diagnostics-compact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
}

@media (min-width: 1440px) {
  .diagnostics-compact-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1200px) {
  .diagnostics-compact-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .diagnostics-compact-grid {
    grid-template-columns: 1fr;
  }
}

.diagnostics-category-compact {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.dark .diagnostics-category-compact {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid #475569;
}

.diagnostics-category-header-compact {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.dark .diagnostics-category-header-compact {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.diagnostics-category-content-compact {
  padding: 4px;
}

.diagnostics-item-compact {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  align-items: center;
  padding: 1px 4px;
  font-size: 0.75rem;
  line-height: 1.1;
}

.diagnostics-label-compact {
  color: #4b5563;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dark .diagnostics-label-compact {
  color: #9ca3af;
}

.diagnostics-value-compact {
  font-weight: 600;
  font-family: 'Monaco', 'Menlo', monospace;
  text-align: right;
  white-space: nowrap;
}

/* Tab Content Styles */
.tab-content {
  animation: fadeIn 0.3s ease;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  padding: 8px;
  margin: 4px 0;
  backdrop-filter: blur(1px);
}

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

/* Analytics Tab Content Styles */
.analytics-tab-content {
  animation: fadeIn 0.3s ease;
}

.analytics-tab-content.hidden {
  display: none;
}

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

/* ================================
   JAZ HIGHLIGHT STYLES
   ================================ */

/* JAZ Highlight Classes for Gateway Table */
#gateways-table tr.jaz-highlight-excellent {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
  border-left: 4px solid #22c55e;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
  animation: highlightPulse 0.5s ease;
}

#gateways-table tr.jaz-highlight-good {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-left: 4px solid #10b981;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
  animation: highlightPulse 0.5s ease;
}

#gateways-table tr.jaz-highlight-acceptable {
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.1) 0%, rgba(234, 179, 8, 0.05) 100%);
  border-left: 4px solid #eab308;
  box-shadow: 0 2px 8px rgba(234, 179, 8, 0.2);
  animation: highlightPulse 0.5s ease;
}

#gateways-table tr.jaz-highlight-improvement {
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.1) 0%, rgba(249, 115, 22, 0.05) 100%);
  border-left: 4px solid #f97316;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.2);
  animation: highlightPulse 0.5s ease;
}

#gateways-table tr.jaz-highlight-poor {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
  border-left: 4px solid #ef4444;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
  animation: highlightPulse 0.5s ease;
}

#gateways-table tr.jaz-highlight-all {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.1) 0%, rgba(124, 58, 237, 0.05) 100%);
  border-left: 4px solid #7c3aed;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
  animation: highlightPulse 0.5s ease;
}

@keyframes highlightPulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.02);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Enhanced hover effects for highlighted rows */
#gateways-table tr.jaz-highlight-excellent:hover,
#gateways-table tr.jaz-highlight-good:hover,
#gateways-table tr.jaz-highlight-acceptable:hover,
#gateways-table tr.jaz-highlight-improvement:hover,
#gateways-table tr.jaz-highlight-poor:hover,
#gateways-table tr.jaz-highlight-all:hover {
  transform: translateX(4px);
  transition: transform 0.2s ease;
}

/* ================================
   JAZ PERIOD SELECTION STYLES
   ================================ */

/* JAZ Period Button Styles */
.jaz-period-btn {
  position: relative;
  overflow: hidden;
}

.jaz-period-btn.active {
  background: rgba(255, 255, 255, 0.3) !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.jaz-period-btn:not(.active):hover {
  background: rgba(255, 255, 255, 0.15) !important;
}

.jaz-period-btn.active::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: white;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* ================================
   THEME KONSISTENZ - QUICK REFERENCE
   ================================
   
   PRIMÄRE VARIABLEN (automatisch Dark Mode aware):
   - var(--text-primary)    → Haupttext (dunkel/hell je nach Mode)
   - var(--text-secondary)  → Sekundärtext
   - var(--text-muted)      → Gedämpfter Text
   - var(--text-accent)     → Akzentfarbe (Mulberry/Sea-Pink)
   
   - var(--bg-primary)      → Haupthintergrund
   - var(--bg-secondary)    → Sekundärhintergrund
   - var(--bg-tertiary)     → Tertiärhintergrund
   
   - var(--border-primary)  → Hauptrahmenfarbe
   - var(--border-secondary)→ Sekundärrahmenfarbe
   
   STATUS FARBEN:
   - var(--status-success)  → Grün (#10b981 / #34d399)
   - var(--status-warning)  → Orange (#f59e0b / #fbbf24)
   - var(--status-error)    → Rot (#ef4444 / #f87171)
   - var(--status-info)     → Blau-Violett
   
   AKZENT FARBEN:
   - var(--accent-primary)  → Mulberry (#c75380)
   - var(--accent-secondary)→ Blue-Violet (#675cbf)
   - var(--vaillant-blue)   → Vaillant Blau
   
   CSS KLASSEN (empfohlen statt Tailwind):
   - .text-primary          → Haupttext
   - .text-secondary        → Sekundärtext
   - .text-muted            → Gedämpfter Text
   - .heading-primary       → Überschriften
   - .card-readable         → Konsistente Karten
   - .card-bg               → Karten-Hintergrund
   
   ================================ */

/* ================================
   DARK MODE COMPLETE FIX - FEBRUARY 2026
   ================================ */

/* Body & Main Container Dark Mode */
.dark body,
.dark main,
.dark .min-h-screen {
  background-color: #0f172a !important;
  color: #e2e8f0 !important;
}

/* All Card Backgrounds - Consistent Dark Mode */
.dark .bg-white,
.dark [class*="bg-white"] {
  background-color: #1e293b !important;
}

.dark .bg-gray-50,
.dark [class*="bg-gray-50"] {
  background-color: #111827 !important;
}

.dark .bg-gray-100,
.dark [class*="bg-gray-100"] {
  background-color: #1f2937 !important;
}

/* Text Color Fixes - Ensure Readability */
.dark h1, .dark h2, .dark h3, .dark h4, .dark h5, .dark h6 {
  color: #f1f5f9 !important;
}

.dark p, .dark span, .dark div, .dark li, .dark td, .dark th {
  color: inherit;
}

.dark label {
  color: #e2e8f0 !important;
}

/* Input/Select Dark Mode */
.dark input,
.dark select,
.dark textarea {
  background-color: #1e293b !important;
  border-color: #4b5563 !important;
  color: #f1f5f9 !important;
}

.dark input::placeholder,
.dark textarea::placeholder {
  color: #9ca3af !important;
}

.dark input:focus,
.dark select:focus,
.dark textarea:focus {
  border-color: #60a5fa !important;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15) !important;
}

/* Button Dark Mode Fixes */
.dark button {
  color: inherit;
}

.dark .bg-gray-500,
.dark .bg-gray-600 {
  background-color: #4b5563 !important;
}

.dark .hover\:bg-gray-600:hover,
.dark .hover\:bg-gray-700:hover {
  background-color: #374151 !important;
}

/* Border Dark Mode */
.dark [class*="border-gray-200"],
.dark [class*="border-gray-300"] {
  border-color: #374151 !important;
}

.dark [class*="border-gray-400"],
.dark [class*="border-gray-500"] {
  border-color: #4b5563 !important;
}

/* Shadow Dark Mode Enhancement */
.dark .shadow,
.dark .shadow-sm,
.dark .shadow-md,
.dark .shadow-lg,
.dark .shadow-xl {
  --tw-shadow-color: rgba(0, 0, 0, 0.5) !important;
}

/* Modal/Overlay Dark Mode */
.dark .bg-black\/50,
.dark [class*="bg-opacity"] {
  background-color: rgba(0, 0, 0, 0.75) !important;
}

/* Tabs Dark Mode Fix */
.dark .tab-btn,
.dark [class*="tab-"] {
  color: #94a3b8;
  border-color: transparent;
}

.dark .tab-btn:hover,
.dark .tab-btn.active {
  color: #f1f5f9;
  background-color: rgba(59, 130, 246, 0.15);
}

/* Loading Spinner Dark Mode */
.dark .animate-spin,
.dark .fa-spinner {
  color: #60a5fa !important;
}

/* Badge/Pill Dark Mode */
.dark .rounded-full[class*="bg-blue"] {
  background-color: rgba(59, 130, 246, 0.2) !important;
  color: #93c5fd !important;
}

.dark .rounded-full[class*="bg-green"] {
  background-color: rgba(34, 197, 94, 0.2) !important;
  color: #86efac !important;
}

.dark .rounded-full[class*="bg-red"] {
  background-color: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
}

.dark .rounded-full[class*="bg-yellow"],
.dark .rounded-full[class*="bg-amber"] {
  background-color: rgba(245, 158, 11, 0.2) !important;
  color: #fcd34d !important;
}

/* Fix for specific problematic areas */
.dark #status-overview-container,
.dark #alarms-table-container,
.dark #plants-grid,
.dark #parameter-settings-container {
  background-color: transparent !important;
}

.dark #status-overview-container .tabulator,
.dark #alarms-table-container .tabulator {
  background-color: #1e293b !important;
}

/* Chart.js Dark Mode */
.dark .chartjs-render-monitor {
  background-color: transparent !important;
}

/* Gradient Backgrounds Dark Mode Fix */
.dark [class*="from-white"] {
  --tw-gradient-from: #1e293b !important;
}

.dark [class*="to-gray-50"] {
  --tw-gradient-to: #111827 !important;
}

.dark .bg-gradient-to-br.from-white.to-gray-50 {
  background: linear-gradient(to bottom right, #1e293b, #111827) !important;
}

.dark .bg-gradient-to-r.from-white {
  background: linear-gradient(to right, #1e293b, #111827) !important;
}

/* Gateway Selector Dark Mode */
.dark #gateway-selector {
  background-color: #1e293b !important;
  border-color: #4b5563 !important;
  color: #f1f5f9 !important;
}

.dark #gateway-selector option {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
}

/* Hover States Dark Mode */
.dark tr:hover td,
.dark .hover\:bg-gray-50:hover {
  background-color: #334155 !important;
}

.dark .hover\:bg-gray-100:hover {
  background-color: #374151 !important;
}

/* Sticky Header Dark Mode */
.dark .sticky {
  background-color: #1e293b !important;
  border-color: #374151 !important;
}

/* Help System / Popups Dark Mode */
.dark .fixed[class*="bg-white"],
.dark .absolute[class*="bg-white"] {
  background-color: #1e293b !important;
  border-color: #374151 !important;
}

/* Icons Dark Mode */
.dark .fa-sun {
  color: #fbbf24 !important;
}

.dark .fa-moon {
  color: #93c5fd !important;
}

/* Ring/Outline Dark Mode */
.dark [class*="ring-"] {
  --tw-ring-color: rgba(96, 165, 250, 0.5) !important;
}

.dark .focus\:ring-blue-500:focus {
  --tw-ring-color: rgba(59, 130, 246, 0.5) !important;
}

/* Print Override - Always Light Mode */
@media print {
  .dark body,
  .dark * {
    background-color: white !important;
    color: black !important;
  }
}

/* ================================
   PERFORMANCE OPTIMIZATIONS
   ================================ */

/* Reduce Repaints */
.kpi-card,
.card-readable,
.tabulator-row,
.nav-btn {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Optimize Animations */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Lazy Load Images */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* ================================
   LIVE UPDATE ANIMATIONS
   ================================ */

/* Value Change Highlight */
.value-changed {
  animation: valueFlash 0.5s ease-in-out;
}

@keyframes valueFlash {
  0%, 100% {
    background-color: transparent;
  }
  50% {
    background-color: rgba(59, 130, 246, 0.2);
  }
}

/* Dark Mode Value Flash */
.dark .value-changed {
  animation: valueFlashDark 0.5s ease-in-out;
}

@keyframes valueFlashDark {
  0%, 100% {
    background-color: transparent;
  }
  50% {
    background-color: rgba(96, 165, 250, 0.15);
  }
}

/* Smooth Number Transitions */
[id*="summary-"],
[id*="device-"],
[id*="setting-"],
[id*="param-"] {
  transition: color 0.3s ease;
}

/* Last Refresh Indicator */
#last-refresh-time {
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 500;
}

.dark #last-refresh-time {
  color: #9ca3af;
}

/* Update Pulse Animation */
.updating-pulse {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* ================================
   COMPACT LAYOUT STYLES
   ================================ */

/* Compact Loading States */
.compact-loading {
  min-height: 120px;
  position: relative;
}

.compact-loading.loaded {
  min-height: auto;
}

/* Sticky System Components Header */
.sticky {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Content Selector Dropdown */
#content-selector {
  font-size: 0.9375rem;
  font-weight: 500;
}

#content-selector option {
  padding: 8px;
}

/* Compact Tab Content */
.tab-content {
  transition: opacity 0.2s ease-in-out;
}

.tab-content.hidden {
  display: none;
  opacity: 0;
}

.tab-content.active {
  display: block;
  opacity: 1;
}

/* ================================
   CHANGELOGS — Flat Compact Timeline
   ================================ */

/* --- Toolbar (Suche + Filter) --- */
.cl-toolbar {
  margin-bottom: 3px;
}

.cl-search-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.cl-search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.cl-search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: #9ca3af;
  pointer-events: none;
}

.dark .cl-search-icon { color: #6b7280; }

.cl-search-input {
  width: 100%;
  padding: 4px 26px 4px 28px;
  font-size: 13px;
  line-height: 1.3;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #fff;
  color: #111827;
  outline: none;
  transition: border-color 0.15s;
}

.dark .cl-search-input {
  background: #1f2937;
  border-color: #374151;
  color: #f3f4f6;
}

.cl-search-input:focus {
  border-color: #0070BA;
  box-shadow: 0 0 0 2px rgba(0, 112, 186, 0.12);
}

.dark .cl-search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.cl-search-input::placeholder {
  color: #9ca3af;
  font-style: normal;
}

.dark .cl-search-input::placeholder { color: #6b7280; }

.cl-search-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 2px 5px;
  font-size: 13px;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
}

.cl-search-clear:hover { color: #6b7280; }
.dark .cl-search-clear:hover { color: #d1d5db; }

/* --- Zeitfilter-Buttons --- */
.cl-time-filters {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.cl-time-btn {
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  line-height: 1.3;
}

.dark .cl-time-btn {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.cl-time-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.dark .cl-time-btn:hover {
  background: #374151;
  color: #e5e7eb;
}

.cl-time-btn.active {
  background: #0070BA;
  border-color: #0070BA;
  color: #fff;
}

.dark .cl-time-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

/* --- Kategorie-Chips --- */
.cl-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 3px;
}

.cl-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  line-height: 1.4;
}

.dark .cl-chip {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.cl-chip:hover {
  background: #f3f4f6;
  color: #374151;
}

.dark .cl-chip:hover {
  background: #374151;
  color: #e5e7eb;
}

.cl-chip.active {
  background: #eff6ff;
  border-color: #0070BA;
  color: #0070BA;
  font-weight: 600;
}

.dark .cl-chip.active {
  background: rgba(37, 99, 235, 0.15);
  border-color: #3b82f6;
  color: #93c5fd;
}

.cl-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Chip dot colors */
.cl-dot-green   { background: #10b981; }
.cl-dot-purple  { background: #8b5cf6; }
.cl-dot-amber   { background: #f59e0b; }
.cl-dot-blue    { background: #3b82f6; }
.cl-dot-gray    { background: #6b7280; }
.cl-dot-indigo  { background: #6366f1; }

/* --- Ergebnis-Zähler --- */
.cl-result-count {
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.2;
  padding: 0;
}

.dark .cl-result-count { color: #6b7280; }

.cl-result-count.cl-filtered {
  color: #0070BA;
  font-weight: 500;
}

.dark .cl-result-count.cl-filtered { color: #60a5fa; }

/* --- Timeline Container --- */
.cl-timeline {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.dark .cl-timeline {
  scrollbar-color: #4b5563 transparent;
}

.cl-timeline::-webkit-scrollbar { width: 5px; }
.cl-timeline::-webkit-scrollbar-track { background: transparent; }
.cl-timeline::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.dark .cl-timeline::-webkit-scrollbar-thumb { background: #4b5563; }

/* --- Tages-Separator --- */
.cl-date-sep {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 1px 1px;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 0;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.dark .cl-date-sep {
  color: #9ca3af;
  border-bottom-color: #1f2937;
  background: #111827;
}

/* --- Einzelne Änderungs-Zeile --- */
.cl-row {
  display: grid;
  grid-template-columns: 32px 6px minmax(120px, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  min-height: 28px;
  border-bottom: 1px solid #f9fafb;
  font-size: 13px;
  line-height: 1.35;
  transition: background 0.1s;
  border-radius: 2px;
  max-width: 100%;
}

.dark .cl-row {
  border-bottom-color: #1f293780;
}

.cl-row:hover {
  background: #f9fafb;
}

.dark .cl-row:hover {
  background: rgba(55, 65, 81, 0.3);
}

.cl-row:focus-visible {
  outline: 2px solid #0070BA;
  outline-offset: -1px;
  border-radius: 3px;
}

.dark .cl-row:focus-visible {
  outline-color: #3b82f6;
}

/* Uhrzeit-Spalte */
.cl-time {
  font-size: 12px;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  color: #9ca3af;
  white-space: nowrap;
  text-align: right;
}

.dark .cl-time { color: #6b7280; }

/* Kategorie-Pip (kleiner farbiger Punkt) */
.cl-cat-pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cl-pip-green   { background: #10b981; }
.cl-pip-purple  { background: #8b5cf6; }
.cl-pip-amber   { background: #f59e0b; }
.cl-pip-blue    { background: #3b82f6; }
.cl-pip-gray    { background: #6b7280; }
.cl-pip-indigo  { background: #6366f1; }

/* Feldname — volle Breite, kann umbrechen bei langen Namen */
.cl-field {
  font-weight: 500;
  color: #374151;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.3;
  min-width: 0;
}

.dark .cl-field { color: #d1d5db; }

/* Wert-Spalte */
.cl-value {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 13px;
}

.cl-val-old {
  color: #9ca3af;
  text-decoration: line-through;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.dark .cl-val-old { color: #6b7280; }

.cl-arrow {
  color: #d1d5db;
  font-size: 12px;
}

.dark .cl-arrow { color: #4b5563; }

.cl-val-new {
  font-weight: 600;
  color: #1d4ed8;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.dark .cl-val-new { color: #60a5fa; }

/* Delta (+/- Wert) */
.cl-delta {
  font-size: 13px;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-weight: 600;
}

.cl-delta-up   { color: #059669; }
.cl-delta-down { color: #dc2626; }

.dark .cl-delta-up   { color: #34d399; }
.dark .cl-delta-down { color: #f87171; }

/* Boolean-Indikator (einzelner Punkt + Text) */
.cl-bool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  font-size: 13px;
}

.cl-bool::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cl-dot-on  { color: #059669; }
.cl-dot-off { color: #9ca3af; }

.dark .cl-dot-on  { color: #34d399; }
.dark .cl-dot-off { color: #6b7280; }

.cl-dot-on::before  { background: #10b981; }
.cl-dot-off::before { background: #d1d5db; }

.dark .cl-dot-off::before { background: #4b5563; }

/* Objekt-Änderung */
.cl-obj {
  font-weight: 500;
  font-size: 13px;
  color: #6b7280;
}

.cl-obj-add { color: #059669; }
.cl-obj-rm  { color: #dc2626; }

.dark .cl-obj     { color: #9ca3af; }
.dark .cl-obj-add { color: #34d399; }
.dark .cl-obj-rm  { color: #f87171; }

/* Leerzustand */
.cl-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px;
  color: #9ca3af;
  font-size: 13px;
}

.dark .cl-empty { color: #6b7280; }

.cl-empty i { font-size: 13px; }

/* --- Responsive --- */
@media (max-width: 480px) {
  .cl-search-row {
    flex-direction: column;
    gap: 4px;
  }

  .cl-time-filters {
    width: 100%;
    justify-content: stretch;
  }

  .cl-time-btn { flex: 1; text-align: center; }

  .cl-row {
    grid-template-columns: 32px 6px 1fr;
    gap: 4px;
  }

  /* Wert unter Feldname auf kleinen Screens */
  .cl-value {
    grid-column: 3 / -1;
    padding-left: 0;
  }

  .cl-timeline { max-height: 320px; }
}
/* ================================
   PARAMETER TABLE HORIZONTAL SCROLL
   ================================ */

/* Container - kein eigenes Scrolling, Tabulator handhabt das */
#parameters-container {
  width: 100%;
}

/* Tabulator füllt den Container und scrollt intern */
#parameters-table-container .tabulator {
  width: 100%;
}

/* Scrollbar Styling für Tabulator-eigene horizontale Scrollbar */
#parameters-table-container .tabulator-tableHolder::-webkit-scrollbar {
  height: 10px;
}

#parameters-table-container .tabulator-tableHolder::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 5px;
}

.dark #parameters-table-container .tabulator-tableHolder::-webkit-scrollbar-track {
  background: #374151;
}

#parameters-table-container .tabulator-tableHolder::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 5px;
}

.dark #parameters-table-container .tabulator-tableHolder::-webkit-scrollbar-thumb {
  background: #6b7280;
}

#parameters-table-container .tabulator-tableHolder::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

.dark #parameters-table-container .tabulator-tableHolder::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Spalten-Selektor Panel Animation */
#column-selector-panel {
  transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
}

#column-selector-panel.hidden {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

/* ============================================================================
   PANEL TAB BAR — Ersetzt das alte <select> Dropdown
   Gruppierte, accessible, keyboard-navigierbare Tab-Navigation
   ============================================================================ */

.panel-tab-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
  background: #f9fafb;
}

.panel-tab-bar::-webkit-scrollbar { display: none; }

.dark .panel-tab-bar {
  background: #111827;
}

.panel-tab-group {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.panel-tab-divider {
  width: 1px;
  height: 16px;
  background: #e5e7eb;
  margin: 0 2px;
  flex-shrink: 0;
}

.dark .panel-tab-divider {
  background: #374151;
}

.panel-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  position: relative;
  outline: none;
}

.panel-tab i {
  font-size: 13px;
  opacity: 0.7;
}

.panel-tab:hover {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.panel-tab:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
  border-radius: 4px;
}

.panel-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background: rgba(59, 130, 246, 0.08);
}

.panel-tab.active i {
  opacity: 1;
}

.dark .panel-tab {
  color: #9ca3af;
}

.dark .panel-tab:hover {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.08);
}

.dark .panel-tab.active {
  color: #60a5fa;
  border-bottom-color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
}

.panel-tab-group-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  padding: 0 4px;
  white-space: nowrap;
  align-self: center;
  flex-shrink: 0;
  user-select: none;
}

.dark .panel-tab-group-label {
  color: #6b7280;
}

/* ============================================================================
   HISTORY RANGE REDESIGN — Kompakte Metriken, flach, kein Gradient-Overload
   ============================================================================ */

.history-metric-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px 8px;
  min-width: 0;
}

.dark .history-metric-card {
  background: #1f2937;
  border-color: #374151;
}

.history-metric-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.history-metric-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9ca3af;
}

.dark .history-metric-label {
  color: #6b7280;
}

.history-metric-value {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.dark .history-metric-value {
  color: #f3f4f6;
}

.history-metric-sub {
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.2;
}

.dark .history-metric-sub {
  color: #6b7280;
}

.history-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-action-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.dark .history-action-btn {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.2);
}

.dark .history-action-btn:hover {
  background: rgba(96, 165, 250, 0.2);
}

/* ============================================================================
   SETTINGS REDESIGN — Kompakte Gruppen-Tabelle statt gestapelte Boxen
   ============================================================================ */

.settings-device-block {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
}

.dark .settings-device-block {
  border-color: #374151;
  background: #1f2937;
}

.settings-device-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #f9fafb;
  border-bottom: 1px solid #f3f4f6;
}

.dark .settings-device-header {
  background: #111827;
  border-bottom-color: #1f2937;
}

.settings-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 300px));
  gap: 0;
}

.settings-group {
  padding: 6px 8px;
  border-right: 1px solid #f3f4f6;
  border-bottom: 1px solid #f3f4f6;
}

.dark .settings-group {
  border-right-color: #1f2937;
  border-bottom-color: #1f2937;
}

.settings-group:last-child {
  border-right: none;
}

.settings-group-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9ca3af;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid #f3f4f6;
}

.dark .settings-group-title {
  color: #6b7280;
  border-bottom-color: #1f2937;
}

.settings-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-item-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 2px 0;
  gap: 10px;
}

.settings-item-label {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
  flex-shrink: 0;
}

.dark .settings-item-label {
  color: #9ca3af;
}

.settings-item-value {
  font-size: 13px;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: auto;
}

.settings-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

/* ============================================================================
   CONSUMPTION REDESIGN — Flache Balken, Prozentwerte, Tabellen-Kategorien
   ============================================================================ */

/* ================================
   CONSUMPTION — Ultra-Compact
   ================================ */
.cons-panel {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 480px;
}

.cons-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 4px 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
  font-size: 13px;
  line-height: 1.3;
}

.dark .cons-header {
  background: #111827;
  border-color: #374151;
}

.cons-header-range {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #6b7280;
}

.dark .cons-header-range { color: #9ca3af; }

.cons-header-range i {
  font-size: 13px;
  color: #60a5fa;
}

.cons-header-dim { color: #9ca3af; font-size: 12px; }
.dark .cons-header-dim { color: #6b7280; }

.cons-header-total {
  font-weight: 700;
  color: #374151;
  font-size: 14px;
  margin-left: auto;
}

.dark .cons-header-total { color: #e5e7eb; }

/* Total-Zeilen */
.cons-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.cons-total {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid transparent;
  font-size: 13px;
}

.cons-total i { font-size: 13px; flex-shrink: 0; }

.cons-total-elec {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.cons-total-elec i { color: #3b82f6; }

.dark .cons-total-elec {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
}

.cons-total-gas {
  background: #fff7ed;
  border-color: #fed7aa;
}

.cons-total-gas i { color: #f97316; }

.dark .cons-total-gas {
  background: rgba(251, 146, 60, 0.08);
  border-color: rgba(251, 146, 60, 0.2);
}

.cons-total-val {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.cons-total-elec .cons-total-val { color: #1d4ed8; }
.dark .cons-total-elec .cons-total-val { color: #93c5fd; }
.cons-total-gas .cons-total-val { color: #c2410c; }
.dark .cons-total-gas .cons-total-val { color: #fdba74; }

.cons-total-unit {
  font-size: 12px;
  font-weight: 500;
  color: #9ca3af;
}

.cons-total-pct {
  font-size: 12px;
  font-weight: 700;
  color: #9ca3af;
  flex-shrink: 0;
}

.cons-total-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  min-width: 3px;
  border-radius: 1px;
}

.cons-total-elec .cons-total-bar { background: #3b82f6; }
.cons-total-gas .cons-total-bar { background: #f97316; }

/* Kategorien-Tabelle */
.cons-cat-table {
  display: grid;
  grid-template-columns: minmax(80px, 150px) 65px 65px;
  gap: 0;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  font-size: 13px;
}

.dark .cons-cat-table { border-color: #374151; }

.cons-cat-hdr {
  display: contents;
}

.cons-cat-hdr > span {
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.cons-cat-hdr > span i { font-size: 12px; }

.dark .cons-cat-hdr > span {
  background: #111827;
  border-bottom-color: #374151;
}

.cons-cat-row {
  display: contents;
}

.cons-cat-row > span {
  padding: 1px 4px;
  border-bottom: 1px solid #f3f4f6;
}

.dark .cons-cat-row > span {
  border-bottom-color: #1f2937;
}

.cons-cat-row:last-child > span { border-bottom: none; }

.cons-cat-label {
  font-weight: 500;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cons-cat-label i { font-size: 12px; }

.dark .cons-cat-label { color: #d1d5db; }

.cons-cat-val {
  font-weight: 600;
  font-family: 'Monaco', 'Menlo', monospace;
  text-align: right;
  font-size: 13px;
}

.cons-inactive {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  padding: 1px 0;
}

.dark .cons-inactive { color: #6b7280; }

/* ================================
   SCHEDULES — Compact Side-by-Side
   ================================ */
.sched-panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sched-device-hdr {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  padding: 0;
}

.dark .sched-device-hdr { color: #e5e7eb; }

.sched-device-hdr i {
  font-size: 13px;
  color: #3b82f6;
}

.sched-device-hdr code {
  font-size: 12px;
  background: #f3f4f6;
  color: #9ca3af;
  padding: 0 4px;
  border-radius: 3px;
  margin-left: auto;
  font-family: 'Monaco', 'Menlo', monospace;
}

.dark .sched-device-hdr code {
  background: #1f2937;
  color: #6b7280;
}

/* Grid: Bl\u00f6cke nebeneinander */
.sched-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 2px;
}

.sched-block {
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.dark .sched-block { border-color: #374151; }

.sched-block-orange { border-left: 2px solid #f97316; }
.sched-block-blue   { border-left: 2px solid #3b82f6; }

.sched-block-hdr {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.dark .sched-block-hdr {
  background: #111827;
  border-bottom-color: #374151;
  color: #e5e7eb;
}

.sched-block-hdr i { font-size: 13px; }
.sched-block-orange .sched-block-hdr i { color: #f97316; }
.sched-block-blue .sched-block-hdr i   { color: #3b82f6; }

/* Tages-Zeile */
.sched-day {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-bottom: 1px solid #f3f4f6;
  min-height: 26px;
}

.dark .sched-day { border-bottom-color: #1f293780; }

.sched-day:last-child { border-bottom: none; }

.sched-day-label {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  width: 22px;
  flex-shrink: 0;
}

.dark .sched-day-label { color: #9ca3af; }

.sched-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.sched-slot {
  font-size: 13px;
  font-family: 'Monaco', 'Menlo', monospace;
  padding: 1px 5px;
  border-radius: 2px;
  line-height: 1.4;
  white-space: nowrap;
}

.sched-slot-heat {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.dark .sched-slot-heat {
  background: rgba(251, 146, 60, 0.1);
  color: #fdba74;
  border-color: rgba(251, 146, 60, 0.2);
}

.sched-slot-water {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.dark .sched-slot-water {
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.2);
}

.sched-ts {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  color: #9ca3af;
  padding: 1px 0 0;
  border-top: 1px solid #e5e7eb;
}

.dark .sched-ts { color: #6b7280; border-top-color: #374151; }

.sched-ts i { font-size: 11px; }

.sched-ts-rel {
  color: #3b82f6;
}

.dark .sched-ts-rel { color: #60a5fa; }

@media (max-width: 400px) {
  .sched-grid {
    grid-template-columns: 1fr;
  }
}
.cons-cat-row:last-child > span {
  border-bottom: none;
}