/*
 * Version 3 -- 1080 Sprint dashboard.
 *
 * Continues the existing shell token system and follows the Force Measurement
 * panel's anatomy: a toolbar, a status line, an empty state, an error region,
 * and a content region of headed sections. Only 1080 Sprint's own layout lives
 * here; no shared component is redeclared under a second name.
 *
 * Nothing in this panel is coloured by outcome, because nothing in this system
 * has a governed outcome. The one tinted element is the "not matched" flag on a
 * row whose athlete has not been resolved -- and that flag carries its own
 * words, so the colour is never the only signal.
 *
 * Every table scrolls inside its own wrapper. The page body never scrolls
 * sideways, however many columns a wide export produces.
 */

/* ---- toolbar ------------------------------------------------------------ */

.v3-s1080-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--v3-space-3);
  padding: var(--v3-space-3) var(--v3-space-4);
  margin-bottom: var(--v3-space-4);
  border-radius: var(--v3-radius-md);
  border: 1px solid var(--v3-border);
  background: var(--v3-surface-muted);
}

.v3-s1080-field {
  display: flex;
  flex-direction: column;
  gap: var(--v3-space-1);
  min-width: 0;
  flex: 1 1 12rem;
}

.v3-s1080-field label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--v3-text-muted);
}

.v3-s1080-field select {
  min-width: 0;
  width: 100%;
}

/* ---- status, empty, error ----------------------------------------------- */

.v3-s1080-status {
  margin: 0 0 var(--v3-space-3);
  font-size: 0.85rem;
  color: var(--v3-text-muted);
}

.v3-s1080-empty {
  padding: var(--v3-space-4);
  border-radius: var(--v3-radius-md);
  border: 1px dashed var(--v3-border-strong);
  background: var(--v3-surface-muted);
  color: var(--v3-text-muted);
}

.v3-s1080-empty p {
  margin: 0;
  max-width: 64ch;
}

.v3-s1080-error {
  padding: var(--v3-space-4);
  border-radius: var(--v3-radius-md);
  border: 1px solid var(--v3-border-strong);
  background: var(--v3-surface);
}

.v3-s1080-error p {
  margin: 0 0 var(--v3-space-1);
}

.v3-s1080-error-detail {
  font-size: 0.82rem;
  color: var(--v3-text-muted);
  overflow-wrap: anywhere;
}

/* ---- sections ----------------------------------------------------------- */

.v3-panel--sprint-1080 section {
  margin-bottom: var(--v3-space-5);
}

.v3-s1080-section-heading {
  margin: 0 0 var(--v3-space-3);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--v3-text);
}

.v3-s1080-note {
  margin: 0 0 var(--v3-space-3);
  max-width: 72ch;
  font-size: 0.82rem;
  color: var(--v3-text-muted);
}

/* ---- summary ------------------------------------------------------------ */

.v3-s1080-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--v3-space-2);
  margin: 0 0 var(--v3-space-3);
  padding: var(--v3-space-4);
  border-radius: var(--v3-radius-md);
  border: 1px solid var(--v3-border);
  background: var(--v3-surface);
}

.v3-s1080-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.v3-s1080-summary-item dt {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--v3-text-muted);
}

.v3-s1080-summary-item dd {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--v3-maroon);
}

.v3-s1080-unresolved {
  margin: 0 0 var(--v3-space-3);
  padding: var(--v3-space-2) var(--v3-space-3);
  border-radius: var(--v3-radius-sm);
  border: 1px dashed var(--v3-border-strong);
  background: var(--v3-surface-muted);
  font-size: 0.82rem;
  color: var(--v3-text-muted);
}

.v3-s1080-range-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--v3-space-3);
}

.v3-s1080-range-card {
  display: flex;
  flex-direction: column;
  gap: var(--v3-space-1);
  padding: var(--v3-space-4);
  border-radius: var(--v3-radius-md);
  border: 1px solid var(--v3-border);
  background: var(--v3-surface);
  min-width: 0;
}

.v3-s1080-range-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--v3-text-muted);
}

.v3-s1080-range-value {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--v3-maroon);
  overflow-wrap: anywhere;
}

.v3-s1080-range-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--v3-text-muted);
}

/* ---- trial groups ------------------------------------------------------- */

.v3-s1080-group {
  display: flex;
  flex-direction: column;
  gap: var(--v3-space-2);
  margin-bottom: var(--v3-space-4);
  padding: var(--v3-space-4);
  border-radius: var(--v3-radius-md);
  border: 1px solid var(--v3-border);
  background: var(--v3-surface);
  min-width: 0;
}

.v3-s1080-group-heading {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--v3-text);
  overflow-wrap: anywhere;
}

.v3-s1080-group-meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--v3-text-muted);
}

.v3-s1080-group .v3-s1080-note {
  margin: 0;
}

.v3-s1080-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--v3-space-2);
  margin: 0;
  padding: var(--v3-space-3);
  border-radius: var(--v3-radius-sm);
  background: var(--v3-surface-muted);
}

.v3-s1080-comparison > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.v3-s1080-comparison dt {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--v3-text-muted);
}

.v3-s1080-comparison dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--v3-text);
  overflow-wrap: anywhere;
}

/* ---- tables ------------------------------------------------------------- */

/* The established horizontal-scroll behaviour, so a wide export never makes the
   page itself scroll sideways. */
.v3-s1080-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.v3-s1080-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.v3-s1080-table th,
.v3-s1080-table td {
  padding: var(--v3-space-1) var(--v3-space-2);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--v3-border);
}

.v3-s1080-table thead th {
  position: sticky;
  top: 0;
  background: var(--v3-surface);
  color: var(--v3-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.v3-s1080-table tbody th {
  font-weight: 600;
  color: var(--v3-text);
}

.v3-s1080-table tbody td {
  color: var(--v3-text);
}

.v3-s1080-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.v3-s1080-table--group thead th {
  background: var(--v3-surface);
}

/* The row is tinted, and the flag beside the name says the same thing in
   words -- the colour is never the only signal. */
.v3-s1080-row--unmatched {
  background: var(--v3-surface-muted);
}

.v3-s1080-unmatched-flag {
  display: inline-block;
  margin-left: var(--v3-space-1);
  padding: 0 var(--v3-space-1);
  border-radius: var(--v3-radius-sm);
  border: 1px solid var(--v3-border-strong);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--v3-text-muted);
  white-space: nowrap;
}

/* ---- responsive --------------------------------------------------------- */

@media (max-width: 720px) {
  .v3-s1080-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .v3-s1080-field {
    flex: 1 1 auto;
  }

  .v3-s1080-range-grid,
  .v3-s1080-comparison {
    grid-template-columns: 1fr;
  }

  .v3-s1080-summary-grid {
    grid-template-columns: 1fr 1fr;
  }
}
