/* Bausteine: Seitenkopf, Panels, Knöpfe, Segmente, Pills, Skalen, Felder, Schalter, Unter-Tabs,
   Kennzahlen, Tabellen (mit Sortierung und Seiten), Code-Blöcke und Kleinteile.
   Klassen 1:1 aus dem Prototyp (Abschnitte „Grundbausteine“ und „Gemeinsame Tabellen und Kleinteile“),
   ergänzt um .h3, .tbl-wrap, .th-sort und .pager. Farben nur über Rollen-Tokens. */

/* ---------- Seite ---------- */
.stack { display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 4px; }
.ph-text { min-width: 0; flex: 1 1 380px; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.eyebrow { margin: 0 0 8px; font-family: var(--f-mono); font-stretch: 80%; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.h1 { margin: 0; font-family: var(--f-display); font-stretch: 62%; font-weight: 800; font-size: clamp(36px, 5vw, 60px); line-height: .9; letter-spacing: -.003em; text-transform: uppercase; text-wrap: balance; }
.h1.task { font-size: clamp(30px, 4.2vw, 50px); }
.lede { margin: 12px 0 0; color: var(--ink-2); max-width: 62ch; font-size: 15px; text-wrap: pretty; }
.h2 { margin: 0; font-family: var(--f-display); font-stretch: 74%; font-weight: 700; font-size: 21px; line-height: 1.1; letter-spacing: .004em; text-wrap: balance; }
.h3 { margin: 0; font-family: var(--f-display); font-stretch: 74%; font-weight: 700; font-size: 17px; line-height: 1.15; letter-spacing: .004em; text-wrap: balance; }
.sub { margin: 4px 0 0; color: var(--ink-3); font-size: 13px; max-width: 62ch; }
.hint { margin: 0; font-size: 12.5px; color: var(--ink-3); }

.panel { background: var(--raised); border: 1px solid var(--line-soft); box-shadow: var(--shadow-1); border-radius: var(--radius-l); padding: 18px 20px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.panel-head > div:first-child { min-width: 0; flex: 1 1 240px; }

/* ---------- Knöpfe ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background .15s, border-color .15s, transform .08s; text-decoration: none; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn .i { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--radius-s); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: color-mix(in oklab, var(--bad) 60%, var(--line)); }
.btn.armed, .btn.armed:hover { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
.btn.busy { pointer-events: none; opacity: .7; }
.btn.busy .i { animation: spin .8s linear infinite; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.sm.icon-only { width: 30px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn:disabled:hover, .btn[aria-disabled="true"]:hover { border-color: var(--line); }
.btn.primary:disabled:hover, .btn.primary[aria-disabled="true"]:hover { background: var(--accent); border-color: var(--accent); }
.btn.ghost:disabled:hover, .btn.ghost[aria-disabled="true"]:hover { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row.end { justify-content: flex-end; flex-wrap: nowrap; }

.link-btn { border: 0; background: none; padding: 2px 0; font-size: 12.5px; font-weight: 600; color: var(--accent-text); }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-plain { border: 0; background: none; padding: 0; color: inherit; font: inherit; font-weight: 600; text-align: left; }
.link-plain:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Segment-Umschalter (ui/seg.js) ---------- */
.seg { display: inline-flex; flex: none; background: var(--sunken); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 2px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: var(--radius-s); font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1), 0 0 0 1px var(--line-soft); }
.seg.sm button { padding: 3px 9px; font-size: 12px; }
.seg .cnt { font-family: var(--f-mono); font-stretch: 80%; font-size: 10.5px; color: var(--ink-3); margin-left: 5px; }
/* .seg scrollt waagerecht und schneidet alles außerhalb ab – Fokusrahmen deshalb nach innen */
.seg button:focus-visible { outline-offset: -2px; }
/* Windows-Kontrastmodus entfernt Hintergrund und Schatten – gedrücktes Segment per Rahmen zeigen
   (Fokusrahmen hat Vorrang) */
@media (forced-colors: active) {
  .seg button[aria-pressed="true"]:not(:focus-visible) { outline: 2px solid Highlight; outline-offset: -2px; }
}

/* ---------- Status: Pills, Tags, Scores ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--sunken); color: var(--ink-2); flex: none; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.good::before { background: var(--good-fill); }
.pill.warn::before { background: var(--warn-fill); }
.pill.bad::before { background: var(--bad-fill); }
.pill.live { background: var(--live-soft); color: var(--live-text); }
.pill.live::before { background: var(--live); animation: blink 1.2s infinite; }
.pill.judge { background: var(--judge-soft); color: var(--judge-text); }
.pill.judge::before { width: 8px; height: 8px; background: none; border: 1.5px solid currentColor; border-right-color: transparent; animation: spin .9s linear infinite; }

.tag { display: inline-block; font-family: var(--f-mono); font-stretch: 80%; font-size: 10.5px; padding: 2px 6px; border-radius: 4px; background: var(--sunken); color: var(--ink-2); border: 1px solid var(--line-soft); white-space: nowrap; }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag-acc { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.tag-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag-good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.tag-live { background: var(--live-soft); color: var(--live-text); border-color: transparent; }

.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.score.good { color: var(--good); }
.score.warn { color: var(--warn); }
.score.bad { color: var(--bad); }

.mcell { display: inline-block; min-width: 42px; padding: 3px 6px; border-radius: 4px; font-weight: 650; font-variant-numeric: tabular-nums; }
.mcell.good { background: var(--good-soft); color: var(--good); }
.mcell.warn { background: var(--warn-soft); color: var(--warn); }
.mcell.bad { background: var(--bad-soft); color: var(--bad); }

.schips { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.schip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 5px; background: var(--sunken); color: var(--ink-2); border: 1px solid var(--line-soft); white-space: nowrap; }
.schip.ok { background: var(--good-soft); color: var(--good); border-color: transparent; }
.schip.no { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

.spin { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--live); border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: middle; }
.lock { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--bad); }
.lock .i { width: 14px; height: 14px; }
.warn-mini { font-size: 12px; font-weight: 700; color: var(--warn); }
.ok-t { color: var(--good); font-weight: 700; }
.no-t { color: var(--bad); font-weight: 700; }
.badges { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; margin-left: 6px; vertical-align: middle; }

/* ---------- Messlatte: segmentierte 0–10-Skala ---------- */
.scale { --v: 0%; --tone: var(--ink-3); position: relative; display: block; height: 8px; border-radius: 2px; background: var(--sunken); overflow: hidden; min-width: 44px; }
.scale > i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--v); background: var(--tone); transition: width .4s cubic-bezier(.2, .8, .2, 1); }
.scale::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), var(--gapc, var(--raised)) calc(10% - 2px) 10%); }
.scale.fine::after { background: repeating-linear-gradient(90deg, transparent 0 calc(5% - 2px), var(--gapc, var(--raised)) calc(5% - 2px) 5%); }
.scale.good { --tone: var(--good-fill); }
.scale.warn { --tone: var(--warn-fill); }
.scale.bad { --tone: var(--bad-fill); }
.scale.acc { --tone: var(--viz); }
.scale-lg { display: flex; flex-direction: column; gap: 6px; }
.scale-lg .scale { height: 14px; }
.scale-ticks { display: flex; justify-content: space-between; font-family: var(--f-mono); font-stretch: 80%; font-size: 10px; color: var(--ink-3); }

/* ---------- Sparkline ---------- */
.spark { display: block; overflow: visible; }
.spark .sa { fill: var(--viz); opacity: .3; }
.spark .sl { fill: none; stroke: var(--viz-line); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark .sd { fill: var(--viz-line); }
.spark.muted .sa { fill: var(--ink-3); opacity: .1; }
.spark.muted .sl { stroke: var(--ink-3); }
.spark.muted .sd { fill: var(--ink-3); }
.spark.bad .sa { fill: var(--bad-fill); }
.spark.bad .sl { stroke: var(--bad); }
.spark.bad .sd { fill: var(--bad); }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.f-lab { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.f-lab-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; }

textarea,
input[type="text"], input[type="search"], input[type="number"], input[type="email"], input[type="password"],
input[type="url"], input[type="tel"], input[type="date"], input[type="time"], input[type="datetime-local"],
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--raised);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.45;
}
textarea { resize: vertical; min-height: 44px; }
textarea.code { font-family: var(--f-mono); font-stretch: 80%; font-size: 12.5px; line-height: 1.6; background: var(--sheet); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-text); outline-offset: -1px; border-color: transparent; }
input:disabled, textarea:disabled, select:disabled { background: var(--sunken); color: var(--ink-2); cursor: not-allowed; }
::placeholder { color: var(--ink-3); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--viz-line); }

.unit { display: flex; align-items: center; gap: 8px; }
.unit span { color: var(--ink-3); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 14px; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; }
.check input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--viz); flex: none; }
.check span { display: flex; flex-direction: column; line-height: 1.35; }
.check small { color: var(--ink-3); font-size: 12px; }

/* Suchfeld mit Icon und Werkzeugleiste über Listen */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .chips.scroll { flex: 1 1 260px; }
.search-field { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); flex: 1 1 220px; max-width: 340px; color: var(--ink-3); }
.search-field:focus-within { outline: 2px solid var(--accent-text); outline-offset: -1px; border-color: transparent; }
.search-field input { border: 0; outline: 0; background: none; padding: 0; height: 100%; flex: 1; min-width: 0; }
.search-field input:focus { outline: none; }
.search-field.sm { height: 34px; max-width: none; flex: none; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* Scrollende Chip-Leiste: 4 px Innenabstand (per negativem Außenabstand ausgeglichen), damit der
   Fokusrahmen nicht abgeschnitten wird – nach innen gelegt wäre er auf gedrückten Chips unsichtbar. */
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; padding: 4px; margin: -4px; }
.chip { flex: none; height: 28px; padding: 0 10px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--raised); font-size: 11.5px; color: var(--ink-2); font-family: var(--f-mono); font-stretch: 80%; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.chips-row.tight { margin: 6px 0 0; }

/* Gewichtungs-Zeile und Schieberegler */
.w-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 34px; align-items: center; gap: 12px; }
.w-row.wide { grid-template-columns: minmax(110px, 190px) minmax(0, 1fr) 40px; }
.w-row label { font-size: 13.5px; font-weight: 500; }
.w-row output { font-family: var(--f-display); font-stretch: 62%; font-weight: 800; font-size: 22px; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.w-row input[type="range"]:disabled { opacity: .4; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; --p: 50%; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--viz) 0 var(--p), var(--line) var(--p) 100%); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--viz); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--raised); border: 2px solid var(--ink); box-shadow: var(--shadow-1); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--raised); border: 2px solid var(--ink); }
input[type="range"]:focus { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent-text); outline-offset: 2px; }
input[type="range"]:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* Schalter */
.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-row span { display: flex; flex-direction: column; line-height: 1.3; }
.switch-row small { color: var(--ink-3); font-size: 12px; }
.switch { position: relative; width: 40px; height: 24px; flex: none; border-radius: 12px; border: 0; background: var(--line); padding: 0; transition: background .15s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--raised); box-shadow: var(--shadow-1); transition: transform .18s cubic-bezier(.2, .8, .2, 1); }
.switch[aria-checked="true"] { background: var(--viz); }
.switch[aria-checked="true"] i { transform: translateX(16px); }
.switch:disabled { opacity: .5; }

/* ---------- Unter-Tabs ---------- */
.subtabs { position: relative; display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.subtab { border: 0; background: none; padding: 10px 12px; font-weight: 600; font-size: 14px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subtab:hover { color: var(--ink); }
.subtab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.subtab .cnt { font-family: var(--f-mono); font-stretch: 80%; font-size: 10.5px; color: var(--ink-3); margin-left: 5px; }
.subtab:focus-visible { outline-offset: -3px; }   /* .subtabs scrollt und schneidet ab; der Tab ragt 1 px in die Grundlinie */

/* ---------- Leerzustand ---------- */
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- Kennzahlen ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--raised); border: 1px solid var(--line-soft); border-radius: var(--radius-l); overflow: hidden; }
.kpi { position: relative; padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--line-soft); }
.k-lab { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.k-num { font-family: var(--f-display); font-stretch: 62%; font-weight: 800; font-size: 46px; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin-top: 6px; }
.k-num small { font-size: .5em; font-weight: 700; color: var(--ink-3); margin-left: 2px; }
.k-sub { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
.k-sub .i { width: 14px; height: 14px; }
.k-sub.bad { color: var(--bad); }
.k-sub.good { color: var(--good); }
.k-sub.warn { color: var(--warn); }
.k-spark { position: absolute; right: 18px; bottom: 18px; }
@container sheet (max-width: 700px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .k-spark { display: none; }
  .k-num { font-size: 40px; }
}

/* ---------- Hinweise und Kästen ---------- */
.note { margin: 0; padding: 12px 14px; border-radius: 9px; background: var(--sheet); border: 1px dashed var(--line); font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.note p { margin: 0; }
.warn-line { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 13px; color: var(--warn); font-weight: 550; }
.warn-line .i { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.callout { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-size: 13.5px; max-width: 90ch; }
.callout .i { color: var(--accent-text); flex: none; margin-top: 1px; }
.callout.warn { background: var(--warn-soft); }
.callout.warn .i { color: var(--warn); }
.callout.bad { background: var(--bad-soft); }
.callout.bad .i { color: var(--bad); }
.callout.info { background: var(--live-soft); }
.callout.info .i { color: var(--live-text); }
.status-line { margin: 0; font-weight: 550; }
.live-line { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--live-text); font-weight: 600; }
.err-d summary { cursor: pointer; color: var(--bad); font-weight: 600; font-size: 12.5px; }
.err-d p { margin: 6px 0 0; font-size: 12px; }
.grp-head { margin: 18px 0 8px; font-weight: 650; font-size: 14px; }
.grp-head .dim { font-weight: 500; font-size: 12.5px; margin-left: 6px; }

.sec-box { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--raised); }
.det-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 10px; }
.det-grid .pod { padding: 12px 14px; gap: 4px; }
.det-grid small { font-size: 11.5px; line-height: 1.4; }

/* Fortschrittsbalken mit Beschriftung */
.meter { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.meter-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink-3); }
.meter-top b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-bar { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.meter-bar i { display: block; height: 100%; width: var(--v); background: var(--viz); border-radius: 3px; }
.meter.warn .meter-bar i { background: var(--warn-fill); }
.meter.bad .meter-bar i { background: var(--bad-fill); }
.meter-bar.mini { display: block; height: 4px; margin-top: 6px; margin-left: auto; max-width: 120px; }
.meter-bar.mini i { transition: width .4s; }

/* Legende unter Diagrammen */
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend.tight { margin: 0; gap: 4px 12px; }
.panel-head .sub + .legend { margin-top: 8px; }
/* .lg ohne Ton ist wie im Prototyp leer; Bereichs-CSS ergänzt eigene Formen (z. B. Ring, Raute, Linie). */
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lg.viz { background: var(--viz); box-shadow: inset 0 0 0 1.5px var(--viz-line); }
.lg.good { background: var(--good-fill); }
.lg.warn { background: var(--warn-fill); }
.lg.bad { background: var(--bad-fill); }
.lg.live { background: var(--live); }
.lg.judge { background: var(--judge); }

/* Einfache Listen (z. B. in Seitenblättern) */
.list { display: flex; flex-direction: column; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--raised); overflow: hidden; }
.li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 11px 12px; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.li:first-child { border-top: 0; }
.li-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.li-main small { color: var(--ink-3); font-size: 12px; }
.li-side { display: flex; align-items: center; gap: 6px; }
.li-btn { width: 100%; border: 0; background: none; text-align: left; color: var(--ink); cursor: pointer; }
.li-btn:hover { background: var(--sheet); }
.li-btn:focus-visible { outline-offset: -2px; border-radius: 0; }   /* .list schneidet ab (overflow: hidden) */
.li-btn .li-main b { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.li-btn .li-main b .i { width: 16px; height: 16px; color: var(--ink-3); }
.li-btn .li-side .i { width: 16px; height: 16px; color: var(--ink-3); }

/* Schlüssel-Wert-Liste */
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 18px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; min-width: 0; }

/* ---------- Diagramme (ui/charts.js: lineChart, areaChart, barsChart) ---------- */
.chart { position: relative; width: 100%; min-height: 260px; }
.chart.line { min-height: 220px; }
.chart svg, .pch svg { display: block; width: 100%; height: auto; overflow: visible; }
.pch { position: relative; width: 100%; }
.ax { font-family: var(--f-mono); font-stretch: 80%; font-size: 10px; fill: var(--ink-3); }
.ax-t { fill: var(--ink-2); }
.grid-l { stroke: var(--line-soft); stroke-width: 1; }
.axis-l { stroke: var(--line); stroke-width: 1; }
.hit { fill: transparent; }
/* Linie mit Fadenkreuz: .xh/.xd werden per .on eingeblendet */
.ln-path { fill: none; stroke: var(--viz-line); stroke-width: 2.5; stroke-linejoin: round; }
.ln-area { fill: var(--viz); opacity: .22; }
.ln-end { fill: var(--viz); stroke: var(--viz-line); stroke-width: 1.5; }
.xh { stroke: var(--ink-3); stroke-dasharray: 2 3; opacity: 0; pointer-events: none; }
.xd { fill: var(--viz); stroke: var(--viz-line); stroke-width: 2; opacity: 0; pointer-events: none; }
.xh.on, .xd.on { opacity: 1; }
/* Fläche */
.pa-area { fill: var(--viz); opacity: .25; }
.pa-line { fill: none; stroke: var(--viz-line); stroke-width: 2.5; stroke-linejoin: round; }
.pa-end { fill: var(--viz); stroke: var(--viz-line); stroke-width: 1.5; }
/* Gestapelte Balken: Stapel-Klassen über spec.stacks[].cls */
.pb-ok { fill: var(--good-fill); }
.pb-fail { fill: var(--bad-fill); }
.pb-warn { fill: var(--warn-fill); }
.pb-live { fill: var(--live); }
.pb-judge { fill: var(--judge); }
.pb-viz { fill: var(--viz); }
.pch rect:not(.hit):hover { opacity: .72; }
.lg.b-ok { border-radius: 2px; background: var(--good-fill); }
.lg.b-fail { border-radius: 2px; background: var(--bad-fill); }

/* ---------- Tabellen (ui/table.js) ---------- */
/* overflow-x: auto schneidet auch oben ab. Die 4 px Innenabstand (per negativem Außenabstand
   ausgeglichen) halten den Fokusrahmen der Sortierknöpfe in der ersten Zeile sichtbar. */
/* position: relative – Bezugsrahmen für absolut gesetzte Kinder (.sr-only im Tabellenkopf);
   sonst ragen sie aus dem gescrollten Bereich und erzeugen waagerechtes Scrollen der Seite. */
.tbl-wrap { position: relative; overflow-x: auto; min-width: 0; max-width: 100%; padding-top: 4px; margin-top: -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { font-size: 11.5px; font-weight: 500; color: var(--ink-3); text-align: left; padding: 0 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; width: var(--w, auto); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }
.tbl small { font-size: 12px; }
.tbl.doc td { vertical-align: top; }
.tbl.doc td:first-child { white-space: nowrap; }
.tbl tbody tr:is([data-go], [data-action]) { cursor: pointer; }
.tbl tbody tr:is([data-go], [data-action]):hover td { background: var(--sunken); --gapc: var(--sunken); }
.tbl tbody tr:focus-visible { outline-offset: -2px; }   /* ganze Zeile per Tastatur: Rahmen innen, .tbl-wrap schneidet ab */
.sub-row td { background: var(--sheet); font-size: 12.5px; color: var(--ink-2); }
.live-row td { background: color-mix(in oklab, var(--live-soft) 70%, transparent); }
.w-ico { width: 1%; padding-right: 0 !important; }
.ico-pair { display: inline-flex; gap: 2px; }
.ico-space { display: inline-block; width: 28px; }

/* Sortierbarer Spaltenkopf: <th aria-sort="ascending|descending|none"><button class="th-sort">Name</button></th>.
   Der Pfeil sitzt immer im Platz daneben (unsichtbar, solange nicht sortiert), damit nichts springt.
   Steht .th-sort direkt am th (mit aria-sort), funktioniert der Pfeil ebenso. */
button.th-sort { display: inline-flex; align-items: center; border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit; letter-spacing: inherit; white-space: nowrap; cursor: pointer; border-radius: 4px; }
button.th-sort:hover, th.th-sort:hover { color: var(--ink); }
th.th-sort { cursor: pointer; }
.th-sort::after { content: ""; display: inline-block; width: 0; height: 0; margin-left: 5px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; vertical-align: middle; opacity: 0; transition: opacity .12s, transform .12s; }
.th-sort:hover::after { opacity: .4; }
[aria-sort="ascending"] > .th-sort, [aria-sort="descending"] > .th-sort,
th.th-sort[aria-sort="ascending"], th.th-sort[aria-sort="descending"] { color: var(--ink); font-weight: 600; }
[aria-sort="descending"] > .th-sort::after, .th-sort[aria-sort="descending"]::after { opacity: 1; }
[aria-sort="ascending"] > .th-sort::after, .th-sort[aria-sort="ascending"]::after { opacity: 1; transform: rotate(180deg); }

/* Seitenleiste unter der Tabelle: Info „1–25 von 140“ links, „Zeilen je Seite“ und Zurück/Weiter rechts */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--ink-3); }
.pager > :first-child { margin-right: auto; }
.pager-info { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pager label, .pager-size { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.pager select { width: auto; padding: 4px 8px; font-size: 12.5px; border-radius: var(--radius-s); }
.pager-nav { display: inline-flex; align-items: center; gap: 6px; }
.pager .btn { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--radius-s); }

/* ---------- Code-Blöcke ---------- */
.dcode { border-radius: 10px; background: var(--code-bg); color: var(--code-fg); overflow: hidden; border: 1px solid var(--code-line); min-width: 0; }
.dcode-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 6px 5px 14px; border-bottom: 1px solid var(--code-line); font-family: var(--f-mono); font-stretch: 80%; font-size: 11px; color: var(--code-dim); }
.dcode-h .btn { color: var(--code-dim); }
.dcode-h .btn:hover { background: color-mix(in oklab, var(--code-fg) 12%, transparent); color: var(--code-fg); }
.dcode pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--f-mono); font-stretch: 80%; font-size: 12px; line-height: 1.65; white-space: pre; scrollbar-width: thin; }
.dcode pre:focus-visible { outline-offset: -2px; border-radius: 0; }   /* scrollbares pre ist per Tastatur fokussierbar */
.t-key { color: var(--code-key); }
.t-str { color: var(--code-str); }
.t-num { color: var(--code-num); }
.t-kw { color: var(--code-kw); }
.t-com { color: var(--code-dim); font-style: italic; }
