/*
 * Version 3 -- Readiness workspace.
 *
 * An operational command centre, built on the existing shell tokens and the
 * anatomy Home and the vendor dashboards already use. Dense enough to scan a
 * hundred-athlete squad, plain enough that nothing decorative competes with the
 * data.
 *
 * ---------------------------------------------------------------------------
 * No colour on this page carries meaning on its own
 * ---------------------------------------------------------------------------
 *
 * There is no red, amber, or green status anywhere here, because there is no
 * governed status to express. `PERFORMANCE_KNOWLEDGE_MODEL.md` §11 forbids a
 * traffic light without every contributing figure, window, baseline, and
 * confidence shown alongside, and names readiness as the reason that rule
 * exists.
 *
 * The two tints that do appear are reinforcement, never signal: a system cell
 * with data is emphasised beside the record count that says the same thing, and
 * the selected row is marked beside an `aria-current` the browser announces. A
 * reader who sees no colour loses nothing.
 *
 * The confidence dot is likewise decorative -- the level is spelled out in the
 * same sentence, exactly as Athlete 360 does it.
 */

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

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

.v3-rdy-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--v3-space-3);
  padding: var(--v3-space-5);
  border-radius: var(--v3-radius-md);
  border: 1px dashed var(--v3-border-strong);
  background: var(--v3-surface-muted);
  color: var(--v3-text-muted);
}

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

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

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

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

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

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

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

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

.v3-rdy-context {
  margin: 0 0 var(--v3-space-3);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--v3-text-muted);
}

/* ---- team overview tiles ------------------------------------------------- */

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

.v3-rdy-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  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-rdy-tile-label {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--v3-text-muted);
}

.v3-rdy-tile-value {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--v3-maroon);
  line-height: 1.1;
}

.v3-rdy-tile-detail {
  margin: 0;
  font-size: 0.75rem;
  color: var(--v3-text-muted);
  overflow-wrap: anywhere;
}

/* ---- attention queue ---------------------------------------------------- */

.v3-rdy-attention {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--v3-space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.v3-rdy-attention-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--v3-space-2);
  padding: var(--v3-space-4);
  border-radius: var(--v3-radius-md);
  border: 1px solid var(--v3-border);
  border-left: 3px solid var(--v3-border-strong);
  background: var(--v3-surface);
  min-width: 0;
}

.v3-rdy-attention-label {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--v3-text);
}

.v3-rdy-attention-reason {
  margin: 0;
  font-size: 0.8rem;
  color: var(--v3-text-muted);
}

/* ---- filters ------------------------------------------------------------ */

.v3-rdy-filters {
  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-3);
  border-radius: var(--v3-radius-md);
  border: 1px solid var(--v3-border);
  background: var(--v3-surface-muted);
}

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

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

.v3-rdy-field select,
.v3-rdy-field input {
  min-width: 0;
  width: 100%;
}

.v3-rdy-field select:focus-visible,
.v3-rdy-field input:focus-visible {
  outline: 2px solid var(--v3-focus-ring);
  outline-offset: 2px;
}

/* ---- athlete table ------------------------------------------------------ */

.v3-rdy-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  max-height: 32rem;
  overflow-y: auto;
}

.v3-rdy-table-wrap:focus-visible {
  outline: 2px solid var(--v3-focus-ring);
  outline-offset: 2px;
}

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

.v3-rdy-table th,
.v3-rdy-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-rdy-table thead th {
  position: sticky;
  top: 0;
  background: var(--v3-surface);
  color: var(--v3-text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.v3-rdy-sort,
.v3-rdy-athlete {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.v3-rdy-sort {
  text-transform: inherit;
  letter-spacing: inherit;
}

.v3-rdy-athlete {
  color: var(--v3-maroon);
  font-weight: 700;
}

.v3-rdy-sort:focus-visible,
.v3-rdy-athlete:focus-visible {
  outline: 2px solid var(--v3-focus-ring);
  outline-offset: 2px;
}

.v3-rdy-system-col {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Reinforcement only: the cell already reads a count or the word "none". */
.v3-rdy-cell {
  display: inline-block;
  min-width: 2.5rem;
  padding: 0 var(--v3-space-1);
  border-radius: var(--v3-radius-sm);
  border: 1px solid var(--v3-border);
  color: var(--v3-text-muted);
}

.v3-rdy-cell--has-data {
  border-color: var(--v3-maroon);
  color: var(--v3-maroon);
  font-weight: 600;
}

/* Marked beside an aria-current the browser announces. */
.v3-rdy-row--selected {
  background: var(--v3-surface-muted);
}

/* ---- athlete detail ----------------------------------------------------- */

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

.v3-rdy-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--v3-space-3);
  padding-bottom: var(--v3-space-3);
  margin-bottom: var(--v3-space-4);
  border-bottom: 1px solid var(--v3-border);
}

.v3-rdy-detail-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--v3-maroon);
}

.v3-rdy-detail-meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--v3-text-muted);
}

.v3-rdy-detail-heading {
  margin: 0 0 var(--v3-space-2);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--v3-text);
}

.v3-rdy-detail-systems {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--v3-space-2);
  margin: 0 0 var(--v3-space-4);
  padding: 0;
  list-style: none;
}

.v3-rdy-detail-system {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--v3-space-1);
  padding: var(--v3-space-3);
  border-radius: var(--v3-radius-sm);
  border: 1px solid var(--v3-border);
  border-top: 3px solid var(--v3-border-strong);
  background: var(--v3-surface-muted);
  min-width: 0;
}

.v3-rdy-detail-system--has-data {
  border-top-color: var(--v3-maroon);
  background: var(--v3-surface);
}

.v3-rdy-detail-system-name {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--v3-text);
}

.v3-rdy-detail-system-status {
  margin: 0;
  font-size: 0.75rem;
  color: var(--v3-text-muted);
  overflow-wrap: anywhere;
}

/* ---- findings, rendered as Athlete 360 renders them --------------------- */

.v3-rdy-group {
  margin-bottom: var(--v3-space-4);
}

.v3-rdy-group-heading {
  display: flex;
  align-items: center;
  gap: var(--v3-space-2);
  margin: 0 0 var(--v3-space-1);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--v3-text);
}

.v3-rdy-group-count {
  padding: 1px var(--v3-space-2);
  border-radius: var(--v3-radius-sm);
  border: 1px solid var(--v3-border-strong);
  background: var(--v3-surface-muted);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--v3-text-muted);
}

.v3-rdy-group-note {
  margin: 0 0 var(--v3-space-2);
  font-size: 0.78rem;
  color: var(--v3-text-muted);
}

.v3-rdy-findings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--v3-space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.v3-rdy-finding {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--v3-space-2);
  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-rdy-finding-system {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--v3-text-muted);
}

.v3-rdy-finding-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--v3-text);
  overflow-wrap: anywhere;
}

.v3-rdy-finding-outcome,
.v3-rdy-finding-value,
.v3-rdy-finding-reason {
  margin: 0;
  font-size: 0.8rem;
  color: var(--v3-text-muted);
}

.v3-rdy-finding-value strong {
  color: var(--v3-maroon);
}

.v3-rdy-finding-confidence {
  display: flex;
  align-items: center;
  gap: var(--v3-space-2);
  margin: 0;
  font-size: 0.78rem;
  color: var(--v3-text-muted);
}

.v3-rdy-finding-confidence--none {
  font-style: italic;
}

/* Decorative: the level is spelled out in the same sentence. */
.v3-rdy-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--v3-border-strong);
}

.v3-rdy-dot--high {
  background: var(--v3-maroon);
}

.v3-rdy-dot--moderate {
  background: var(--v3-maroon-light);
}

.v3-rdy-basis {
  width: 100%;
  border-top: 1px solid var(--v3-border);
  padding-top: var(--v3-space-2);
}

.v3-rdy-basis > summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--v3-maroon);
}

.v3-rdy-basis > summary:focus-visible {
  outline: 2px solid var(--v3-focus-ring);
  outline-offset: 2px;
}

.v3-rdy-basis-list {
  display: grid;
  gap: var(--v3-space-1);
  margin: var(--v3-space-2) 0 0;
}

.v3-rdy-basis-list > div {
  display: flex;
  justify-content: space-between;
  gap: var(--v3-space-3);
  font-size: 0.78rem;
}

.v3-rdy-basis-list dt {
  margin: 0;
  color: var(--v3-text-muted);
}

.v3-rdy-basis-list dd {
  margin: 0;
  font-weight: 600;
  color: var(--v3-text);
  text-align: right;
  overflow-wrap: anywhere;
}

/* ---- limitations -------------------------------------------------------- */

.v3-rdy-limitations {
  margin: 0;
  padding-left: var(--v3-space-4);
  max-width: 78ch;
}

.v3-rdy-limitations li {
  font-size: 0.8rem;
  color: var(--v3-text-muted);
  margin-bottom: var(--v3-space-1);
}

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

@media (max-width: 900px) {
  .v3-rdy-tiles {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

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

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

  .v3-rdy-tiles {
    grid-template-columns: 1fr 1fr;
  }

  .v3-rdy-attention,
  .v3-rdy-findings,
  .v3-rdy-detail-systems {
    grid-template-columns: 1fr;
  }

  .v3-rdy-basis-list > div {
    flex-direction: column;
    gap: 2px;
  }

  .v3-rdy-basis-list dd {
    text-align: left;
  }
}
