/* MOVE Coach — Programs (programs.js, 2026-10-18): laid out like TrainHeroic's coach side.
   A rail of calendars (team · groups · catchers) beside a Mon–Sun week grid of workout
   cards; a program builder of weeks × days; progressions as a ladder of levels. Light or
   dark from shell.css's tokens. Loaded after shell.css. */

.pg-ph { margin-bottom: 14px; }
.pg-tabs { display: flex; gap: 22px; border-bottom: .5px solid var(--line-hi); margin: 0 0 20px; overflow-x: auto; }
.pg-tabs button {
  flex: none; background: none; border: 0; padding: 0 0 11px; margin-bottom: -.5px; cursor: pointer;
  font-size: 15px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent;
}
.pg-tabs button:hover { color: var(--text); }
.pg-tabs button.on { color: var(--text); font-weight: 600; border-bottom-color: var(--cyan); }

/* ---- Calendar ---- */
.pg-cal { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 16px; align-items: start; }
.pg-rail { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 1px; max-height: calc(100vh - 32px); overflow-y: auto; }
.pg-rail-h {
  display: flex; align-items: center; justify-content: space-between; margin: 14px 8px 4px;
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.pg-rail-h:first-child { margin-top: 0; }
.pg-rail-h .linkbtn { display: inline-flex; align-items: center; gap: 2px; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--cyan); background: none; border: 0; cursor: pointer; }
.pg-rail-h .linkbtn svg { width: 14px; height: 14px; }
.pg-rail-note { margin: 2px 8px 6px; }
.pg-pick {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 36px; padding: 6px 8px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font-size: 14px; text-align: left; cursor: pointer;
}
.pg-pick > span:not(.avatar):not(.dr-n) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-pick svg { color: var(--muted); flex: none; }
.pg-pick:hover { background: var(--hover); }
.pg-pick.on { background: var(--tint-soft); color: var(--cyan); font-weight: 600; }
.pg-pick.on svg { color: var(--cyan); }
.pg-pick-row { display: flex; align-items: center; }
.pg-pick-row .pg-pick { flex: 1; min-width: 0; }
.pg-pick-edit { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 6px; cursor: pointer; opacity: 0; }
.pg-pick-row:hover .pg-pick-edit, .pg-pick-edit:focus-visible { opacity: 1; }
.pg-pick-edit:hover { color: var(--text); background: var(--hover); }

.pg-main { min-width: 0; }
.pg-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 12px; }
.pg-nav { display: flex; align-items: center; gap: 6px; }
.pg-nav .iconbtn { width: 34px; height: 34px; }
.pg-range { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.pg-range b { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.pg-hint {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; margin-bottom: 12px;
  border-radius: var(--r-inner); background: var(--tint-soft);
}
.pg-hint b { font-weight: 600; }
.pg-hint .note { flex: 1; }

.pg-heads, .pg-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.pg-heads span { padding: 0 8px 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pg-weeks { display: flex; flex-direction: column; gap: 6px; }
.pg-day {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 420px; padding: 7px 5px 34px;
  background: var(--surface); border-radius: 12px; transition: box-shadow .12s;
}
.pg-weeks.compact .pg-day { min-height: 128px; }
.pg-day.past { background: color-mix(in srgb, var(--surface) 65%, transparent); }
.pg-day.past .pg-wo { opacity: .72; }
.pg-day-h { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 2px; }
.pg-day-h b { font-size: 15px; font-weight: 600; }
.pg-day.today .pg-day-h b {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
  background: var(--cyan); color: var(--ink);
}
.pg-day.drop-on, .pg-cell.drop-on { box-shadow: 0 0 0 2px var(--cyan) inset; }
.pg-add {
  position: absolute; left: 6px; right: 6px; bottom: 6px; height: 24px; display: grid; place-items: center;
  border: 1px dashed var(--line-hi); border-radius: 8px; background: none; color: var(--muted); cursor: pointer; opacity: 0;
}
.pg-day:hover .pg-add, .pg-add:focus-visible { opacity: 1; }
.pg-add:hover { color: var(--cyan); border-color: var(--cyan); }
.pg-add svg { width: 15px; height: 15px; }

/* A workout card: the program's colour down its left edge, lettered lines, the plan it's from. */
.pg-wo, .pg-cell:not(.empty) {
  display: flex; flex-direction: column; gap: 5px; width: 100%; padding: 8px 9px 8px 11px; text-align: left; cursor: pointer;
  border: 0; border-radius: 9px; color: var(--text); font-size: 12px; line-height: 1.3;
  background: color-mix(in srgb, var(--pc, var(--cyan)) 11%, var(--surface-hi));
  box-shadow: 3px 0 0 var(--pc, var(--cyan)) inset;
}
.pg-wo:hover, .pg-cell:not(.empty):hover { background: color-mix(in srgb, var(--pc, var(--cyan)) 18%, var(--surface-hi)); }
.pg-wo.dragging, .pg-cell.dragging { opacity: .4; }
.pg-wo-t { font-size: 13px; font-weight: 600; }
.pg-wo-items { display: flex; flex-direction: column; gap: 3px; }
.pg-wo-items > span { display: grid; grid-template-columns: 14px minmax(0, 1fr); column-gap: 4px; }
.pg-wo-items i { font-style: normal; font-weight: 700; color: var(--pc, var(--cyan)); }
.pg-wo-name { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pg-wo-items em { grid-column: 2; font-style: normal; color: var(--muted); }
.pg-wo-n, .pg-wo-src { color: var(--muted); font-size: 11px; }
.pg-wo-src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Drafts (2026-10-22): written by the coach's own AI, for nobody until published.
   Amber, dashed, with a Draft badge; published plans look as before. ---- */
.pg-draft-badge {
  display: inline-flex; align-items: center; flex: none; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--warn); background: var(--warn-soft);
}
.pg-wo.draft { background: none; box-shadow: none; outline: 1.5px dashed var(--warn); outline-offset: -1.5px; }
.pg-wo.draft:hover { background: var(--warn-soft); }
.pg-wo.draft .pg-wo-src { color: var(--warn); font-weight: 600; }
.pg-card.draft { outline: 1.5px dashed var(--warn); outline-offset: -1.5px; }
.pg-card.draft .pg-draft-badge { margin-bottom: 2px; }
.pg-drafts {
  display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; padding: 10px 12px;
  border-radius: var(--r-inner); background: var(--warn-soft);
}
.pg-drafts-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding-bottom: 4px; }
.pg-drafts-h b { font-weight: 600; }
.pg-draft-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 6px 0; }
.pg-draft-row + .pg-draft-row { border-top: .5px solid var(--line-hi); }
.pg-draft-t { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.pg-draft-t b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-draft-t .note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-draft-act { display: flex; gap: 6px; flex: none; }
.pg-draft-one { margin: -6px 0 16px; }
.pg-draft-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* ---- Programs and progressions lists ---- */
.pg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.pg-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 140px; padding: 20px 18px 16px;
  border: 0; border-radius: var(--r-tile); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; overflow: hidden;
  transition: transform .12s, box-shadow .12s;
}
.pg-card:hover { transform: translateY(-1px); box-shadow: 0 10px 30px -18px rgba(0,0,0,.6); }
.pg-card-bar { position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--pc); }
.pg-card b { font-size: 17px; font-weight: 600; }
.pg-card-about { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pg-card-on { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.pg-steps-mini { display: flex; gap: 4px; margin-top: 6px; }
.pg-steps-mini span {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: 11px; font-weight: 700;
  background: color-mix(in srgb, var(--pc) 18%, transparent); color: var(--pc);
}
.vr-empty .btn { margin-top: 10px; align-self: flex-start; }

/* ---- Program builder ---- */
.pg-bhead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 8px 0 18px; padding-left: 14px; box-shadow: 4px 0 0 var(--pc) inset; }
.pg-bhead > div { flex: 1; min-width: 200px; }
.pg-bhead h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.pg-bhead p { margin: 2px 0 0; }
.pg-builder { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; overflow-x: auto; }
.pg-brow { display: grid; grid-template-columns: 110px repeat(7, minmax(118px, 1fr)); gap: 6px; align-items: stretch; }
.pg-bheads span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0 8px; }
.pg-wk { display: flex; flex-direction: column; gap: 4px; padding: 8px 4px; }
.pg-wk b { font-size: 14px; font-weight: 600; }
.pg-wk .linkbtn { padding: 0; text-align: left; font-size: 12px; background: none; border: 0; color: var(--cyan); cursor: pointer; }
.pg-wk .linkbtn.danger { color: var(--bad); }
.pg-cell { min-height: 130px; }
.pg-cell.empty {
  display: grid; place-items: center; border: 1px dashed var(--line-hi); border-radius: 9px; background: none; color: var(--dim); cursor: pointer;
}
.pg-cell.empty:hover { color: var(--cyan); border-color: var(--cyan); background: var(--tint-soft); }

/* ---- A progression ---- */
.pg-ladder { display: flex; align-items: stretch; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; }
.pg-step {
  flex: 0 0 210px; display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: var(--r-tile); background: var(--surface);
}
.pg-step-n { font-size: 12px; font-weight: 700; color: var(--cyan); text-transform: uppercase; letter-spacing: .04em; }
.pg-step-thumb {
  position: relative; aspect-ratio: 16 / 9; width: 100%; border: 0; padding: 0; border-radius: 8px; overflow: hidden; cursor: pointer;
  background: #000; display: grid; place-items: center; color: #fff;
}
.pg-step-thumb:disabled { cursor: default; background: var(--surface-hi); }
.pg-step-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pg-step-thumb .vr-play { position: relative; }
.pg-step b { font-size: 15px; font-weight: 600; }
.pg-goal { font-size: 13px; color: var(--text); background: var(--fill); border-radius: 6px; padding: 4px 7px; align-self: flex-start; }
.pg-step-who { margin-top: auto; font-size: 12px; color: var(--muted); }
.pg-step-arrow { align-self: center; color: var(--dim); flex: none; }
.pg-roster-p { margin-bottom: 20px; }
.pg-roster td { vertical-align: middle; }
.pg-who { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.pg-meter { display: inline-flex; flex-direction: column; margin-right: 8px; vertical-align: middle; }
.pg-meter b { font-weight: 600; }
.pg-meter.ready b { color: var(--good); }
.pg-row-act { text-align: right; white-space: nowrap; }
.pg-row-act .btn { margin-left: 4px; }
.pg-row-act .btn svg { width: 15px; height: 15px; }

/* ---- Sheets: the workout editor and the progression's levels ---- */
.st-sheet.pg-confirm-sheet { width: min(400px, 100%); padding: 20px; }
.pg-confirm { margin: 0 0 18px; line-height: 1.45; }
.st-sheet.pg-sheet { width: min(860px, 100%); }
.pg-form .field input:not([type=checkbox]), .pg-form .field select { font-size: 14px; }
.pg-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.pg-item {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 150px auto; gap: 10px; align-items: start;
  padding: 10px; border-radius: var(--r-inner); background: var(--fill);
}
.pg-level { grid-template-columns: 28px minmax(0, 1fr) auto; }
.pg-letter {
  display: grid; place-items: center; width: 28px; height: 28px; margin-top: 5px; border-radius: 8px;
  background: var(--cyan); color: var(--ink); font-weight: 700; font-size: 13px;
}
.pg-item-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pg-item-main input, .pg-item-main select, .pg-dose input { padding: 8px 10px !important; }
.pg-dose { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.pg-dose span { color: var(--muted); }
.pg-dose input { width: 100%; text-align: center; }
.pg-item-act { display: flex; gap: 4px; }
.pg-item-act .iconbtn { width: 30px; height: 30px; }
.pg-item-act .iconbtn:disabled { opacity: .3; }
/* A line's video: thumbnail to play, then Replace / Remove; or Add video. */
.pg-vid { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-height: 32px; }
.pg-vid-thumb {
  position: relative; width: 96px; aspect-ratio: 16 / 9; flex: none; border: 0; padding: 0; border-radius: 7px; overflow: hidden;
  background: #000; color: #fff; display: grid; place-items: center; cursor: pointer;
}
span.pg-vid-thumb { cursor: default; background: var(--surface-hi); }
.pg-vid-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pg-vid-thumb .vr-play { position: relative; width: 28px; height: 28px; }
.pg-vid-thumb .vr-dur { right: 4px; bottom: 4px; font-size: 10px; padding: 1px 4px; }
.pg-vid-thumb:hover .vr-play { transform: scale(1.08); }
.pg-vid-t { font-size: 13px; font-weight: 600; margin-right: auto; }
.pg-vid .linkbtn { cursor: pointer; }
.pg-vid-add { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.pg-wo-vid { display: inline-grid; vertical-align: -1px; margin-right: 4px; color: var(--pc, var(--cyan)); }
.st-sheet.pg-play-sheet { width: min(860px, 100%); }
.pg-goalrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.pg-goalrow select { width: auto !important; flex: 1 1 200px; }
.pg-goalrow input { width: 84px !important; text-align: center; }
.pg-op { font-weight: 700; }
.pg-gchip { display: inline-flex; align-items: center; gap: 2px; cursor: pointer; padding: 5px 10px; }
.pg-gchip svg { width: 13px; height: 13px; }
.st-recip small { margin-left: auto; }

@media (max-width: 1100px) {
  .pg-cal { grid-template-columns: 1fr; }
  .pg-rail { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .pg-rail-h { width: 100%; margin: 6px 4px 0; }
  .pg-rail .pg-pick, .pg-pick-row { width: auto; }
  .pg-pick { border-radius: 999px; background: var(--fill); padding: 5px 12px; min-height: 32px; }
  .pg-pick-edit { opacity: 1; }
}
@media (max-width: 760px) {
  /* One scrolling row of calendars; the headings fold away, "+ New" group stays. */
  .pg-rail { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .pg-rail > *, .pg-pick-row .pg-pick { flex: none; }
  .pg-rail-h { width: auto; margin: 0; font-size: 0; }
  .pg-rail-h .linkbtn { font-size: 13px; white-space: nowrap; padding: 6px 8px; }
  .pg-rail-h:not(:has(.linkbtn)), .pg-rail-note { display: none; }
  .pg-pick > span:not(.avatar):not(.dr-n) { overflow: visible; }
  .pg-heads { display: none; }
  .pg-week { grid-template-columns: 1fr; }
  .pg-day { min-height: 0; }
  .pg-weeks.compact .pg-day { min-height: 0; }
  .pg-day-h b::before { content: attr(data-wd); }
  .pg-add { opacity: 1; }
  .pg-item { grid-template-columns: 28px minmax(0, 1fr); }
  .pg-dose, .pg-item-act { grid-column: 2; }
}
.pg-confirm-sheet .btn.danger, .pg-sheet .btn.danger, .dr-form .btn.danger { color: var(--bad); }
.pg-confirm-sheet .btn.danger:not(.ghost) { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.linkbtn.danger { color: var(--bad); background: none; border: 0; cursor: pointer; padding: 0; }
