:root {
    --sidebar-width: 280px; /* Etwas breiter für mehr Ruhe */
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --success-color: #2ecc71;
    --success-hover: #27ae60;
    --bg-color: #f0f2f5; /* Weicheres Grau für den Hintergrund */
    --sidebar-bg: #2c3e50;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    
    /* ABSTÄNDE (Für mehr Luft) */
    --spacing-main: 40px;
    --card-padding: 30px;
}

* { box-sizing: border-box; }

body, html { 
    margin: 0; padding: 0; height: 100%; 
    font-family: 'Inter', 'Segoe UI', sans-serif; 
    background-color: var(--bg-color); 
    color: var(--text-dark); 
    line-height: 1.6; /* Mehr Zeilenabstand für bessere Lesbarkeit */
}

.app-container { display: flex; min-height: 100vh; }

/* --- SIDEBAR --- */
.sidebar { 
    width: var(--sidebar-width); 
    background-color: var(--sidebar-bg); 
    color: white; 
    position: sticky; top: 0; height: 100vh; 
    box-shadow: 4px 0 15px rgba(0,0,0,0.05);
}

.sidebar-header { padding: 40px 20px; text-align: center; }
.sidebar-header h2 { font-size: 1.6rem; color: var(--primary-color); margin: 0; font-weight: 800; }

.nav-label { 
    padding: 20px 30px 10px; 
    font-size: 0.75rem; 
    color: #94a3b8; 
    text-transform: uppercase; 
    letter-spacing: 1.5px; 
}

.nav-item { 
    padding: 15px 30px; 
    display: flex; align-items: center; gap: 12px;
    color: #cbd5e1; text-decoration: none; 
    transition: 0.3s; font-size: 1.05rem; 
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-item.active { background: rgba(52, 152, 219, 0.1); border-left: 5px solid var(--primary-color); color: var(--primary-color); font-weight: 600; }

/* --- MAIN CONTENT --- */
.main-content { flex-grow: 1; min-width: 0; }
.top-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 40px; 
    height: 70px;
    background: white; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); 
}

/* WICHTIG: Das Eltern-Element muss 'relative' sein */
.user-menu { 
    position: relative; 
    display: inline-block;
}

.user-badge { 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 10px 18px; 
    border-radius: 50px; 
    background: #f1f5f9; 
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.user-badge:hover { 
    background: #e2e8f0; 
    border-color: var(--primary-color);
}

/* Das Menü-Fenster */
.dropdown-content { 
    display: none; 
    position: absolute; 
    right: 0; 
    top: 100%; /* Direkt unter dem Badge */
    background: white; 
    min-width: 220px; 
    box-shadow: 0 15px 30px rgba(0,0,0,0.15); 
    border-radius: 12px; 
    z-index: 2000; 
    border: 1px solid #e2e8f0; 
    overflow: hidden;
    margin-top: 8px; /* Kleiner Abstand fürs Auge */
}

/* DER TRICK: Eine unsichtbare Brücke, damit das Hover nicht abbricht */
.user-menu::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 15px; /* Diese Höhe überbrückt die Lücke */
    bottom: -15px;
    left: 0;
    display: none;
}

/* Wenn man über das Menü hovert, zeige das Fenster UND die Brücke */
.user-menu:hover .dropdown-content,
.user-menu:hover::after { 
    display: block !important; 
}

.dropdown-content a { 
    color: var(--text-dark); 
    padding: 14px 20px; 
    text-decoration: none; 
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem; 
    transition: background 0.2s;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-content a:last-child { border-bottom: none; }

.dropdown-content a:hover { 
    background-color: #f8fafc; 
    color: var(--primary-color); 
}

.breadcrumb { font-size: 1rem; color: var(--text-muted); }
.breadcrumb strong { color: var(--text-dark); font-weight: 700; }

.user-badge { 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 8px 16px; 
    border-radius: 50px; 
    background: #f1f5f9; 
    font-weight: 600;
}

.dropdown-content { 
    display: none; 
    position: absolute; 
    right: 0; 
    top: calc(100% + 5px); 
    background: white; 
    min-width: 200px; 
    box-shadow: 0 10px 15px rgba(0,0,0,0.1); 
    border-radius: 12px; 
    z-index: 1000; 
    border: 1px solid #eee; 
    overflow: hidden; 
}
.user-menu:hover .dropdown-content { display: block; }

.content-inner { 
    padding: var(--spacing-main); 
    max-width: 1500px; margin: 0 auto; 
}

h1 { margin-bottom: 35px; font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; }

/* --- CARDS (DEUTLICH MEHR PLATZ) --- */
.station-card { 
    background: var(--card-bg); 
    border-radius: 20px; 
    box-shadow: var(--shadow); 
    margin-bottom: 30px; 
    border: 1px solid var(--border-color);
    padding: 10px; /* Basis-Padding für den Inhalt */
}

/* --- TABELLEN STYLING (Hier war es gequetscht) --- */
table { width: 100%; border-collapse: collapse; margin: 10px 0; }

th { 
    text-align: left; 
    padding: 20px 25px; 
    background: #f8fafc; 
    color: var(--text-muted); 
    font-size: 0.8rem; 
    text-transform: uppercase; 
    letter-spacing: 1px;
    border-bottom: 2px solid var(--border-color);
}

td { 
    padding: 22px 25px; /* Dezent mehr Höhe pro Zeile */
    border-bottom: 1px solid #f1f5f9; 
    font-size: 1rem;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #fcfdfe; }

/* --- FILTER & CONTROLS --- */
.chart-controls { 
    display: flex; flex-wrap: wrap; gap: 30px; /* Größerer Gap */
    padding: 25px; 
    background: #f8fafc; border-radius: 15px;
    margin-bottom: 25px;
}

.control-group { display: flex; flex-direction: column; gap: 10px; }
.control-group label { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); }

select, input[type="date"] {
    padding: 12px 18px; 
    border-radius: 10px; border: 1px solid #d1d5db;
    background: white; font-size: 1rem; min-width: 200px;
}

/* --- SPEZIELLE WERTE --- */
.station-value { 
    font-family: 'JetBrains Mono', 'Consolas', monospace; 
    font-weight: 800; color: var(--primary-color); font-size: 1.2rem; 
}
.station-name { font-weight: 600; font-size: 1.1rem; color: #1e293b; }
.station-value { font-family: 'Consolas', 'Monaco', monospace; font-weight: 700; color: var(--primary-color); font-size: var(--font-size-values); }

.station-details { display: none; padding: 30px; border-top: 1px solid var(--border-color); background: #ffffff; }
.open .station-details { display: block; }

/* --- MODERNE FORMULARELEMENTE --- */
.chart-controls { 
    display: flex; 
    flex-wrap: wrap;
    gap: 15px; 
    margin-bottom: 25px; 
    padding: 20px; 
    background: #f8fafc; 
    border-radius: 12px; 
    border: 1px solid var(--border-color);
    align-items: flex-end;
}

.control-group { display: flex; flex-direction: column; gap: 6px; }
.control-group label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }

select, input[type="date"] {
    appearance: none;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 160px;
    cursor: pointer;
}

select:focus, input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Buttons */
.btn-load, .btn-export, .btn-add {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-load { background: var(--primary-color); color: white; }
.btn-load:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-export { background: var(--success-color); color: white; }
.btn-export:hover { background: var(--success-hover); transform: translateY(-1px); }

.btn-del {
    background: #fee2e2;
    color: #ef4444;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.btn-del:hover { background: #fecaca; color: #dc2626; }

.chart-container { position: relative; height: 350px; width: 100%; }

/* Der Header über den Stationen */
.station-header-grid {
    display: grid !important;
    /* 2.5 Anteile für den Namen, jeweils 1 Anteil für die Werte */
    grid-template-columns: 2.5fr 1fr 1fr 1fr; 
    gap: 20px;
    padding: 15px 30px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Die Zeile einer Station */
.station-row {
    display: grid !important;
    grid-template-columns: 2.5fr 1fr 1fr 1fr; /* MUSS identisch zum Header sein */
    gap: 20px;
    padding: 22px 30px;
    cursor: pointer;
    align-items: center;
    transition: background 0.2s;
}

/* Verhindert, dass Werte ineinander laufen */
.station-value {
    white-space: nowrap;
    display: inline-block;
}