/* =============================================================================
   Athlete Profile — Full athlete-facing portal experience
   Prefix: ap- (profile shell + tabs), apd- (workout detail panel)
   Athlete portal colour: #185FA5 (blue). Teal #14b8a6 is accent only.
   border-radius: 0 everywhere. Circular avatars are the only exception.
   ============================================================================= */

/* ============================== PAGE SHELL ================================= */

.ap-page { font-size: 14px; color: #1a1a18; }

/* Profile header */
.ap-header {
  background: #fff;
  border-bottom: 0.5px solid #e0e0dc;
  padding: 20px 24px 0;
}
.ap-header-row { display: flex; gap: 16px; align-items: flex-start; }
.ap-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #185FA5;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600;
  flex-shrink: 0;
}
.ap-header-info { flex: 1; min-width: 0; }
.ap-name { font-size: 18px; font-weight: 500; margin-bottom: 2px; }
.ap-meta { font-size: 12px; color: #666; margin-bottom: 6px; }
.ap-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-badge {
  display: inline-flex; padding: 2px 8px;
  font-size: 10px; font-weight: 500; border-radius: 0;
}
.ap-badge-active   { background: #E1F5EE; color: #085041; }
.ap-badge-inactive { background: #f0f0ee; color: #666; }
.ap-badge-level    { background: #f0f0ee; color: #666; }
.ap-badge-multi    { background: #E6F1FB; color: #0C447C; }
.ap-badge-target   { background: #EEEDFE; color: #3C3489; }

.ap-header-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ap-btn {
  padding: 7px 14px; font-size: 13px;
  border: 0.5px solid #aaa; background: transparent;
  color: #1a1a18; cursor: pointer; font-family: inherit; border-radius: 0;
}
.ap-btn:hover { background: #f0f0ee; }
.ap-btn-primary { background: #185FA5; border-color: #185FA5; color: #fff; }
.ap-btn-primary:hover { background: #124E8A; border-color: #124E8A; }

/* ============================== MAIN TAB BAR =============================== */

.ap-tabs {
  display: flex;
  border-bottom: 0.5px solid #e0e0dc;
  background: #fff;
  overflow-x: auto;
  padding: 0 24px;
}
.ap-tab {
  padding: 10px 16px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit; white-space: nowrap;
}
.ap-tab.act { color: #185FA5; border-bottom-color: #185FA5; font-weight: 500; }

/* Tab panels */
.ap-panel { display: none; }
.ap-panel.active { display: block; margin-top: 16px; }
#ap-panel-my-training.active { margin-top: 0; }

/* ============================== PLAN CONTEXT STRIP ========================= */

.ap-plan-strip {
  background: #fff;
  border-bottom: 0.5px solid #e0e0dc;
  padding: 14px 24px 16px;
  margin-top: 16px;
}
.ap-plan-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ap-plan-name { font-size: 14px; font-weight: 500; }
.ap-plan-dates { font-size: 11px; color: #666; margin-bottom: 10px; }

/* Period colour bar */
.ap-period-bar { display: flex; height: 6px; margin-bottom: 8px; overflow: hidden; }
.ap-period-seg { height: 6px; }

/* Plan Timeline (periods / blocks / weeks) — adapted from coach
   athlete-profile-detail.css .plan-timeline / .timeline-* with ap-tl- prefix */
.ap-tl {
  position: relative;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 20px 12px 12px;
  margin-top: 4px;
}
.ap-tl-row {
  position: relative;
  height: 28px;
  margin-bottom: 4px;
  background: #fff;
  margin-top: 14px;
}
.ap-tl-row:last-child { margin-bottom: 0; }
.ap-tl-row-label {
  position: absolute;
  left: 0;
  top: -13px;
  font-size: 9px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  z-index: 2;
}
.ap-tl-dates-row {
  height: 16px;
  background: transparent;
  margin-bottom: 6px;
  margin-top: 0;
}
.ap-tl-month {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ap-tl-month::before {
  content: '';
  width: 1px;
  height: 8px;
  background: #d1d5db;
}
.ap-tl-month-label {
  font-size: 9px;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
}
.ap-tl-bar {
  position: absolute;
  top: 2px;
  height: 24px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 4px;
}
.ap-tl-bar-label {
  font-size: 9px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-tl-bar:hover {
  filter: brightness(0.95);
  transform: scaleY(1.1);
  z-index: 3;
}
/* Period type colours — match coach palette */
.ap-tl-period { background: #fef3c7; border: 1px solid #fcd34d; }
.ap-tl-period.type-base,
.ap-tl-period.type-base_i,
.ap-tl-period.type-base_ii { background: #fef3c7; border: 1px solid #fcd34d; }
.ap-tl-period.type-transition_to_speed { background: #fed7aa; border: 1px solid #fdba74; }
.ap-tl-period.type-speed { background: #fecaca; border: 1px solid #fca5a5; }
.ap-tl-period.type-build { background: #fed7aa; border: 1px solid #fdba74; }
.ap-tl-period.type-peak { background: #fecaca; border: 1px solid #fca5a5; }
.ap-tl-period.type-taper { background: #ddd6fe; border: 1px solid #c4b5fd; }
.ap-tl-period.type-season { background: #bbf7d0; border: 1px solid #86efac; }
.ap-tl-period.type-recovery { background: #dbeafe; border: 1px solid #93c5fd; }
.ap-tl-period.type-rest { background: #f3f4f6; border: 1px solid #d1d5db; }

.ap-tl-block {
  background: linear-gradient(135deg, #5eead4 0%, #14b8a6 100%);
  border: 1px solid #14b8a6;
}
.ap-tl-weeks-row { height: 14px; }
.ap-tl-week-tick {
  position: absolute;
  top: 0;
  width: 1px;
  height: 100%;
  background: #d1d5db;
  transform: translateX(-50%);
}
.ap-tl-week-num {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 8px;
  color: #9ca3af;
  font-weight: 500;
  cursor: pointer;
}
.ap-tl-week-num:hover { color: #374151; font-weight: 700; }
.ap-tl-bar.ap-tl-selected {
  outline: 2px solid #185FA5;
  outline-offset: -1px;
  z-index: 4;
}
.ap-tl-week-num.ap-tl-selected { font-weight: 700; color: #185FA5; }
.ap-tl-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #14b8a6;
  transform: translateX(-50%);
  z-index: 5;
}
.ap-tl-today::before {
  content: 'Today';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 600;
  color: #14b8a6;
  white-space: nowrap;
  background: #f9fafb;
  padding: 0 3px;
  z-index: 6;
}

.ap-plan-empty {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: #888;
}

/* ============================== PLAN SUB-TABS ============================== */

.ap-sub-tabs {
  display: flex;
  border-bottom: 0.5px solid #e0e0dc;
  background: #fff;
  overflow-x: auto;
  padding: 0 24px;
}
.ap-stab {
  padding: 9px 14px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit; white-space: nowrap;
}
.ap-stab.act { color: #14b8a6; border-bottom-color: #14b8a6; font-weight: 500; }

.ap-sub-panel { display: none; padding: 0 24px; }
.ap-sub-panel.active { display: block; padding-top: 16px; }
.ap-sub-panel[data-ap-sub-panel="the-plan"].active {
  background: var(--color-background-tertiary, #f5f5f3);
  padding: 16px;
}

/* ============================== SCHEDULE HEADER ============================ */

.ap-schedule-header {
  display: flex; flex-direction: column; gap: 12px;
  padding: 12px 16px; background: var(--color-background-secondary, #f9fafb);
  border-bottom: 1px solid var(--gray-200, #e0e0dc); margin-bottom: 10px;
}

/* Row 1: Controls */
.ap-schedule-controls {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}
.ap-view-mode-toggles {
  display: flex; gap: 0; background: #fff;
  border: 1px solid var(--gray-200, #e0e0dc); padding: 2px;
}
.ap-view-btn {
  padding: 6px 12px; font-size: 12px; font-weight: 500;
  color: var(--gray-600, #666); background: #fff; border: none;
  cursor: pointer; font-family: inherit; border-radius: 0;
}
.ap-view-btn:hover { background: var(--gray-100, #f0f0ee); }
.ap-view-btn.act { background: #185FA5; color: #fff; }

.ap-week-navigation { display: flex; gap: 4px; }
.ap-nav-btn {
  padding: 6px 12px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--gray-300, #ccc); background: #fff;
  color: var(--gray-600, #666); cursor: pointer; font-family: inherit; border-radius: 0;
}
.ap-nav-btn:hover { background: var(--gray-100, #f0f0ee); color: #185FA5; border-color: #185FA5; }
.ap-today-btn {
  padding: 6px 12px; font-size: 12px; font-weight: 500;
  background: #185FA5; color: #fff; border: 1px solid #185FA5;
  cursor: pointer; font-family: inherit; border-radius: 0;
}
.ap-today-btn:hover { background: #124E8A; }

.ap-mode-pill {
  display: flex; background: var(--color-background-secondary, #f9fafb);
  border: 0.5px solid var(--gray-300, #ccc); padding: 3px; margin-left: auto;
}
.ap-mpill {
  padding: 4px 16px; font-size: 12px; border: none; cursor: pointer;
  color: var(--gray-500, #888); background: none; font-weight: 400;
  font-family: inherit; border-radius: 0;
}
.ap-mpill.act {
  background: #fff; color: #185FA5; font-weight: 500;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* Row 2: Week info */
.ap-schedule-week-info {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.ap-week-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; padding: 4px 8px; background: #185FA5;
  color: #fff; font-size: 12px; font-weight: 600;
}
.ap-week-dates { font-size: 13px; color: var(--gray-700, #444); font-weight: 500; }
.ap-week-summary-toggle {
  background: none; border: 1px solid var(--gray-300, #ccc);
  color: var(--gray-600, #666); font-size: 12px; font-weight: 500;
  padding: 3px 10px; cursor: pointer; display: inline-flex;
  align-items: center; gap: 4px; font-family: inherit; border-radius: 0;
}
.ap-week-summary-toggle:hover { color: #185FA5; border-color: #185FA5; }
.ap-toggle-arrow { font-size: 14px; line-height: 1; transition: transform 0.15s; display: inline-block; }
.ap-toggle-arrow.open { transform: rotate(180deg); }

/* Row 3: Focus summary */
.ap-single-week-summary {
  padding: 10px 0 0; border-top: 1px solid var(--gray-200, #e0e0dc); margin-top: 0;
}
.ap-summary-item { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.ap-summary-label {
  font-size: 10px; font-weight: 600; color: var(--gray-500, #888);
  text-transform: uppercase; min-width: 80px; letter-spacing: 0.04em;
}
.ap-summary-value { font-size: 13px; color: var(--gray-800, #1a1a18); line-height: 1.4; }
.ap-summary-metrics { display: flex; gap: 24px; flex-wrap: wrap; }
.ap-single-metric { display: flex; align-items: baseline; gap: 6px; }

/* ============================== WEEK GRID ================================== */

/* Day headers — separate grid row for even alignment (matches coach pattern) */
.ap-day-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--gray-200, #e0e0dc);
  background: #fff; border: 0.5px solid #e0e0dc; border-bottom: none;
}
.ap-day-hdr {
  padding: 8px 8px; text-align: center;
  background: var(--gray-50, #f5f5f3);
  border-right: 0.5px solid #e0e0dc;
}
.ap-day-hdr:last-child { border-right: none; }
.ap-day-hdr.today { background: #E6F1FB; }
.ap-day-name { font-size: 9px; color: #999; text-transform: uppercase; letter-spacing: 0.05em; }
.ap-day-num { font-size: 14px; font-weight: 500; color: #1a1a18; margin-top: 1px; }
.ap-day-num.today { color: #185FA5; }
.ap-day-tags { display: flex; gap: 2px; margin-top: 3px; flex-wrap: wrap; justify-content: center; }
.ap-dtag { font-size: 9px; padding: 1px 4px; font-weight: 500; }
.ap-t-base { background: #E1F5EE; color: #085041; }
.ap-t-easy { background: #E1F5EE; color: #085041; }
.ap-t-mod { background: #FAEEDA; color: #633806; }
.ap-t-hard { background: #FCEBEB; color: #A32D2D; }
.ap-t-long { background: #E6F1FB; color: #0C447C; }

/* Day cells — separate grid, all stretch to tallest */
.ap-day-cells {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #fff; border: 0.5px solid #e0e0dc; border-top: none;
  margin-bottom: 16px;
}
.ap-day-cell {
  border-right: 0.5px solid #e0e0dc;
  padding: 7px 6px; min-height: 120px;
  min-width: 0;
}
.ap-day-cell:last-child { border-right: none; }
.ap-day-cell.today { background: #fafeff; }

/* Mobile-only inline day header inside each cell */
.ap-day-cell-hdr { display: none; }

/* Slot labels */
.ap-slot-label {
  font-size: 9px;
  color: var(--color-text-tertiary, #999);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
.ap-slot-label:first-child { margin-top: 0; }
.ap-slot-gap { margin-top: 7px; }

/* ============================== CHIPS ====================================== */

.ap-chip { display: flex; align-items: stretch; border: 0.5px solid #e0e0dc; margin-bottom: 4px; cursor: pointer; overflow: hidden; }
.ap-chip:hover { border-color: #ccc; }
.ap-chip.missed { border-color: #F09595; }
.ap-chip.today-c { border-color: #185FA5; }
.ap-chip-bar { width: 3px; flex-shrink: 0; }
.ap-chip-body { padding: 4px 6px; flex: 1; min-width: 0; }
.ap-chip-name { font-size: 11px; font-weight: 500; color: #1a1a18; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.ap-chip-meta { font-size: 10px; color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.ap-chip-tags { display: flex; gap: 2px; margin-top: 2px; }
.ap-ctag { font-size: 8px; padding: 1px 3px; }
.ap-ct-p { background: #FAEEDA; color: #633806; }
.ap-ct-t { background: #E6F1FB; color: #0C447C; }

/* ============================== WORKOUT CARDS ============================== */

.ap-wcard {
  background: #fff;
  border: 0.5px solid #e0e0dc;
  padding: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  border-radius: 0;
  position: relative;
}
.ap-wcard:hover { border-color: #aaa; }
.ap-wcard.today-card { border-color: #185FA5; border-width: 1px; }
.ap-wcard.logged { border-left: 2px solid #14b8a6; }
.ap-wcard.missed { border-left: 2px solid #E24B4A; }
.ap-wcard.priority { border-left: 2px solid #F59E0B; }
.ap-wcard.priority.logged { border-left: 2px solid #14b8a6; }
.ap-wcard.priority.missed { border-left: 2px solid #E24B4A; }

.ap-pt-tags { display: flex; gap: 4px; margin-bottom: 4px; }
.ap-pt-tag {
  font-size: 8px; font-weight: 600; padding: 1px 5px;
  letter-spacing: 0.03em;
}
.ap-pt-tag.priority { background: #FEF3C7; color: #92400E; }
.ap-pt-tag.technique { background: #E0F2FE; color: #0369A1; }

.ap-sport-tag {
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 3px;
}
.ap-s-run  { color: #185FA5; }
.ap-s-ride { color: #854F0B; }
.ap-s-swim { color: #0F6E56; }
.ap-s-strength { color: #534AB7; }
.ap-s-other { color: #666; }

.ap-wname { font-size: 12px; font-weight: 500; margin-bottom: 3px; }
.ap-wmeta { font-size: 10px; color: #888; margin-bottom: 4px; }
.ap-wzone {
  display: inline-flex; padding: 1px 7px;
  font-size: 10px; font-weight: 500; margin-bottom: 4px;
}
.ap-z-end  { background: #E1F5EE; color: #085041; }
.ap-z-stam { background: #E6F1FB; color: #0C447C; }
.ap-z-str  { background: #FAEEDA; color: #633806; }
.ap-z-pow  { background: #FCEBEB; color: #791F1F; }

.ap-wintensity { font-size: 11px; color: #1a1a18; margin-bottom: 4px; }
.ap-wpace { font-size: 12px; color: #185FA5; font-weight: 500; margin-bottom: 4px; }
.ap-wprescribed-label { font-size: 10px; color: #999; }

.ap-log-link {
  display: block;
  font-size: 11px; color: #185FA5;
  cursor: pointer;
  margin-top: 6px;
}
.ap-logged-link {
  display: block;
  font-size: 11px; color: #14b8a6;
  cursor: pointer;
  margin-top: 6px;
}
.ap-missed-link {
  display: block;
  font-size: 11px; color: #E24B4A;
  cursor: pointer;
  margin-top: 6px;
}
.ap-wenv {
  font-size: 11px;
  color: var(--color-text-secondary, #888);
  margin-bottom: 2px;
}

.ap-rest-card {
  background: #f9f9f7;
  border: 0.5px dashed #e0e0dc;
  padding: 10px;
  text-align: center;
  border-radius: 0;
  margin-bottom: 6px;
}
.ap-rest-label { font-size: 11px; color: #aaa; }

/* ============================== WEEK SUMMARY STRIP ========================= */

.ap-week-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}
.ap-ws-cell {
  background: #fff;
  border: 0.5px solid #e0e0dc;
  padding: 10px 12px;
  border-radius: 0;
}
.ap-ws-label {
  font-size: 10px; color: #999;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.ap-ws-val { font-size: 18px; font-weight: 500; }
.ap-ws-sub { font-size: 10px; color: #999; margin-top: 2px; }
.ap-ws-link {
  font-size: 10px; color: #14b8a6;
  cursor: pointer; margin-top: 2px;
  background: none; border: none; padding: 0;
  font-family: inherit;
}
.ap-zone-bar-row { display: flex; gap: 2px; margin-top: 6px; }
.ap-zb { height: 4px; }

/* ============================== PLAN STRUCTURE ============================= */

.ap-section {
  background: #fff;
  border: 0.5px solid #e0e0dc;
  margin-bottom: 16px;
  border-radius: 0;
}
.ap-sec-hdr {
  padding: 12px 16px;
  font-size: 12px; font-weight: 500; color: #666;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 0.5px solid #e0e0dc;
}
.ap-sec-body { padding: 16px; }

/* Goals */
.ap-goal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ap-goal-card {
  padding: 12px 14px;
  border: 0.5px solid #e0e0dc;
  background: #f5f5f3;
  border-radius: 0;
}
.ap-goal-label {
  font-size: 10px; font-weight: 500; color: #888;
  text-transform: uppercase; margin-bottom: 4px;
}
.ap-goal-text { font-size: 13px; color: #1a1a18; }

/* Timeline */
.ap-tl-wrap { overflow-x: auto; margin-bottom: 16px; }
.ap-tl-inner { min-width: 640px; }
.ap-tl-row { display: flex; align-items: center; margin-bottom: 7px; }
.ap-tl-lbl {
  font-size: 9px; color: #999; width: 48px; flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.ap-tl-track { flex: 1; position: relative; height: 20px; display: flex; }
.ap-tl-p {
  position: absolute; top: 0; height: 20px;
  display: flex; align-items: center; padding: 0 6px;
  font-size: 9px; font-weight: 500; color: #fff;
  overflow: hidden; white-space: nowrap;
}
.ap-wrow { display: flex; flex: 1; }
.ap-wn {
  flex: 1; text-align: center; font-size: 9px; color: #999;
}
.ap-wn.now { color: #185FA5; font-weight: 500; }
.ap-today-line {
  position: absolute; width: 1.5px; background: #14b8a6;
  z-index: 10; top: -10px; height: 60px;
}
.ap-today-lbl {
  position: absolute; top: -18px; font-size: 9px; color: #14b8a6;
  font-weight: 500; transform: translateX(-50%); white-space: nowrap;
}

/* Donuts */
.ap-donut-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 20px; margin-bottom: 20px;
}
.ap-donut-cell { display: flex; flex-direction: column; align-items: center; }
.ap-donut-label {
  font-size: 11px; font-weight: 500; color: #666;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.ap-donut-wrap { width: 120px; height: 120px; margin-bottom: 12px; }
.ap-legend-table { font-size: 11px; width: 100%; }
.ap-legend-table td { padding: 2px 4px; }
.ap-leg-swatch {
  width: 10px; height: 10px; display: inline-block;
  border-radius: 0;
}

/* Bar chart */
.ap-bar-chart-wrap { margin-bottom: 20px; }

/* Chart settings */
.ap-chart-settings {
  border-top: 0.5px solid #e0e0dc;
  padding: 12px 16px;
  background: #f9f9f7;
}
.ap-ctrl-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px 8px; margin-bottom: 8px; min-width: 0;
}
.ap-ctrl-row:last-child { margin-bottom: 0; }
.ap-ctrl-label { font-size: 10px; color: #888; width: 90px; flex-shrink: 0; }
.ap-ctrl-btns { display: flex; flex-wrap: wrap; gap: 0; min-width: 0; }
.ap-cb {
  padding: 3px 10px; font-size: 11px;
  border: 0.5px solid #ccc; background: transparent;
  color: #666; cursor: pointer; font-family: inherit; border-radius: 0;
}
.ap-cb.act { background: #185FA5; color: #fff; border-color: #185FA5; }
.ap-cb.act2 { background: #14b8a6; color: #fff; border-color: #14b8a6; }
.ap-save-btn {
  padding: 5px 12px; font-size: 11px;
  border: 0.5px solid #ccc; background: transparent;
  color: #666; cursor: pointer; font-family: inherit; border-radius: 0;
}
.ap-save-btn:hover { background: #e0e0dc; }

/* Period hierarchy */
.ap-prow { border-bottom: 0.5px solid #e0e0dc; }
.ap-prow:last-child { border-bottom: none; }
.ap-phdr {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
}
.ap-phdr:hover { background: #f9f9f7; }
.ap-pstripe { width: 3px; align-self: stretch; flex-shrink: 0; }
.ap-phdr-content { flex: 1; min-width: 0; }
.ap-phdr-name { font-size: 13px; font-weight: 500; }
.ap-phdr-range { font-size: 11px; color: #888; }
.ap-phdr-pts { font-size: 11px; color: #888; margin-left: auto; }
.ap-pright-meta { font-size: 10px; color: #888; margin-left: auto; }
.ap-pright { font-size: 10px; color: #aaa; transition: transform 0.15s; margin-left: 6px; }
.ap-pright.open { transform: rotate(90deg); }
.ap-pdetail { padding: 0 14px 14px 28px; display: none; }
.ap-pdetail.open { display: block; }
.ap-gml { font-size: 10px; color: #888; text-transform: uppercase; margin-bottom: 2px; }
.ap-gmt { font-size: 12px; color: #1a1a18; margin-bottom: 8px; }

.ap-block-row {
  background: #f9f9f7;
  border: 0.5px solid #e0e0dc;
  margin: 8px 0 0; border-radius: 0;
}
.ap-block-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer;
}
.ap-block-hdr:hover { background: #f0f0ee; }
.ap-block-stripe { width: 3px; align-self: stretch; flex-shrink: 0; }
.ap-block-content { flex: 1; min-width: 0; }
.ap-block-name { font-size: 12px; font-weight: 500; }
.ap-block-range { font-size: 10px; color: #888; }
.ap-block-right { font-size: 10px; color: #888; white-space: nowrap; }
.ap-block-detail { display: none; padding: 0 12px 12px; }
.ap-block-detail.open { display: block; }

.ap-week-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.ap-week-table th {
  text-align: left; padding: 4px 8px;
  font-size: 9px; font-weight: 500; color: #888;
  text-transform: uppercase; border-bottom: 0.5px solid #e0e0dc;
}
.ap-week-table td { padding: 6px 8px; border-bottom: 0.5px solid #e0e0dc; }
.ap-week-table tr:last-child td { border-bottom: none; }
.ap-now-row td { background: #E6F1FB; }
.ap-now-badge {
  font-size: 9px; background: #185FA5; color: #fff;
  padding: 1px 4px; margin-left: 4px; border-radius: 0;
}
.ap-cur-badge {
  font-size: 9px; background: #185FA5; color: #fff;
  padding: 1px 5px; margin-left: 6px; vertical-align: middle; border-radius: 0;
}
.ap-wbar-bg { background: #e0e0dc; height: 3px; position: relative; width: 60px; }
.ap-wbar-fill { height: 3px; position: absolute; top: 0; left: 0; }

/* ============================== PROFILE TAB ================================ */

.ap-profile-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.ap-card {
  background: #fff;
  border: 0.5px solid #e0e0dc;
  margin-bottom: 16px;
  border-radius: 0;
}
.ap-card-hdr {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 0.5px solid #e0e0dc;
}
.ap-card-title { font-size: 13px; font-weight: 500; }
.ap-card-edit {
  font-size: 12px; color: #14b8a6;
  background: none; border: none; cursor: pointer;
  font-family: inherit; padding: 0;
}
.ap-card-body { padding: 14px 16px; }
.ap-field-row {
  display: flex; justify-content: space-between;
  padding: 6px 0; border-bottom: 0.5px solid #f3f4f6;
  font-size: 12px;
}
.ap-field-row:last-child { border-bottom: none; }
.ap-field-label { color: #888; }
.ap-field-value { color: #1a1a18; text-align: right; }
.ap-field-link { color: #185FA5; }
.ap-field-muted { color: #aaa; }

/* Coach card */
.ap-coach-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #0F6E56; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.ap-coach-row { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.ap-coach-name { font-size: 14px; font-weight: 500; }
.ap-coach-sub { font-size: 11px; color: #666; }

/* Guardian card */
.ap-guardian-notice {
  background: #FAEEDA; border: 0.5px solid #FAC775;
  padding: 8px 10px; font-size: 12px; color: #666;
  margin-bottom: 10px; border-radius: 0;
}

/* Weekly schedule list (profile tab — reflects the global Weekly
   Structure from Settings, with one summary row per day).
   Reuses .ap-dtag / .ap-t-* classes so it matches the plan-page look. */
.ap-sched-list {
  display: flex;
  flex-direction: column;
  border: 0.5px solid #e0e0dc;
}
.ap-sched-row {
  display: grid;
  grid-template-columns: 52px 52px 1fr;
  gap: 10px;
  padding: 6px 12px;
  align-items: baseline;
}
.ap-sched-row-rest { background: #fafafa; }
/* Only draw a divider between days — first row of a day gets a top
   border (skipped on the very first row of the list). */
.ap-sched-row-first + .ap-sched-row-first,
.ap-sched-row-cont + .ap-sched-row-first,
.ap-sched-row-rest,
.ap-sched-row-first + .ap-sched-row-rest,
.ap-sched-row-cont + .ap-sched-row-rest,
.ap-sched-row-rest + .ap-sched-row-first,
.ap-sched-row-rest + .ap-sched-row-rest {
  border-top: 0.5px solid #eeeeea;
}
.ap-sched-row-first { padding-top: 10px; }
.ap-sched-row-first:first-child { border-top: none; padding-top: 8px; }
.ap-sched-row-cont { padding-top: 2px; padding-bottom: 8px; }
.ap-sched-day {
  font-size: 11px;
  font-weight: 600;
  color: #1a1a18;
  letter-spacing: 0.06em;
}
.ap-sched-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 10px;
  row-gap: 4px;
  font-size: 12px;
  color: #666;
  min-width: 0;
}
.ap-sched-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ap-sched-slots {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.ap-sched-slot-label {
  font-size: 10px;
  font-weight: 600;
  color: #185FA5;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ap-sched-slot-time {
  font-size: 10px;
  color: #999;
  font-weight: 400;
  letter-spacing: 0;
}
.ap-sched-notes {
  flex-basis: 100%;
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.ap-sched-rest { font-size: 11px; color: #999; font-style: italic; }
.ap-sched-empty { font-size: 11px; color: #bbb; }

/* Feature tag colours (priority / technique / resist / stretch / cross)
   — match the ws-tag palette used in Settings. */
.ap-t-priority   { background: #f5f3ff; color: #6d28d9; border: 0.5px solid #c4b5fd; }
.ap-t-technique  { background: #ecfeff; color: #0891b2; border: 0.5px solid #a5f3fc; }
.ap-t-resistance { background: #fffbeb; color: #b45309; border: 0.5px solid #fcd34d; }
.ap-t-stretching { background: #ecfdf5; color: #059669; border: 0.5px solid #6ee7b7; }
.ap-t-cross      { background: #f5f3ff; color: #7c3aed; border: 0.5px solid #c4b5fd; }

/* Legacy grid (keeping for any other references) */
.ap-schedule-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.ap-schedule-cell {
  text-align: center; padding: 8px 4px;
  border: 0.5px solid #e0e0dc; border-radius: 0;
}
.ap-schedule-cell.active { background: #E6F1FB; border-color: #185FA5; }
.ap-schedule-day { font-size: 9px; color: #999; text-transform: uppercase; }
.ap-schedule-slot { font-size: 11px; font-weight: 500; color: #0C447C; }
.ap-schedule-rest { font-size: 11px; color: #aaa; font-weight: 400; }

@media (max-width: 640px) {
  .ap-schedule-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .ap-schedule-cell {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; text-align: left;
  }
  .ap-schedule-day { font-size: 12px; color: #555; }
  .ap-schedule-slot, .ap-schedule-rest { font-size: 12px; }
}

/* ============================== LOADING / ERROR ============================ */

.ap-loading {
  padding: 40px; text-align: center;
  font-size: 13px; color: #888;
}
.ap-error {
  padding: 20px;
  background: #FCEBEB; border: 0.5px solid #f5c0c0;
  font-size: 12px; color: #791F1F;
}
.ap-empty {
  padding: 24px; text-align: center;
  font-size: 13px; color: #888;
}

/* Message Centre styles moved to message-centre.css (shared with the coach
   portal). Loaded by coachforce-portal-shell.html. */

/* ============================== RESPONSIVE ================================= */

@media (max-width: 768px) {
  .ap-week-grid { grid-template-columns: repeat(3, 1fr); }
  .ap-week-summary { grid-template-columns: repeat(2, 1fr); }
  .ap-profile-grid { grid-template-columns: 1fr; }
  .ap-donut-row { grid-template-columns: 1fr; }
  .ap-goal-grid { grid-template-columns: 1fr; }

  /* Schedule header: tidy up wrapping so rows don't leave weird gaps */
  .ap-schedule-header { padding: 10px 12px; gap: 10px; }
  .ap-schedule-controls { gap: 8px; justify-content: flex-start; }
  .ap-view-mode-toggles { width: 100%; }
  .ap-view-mode-toggles .ap-view-btn { flex: 1; }
  .ap-week-navigation { flex: 1; }
  .ap-mode-pill { margin-left: 0; }

  /* Week grid: stack days vertically */
  .ap-day-headers { display: none; }
  .ap-day-cells {
    grid-template-columns: 1fr;
    border-top: 0.5px solid #e0e0dc;
  }
  .ap-day-cell {
    border-right: none;
    border-bottom: 0.5px solid #e0e0dc;
    min-height: 0;
    padding: 10px 12px;
  }
  .ap-day-cell:last-child { border-bottom: none; }
  .ap-day-cell-hdr {
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 6px; margin-bottom: 6px;
    border-bottom: 0.5px dashed #e0e0dc;
  }
  .ap-day-cell-hdr .ap-day-name {
    font-size: 11px; font-weight: 600; color: #1a1a18;
    text-transform: uppercase; letter-spacing: 0.05em;
  }
  .ap-day-cell-hdr .ap-day-tags { margin-top: 0; justify-content: flex-start; }
  .ap-day-cell.today .ap-day-cell-hdr .ap-day-name { color: #185FA5; }

  /* Header: drop action buttons below the name/meta/badges summary */
  .ap-header { padding: 16px 12px 0; }
  .ap-header-row { flex-wrap: wrap; gap: 12px; }
  .ap-header-actions {
    order: 2;
    flex-basis: 100%;
    width: 100%;
    gap: 8px;
  }
  .ap-header-actions .ap-btn { flex: 1; padding: 9px 12px; }

  /* Plan timeline: scroll horizontally on mobile (matches coach portal) */
  .ap-tl-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .ap-tl-scroll-wrapper .ap-tl {
    min-width: 800px;
  }
}


/* ============================================================
   MULTI-PLAN PHASE 3b — plan toggle row (athlete portal)
   Sits inside the plan strip, above the timeline widget.
   ============================================================ */

.ap-plan-toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 10px 0;
    flex-wrap: wrap;
    margin-top: 8px;
    border-top: 1px solid #e5e7eb;
}
.ap-plan-row-label {
    font-size: 10px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 4px;
}

.ap-plan-pill {
    display: inline-flex;
    align-items: center;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.15s;
}
.ap-plan-pill.off {
    opacity: 0.45;
    background: #f3f4f6;
}
.ap-plan-pill.primary {
    border-color: #185FA5;
    box-shadow: inset 0 0 0 1px #185FA5;
}
.ap-plan-pill-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: transparent;
    border: none;
    color: #111827;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.ap-plan-pill-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.15);
}
.ap-plan-pill.off .ap-plan-pill-dot {
    background: #9ca3af !important;
}
.ap-plan-pill-name {
    white-space: nowrap;
}
.ap-plan-pill-setprimary {
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-left: 1px solid #e5e7eb;
    color: #9ca3af;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.15s;
}
.ap-plan-pill-setprimary:hover {
    color: #f59e0b;
}

/* Orphan pill — rounded, distinct from plan pills per spec */
.ap-orphan-pill {
    margin-left: auto;
}
.ap-orphan-pill button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: #fef3c7;
    border: 1px dashed #f59e0b;
    border-radius: 14px;
    color: #92400e;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.ap-orphan-pill button:hover {
    background: #fde68a;
}
.ap-orphan-pill.active button {
    background: #f59e0b;
    color: white;
    border-style: solid;
}
.ap-orphan-icon {
    font-size: 12px;
}

/* Orphan card/chip styling — muted background so unassigned workouts
   are visually distinct from plan-attributed ones. */
.ap-wcard.ap-orphan { background: #fafafa; }
.ap-chip.ap-orphan { opacity: 0.85; }
