/* =============================================================================
   Athlete Workout Detail Panel
   Prefix: apd-
   440px desktop, full-width mobile (<480px). Overlay pattern.
   Athlete portal: #185FA5. Teal accent: #14b8a6.
   border-radius: 0 everywhere.
   ============================================================================= */

.apd-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 990; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.apd-overlay.visible { opacity: 1; pointer-events: auto; }

.apd-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 520px; max-width: 100vw;
  background: #fff;
  border-left: 0.5px solid #e0e0dc;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex; flex-direction: column;
}
.apd-panel.open { transform: translateX(0); }

@media (max-width: 480px) {
  .apd-panel { width: 100vw; }
}

.apd-hdr {
  padding: 12px 18px;
  background: #1a2332;
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-shrink: 0;
}
.apd-hdr-title { font-size: 14px; font-weight: 500; color: #fff; }
.apd-hdr-sub { font-size: 11px; color: #94a3b8; margin-bottom: 2px; }
.apd-close {
  background: none; border: none; cursor: pointer;
  font-size: 22px; color: #94a3b8; line-height: 1; padding: 0;
}
.apd-close:hover { color: #fff; }

.apd-body { flex: 1; overflow-y: auto; padding: 16px 18px; background: #f5f5f3; }
.apd-ftr {
  padding: 12px 18px;
  border-top: 0.5px solid #e0e0dc;
  display: flex; gap: 8px; flex-shrink: 0;
}

.apd-btn-log {
  flex: 1; padding: 10px;
  background: #185FA5; color: #fff; border: none;
  font-size: 13px; cursor: pointer; font-weight: 500;
  font-family: inherit; border-radius: 0;
}
.apd-btn-log:hover { background: #124E8A; }
.apd-btn-swap {
  padding: 10px 14px;
  background: transparent; border: 0.5px solid #aaa;
  color: #1a1a18; font-size: 13px; cursor: pointer;
  font-family: inherit; border-radius: 0;
}
.apd-btn-swap:hover { background: #f0f0ee; }

/* Cards */
.apd-card {
  background: #fff; border: 0.5px solid #e0e0dc;
  padding: 18px; margin-bottom: 12px;
}
.apd-card-hdr {
  font-size: 14px; font-weight: 600; color: #1a1a18;
  padding-bottom: 12px; border-bottom: 0.5px solid #e0e0dc;
  margin-bottom: 12px;
}
.apd-card-body { font-size: 13px; line-height: 1.65; color: #1a1a18; }
.apd-text-content { margin: 0; }

/* Body content */
.apd-sport-context {
  font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.06em; color: #185FA5; margin-bottom: 8px;
}
.apd-workout-title {
  font-size: 20px; font-weight: 600; margin: 0 0 6px; line-height: 1.3;
}

.apd-section-label {
  font-size: 10px; font-weight: 500; color: #999;
  text-transform: uppercase; letter-spacing: 0.07em;
  margin: 16px 0 8px; padding-top: 16px;
  border-top: 0.5px solid #e0e0dc;
}
.apd-section-label.first { border-top: none; padding-top: 0; margin-top: 0; }
.apd-how-to { font-size: 13px; line-height: 1.65; color: #1a1a18; }

/* Intensity tabs */
.apd-intensity-tabs {
  display: flex; gap: 0; border: 0.5px solid #ccc; margin-bottom: 12px;
}
.apd-it {
  flex: 1; padding: 6px 0; font-size: 11px; text-align: center;
  cursor: pointer; background: transparent; border: none;
  color: #666; font-family: inherit;
}
.apd-it.act { background: #E6F1FB; color: #0C447C; font-weight: 500; }
.apd-intensity-val { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.apd-intensity-sub { font-size: 12px; color: #666; margin-bottom: 8px; }
.apd-preference-link {
  font-size: 11px; color: #14b8a6; cursor: pointer;
  display: block; margin-top: 4px;
  background: none; border: none; padding: 0; font-family: inherit;
  text-align: left;
}
.apd-preference-link.saved {
  color: #888; cursor: default;
}

/* Steps table */
.apd-steps-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.apd-steps-table th {
  text-align: left; padding: 6px 8px; font-size: 10px; color: #999;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 0.5px solid #e0e0dc;
}
.apd-steps-table td {
  padding: 8px; border-bottom: 0.5px solid #e0e0dc;
}
.apd-steps-table tr:last-child td { border-bottom: none; }
.apd-step-section-row td {
  background: #f5f5f3; font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em; color: #888;
  padding: 5px 8px;
}

/* Coach note */
.apd-coach-note {
  background: #E1F5EE; border: 0.5px solid #9FE1CB;
  padding: 10px 12px; font-size: 12px; color: #085041; line-height: 1.6;
}
.apd-coach-note-label {
  font-size: 10px; font-weight: 500; color: #0F6E56;
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em;
}

/* Benefits */
.apd-benefits-row { display: flex; flex-wrap: wrap; gap: 6px; }
.apd-benefit-pill {
  padding: 3px 10px; font-size: 11px;
  background: #f5f5f3; border: 0.5px solid #e0e0dc;
  color: #666; border-radius: 0;
}

/* Logged state */
.apd-log-entry {
  background: #f5f5f3; border: 0.5px solid #e0e0dc;
  padding: 12px; margin-bottom: 14px; border-radius: 0;
}
.apd-log-entry-label {
  font-size: 10px; font-weight: 500; color: #888;
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px;
}
.apd-log-row {
  display: flex; justify-content: space-between;
  font-size: 12px; padding: 4px 0;
  border-bottom: 0.5px solid #e0e0dc;
}
.apd-log-row:last-child { border-bottom: none; }
.apd-log-label { color: #666; }
.apd-log-val { font-weight: 500; }
.apd-log-private { background: #f9f9f7; border-left: 2px solid #ccc; padding-left: 8px; margin-top: 4px; }
.apd-log-private .apd-log-label { color: #999; }

.apd-view-rx-toggle {
  font-size: 11px; color: #14b8a6; cursor: pointer;
  background: none; border: none; padding: 0;
  font-family: inherit; margin-bottom: 8px;
}

/* Sharing row — shown in sharing-summary mode (Message Centre View ->) */
.apd-log-sharing {
  margin-top: 12px; padding-top: 10px;
  border-top: 0.5px solid #e0e0dc;
}
.apd-log-sharing-label {
  font-size: 10px; font-weight: 500; color: #999;
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 6px;
}
.apd-log-sharing-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.apd-share-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  border: 0.5px solid #ccc;
  background: #fff; color: #666;
  font-size: 10px; font-family: inherit;
  cursor: pointer; user-select: none;
}
.apd-share-pill .apd-share-dot {
  width: 8px; height: 8px; background: #ccc; display: inline-block;
}
.apd-share-pill.on {
  background: #E1F5EE; border-color: #14b8a6; color: #085041;
}
.apd-share-pill.on .apd-share-dot { background: #14b8a6; }
.apd-share-pill.busy { opacity: 0.5; pointer-events: none; }

.apd-share-badge {
  display: inline-flex; align-items: center;
  padding: 3px 7px;
  background: #f0f0ee; color: #666;
  font-size: 10px; font-weight: 500;
}
.apd-share-badge.on { background: #E1F5EE; color: #085041; }

.apd-loading { padding: 20px; text-align: center; font-size: 12px; color: #888; }
.apd-error { padding: 14px; background: #FCEBEB; font-size: 12px; color: #791F1F; }

/* Description */
.apd-description { font-size: 13px; color: #6b7280; line-height: 1.6; margin: 0 0 12px; }

/* Priority / Technique banner */
.apd-pt-banner {
  display: flex; gap: 0; margin-bottom: 14px;
}
.apd-pt-cell {
  flex: 1; padding: 8px 14px;
  font-size: 12px; font-weight: 500;
}
.apd-pt-cell.full { flex: 1; }
.apd-pt-cell.priority { background: #FEF3C7; color: #92400E; }
.apd-pt-cell.technique { background: #E0F2FE; color: #0369A1; }

/* Stat strip */
.apd-stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 0.5px solid #e0e0dc;
}
.apd-stat {
  padding: 10px 8px; text-align: center;
  border-right: 0.5px solid #e0e0dc;
}
.apd-stat:last-child { border-right: none; }
.apd-stat-label { font-size: 9px; color: #888; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.apd-stat-val { font-size: 15px; font-weight: 600; color: #1a1a18; }
.apd-zone-val { color: #14b8a6; }

/* Volume/intensity cell styles */
.apd-vol-primary { font-weight: 500; color: #1a1a18; }
.apd-vol-secondary { font-size: 11px; color: #999; margin-top: 2px; }
.apd-int-feeling { color: #1a1a18; }
.apd-int-primary { color: #14b8a6; font-weight: 500; }
.apd-int-secondary { font-size: 11px; color: #999; margin-top: 2px; }
.apd-divider { width: 1px; height: 20px; background: #e0e0dc; margin: 0 2px; flex-shrink: 0; }

/* Summary strip inside steps card */
.apd-summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 0.5px solid #e0e0dc; margin-top: 12px; }
.apd-sum-cell { padding: 12px 8px; text-align: center; border-right: 0.5px solid #e0e0dc; }
.apd-sum-cell:last-child { border-right: none; }
.apd-sum-label { font-size: 10px; color: #999; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.apd-sum-val { font-size: 16px; font-weight: 500; color: #1a1a18; }
.apd-sum-zone { color: #14b8a6; }

/* Steps controls */
.apd-steps-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 10px; border-bottom: 0.5px solid #e0e0dc;
  margin-bottom: 10px;
}
.apd-steps-title { font-size: 14px; font-weight: 600; }
.apd-steps-meta { font-size: 11px; color: #888; }
.apd-adjust-btn {
  font-size: 11px; color: #999; background: none; border: 0.5px solid #ccc;
  padding: 2px 8px; cursor: pointer; font-family: inherit; margin-left: 6px;
  border-radius: 0;
}
.apd-adjust-btn:hover { background: #f5f5f3; }
.apd-hidden { display: none !important; }

/* Repeat group */
.apd-rg-compact {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; background: #f9fafb;
}
.apd-rg-badge {
  font-size: 10px; font-weight: 500; color: #0F6E56;
  background: #e1f5ee; padding: 1px 6px; flex-shrink: 0;
}
.apd-rg-vol { font-size: 12px; font-weight: 500; color: #1a1a18; }
.apd-rg-sep { font-size: 11px; color: #999; }
.apd-rg-intens { font-size: 11px; color: #6b7280; flex: 1; }
.apd-rg-expand {
  font-size: 10px; padding: 2px 9px;
  border: 0.5px solid #ccc; background: #fff;
  cursor: pointer; color: #999; white-space: nowrap;
  flex-shrink: 0; font-family: inherit; border-radius: 0;
}
.apd-rg-expand:hover { border-color: #14b8a6; color: #14b8a6; }
.apd-rg-detail {
  display: none; border-left: 2px solid #14b8a6; margin-left: 14px;
}
.apd-rg-detail.apd-rg-open { display: block; }
.apd-rg-step {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-bottom: 0.5px solid #e0e0dc;
}
.apd-rg-step:last-child { border-bottom: none; }
.apd-rg-step-type {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em;
  color: #999; width: 56px; flex-shrink: 0;
}
.apd-rg-step-vol { font-size: 11px; color: #6b7280; width: 50px; flex-shrink: 0; }
.apd-rg-step-name { font-size: 11px; font-weight: 500; color: #1a1a18; flex: 1; }
.apd-rg-step-feeling { font-size: 10px; color: #999; margin-left: 4px; font-weight: 400; }

/* Attribution */
.apd-attribution {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; margin-bottom: 12px;
  background: #fff; border: 0.5px solid #e0e0dc;
}
.apd-attr-icon {
  width: 36px; height: 36px;
  background: #14b8a6; color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.apd-attr-text {
  font-size: 12px; font-weight: 600; color: #14b8a6;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.apd-steps-controls { margin-bottom: 10px; }
.apd-ctrl-row {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px 8px; margin-bottom: 6px; min-width: 0;
  padding-left: 88px; min-height: 24px;
}
.apd-ctrl-label {
  position: absolute;
  left: 0; top: 8px;
  width: 80px; flex-shrink: 0;
  font-size: 10px; color: #888;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.apd-ctrl-btns { display: flex; gap: 0; border: 0.5px solid #ccc; }
.apd-ctrl-btn {
  padding: 4px 10px; font-size: 11px; background: #fff; border: none;
  cursor: pointer; font-family: inherit; color: #666;
}
.apd-ctrl-btn.act { background: #14b8a6; color: #fff; }
.apd-env-row {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px;
}
.apd-env-row .apd-ctrl-label { width: auto; }
.apd-env-select {
  font-size: 12px; padding: 6px 10px; border: 0.5px solid #ccc;
  font-family: inherit; background: #fff; width: 100%;
}

/* Terrain section — relief + environment dropdowns.
   Uses the .apd-ctrl-row pattern so the left edges of the selects align
   with the Volume/Intensity pill rows above. */
.apd-terrain-section {
  margin-top: 6px;
}
.apd-terrain-select {
  flex: 1;
  font-size: 11px;
  padding: 4px 8px;
  border: 0.5px solid #ccc;
  background: #fff;
  color: #111827;
  font-family: inherit;
  border-radius: 0;
}
.apd-terrain-select:disabled {
  background: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

/* Values */
.apd-values-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.apd-value-item { }
.apd-value-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.apd-value-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.apd-value-desc { font-size: 11px; color: #6b7280; font-style: italic; line-height: 1.5; }

/* Section divider — separates Values from Benefits */
.apd-section-divider {
  border: 0; border-top: 0.5px solid #e5e7eb;
  margin: 14px 0; height: 0;
}

/* Benefits */
.apd-benefits-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 12px; }

/* Mobile + narrow screens: stack values one per row, stack benefit
   columns vertically with mental above physical. */
@media (max-width: 640px) {
  .apd-values-grid { grid-template-columns: 1fr; gap: 10px; }
  .apd-benefits-grid { grid-template-columns: 1fr; gap: 12px; }
}
.apd-benefits-col { border-left: 2px solid #14b8a6; padding-left: 12px; }
.apd-benefits-col-title { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #888; margin-bottom: 8px; }
.apd-benefit-item { font-size: 12px; color: #1a1a18; margin-bottom: 6px; line-height: 1.5; }

/* Training load card */
.apd-load-header {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 10px; margin-bottom: 12px;
}
.apd-load-title { font-size: 14px; font-weight: 600; margin: 0; }
.apd-load-pts { font-size: 14px; font-weight: 700; color: #1a1a18; }
.apd-load-bar { display: none; }
.apd-load-seg { display: none; }
.apd-load-zones { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.apd-load-zone-cell { text-align: center; padding: 6px 4px; }
.apd-load-zone-bar { height: 3px; margin-bottom: 6px; }
.apd-load-zone-label { font-size: 9px; font-weight: 600; letter-spacing: 0.04em; color: #6b7280; margin-bottom: 4px; }
.apd-load-zone-val { font-size: 16px; font-weight: 700; }
.apd-load-zone-sub { font-size: 10px; color: #888; }
