:root {
    --bg: #f2f4f8;
    --panel: #ffffff;
    --border: #e3e7ee;
    --text: #1f2937;
    --text-muted: #6b7280;
    --accent: #e8833a;
    --accent-dark: #d5701f;
    --blue: #2f6fed;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 10px rgba(16, 24, 40, 0.05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.app-header {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 32px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.app-header .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.app-header .brand-logo {
    height: 28px;
    width: auto;
    display: block;
}

.app-header .brand-name {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.2px;
    color: var(--text);
}

.logout-form { display: flex; align-items: center; gap: 12px; }
.logout-form span { font-size: 14px; color: var(--text-muted); }
.logout-form button {
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 8px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
}
.logout-form button:hover { background: var(--bg); }

.nav-link {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
}
.nav-link:hover { background: var(--bg); color: var(--text); }

/* --- Benutzerverwaltung --- */
.benutzer-layout { display: flex; flex-direction: column; gap: 20px; padding: 28px 32px; max-width: 640px; }
.benutzer-form { display: flex; flex-direction: column; gap: 14px; }
.benutzer-form input {
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}
.benutzer-form .hint { font-weight: normal; text-transform: none; letter-spacing: normal; color: var(--text-muted); font-size: 11px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.erfolg { color: #1a7f4b; font-size: 13px; margin: 0 0 8px 0; }
.benutzer-tabelle { width: 100%; border-collapse: collapse; }
.benutzer-tabelle th, .benutzer-tabelle td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); font-size: 14px; }
.benutzer-tabelle th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

/* <main> füllt die restliche Bildschirmhöhe unterhalb des Headers */
main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* --- Dashboard-Layout: robustes Flexbox statt Grid, damit die zwei Spalten
   auch bei ungewöhnlichen Fenstergrößen/Zoomstufen zuverlässig nebeneinander bleiben.
   align-items: stretch + min-height: 0 sorgt dafür, dass die Diagramm-Karten die komplett
   verfügbare Bildschirmhöhe exakt aufteilen, statt über eine geschätzte vh-Höhe überzulaufen. --- */
.dashboard-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: stretch;
    gap: 24px;
    padding: 28px 32px;
}

.filter-panel {
    flex: 0 0 280px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.filter-panel-title {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.filter-group { display: flex; flex-direction: column; gap: 6px; }

.filter-group label,
.filter-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.filter-group select {
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    font-size: 14px;
    color: var(--text);
    width: 100%;
}

.filter-group select:disabled { background: #f7f8fa; color: #b0b6c0; border-style: dashed; }

.feld-hinweis { font-size: 12px; color: var(--accent-dark); }

.radio-list { display: flex; flex-direction: column; gap: 7px; }
.radio-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text);
    cursor: pointer;
}
.radio-list input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; }

.btn-primary {
    margin-top: 4px;
    padding: 11px;
    border: none;
    border-radius: 9px;
    background: var(--accent);
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-primary:disabled { background: #d8dce3; color: #9aa1ac; cursor: not-allowed; }

/* --- Content / Charts --- */
.content-panel { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 20px; }

.dashboard-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    position: relative;
}

/* Nur innerhalb des Analyse-Dashboards sollen sich die Karten die verfügbare Bildschirmhöhe
   teilen (siehe .content-panel oben) - andere Seiten wie die Benutzerverwaltung nutzen dieselbe
   .dashboard-card-Optik, aber mit normaler, am Inhalt orientierter Höhe. */
.content-panel .dashboard-card {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.card-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.content-panel .card-header { flex: 0 0 auto; }
.card-header h2 { margin: 0; font-size: 16px; font-weight: 700; }
.card-subtitle { font-size: 13px; color: var(--text-muted); }

.chart-wrap { position: relative; flex: 1 1 auto; min-height: 160px; }

.hinweis { color: var(--text-muted); font-size: 13px; margin-top: 10px; }
.leer-zustand {
    position: absolute;
    inset: 60px 24px 24px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #9aa1ac;
    font-size: 14px;
}
.fehler { color: #b3261e; font-size: 13px; margin: 0; }

.login-panel {
    max-width: 340px;
    margin: 80px auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}
.login-panel label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.login-panel input {
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}
.login-panel button {
    margin-top: 6px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-weight: 600;
    cursor: pointer;
}
.login-panel button:hover { opacity: 0.92; }

@media (max-width: 900px) {
    main { display: block; }
    .dashboard-layout { flex: none; flex-direction: column; min-height: 0; align-items: stretch; }
    .filter-panel { width: 100%; overflow-y: visible; }
    .content-panel { min-height: 0; }
    .dashboard-card { flex: none; }
    .chart-wrap { flex: none; height: 320px; min-height: 320px; }
}
