/* Charts (public/ui/viz.js). Colors only through tokens; a series or tone color arrives as --c (set with CSSOM),
   so theme switches restyle every chart without a redraw. Motion: first draw only, none under reduced motion. */

.viz {
  container-type: inline-size;
  display: grid;
  gap: var(--s-3);
  min-width: 0;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.viz-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 28px; }
.viz-title { min-width: 0; color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; }
.viz-actions { display: flex; flex: none; align-items: center; gap: var(--s-2); margin-left: auto; }
.viz-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 var(--s-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--t-micro) var(--ease-move), background-color var(--t-micro) var(--ease-move), border-color var(--t-micro) var(--ease-move);
}
.viz-toggle:hover { background: var(--neutral-soft); color: var(--text); }
.viz-toggle.is-table { border-color: var(--line); background: var(--raised); color: var(--text); }
.viz-body { position: relative; min-width: 0; }
.viz-graphic { display: grid; gap: var(--s-3); min-width: 0; }
.viz-caption { max-width: 72ch; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
/* A chart whose numbers the page already states in prose keeps its caption for assistive technology only. */
.viz-quiet .viz-caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.viz-glyph { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.viz-glyph-dot path { stroke-width: 4; }

/* Canvas and SVG primitives */
.viz-canvas { position: relative; min-width: 0; min-height: var(--h, auto); border-radius: var(--r-sm); touch-action: pan-y; }
.viz-canvas:focus-visible, .viz-donut-wrap:focus-visible, .viz-matrix-grid:focus-visible, .viz-range-grid:focus-visible { outline-offset: 4px; }
.viz-svg { display: block; overflow: visible; max-width: none; }
.viz-svg text { font-family: var(--font-sans); }
.viz-axis-label { fill: var(--chart-axis); font-size: var(--fs-xs); }
.viz-axis-label.is-category { fill: var(--text-2); }
.viz-grid line { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz-grid line.is-zero { stroke: var(--line-strong); }
.viz-line { fill: none; stroke: var(--c); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.viz-area { fill: var(--c); fill-opacity: 0.14; stroke: none; }
.viz-area.is-faint { fill-opacity: 0.06; }
.viz-plot.is-stacked .viz-area { fill-opacity: 0.2; }
.viz-dot { fill: var(--c); }
.viz-end-dot { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.viz-end-label { fill: var(--c); font-size: var(--fs-xs); font-weight: 600; }
.viz-band { fill: var(--c); fill-opacity: 0.1; }
.viz-band-label, .viz-annotation-label { fill: var(--text-3); font-size: var(--fs-xs); }
.viz-annotation-label { fill: var(--text-2); }
.viz-annotation { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 2 3; shape-rendering: crispEdges; }
.viz-cursor line { stroke: var(--chart-cursor); stroke-width: 1; shape-rendering: crispEdges; }
.viz-cursor circle { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.viz-hover { fill: var(--neutral-soft); }
.viz-bar { fill: var(--c); }
.viz-bars.has-highlight .viz-bar:not(.is-highlight) { fill-opacity: 0.38; }
.viz-value-label { fill: var(--text-2); font-size: var(--fs-xs); font-weight: 500; }

.viz-legend { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); margin: 0; padding: 0; color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); list-style: none; }
.viz-legend li { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.viz-swatch { flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }

/* Tooltip (one per page, fixed to the viewport) */
.viz-tip {
  position: fixed;
  top: var(--safe-top);
  left: var(--safe-left);
  z-index: var(--z-toast);
  min-width: 120px;
  max-width: min(320px, calc(100vw - 16px));
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--overlay);
  box-shadow: var(--shadow-overlay);
  color: var(--text);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  transform: translate(var(--tx, 0), var(--ty, 0));
}
.viz-tip-title { margin-bottom: 6px; color: var(--text-3); font-weight: 500; }
.viz-tip-row { display: flex; align-items: center; gap: var(--s-2); }
.viz-tip-row + .viz-tip-row { margin-top: 4px; }
.viz-tip-label { flex: 1; min-width: 0; color: var(--text-2); }
.viz-tip-value { margin-left: var(--s-3); color: var(--text); font-weight: 600; }
.viz-tip-row.is-muted .viz-tip-value, .viz-tip-row.is-muted .viz-tip-label { color: var(--text-3); font-weight: 500; }

/* Honest states use ui.js emptyState({ compact: true }) anatomy (.ui-empty.is-compact, styled in components.css); viz only
   reserves the chart's height and adds the collecting progress cue (steps toward the minimum history). */
.viz-state { min-height: var(--h, 160px); }
.viz-collect-steps { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; width: min(280px, 100%); margin: var(--s-3) auto 0; }
.viz-collect-steps span { height: 6px; border-radius: 2px; background: var(--seq-0); }
.viz-collect-steps .is-done { background: var(--seq-3); }
.viz-collect-bar { width: min(280px, 100%); height: 6px; margin: var(--s-3) auto 0; overflow: hidden; border-radius: var(--r-full); background: var(--seq-0); }
.viz-collect-bar span { display: block; width: var(--p); height: 100%; border-radius: inherit; background: var(--seq-3); }

/* Not-reported series (unknown: true, or tone 'faint'/'unknown'): dashed outlines, never a solid gray mark. */
.viz-bar.is-unknown, .viz-donut-seg.is-unknown { fill: none; stroke: var(--line-input); stroke-width: 1; stroke-dasharray: 3 3; }
.is-unknown > .viz-line { stroke: var(--line-input); stroke-width: 1.5; stroke-dasharray: 3 3; }
.is-unknown > .viz-area { fill: none; }
.is-unknown > :is(.viz-dot, .viz-end-dot) { fill: none; stroke: var(--line-input); }
.viz-swatch.is-unknown { border: 1px dashed var(--line-input); background: none; }

.viz-bounded {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 6px;
  padding: 2px var(--s-2);
  border: 1px solid var(--line-subtle);
  border-radius: var(--r-sm);
  background: var(--info-soft);
  color: var(--text-2);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}
.viz-bounded .viz-glyph { color: var(--info); }

/* Table view */
.viz-table { max-height: 360px; overflow: auto; border: 1px solid var(--line-subtle); border-radius: var(--r-sm); }
.viz-table table { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.viz-table th, .viz-table td { padding: 6px var(--s-3); border-bottom: 1px solid var(--line-subtle); text-align: left; white-space: nowrap; }
.viz-table tbody tr:last-child > * { border-bottom: 0; }
.viz-table thead th { position: sticky; top: 0; z-index: 1; background: var(--raised); color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.viz-table tbody th { color: var(--text); font-weight: 450; }
.viz-table td { color: var(--text-2); }
.viz-table .is-num { text-align: right; }

/* Sparkline and ring (inline marks) */
.viz-spark { display: block; overflow: visible; }
.viz-spark-line { fill: none; stroke: var(--c); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.viz-spark-area { fill: var(--c); fill-opacity: 0.12; }
.viz-spark-dot { fill: var(--c); }
.viz-spark-last { fill: var(--c); stroke: var(--surface); stroke-width: 1.5; }
.viz-spark-none { stroke: var(--line-input); stroke-dasharray: 2 3; }
.viz-ring { display: block; overflow: visible; fill: none; }
.viz-ring-track { stroke: var(--seq-0); }
.viz-ring-track.is-unknown { stroke: var(--line-input); stroke-dasharray: 2 3; }
.viz-ring-value { stroke: var(--c); stroke-linecap: round; }
.viz-ring-text { fill: var(--text); font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Donut */
.viz-donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4) var(--s-8); border-radius: var(--r-sm); }
.viz-donut-svg { flex: none; }
.viz-donut-track { fill: none; stroke: var(--seq-0); }
.viz-donut-seg { fill: var(--c); transition: opacity var(--t-micro) var(--ease-move); }
.viz-donut-svg.has-active .viz-donut-seg:not(.is-active) { opacity: 0.28; }
.viz-donut-value { fill: var(--text); font-size: clamp(15px, calc(var(--size) * 0.13), 30px); font-weight: 600; letter-spacing: -0.02em; }
.viz-donut-label { fill: var(--text-3); font-size: var(--fs-xs); }
.viz-donut-legend { display: grid; flex: 1 1 220px; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 2px var(--s-3); max-width: 420px; margin: 0; padding: 0; font-size: var(--fs-sm); line-height: var(--lh-sm); list-style: none; }
.viz-donut-legend li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; margin: 0; padding: 4px var(--s-2); border-radius: var(--r-xs); }
.viz-donut-legend li.is-active { background: var(--neutral-soft); }
.viz-donut-name { overflow: hidden; color: var(--text-2); text-overflow: ellipsis; white-space: nowrap; }
.viz-donut-num { color: var(--text); font-weight: 600; text-align: right; }
.viz-donut-share { min-width: 5ch; color: var(--text-3); text-align: right; }

/* Gauge */
.viz-gauge-wrap { display: grid; justify-items: center; gap: var(--s-1); }
.viz-gauge-svg { overflow: visible; fill: none; }
.viz-gauge-ticks line { stroke: var(--line); stroke-width: 1; stroke-linecap: round; }
.viz-gauge-ticks line.is-major { stroke: var(--text-3); }
.viz-gauge-track { stroke: var(--seq-0); stroke-linecap: round; }
.viz-gauge-track.is-unknown { stroke: var(--line-input); stroke-dasharray: 2 5; stroke-width: 2; }
.viz-gauge-value { stroke: var(--c); stroke-linecap: round; }
.viz-gauge-number { fill: var(--text); font-size: clamp(18px, calc(var(--size) * 0.16), 40px); font-weight: 600; letter-spacing: -0.03em; }
.viz-gauge-caption { fill: var(--text-3); font-size: var(--fs-xs); }
.viz-gauge-label { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); text-align: center; }

/* Bullet */
.viz-bullet-wrap { display: grid; gap: var(--s-2); }
.viz-bullet-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.viz-bullet-label { color: var(--text-2); }
.viz-bullet-value { color: var(--text); font-weight: 600; white-space: nowrap; }
.viz-bullet-value.is-over { color: var(--danger); }
.viz-bullet-value.is-unknown { color: var(--text-3); font-weight: 500; }
.viz-bullet-track { position: relative; height: 12px; border-radius: var(--r-xs); background: var(--seq-0); }
.viz-bullet-track.is-unknown { border: 1px dashed var(--line-input); background: none; }
.viz-bullet-range, .viz-bullet-bar { position: absolute; top: 0; bottom: 0; }
.viz-bullet-range { left: var(--l); width: var(--w); background: color-mix(in srgb, var(--c) 16%, transparent); }
.viz-bullet-bar { left: 0; width: var(--w); top: 3px; bottom: 3px; border-radius: 0 3px 3px 0; background: var(--c); }
.viz-bullet-mark { position: absolute; top: -4px; bottom: -4px; left: var(--x); width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text); }
.viz-bullet-marks { position: relative; height: var(--lh-xs); color: var(--text-3); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.viz-bullet-marks.is-two-rows { height: calc(var(--lh-xs) * 2); }
.viz-bullet-marks span { position: absolute; top: 0; left: var(--x); white-space: nowrap; transform: translateX(-50%); }
.viz-bullet-marks span[data-row="1"] { top: var(--lh-xs); }
.viz-bullet-marks span[data-align="end"] { transform: translateX(-100%); }
.viz-bullet-marks span[data-align="start"] { transform: none; }

/* Heatmap */
.viz-heat-cell { fill: var(--seq-0); }
.viz-heat-cell.l1, .viz-heat-swatch.l1 { fill: var(--seq-1); background: var(--seq-1); }
.viz-heat-cell.l2, .viz-heat-swatch.l2 { fill: var(--seq-2); background: var(--seq-2); }
.viz-heat-cell.l3, .viz-heat-swatch.l3 { fill: var(--seq-3); background: var(--seq-3); }
.viz-heat-cell.l4, .viz-heat-swatch.l4 { fill: var(--seq-4); background: var(--seq-4); }
.viz-heat-cell.is-none { fill: none; stroke: var(--line-input); stroke-width: 1; stroke-dasharray: 2 2; }
.viz-heat-cursor { fill: none; stroke: var(--text); stroke-width: 1.5; pointer-events: none; }
.viz-heat-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--text-3); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.viz-heat-legend > span:not(.viz-heat-swatch) { margin: 0 4px; }
.viz-heat-swatch { width: 12px; height: 12px; border-radius: 2.5px; background: var(--seq-0); }
.viz-heat-swatch.is-none { margin-left: var(--s-3); border: 1px dashed var(--line-input); background: none; }

/* Matrix */
.viz-matrix-scroll { overflow-x: auto; }
.viz-matrix-grid {
  display: grid;
  grid-template-columns: minmax(120px, max-content) repeat(var(--cols), minmax(36px, 1fr));
  gap: 4px;
  align-items: center;
  min-width: min-content;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}
.viz-matrix-col { padding: 0 var(--s-2) var(--s-1); overflow: hidden; color: var(--text-3); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.viz-matrix-row { padding-right: var(--s-3); overflow: hidden; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); text-overflow: ellipsis; white-space: nowrap; }
.viz-mcell {
  --c: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  min-width: 0;
  padding: 0 var(--s-2);
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: var(--neutral-soft);
  color: var(--c);
}
.viz-mcell[data-tone="ok"] { --c: var(--ok); background: var(--ok-soft); }
.viz-mcell[data-tone="warn"] { --c: var(--warn); background: var(--warn-soft); }
.viz-mcell[data-tone="danger"] { --c: var(--danger); background: var(--danger-soft); }
.viz-mcell[data-tone="info"] { --c: var(--info); background: var(--info-soft); }
.viz-mcell[data-tone="accent"] { --c: var(--accent); background: var(--accent-soft); }
.viz-mcell[data-tone="none"] { border: 1px dashed var(--line-input); background: none; }
.viz-mcell.is-active { border-color: var(--c); }
.viz-mcell[data-tone="none"].is-active { border-color: var(--text-3); }
.viz-mcell-text { overflow: hidden; color: var(--text-2); text-overflow: ellipsis; white-space: nowrap; }
@container (max-width: 640px) {
  .viz-mcell { justify-content: center; padding: 0; }
  .viz-mcell-text { display: none; }
  .viz-matrix-col { padding: 0 0 var(--s-1); text-align: center; }
}

/* Swimlane */
.viz-lane-dot { fill: var(--c); }
.viz-lane-track { stroke: var(--line-subtle); stroke-width: 1; shape-rendering: crispEdges; }
.viz-event { fill: var(--c); stroke: var(--surface); stroke-width: 1.5; }
.viz-event-cursor { fill: none; stroke: var(--text); stroke-width: 1.5; pointer-events: none; }

/* Flow (workflow pipeline). Left-aligned steps up to 240px apart when there is room; a vertical list in narrow containers.
   Color comes from data-tone (status.js statusTone, the same map as status pills); the border style is the second cue. */
.viz-flow-list {
  --node: 32px;
  --flow-gap: var(--s-4);
  display: grid;
  grid-auto-columns: minmax(0, 240px);
  grid-auto-flow: column;
  justify-content: start;
  gap: var(--flow-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.viz-flow-list.has-marks { --node: 40px; }
.viz-flow-step { --c: var(--text-3); --soft: var(--neutral-soft); position: relative; display: grid; align-content: start; gap: var(--s-2); min-width: 0; margin: 0; }
.viz-flow-step[data-tone="ok"] { --c: var(--ok); --soft: var(--ok-soft); }
.viz-flow-step[data-tone="info"] { --c: var(--info); --soft: var(--info-soft); }
.viz-flow-step[data-tone="warn"] { --c: var(--warn); --soft: var(--warn-soft); }
.viz-flow-step[data-tone="danger"] { --c: var(--danger); --soft: var(--danger-soft); }
.viz-flow-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: calc(var(--node) / 2);
  left: calc(var(--node) + 6px);
  right: calc(6px - var(--flow-gap));
  border-top: 1.5px dashed var(--line-input);
}
.viz-flow-step[data-status="succeeded"]:not(:last-child)::after { border-top-style: solid; border-color: var(--text-3); }
.viz-flow-node {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--node);
  height: var(--node);
  border: 1.5px solid var(--c);
  border-radius: var(--r-full);
  background: var(--soft);
  color: var(--c);
}
.viz-flow-step:is([data-status="pending"], [data-status="queued"], [data-status="awaiting_approval"], [data-status="skipped"]) .viz-flow-node { border-style: dashed; }
.viz-flow-step:is([data-status="pending"], [data-status="queued"], [data-status="skipped"]) .viz-flow-node { background: var(--surface); }
.viz-flow-step[data-status="skipped"] .viz-flow-node { border-color: var(--line-input); }
.viz-flow-step[data-status="running"] .viz-flow-node { border-color: color-mix(in srgb, var(--c) 35%, transparent); }
.viz-flow-step[data-status="running"] .viz-flow-node::after {
  content: "";
  position: absolute;
  inset: -1.5px;
  border: 1.5px solid transparent;
  border-top-color: var(--c);
  border-radius: inherit;
}
.viz-flow-node.has-mark { background: var(--surface); }
.viz-flow-mark { display: grid; place-items: center; width: 28px; height: 28px; overflow: hidden; border-radius: var(--r-full); }
.viz-flow-mark > * { max-width: 28px; max-height: 28px; }
.viz-flow-step:is([data-status="skipped"], [data-status="cancelled"], [data-status="pending"], [data-status="queued"]) .viz-flow-mark { opacity: 0.55; filter: grayscale(1); }
.viz-flow-badge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface);
  border-radius: var(--r-full);
  background: var(--c);
  color: var(--surface);
}
.viz-flow-badge .viz-glyph { stroke-width: 2.2; }
.viz-flow-text { display: grid; gap: 2px; min-width: 0; }
.viz-flow-label { overflow: hidden; color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.viz-flow-step:is([data-status="skipped"], [data-status="cancelled"]) .viz-flow-label { color: var(--text-3); }
.viz-flow-step[data-status="skipped"] .viz-flow-label { text-decoration: line-through; text-decoration-color: var(--line-input); }
.viz-flow-sub { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-3); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.viz-flow-sub > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-flow-dot { flex: none; width: 6px; height: 6px; border-radius: var(--r-full); background: var(--c); }
.viz-flow-status { color: var(--c); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; }
@container (max-width: 640px) {
  .viz-flow-list { grid-auto-flow: row; gap: var(--s-3); }
  .viz-flow-step { grid-template-columns: var(--node) minmax(0, 1fr); column-gap: var(--s-3); }
  .viz-flow-step:not(:last-child)::after {
    top: calc(var(--node) + 4px);
    bottom: calc(4px - var(--s-3));
    left: calc(var(--node) / 2 - 0.75px);
    right: auto;
    border-top: 0;
    border-left: 1.5px dashed var(--line-input);
  }
  .viz-flow-step[data-status="succeeded"]:not(:last-child)::after { border-left-style: solid; border-color: var(--text-3); }
  .viz-flow-text { padding-top: calc(var(--node) / 2 - 10px); }
  .viz-flow-label { white-space: normal; }
}

/* Range bars */
.viz-range-grid { display: grid; grid-template-columns: minmax(0, max-content) minmax(96px, 1fr) max-content; column-gap: var(--s-4); border-radius: var(--r-sm); }
.viz-range-row, .viz-range-axis { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; }
.viz-range-row { min-height: 40px; padding: 0 var(--s-2); border-radius: var(--r-xs); }
.viz-range-row.is-active { background: var(--neutral-soft); }
.viz-range-label { overflow: hidden; max-width: 200px; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); text-overflow: ellipsis; white-space: nowrap; }
.viz-range-track { position: relative; height: 16px; }
.viz-range-track::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; border-top: 1px solid var(--line-subtle); }
.viz-range-track.is-unknown::before { border-top-style: dashed; border-color: var(--line-input); }
.viz-range-span { position: absolute; top: 4px; bottom: 4px; left: var(--l); right: calc(100% - var(--r)); min-width: 2px; border-radius: var(--r-full); background: color-mix(in srgb, var(--chart-1) 32%, transparent); }
.viz-range-mid { position: absolute; top: 0; bottom: 0; left: var(--x); width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--chart-1); box-shadow: 0 0 0 2px var(--surface); }
.viz-range-values { display: grid; justify-items: end; line-height: var(--lh-xs); }
.viz-range-main { color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; }
.viz-range-sub { color: var(--text-3); font-size: var(--fs-xs); }
.viz-range-axis { padding: var(--s-1) var(--s-2) 0; }
.viz-range-ticks { position: relative; height: var(--lh-xs); border-top: 1px solid var(--line); color: var(--chart-axis); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.viz-range-ticks span { position: absolute; top: 4px; left: var(--x); white-space: nowrap; transform: translateX(-50%); }
.viz-range-ticks span[data-align="start"] { transform: none; }
.viz-range-ticks span[data-align="end"] { transform: translateX(-100%); }
@media print {
  .viz-range-ticks span:not([data-end]) { display: none; }
  /* Paper: no table toggles, no help buttons or period controls; charts keep their ink and never split across pages. */
  .viz-toggle, .ui-stat-help, .value-toolbar, .page-heading .ui-heading-action { display: none !important; }
  .viz, .ui-stat, .ui-panel { break-inside: avoid; }
  .viz, .viz * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .viz-svg { max-width: 100%; height: auto; }
}

/* Orbit: the overview signature. SVG draws the dial, spokes, rings and arcs; HTML carries marks, labels and focus. */
/* min(size, 100%): the orbit keeps a real width when its parent shrinks to fit (the figure is a size container). */
.viz-orbit { min-width: min(var(--size, 480px), 100%); }
.viz-orbit-wrap { display: grid; justify-items: center; padding-block: var(--s-2) var(--s-4); }
.viz-orbit-stage {
  container-type: inline-size;
  position: relative;
  width: 100%;
  max-width: var(--size, 480px);
  aspect-ratio: 1;
}
.viz-orbit-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; }
.viz-orbit-dial { stroke: var(--line); stroke-width: 1; }
.viz-orbit-inner { stroke: var(--line-subtle); stroke-width: 1; stroke-dasharray: 1 4; stroke-linecap: round; }
.viz-orbit-ticks line { stroke: var(--line); stroke-width: 1; stroke-linecap: round; }
.viz-orbit-ticks line.is-major { stroke: var(--line-strong); }
.viz-orbit-spoke { stroke: var(--line-strong); stroke-width: 1; transition: stroke var(--t-micro) var(--ease-move); }
.viz-orbit-n[data-state="disconnected"] .viz-orbit-spoke { stroke-dasharray: 1 3.5; stroke-linecap: round; }
.viz-orbit-n[data-state="closed"] .viz-orbit-spoke { stroke: var(--line-subtle); }
.viz-orbit-n.is-hot .viz-orbit-spoke { stroke: var(--c); }
.viz-orbit-track { stroke: var(--line-subtle); stroke-width: 2; }
.viz-orbit-activity { stroke: var(--c); stroke-width: 2.5; stroke-linecap: round; }
.viz-orbit-ring { stroke: var(--c); stroke-width: 2; fill: color-mix(in srgb, var(--c) 10%, transparent); transition: stroke-width var(--t-micro) var(--ease-move); }
.viz-orbit-n[data-state="attention"] .viz-orbit-ring { stroke: var(--warn); stroke-dasharray: 5 3.5; fill: var(--warn-soft); }
.viz-orbit-n:is([data-state="inactive"], [data-state="reconnect"]) .viz-orbit-ring { stroke: color-mix(in srgb, var(--warn) 50%, transparent); fill: var(--warn-soft); }
.viz-orbit-n[data-state="disconnected"] .viz-orbit-ring { stroke: var(--text-3); stroke-width: 1.5; stroke-dasharray: 0.5 4; stroke-linecap: round; fill: none; }
.viz-orbit-n[data-state="closed"] .viz-orbit-ring { stroke: var(--line); stroke-width: 1; fill: none; }
.viz-orbit-n.is-hot .viz-orbit-ring { stroke-width: 2.75; }
.viz-orbit-pulse { fill: var(--c); opacity: 0; }

.viz-orbit-center {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  width: 25%;
  aspect-ratio: 1;
  padding: var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--raised);
  box-shadow: var(--shadow-panel);
  text-align: center;
  transform: translate(-50%, -50%);
}
.viz-orbit-center-mark { display: grid; place-items: center; margin-bottom: 4px; }
.viz-orbit-center-label { display: -webkit-box; max-width: 100%; overflow: hidden; color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; overflow-wrap: break-word; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
@container (max-width: 420px) {
  .viz-orbit-center-label { font-size: var(--fs-xs); line-height: var(--lh-xs); }
}
/* The center mark stays down to a 380px stage (280px when there is no sublabel); below that the label alone carries it. */
@container (max-width: 379px) {
  .viz-orbit-center:has(.viz-orbit-center-sub) .viz-orbit-center-mark { display: none; }
}
@container (max-width: 279px) {
  .viz-orbit-center-mark { display: none; }
}
.viz-orbit-center-sub { color: var(--text-3); font-size: var(--fs-xs); line-height: var(--lh-xs); white-space: nowrap; }

.viz-orbit-node {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: 12.5%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: var(--r-full);
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: default;
  transform: translate(-50%, -50%);
}
a.viz-orbit-node, button.viz-orbit-node { cursor: pointer; }
a.viz-orbit-node:hover { text-decoration: none; }
.viz-orbit-node:focus-visible { outline: none; }
.viz-orbit-disc {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: var(--r-full);
  background: var(--raised);
  transition: transform var(--t-micro) var(--ease-move);
}
.viz-orbit-node:focus-visible .viz-orbit-disc { outline: 2px solid var(--focus); outline-offset: 9px; }
:is(a, button).viz-orbit-node:hover .viz-orbit-disc { transform: scale(1.05); }
.viz-orbit-node:is([data-state="disconnected"], [data-state="closed"]) .viz-orbit-disc > * { opacity: 0.45; filter: grayscale(1); }
.viz-orbit-node[data-state="closed"] .viz-orbit-disc { background: none; }
.viz-orbit-dot { width: 10px; height: 10px; border-radius: var(--r-full); background: var(--c); }
.viz-orbit-badge {
  position: absolute;
  top: -6%;
  right: -10%;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid var(--surface);
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  line-height: 1;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.viz-orbit-name {
  position: absolute;
  left: 50%;
  display: grid;
  justify-items: center;
  width: max-content;
  max-width: 140px;
  text-align: center;
  transform: translateX(-50%);
}
.viz-orbit-name[data-place="below"] { top: calc(100% + 10px); }
.viz-orbit-name[data-place="above"] { bottom: calc(100% + 10px); }
.viz-orbit-name[data-out="right"] { left: 0; justify-items: start; text-align: start; transform: none; }
.viz-orbit-name[data-out="left"] { left: auto; right: 0; justify-items: end; text-align: end; transform: none; }
.viz-orbit-title { color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; }
.viz-orbit-state { color: var(--text-3); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.viz-orbit-node[data-state="attention"] .viz-orbit-state { color: var(--warn); }
.viz-orbit-node:is([data-state="disconnected"], [data-state="closed"]) .viz-orbit-title { color: var(--text-2); }

.viz-orbit-compact { display: none; width: 100%; }
.viz-orbit-compact-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding: 0 var(--s-1) var(--s-2); border-bottom: 1px solid var(--line-subtle); }
.viz-orbit-list { margin: 0; padding: 0; list-style: none; }
.viz-orbit-list li { margin: 0; border-bottom: 1px solid var(--line-subtle); }
.viz-orbit-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 56px;
  padding: var(--s-2) var(--s-1);
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
}
a.viz-orbit-item:hover { text-decoration: none; }
:is(a, button).viz-orbit-item { cursor: pointer; }
:is(a, button).viz-orbit-item:hover { background: var(--neutral-soft); }
.viz-orbit-item .viz-orbit-disc { width: 36px; height: 36px; box-shadow: inset 0 0 0 1.5px var(--c); }
.viz-orbit-item[data-state="attention"] .viz-orbit-disc { box-shadow: inset 0 0 0 1.5px var(--warn); }
.viz-orbit-item:is([data-state="inactive"], [data-state="reconnect"]) .viz-orbit-disc { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--warn) 50%, transparent); }
.viz-orbit-item:is([data-state="disconnected"], [data-state="closed"]) .viz-orbit-disc { box-shadow: inset 0 0 0 1px var(--line-strong); }
.viz-orbit-item:is([data-state="disconnected"], [data-state="closed"]) .viz-orbit-disc > * { opacity: 0.45; filter: grayscale(1); }
.viz-orbit-item-text { display: grid; min-width: 0; }
.viz-orbit-item-text > .viz-orbit-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-orbit-item-text > .viz-orbit-state { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.viz-orbit-item[data-state="attention"] .viz-orbit-state { color: var(--warn); }
.viz-orbit-activity-cell { display: flex; align-items: center; gap: var(--s-2); margin-top: 4px; }
.viz-orbit-meter-value { color: var(--text-2); font-size: var(--fs-xs); line-height: 1; font-variant-numeric: tabular-nums; }
.viz-orbit-meter { width: 40px; height: 4px; overflow: hidden; border-radius: var(--r-full); background: var(--seq-0); }
.viz-orbit-meter span { display: block; width: var(--p); height: 100%; background: var(--c); }
.viz-orbit-item .viz-orbit-badge { position: static; border: 0; }
@media (max-width: 479px) {
  .viz-orbit-stage { display: none; }
  .viz-orbit-compact { display: block; }
}
@media (pointer: coarse) {
  .viz-toggle { height: 44px; }
}

/* Motion: first draw only (viz.js adds .viz-enter once), nothing under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .viz-enter :not(.is-unknown) > .viz-line { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: viz-draw var(--t-long) var(--ease-enter) forwards; }
  .viz-enter .is-unknown > .viz-line { animation: viz-fade var(--t-long) var(--ease-enter) both; }
  .viz-enter :is(.viz-area, .viz-dot, .viz-end-dot, .viz-end-label, .viz-value-label, .viz-heat-cell, .viz-event) { animation: viz-fade var(--t-long) var(--ease-enter) both; }
  .viz-enter .viz-bar { transform-box: fill-box; transform-origin: 50% 100%; animation: viz-grow-y var(--t-medium) var(--ease-enter) both; }
  .viz-enter .viz-bar.is-negative { transform-origin: 50% 0; }
  .viz-enter .viz-bar.is-horizontal { transform-origin: 0 50%; animation-name: viz-grow-x; }
  .viz-enter .viz-bar.is-horizontal.is-negative { transform-origin: 100% 50%; }
  .viz-enter .viz-donut-seg { transform-box: view-box; transform-origin: 50% 50%; animation: viz-spin-in var(--t-long) var(--ease-enter) both; }
  .viz-enter :is(.viz-gauge-value, .viz-ring-value) { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: viz-draw var(--t-long) var(--ease-enter) forwards; }
  .viz-enter :is(.viz-bullet-bar, .viz-range-span) { transform-origin: 0 50%; animation: viz-grow-x var(--t-medium) var(--ease-enter) both; }
  .viz-enter :is(.viz-flow-step, .viz-range-row, .viz-mcell) { animation: viz-fade var(--t-medium) var(--ease-enter) both; }
  .viz-enter .viz-flow-step { animation-delay: calc(var(--i) * 40ms); }
  .viz-enter .viz-orbit-node, .viz-enter .viz-orbit-center { animation: viz-pop var(--t-long) var(--ease-enter) both; animation-delay: calc(var(--i, 0) * 50ms); }
  .viz-enter .viz-orbit-n { animation: viz-fade var(--t-long) var(--ease-enter) both; animation-delay: calc(var(--i) * 50ms); }
  .viz-orbit-pulse { animation: viz-pulse var(--dur) linear var(--delay) infinite; }
  .viz-flow-step[data-status="running"] .viz-flow-node::after { animation: viz-turn 1.1s linear infinite; }
}
@keyframes viz-draw { to { stroke-dashoffset: 0; } }
@keyframes viz-fade { from { opacity: 0; } }
@keyframes viz-grow-y { from { transform: scaleY(0); } }
@keyframes viz-grow-x { from { transform: scaleX(0); } }
@keyframes viz-spin-in { from { opacity: 0; transform: rotate(-24deg) scale(0.94); } }
@keyframes viz-pop { from { opacity: 0; translate: 0 6px; } }
@keyframes viz-turn { to { transform: rotate(1turn); } }
@keyframes viz-pulse {
  0% { opacity: 0; transform: translate(0, 0); }
  15% { opacity: 0.9; }
  80% { opacity: 0.9; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)); }
}

@media (forced-colors: active) {
  .viz-line, .viz-spark-line { stroke: CanvasText; }
  .viz-bar, .viz-donut-seg, .viz-heat-cell:not(.is-none) { fill: CanvasText; }
}
