  :root {
    color-scheme: light;
    --surface-1:      #fcfcfb;
    --page-plane:     #f9f9f7;
    --text-primary:   #0b0b0b;
    --text-secondary: #52514e;
    --muted:          #898781;
    --gridline:       #e1e0d9;
    --baseline:       #c3c2b7;
    --series-1:       #2a78d6;
    --series-2:       #eb6834;
    --series-3:       #1baf7a;
    --series-4:       #eda100;
    --seq-track:      #cde2fb;
    --success:        #006300;
    --border:         rgba(11,11,11,0.10);
    --de-emphasis:    #d7d6cf;
    --good:           #0ca30c;
    --warning:        #fab219;
    --serious:        #ec835a;
    --critical:       #d03b3b;
    --warning-track:  rgba(250,178,25,0.16);
    --critical-track: rgba(208,59,59,0.14);
  }
  @media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) {
      color-scheme: dark;
      --surface-1:      #1a1a19;
      --page-plane:     #0d0d0d;
      --text-primary:   #ffffff;
      --text-secondary: #c3c2b7;
      --muted:          #898781;
      --gridline:       #2c2c2a;
      --baseline:       #383835;
      --series-1:       #3987e5;
      --series-2:       #d95926;
      --series-3:       #199e70;
      --series-4:       #c98500;
      --seq-track:      rgba(57,135,229,0.18);
      --success:        #0ca30c;
      --border:         rgba(255,255,255,0.10);
      --de-emphasis:    #34342f;
      --good:           #0ca30c;
      --warning:        #fab219;
      --serious:        #ec835a;
      --critical:       #e66767;
      --warning-track:  rgba(250,178,25,0.14);
      --critical-track: rgba(230,103,103,0.14);
    }
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --page-plane:     #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --muted:          #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --series-1:       #3987e5;
    --series-2:       #d95926;
    --series-3:       #199e70;
    --series-4:       #c98500;
    --seq-track:      rgba(57,135,229,0.18);
    --success:        #0ca30c;
    --border:         rgba(255,255,255,0.10);
    --de-emphasis:    #34342f;
    --good:           #0ca30c;
    --warning:        #fab219;
    --serious:        #ec835a;
    --critical:       #e66767;
    --warning-track:  rgba(250,178,25,0.14);
    --critical-track: rgba(230,103,103,0.14);
  }

  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    background: var(--page-plane);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
  }
  a { color: var(--series-1); }

  .wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

  /* Top bar */
  header.topbar {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--page-plane) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
  }
  .topbar-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0; gap: 16px; flex-wrap: wrap;
  }
  .brand { display: flex; align-items: baseline; gap: 10px; }
  .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--series-1); display: inline-block; }
  .brand strong { font-size: 15px; letter-spacing: 0.01em; }
  nav.subnav { display: flex; gap: 18px; flex-wrap: wrap; }
  nav.subnav a {
    font-size: 13.5px; color: var(--text-secondary); text-decoration: none;
    padding: 6px 2px; border-bottom: 2px solid transparent;
  }
  nav.subnav a:hover { color: var(--text-primary); border-bottom-color: var(--series-1); }
  .theme-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface-1); border: 1px solid var(--border); color: var(--text-secondary);
    border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer;
  }
  .theme-toggle:hover { color: var(--text-primary); }

  /* Hero */
  .hero { padding: 56px 0 40px; }
  .hero-eyebrow {
    font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--muted); font-weight: 600; margin: 0 0 14px;
  }
  .hero-figure {
    font-size: clamp(56px, 9vw, 92px);
    font-weight: 700; letter-spacing: -0.02em; line-height: 1;
    margin: 0 0 12px; color: var(--text-primary);
  }
  .hero-figure span { color: var(--series-1); }
  .hero-sub {
    font-size: 18px; color: var(--text-secondary); max-width: 640px; margin: 0 0 6px;
  }
  .hero-meta { font-size: 13px; color: var(--muted); margin-top: 18px; }

  /* KPI grid */
  .kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px; margin: 8px 0 48px;
  }
  .kpi-tile {
    background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px;
    padding: 18px 20px;
  }
  .kpi-label { font-size: 13px; color: var(--text-secondary); margin: 0 0 8px; }
  .kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 6px; }
  .kpi-foot { font-size: 12.5px; color: var(--muted); margin: 0; }
  .kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 12.5px; }
  .kpi-delta.bad { color: var(--critical); }
  .kpi-delta svg { width: 11px; height: 11px; }

  /* Section headers */
  section.block { padding: 8px 0 48px; scroll-margin-top: 84px; }
  .block-head { margin-bottom: 18px; }
  .block-title { font-size: 22px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.01em; }
  .block-desc { font-size: 14.5px; color: var(--text-secondary); margin: 0; max-width: 680px; }

  /* Card */
  .card {
    background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px;
    padding: 24px; margin-bottom: 20px;
  }
  .card-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    margin-bottom: 14px; flex-wrap: wrap;
  }
  .card-head h3 { font-size: 16px; margin: 0 0 4px; font-weight: 600; }
  .card-head .caption { font-size: 13px; color: var(--text-secondary); margin: 0; max-width: 520px; }
  .table-toggle {
    flex-shrink: 0; background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
    border-radius: 8px; padding: 6px 12px; font-size: 12.5px; cursor: pointer;
  }
  .table-toggle:hover { color: var(--text-primary); border-color: var(--muted); }
  .source-note { font-size: 12px; color: var(--muted); margin: 14px 0 0; }

  .chart-visual svg { width: 100%; height: auto; display: block; overflow: visible; }
  .chart-table[hidden] { display: none; }
  .chart-visual[hidden] { display: none; }
  table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  table.data-table th, table.data-table td {
    text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--gridline);
    font-variant-numeric: tabular-nums;
  }
  table.data-table th { color: var(--text-secondary); font-weight: 600; }

  /* marks */
  .mark { cursor: pointer; outline: none; transition: filter .12s ease; }
  .mark:hover, .mark.hover, .mark:focus-visible { filter: brightness(1.12); }
  .val-label { font-size: 12.5px; fill: var(--text-primary); font-weight: 600; }
  .cat-label { font-size: 12.5px; fill: var(--text-secondary); }
  .tick-label { font-size: 11px; fill: var(--muted); }
  .grid-line { stroke: var(--gridline); stroke-width: 1; }
  .axis-line { stroke: var(--baseline); stroke-width: 1; }
  .zero-line { stroke: var(--baseline); stroke-width: 1; stroke-dasharray: 2 3; }
  .line-path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
  .line-path.projected { stroke-dasharray: 5 4; opacity: 0.6; }
  .line-dot { stroke: var(--surface-1); stroke-width: 2; cursor: pointer; }
  .end-label { font-size: 10px; font-weight: 600; }
  .crosshair-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; opacity: 0; }
  .chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 14px; font-size: 13px; color: var(--text-secondary); }
  .chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
  .chart-legend .swatch-line { width: 14px; height: 2px; border-radius: 2px; flex-shrink: 0; }
  .chart-legend .swatch-line.dashed { background: none; border-top: 2px dashed currentColor; height: 0; }

  /* tooltip */
  #chart-tooltip {
    position: fixed; z-index: 100; pointer-events: none;
    background: var(--text-primary); color: var(--page-plane);
    border-radius: 8px; padding: 8px 12px; font-size: 12.5px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25); max-width: 220px;
  }
  #chart-tooltip .tt-value { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
  #chart-tooltip .tt-label { opacity: 0.8; }
  #chart-tooltip[hidden] { display: none; }

  /* meters */
  .meter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
  .meter-item .meter-top { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
  .meter-item .status-icon { width: 15px; height: 15px; flex-shrink: 0; }
  .meter-item .meter-label { font-size: 13.5px; color: var(--text-secondary); }
  .meter-item .meter-value { font-size: 26px; font-weight: 700; margin: 2px 0 8px; }
  .meter-track {
    position: relative; height: 10px; border-radius: 999px; background: var(--gridline); overflow: visible;
  }
  .meter-fill { position: absolute; top: 0; left: 0; height: 100%; border-radius: 999px; }
  .meter-item .meter-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

  .target-meter { margin-top: 6px; }
  .target-meter .meter-track { height: 14px; background: var(--seq-track); }
  .target-meter .meter-fill { background: var(--series-1); }
  .target-tick {
    position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--baseline);
  }
  .target-band {
    position: absolute; top: -6px; bottom: -6px; background: var(--critical-track);
    border-left: 2px solid var(--critical); border-right: 2px solid var(--critical);
  }
  .target-legend { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 26px; font-size: 12.5px; color: var(--text-secondary); }
  .target-legend .key { display: inline-flex; align-items: center; gap: 6px; }
  .target-legend .swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

  footer.page-footer { padding: 32px 0 64px; border-top: 1px solid var(--border); margin-top: 12px; }
  footer.page-footer h4 { font-size: 14px; margin: 0 0 10px; }
  footer.page-footer ul { margin: 0 0 20px; padding-left: 18px; font-size: 13px; color: var(--text-secondary); }
  footer.page-footer li { margin-bottom: 4px; }
  footer.page-footer .foot-note { font-size: 12.5px; color: var(--muted); }

  /* ---------- Teil 2: lokale Sektionen ---------- */

  .part-divider {
    margin: 56px 0 8px; padding: 34px 0 30px;
    border-top: 2px solid var(--text-primary); border-bottom: 1px solid var(--border);
  }
  .part-eyebrow {
    margin: 0 0 10px; font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase;
    color: var(--muted); font-weight: 600;
  }
  .part-title { margin: 0 0 12px; font-size: clamp(26px, 4vw, 38px); line-height: 1.12; letter-spacing: -0.02em; }
  .part-desc { margin: 0; max-width: 62ch; font-size: 15.5px; line-height: 1.6; color: var(--text-secondary); }

  .data-status {
    margin-top: 20px; padding: 12px 14px; border-radius: 8px;
    border: 1px solid var(--warning); background: var(--warning-track);
    font-size: 13px; color: var(--text-primary);
  }
  .data-status.error { border-color: var(--critical); background: var(--critical-track); }
  .data-status[hidden] { display: none; }

  .callout {
    margin-top: 20px; padding: 14px 16px; border-left: 3px solid var(--series-1);
    background: var(--seq-track); border-radius: 0 8px 8px 0;
  }
  .callout p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text-primary); }

  /* Kachelraster der Monatsanomalien */
  .heat-grid { width: 100%; overflow-x: auto; }
  .heat-grid table { border-collapse: separate; border-spacing: 3px; font-size: 12px; }
  .heat-grid th {
    font-weight: 500; color: var(--muted); padding: 2px 4px; text-align: center; white-space: nowrap;
  }
  .heat-grid th.row-head { text-align: right; padding-right: 8px; color: var(--text-secondary); font-weight: 600; }
  .heat-grid td {
    width: 42px; height: 30px; border-radius: 4px; text-align: center;
    font-variant-numeric: tabular-nums; font-size: 11.5px; cursor: default;
  }
  .heat-grid td.empty { background: none; }
  .heat-scale { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; color: var(--text-secondary); }
  .heat-scale .ramp { display: flex; }
  .heat-scale .ramp span { width: 22px; height: 10px; }
  .heat-scale .ramp span:first-child { border-radius: 3px 0 0 3px; }
  .heat-scale .ramp span:last-child { border-radius: 0 3px 3px 0; }

  /* Gestapelter Balken der Preisbestandteile */
  .stack-bar { display: flex; width: 100%; height: 42px; border-radius: 6px; overflow: hidden; margin: 6px 0 18px; }
  .stack-bar .seg { display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; color: #fff; }
  .stack-legend { display: grid; gap: 10px; }
  .stack-legend .row {
    display: grid; grid-template-columns: 14px 1fr auto auto; gap: 10px; align-items: center;
    font-size: 13.5px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
  }
  .stack-legend .row:last-child { border-bottom: none; }
  .stack-legend .sw { width: 12px; height: 12px; border-radius: 3px; }
  .stack-legend .num { font-variant-numeric: tabular-nums; color: var(--text-secondary); }
  .stack-legend .row.total { font-weight: 700; border-top: 1px solid var(--baseline); padding-top: 10px; }
  .stack-legend .row.total .num { color: var(--text-primary); }

  @media (max-width: 640px) {
    nav.subnav { display: none; }
    .hero { padding: 40px 0 28px; }
    .part-divider { margin-top: 40px; }
  }
