@layer pages {
  .actions { display: flex; flex-wrap: wrap; gap: 10px; }
  .hint { font-size: 13px; color: var(--muted); }

  .stack { display: flex; flex-direction: column; gap: 14px; }

  .section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;

    & h2 { font-size: 22px; }
    & .muted { font-size: 14px; }
  }

  .setup {
    padding: clamp(20px, 4vw, 28px);
    display: flex;
    flex-direction: column;
    gap: 16px;

    & h2 { font-size: 22px; }
    & + .setup { margin-top: 16px; }
  }

  .device-list {
    list-style: none;
    margin: 0;
    padding: 0;

    & li {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      padding: 10px 0;
      border-top: 1px solid var(--line);
    }
    & small { display: block; }
  }

  .delete-account {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;

    & .field { flex: 1 1 240px; max-width: 360px; }
  }

  .steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;

    & li {
      display: grid;
      grid-template-columns: 32px minmax(0, 1fr) auto;
      gap: 14px;
      align-items: center;
      padding: 14px 0;
      border-top: 1px solid var(--line);
    }
    & li:first-child { border-top: 0; padding-top: 0; }
    & .num {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      background: var(--bg);
      border: 1px solid var(--line);
      font-size: 13px;
    }
    & b { font-weight: 600; }
    & p { font-size: 14px; }
  }
}

@layer pages {
  .lead { max-width: 44em; }
  .section-title { font-size: 22px; }

  .readout {
    padding: clamp(20px, 4vw, 28px);
    display: flex;
    flex-direction: column;
    gap: 16px;

    & .verdict { font-size: clamp(22px, 3vw, 28px); max-width: 30em; }
    & .classic { margin-left: 6px; opacity: .7; }
    & .big.fatigue { color: var(--fatigue); }
  }

  .thresholds { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .thresholds .big { font-size: 40px; }

  .threshold-form { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
  .threshold-form .fields { width: 100%; }

  .upload {
    padding: clamp(20px, 4vw, 28px);
    display: flex;
    flex-direction: column;
    gap: 18px;

    & h2 { font-size: 22px; }
    & p { max-width: 44em; }
  }

  .upload-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }

  .drop {
    position: relative;
    flex: 1 1 320px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border: 1.5px dashed var(--line);
    border-radius: var(--r-inner);
    background: var(--bg);
    color: var(--muted);
    cursor: pointer;

    &:hover, &:focus-within { border-color: var(--accent-text); }
    & svg { width: 22px; height: 22px; color: var(--accent-text); flex: none; }
    & b { color: var(--ink); }
  }

  .drop-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

  .import-runs { display: flex; flex-direction: column; gap: 14px; }
  .import-run { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
  .import-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14.5px; }
  .import-run p { font-size: 14px; }

  .pager { display: flex; gap: 10px; }

  .tblw td a { color: var(--ink); font-weight: 600; text-decoration: none; }
  .tblw td a:hover { color: var(--accent-text); }
  .tblw td .pill { margin-left: 6px; }
  .day .t a { color: inherit; text-decoration: none; }

  .tblw table.workouts td.n:first-child { white-space: nowrap; }

  @media (max-width: 760px) {
    .tblw table.workouts { min-width: 0; }
    .workouts th:nth-child(4), .workouts td:nth-child(4) { display: none; }
    .workouts th, .workouts td { padding-inline: 10px; }
    .workouts td .pill { display: none; }
  }

  @media (max-width: 1000px) {
    .thresholds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
}

/* Workout builder */
@layer pages {
  .builder {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    align-items: start;
  }

  .builder-main, .builder-side {
    padding: clamp(18px, 3vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .builder-side { position: sticky; top: 24px; }

  .sentence {
    width: 100%;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: var(--r-inner);
    background: var(--bg);
    padding: 14px 16px;
    font-family: var(--display);
    font-size: clamp(18px, 2vw, 22px);
    line-height: 1.35;
    letter-spacing: -.01em;

    &:focus { outline: 0; border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-wash); }
  }

  .builder-preview { display: flex; flex-direction: column; gap: 16px; }

  .totals {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;

    & div { display: flex; flex-direction: column; gap: 2px; }
    & b { font-size: 22px; font-weight: 500; }
  }

  .profile {
    width: 100%;
    height: 120px;
    background: var(--bg);
    border-radius: var(--r-inner);

    & .seg { stroke: var(--panel); stroke-width: 1; vector-effect: non-scaling-stroke; }
    & .ftp-line { stroke: var(--muted); stroke-dasharray: 4 4; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .6; }
  }

  .profile-empty { padding: 36px 16px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r-inner); font-size: 14px; }

  .z-easy { fill: color-mix(in srgb, var(--accent) 22%, transparent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
  .z-tempo { fill: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 45%, transparent); }
  .z-threshold { fill: color-mix(in srgb, var(--accent) 75%, transparent); background: color-mix(in srgb, var(--accent) 75%, transparent); }
  .z-hard { fill: var(--accent); background: var(--accent); }

  .segments {
    & .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 10px; vertical-align: 0; }
    & .depth-1 td:first-child { padding-left: 34px; }
    & .depth-2 td:first-child { padding-left: 54px; }
    & tr.repeat td { background: var(--bg); }
  }

  @media (max-width: 900px) {
    .builder { grid-template-columns: 1fr; }
    .builder-side { position: static; order: -1; }
  }
}

/* Week */
@layer pages {
  .week-summary {
    padding: clamp(18px, 3vw, 24px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 18px 32px;
    align-items: center;
  }

  .week-verdict { display: flex; flex-direction: column; gap: 6px; }
  .week-verdict .verdict { font-size: clamp(22px, 2.6vw, 28px); }

  .week-figures {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) auto minmax(0, auto);
    gap: 16px 24px;
    align-items: end;

    & .figure { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
    & b { font-size: 20px; font-weight: 500; white-space: nowrap; }
    & .figure .eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  }

  .loadbar {
    display: flex;
    flex-direction: column;
    gap: 8px;

    & .loadbar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
    & .track { position: relative; height: 12px; border-radius: var(--r-pill); background: var(--bg); overflow: hidden; }
    & .plan-fill, & .actual-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--r-pill); }
    & .plan-fill { background: var(--accent-wash); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
    & .actual-fill { background: var(--actual); top: 3px; bottom: 3px; left: 3px; max-width: calc(100% - 6px); }
  }

  .legend { display: flex; gap: 8px; }

  .plan-week {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
  }

  .plan-day {
    border: 1px solid var(--line);
    border-radius: var(--r-inner);
    background: var(--bg);
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 180px;
    min-width: 0;

    &.today { border-color: var(--ink); background: var(--panel); }
    & .d { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--muted); }
    & .d b { color: var(--ink); font-weight: 500; }
    & .rest { font-size: 12.5px; }
    & .add { margin-top: auto; font-size: 12.5px; font-weight: 600; text-decoration: none; opacity: .75; }
    & .add:hover { opacity: 1; }
  }

  .session {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 9px;
    border-radius: 10px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    color: var(--ink);
    text-decoration: none;
    min-width: 0;

    &:hover { border-color: var(--muted); border-left-color: var(--accent); }
    &.actual { border-left-color: var(--actual); }
    &.done { border-left-color: var(--good); }
    &.missed { opacity: .7; border-left-style: dashed; }
    & .s-title { font-size: 13px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
    & .s-meta { font-size: 11px; color: var(--muted); }
    & .s-done { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--good); }
    & .s-done svg { width: 13px; height: 13px; }
    & .s-missed { font-size: 11.5px; color: var(--muted); }
    & .key-tag { margin-left: 6px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
  }

  @media (max-width: 1100px) {
    .week-summary { grid-template-columns: 1fr; }
  }

  @media (max-width: 760px) {
    .plan-week { grid-template-columns: 1fr; }
    .plan-day { min-height: 0; display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: start; gap: 8px 10px; }
    .plan-day > * { grid-column: 2; }
    .plan-day .d { grid-column: 1; grid-row: 1 / span 4; flex-direction: column; align-items: flex-start; gap: 0; }
    .plan-day .d b { font-size: 20px; }
    .plan-day .add { margin-top: 0; }
    .week-figures { grid-template-columns: 1fr 1fr; }
    .week-figures .loadbar { grid-column: 1 / -1; }
  }
}

/* Workout review */
@layer pages {
  .review {
    padding: clamp(18px, 3vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 16px;

    & .verdict { font-size: clamp(22px, 2.6vw, 28px); }
  }

  .chart { margin: 0; display: flex; flex-direction: column; gap: 10px; }
  .chart-key { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }

  .review-chart {
    width: 100%;
    height: 220px;
    background: var(--bg);
    border-radius: var(--r-inner);

    & .target { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
    & .actual-line { fill: none; stroke: var(--actual); stroke-width: 1.75; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
    & .ftp-line { stroke: var(--muted); stroke-dasharray: 4 4; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .6; }
  }

  .intervals td .pill { margin-left: 0; }
}

/* Fitness */
@layer pages {
  .goal-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14.5px; }
  .goal-chip b { font-weight: 600; }

  .fitness-chart {
    padding: clamp(18px, 3vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .fatigue-pill { border: 1px solid var(--line); color: var(--fatigue); }

  .fit-chart, .form-chart { width: 100%; background: var(--bg); border-radius: var(--r-inner); display: block; }
  .fit-chart { height: 260px; }
  .form-chart { height: 90px; }

  .fit-chart, .form-chart {
    & polyline { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
    & .fitness-line { stroke: var(--actual); stroke-width: 2.25; }
    & .fatigue-line { stroke: var(--fatigue); stroke-width: 1.5; opacity: .85; }
    & .form-line { stroke: var(--ink); stroke-width: 1.5; }
    & .projected { stroke-dasharray: 5 4; }
    & .fitness-line.projected { stroke: var(--accent-text); }
    & .fatigue-line.projected { opacity: .55; }
    & .form-line.projected { stroke: var(--accent-text); }
    & .future { fill: color-mix(in srgb, var(--accent) 6%, transparent); }
    & .today-line, & .zero { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
    & .today-line { stroke: var(--muted); stroke-dasharray: 2 3; }
  }

  .form-strip { display: flex; flex-direction: column; gap: 6px; }

  .what-if {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px 28px;
    align-items: center;
    padding-top: 6px;

    & input[type="range"] { width: 100%; accent-color: var(--accent); }
    & .range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
    & .hint { grid-column: 1 / -1; }
  }

  .what-if-result { font-family: var(--display); font-size: clamp(18px, 2vw, 22px); letter-spacing: -.01em; }
  .what-if-result b { font-weight: 700; }

  .goal-form { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
  .goal-form .fields { width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .reading-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;

    & p { font-size: 14.5px; color: var(--muted); }
  }

  @media (max-width: 760px) {
    .what-if, .reading-grid { grid-template-columns: 1fr; }
    .goal-form .fields { grid-template-columns: 1fr 1fr; }
    .fit-chart { height: 200px; }
  }
}

/* Setup */
@layer pages {
  .setup-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;

    & a {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-radius: var(--r-inner);
      background: var(--panel);
      color: var(--muted);
      font-size: 14px;
      font-weight: 600;
      text-decoration: none;
    }
    & .current a { border-color: var(--ink); color: var(--ink); }
    & .done a { color: var(--ink); }
    & .num { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); font-size: 12px; }
    & .done .num { background: var(--good-wash); color: var(--good); border-color: transparent; }
    & .current .num { background: var(--accent); color: var(--on-accent); border-color: transparent; }
    & .num svg { width: 14px; height: 14px; }
  }

  .estimates { display: flex; flex-direction: column; gap: 18px; }
  .estimate small .pill { margin-left: 4px; }
  .estimate .inp { margin-top: 4px; }
  .hours-form { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
  .inp.hours { width: 160px; }

  @media (max-width: 760px) {
    .setup-steps { grid-template-columns: 1fr 1fr; }
  }
}

/* Today's session: the phone-first day-of view */
@layer pages {
  .today-session {
    padding: clamp(18px, 3vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-left: 4px solid var(--accent);

    & .today-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
    & h2 { font-size: clamp(26px, 3.4vw, 34px); }
    & .profile { height: 90px; }
    & .btn.ghost { align-self: flex-start; }
  }

  .targets {
    max-width: 640px;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;

    & li { border-top: 1px solid var(--line); }
    & .repeat-row { padding: 8px 0 2px; font-size: 13px; color: var(--muted); border-top: 0; }
    & .target-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.3fr);
      align-items: baseline;
      gap: 12px;
      padding: 10px 0;
    }
    & .depth-1, & .depth-2 { padding-left: 16px; }
    & .t-name { font-weight: 600; font-size: 15px; }
    & .t-time { color: var(--muted); font-size: 14px; }
    & .t-target {
      text-align: right;
      font-family: var(--display);
      font-weight: 700;
      font-size: clamp(22px, 5vw, 28px);
      letter-spacing: -.02em;
      font-variant-numeric: tabular-nums;
    }
  }
}

/* Connected apps */
@layer pages {
  .connections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

  .connection {
    padding: clamp(18px, 3vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 16px;

    & h2 { font-size: 22px; }
    & .connection-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; }
    & .connection-head p { font-size: 14px; }
  }

  .app-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-family: var(--display);
    font-weight: 700;
    font-size: 20px;
    color: #fff;
  }
  .app-mark.strava { background: #FC4C02; }
  .app-mark.icu { background: var(--ink); color: var(--bg); }

  /* Strava's brand rule: its connect button is orange with white text. */
  .btn.strava-btn { background: #FC4C02; color: #fff; }
  .btn.strava-btn:hover { filter: brightness(1.06); }

  .icu-form { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
  .icu-form .fields { width: 100%; }

  @media (max-width: 1000px) {
    .connections { grid-template-columns: 1fr; }
  }

  @media (max-width: 480px) {
    .connection .connection-head { grid-template-columns: auto minmax(0, 1fr); }
    .connection .connection-head > .pill { grid-column: 2; justify-self: start; }
  }
}

/* Move from TrainingPeaks */
@layer pages {
  .tp-report, .tp-compare { padding: clamp(18px, 3vw, 24px); display: flex; flex-direction: column; gap: 16px; }
  .tp-report .verdict, .tp-compare .verdict { font-size: clamp(20px, 2.4vw, 26px); }
  .tp-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tp-metrics .big { font-size: 40px; }

  .export-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; max-width: 46em; }
  .export-steps b { font-weight: 600; }

  .load-choice { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
  .load-choice fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
  .load-choice legend { font-weight: 600; margin-bottom: 8px; }
  .choice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-inner);
    background: var(--bg);
    cursor: pointer;
    font-size: 14.5px;

    & input { accent-color: var(--accent); margin-top: 4px; width: 18px; height: 18px; }
    &:has(input:checked) { border-color: var(--accent-text); }
  }

  .tblw table.compare td.n { white-space: nowrap; }

  @media (max-width: 1000px) {
    .tp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  @media (max-width: 760px) {
    .tblw table.compare { min-width: 0; }
    .compare th:nth-child(2), .compare td:nth-child(2) { display: none; }
    .compare th, .compare td { padding-inline: 10px; }
  }
}

/* Coach: the morning roster, invites, and notes between coach and athlete */
@layer pages {
  .tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;

    & a {
      padding: 7px 12px;
      border-radius: var(--r-pill);
      color: var(--muted);
      text-decoration: none;
      font-weight: 500;
      font-size: 14.5px;
      white-space: nowrap;
    }
    & a:hover { color: var(--ink); }
    & a[aria-current="page"] { background: var(--ink); color: var(--bg); }
  }

  .roster { display: flex; flex-direction: column; gap: 10px; }
  .roster-empty { padding: 20px 0; }

  .athlete {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-card);

    &.open { border-color: var(--accent); }
  }

  .athlete-head {
    display: grid;
    grid-template-columns: 40px minmax(150px, 1.1fr) auto minmax(0, 2fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--ink);
    text-decoration: none;

    & .who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
    & .who small { font-size: 13px; }
    & .why { font-size: 14px; min-width: 0; }
    & .figs { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
  }

  .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: var(--display);
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    background: oklch(48% .12 var(--hue));
  }

  .flag {
    font-size: 12.5px;
    padding: 5px 10px;
    border-radius: var(--r-pill);
    white-space: nowrap;

    &.warn { background: color-mix(in srgb, var(--fatigue) 16%, transparent); color: color-mix(in srgb, var(--fatigue) 70%, var(--ink)); }
    &.note { background: color-mix(in srgb, var(--actual) 14%, transparent); color: color-mix(in srgb, var(--actual) 75%, var(--ink)); }
    &.calm { background: var(--good-wash); color: var(--good); }
  }

  .athlete-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 18px 18px 72px;

    & .context { display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; }
    & .also { font-size: 13.5px; }
    & .dismiss { align-self: flex-start; }
  }

  .reply-form, .comment-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;

    & textarea {
      width: 100%;
      resize: vertical;
      border: 1px solid var(--line);
      border-radius: var(--r-inner);
      background: var(--bg);
      color: var(--ink);
      padding: 12px 14px;
      font: inherit;
      line-height: 1.45;
    }
    & textarea:focus { outline: 0; border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-wash); }
  }

  .reply-form kbd { font-size: 11px; opacity: .7; margin-left: 4px; }
  @media (hover: none), (max-width: 900px) { .reply-form kbd { display: none; } }

  .invite { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
  .invite-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
  .invite-form .field { flex: 1 1 280px; }
  .invites { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
  .invites li {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--line);

    & > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
    &.fresh .link-box { border-color: var(--accent); }
  }
  .link-box {
    width: 100%;
    font-size: 12.5px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: var(--bg);
    color: var(--ink);
    padding: 8px 10px;
  }

  .notes, .coach-notes { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
  .comment {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border-radius: var(--r-inner);
    background: var(--bg);
    font-size: 15px;

    & .by { font-size: 13.5px; }
    &.mine { background: var(--accent-wash); }
    &.unread { box-shadow: inset 3px 0 0 var(--accent); }
  }

  .rpe-form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
  .rpe-form legend { font-weight: 600; padding: 0; margin-bottom: 10px; }
  .rpe-form legend .muted { font-weight: 400; }
  .rpe { display: flex; flex-wrap: wrap; gap: 6px; }
  .rpe label { position: relative; }
  .rpe input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
  .rpe span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: var(--bg);
    font-size: 14px;
  }
  .rpe input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  .rpe input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-wash); }

  .plain-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
  .coach-share { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }

  @media (max-width: 900px) {
    .athlete-head {
      grid-template-columns: 40px minmax(0, 1fr) auto;
      gap: 6px 12px;

      & .why { grid-column: 2 / -1; }
      & .figs { grid-column: 2 / -1; }
    }
    .athlete-body { padding: 0 16px 16px; }
  }
}

/* Coach: moving a roster from TrainingPeaks, and the workout library */
@layer pages {
  .head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
  .move-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .move-metrics .big { font-size: 40px; }

  .move-step {
    padding: clamp(20px, 4vw, 28px);
    display: flex;
    flex-direction: column;
    gap: 14px;

    & h2 { font-size: 22px; }
    & > p { max-width: 46em; }
    & b { font-weight: 600; }
  }

  .move-add { display: flex; flex-direction: column; gap: 16px; }
  .move-bundle { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px dashed var(--line); border-radius: 12px; }
  .move-bundle > p { margin: 0; max-width: 46em; }

  .move-roster { display: flex; flex-direction: column; }
  .move-athlete {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 0;
    border-top: 1px solid var(--line);

    &:target { border-top-color: var(--accent); }
  }
  .move-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;

    & .who { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 160px; }
    & .who b, & .who small { overflow-wrap: anywhere; }
  }
  .move-preview { font-size: 14.5px; padding-left: 52px; display: flex; flex-direction: column; gap: 4px; }
  .move-actions {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding-left: 52px;
  }
  .drop.compact { padding: 10px 14px; flex-basis: 220px; font-size: 14px; }
  .drop.compact svg { width: 18px; height: 18px; }

  .library td .pill { margin-left: 8px; }
  .library .summary { font-size: 13.5px; min-width: 260px; }
  .library-workout { padding: clamp(20px, 4vw, 28px); display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
  .library-workout .builder-preview { width: 100%; }
  .plan-form { width: 100%; padding-top: 16px; border-top: 1px solid var(--line); }

  @media (max-width: 760px) {
    .move-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .move-actions { grid-template-columns: 1fr; padding-left: 0; }
    .move-preview { padding-left: 0; }
  }
}
