/* =====================================================
   SuppTree — SVG-Chart-Helfer CSS (gemeinsame Quelle)
   =====================================================
   Struktur-, Typografie- und Animations-Stile für das
   SVG-Chart-HTML, das von shared/charts.js erzeugt wird.

   Namespace: alle Klassen beginnen mit .sct-* (SuppTree
   ChartS) — kollisionsfrei zu anderen App-Stilen.

   WICHTIG: Daten-Farben (Linien, Balken, Slices) werden
   INLINE auf den SVG-Knoten gesetzt. Diese Datei steuert
   NUR Layout, Typografie, Hover/Transitions und neutrale
   Zustände (Gitter, Achsen, Leer-Meldung).

   Die :root-CSS-Variablen (--green-dark, --green-accent,
   --border, --text-muted, --r …) werden von der jeweils
   einbindenden App (hersteller/ bzw. partner/) gestellt.
   ===================================================== */

/* --- Chart-Rahmen --- */
.sct-chart {
  margin: 0;
  padding: 0;
  width: 100%;
}
.sct-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: inherit;
}

/* --- Achsen & Gitter --- */
.sct-grid {
  stroke-width: 1;
  shape-rendering: crispEdges;
}
.sct-axis-x,
.sct-axis-y {
  font-size: 10px;
  fill: var(--text-muted, #6b7280);
}
.sct-axis-y { font-variant-numeric: tabular-nums; }

/* --- Linien-Chart --- */
.sct-line {
  transition: opacity 0.15s ease;
}
.sct-line-forecast {
  opacity: 0.9;
}
.sct-area,
.sct-stack-area,
.sct-band {
  transition: fill-opacity 0.15s ease;
}
.sct-forecast-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.sct-dot {
  transition: r 0.12s ease;
  cursor: pointer;
}
.sct-dot:hover { r: 5.5; }
.sct-dot-forecast { opacity: 0.85; }

/* --- Balken-Charts --- */
.sct-bar,
.sct-funnel-bar,
.sct-slice,
.sct-heat-cell {
  transition: opacity 0.13s ease, filter 0.13s ease;
  cursor: pointer;
}
.sct-bar:hover,
.sct-funnel-bar:hover,
.sct-slice:hover,
.sct-heat-cell:hover {
  opacity: 0.82;
}
.sct-bar-value,
.sct-funnel-label {
  font-size: 10px;
  font-weight: 600;
  fill: var(--text, #1f2937);
  font-variant-numeric: tabular-nums;
}
.sct-funnel-label { fill: #ffffff; }
.sct-funnel-conv {
  font-size: 10px;
  font-weight: 600;
}

/* --- Donut --- */
.sct-donut-value {
  font-size: 20px;
  font-weight: 700;
  fill: var(--green-dark, #1a5a3a);
  font-variant-numeric: tabular-nums;
}
.sct-donut-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Gauge --- */
.sct-gauge-bg { shape-rendering: geometricPrecision; }
.sct-gauge-needle { transition: all 0.2s ease; }
.sct-gauge-value {
  font-size: 22px;
  font-weight: 700;
  fill: var(--green-dark, #1a5a3a);
  font-variant-numeric: tabular-nums;
}
.sct-gauge-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* --- Heatmap --- */
.sct-heat-value {
  font-size: 9px;
  font-weight: 600;
  fill: #1f2937;
  font-variant-numeric: tabular-nums;
}

/* --- Sparkline (winzig, kein Achsen-Layout) --- */
.sct-sparkline svg {
  height: 32px;
}

/* --- Leer-Zustand --- */
.sct-chart-empty { opacity: 0.9; }
.sct-empty {
  font-size: 12px;
  fill: var(--text-muted, #6b7280);
  font-style: italic;
}

/* --- Legende --- */
.sct-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: center;
  margin-top: 8px;
  padding: 0 8px;
}
.sct-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text, #1f2937);
}
.sct-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-block;
}

/* --- Tooltip (eines, geteilt, an document.body) --- */
.sct-tooltip {
  position: absolute;
  z-index: 9999;
  pointer-events: none;
  background: #1f2937;
  color: #ffffff;
  font-size: 11px;
  line-height: 1.35;
  padding: 5px 9px;
  border-radius: 5px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  max-width: 240px;
  white-space: normal;
}

/* --- Segment-Umschalter --- */
.sct-segmented {
  display: inline-flex;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--r, 7px);
  overflow: hidden;
  background: var(--cream, #f8f9fa);
}
.sct-segmented-btn {
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  border-right: 1px solid var(--border, #e5e7eb);
}
.sct-segmented-btn:last-child { border-right: none; }
.sct-segmented-btn:hover { color: var(--green-dark, #1a5a3a); }
.sct-segmented-btn.active {
  background: var(--green-dark, #1a5a3a);
  color: #ffffff;
}

/* --- Metrik-Auswahl (Select in der chartCard) --- */
.sct-metric-select {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--green-dark, #1a5a3a);
  background: var(--cream, #f8f9fa);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--r, 7px);
  padding: 6px 10px;
  cursor: pointer;
}

/* --- KPI-Kachel --- */
.sct-kpi {
  background: #ffffff;
  border: 1px solid var(--border, #e5e7eb);
  border-top: 3px solid var(--green-accent, #00A67E);
  border-radius: var(--r, 7px);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: box-shadow 0.15s ease;
}
.sct-kpi:hover { box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08); }
.sct-kpi-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #6b7280);
}
.sct-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--green-dark, #1a5a3a);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.sct-kpi-delta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.sct-kpi-arrow { font-size: 10px; }
.sct-kpi-abs { opacity: 0.85; }
.sct-kpi-up    { color: #15803d; }
.sct-kpi-down  { color: #dc2626; }
.sct-kpi-flat  { color: var(--text-muted, #6b7280); }
.sct-kpi-spark { margin-top: 2px; }

/* --- Chart-Karte (.card-Hülle) --- */
.sct-card {
  display: flex;
  flex-direction: column;
}
.sct-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.sct-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark, #1a5a3a);
}
.sct-card-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sct-card-body { width: 100%; }
.sct-card-footnote {
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-muted, #6b7280);
  line-height: 1.4;
}
