/* Shared chart styles for countBars(), lanePlot(), svgBars(), ecdfPlot() and scatterPlot() in
   charts.mjs. */
.chart-bars {
  display: grid;
  gap: 0.35rem;
}
.chart-bar-row {
  display: grid;
  width: 100%;
  min-height: 2.6rem;
  grid-template-columns: minmax(14rem, 28rem) minmax(5rem, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.35rem 0.5rem;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.95rem;
  text-align: start;
  cursor: pointer;
}
.chart-bar-row:hover {
  background: var(--surface-1);
}
.chart-bar-row.is-selected {
  outline: 2px solid var(--color-loom-500);
  outline-offset: -2px;
  background: var(--surface-1);
}
.chart-bar-row:focus-visible {
  outline: 2px solid var(--color-loom-500);
  outline-offset: 2px;
}
.chart-bar-label {
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.chart-bar-track {
  display: block;
  height: 1rem;
  overflow: hidden;
  border-radius: var(--radius-control);
  background: var(--surface-2);
}
.chart-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-loom-600);
}
.chart-bar-row-unknown .chart-bar-fill {
  border: 1px solid var(--text-secondary);
  background: repeating-linear-gradient(
    135deg,
    var(--text-secondary) 0 5px,
    var(--surface-2) 5px 10px
  );
}
.chart-bar-count {
  min-width: 5.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  text-align: end;
}
.chart-empty {
  color: var(--text-secondary);
  padding: 1.2rem;
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-control);
}
.chart-lane-plot {
  display: block;
  width: 100%;
  min-width: 680px;
  font: 13px var(--font-sans);
}
.chart-lane-plot text {
  fill: var(--text-primary);
}
.chart-lane-plot .axis,
.chart-lane-plot .grid {
  stroke: var(--border-default);
}
.chart-lane-plot .grid {
  stroke-dasharray: 2 4;
}
.chart-lane-plot .point {
  fill: var(--color-loom-600);
  stroke: var(--surface-0);
  stroke-width: 1.5;
  cursor: pointer;
}
.chart-lane-plot .point:focus {
  stroke: var(--text-primary);
  stroke-width: 3;
  outline: none;
}
.chart-lane-plot .lane {
  stroke: var(--border-default);
}
/* Tone classes name colour tokens; every chart pairs them with a pattern, dash or label. */
.chart-svg-bars,
.chart-ecdf {
  display: block;
  width: 100%;
  max-width: 40rem;
  height: auto;
  font: 15px var(--font-sans);
}
.chart-svg-bars text,
.chart-ecdf text {
  fill: var(--text-primary);
}
.chart-bars-heading {
  font-weight: 600;
}
.chart-bars-value {
  fill: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.chart-svg-bars .chart-bars-track {
  fill: var(--surface-2);
}
.chart-svg-bars .chart-bars-hit {
  fill: transparent;
  pointer-events: all;
}
.chart-svg-bars .bar-solid.tone-primary {
  fill: var(--color-loom-600);
}
.chart-svg-bars .bar-solid.tone-human {
  fill: var(--color-org-human);
}
.chart-svg-bars .bar-solid.tone-mouse {
  fill: var(--color-org-mouse);
}
.chart-svg-bars .bar-solid.tone-muted {
  fill: var(--text-secondary);
}
.chart-svg-bars .bar-hatch,
.chart-svg-bars .bar-outline {
  stroke-width: 1.5;
}
.chart-svg-bars .bar-outline {
  fill: var(--surface-0);
}
.chart-svg-bars .bar-hatch.tone-primary,
.chart-svg-bars .bar-outline.tone-primary {
  stroke: var(--color-loom-600);
}
.chart-svg-bars .bar-hatch.tone-human,
.chart-svg-bars .bar-outline.tone-human {
  stroke: var(--color-org-human);
}
.chart-svg-bars .bar-hatch.tone-mouse,
.chart-svg-bars .bar-outline.tone-mouse {
  stroke: var(--color-org-mouse);
}
.chart-svg-bars .bar-hatch.tone-muted,
.chart-svg-bars .bar-outline.tone-muted {
  stroke: var(--text-secondary);
}
.chart-svg-bars .hatch-line {
  stroke: var(--text-secondary);
  stroke-width: 3;
}
/* Red marks an error state only, such as a source with no usable date. */
.chart-svg-bars .bar-hatch.tone-error {
  stroke: var(--color-error);
}
.chart-svg-bars .hatch-line.hatch-error {
  stroke: var(--color-error);
}
.chart-svg-bars .chart-bars-detail {
  fill: var(--text-secondary);
  font-size: 13px;
}
.chart-svg-bars .chart-bars-detail.tone-error {
  fill: var(--color-error);
}
.chart-svg-bar.is-selectable {
  cursor: pointer;
}
.chart-svg-bar.is-selectable:hover .chart-bars-track {
  fill: var(--surface-3);
}
.chart-svg-bar:focus {
  outline: none;
}
.chart-svg-bar:focus-visible .chart-bars-track,
.chart-svg-bar.is-selected .chart-bars-track {
  stroke: var(--text-primary);
  stroke-width: 2;
}
.chart-svg-bar.is-selected .chart-bars-label {
  font-weight: 700;
  text-decoration: underline;
}
.chart-ecdf .grid,
.chart-ecdf .axis {
  stroke: var(--border-default);
}
.chart-ecdf .grid {
  stroke-dasharray: 2 4;
}
.chart-ecdf .ecdf-line {
  fill: none;
  stroke-width: 2.5;
}
.chart-ecdf .tone-primary {
  stroke: var(--color-loom-600);
}
.chart-ecdf .tone-human {
  stroke: var(--color-org-human);
}
.chart-ecdf .tone-mouse {
  stroke: var(--color-org-mouse);
}
.chart-ecdf .tone-other {
  stroke: var(--text-secondary);
}
.chart-ecdf .ecdf-vertex {
  fill: var(--surface-0);
  stroke-width: 1.5;
}
.chart-ecdf .ecdf-vertex:focus {
  outline: none;
  stroke: var(--text-primary);
  stroke-width: 3;
  r: 6px;
}
.chart-threshold {
  display: block;
  width: 100%;
  max-width: 40rem;
  height: auto;
  font: 13px var(--font-sans);
}
.chart-threshold text {
  fill: var(--text-primary);
}
.chart-threshold .grid,
.chart-threshold .axis {
  stroke: var(--border-default);
}
.chart-threshold .grid {
  stroke-dasharray: 2 4;
}
.chart-threshold .threshold-line {
  fill: none;
  stroke: var(--color-loom-600);
  stroke-width: 2.5;
}
.chart-threshold .threshold-point {
  fill: var(--surface-0);
  stroke: var(--color-loom-600);
  stroke-width: 1.5;
  cursor: pointer;
}
.chart-threshold .threshold-point:focus {
  outline: none;
  stroke: var(--text-primary);
  stroke-width: 3;
}
.chart-threshold .threshold-rule {
  stroke: var(--text-primary);
  stroke-width: 1.5;
}
.chart-threshold .threshold-diamond {
  fill: var(--text-primary);
  stroke: var(--surface-0);
  stroke-width: 1.5;
}
.chart-threshold .threshold-label {
  font-weight: 700;
}
.chart-lane-plot .point.is-out {
  opacity: 0.3;
}
.chart-lane-plot .point.is-linked {
  stroke: var(--text-primary);
  stroke-width: 3;
}
.chart-scatter {
  display: block;
  width: 100%;
  max-width: 32rem;
  height: auto;
  font: 11px var(--font-sans);
}
.chart-scatter text {
  fill: var(--text-primary);
}
.chart-scatter .grid,
.chart-scatter .axis {
  stroke: var(--border-default);
}
.chart-scatter .grid {
  stroke-dasharray: 2 4;
}
.chart-scatter .scatter-rule {
  stroke: var(--text-primary);
  stroke-width: 1.25;
}
.chart-scatter .scatter-rule-label {
  font-weight: 700;
}
.chart-scatter .point {
  fill: var(--color-loom-600);
  fill-opacity: 0.3;
  stroke: none;
  cursor: pointer;
}
.chart-scatter .point.band-highly {
  fill-opacity: 0.6;
}
.chart-scatter .point:focus {
  outline: none;
  fill-opacity: 1;
  stroke: var(--text-primary);
  stroke-width: 2;
}
.chart-scatter .point.is-picked {
  fill: var(--text-primary);
  fill-opacity: 1;
  stroke: var(--surface-0);
  stroke-width: 1.5;
}
@media (max-width: 1050px) {
  .chart-bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem 0.7rem;
  }
  .chart-bar-label {
    grid-column: 1 / -1;
  }
  .chart-bar-track {
    grid-column: 1;
    grid-row: 2;
  }
  .chart-bar-count {
    grid-column: 2;
    grid-row: 2;
  }
}
/* Windows high contrast replaces backgrounds with Canvas, which would erase the bar fills. */
@media (forced-colors: active) {
  .chart-bar-track {
    border: 1px solid CanvasText;
  }
  .chart-bar-fill {
    forced-color-adjust: none;
    background: CanvasText;
  }
  .chart-bar-row-unknown .chart-bar-fill {
    background: repeating-linear-gradient(135deg, CanvasText 0 5px, Canvas 5px 10px);
  }
  .chart-bar-row.is-selected,
  .chart-bar-row:focus-visible {
    outline-color: Highlight;
  }
  .chart-lane-plot text {
    fill: CanvasText;
  }
  .chart-lane-plot .axis,
  .chart-lane-plot .grid,
  .chart-lane-plot .lane {
    stroke: GrayText;
  }
  .chart-lane-plot .point {
    fill: CanvasText;
    stroke: Canvas;
  }
  .chart-lane-plot .point:focus,
  .chart-lane-plot .point.is-linked {
    stroke: Highlight;
  }
  .chart-svg-bars text,
  .chart-ecdf text {
    fill: CanvasText;
  }
  .chart-svg-bars .chart-bars-track {
    fill: Canvas;
    stroke: GrayText;
  }
  /* Two classes on the fill match the specificity of the tone rules above, so these win. */
  .chart-svg-bars .chart-bars-fill[class*='tone-'] {
    forced-color-adjust: none;
    stroke: CanvasText;
  }
  .chart-svg-bars .chart-bars-fill.bar-solid {
    fill: CanvasText;
  }
  .chart-svg-bars .bar-outline {
    fill: Canvas;
  }
  .chart-svg-bars .hatch-line,
  .chart-svg-bars .hatch-line.hatch-error {
    stroke: CanvasText;
  }
  .chart-svg-bars .chart-bars-detail,
  .chart-svg-bars .chart-bars-detail.tone-error {
    fill: CanvasText;
  }
  .chart-svg-bar:focus-visible .chart-bars-track,
  .chart-svg-bar.is-selected .chart-bars-track {
    stroke: Highlight;
  }
  .chart-ecdf .ecdf-line,
  .chart-ecdf .ecdf-vertex {
    stroke: CanvasText;
  }
  .chart-ecdf .ecdf-vertex:focus {
    stroke: Highlight;
  }
  .chart-ecdf .grid,
  .chart-ecdf .axis {
    stroke: GrayText;
  }
  .chart-threshold text {
    fill: CanvasText;
  }
  .chart-threshold .grid,
  .chart-threshold .axis {
    stroke: GrayText;
  }
  .chart-threshold .threshold-line,
  .chart-threshold .threshold-rule,
  .chart-threshold .threshold-point {
    stroke: CanvasText;
  }
  .chart-threshold .threshold-point {
    fill: Canvas;
  }
  .chart-threshold .threshold-diamond {
    forced-color-adjust: none;
    fill: CanvasText;
    stroke: Canvas;
  }
  .chart-threshold .threshold-point:focus {
    stroke: Highlight;
  }
}
@media (prefers-reduced-motion: reduce) {
  .chart-bar-row,
  .chart-bar-fill,
  .chart-lane-plot .point,
  .chart-svg-bar,
  .chart-ecdf .ecdf-vertex {
    transition: none;
    animation: none;
  }
}
/* Stacked bars (stackedBars in charts.mjs): a label button per row, a count button per state. */
.chart-stacked .chart-stack-count {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.chart-stacked .chart-stack-count.is-zero {
  fill: var(--text-secondary);
}
.chart-stacked-button {
  cursor: pointer;
}
.chart-stacked-button:focus {
  outline: none;
}
.chart-stacked-button:hover .chart-bars-hit {
  fill: var(--surface-1);
}
.chart-stacked-button:focus-visible .chart-bars-hit {
  stroke: var(--text-primary);
  stroke-width: 2;
}
.chart-stacked-button.is-selected text {
  font-weight: 700;
  text-decoration: underline;
}
.chart-stacked-button.is-selected .chart-bars-fill {
  stroke: var(--text-primary);
  stroke-width: 2.5;
}
@media (forced-colors: active) {
  .chart-stacked .chart-stack-count.is-zero {
    fill: GrayText;
  }
  .chart-stacked-button:focus-visible .chart-bars-hit,
  .chart-stacked-button.is-selected .chart-bars-fill {
    stroke: Highlight;
  }
}
/* Stacked state bars (stateBar in charts.mjs): glyph and count in every segment. */
.state-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.state-segment {
  flex: 1 1 0;
  min-width: 2.6rem;
  min-height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.15rem 0.3rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border-default);
  background: var(--surface-1);
  color: var(--text-primary);
}
.state-segment .matrix-glyph {
  font-size: 1rem;
}
.state-segment[data-state='present'],
.state-segment[data-state='records'] {
  background: var(--surface-2);
  border-color: var(--text-tertiary);
}
.state-segment[data-state='not_evaluated'],
.state-segment[data-state='unavailable'],
.state-segment[data-state='index_unavailable'] {
  border-style: dashed;
  color: var(--text-secondary);
}
.state-segment[aria-pressed='true'] {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
  font-weight: 700;
  text-decoration: underline;
}
@media (forced-colors: active) {
  .state-segment {
    border-color: ButtonText;
  }
  .state-segment[aria-pressed='true'] {
    outline-color: Highlight;
  }
}
/* Resolution timeline (timelinePlot in charts.mjs): one lane per outcome, one shape per lane. */
.chart-timeline {
  display: block;
  width: 100%;
  max-width: 40rem;
  height: auto;
  font: 14px var(--font-sans);
}
.chart-timeline text {
  fill: var(--text-primary);
}
.chart-timeline .tick {
  fill: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.chart-timeline .axis,
.chart-timeline .lane {
  stroke: var(--border-default);
}
.chart-timeline .grid {
  stroke: var(--border-default);
  stroke-dasharray: 2 4;
}
.chart-timeline .chart-timeline-hit {
  fill: transparent;
  pointer-events: all;
  cursor: pointer;
}
.chart-timeline .point {
  stroke: var(--surface-0);
  stroke-width: 1.5;
  cursor: pointer;
}
.chart-timeline .point.tone-primary {
  fill: var(--color-loom-600);
}
.chart-timeline .point.tone-muted {
  fill: var(--text-secondary);
}
.chart-timeline .point:focus,
.chart-timeline .point:hover {
  stroke: var(--text-primary);
  stroke-width: 3;
  outline: none;
}
.chart-timeline-link {
  fill: none;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}
.chart-timeline-link.tone-primary {
  stroke: var(--color-loom-600);
}
.chart-timeline-link.tone-muted {
  stroke: var(--text-secondary);
}
.history-row:focus,
.history-row.is-focused {
  outline: 2px solid var(--color-loom-600);
  outline-offset: 2px;
}
@media (forced-colors: active) {
  .chart-timeline text {
    fill: CanvasText;
  }
  .chart-timeline .axis,
  .chart-timeline .grid,
  .chart-timeline .lane,
  .chart-timeline-link {
    stroke: GrayText;
  }
  .chart-timeline .point {
    forced-color-adjust: none;
    fill: CanvasText;
    stroke: Canvas;
  }
  .chart-timeline .point:focus {
    stroke: Highlight;
  }
  .history-row:focus,
  .history-row.is-focused {
    outline-color: Highlight;
  }
  .chart-scatter text {
    fill: CanvasText;
  }
  .chart-scatter .grid,
  .chart-scatter .axis {
    stroke: GrayText;
  }
  .chart-scatter .scatter-rule {
    stroke: CanvasText;
  }
  .chart-scatter .point {
    forced-color-adjust: none;
    fill: CanvasText;
  }
  .chart-scatter .point:focus,
  .chart-scatter .point.is-picked {
    fill: Highlight;
    stroke: Highlight;
  }
}
/* UpSet-style combination bars (upsetBars in charts.mjs): membership is a filled dot against a
   hollow ring, so it reads without colour; the pressed column is underlined and outlined. */
.chart-upset {
  display: block;
  width: 100%;
  max-width: 40rem;
  height: auto;
  font: 12px var(--font-sans);
}
.chart-upset text {
  fill: var(--text-primary);
}
.chart-upset .axis {
  stroke: var(--border-default);
}
.chart-upset .upset-stripe {
  fill: var(--surface-2);
}
.chart-upset .upset-count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chart-upset .upset-hit {
  fill: transparent;
  pointer-events: all;
}
.chart-upset .upset-bar {
  fill: var(--color-loom-600);
}
.chart-upset .upset-dot {
  fill: var(--surface-0);
  stroke: var(--text-tertiary);
  stroke-width: 1.5;
}
.chart-upset .upset-dot.is-member {
  fill: var(--text-primary);
  stroke: var(--text-primary);
}
.chart-upset .upset-link {
  stroke: var(--text-primary);
  stroke-width: 2;
}
.upset-column {
  cursor: pointer;
}
.upset-column:focus {
  outline: none;
}
.upset-column:hover .upset-hit {
  fill: var(--surface-1);
  fill-opacity: 0.6;
}
.upset-column:focus-visible .upset-hit {
  stroke: var(--text-primary);
  stroke-width: 2;
}
.upset-column.is-selected .upset-bar {
  stroke: var(--text-primary);
  stroke-width: 2.5;
}
.upset-column.is-selected .upset-count {
  font-weight: 700;
  text-decoration: underline;
}
@media (forced-colors: active) {
  .chart-upset text {
    fill: CanvasText;
  }
  .chart-upset .axis {
    stroke: GrayText;
  }
  .chart-upset .upset-stripe {
    fill: Canvas;
  }
  .chart-upset .upset-bar,
  .chart-upset .upset-dot,
  .chart-upset .upset-link {
    forced-color-adjust: none;
  }
  .chart-upset .upset-bar {
    fill: CanvasText;
  }
  .chart-upset .upset-dot {
    fill: Canvas;
    stroke: CanvasText;
  }
  .chart-upset .upset-dot.is-member {
    fill: CanvasText;
  }
  .chart-upset .upset-link {
    stroke: CanvasText;
  }
  .upset-column:focus-visible .upset-hit,
  .upset-column.is-selected .upset-bar {
    stroke: Highlight;
  }
}
