/* Aspire trainer console — premium dark UI. */

:root {
  --bg: #0D0F12;
  --surface: #16191E;
  --surface-2: #1C2026;
  --border: #2A2F37;
  --text: #F2F2F2;
  --muted: #9AA1AB;
  --accent: #E8542F;
  --accent-soft: rgba(232, 84, 47, 0.14);
  --green: #4CC38A;
  --green-soft: rgba(76, 195, 138, 0.14);
  --amber: #E5B04B;
  --amber-soft: rgba(229, 176, 75, 0.14);
  --red: #E5534B;
  --red-soft: rgba(229, 83, 75, 0.12);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
          sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* The [hidden] attribute must win over the display rules below (e.g. the
   topbar's flex containers) so signed-out chrome stays hidden. */
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }
p { margin: 0; }
a { color: var(--text); text-decoration: none; }
code { font-family: var(--mono); font-size: 12px; }

.muted { color: var(--muted); }

/* ------------------------------ top bar -------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  background: rgba(13, 15, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.wordmark {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.wordmark-dot { color: var(--accent); }
.wordmark-sub {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-email { color: var(--muted); font-size: 13px; }

/* ------------------------------ layout --------------------------------- */

.app { max-width: 1080px; margin: 0 auto; padding: 28px 24px 64px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-sub { margin-top: 4px; font-size: 13px; }
.breadcrumb { font-size: 12px; margin-bottom: 4px; }
.breadcrumb a { color: var(--muted); transition: color 120ms ease; }
.breadcrumb a:hover { color: var(--text); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ------------------------------ buttons -------------------------------- */

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease,
              transform 60ms ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #f0603b; }

.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }

.btn-danger-ghost { color: var(--red); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--red-soft); border-color: rgba(229, 83, 75, 0.4); }

.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; }

/* ------------------------------ forms ---------------------------------- */

input, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: #5d646e; }

.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}
.field input, .field textarea, .field select { width: 100%; }
.field textarea { resize: vertical; min-height: 64px; }

/* ------------------------------ login ---------------------------------- */

.login-wrap { display: flex; justify-content: center; padding-top: 9vh; }
.login-card { width: 100%; max-width: 380px; padding: 28px; }
.login-title { font-size: 20px; }
.login-sub { margin: 4px 0 22px; font-size: 13px; }
.login-error {
  margin-bottom: 14px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--red-soft);
  border: 1px solid rgba(229, 83, 75, 0.35);
  color: #f1a9a5;
  font-size: 13px;
}
.login-hint { margin-top: 18px; font-size: 12px; text-align: center; }

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-apple {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #000;
  border-color: #000;
  color: #fff;
}
.btn-apple:hover:not(:disabled) { background: #1a1a1a; border-color: #1a1a1a; }
.btn-apple svg { display: block; }

/* --------------------------- coach gate -------------------------------- */

.gate-card { max-width: 420px; margin: 5vh auto 0; padding: 28px; }
.gate-card-wide { max-width: 520px; }
.gate-title { font-size: 18px; }
.gate-sub { margin: 6px 0 20px; font-size: 13px; }

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

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 560px;
}
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.th-note { text-transform: none; letter-spacing: 0; font-weight: 500; }
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }

.cell-name { font-weight: 600; }
.cell-notes { color: var(--muted); max-width: 240px; }

tr.row-link { cursor: pointer; transition: background 100ms ease; }
tr.row-link:hover, tr.row-link:focus-visible { background: var(--surface-2); outline: none; }

/* ------------------------------ chips ---------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip-xs { padding: 1px 7px; font-size: 10px; }
.chip-completed { background: var(--green-soft); color: var(--green); border-color: rgba(76, 195, 138, 0.3); }
.chip-planned { background: rgba(154, 161, 171, 0.12); color: var(--muted); border-color: rgba(154, 161, 171, 0.28); }
.chip-skipped { background: var(--amber-soft); color: var(--amber); border-color: rgba(229, 176, 75, 0.3); }
.chip-active { background: var(--accent-soft); color: var(--accent); border-color: rgba(232, 84, 47, 0.35); }

/* ------------------------------ roster --------------------------------- */

.add-athlete { display: flex; gap: 8px; }
.add-athlete input { width: 230px; }
.add-athlete #add-athlete-message { width: 300px; }

.adherence { display: flex; align-items: center; gap: 10px; }
.adherence-ratio { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 38px; }
.meter {
  width: 84px;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  flex: none;
}
.meter-fill { display: block; height: 100%; border-radius: 999px; transition: width 300ms ease; }
.meter-good .meter-fill { background: var(--green); }
.meter-mid .meter-fill { background: var(--amber); }
.meter-low .meter-fill { background: var(--accent); }
.meter-empty .meter-fill { background: transparent; }

/* ------------------------------ tabs ----------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 120ms ease, border-color 120ms ease;
}
.tab:hover { color: var(--text); }
.tab-active { color: var(--text); border-bottom-color: var(--accent); }

/* ------------------------------ sessions ------------------------------- */

.session-list { display: flex; flex-direction: column; gap: 10px; }

.session { overflow: hidden; }
.session-head {
  display: grid;
  grid-template-columns: minmax(150px, max-content) 1fr auto 16px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 16px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 100ms ease;
}
.session-head:hover { background: var(--surface-2); }
.session-date { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.upcoming-tag {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.session-template { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-caret { color: var(--muted); transition: transform 150ms ease; justify-self: end; }
.session-open .session-caret { transform: rotate(90deg); }

.session-body { padding: 4px 16px 16px; border-top: 1px solid var(--border); }

.session-section { margin-top: 16px; }
.section-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

.exercise-block { margin-top: 16px; }
.exercise-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 7px; flex-wrap: wrap; }
.exercise-name { font-weight: 650; }
.exercise-meta { font-size: 12px; }
.exercise-note { margin-top: 6px; }

.set-table { min-width: 420px; }
.set-table th, .set-table td { padding: 7px 12px; }
.set-num { color: var(--muted); font-variant-numeric: tabular-nums; width: 44px; }
.set-missed td { color: var(--muted); }

.wellness {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.wellness-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 11px;
}
.wellness-key { font-size: 11px; color: var(--muted); font-weight: 600; }
.wellness-val { font-weight: 650; font-variant-numeric: tabular-nums; }

.note-text { color: var(--muted); font-size: 13px; white-space: pre-wrap; }

.feedback-input { width: 100%; resize: vertical; background: var(--bg); }
.session-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }

/* ------------------------------ plan ------------------------------------ */

.plan-summary { padding: 18px; margin-bottom: 16px; }
.plan-summary-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.plan-goal { font-size: 17px; margin-bottom: 4px; }

.plan-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 32px;
  margin: 16px 0 0;
}
.plan-facts dt {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.plan-facts dd { margin: 2px 0 0; font-weight: 600; }

.templates { display: flex; flex-direction: column; gap: 14px; }
.template { padding: 16px 0 0; }
.template-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 10px;
}
.template .note-text { padding: 0 16px 10px; }
.template-key {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
}

.plan-editor { padding: 18px; }
.plan-editor-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.schema-link { font-size: 12px; }
.schema-link:hover { color: var(--text); }
.editor-hint { margin: 4px 0 12px; font-size: 12px; }

.json-input {
  width: 100%;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
  tab-size: 2;
}

.editor-errors {
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  background: var(--red-soft);
  border: 1px solid rgba(229, 83, 75, 0.35);
  font-size: 13px;
}
.error-title { font-weight: 650; color: #f1a9a5; }
.editor-errors ul { margin: 6px 0 0; padding-left: 18px; }
.editor-errors li { margin-top: 3px; color: #f1c3c0; }
.editor-errors code { color: #f1a9a5; }

/* ------------------------------ states --------------------------------- */

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding: 32px 4px;
  font-size: 13px;
}
.spinner {
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
}
.empty-title { font-weight: 650; font-size: 15px; }
.empty-body { color: var(--muted); margin: 6px auto 14px; max-width: 46ch; }

/* ------------------------------ toasts --------------------------------- */

.toast-host {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  max-width: 340px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms ease, transform 200ms ease;
}
.toast-in { opacity: 1; transform: translateY(0); }
.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }

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

@media (max-width: 860px) {
  .app { padding: 20px 14px 56px; }
  .topbar { padding: 0 14px; }
  .topbar-email { display: none; }
  .page-head { align-items: stretch; flex-direction: column; }
  .page-head > .btn { align-self: flex-start; }
  .add-athlete { width: 100%; }
  .add-athlete input { flex: 1; width: auto; }
  .session-head { grid-template-columns: minmax(110px, max-content) 1fr auto 14px; gap: 10px; padding: 12px; }
  .session-body { padding: 4px 12px 14px; }
  .plan-summary-head { flex-direction: column; }
}

/* ------------------------------ billing -------------------------------- */

.topbar-nav { display: flex; gap: 18px; margin-right: auto; margin-left: 28px; }
.topbar-nav a { color: var(--muted); font-size: 14px; font-weight: 550; }
.topbar-nav a:hover { color: var(--text); }

.banner {
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; font-size: 14px;
  border: 1px solid var(--border); background: var(--surface);
}
.banner-ok { background: var(--green-soft); border-color: rgba(76, 195, 138, 0.4); }
.banner-trial { background: var(--accent-soft); border-color: rgba(232, 84, 47, 0.4); }
.banner-lapsed { background: var(--red-soft); border-color: rgba(229, 83, 75, 0.4); }

.billing-card { padding: 18px 20px; margin-bottom: 16px; }
.billing-h2 { font-size: 15px; margin-bottom: 6px; }
.billing-hint { font-size: 13px; margin-top: 8px; }

.billing-plan-row, .billing-seat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.billing-plan-name { font-size: 17px; font-weight: 650; margin-right: 8px; }
.billing-renew { font-size: 13px; margin-top: 4px; }
.billing-seat-num { font-size: 26px; font-weight: 680; margin-right: 6px; }
.billing-meter { display: block; height: 10px; margin: 12px 0 0; width: 100%; }

.billing-interval { display: flex; gap: 10px; margin-bottom: 14px; }
.billing-plans td { padding: 12px 0; }
.plan-seats { font-weight: 400; font-size: 13px; }
.plan-action { text-align: right; }

.empty-cta { margin-top: 16px; text-align: center; }

/* ===================== Track CB — Plan v2, drafts, Your AI ============== */

/* Block header (season line) */
.block-header { padding: 18px 20px; margin-bottom: 16px; }
.block-header-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.block-goal { font-size: 19px; }
.block-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.block-facts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.block-facts .dot { color: var(--border); }
.block-notes { margin-top: 12px; }
.week-marker {
  font-weight: 650; color: var(--text);
  background: var(--accent-soft); border: 1px solid rgba(232, 84, 47, 0.35);
  border-radius: 6px; padding: 2px 9px; font-size: 12px;
}
.event-badge {
  font-size: 12px; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 11px;
}

/* Intent chips — distinct muted tones */
.intent-chip { font-weight: 600; }
.intent-accumulation { background: rgba(76, 195, 138, 0.14); color: var(--green); border-color: rgba(76, 195, 138, 0.3); }
.intent-intensification { background: rgba(232, 84, 47, 0.14); color: var(--accent); border-color: rgba(232, 84, 47, 0.35); }
.intent-peak { background: rgba(155, 122, 232, 0.16); color: #b09bf0; border-color: rgba(155, 122, 232, 0.35); }
.intent-deload { background: rgba(90, 170, 232, 0.14); color: #6cb2ef; border-color: rgba(90, 170, 232, 0.32); }
.intent-general { background: rgba(154, 161, 171, 0.12); color: var(--muted); border-color: rgba(154, 161, 171, 0.28); }

/* Plan v2 two-column layout */
.plan-v2 { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.plan-main { min-width: 0; }
.plan-actions-row { display: flex; justify-content: flex-end; margin: -6px 0 14px; }
.template-blocks { display: flex; flex-direction: column; gap: 14px; }
.template-block { padding: 16px 0 0; }
.template-block .template-head { align-items: baseline; }
.template-block .note-text { padding: 0 16px 10px; }
.block-grid { min-width: 480px; }
.cell-rx { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-prog { font-size: 12px; }

/* AI attribution banner */
.banner-ai {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--accent-soft); border-color: rgba(232, 84, 47, 0.4);
}

/* History rail */
.history-rail { padding: 14px; position: sticky; top: 72px; }
.rail-title {
  font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}
.history-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 9px 10px; margin-bottom: 4px; color: var(--text);
  transition: background 120ms ease, border-color 120ms ease;
}
.history-item:hover { background: var(--surface-2); border-color: var(--border); }
.history-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-time { font-size: 12px; }
.history-meta { font-size: 12px; margin-top: 4px; }
.src-badge { font-weight: 600; }

/* Version detail + diff */
.version-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.version-detail-title { display: flex; align-items: center; gap: 8px; }
.version-detail-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.version-summary, .version-diff { padding: 16px 18px; }
.spec-summary-tpl { margin-bottom: 14px; }
.spec-summary-tpl:last-child { margin-bottom: 0; }
.spec-summary-list { margin: 0; padding-left: 18px; }
.spec-summary-list li { margin: 3px 0; font-size: 13px; }
.spec-diff .diff-tpl { margin-bottom: 14px; }
.spec-diff .diff-tpl:last-child { margin-bottom: 0; }
.diff-line { font-size: 13px; font-family: var(--mono); margin: 3px 0; }
.diff-add { color: var(--green); }
.diff-remove { color: var(--red); }
.diff-change { color: var(--amber); }
.diff-empty { font-style: italic; }

/* Drafts queue */
.drafts-list { display: flex; flex-direction: column; gap: 14px; }
.draft-card { padding: 16px 18px; }
.draft-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.draft-athlete { font-size: 16px; }
.draft-meta { font-size: 12px; margin-top: 4px; }
.draft-actions { display: flex; gap: 8px; flex-shrink: 0; }
.draft-summary { margin: 10px 0 12px; }
.draft-diff { border-top: 1px solid var(--border); padding-top: 12px; }

/* Your AI page */
.yourai { display: flex; flex-direction: column; gap: 16px; }
.yourai-card { padding: 18px 20px; }
.yourai-h2 { font-size: 15px; }
.yourai-hint { font-size: 13px; margin-top: 6px; }
.copy-field {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 8px 8px 12px;
}
.copy-value { flex: 1; overflow-x: auto; white-space: nowrap; font-size: 13px; }
.copy-btn.copied { color: var(--green); border-color: rgba(76, 195, 138, 0.4); }
.connect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 12px; }
.connect-col h3 { font-size: 14px; margin-bottom: 8px; }
.connect-steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.connect-steps li { margin: 5px 0; }
.consent-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.consent-status { display: flex; align-items: center; }
.consent-actions { margin-top: 14px; }
.prompt-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.prompt-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.prompt-text { font-size: 13px; }

@media (max-width: 860px) {
  .plan-v2 { grid-template-columns: 1fr; }
  .history-rail { position: static; }
  .version-detail-body { grid-template-columns: 1fr; }
  .connect-grid { grid-template-columns: 1fr; }
}

/* ===================== Track CA — Review, roster flags, Analytics,
   Body, Notes ============================================================ */

/* --- Review landing (triage) ------------------------------------------- */
.review-list { display: flex; flex-direction: column; gap: 8px; }
.review-item {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: inherit;
  transition: background 100ms ease, border-color 100ms ease;
}
.review-item:hover { background: var(--surface-2); border-color: #333a44; }
.rq-chip { justify-content: center; text-transform: uppercase; letter-spacing: 0.05em; }
.rq-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rq-athlete { font-weight: 650; }
.rq-summary { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rq-date { font-size: 12px; white-space: nowrap; }
.rq-injury { background: var(--red-soft); color: var(--red); border-color: rgba(229, 83, 75, 0.4); }
.rq-wellness { background: var(--amber-soft); color: var(--amber); border-color: rgba(229, 176, 75, 0.32); }
.rq-missed { background: rgba(229, 83, 75, 0.08); color: #c98783; border-color: rgba(229, 83, 75, 0.22); }
.rq-feedback { background: var(--accent-soft); color: var(--accent); border-color: rgba(232, 84, 47, 0.35); }
.rq-pr { background: var(--green-soft); color: var(--green); border-color: rgba(76, 195, 138, 0.3); }

/* --- Roster row flags --------------------------------------------------- */
.cell-name-row { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adherence-cell { display: inline-flex; align-items: center; gap: 8px; }
.trend { font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.trend-up { color: var(--green); }
.trend-down { color: var(--red); }
.trend-flat { color: var(--muted); }
.flag-injury { background: var(--red-soft); color: var(--red); border-color: rgba(229, 83, 75, 0.4); }
.flag-feedback { background: var(--accent-soft); color: var(--accent); border-color: rgba(232, 84, 47, 0.35); }
.flag-wellness {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber); vertical-align: middle;
  box-shadow: 0 0 0 3px var(--amber-soft);
}

/* --- Segmented controls (shared: analytics weeks, body mode/gender) ---- */
.weeks-seg, .mode-seg, .gender-seg {
  display: inline-flex; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 2px;
}
.seg-btn {
  appearance: none; border: none; background: transparent; color: var(--muted);
  padding: 5px 12px; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background 120ms ease, color 120ms ease;
}
.seg-btn:hover { color: var(--text); }
.seg-active { background: var(--accent); color: #fff; }

/* --- Analytics --------------------------------------------------------- */
.analytics-tab { display: flex; flex-direction: column; gap: 16px; }
.analytics-asof { font-size: 12px; margin-top: 6px; }
.chart-card { padding: 16px 18px; max-width: 672px; }
.chart-title { font-size: 14px; margin-bottom: 12px; }
.chart-body { width: 100%; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.lift-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 12px;
}
.lift-cell {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
}
.lift-name { font-weight: 650; font-size: 13px; margin-bottom: 6px; }
.lift-latest { font-size: 20px; font-weight: 680; font-variant-numeric: tabular-nums; margin-top: 6px; }
.lift-change { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.lift-nodata { font-size: 12px; padding: 10px 0; }
.chg-up { color: var(--green); }
.chg-down { color: var(--red); }
.chg-flat { color: var(--muted); }

/* --- Body tab ---------------------------------------------------------- */
.body-tab { display: flex; flex-direction: column; gap: 18px; }
.body-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.figures { display: flex; gap: 10px; justify-content: center; max-width: 540px; margin: 0 auto; width: 100%; }
.figure { position: relative; flex: 1 1 0; min-width: 0; }
.figure-base { width: 100%; display: block; }
.figure-overlay { position: absolute; inset: 0; width: 100%; height: auto; pointer-events: none; }
/* Ember overlays are orange; this tint rotates them into a legible red for
   injured sites (the master figure is a separate untinted <img>). */
.overlay-injury { filter: sepia(1) saturate(6) hue-rotate(-38deg) brightness(1.05); }
.joint-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.body-caption { text-align: center; font-size: 12px; }

.figures-region, .list-region { width: 100%; }
.injury-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.injury-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 12px 16px; flex-wrap: wrap;
}
.injury-row.injury-resolved { opacity: 0.6; }
.injury-row-main { min-width: 0; flex: 1 1 260px; }
.injury-row-head { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.injury-site { font-weight: 650; }
.injury-kind { text-transform: capitalize; }
.injury-notes { margin-top: 6px; }
.injury-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.injury-edit-form, .injury-add {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; align-items: end;
}
.injury-edit-form { flex-basis: 100%; margin-top: 12px; }
.injury-edit-form[hidden] { display: none; }
.injury-add { margin-top: 12px; }
.injury-add[hidden] { display: none; }
.injury-edit-form .field, .injury-add .field { margin-bottom: 0; }
.injury-edit-form input, .injury-edit-form select, .injury-edit-form textarea,
.injury-add input, .injury-add select, .injury-add textarea { width: 100%; }
.field-wide { grid-column: 1 / -1; }
.injury-edit-form .session-actions, .injury-add .session-actions { grid-column: 1 / -1; margin-top: 0; }
.injury-add-wrap { margin-top: 6px; }

/* --- Notes tab --------------------------------------------------------- */
.notes-tab { display: flex; flex-direction: column; gap: 14px; }
.notes-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  appearance: none; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px; transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.filter-chip:hover { color: var(--text); }
.filter-active { background: var(--accent-soft); color: var(--accent); border-color: rgba(232, 84, 47, 0.4); }
.filter-toggle { margin-left: auto; }

.note-add { padding: 14px 16px; }
.note-add-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.note-kind-select { padding: 6px 10px; }
.note-pin-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.note-add-text { width: 100%; resize: vertical; }

.notes-list { display: flex; flex-direction: column; gap: 10px; }
.note-row { padding: 12px 16px; }
.note-row.note-archived { opacity: 0.6; }
.note-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.note-head-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.note-pin {
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 17px; line-height: 1; padding: 2px;
  transition: color 120ms ease, transform 60ms ease;
}
.note-pin:hover { color: var(--text); }
.note-pin.pinned { color: var(--amber); }
.note-pin:active { transform: scale(0.9); }
.note-body { margin: 8px 0; white-space: pre-wrap; }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.note-byline { font-size: 12px; }
.note-actions { display: flex; gap: 6px; }
.note-editor { margin: 8px 0; }
.note-via-ai { background: var(--accent-soft); color: var(--accent); border-color: rgba(232, 84, 47, 0.35); }
.note-kind { background: rgba(154, 161, 171, 0.12); color: var(--muted); border-color: rgba(154, 161, 171, 0.28); }
.note-kind-constraint { background: var(--red-soft); color: #e08c86; border-color: rgba(229, 83, 75, 0.3); }
.note-kind-preference { background: rgba(90, 170, 232, 0.14); color: #6cb2ef; border-color: rgba(90, 170, 232, 0.32); }
.note-kind-response { background: var(--green-soft); color: var(--green); border-color: rgba(76, 195, 138, 0.3); }
.note-kind-life { background: rgba(155, 122, 232, 0.16); color: #b09bf0; border-color: rgba(155, 122, 232, 0.35); }
.note-kind-retrospective { background: var(--amber-soft); color: var(--amber); border-color: rgba(229, 176, 75, 0.3); }

/* --- Plan tab side column (history rail + pinned notes rail) ------------ */
.plan-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 72px; }
.plan-side .history-rail { position: static; }
.notes-rail { padding: 14px; }
.rail-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.rail-link { font-size: 12px; color: var(--muted); }
.rail-link:hover { color: var(--text); }
.rail-note { padding: 8px 0; border-top: 1px solid var(--border); }
.rail-note:first-of-type { border-top: none; }
.rail-note-text { font-size: 13px; margin-top: 6px; white-space: pre-wrap; }

@media (max-width: 860px) {
  .plan-side { position: static; }
  .review-item { grid-template-columns: 72px 1fr; }
  .review-item .rq-date { grid-column: 2; }
  .figures { max-width: 100%; }
  .body-controls { flex-direction: column; align-items: stretch; }
}
