/* ============================================================
   zk-design 0.4.0: Dashboards und Diagramme (charts.css).
   Optional, NACH components.css und contrast.css laden. Funktioniert
   im Standard und im Stil editorial. Farben nur ueber Tokens:
   Serien aus --series-1..8 (tokens.css), Hervorhebung aus --accent.

   Serienfarbe: jede Klasse .s1 ... .s8 setzt --s, die Marken
   (Linie, Balken, Legende) lesen --s. Farbe folgt der Sache:
   dieselbe Serie behaelt in allen Diagrammen ihre Nummer.
   .s-hl = Akzent (die eine Serie, um die es geht), .s-rest =
   zurueckgenommenes Grau fuer den Rest.

   Erzeugt werden die Diagramme von src/Chart.php (oder dem Skript
   skill/zk-screen/scripts/chart.php fuer statische Entwuerfe).
   ============================================================ */

.s1 { --s: var(--series-1); } .s2 { --s: var(--series-2); } .s3 { --s: var(--series-3); } .s4 { --s: var(--series-4); }
.s5 { --s: var(--series-5); } .s6 { --s: var(--series-6); } .s7 { --s: var(--series-7); } .s8 { --s: var(--series-8); }
.s-hl { --s: var(--accent); }
.s-rest { --s: var(--ink-3); opacity: .55; }
.s-rest-2 { --s: var(--ink-2); opacity: .8; }

/* ---------- Raster und Panel ---------- */
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); gap: 16px; }
.dash > * { min-width: 0; }
.panel-wide { grid-column: 1 / -1; }
/* zwei Spalten breit, sobald das Fenster fuer mindestens zwei reicht (Seitenraster, nicht fuer schmale Einbettung) */
@media (min-width: 56rem) { .panel-span { grid-column: span 2; } }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 16px 18px 18px;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-title { font-size: 15px; line-height: 1.3; font-weight: 600; margin: 0; color: var(--ink); }
.panel-sub { font-size: 13px; color: var(--ink-3); }

/* Kennzahl mit Veraenderung: Pfeil und Vorzeichen tragen die Richtung, Farbe nur zusaetzlich */
.kpi-delta { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.kpi-delta .ms { font-size: 16px; }
.kpi-delta.is-up { color: var(--ok); }
.kpi-delta.is-down { color: var(--danger); }

/* ---------- Legende ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-sw { width: 10px; height: 10px; border-radius: 3px; background: var(--s); flex: none; }
.legend-val { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- Rangbalken (waagerecht, eine Farbe) ---------- */
.hbar { display: grid; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(5.5rem, 9.5rem) minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.hbar-label { font-size: 14px; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.hbar-track { display: block; height: 10px; border-radius: 4px; background: var(--bar-track); overflow: hidden; }
.hbar-fill { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--s, var(--series-1)); }
.hbar a.hbar-label { color: var(--ink); text-decoration: none; }
.hbar a.hbar-label:hover { text-decoration: underline; }
.hbar a.hbar-label:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.hbar-val { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; min-width: 3.5rem; }

/* ---------- Geteilter Balken (ein Ganzes in Teile), duenn, Zahlen in der Legende ---------- */
.segbar { display: flex; gap: 2px; height: 12px; }
.segbar-seg { display: block; min-width: 3px; border-radius: 3px; background: var(--s); }

/* ---------- Linien- und Flaechendiagramm (SVG aus Chart::line) ---------- */
.chart { margin: 0; }
.chart-scroll { display: block; overflow-x: auto; padding: 0; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.chart-svg { display: block; width: 100%; min-width: 40rem; max-width: 48rem; height: auto; overflow: visible; }
.chart-grid { stroke: var(--line-soft); stroke-width: 1; shape-rendering: crispEdges; }
.chart-axis { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart-tick { font-size: 13px; fill: var(--ink-3); font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--s); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--s); fill-opacity: .12; stroke: none; }
.chart-dot { fill: var(--s); stroke: var(--surface); stroke-width: 2; }
.chart-name { font-size: 13px; font-weight: 600; fill: var(--ink-2); font-family: var(--font); }
.chart-goal { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 4; fill: none; }
.chart-goal-label { font-size: 13px; fill: var(--ink-3); font-family: var(--font); }
.chart-bar { fill: var(--s); stroke: var(--surface); stroke-width: 2; }
.chart-hit { fill: transparent; pointer-events: all; }
.chart-hit:hover { fill: var(--line-soft); fill-opacity: .6; }
.chart-table { margin-top: 12px; font-size: 13px; }
.chart-table > summary { cursor: pointer; color: var(--ink-2); min-height: 24px; }
.chart-table table { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 6px 8px; border-top: 1px solid var(--line); text-align: right; font-weight: 400; }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.chart-table thead th { border-top: 0; color: var(--ink-3); }

/* Tooltip (nur mit zk.js; ohne die Datei bleibt der Browser-Tooltip aus dem <title>) */
.chart { position: relative; }
.chart-hit:focus { outline: none; fill: var(--line-soft); fill-opacity: .6; }
.chart-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; max-width: 16rem;
  background: var(--ink); color: var(--bg); border-radius: var(--r-el);
  padding: 8px 10px; font-size: 13px; line-height: 1.45; font-variant-numeric: tabular-nums;
}
.chart-tip[hidden] { display: none; }
.chart-tip-head { display: block; font-weight: 600; margin-bottom: 2px; }
.chart-tip-row { display: block; }

/* CSP-feste Breiten (0.5.0): statt style="width:N%" die Klasse .w-N, N = 0 bis 100 (ganzzahlig).
   Chart::hbar und Chart::segbar mit 'csp' => true erzeugen sie. */
.w-0 { width: 0%; }
.w-1 { width: 1%; }
.w-2 { width: 2%; }
.w-3 { width: 3%; }
.w-4 { width: 4%; }
.w-5 { width: 5%; }
.w-6 { width: 6%; }
.w-7 { width: 7%; }
.w-8 { width: 8%; }
.w-9 { width: 9%; }
.w-10 { width: 10%; }
.w-11 { width: 11%; }
.w-12 { width: 12%; }
.w-13 { width: 13%; }
.w-14 { width: 14%; }
.w-15 { width: 15%; }
.w-16 { width: 16%; }
.w-17 { width: 17%; }
.w-18 { width: 18%; }
.w-19 { width: 19%; }
.w-20 { width: 20%; }
.w-21 { width: 21%; }
.w-22 { width: 22%; }
.w-23 { width: 23%; }
.w-24 { width: 24%; }
.w-25 { width: 25%; }
.w-26 { width: 26%; }
.w-27 { width: 27%; }
.w-28 { width: 28%; }
.w-29 { width: 29%; }
.w-30 { width: 30%; }
.w-31 { width: 31%; }
.w-32 { width: 32%; }
.w-33 { width: 33%; }
.w-34 { width: 34%; }
.w-35 { width: 35%; }
.w-36 { width: 36%; }
.w-37 { width: 37%; }
.w-38 { width: 38%; }
.w-39 { width: 39%; }
.w-40 { width: 40%; }
.w-41 { width: 41%; }
.w-42 { width: 42%; }
.w-43 { width: 43%; }
.w-44 { width: 44%; }
.w-45 { width: 45%; }
.w-46 { width: 46%; }
.w-47 { width: 47%; }
.w-48 { width: 48%; }
.w-49 { width: 49%; }
.w-50 { width: 50%; }
.w-51 { width: 51%; }
.w-52 { width: 52%; }
.w-53 { width: 53%; }
.w-54 { width: 54%; }
.w-55 { width: 55%; }
.w-56 { width: 56%; }
.w-57 { width: 57%; }
.w-58 { width: 58%; }
.w-59 { width: 59%; }
.w-60 { width: 60%; }
.w-61 { width: 61%; }
.w-62 { width: 62%; }
.w-63 { width: 63%; }
.w-64 { width: 64%; }
.w-65 { width: 65%; }
.w-66 { width: 66%; }
.w-67 { width: 67%; }
.w-68 { width: 68%; }
.w-69 { width: 69%; }
.w-70 { width: 70%; }
.w-71 { width: 71%; }
.w-72 { width: 72%; }
.w-73 { width: 73%; }
.w-74 { width: 74%; }
.w-75 { width: 75%; }
.w-76 { width: 76%; }
.w-77 { width: 77%; }
.w-78 { width: 78%; }
.w-79 { width: 79%; }
.w-80 { width: 80%; }
.w-81 { width: 81%; }
.w-82 { width: 82%; }
.w-83 { width: 83%; }
.w-84 { width: 84%; }
.w-85 { width: 85%; }
.w-86 { width: 86%; }
.w-87 { width: 87%; }
.w-88 { width: 88%; }
.w-89 { width: 89%; }
.w-90 { width: 90%; }
.w-91 { width: 91%; }
.w-92 { width: 92%; }
.w-93 { width: 93%; }
.w-94 { width: 94%; }
.w-95 { width: 95%; }
.w-96 { width: 96%; }
.w-97 { width: 97%; }
.w-98 { width: 98%; }
.w-99 { width: 99%; }
.w-100 { width: 100%; }
