/* ============================================================
   DESIGN TOKENS — Bochum Design Language
   ============================================================ */
:root {
  --cyan: #0AB4FF;
  --blue: #0F2864;
  --orange: #F49100;
  --green: #76B729;
  --red: #E61937;
  --bg: #F6F6F6;
  --card-bg: #FFFFFF;
  --text: #1A1A1A;
  --text-secondary: #4A5568;
  --text-muted: #718096;
  --border-light: #E2E8F0;
  --radius: 12px;
  --shadow-card: 0 1px 4px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg: #12161C;
  --card-bg: #1A1F27;
  --text: #E6EDF5;
  --text-secondary: #A8B3C1;
  --text-muted: #7D8896;
  --border-light: #2A313B;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }

/* Globale Linkfarbe. ACHTUNG: sie ist der Grund, warum Header und Footer
   weiter unten eigene Regeln brauchen — Cyan auf cyanem Grund ist
   unlesbar, und genau daran sind schon zwei Footer zerbrochen. */
a { color: var(--cyan); text-decoration: none; }

#app { display: flex; flex-direction: column; min-height: 100vh;
       max-width: 1440px; margin: 0 auto; padding: 0 16px; }

/* Luft zwischen Inhalt und Footer. Der Abstand haengt am Inhalt, nicht am
   Footer: dessen margin-top: auto soll ihn bei kurzen Seiten nach unten
   druecken, und ein padding-top dort waere cyan eingefaerbt. */
.view { padding-bottom: 32px; }

/* ============================================================
   HEADER — cyan mit dunkler Schrift
   ============================================================ */
.app-header { background: var(--cyan); padding: 0; margin-bottom: 16px;
              width: 100vw; margin-left: calc(-50vw + 50%); }
.header-inner { max-width: 1440px; margin: 0 auto; padding: 0 16px; height: 70px;
                display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.header-left { display: flex; align-items: center; gap: 20px; }
.header-logo { height: 36px; width: auto; display: block; }
.header-title { font-size: 1.3rem; font-weight: 700; color: #1A1A1A; }
/* Dunkel, nicht weiss: der Grund ist cyan. */
.header-meta { font-size: 0.8rem; color: #1A1A1A; display: flex; align-items: center;
               gap: 10px; white-space: nowrap; }

/* ============================================================
   KARTE + SEITENLEISTE — gleiche Hoehe, damit beide buendig enden
   ============================================================ */
.main-content { display: grid; grid-template-columns: 1fr 380px; gap: 16px; }
#map, #sidebar { height: min(64vh, 680px); min-height: 420px;
                 border-radius: var(--radius); overflow: hidden; }
#sidebar { display: flex; flex-direction: column; background: var(--card-bg);
           box-shadow: var(--shadow-card); }
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.sidebar-header h2 { margin: 0; font-size: 1rem; }
.sidebar-body { flex: 1; overflow-y: auto; padding: 12px; }

.placeholder-card { background: var(--card-bg); border-radius: var(--radius);
                    box-shadow: var(--shadow-card); border: 1px solid var(--border-light);
                    padding: 60px 40px; text-align: center; margin-top: 16px; }
.placeholder-icon { font-size: 3rem; margin-bottom: 12px; }
.placeholder-card p { color: var(--text-secondary); font-size: 0.9rem; margin: 0; }

/* ============================================================
   FOOTER — cyan mit dunkler Schrift, wie der Header
   ============================================================ */
.app-footer { margin-top: auto; padding: 24px 0; background: var(--cyan);
              width: 100vw; margin-left: calc(-50vw + 50%); }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 0 16px; display: flex;
                flex-direction: column; align-items: center; gap: 10px; }
.footer-main { font-size: 0.85rem; color: #1A1A1A; text-align: center; }
.footer-brand { font-weight: 700; }
.footer-data { display: block; font-size: 0.78rem; margin-top: 2px; color: rgba(26,26,26,0.75); }
/* Ohne diese beiden Regeln erben die Links die globale Cyan-Farbe und
   verschwinden auf dem cyanen Grund. Gilt fuer JEDEN Link im Footer. */
.footer-main a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer-main a:hover { color: rgba(26,26,26,0.7); }
.footer-links { margin-top: 4px; font-size: 0.78rem; }
.footer-links a { color: #1A1A1A; text-decoration: underline; }
.footer-links a:hover { color: rgba(26,26,26,0.7); }

.hint-banner { display: flex; align-items: center; gap: 8px; font-size: 0.78rem;
               color: #8D6E00; background: #FFF8E1; border: 1px solid #FFE082;
               border-radius: 8px; padding: 8px 14px; max-width: 680px; }

/* Header und Footer bleiben im Dark Mode cyan mit dunklem Text. */
[data-theme="dark"] .app-header, [data-theme="dark"] .app-footer { color: #1A1A1A; }

@media (max-width: 900px) {
  .main-content { grid-template-columns: 1fr; }
  #map, #sidebar { height: 380px; min-height: 320px; }
}

/* ============================================================
   HAUSHALTSKOMPASS — Module (Kacheln, Diagrammkarten, Tabellen)
   ============================================================ */
.app-nav { max-width: 1440px; margin: 0 auto; padding: 0 16px 10px; display: flex;
           flex-wrap: wrap; gap: 14px; font-size: 0.82rem; }
.app-nav a { color: #1A1A1A; text-decoration: none; opacity: 0.85; }
.app-nav a:hover { opacity: 1; text-decoration: underline; }
.theme-toggle { border: 1px solid rgba(26,26,26,0.35); background: rgba(255,255,255,0.25);
                color: #1A1A1A; border-radius: 999px; width: 32px; height: 32px;
                cursor: pointer; font-size: 1rem; line-height: 1; }

.section { margin: 0 0 28px; }
.section h2 { font-size: 1.15rem; margin: 0 0 12px; }
.card { background: var(--card-bg); border: 1px solid var(--border-light);
        border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 16px;
        margin-bottom: 14px; }
.card h3 { margin: 0 0 6px; font-size: 0.98rem; }
.card-hint { margin: 0 0 10px; font-size: 0.8rem; color: var(--text-secondary); }
.card--detail { border-left: 4px solid var(--cyan); }
.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1000px) { .grid--2 { grid-template-columns: 1fr; } }

.chart-wrap { position: relative; height: 320px; }
.chart-wrap--hoch { height: 460px; }

.kpi-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--card-bg); border: 1px solid var(--border-light);
       border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 12px 14px;
       display: flex; flex-direction: column; gap: 2px; }
.kpi-wert { font-size: 1.15rem; font-weight: 700; color: var(--blue); }
[data-theme="dark"] .kpi-wert { color: #4FC3F7; }
.kpi-label { font-size: 0.8rem; color: var(--text-secondary); }
.kpi-quelle { font-size: 0.7rem; color: var(--text-muted); }

.kpi-gruppe { margin-bottom: 14px; }
.kpi-liste { display: flex; flex-direction: column; }
.kpi-zeile { display: grid; grid-template-columns: 1fr auto 46px; gap: 10px;
             padding: 5px 0; border-bottom: 1px solid var(--border-light); font-size: 0.84rem; }
.kpi-zeile:last-child { border-bottom: 0; }
.kpi-zeile i { color: var(--text-muted); font-style: normal; text-align: right; font-size: 0.72rem; }

table.daten { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
table.daten th, table.daten td { text-align: left; padding: 5px 8px;
                                 border-bottom: 1px solid var(--border-light); }
table.daten th { color: var(--text-secondary); font-weight: 600; }
table.daten td.num, table.daten th.num { text-align: right; font-variant-numeric: tabular-nums; }
details { margin-top: 10px; }
summary { cursor: pointer; font-size: 0.8rem; color: var(--text-secondary); }
details > div { max-height: 320px; overflow: auto; margin-top: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--card-bg); border: 1px solid var(--border-light);
        border-radius: 999px; padding: 4px 10px; font-size: 0.78rem; }

.hinweis { background: #FFF8E1; border: 1px solid #FFE082; color: #8D6E00;
           border-radius: 8px; padding: 10px 14px; font-size: 0.85rem; margin-bottom: 14px; }
.hinweis--fehler { background: #FDECEA; border-color: #F5C2BB; color: #8A1F14; }
[data-theme="dark"] .hinweis { background: #2A2413; border-color: #4A3F1C; color: #E8D48B; }
[data-theme="dark"] .hinweis--fehler { background: #2C1A18; border-color: #4A2724; color: #F0A79C; }

/* ============================================================
   TABS — ein Abschnitt auf einmal
   ============================================================ */
.app-tabs { max-width: 1440px; margin: 0 auto; padding: 0 16px 12px; display: flex;
            flex-wrap: wrap; gap: 6px; }
.tab { border: 1px solid rgba(26,26,26,0.25); background: rgba(255,255,255,0.35);
       color: #1A1A1A; border-radius: 999px; padding: 6px 14px; font-size: 0.83rem;
       font-family: inherit; cursor: pointer; }
.tab:hover { background: rgba(255,255,255,0.6); }
.tab.aktiv { background: var(--blue); border-color: var(--blue); color: #FFFFFF; font-weight: 600; }
.tab:focus-visible { outline: 2px solid #1A1A1A; outline-offset: 2px; }

/* ============================================================
   FLIESSTEXT — Vorwort und Einordnung
   ============================================================ */
.card--einleitung { border-top: 3px solid var(--cyan); }
.card--einleitung h2, .card--einleitung h3 { margin-bottom: 10px; }
.fliesstext { max-width: 72ch; }
.fliesstext p { margin: 0 0 12px; line-height: 1.62; font-size: 0.92rem;
                color: var(--text-secondary); }
.fliesstext p.lead { font-size: 1.02rem; color: var(--text); }
.fliesstext p:last-child { margin-bottom: 0; }

/* Staffeltarife in einer Zeile statt drei Zeilen untereinander. */
.kpi-zeile--staffel { grid-template-columns: 1fr auto; }
.kpi-zeile--staffel b { color: var(--text); }
.kpi-zeile i.trenner { margin: 0 6px; color: var(--text-muted); }
.kpi-zeile i.quelle { text-align: right; }

/* ============================================================
   DIAGRAMM-UMSCHALTER — Kuchen / Ring / Balken
   ============================================================ */
.typ-leiste { display: flex; gap: 6px; margin: 0 0 8px; }
.typ { border: 1px solid var(--border, rgba(26,26,26,0.2)); background: transparent;
       color: var(--text-secondary); border-radius: 8px; padding: 4px 12px;
       font-family: inherit; font-size: 0.78rem; cursor: pointer; }
.typ:hover { border-color: var(--cyan); color: var(--text); }
.typ.aktiv { background: var(--cyan); border-color: var(--cyan); color: #06263A; font-weight: 600; }
.typ:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[data-theme="dark"] .typ { border-color: rgba(255,255,255,0.25); }
[data-theme="dark"] .typ.aktiv { color: #06263A; }



