/**
 * Analytics station styles.
 *
 * One rule governs this file: an UNAVAILABLE metric must be visibly
 * unavailable. Unreliable figures are muted, italicised and annotated, never
 * rendered in the same weight and colour as a measured one - because a number
 * without a caveat is an assertion, whatever the API said about it.
 */

.station-main { padding: var(--sp-4); max-width: 1200px; margin: 0 auto; }
.station-head { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.station-head h2 { margin: 0; }
.field { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); }
.field select { min-width: 280px; }

/* --- data quality banner ------------------------------------------------ */

.quality {
  border: 1px solid var(--line);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  background: var(--panel-2);
}
.quality[data-state='ok'] { border-left-color: var(--ok); }
.quality h2 { margin: 0 0 var(--sp-1); font-size: var(--fs-base); }
.quality p { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.5; }

/* --- layout ------------------------------------------------------------- */

/* `min-width: 0` on the panels lets the grid columns shrink below their
   content width, which is what keeps the right-hand column inside the panel. */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--sp-3); }
.panel { min-width: 0; }
.panel-wide { grid-column: 1 / -1; }
.subhead { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: var(--sp-3) 0 var(--sp-2); }
.subhead:first-child { margin-top: 0; }

/* --- figures ------------------------------------------------------------ */

.headline { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.num { font-variant-numeric: tabular-nums; }
.num.big { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.muted { color: var(--text-muted); }

.breakdown { display: flex; flex-direction: column; gap: var(--sp-2); }
.breakdown .row { display: grid; grid-template-columns: 7rem 4rem 1fr; gap: var(--sp-2); align-items: center; font-size: var(--fs-sm); }
.breakdown .count { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.bar { height: 7px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* --- reliability -------------------------------------------------------- */

.note {
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--text-muted);
  margin: var(--sp-3) 0 0;
  padding-left: var(--sp-2);
  border-left: 2px solid var(--line);
}

/*
 * The word "unavailable", not a dash. A dash reads as a rendering failure; the
 * word reads as a decision the system made, which is what it is - and it is
 * what a coach needs to know before they act on the rest of the page.
 */
.unavailable { color: var(--text-dim); font-style: italic; font-size: var(--fs-xs); }

/*
 * All four columns are FRACTIONS, not fixed rem widths.
 *
 * Fixed-width columns plus a long "unavailable" made the row wider than its
 * panel, and the right-hand column - the one carrying the reliability wording -
 * was clipped at the edge. Fractions cannot overflow: whatever the content
 * needs, the columns give back proportionally.
 *
 * The spacing comes from the shared `.panel-body`, which is the padded variant
 * of `.panel`. Using bare `.panel` gave the grid no horizontal padding at all,
 * so the right-aligned "unavailable" sat exactly on the panel border and read
 * as cut off.
 */
.entity-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: var(--sp-2);
  align-items: center;
  padding: var(--sp-2) 0;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.entity-row > span:not(:first-child) { text-align: right; }
.entity-row > span { min-width: 0; overflow-wrap: anywhere; }

.legend {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding-bottom: var(--sp-1);
  border-bottom: 1px solid var(--line);
  margin: var(--sp-1) 0 var(--sp-1);
}
.legend span:not(:first-child) { text-align: right; }

.empty { color: var(--text-muted); font-size: var(--fs-sm); margin: 0; }