/* Belegte Fälle: Ergebnis-Karten mit eigener Darstellung und Original-Beleg.
 * Wird von der Startseite, /analyse/, /local-pack/ und den Cluster-Seiten
 * geladen. Nutzt die Farbvariablen der jeweiligen Seite, mit Rückfallwerten,
 * damit die Komponente überall gleich aussieht.
 * Standard = dunkles Band. Für helle Bänder zusätzlich .faelle.hell setzen. */

.faelle {
  --fa-gold: var(--gold, #c2a05e);
  --fa-fg: var(--d-fg, #ece8df);
  --fa-muted: var(--d-muted, rgba(236, 232, 223, 0.58));
  --fa-line: var(--d-line, rgba(236, 232, 223, 0.12));
  --fa-card: var(--d-card, rgba(255, 255, 255, 0.04));
  --fa-vorher: rgba(236, 232, 223, 0.46);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.3rem;
  margin-top: 2.4rem;
}
.faelle.hell {
  --fa-gold: #8a6a2c;
  --fa-fg: var(--p-ink, #1b1a14);
  --fa-muted: var(--p-muted, rgba(27, 26, 20, 0.55));
  --fa-line: var(--p-line, rgba(27, 26, 20, 0.12));
  --fa-card: #fffdf8;
  --fa-line: rgba(27, 26, 20, 0.14);
  --fa-vorher: rgba(27, 26, 20, 0.45);
}
/* Auf Papier ist Gold dunkler als der Grund, also traegt es dort Flaeche statt Leuchten. */
.faelle.hell .fall { box-shadow: 0 1px 2px rgba(27, 26, 20, 0.05), 0 18px 40px -22px rgba(27, 26, 20, 0.22); }
.faelle.hell .fa-linie { stroke-width: 2.4; }
.faelle.hell .fa-flaeche { opacity: 0.2; }
.faelle.hell .fall-delta { background: rgba(138, 106, 44, 0.1); border-color: rgba(138, 106, 44, 0.38); }
.faelle-block { --fa-hinweis: var(--d-muted, rgba(236, 232, 223, 0.58)); }
.faelle-block.hell { --fa-hinweis: var(--p-muted, rgba(27, 26, 20, 0.55)); }
/* Pflichtklarstellung: Einzelfaelle, keine Zusage. */
.faelle-block .faelle-hinweis {
  margin: 1.1rem 0 0; font-size: 0.78rem; line-height: 1.55; color: var(--fa-hinweis);
  max-width: 78ch;
}
.faelle p { margin: 0; line-height: inherit; }
.faelle a { text-decoration: none; }
.faelle svg { max-width: 100%; }
.faelle.einzeln { grid-template-columns: 1fr; max-width: 560px; margin-inline: auto; }
@media (max-width: 860px) { .faelle { grid-template-columns: 1fr; } }

.faelle .fall {
  border: 1px solid var(--fa-line);
  background: var(--fa-card);
  border-radius: 20px;
  padding: 2rem 2.1rem 1.8rem;
  display: flex;
  flex-direction: column;
  color: var(--fa-fg);
}

.faelle .fall-art {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fa-gold);
}
/* Der Kundenname trägt die Karte: die Zahl gehört zu einem Namen, nicht zu „einem Kunden“. */
.faelle .fall-kunde {
  margin-top: 0.55rem; font-size: 1.16rem; font-weight: 600; letter-spacing: -0.015em;
  line-height: 1.3; color: var(--fa-fg);
}

.faelle .fall-metrik { margin-top: 1.15rem; font-size: 0.95rem; color: var(--fa-muted); }
/* Das Ergebnis ist die Karte: ein Satz in Kundengroessen, der Kern hell hervorgehoben. */
.faelle .fall-ergebnis {
  margin-top: 1.05rem; font-family: var(--serif, Georgia, serif);
  font-size: clamp(1.35rem, 2.7vw, 1.8rem); line-height: 1.32; letter-spacing: -0.01em;
  color: var(--fa-muted); text-wrap: balance;
}
.faelle .fall-ergebnis b { color: var(--fa-fg); font-weight: 600; }

.faelle .fall-zahl {
  margin-top: 0.5rem; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.55rem;
  font-family: var(--serif, Georgia, serif); font-weight: 500; letter-spacing: -0.02em;
  line-height: 1.05; font-variant-numeric: tabular-nums;
}
.faelle .fall-vorher { font-size: clamp(1.5rem, 3.2vw, 1.9rem); color: var(--fa-vorher); }
.faelle .fall-pfeil { font-size: 1.1rem; color: var(--fa-muted); }
.faelle .fall-nachher { font-size: clamp(2.1rem, 5vw, 2.8rem); color: var(--fa-fg); }
.faelle .fall-delta {
  margin-left: 0.15rem; font-family: var(--sans, sans-serif); font-size: 0.85rem; font-weight: 600;
  letter-spacing: 0; color: var(--fa-gold); border: 1px solid var(--fa-gold);
  border-radius: 999px; padding: 0.2rem 0.62rem; white-space: nowrap;
}

.faelle .fall-kurve { margin-top: 1.1rem; }
.faelle .fall-kurvenlabel {
  margin-bottom: 0.45rem; font-size: 0.74rem; letter-spacing: 0.02em; color: var(--fa-muted);
}
.faelle .fall-kurve svg { width: 100%; height: auto; display: block; overflow: visible; }
.faelle .fall-kurve .fa-flaeche { fill: var(--fa-gold); opacity: 0.13; }
.faelle .fall-kurve .fa-linie { fill: none; stroke: var(--fa-gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.faelle .fall-kurve .fa-punkt { fill: var(--fa-gold); }
.faelle .fall-achse {
  margin-top: 0.4rem; display: flex; justify-content: space-between;
  font-size: 0.72rem; color: var(--fa-muted); font-variant-numeric: tabular-nums;
}

.faelle .fall-zweit {
  margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--fa-line);
  display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9rem;
}
.faelle .fall-zweit .k { color: var(--fa-muted); }
.faelle .fall-zweit .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.faelle .fall-fuss {
  margin-top: auto; padding-top: 1.2rem; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.faelle .fall-quelle { font-size: 0.76rem; color: var(--fa-muted); max-width: 26ch; line-height: 1.45; }
.faelle .fall-beleg {
  display: inline-flex; align-items: center; gap: 0.45rem; font: inherit; font-size: 0.84rem;
  font-weight: 600; color: var(--fa-gold); background: none; border: 1px solid var(--fa-gold);
  border-radius: 999px; padding: 0.5rem 1rem; cursor: pointer; text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.faelle .fall-beleg:hover { background: var(--fa-gold); color: #14140f; }
.faelle.hell .fall-beleg:hover { color: #f7f5ef; }
.faelle .fall-beleg:focus-visible { outline: 2px solid var(--fa-gold); outline-offset: 3px; }
.faelle .fall-beleg .lupe { width: 13px; height: 13px; flex: 0 0 auto; }

/* Beleg-Fenster */
.fa-fenster {
  border: none; padding: 0; background: transparent; max-width: min(980px, 94vw);
  max-height: 92vh; color: #14161a;
  /* Der globale Reset setzt margin:0 und hebelt das Zentrieren modaler Dialoge aus. */
  margin: auto;
}
.fa-fenster::backdrop { background: rgba(20, 22, 26, 0.55); backdrop-filter: blur(4px); }
.fa-fenster-inhalt {
  background: #fff; border: 1px solid #e7e9ee; border-radius: 24px;
  padding: 1.15rem 1.15rem 1.25rem; display: flex; flex-direction: column; gap: 0.85rem;
  max-height: 92vh; min-height: 0;
  box-shadow: 0 40px 90px -40px rgba(20, 22, 26, 0.5);
}
/* Beleg immer ganz sichtbar, ohne Scrollen */
.fa-fenster img {
  display: block; margin-inline: auto; border-radius: 14px; background: #fff;
  max-width: 100%; width: auto; height: auto; min-height: 0; flex: 0 1 auto;
  object-fit: contain; border: 1px solid #e7e9ee;
}
.fa-fenster-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.fa-fenster-titel { font-family: var(--sans, sans-serif); font-size: 0.88rem; line-height: 1.55;
  color: #5a6170; max-width: 62ch; }
.fa-original {
  align-self: flex-start; font-size: 0.82rem; font-weight: 600; color: #2563eb;
  text-decoration: none; border: 1px solid #e7e9ee; border-radius: 999px; padding: 0.4rem 0.85rem;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}
.fa-original:hover { border-color: #d0d5df; background: #f6f7f9; }
.fa-original:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
.fa-schliessen {
  font: inherit; font-size: 1.25rem; line-height: 1; color: #5a6170;
  background: #f6f7f9; border: 1px solid #e7e9ee; cursor: pointer;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; padding: 0; flex: 0 0 auto;
}
.fa-schliessen:hover { color: #14161a; border-color: #d0d5df; }
.fa-schliessen:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
