/* Gráficas tab: equipment picker, symmetric 2 × 2 grid of equal chart cards (S13) and SVG marks. */

/* ---------- Series colour slots (colour follows the equipment, never its rank) ---------- */
.chart-key {
  flex: none;
  width: 14px;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}
.series-1 {
  --series: var(--chart-1);
}
.series-2 {
  --series: var(--chart-2);
}
.series-3 {
  --series: var(--chart-3);
}
.series-4 {
  --series: var(--chart-4);
}
.series-5 {
  --series: var(--chart-5);
}
.series-6 {
  --series: var(--chart-6);
}
.chart-key[class*='series-'] {
  background: var(--series);
}

/* ---------- Equipment picker ---------- */
.chart-picker {
  margin-bottom: var(--space-5);
  padding: var(--space-4) var(--space-5);
}
.chart-picker-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.chart-picker-head h2 {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
}
.chart-picker-count {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.chart-reset {
  margin-left: auto;
}
.chart-picker-groups {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
}
.chart-picker-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.chart-picker-label {
  min-width: 128px;
  color: var(--text-subtle);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Chip: inherits rest/hover/focus/active/disabled/loading from the base button; the pressed state
   shows the series key instead of the brand fill so the chip doubles as the legend. */
.chart-chip {
  min-height: 30px;
  padding: 0 var(--space-3) 0 var(--space-2);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.chart-chip[aria-pressed='true'] {
  background: var(--surface);
  border-color: var(--text-muted);
  color: var(--text);
  font-weight: var(--weight-bold);
}
.chart-chip[aria-pressed='true']:hover {
  background: var(--state-hover-bg);
  border-color: var(--state-hover-border);
}

/* ---------- Grid of equal cards ---------- */
.data-grid.chart-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}
@media (max-width: 1000px) {
  .data-grid.chart-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.chart-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}
.chart-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.chart-card-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ---------- Plot (focusable: arrow keys move the crosshair) ---------- */
.chart-plot {
  position: relative;
  min-height: 210px;
  border-radius: var(--radius-sm);
  cursor: crosshair;
  transition:
    box-shadow var(--transition-fast),
    opacity var(--transition-fast);
}
.chart-plot:hover {
  box-shadow: 0 0 0 1px var(--border);
}
.chart-plot:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.chart-plot:active {
  box-shadow: 0 0 0 1px var(--state-hover-border);
}
.chart-plot.is-empty,
.chart-plot[aria-disabled='true'] {
  cursor: default;
}
.chart-plot[aria-busy='true'] {
  opacity: 0.5;
}
.chart-plot svg {
  display: block;
  width: 100%;
  overflow: visible;
}
.chart-gridlines line {
  stroke: var(--chart-grid);
  stroke-width: 1;
}
.chart-baseline {
  stroke: var(--chart-axis);
  stroke-width: 1;
}
.chart-plot text {
  fill: var(--text-subtle);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}
.chart-line {
  fill: none;
  stroke: var(--series);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-crosshair {
  stroke: var(--chart-axis);
  stroke-width: 1;
}
.chart-dot {
  fill: var(--series);
  stroke: var(--surface);
  stroke-width: 2;
}
.chart-empty {
  position: absolute;
  inset: 0 0 var(--space-6) var(--space-7);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: center;
}

/* ---------- Tooltip: values lead, ids follow, line keys ---------- */
.chart-tooltip {
  position: absolute;
  top: var(--space-1);
  z-index: 2;
  min-width: 150px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  pointer-events: none;
}
.chart-tooltip-time {
  margin-bottom: var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}
.chart-tooltip-id {
  margin-left: auto;
  padding-left: var(--space-3);
  color: var(--text-muted);
}

/* ---------- Table view (legend + values) ---------- */
.chart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.chart-table th,
.chart-table td {
  padding: 3px var(--space-2);
  border-top: 1px solid var(--border);
  text-align: left;
  font-weight: var(--weight-regular);
}
.chart-table thead th {
  border-top: 0;
  color: var(--text-subtle);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}
.chart-table .num {
  text-align: right;
}
.chart-table th[scope='row'] {
  padding-left: 0;
}
/* Row link to the equipment view: ghost button with the base button states. */
.chart-link {
  min-height: 26px;
  padding: 0 var(--space-2);
  border-color: transparent;
  background: transparent;
  font-weight: var(--weight-bold);
}
.chart-link:hover {
  background: var(--state-hover-bg);
  border-color: transparent;
  color: var(--brand-700);
}
.chart-link:disabled {
  background: transparent;
}
