flowchart LR
  %% Clients (Frontends)
  subgraph Clients["Clients (Frontends)"]
    SC["Spiel-Client"]
    DC["Dashboard-Client"]
  end

  %% Ingestion
  subgraph Ingestion["Telemetry Ingestion"]
    CG["Consent-Gate"]
    COL["Collector<br/>(Auth + Schema-Validation)"]
  end

  %% Separation
  subgraph Streams["Trennung der Datenströme"]
    DID["Didaktik-Stream<br/>(Lern/Verhalten)"]
    SYS["System-Stream<br/>(Fehler/Performance)"]
  end

  %% Storage
  subgraph Storage["Persistenz"]
    LRS["LRS / Event Store<br/>(Rohdaten)"]
  end

  %% Analytics
  subgraph Analytics["Analytics"]
    AGG["Aggregation<br/>(KPIs/Indikatoren)"]
    ADB["Analytics DB<br/>(Serving Layer)"]
  end

  %% Governance
  subgraph Gov["Governance"]
    RB["RBAC/ABAC"]
    RET["Retention/Löschung"]
    AUD["Audit Logs"]
  end

  %% Flows
  SC --> CG --> COL
  COL --> DID --> LRS
  COL --> SYS --> LRS
  LRS --> AGG --> ADB --> DC

  %% Governance as controls
  RB -. "Zugriff" .-> LRS
  RB -. "Zugriff" .-> ADB
  RET -. "Regeln" .-> LRS
  AUD <-. "Zugriffe/Exporte" .-> DC
