/* style.css — design tokens, layout, components */

/* ═══════════════════════════════════════════════
   DESIGN TOKENS — Legal/Justice Domain Palette
   Sober, authoritative: deep navy + muted gold accent
   ═══════════════════════════════════════════════ */

:root,
[data-theme='light'] {
  /* Surfaces — warm-neutral, slightly cool */
  --color-bg: #f4f5f7;
  --color-surface: #ffffff;
  --color-surface-2: #f8f9fb;
  --color-surface-offset: #eef0f3;
  --color-surface-offset-2: #e6e9ed;
  --color-divider: #dde1e6;
  --color-border: #d1d6dc;

  /* Text */
  --color-text: #1a2332;
  --color-text-muted: #5a6678;
  --color-text-faint: #9aa5b1;
  --color-text-inverse: #f8f9fb;

  /* Primary Accent — Deep Navy (Justiz) */
  --color-accent: #1b2a4a;
  --color-accent-hover: #0f1d38;
  --color-accent-active: #0a1528;
  --color-accent-highlight: #d6dae4;
  --color-accent-soft: #e8ecf2;

  /* Secondary Accent — Muted Gold (Würde/Autorität) */
  --color-gold: #c5a572;
  --color-gold-hover: #b08e57;
  --color-gold-highlight: #f0e8d6;

  /* Semantic — Haft (stationary) */
  --color-haft: #8b3a3a;
  --color-haft-soft: #f0d8d8;
  --color-haft-border: #c4a0a0;

  /* Semantic — Ambulant */
  --color-ambulant: #2d6a4f;
  --color-ambulant-soft: #d0e4d8;
  --color-ambulant-border: #a0c4af;

  /* Chart colors */
  --color-chart-1: #1b2a4a;
  --color-chart-2: #c5a572;
  --color-chart-3: #2d6a4f;
  --color-chart-4: #8b3a3a;
  --color-chart-5: #4a6fa5;
  --color-chart-6: #d4a574;
  --color-chart-positive: #2d6a4f;
  --color-chart-negative: #8b3a3a;
  --color-chart-neutral: #5a6678;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(27, 42, 74, 0.06);
  --shadow-md: 0 4px 12px rgba(27, 42, 74, 0.08);
  --shadow-lg: 0 12px 32px rgba(27, 42, 74, 0.12);

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Typography */
  --font-display: 'Zapf Humanist', 'Optima', 'URW Gothic', 'Candara', 'Cabin', 'Source Sans 3', sans-serif;
  --font-body: 'Source Sans 3', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
}

[data-theme='dark'] {
  --color-bg: #0f1419;
  --color-surface: #161c25;
  --color-surface-2: #1a212c;
  --color-surface-offset: #1e2530;
  --color-surface-offset-2: #232b37;
  --color-divider: #2a3340;
  --color-border: #334055;

  --color-text: #d4dae3;
  --color-text-muted: #8a96a8;
  --color-text-faint: #5c6878;
  --color-text-inverse: #0f1419;

  --color-accent: #6b8cc4;
  --color-accent-hover: #5a7ab0;
  --color-accent-active: #4a699c;
  --color-accent-highlight: #2a3a5a;
  --color-accent-soft: #1e2838;

  --color-gold: #d4b888;
  --color-gold-hover: #c5a572;
  --color-gold-highlight: #3a3328;

  --color-haft: #c47070;
  --color-haft-soft: #3a2424;
  --color-haft-border: #5a3a3a;

  --color-ambulant: #6dba8f;
  --color-ambulant-soft: #1e3a2a;
  --color-ambulant-border: #2a5a3a;

  --color-chart-1: #6b8cc4;
  --color-chart-2: #d4b888;
  --color-chart-3: #6dba8f;
  --color-chart-4: #c47070;
  --color-chart-5: #7a9ad4;
  --color-chart-6: #d4a574;
  --color-chart-positive: #6dba8f;
  --color-chart-negative: #c47070;
  --color-chart-neutral: #8a96a8;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* ═══════════════════════════════════════════════
   DASHBOARD LAYOUT
   ═══════════════════════════════════════════════ */

html,
body {
  height: 100%;
  overflow: hidden;
  margin: 0;
}

.dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto 1fr;
  height: 100dvh;
}

/* ═══════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════ */

.sidebar {
  grid-row: 1 / -1;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-6) var(--space-4);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  color: var(--color-gold);
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.2;
  color: #fff;
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: var(--space-1);
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.filter-btn {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all var(--transition-interactive);
  white-space: nowrap;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.filter-btn.active {
  background: var(--color-gold);
  color: var(--color-accent);
  border-color: var(--color-gold);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.methodology-note h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-gold);
  margin-bottom: var(--space-2);
}

.methodology-note h4 a {
  color: var(--color-gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.methodology-note h4 a:hover {
  color: var(--color-gold);
}

.methodology-note p {
  font-size: 0.75rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.5);
}

/* ═══════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════ */

.header {
  grid-column: 2;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-8);
}

.header-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.header-sub-brand {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-gold);
}

.header-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.theme-toggle:hover {
  color: var(--color-text);
  background: var(--color-surface-offset-2);
}

/* ═══════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════ */

.main {
  grid-column: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-6) var(--space-8) var(--space-12);
}

/* ═══════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.kpi-card-highlight {
  border-color: var(--color-accent);
  border-width: 2px;
  background: var(--color-surface-alt);
}

/* Bundesland Filter */
.bundesland-select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
}

.bundesland-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-faint);
}

.bundesland-info {
  margin-top: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.bl-stat {
  flex: 1 1 45%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bl-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
}

.bl-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.bl-source {
  flex: 1 1 100%;
  font-size: 0.65rem;
  color: var(--color-text-faint);
  margin-top: 2px;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--color-text);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.2;
}

.kpi-delta {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums lining-nums;
}

.kpi-delta-positive {
  color: var(--color-ambulant);
}

.kpi-delta-info {
  color: var(--color-accent);
}

.delta-arrow {
  font-weight: 700;
}

.delta-label {
  color: var(--color-text-faint);
}

/* ═══════════════════════════════════════════════
   CHART CARDS
   ═══════════════════════════════════════════════ */

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.chart-card-wide {
  grid-column: 1 / -1;
}

.chart-header {
  margin-bottom: var(--space-4);
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.chart-desc {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

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

/* ═══════════════════════════════════════════════
   DATA TABLE
   ═══════════════════════════════════════════════ */

.detail-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-4);
}

.table-wrapper {
  overflow-x: auto;
  overscroll-behavior: contain;
  margin-top: var(--space-4);
}

.data-table {
  font-size: 0.875rem;
  min-width: 700px;
}

.data-table thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  background: var(--color-surface-offset);
  border-bottom: 2px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table thead th.num {
  text-align: right;
}

.data-table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
}

.data-table tbody td.num {
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.data-table tbody tr:hover {
  background: var(--color-surface-offset);
}

.data-table tbody tr.row-haft td:first-child {
  border-left: 3px solid var(--color-haft);
}

.data-table tbody tr.row-ambulant td:first-child {
  border-left: 3px solid var(--color-ambulant);
}

.measure-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.measure-badge.haft {
  background: var(--color-haft-soft);
  color: var(--color-haft);
}

.measure-badge.ambulant {
  background: var(--color-ambulant-soft);
  color: var(--color-ambulant);
}

/* ═══════════════════════════════════════════════
   SOURCES SECTION
   ═══════════════════════════════════════════════ */

.sources-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-4);
}

.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.source-item {
  padding: var(--space-4);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.source-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.source-desc {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.source-link {
  font-size: 0.75rem;
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
  word-break: break-word;
  display: inline-block;
}

.source-link:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════ */

.dashboard-footer {
  padding: var(--space-5);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.footer-content {
  max-width: none;
}

.footer-content p {
  margin-bottom: var(--space-3);
}

.dashboard-footer strong {
  color: var(--color-text);
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .chart-row {
    grid-template-columns: 1fr;
  }

  .chart-card-wide {
    grid-column: auto;
  }
}

@media (max-width: 768px) {
  .dashboard {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    height: auto;
    min-height: 100dvh;
  }

  html,
  body {
    overflow: auto;
    height: auto;
  }

  .sidebar {
    grid-row: auto;
    grid-column: 1;
    flex-direction: column;
    padding: var(--space-4);
  }

  .sidebar-brand {
    margin-bottom: var(--space-4);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-4);
  }

  .filter-group {
    flex: 1;
    min-width: 200px;
  }

  .sidebar-footer {
    margin-top: var(--space-4);
  }

  .header {
    grid-column: 1;
    position: relative;
  }

  .main {
    grid-column: 1;
    overflow: visible;
    padding: var(--space-4);
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .chart-container {
    height: 260px;
  }

  .header-content {
    padding: var(--space-3) var(--space-4);
  }

  .header-title {
    font-size: 1.25rem;
  }
}

/* Criminal-policy background: intentionally wider and shifted right */
.criminal-background {
  width: calc(100% - 8%);
  margin-left: 8%;
  margin-bottom: var(--space-5);
  padding: var(--space-4) var(--space-5);
  font-size: 0.9rem;
  line-height: 1.7;
  text-align: left;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}
.criminal-background p {
  margin: 0;
}
.criminal-background strong {
  color: var(--color-text);
}

.impressum-link {
  margin-top: 0.45rem;
  font-size: 0.72rem;
}
.impressum-link a {
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.impressum-link a:hover {
  color: var(--color-text);
}

.dashboard-explainer {
  margin-top: var(--space-2);
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--color-text-muted);
  max-width: 1100px;
}

.scenario-grid {
  display: grid;
  grid-template-columns: 1fr 0.72fr 1fr;
  gap: 0.45rem;
  align-items: stretch;
}
.scenario-direction {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.scenario-direction-label {
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.68rem;
  line-height: 1.15;
  color: var(--color-text-muted);
  font-weight: 600;
}
.scenario-btn {
  width: 100%;
}
.scenario-btn-reverse {
  border-color: #a45d5d;
}
.scenario-btn-reverse:hover,
.scenario-btn-reverse.active {
  background: #8d4f4f;
  border-color: #8d4f4f;
  color: #fff;
}
.scenario-btn-none {
  align-self: stretch;
  min-height: 100%;
}
.risk-model-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.risk-model-options .filter-btn {
  white-space: normal;
  line-height: 1.2;
}

.risk-model-hint {
  margin-top: 0.4rem;
  font-size: 0.64rem;
  line-height: 1.35;
  color: var(--color-text-muted);
}

/* Szenario-Hilfe */
.scenario-help-btn {
  width: 100%;
  margin-top: 0.7rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}
.scenario-help-btn:hover,
.scenario-help-btn:focus-visible {
  background: rgba(255,255,255,0.08);
  outline: none;
}
.scenario-help-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0,0,0,0.62);
}
.scenario-help-backdrop[hidden] {
  display: none;
}
.scenario-help-modal {
  position: relative;
  width: min(680px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.6rem 1.8rem;
  border-radius: 10px;
  background: var(--color-bg, #fff);
  color: var(--color-text, #222);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.scenario-help-modal h2 {
  margin: 0 2rem 1.1rem 0;
}
.scenario-help-modal h3 {
  margin: 1.1rem 0 0.35rem;
  font-size: 1rem;
}
.scenario-help-modal p {
  margin: 0.35rem 0 0.75rem;
  line-height: 1.5;
}
.scenario-help-close {
  position: absolute;
  top: 0.65rem;
  right: 0.8rem;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.reform-note {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--color-text-muted);
}
.structure-reform-options {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0.45rem;
  align-items: start;
}
.structure-reform-options > .filter-btn {
  align-self: center;
}
.structure-reform-column {
  min-width: 0;
}
.structure-reform-label {
  font-size: 0.72rem;
  line-height: 1.2;
  margin-bottom: 0.28rem;
  color: var(--color-text-muted);
}
.structure-reform-buttons {
  display: flex;
  gap: 0.3rem;
}
.structure-reform-buttons .filter-btn {
  flex: 1 1 0;
  min-width: 0;
}

/* Zusammengehörige Auswahl von Substitutionsszenarien und Risikomodell */
.scenario-selection-frame {
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 10px;
  padding: 0.65rem 0.7rem 0.55rem;
  margin-bottom: 0.8rem;
}
.scenario-selection-frame .filter-group {
  margin-bottom: 0.55rem;
}
.scenario-selection-frame .filter-group:last-child {
  margin-bottom: 0;
}


.kpi-note {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  line-height: 1.25;
  opacity: 0.85;
}


/* Strukturreformen: vertikale, kompakte Anordnung */
.structure-reform-options-vertical { display:flex; flex-direction:column; gap:.45rem; align-items:stretch; }
.structure-reform-options-vertical > .structure-reform-none { width:100%; }
.structure-reform-stack { display:flex; flex-direction:column; gap:.55rem; }
.structure-reform-label { font-size:.88rem; line-height:1.2; margin-bottom:.28rem; color:rgba(255,255,255,.82); font-weight:500; }
.structure-reform-title a { color: var(--color-gold); text-decoration: none; }
.structure-reform-title a:hover, .structure-reform-title a:focus-visible { color: var(--color-gold-highlight); text-decoration: underline; text-underline-offset: 2px; }
.scenario-direction-label { color: var(--color-gold-highlight); }
.structure-reform-buttons { display:flex; gap:.3rem; }
.structure-reform-buttons .filter-btn { flex:1 1 0; min-width:0; }

/* ═══════════════════════════════════════════════
   ISO-AUSLASTUNG — neue Dashboard-Komponenten
   ═══════════════════════════════════════════════ */
.kpi-grid-four { grid-template-columns: repeat(4, 1fr); }
.kpi-value {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 600;
  line-height: 1.05;
  color: var(--color-text);
  letter-spacing: -0.02em;
}
.kpi-subline {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  min-height: 1.2em;
}
.kpi-offers-card { min-height: 205px; }
.offer-list {
  margin: 0.2rem 0 0;
  padding-left: 1.15rem;
  color: var(--color-text);
  font-size: 0.94rem;
  line-height: 1.55;
}
.offer-list li { padding-left: 0.15rem; }
.offer-list li.optional { color: var(--color-text-muted); }
.offer-list li.empty { color: var(--color-text-faint); list-style: none; margin-left: -1.15rem; }
.data-loading-card,
.error-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  color: var(--color-text-muted);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.error-card { color: #9a3d3d; border-color: rgba(154,61,61,.25); }
.data-loading-card[hidden],
.error-card[hidden] { display: none !important; }
.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: iso-spin .8s linear infinite;
}
@keyframes iso-spin { to { transform: rotate(360deg); } }
#data-status { font-size: .7rem; color: rgba(255,255,255,.5); }

@media (max-width: 1100px) {
  .kpi-grid-four { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .kpi-grid-four { grid-template-columns: 1fr; }
  .kpi-offers-card { min-height: auto; }
}

/* Fallback zum lokalen Einlesen der Excel-Datenbasis */
.error-card-content { width: 100%; }
.local-file-fallback {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--color-border);
}
.local-file-fallback p { margin: 0 0 0.7rem; }
.file-select-btn {
  display: inline-block;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s ease, transform .15s ease;
}
.file-select-btn:hover { opacity: .9; }
.file-select-btn:active { transform: translateY(1px); }
.file-select-hint {
  margin-top: 0.55rem;
  font-size: .76rem;
  color: var(--color-text-faint);
}


/* Auslastungsstufen: dezente Einfärbung der beiden Auslastungskästen */
.utilization-card {
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.utilization-card.util-a {
  background: rgba(62, 142, 76, 0.10);
  border-color: rgba(62, 142, 76, 0.28);
}
.utilization-card.util-b {
  background: rgba(226, 145, 45, 0.11);
  border-color: rgba(226, 145, 45, 0.30);
}
.utilization-card.util-c {
  background: rgba(208, 46, 55, 0.10);
  border-color: rgba(208, 46, 55, 0.28);
}
.utilization-card.util-d {
  background: rgba(185, 35, 145, 0.11);
  border-color: rgba(185, 35, 145, 0.30);
}
.utilization-card.util-a .kpi-subline { color: #397d46; font-weight: 600; }
.utilization-card.util-b .kpi-subline { color: #a4661d; font-weight: 600; }
.utilization-card.util-c .kpi-subline { color: #a52f36; font-weight: 600; }
.utilization-card.util-d .kpi-subline { color: #92206f; font-weight: 600; }


/* ═══════════════════════════════════════════════
   SACHSEN-KARTE — interaktive Regionsdarstellung
   ═══════════════════════════════════════════════ */
.saxony-map-card {
  margin-top: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.map-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}
.map-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--color-text);
}
.map-header p {
  margin: .25rem 0 0;
  color: var(--color-text-muted);
  font-size: .8rem;
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .7rem 1rem;
  color: var(--color-text-muted);
  font-size: .72rem;
  white-space: nowrap;
}
.legend-swatch { display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:5px; vertical-align:-1px; }
.legend-client { background:#6fa94a; }
.legend-appointment { background:#e49a32; }
.map-status {
  min-height: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: .8rem;
  padding: 1rem;
}
.map-status.map-error { color:#9a3d3d; }
.saxony-map-wrap { width:100%; }
.saxony-map { display:block; width:100%; height:auto; min-height:520px; overflow:visible; }
.district-base-map { pointer-events:none; }
.region-label { font-family:var(--font-display); font-size:15px; font-weight:600; fill:var(--color-text); pointer-events:none; }
.region-label.inactive { opacity:.62; }
.city-point circle { fill:var(--color-text); stroke:var(--color-surface); stroke-width:1.5; }
.city-point text { font-family:var(--font-body); font-size:11px; fill:var(--color-text); }
.city-point.major text { font-weight:700; font-size:13px; }
.city-point.major circle { r:4.2; }
.regional-bars line { stroke:var(--color-text-faint); stroke-width:1; }
.bar-value { font-family:var(--font-body); font-size:11px; font-weight:600; fill:var(--color-text); }
.bar-label { font-family:var(--font-body); font-size:9px; fill:var(--color-text-muted); }
.regional-bars.inactive { opacity:.68; }
.map-source { margin-top:.45rem; color:var(--color-text-faint); font-size:.65rem; }
@media (max-width: 900px) {
  .map-header { flex-direction:column; }
  .map-legend { justify-content:flex-start; white-space:normal; }
  .saxony-map { min-height:420px; }
}
@media (max-width: 768px) {
  .saxony-map { min-height:320px; }
}

.region-shape {
  stroke: var(--color-surface);
  stroke-width: 3;
  stroke-linejoin: round;
  transition: fill .18s ease, opacity .18s ease;
}
.region-shape.active { opacity: .82; }
.region-shape.inactive { opacity: .55; }
.region-shape:hover { opacity: .95; }

/* v22: statische Kartenlinien, Orte und Beschriftungen; JavaScript ändert nur Farbe/Opacity und Säulen. */
.region-shape {
  stroke: var(--color-surface);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  transition: fill .18s ease, opacity .18s ease;
}
.city-point { pointer-events: none; }
.city-point circle { fill: var(--color-text); stroke: var(--color-surface); stroke-width: 1.5; }
.city-point text { font-family: var(--font-body); font-size: 11px; fill: var(--color-text); paint-order: stroke; stroke: var(--color-surface); stroke-width: 3px; stroke-linejoin: round; }
.city-point.major text { font-weight: 700; font-size: 13px; }
.region-label { paint-order: stroke; stroke: var(--color-surface); stroke-width: 4px; stroke-linejoin: round; }

/* v24: feinere Kartenfarben und größere Säulendiagramme */
.bar-value {
  font-size: 13px;
  font-weight: 700;
}
.bar-label {
  font-size: 11px;
  font-weight: 600;
  fill: #ffffff !important;
}

/* v25: Ortsbeschriftungen schlicht schwarz, ohne weißen Hintergrund/Umriss */
.city-point text {
  fill: #000000 !important;
  stroke: none !important;
  paint-order: normal;
}

/* v28: hervorgehobene Städte – Leipzig, Dresden, Chemnitz ca. 150 %, Bautzen ca. 125 % */
.city-point .major-city-label {
  font-size: 19.5px !important;
  font-weight: 700 !important;
}
.city-point .bautzen-city-label {
  font-size: 13.75px !important;
  font-weight: 700 !important;
}

/* v29: Zeitverlauf der beiden Auslastungskennzahlen */
.trend-section {
  margin-top: 28px;
}
.section-heading {
  margin-bottom: 10px;
}
.section-heading h2 {
  margin: 0;
}
.section-heading p {
  margin: 3px 0 0;
  font-size: 0.86rem;
  color: var(--color-text-muted, #666);
}
.trend-chart-wrap {
  width: 100%;
}
.trend-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.trend-grid-line {
  stroke: var(--color-border, #d9d9d9);
  stroke-width: 1;
  opacity: .7;
}
.trend-axis-line, .trend-tick {
  stroke: var(--color-text-faint, #8a8a8a);
  stroke-width: 1;
}
.trend-y-label, .trend-x-label, .trend-y-title {
  fill: var(--color-text, #222);
  font-family: inherit;
  font-size: 12px;
}
.trend-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.trend-line-client {
  stroke: var(--viz-series-1, #5c78a8);
}
.trend-line-appointment {
  stroke: var(--viz-series-2, #9b6b9e);
}
.trend-point {
  stroke: var(--color-surface, #fff);
  stroke-width: 2;
}
.trend-point-client {
  fill: var(--viz-series-1, #5c78a8);
}
.trend-point-appointment {
  fill: var(--viz-series-2, #9b6b9e);
}
.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 4px;
  font-size: .86rem;
}
.trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.trend-key {
  width: 22px;
  height: 3px;
  display: inline-block;
  border-radius: 2px;
}
.trend-key-client { background: var(--viz-series-1, #5c78a8); }
.trend-key-appointment { background: var(--viz-series-2, #9b6b9e); }

@media (max-width: 620px) {
  .trend-x-label { font-size: 10px; }
  .trend-y-label { font-size: 10px; }
}

/* v30: deutlich unterscheidbare Blautöne für den Zeitverlauf */
.trend-line-client { stroke: #63b5e8 !important; }
.trend-point-client { fill: #63b5e8 !important; }
.trend-key-client { background: #63b5e8 !important; }
.trend-line-appointment { stroke: #174a7e !important; }
.trend-point-appointment { fill: #174a7e !important; }
.trend-key-appointment { background: #174a7e !important; }

/* v32: erläuternder Infokasten unter dem Zeitverlaufsdiagramm */
.info-box {
  margin-top: 24px;
  padding: 18px 22px;
  border: 1px solid var(--color-border, #d9d9d9);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
}
.info-box h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}
.info-box p {
  margin: 0 0 9px;
  line-height: 1.5;
}
.info-box p:last-child {
  margin-bottom: 0;
}

/* v33: methodischer Hinweis am Ende des Dashboards */
.method-note {
  margin: 10px 2px 24px;
  font-size: .78rem;
  line-height: 1.45;
  color: var(--color-text-muted, #666);
}
.method-note strong {
  color: var(--color-text, #333);
}
