/* Interactive timeline chart (admin_chart_controller.js) -----------------
   Light surface only — the admin panels are white. Series colours arrive
   inline from Participation::ApplicationFeePerformance::COLORS; everything
   here is chrome, and chrome never wears a series colour. */
.admin-chart {
  margin: 0;
}

.admin-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-4xs);
  margin-bottom: var(--spacing-xs);
}

.admin-chart__legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-3xs);
  padding: var(--spacing-4xs) var(--spacing-2xs);
  background: none;
  border: 0;
  border-radius: var(--rounded-3xs);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  line-height: 1.4;
}

.admin-chart__legend-item:hover {
  background: var(--background-neutral);
  color: var(--text-primary);
}

/* Legends mirror the mark: a short stroke for a line chart, never a block. */
.admin-chart__legend-key {
  width: 14px;
  height: 3px;
  flex: none;
  background: var(--series-color);
  border-radius: var(--rounded-full);
}

.admin-chart__legend-item[aria-pressed="false"] {
  color: var(--text-secondary);
  opacity: 0.45;
}

.admin-chart__legend-item[aria-pressed="false"] .admin-chart__legend-key {
  background: #9a9e98;
}

.admin-chart__plot {
  position: relative;
  min-height: 220px;
  border-radius: var(--rounded-3xs);
  touch-action: pan-y;
}

.admin-chart__plot:focus-visible {
  outline: 2px solid var(--interactive-primary);
  outline-offset: 2px;
}

.admin-chart__svg {
  display: block;
  width: 100%;
  height: auto;
}

.admin-chart__grid {
  stroke: #e9ece7;
  stroke-width: 1;
}

.admin-chart__tick {
  fill: #656965;
  font-family: var(--font-family-body);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.admin-chart__line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A wash, never a saturated block — only drawn when one variant is isolated. */
.admin-chart__area {
  opacity: 0.12;
  stroke: none;
}

/* 2px surface ring so dots stay legible where series cross. */
.admin-chart__dot,
.admin-chart__marker {
  stroke: #fff;
  stroke-width: 2;
}

.admin-chart__crosshair {
  stroke: #b6bab4;
  stroke-width: 1;
}

.admin-chart__mark--dimmed {
  opacity: 0.16;
}

.admin-chart__tooltip {
  position: absolute;
  top: var(--spacing-2xs);
  z-index: 2;
  min-width: 13rem;
  max-width: 20rem;
  padding: var(--spacing-2xs) var(--spacing-xs);
  background: #fff;
  border: 1px solid var(--color-border-neutral);
  border-radius: var(--rounded-3xs);
  box-shadow: 0 6px 20px rgb(22 51 0 / 0.12);
  pointer-events: none;
}

.admin-chart__tooltip[hidden] {
  display: none;
}

.admin-chart__tooltip-header {
  margin: 0 0 var(--spacing-3xs);
  padding-bottom: var(--spacing-4xs);
  border-bottom: 1px solid var(--color-border-soft);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
}

.admin-chart__tooltip ul {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-chart__tooltip li {
  display: grid;
  grid-template-columns: 14px auto 1fr;
  align-items: baseline;
  column-gap: var(--spacing-3xs);
  row-gap: 2px;
}

.admin-chart__tooltip li::before {
  content: "";
  grid-row: 1;
  grid-column: 1;
  align-self: center;
  width: 14px;
  height: 3px;
  background: var(--series-color);
  border-radius: var(--rounded-full);
}

/* Value leads, label follows — the reader already knows which series. */
.admin-chart__tooltip li strong {
  grid-row: 1;
  grid-column: 2;
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-variant-numeric: tabular-nums;
}

.admin-chart__tooltip-name {
  grid-row: 1;
  grid-column: 3;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: right;
}

.admin-chart__tooltip-support {
  grid-row: 2;
  grid-column: 2 / -1;
  margin: 0;
  color: #656965;
  font-size: 11px;
}

.admin-chart__note {
  margin: var(--spacing-2xs) 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

/* The table twin: every plotted value without needing a pointer. */
.admin-chart__data {
  margin-top: var(--spacing-xs);
}

.admin-chart__data summary {
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
}

.admin-chart__data summary:hover {
  color: var(--text-primary);
}

.admin-chart__data .admin-table__scroll {
  margin-top: var(--spacing-2xs);
}

.admin-chart__table-caption {
  padding-bottom: var(--spacing-3xs);
  color: var(--text-secondary);
  font-size: 12px;
  text-align: left;
}

@media (prefers-reduced-motion: no-preference) {
  .admin-chart__svg {
    animation: admin-chart-fade 240ms ease-out;
  }

  @keyframes admin-chart-fade {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

/* Too narrow to float over the plot without hiding it: the readout drops below
   the chart and the crosshair alone marks the bucket. */
@media (max-width: 40rem) {
  .admin-chart__tooltip {
    position: static;
    min-width: 0;
    max-width: none;
    margin-top: var(--spacing-2xs);
    box-shadow: none;
  }
}

/* Compact comparison bars — the ranking the wide table hides ---------------
   One row per variant, each keeping the colour it wears in the timeline. */
.admin-bars {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2xs);
  margin: 0 0 var(--spacing-lg);
}

.admin-bars__caption {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
}

.admin-bars__row {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) minmax(4rem, 1fr) auto;
  align-items: center;
  gap: var(--spacing-2xs);
}

.admin-bars__label {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-3xs);
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.admin-bars__label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-bars__label i {
  width: 9px;
  height: 9px;
  flex: none;
  background: var(--series-color);
  border-radius: var(--rounded-full);
}

.admin-bars__track {
  display: block;
  height: 14px;
  background: var(--background-neutral);
  border-radius: 2px;
}

/* Square at the baseline, 4px rounded at the data end. */
.admin-bars__bar {
  display: block;
  height: 100%;
  min-width: 2px;
  background: var(--series-color);
  border-radius: 2px 4px 4px 2px;
}

.admin-bars__value {
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-weight-semibold);
}

@media (max-width: 40rem) {
  .admin-bars__row {
    grid-template-columns: 1fr auto;
  }

  .admin-bars__track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* Aggregated trend panels — one metric each, all variants pooled ----------- */
.admin-trends {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

@media (max-width: 60rem) {
  .admin-trends { grid-template-columns: 1fr; }
}

.admin-trend {
  margin-bottom: 0;
  padding: var(--spacing-md);
}

.admin-trend__header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--spacing-2xs);
}

.admin-trend__label {
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: var(--font-weight-semibold);
}

.admin-trend__value {
  font-family: var(--font-family-bricolage);
  font-size: 1.75rem;
  line-height: 1.1;
}

.admin-trend__support {
  color: #656965;
  font-size: 12px;
}

.admin-chart--compact .admin-chart__plot {
  min-height: 140px;
}

.admin-trends__data {
  grid-column: 1 / -1;
  margin-top: 0;
}

/* A distribution takes the whole row: its bands are too many for half of it. */
.admin-trend--wide {
  grid-column: 1 / -1;
}
