/* coach-mobile.css — Mobile Responsive Coach Dashboard + "Message AT" Widget
 * Fantasy football theme: card flips, glow states, status rings
 * Breakpoints: ≤767px (mobile), 768-1023px (tablet), ≥1024px (desktop)
 * ADR-006: data-qa semantic locators assumed in markup
 * ADR-007: namespace-prefixed IDs (mobile-*, desktop-*, msg-*)
 * ADR-005: no DB IDs hardcoded — all hydrated from JS
 * ADR-022: uses __SLW_ENV__ + apiRequest() for auth
 */

/* ═══════════════════════════════════════════════════════════════
   MOBILE BOTTOM SHEET (replaces desktop sticky panel ≤767px)
   ═══════════════════════════════════════════════════════════════ */

.mobile-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 350;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
  border: 0;
  padding: 0;
}

.mobile-sheet__back-btn:focus-visible {
  outline: 3px solid var(--coach-accent, #f59e0b);
  outline-offset: 3px;
}

.mobile-sheet-overlay--visible {
  display: block;
  opacity: 1;
}

.mobile-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 92vh;
  background: var(--bg-deep, #0f172a);
  border-radius: 20px 20px 0 0;
  z-index: 360;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
}

.mobile-sheet--open {
  transform: translateY(0);
}

.mobile-sheet__handle {
  width: 40px;
  height: 5px;
  background: var(--border-light, #334155);
  border-radius: 3px;
  margin: 12px auto 8px;
  flex-shrink: 0;
  cursor: grab;
  touch-action: none;
}

.mobile-sheet__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--border, #1e293b);
  flex-shrink: 0;
}

.mobile-sheet__back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface, #1e293b);
  border: 1px solid var(--border, #334155);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.125rem;
  color: var(--text-primary, #f1f5f9);
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background 0.12s ease;
}

.mobile-sheet__back-btn:active {
  background: var(--bg-hover, #334155);
  transform: scale(0.95);
}

.mobile-sheet__title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-sheet__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 16px));
}

/* Swipe indicator at bottom of sheet */
.mobile-sheet__swipe-hint {
  font-size: 0.7rem;
  color: var(--text-muted, #64748b);
  text-align: center;
  padding: 8px 0;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   MESSAGE AT FAB — Floating Action Button
   ═══════════════════════════════════════════════════════════════ */

.message-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coach-accent, #f59e0b), #d97706);
  border: none;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35), 0 0 0 0 rgba(245, 158, 11, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  touch-action: manipulation;
  animation: message-fab-glow 2.5s ease-in-out infinite;
}

@keyframes message-fab-glow {
  0%, 100% { box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35), 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5), 0 0 12px 4px rgba(245, 158, 11, 0.2); }
}

.message-fab:active {
  transform: scale(0.92);
}

.message-fab__icon {
  font-size: 1.5rem;
  line-height: 1;
  color: #fff;
}

.message-fab__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--status-out, #ef4444);
  color: #fff;
  font-size: 0.688rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  border: 2px solid var(--bg-deep, #0f172a);
  display: none;
}

.message-fab__badge--visible {
  display: flex;
}

/* Desktop FAB offset — shift left so it doesn't overlap bottom nav */
@media (min-width: 768px) {
  .message-fab {
    bottom: 32px;
    right: 32px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   MESSAGE AT PANEL — Slide-up panel ~85% viewport
   ═══════════════════════════════════════════════════════════════ */

.message-panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 400;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.message-panel-overlay--visible {
  display: block;
  opacity: 1;
}

.message-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 85vh;
  max-height: 85vh;
  background: var(--bg-deep, #0f172a);
  border-radius: 24px 24px 0 0;
  z-index: 410;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.message-panel--open {
  transform: translateY(0);
}

.message-panel__handle {
  width: 48px;
  height: 5px;
  background: var(--border-light, #334155);
  border-radius: 3px;
  margin: 10px auto 6px;
  flex-shrink: 0;
  cursor: grab;
  touch-action: none;
}

.message-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 14px;
  border-bottom: 1px solid var(--border, #1e293b);
  flex-shrink: 0;
}

.message-panel__header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.message-panel__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--coach-accent, #f59e0b);
  flex-shrink: 0;
}

.message-panel__info h3 {
  font-size: 0.938rem;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
  margin: 0;
  line-height: 1.3;
}

.message-panel__info p {
  font-size: 0.75rem;
  color: var(--text-secondary, #94a3b8);
  margin: 0;
}

.message-panel__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-surface, #1e293b);
  border: 1px solid var(--border, #334155);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-secondary, #94a3b8);
  flex-shrink: 0;
  transition: background 0.12s ease;
  touch-action: manipulation;
}

.message-panel__close:active {
  background: var(--bg-hover, #334155);
}

.message-panel__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px;
}

.message-panel__footer {
  padding: 12px 20px max(12px, env(safe-area-inset-bottom, 12px));
  border-top: 1px solid var(--border, #1e293b);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Quick Compose */
.msg-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface, #1e293b);
  border-radius: var(--radius-md, 12px);
  padding: 12px;
  border: 1px solid var(--border, #334155);
}

.msg-composer__input {
  width: 100%;
  padding: 8px 8px;
  border: none;
  border-radius: 6px;
  background: var(--bg-subtle, #0f172a);
  color: var(--text-primary, #f1f5f9);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: box-shadow 0.15s;
  box-sizing: border-box;
}

.msg-composer__input:focus {
  box-shadow: 0 0 0 2px var(--coach-accent, #f59e0b);
}

.msg-composer__input::placeholder {
  color: var(--text-muted, #64748b);
}

.msg-composer__textarea {
  width: 100%;
  min-height: 60px;
  max-height: 120px;
  padding: 8px 8px;
  border: none;
  border-radius: 6px;
  background: var(--bg-subtle, #0f172a);
  color: var(--text-primary, #f1f5f9);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: box-shadow 0.15s;
  box-sizing: border-box;
}

.msg-composer__textarea:focus {
  box-shadow: 0 0 0 2px var(--coach-accent, #f59e0b);
}

.msg-composer__textarea::placeholder {
  color: var(--text-muted, #64748b);
}

.msg-composer__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.msg-send-btn {
  padding: 8px 20px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--coach-accent, #f59e0b), #d97706);
  color: #fff;
  font-size: 0.813rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-send-btn:active {
  transform: scale(0.96);
}

.msg-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Recent Messages Thread */
.msg-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.msg-thread__header {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border, #1e293b);
}

.msg-thread__item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-surface, #1e293b);
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border, #334155);
  transition: background 0.12s ease;
}

.msg-thread__item--unread {
  border-left: 3px solid var(--coach-accent, #f59e0b);
}

.msg-thread__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-hover, #334155);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.813rem;
  flex-shrink: 0;
}

.msg-thread__body {
  flex: 1;
  min-width: 0;
}

.msg-thread__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.msg-thread__sender {
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--text-primary, #f1f5f9);
}

.msg-thread__time {
  font-size: 0.65rem;
  color: var(--text-muted, #64748b);
}

.msg-thread__subject {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: 2px;
}

.msg-thread__preview {
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-thread__empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted, #64748b);
}

.msg-thread__empty-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.msg-thread__empty-text {
  font-size: 0.813rem;
}

.msg-loading {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary, #94a3b8);
}

.msg-loading__spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border, #334155);
  border-top-color: var(--coach-accent, #f59e0b);
  border-radius: 50%;
  animation: msg-spin 0.7s linear infinite;
  margin: 0 auto 8px;
}

@keyframes msg-spin {
  to { transform: rotate(360deg); }
}

.msg-error {
  text-align: center;
  padding: 16px;
  color: var(--status-out, #ef4444);
  font-size: 0.813rem;
}

/* ═══════════════════════════════════════════════════════════════
   DEPTH CHART — Mobile: single column, horizontal scroll
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  .depth-chart-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .athlete-pool {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-surface, #1e293b);
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--border, #334155);
  }

  .athlete-pool__header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-surface, #1e293b);
    padding: 10px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary, #94a3b8);
    border-bottom: 1px solid var(--border, #334155);
  }

  .athlete-pool__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 12px;
    border-bottom: 1px solid var(--border, #334155);
    font-size: 0.875rem;
    min-height: 48px;
    touch-action: manipulation;
  }

  .formation-grid {
    display: grid;
    gap: 8px;
    min-height: 200px;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .depth-slot {
    min-height: 60px;
    padding: 8px;
    border: 2px dashed var(--border, #334155);
    border-radius: var(--radius-sm, 8px);
    background: var(--bg-surface, #1e293b);
    transition: all 0.2s;
  }

  .depth-slot--has-athlete {
    border-style: solid;
  }

  .depth-slot--green {
    border-color: var(--status-full, #22c55e);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.25);
  }

  .depth-slot--amber {
    border-color: var(--coach-accent, #f59e0b);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
  }

  .depth-slot--red {
    border-color: var(--status-out, #ef4444);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
    animation: mobile-pulse-out 2s ease-in-out infinite;
  }

  @keyframes mobile-pulse-out {
    0%, 100% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.6); }
  }
}

/* ═══════════════════════════════════════════════════════════════
   POOL ATHLETES — Vertical stack on mobile
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  .roster-athlete {
    padding: 16px 14px;
    gap: 14px;
  }

  .roster-athlete__avatar {
    width: 48px;
    height: 48px;
    font-size: 1rem;
  }

  .roster-athlete__name {
    font-size: 1.0625rem;
  }

  .quick-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .quick-action-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    padding: 12px 8px;
  }

  .filters {
    padding: 4px 0 12px;
    gap: 6px;
  }

  .filter-pill {
    padding: 10px 16px;
    font-size: 0.813rem;
    min-height: 40px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   SAVE BAR — Fixed to bottom on mobile
   ═══════════════════════════════════════════════════════════════ */

.save-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 12px 16px;
  margin-top: 12px;
  background: var(--bg-surface, #1e293b);
  border-top: 1px solid var(--border, #334155);
  border-radius: var(--radius-md, 12px) var(--radius-md, 12px) 0 0;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
}

.save-bar--visible {
  display: flex;
}

.save-bar__info {
  font-size: 0.8125rem;
  color: var(--text-secondary, #94a3b8);
}

.save-bar__info strong {
  color: var(--text-primary, #f1f5f9);
}

.save-bar__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.save-bar__btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  font-size: 0.813rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease;
  touch-action: manipulation;
}

.save-bar__btn:active {
  transform: scale(0.96);
}

.save-bar__btn--primary {
  background: linear-gradient(135deg, var(--coach-accent, #f59e0b), #d97706);
  color: #fff;
}

.save-bar__btn--secondary {
  background: var(--bg-hover, #334155);
  color: var(--text-secondary, #94a3b8);
  border: 1px solid var(--border, #475569);
}

@media (max-width: 767px) {
  .save-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    z-index: 200;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom, 12px));
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.2);
  }
}

/* ═══════════════════════════════════════════════════════════════
   FANTASY FOOTBALL THEME — Card flips, glow, status rings
   ═══════════════════════════════════════════════════════════════ */

/* Card Flip Container */
.depth-slot__athlete-card {
  position: relative;
  perspective: 600px;
  width: 100%;
  min-height: 48px;
}

.depth-slot__athlete-card-inner {
  position: relative;
  width: 100%;
  min-height: 48px;
  transition: transform 0.4s ease;
  transform-style: preserve-3d;
}

.depth-slot__athlete-card-inner--flipped {
  transform: rotateY(180deg);
}

.depth-slot__athlete-card-front,
.depth-slot__athlete-card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 48px;
  backface-visibility: hidden;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.depth-slot__athlete-card-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, var(--coach-dim, rgba(245, 158, 11, 0.1)), rgba(245, 158, 11, 0.02));
  padding: 8px 10px;
  font-size: 0.7rem;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.depth-slot__athlete-card-back .back-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.4;
}

.depth-slot__athlete-card-back .back-row strong {
  color: var(--text-primary, #f1f5f9);
  font-weight: 600;
  text-align: right;
  max-width: 60%;
}

.depth-slot__athlete-card-back .back-label {
  font-size: 0.6rem;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Status Rings (fantasy football card aesthetic) */
.status-ring {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-ring--cleared {
  background: var(--status-full, #22c55e);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.status-ring--restricted {
  background: var(--status-restricted, #f59e0b);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
  animation: ring-pulse 1.5s ease-in-out infinite;
}

.status-ring--out {
  background: var(--status-out, #ef4444);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
  animation: ring-pulse 1s ease-in-out infinite;
}

@keyframes ring-pulse {
  0%, 100% { box-shadow: 0 0 6px currentColor; }
  50% { box-shadow: 0 0 12px 3px currentColor; }
}

/* Glow Border for fantasy theme cards */
.roster-athlete--glow-cleared {
  box-shadow: 0 0 0 1px var(--status-full, #22c55e), 0 0 12px rgba(34, 197, 94, 0.15);
}

.roster-athlete--glow-restricted {
  box-shadow: 0 0 0 1px var(--status-restricted, #f59e0b), 0 0 12px rgba(245, 158, 11, 0.2);
}

.roster-athlete--glow-out {
  box-shadow: 0 0 0 1px var(--status-out, #ef4444), 0 0 14px rgba(239, 68, 68, 0.25);
}

/* Athlete card number (jersey style, fantasy football top-left badge) */
.athlete-jersey-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--bg-hover, #334155);
  font-size: 0.688rem;
  font-weight: 800;
  color: var(--text-secondary, #94a3b8);
  flex-shrink: 0;
}

/* Position label on cards (like fantasy football cards) */
.card-position-tag {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--coach-accent, #f59e0b);
}

/* ═══════════════════════════════════════════════════════════════
   TABLET LAYOUT (768-1023px)
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 768px) and (max-width: 1023px) {
  .coach-desktop-grid {
    display: flex;
    flex-direction: row;
    gap: 14px;
    align-items: flex-start;
  }

  .coach-desktop-left {
    flex: 0 0 calc(42% - 7px);
    max-width: calc(42% - 7px);
  }

  .coach-desktop-right {
    flex: 0 0 calc(58% - 7px);
    max-width: calc(58% - 7px);
  }

  .coach-detail-panel {
    display: block;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border, #334155);
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    min-height: 300px;
    position: sticky;
    top: 16px;
  }

  .mobile-sheet-overlay,
  .mobile-sheet {
    display: none !important;
  }

  /* Hide mobile FAB on tablet — show inline Messages button instead */
  .message-fab {
    bottom: 32px;
    right: 32px;
    width: 56px;
    height: 56px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   DESKTOP LAYOUT (≥1024px)
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 1024px) {
  .coach-desktop-grid {
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: flex-start;
  }

  .coach-desktop-left {
    flex: 0 0 40%;
    max-width: 40%;
  }

  .coach-desktop-right {
    flex: 0 0 60%;
    max-width: 60%;
  }

  .coach-detail-panel {
    display: block;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border, #334155);
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    min-height: 300px;
    position: sticky;
    top: 16px;
  }

  .mobile-sheet-overlay,
  .mobile-sheet {
    display: none !important;
  }

  .message-fab {
    width: 56px;
    height: 56px;
    bottom: 36px;
    right: 36px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE HIDES
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  .coach-detail-panel {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .mobile-sheet,
  .message-panel,
  .depth-slot__athlete-card-inner,
  .message-fab,
  .status-ring {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .depth-slot__athlete-card-inner--flipped {
    transform: none;
  }

  .depth-slot__athlete-card-back {
    transform: none;
    position: relative;
  }
}
.msg-thread__view {
  display: flex;
  flex-direction: column;
  min-height: 50vh;
  height: 100%;
}

.msg-thread__view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #334155);
  background: var(--bg-elevated, #0f172a);
  position: sticky;
  top: 0;
  z-index: 1;
}

.msg-thread__back {
  background: none;
  border: none;
  color: var(--coach-accent, #f59e0b);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.msg-thread__back:hover { background: rgba(245, 158, 11, 0.1); }

.msg-thread__view-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
}

.msg-thread__messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.msg-thread__bubble {
  display: flex;
  gap: 8px;
  max-width: 85%;
  align-items: flex-start;
}

.msg-thread__bubble--mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-thread__bubble-avatar {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface, #1e293b);
  border-radius: 50%;
}

.msg-thread__bubble-body {
  background: var(--bg-surface, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 12px 12px 12px 4px;
  padding: 8px 12px;
}

.msg-thread__bubble--mine .msg-thread__bubble-body {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--coach-accent, #f59e0b);
  border-radius: 12px 12px 4px 12px;
}

.msg-thread__bubble-sender {
  font-size: 0.688rem;
  font-weight: 600;
  color: var(--coach-accent, #f59e0b);
  margin-bottom: 2px;
}

.msg-thread__bubble-text {
  font-size: 0.875rem;
  color: var(--text-primary, #f1f5f9);
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg-thread__bubble-time {
  font-size: 0.625rem;
  color: var(--text-muted, #94a3b8);
  margin-top: 4px;
  text-align: right;
}

.msg-thread__empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted, #94a3b8);
  font-size: 0.875rem;
}

.msg-thread__error {
  text-align: center;
  padding: 32px 16px;
  color: #ef4444;
  font-size: 0.875rem;
}

.msg-thread__loading {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted, #94a3b8);
  font-size: 0.875rem;
}

.msg-thread__reply {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border, #334155);
  background: var(--bg-elevated, #0f172a);
  flex-shrink: 0;
  align-items: flex-end;
}

#msg-thread-reply-input {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
  padding: 8px 12px;
  border: 1px solid var(--border, #334155);
  border-radius: 12px;
  background: var(--bg-surface, #1e293b);
  color: var(--text-primary, #f1f5f9);
  font-family: inherit;
  font-size: 0.875rem;
  resize: none;
  overflow-y: auto;
}

#msg-thread-reply-input:focus {
  outline: none;
  border-color: var(--coach-accent, #f59e0b);
}

#msg-thread-reply-send {
  background: var(--coach-accent, #f59e0b);
  color: #1a1a2e;
  border: none;
  border-radius: 12px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  flex-shrink: 0;
}

#msg-thread-reply-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#msg-thread-reply-send:hover:not(:disabled) {
  filter: brightness(1.1);
}

/* Clickable affordance for message threads */
.msg-thread__item {
  cursor: pointer;
  transition: background 0.15s ease;
}

.msg-thread__item:hover {
  background: var(--bg-elevated, #0f172a);
}

.msg-thread__item:focus {
  outline: 2px solid var(--coach-accent, #f59e0b);
  outline-offset: -2px;
}
