/* ============================================================
   STUDENT PAGES (Learning: dashboard, my-progress, review, goals;
   Riding: coaching, riding-goals, training)
   Loaded after site.css and lab.css on body.lab pages, so it uses
   the Lab's dark tokens. Everything here is for signed-in students:
   the section tabs, this-week tiles, skill meters, activity lists
   and the review cards.

   Status colors (always shown with an icon and a word, never alone):
     strong = green, developing = blue, needs practice = rust,
     not enough data = no color.
   These three were checked together on the dark card surface for
   color-blind separation, lightness and contrast; the Lab's own moss
   and contour gold are too close to each other to tell apart, so
   don't swap them back in.
   ============================================================ */
body.lab {
  --st-strong: #58A862;
  --st-developing: #4F97EA;
  --st-needs: #E36A40;
}

.student-head { padding-bottom: 36px; }
.student-head .page-title { font-size: clamp(40px, 6.4vw, 76px); }
.student-head .hero-lede { max-width: 40rem; }

/* ---------- section tabs ---------- */
.student-tabs { border-bottom: 1px solid var(--rule); background: var(--panel); }
.student-tabs ul {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.student-tabs ul::-webkit-scrollbar { display: none; }
.student-tabs a {
  display: block;
  padding: 16px 0 14px;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
}
.student-tabs a:hover { color: var(--ink); }
.student-tabs a[aria-current="page"] { color: var(--ink); border-color: var(--blaze); }
.student-tabs .tab-count {
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--ink);
}

/* ---------- page sections ---------- */
.student-section { padding: 56px 0; }
.student-section + .student-section { border-top: 1px solid var(--rule); }
.student-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 26px;
}
.student-section-head .meta { max-width: 34rem; }
.student-state { padding: 72px 0; }
.student-state p { max-width: 36rem; color: var(--text); }
.student-empty {
  padding: 26px 24px;
  border: 1px dashed var(--rule);
  color: var(--text);
  max-width: 44rem;
}
.student-empty p { margin: 0 0 14px; }
.student-empty p:last-child { margin-bottom: 0; }
.student-note { margin: 18px 0 0; font-size: 13.5px; color: var(--ink-soft); max-width: 46rem; }

/* ---------- this week: stat tiles ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  list-style: none;
  margin: 0;
  padding: 0;
}
.stat { background: var(--cream); padding: 20px 20px 18px; min-width: 0; }
.stat-label { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-soft); }
.stat-value {
  margin: 0;
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.05;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-value small { font-size: 16px; font-weight: 500; color: var(--ink-soft); }
.stat-sub { margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); }
.stat-sub a { color: var(--ink); }
.stat--empty .stat-value { color: var(--ink-soft); }

/* ---------- next steps ---------- */
.rec-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; list-style: none; margin: 0; padding: 0; }
.rec {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 20px;
  background: var(--cream);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--blaze);
}
.rec-kicker { margin: 0; font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.rec-title { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: 24px; line-height: 1.05; text-transform: uppercase; color: var(--ink); }
.rec-why { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--text); flex: 1; }
.rec .read-link { align-self: flex-start; }

/* ---------- skills ---------- */
.skill-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.skill {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(140px, 2fr) minmax(150px, auto);
  align-items: center;
  gap: 8px 22px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}
.skill-name { margin: 0; font-weight: 600; font-size: 16px; color: var(--ink); }
.skill-name small { display: block; margin-top: 3px; font-weight: 400; font-size: 13px; color: var(--ink-soft); }
.skill-figure { display: flex; align-items: center; gap: 14px; min-width: 0; }
.skill-pct { flex: 0 0 3.2em; font-weight: 600; font-size: 18px; font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; }
.meter { flex: 1; height: 8px; border-radius: 999px; overflow: hidden; background: var(--tint); }
.meter > span { display: block; height: 100%; border-radius: 999px; min-width: 2px; }
.meter--strong { background: rgba(88, 168, 98, 0.22); }
.meter--strong > span { background: var(--st-strong); }
.meter--developing { background: rgba(79, 151, 234, 0.22); }
.meter--developing > span { background: var(--st-developing); }
.meter--needs_practice { background: rgba(227, 106, 64, 0.22); }
.meter--needs_practice > span { background: var(--st-needs); }
.skill-detail { margin: 0; font-size: 13px; color: var(--ink-soft); grid-column: 2 / -1; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  color: var(--ink);
  white-space: nowrap;
}
.status-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-soft);
  font-size: 12px;
  line-height: 1;
  color: var(--ink-soft);
}
.status--strong .status-icon { border-color: var(--st-strong); color: var(--st-strong); }
.status--developing .status-icon { border-color: var(--st-developing); color: var(--st-developing); }
.status--needs_practice .status-icon { border-color: var(--st-needs); color: var(--st-needs); }
.status--not_enough_data { color: var(--ink-soft); }
.trend { font-size: 13px; color: var(--ink-soft); }

@media (max-width: 720px) {
  .skill { grid-template-columns: 1fr auto; }
  .skill-figure { grid-column: 1 / -1; grid-row: 2; }
  .skill-detail { grid-column: 1 / -1; }
}

/* ---------- goals ---------- */
.goal-count { flex-basis: 5.2em; font-size: 16px; }
.goal-actions { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.goal-actions button {
  background: none;
  border: 0;
  padding: 0 0 2px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
.goal-actions button:hover { color: var(--blaze); border-color: var(--blaze); }
.goal-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px 20px; align-items: end; max-width: 60rem; padding: 22px; background: var(--cream); border: 1px solid var(--rule); }
.goal-form label { display: flex; flex-direction: column; gap: 6px; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.goal-form select, .goal-form input {
  font: inherit;
  font-family: var(--f-body);
  font-size: 16px;
  text-transform: none;
  letter-spacing: 0;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 0;
  color-scheme: dark;
}
.goal-form select:focus, .goal-form input:focus { outline: 2px solid var(--blaze); outline-offset: 1px; }
.goal-form .goal-wide { grid-column: 1 / -1; }
.goal-preview { margin: 0; font-size: 16px; color: var(--ink); }
.goal-preview b { font-weight: 600; }

/* ---------- activity and history lists ---------- */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.row-title { margin: 0; font-weight: 600; color: var(--ink); }
.row-meta { margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.row-side { text-align: right; font-size: 14px; color: var(--text); white-space: nowrap; }
.row-body { grid-column: 1 / -1; margin: 2px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
/* Right / not yet: the words stay in the text color; only the tick or cross is colored. */
.mark { display: inline-block; font-family: var(--f-mono); font-size: 12.5px; white-space: nowrap; color: var(--ink); }
.mark--right::first-letter { color: var(--st-strong); }
.mark--wrong::first-letter { color: var(--st-needs); }
.answer { font-family: var(--f-mono); font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }

/* ---------- filters ---------- */
.student-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 20px; margin-bottom: 24px; }
.student-filters label { display: flex; flex-direction: column; gap: 6px; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.student-filters select {
  font: inherit;
  font-family: var(--f-body);
  font-size: 15px;
  text-transform: none;
  letter-spacing: 0;
  padding: 9px 12px;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: 0;
}
.student-filters select:focus { outline: 2px solid var(--blaze); outline-offset: 1px; }
.student-count { margin: -8px 0 18px; }
.lab button.button { color: var(--lab-deep); }
.button--quiet {
  background: transparent;
  color: var(--ink) !important;
  border: 1px solid var(--rule) !important;
  padding: 12px 20px;
}
.button--quiet:hover { background: var(--tint) !important; }

/* ---------- review cards ---------- */
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.review-card { background: var(--cream); border: 1px solid var(--rule); }
.review-card[data-open="true"] { border-color: rgba(236, 239, 231, 0.3); }
.review-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 20px;
  width: 100%;
  padding: 18px 20px;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.review-summary:hover .review-title { color: var(--blaze); }
.review-summary:focus-visible { outline: 2px solid var(--blaze); outline-offset: -2px; }
.review-title { margin: 0; font-weight: 600; font-size: 17px; color: var(--ink); }
.review-preview { margin: 0; font-size: 14.5px; color: var(--text); grid-column: 1 / -1; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.review-facts { margin: 0; grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-soft); }
.review-body { padding: 4px 20px 22px; border-top: 1px solid var(--rule); }
.review-body h3 { margin: 22px 0 8px; font-family: var(--f-mono); font-weight: 500; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.problem { margin: 0; font-size: 17px; line-height: 1.55; color: var(--ink); overflow-wrap: anywhere; }
.problem-math { margin: 12px 0 0; font-size: 19px; overflow-x: auto; color: var(--ink); }
.problem-context { margin: 12px 0 0; padding: 0; list-style: none; font-size: 14.5px; color: var(--text); }
.problem-context li { margin: 3px 0; }
.problem-context b { font-weight: 600; color: var(--ink); }
.problem-graph { display: block; width: 100%; max-width: 420px; height: auto; margin-top: 14px; background: var(--bg); border: 1px solid var(--rule); }
.tries { list-style: none; margin: 0; padding: 0; font-size: 14.5px; color: var(--text); }
.tries li { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 5px 0; }
.retry { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.retry .input { width: auto; flex: 1 1 200px; max-width: 320px; }
.lab .input { border-color: var(--rule); }
.retry-unit { color: var(--ink-soft); }
.choices { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
.choices label { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border: 1px solid var(--rule); cursor: pointer; color: var(--ink); }
.choices label:has(input:checked) { border-color: var(--blaze); background: var(--tint); }
.choices input { margin-top: 3px; accent-color: var(--blaze); }
.feedback { margin: 16px 0 0; padding: 14px 16px; border-left: 3px solid var(--chalk); background: var(--tint); color: var(--ink); font-size: 15.5px; line-height: 1.5; }
.feedback--right { border-color: var(--st-strong); }
.feedback--wrong { border-color: var(--blaze); }
.feedback p { margin: 0 0 8px; }
.feedback p:last-child, .feedback ol:last-child { margin-bottom: 0; }
.feedback ol { margin: 6px 0 0; padding-left: 22px; }
.review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 20px; }
.format-hint { margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); }

@media (max-width: 640px) {
  .student-section { padding: 40px 0; }
  .stat-value { font-size: 28px; }
  .review-summary, .review-body { padding-left: 16px; padding-right: 16px; }
}

/* ============================================================
   MTB COACHING (coaching.html, riding-goals.html, training.html)
   Same tokens and status colors as the Learning pages.
   ============================================================ */
.ride-goal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.ride-goal {
  display: grid;
  gap: 12px;
  padding: 20px;
  background: var(--cream);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--st-developing);
}
.ride-goal--done { border-left-color: var(--st-strong); }
.ride-goal-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 20px; }
.ride-goal-title { margin: 6px 0 0; font-family: var(--f-body); font-weight: 600; font-size: 19px; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.ride-goal-parent { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-soft); }
.ride-goal .row-meta { margin: 0; }
.ride-goal .meter { flex: none; max-width: 420px; }
.ride-mini { margin: 0 0 8px; font-family: var(--f-mono); font-weight: 500; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }

.ride-notes { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14.5px; line-height: 1.5; }
.ride-notes dt { color: var(--ink-soft); font-size: 13px; padding-top: 1px; }
.ride-notes dd { margin: 0; color: var(--text); overflow-wrap: anywhere; white-space: pre-line; }
.ride-notes--log { grid-column: 1 / -1; margin-top: 6px; }

.ride-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ride-steps li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ride-steps label { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; cursor: pointer; color: var(--ink); font-size: 15px; }
.ride-steps input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--st-strong); flex: none; }
.ride-steps input:checked + span { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--ink-soft); }
.ride-x { background: none; border: 0; padding: 4px 8px; font-size: 18px; line-height: 1; color: var(--ink-soft); cursor: pointer; }
.ride-x:hover, .ride-x:focus-visible { color: var(--blaze); }
.ride-add-step { display: flex; flex-wrap: wrap; gap: 10px; }
.ride-add-step input {
  flex: 1 1 240px; min-width: 0; font: inherit; font-size: 15px; padding: 9px 12px;
  color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 0;
}
.ride-add-step input:focus { outline: 2px solid var(--blaze); outline-offset: 1px; }
.ride-add-step .button { padding: 9px 16px; }

.ride-form textarea {
  font: inherit; font-family: var(--f-body); font-size: 16px; line-height: 1.45; text-transform: none; letter-spacing: 0;
  padding: 10px 12px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 0; resize: vertical;
}
.ride-form textarea:focus { outline: 2px solid var(--blaze); outline-offset: 1px; }
.ride-form textarea::placeholder, .ride-form input::placeholder, .ride-add-step input::placeholder { color: var(--ink-soft); opacity: 0.8; }
.ride-form .format-hint { margin: -4px 0 0; }
.ride-form-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.ride-form select:disabled { opacity: 0.6; }
.ride-areas { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.ride-areas legend { padding: 0; margin-bottom: 10px; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.goal-form .ride-areas label { flex-direction: row; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--rule); cursor: pointer;
  font-family: var(--f-body); font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--ink); }
.ride-areas label:has(input:checked) { border-color: var(--st-strong); background: var(--tint); }
.ride-areas input { margin: 0; accent-color: var(--st-strong); }

.plan-details { white-space: pre-line; color: var(--text); font-size: 14px; }
.ride-log-actions { grid-column: 1 / -1; margin: 6px 0 0; }

.coach-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.coach { padding: 18px 20px; background: var(--cream); border: 1px solid var(--rule); }
.coach-name { margin: 0 0 4px; font-weight: 600; font-size: 18px; color: var(--ink); }
.coach-bio { margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--text); }

@media (max-width: 640px) {
  .ride-goal { padding: 16px; }
  .ride-notes { grid-template-columns: 1fr; gap: 2px; }
  .ride-notes dd { margin-bottom: 8px; }
}

/* ---------- "Working in" (organizations) ---------- */
.student-org { margin-top: 18px; }
.org-switch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; font-size: 15px; color: var(--ink-soft); }
.org-switch-row--one { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.org-switch-label { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.org-switch { font: inherit; font-size: 15px; padding: 8px 12px; color: var(--ink); background: var(--cream); border: 1px solid var(--rule); border-radius: 0; max-width: 100%; }
.org-switch:focus { outline: 2px solid var(--blaze); outline-offset: 1px; }
.org-note { margin: 10px 0 0; padding: 10px 14px; border-left: 3px solid var(--blaze); background: var(--tint); color: var(--ink); font-size: 14.5px; max-width: 44rem; }
.org-manage { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 12px 0 0; font-size: 15px; }

/* ---------- "Your school" (js/org.js drawSchool): dashboard + admin preview ---------- */
.school { --org-accent: var(--moss); border-left: 4px solid var(--org-accent); padding: 4px 0 4px 22px; max-width: 60rem; }
.school-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.school-logo { width: 64px; height: 64px; object-fit: contain; background: var(--cream); border: 1px solid var(--rule); padding: 4px; }
.school-eyebrow { margin: 0 0 4px; font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--org-accent); }
.school-name { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: clamp(26px, 4vw, 38px); line-height: 1.05; text-transform: uppercase; color: var(--ink); }
.school-welcome { margin: 0 0 18px; max-width: 44rem; color: var(--text); font-size: 17px; white-space: pre-line; }
.school-group { margin-top: 18px; }
.school-group-title { margin: 0 0 8px; font-family: var(--f-mono); font-size: 12.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.school-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px 22px; }
.school-list li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--rule-soft); }
.school-list a { color: var(--ink); font-weight: 600; text-decoration-color: var(--org-accent); text-underline-offset: 3px; }
.school-list a:hover { color: var(--org-accent); }
.school-desc { font-size: 14px; color: var(--ink-soft); }
.school-empty { margin: 8px 0 0; color: var(--ink-soft); }
.school-section { padding-bottom: 40px; }
