/*
 * ============================================================================
 * COMPONENTS - Consolidated UI Component Library
 * ============================================================================
 *
 * This file consolidates all interactive UI components following Powell's
 * minimal CSS philosophy while maintaining Rails conventions.
 *
 * Contents:
 * 1. Buttons - Universal button system with consistent states
 * 2. Badges - Semantic badge system for status and categorization
 * 3. Cards - Reusable card components with glassmorphism
 * 4. Accordion - Collapsible sections with smooth animations
 * 5. Modals - Turbo Frame based modal system
 * 6. Flash Messages & Notifications - User feedback and alerts
 * 7. Progress Bars & Indicators - Progress visualization and stats
 *
 * Architecture:
 * - Mobile-first responsive design
 * - Accessibility built-in (focus states, reduced motion)
 * - Modern CSS (custom properties, oklch colors)
 * - Turbo-ready (progressive enhancement)
 */

/* ============================================================================
   1. BUTTONS
   ============================================================================ */

/* Universal Button State Configuration */
:root {
  --btn-outline-width: 2px;
  --btn-active-transition: 0.05s;
}

/* Base Button Foundation */
.btn {
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-xl);
  font-weight: 600;
  cursor: pointer;
  /* GPU-composited only: transform + opacity never trigger repaint */
  transition: transform 200ms var(--ease-accelerate),
    opacity 200ms var(--ease-accelerate),
    background-color 150ms var(--ease-accelerate),
    color 150ms var(--ease-accelerate);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: var(--text-sm);
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none;
  min-block-size: 2.75rem;
  /* 44px touch target */
  line-height: 1;
  gap: var(--space-xs);
  position: relative;
  white-space: nowrap;
}

/* Disabled State */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* Loading State - Turbo automatically adds aria-busy to forms during submission */
[aria-busy] .btn:disabled {
  position: relative;
}

[aria-busy] .btn:disabled>* {
  visibility: hidden;
}

[aria-busy] .btn:disabled::after {
  --mask: no-repeat radial-gradient(#000 68%, #0000 71%);
  --size: 1.25em;

  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  inline-size: var(--size);
  aspect-ratio: 8/5;
  background: currentColor;
  -webkit-mask: var(--mask), var(--mask), var(--mask);
  -webkit-mask-size: 28% 45%;
  animation: submitting 0.8s infinite linear;
}

/* Button Variants - Define visual styles only */
.btn-primary {
  --btn-outline-color: var(--accent);
  background: var(--accent);
  border: none;
  color: white;
  font-weight: 700;
  font-size: var(--text-base);
  box-shadow: var(--shadow-mint);
}

.btn-secondary {
  background: transparent;
  color: var(--text-light);
}

.btn-secondary--confirmed {
  background: oklch(var(--lch-valid) / 0.12);
  border-color: oklch(var(--lch-valid) / 0.4);
  color: var(--color-valid);
  cursor: default;
  pointer-events: none;
}

.btn-danger {
  --btn-outline-color: var(--invalid);
  background: var(--invalid);
  border: none;
  color: black;
  font-weight: 600;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-light);
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-lighter);
  transition: transform var(--transition-button),
    opacity var(--transition-button),
    background-color var(--transition-button),
    color var(--transition-button);
}

.btn-ghost-danger {
  background: transparent;
  border: none;
  color: var(--text-lighter);
  transition: transform var(--transition-button),
    opacity var(--transition-button),
    background-color var(--transition-button),
    color var(--transition-button);
}

.btn-admin-toggle {
  color: var(--text-lighter);
  border-radius: 9999px;
}

.btn-admin-toggle--active {
  color: oklch(100% 0 0);
  background-color: var(--warn);
}

.btn-admin-toggle:not(.btn-admin-toggle--active):hover,
.btn-admin-toggle:not(.btn-admin-toggle--active):focus-visible {
  color: var(--warn);
}

.btn-admin-toggle.btn-admin-toggle--active:hover,
.btn-admin-toggle.btn-admin-toggle--active:focus-visible {
  color: oklch(100% 0 0);
  background-color: color-mix(in oklch, var(--warn) 80%, oklch(0% 0 0));
  outline: none;
}

.btn-small {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  min-height: 44px;
  /* Ensure accessibility compliance */
  min-width: 44px;
}


/* Page Back Button & Logout Button */
.player-page,
.user-profile-page,
.billing-page,
.training-sessions-page,
.players-page,
.organization-edit-page,
.users-page,
.checkout-page,
.login-page,
.signup-page,
.password-reset-page,
.password-edit-page {
  position: relative;
  width: 100%;
}

.page-back-button {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
}

.player-page .page-back-button {
  left: var(--space-md);
}

.page-back-button .btn {
  padding: var(--space-sm);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Universal Hover/Focus-Visible Pattern - All buttons get 2px outline */
@media (any-hover: hover) {

  /* Faster hover-in transition for snappier feel */
  .btn:hover {
    transition: transform 120ms var(--ease-decelerate),
      opacity 120ms var(--ease-decelerate),
      background-color 120ms var(--ease-decelerate),
      color 120ms var(--ease-decelerate);
  }

  /* Primary button gets lighter background on hover, no outline */
  .btn-primary:hover,
  .btn-primary:focus-visible {
    background: color-mix(in oklch, var(--accent) 85%, white);
    color: white;
    outline: none;
    border: none;
  }

  /* Secondary buttons fill with border color on hover */
  .btn-secondary:hover,
  .btn-secondary:focus-visible {
    background: var(--accent-bg);
    color: var(--text-light);
  }

  /* Outline button gets subtle background on hover */
  .btn-outline:hover,
  .btn-outline:focus-visible {
    background: var(--accent-bg);
    border-color: var(--text-lighter);
    outline: none;
  }

  /* Danger button gets outline on hover, keeps black text */
  .btn-danger:hover,
  .btn-danger:focus-visible,
  a.btn-danger:hover,
  a.btn-danger:focus-visible {
    color: black;
    outline: var(--btn-outline-width) solid var(--invalid);
  }

  /* Ghost button reveals subtle fill on hover */
  .btn-ghost:hover,
  .btn-ghost:focus-visible {
    background: var(--accent-bg);
    color: var(--text);
    outline: none;
  }

  /* Ghost danger button reveals red fill on hover */
  .btn-ghost-danger:hover,
  .btn-ghost-danger:focus-visible {
    background: var(--invalid);
    color: white;
    outline: none;
  }
}

/* Universal Active Pattern - Scale press feedback */
.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
  outline: none;
  box-shadow: none;
  transform: scale(0.97);
  transition-duration: var(--btn-active-transition);
}


/* ============================================================================
   2. BADGES
   ============================================================================ */

/* Rank Badge */
.rank-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
}

.rank-badge--promoted {
  background: var(--excellent);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
}

.rank-badge--demoted {
  background: var(--warn);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
}

.rank-badge-arrow {
  width: 1.2em;
  height: 1.2em;
  flex-shrink: 0;
  opacity: 0.85;
}

/* Interactive rank badge — owner tappable link */
.rank-badge--interactive {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
}

.rank-badge--interactive:hover {
  color: white;
  opacity: 0.85;
}

.rank-badge-chevron {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  opacity: 0.85;
}

/* Rank change event — shown in the player session timeline */
.rank-change-event {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.rank-change-event--promoted {
  background: color-mix(in oklch, var(--valid) 8%, transparent);
  border-left: 3px solid var(--valid);
}

.rank-change-event--demoted {
  background: color-mix(in oklch, var(--warn) 8%, transparent);
  border-left: 3px solid var(--warn);
}

.rank-change-event-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.rank-change-event--promoted .rank-change-event-icon {
  color: var(--valid);
}

.rank-change-event--demoted .rank-change-event-icon {
  color: var(--warn);
}

.rank-change-event-body {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  font-size: var(--text-sm);
}

.rank-change-event-title {
  color: var(--text);
  font-weight: 500;
}

.rank-change-event-from {
  color: var(--text-lighter);
  font-size: var(--text-xs);
}

/* Promoted pip — small amber pill shown on the player list */


/* General badge system */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge--new {
  background: oklch(var(--lch-accent) / 0.15);
  color: var(--accent);
}

.badge--emailed {
  background: oklch(var(--lch-text-light) / 0.1);
  color: var(--text-lighter);
}

.badge--no-show {
  background: var(--surface-alt);
  color: var(--text-lighter);
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

/* Tier Badge System - Consolidated from users.css and checkout.css duplicates */
.tier-badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid;
  transition: opacity var(--transition-standard), transform var(--transition-standard);
}

.tier-badge-pro {
  background: oklch(var(--lch-accent) / 0.2);
  color: var(--accent);
  border-color: oklch(var(--lch-accent) / 0.3);
}

.tier-badge-lite {
  background: rgba(119, 119, 119, 0.2);
  color: var(--text-lighter);
  border-color: rgba(119, 119, 119, 0.3);
}

/* ============================================================================
   3. CARDS
   ============================================================================ */

/* Base Card Styles */
.card {
  background: var(--card-bg-pure);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-2xl);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-lg);
  /* Center with automatic margins while ensuring minimum edge spacing */
  margin-inline: max(var(--space-md), auto);
}


.card-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-lg);
  padding-top: var(--space-xs);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-top: 5px;
}

.card-header .card-title {
  margin-bottom: 0;
}

/* ============================================================================
   UNIFIED LIST SYSTEM - Shared Base Classes
   ============================================================================ */

/* Base List Container - Used by all lists (players, coaches, sessions) */
.list-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  isolation: isolate;
  background: transparent;
  border-radius: var(--radius-lg);
  margin-top: var(--space-sm);
}

.player-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

/* Base List Item - Clickable row pattern used across all lists */
.list-item {
  background: transparent;
  border: none;
  padding: var(--space-md) var(--space-md);
  display: flex;
  flex-direction: row;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: background-color var(--transition-fast);
  cursor: pointer;
  min-height: 56px;
}

/* Base hover effect for list items */
@media (any-hover: hover) {
  .list-item:hover {
    background: var(--accent-bg);
  }
}

.today-log-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  flex-shrink: 0;
  width: fit-content;
  color: var(--text-lighter);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color var(--transition-fast);
}

@media (any-hover: hover) {
  .today-log-btn:hover {
    color: var(--accent);
  }
}

.today-log-btn .icon {
  width: 28px;
  height: 28px;
}

/* ============================================================================
   PLAYERS LIST - Google Docs Style Layout
   ============================================================================ */

/* Player Item - name fills left, meta elements grouped on right */
.player-item {
  display: grid;
  grid-template-columns: 1fr 4rem 9rem 10rem 3rem;
  gap: var(--space-lg);
  align-items: center;
}

.player-col-name {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-col-trained {
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Player name in list view */
.player-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  margin: 0;
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

/* Hover effect for player name */
@media (any-hover: hover) {
  .player-item:hover .player-name {
    color: var(--accent);
  }
}

/* Rank badge column — right-aligned within its cell */
.player-col-rank {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-xs);
}

/* Sparkline column — center content vertically */
.player-col-sparkline {
  display: flex;
  align-items: center;
}

/* Status chip column */
.player-col-status {
  display: flex;
  align-items: center;
}

/* Player picker — simplified 3-column layout */
.player-item--picker {
  grid-template-columns: 1fr 8rem 2.5rem;
}

.player-col-trained--picker {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Player status chip */
.player-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

.player-status-chip::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.player-status-chip--good {
  --_chip-color: var(--valid);
  color: var(--_chip-color);
  background: color-mix(in oklch, var(--valid) 12%, transparent);
  border-color: color-mix(in oklch, var(--valid) 20%, transparent);
}

.player-status-chip--highlight {
  --_chip-color: var(--excellent);
  color: var(--_chip-color);
  background: color-mix(in oklch, var(--excellent) 12%, transparent);
  border-color: color-mix(in oklch, var(--excellent) 20%, transparent);
}

.player-status-chip--warn {
  --_chip-color: var(--warn);
  color: var(--_chip-color);
  background: color-mix(in oklch, var(--warn) 12%, transparent);
  border-color: color-mix(in oklch, var(--warn) 20%, transparent);
}

.player-status-chip--bad {
  --_chip-color: var(--invalid);
  color: var(--_chip-color);
  background: color-mix(in oklch, var(--invalid) 12%, transparent);
  border-color: color-mix(in oklch, var(--invalid) 20%, transparent);
}

.player-status-chip--muted {
  --_chip-color: var(--text-lighter);
  color: var(--_chip-color);
  background: color-mix(in oklch, var(--text-lighter) 10%, transparent);
  border-color: var(--border);
}

.player-status-chip--interactive:hover {
  filter: brightness(0.92);
  color: var(--_chip-color);
}

.player-status-chip--interactive {
  cursor: pointer;
  text-decoration: none;
}


/* Player header chips — rank + status chips in page-header-left */
.player-header-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

#player-rank-chips {
  display: flex;
  align-items: center;
}

/* Player header name + age grouped vertically */
.player-header-name-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-header-age {
  font-size: var(--text-sm);
  color: var(--text-lighter);
  font-weight: 400;
  line-height: 1.2;
}

/* Training days inline in player header meta row */
.player-header-schedule {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-left: calc(var(--space-sm) - var(--space-md));
  padding-left: var(--space-sm);
  border-left: 1px solid var(--border);
}

.player-header-schedule-icon {
  width: 14px;
  height: 14px;
  color: var(--text-lighter);
  flex-shrink: 0;
}

.player-header-schedule-days {
  font-size: var(--text-xs);
  color: var(--text-lighter);
}

/* Contact list — icon + value rows */
.player-contact-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.player-contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--text);
  padding: var(--space-xs) 0;
  transition: color var(--transition-fast);
}

@media (any-hover: hover) {
  .player-contact-item:hover {
    color: var(--accent);
  }
}

.player-contact-icon {
  width: 16px;
  height: 16px;
  color: var(--text-lighter);
  flex-shrink: 0;
}

.player-contact-value {
  font-size: var(--text-sm);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Collapsible bio */
.player-bio-details {
  margin-top: var(--space-sm);
}

.player-bio-details[open] {
  margin-top: var(--space-md);
}

.player-contact-list + .player-bio-details {
  border-top: 1px solid var(--border);
  padding-top: var(--space-sm);
  margin-top: var(--space-sm);
}

.player-bio-summary {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.player-bio-summary::-webkit-details-marker {
  display: none;
}

/* Quick-edit pencil button inside bio summary */
.player-bio-edit-btn {
  display: inline-flex;
  align-items: center;
  color: var(--text-lighter);
  text-decoration: none;
  margin-left: auto;
  cursor: pointer;
}

.player-bio-edit-btn:hover {
  color: var(--accent);
}

.player-bio-summary::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.player-bio-details[open] .player-bio-summary::before {
  transform: rotate(45deg);
}

.player-bio-body {
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-light);
  line-height: 1.6;
}

.player-bio-body p {
  margin: 0 0 var(--space-xs);
}

.player-bio-body p:last-child {
  margin-bottom: 0;
}

/* Player evidence band — always-visible stat strip above tabs */
.player-evidence-band {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.player-evidence-band--empty {
  background: var(--accent-bg);
  border-color: var(--border);
  padding: var(--space-sm) var(--space-md);
  justify-content: center;
}

.player-evidence-empty {
  font-size: var(--text-sm);
  color: var(--text-light);
  margin: 0;
}

.player-evidence-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--space-sm) var(--space-md);
  background: var(--accent-bg);
  flex: 1 1 auto;
  min-width: 72px;
  text-align: center;
}

.player-evidence-value {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.player-evidence-label {
  font-size: var(--text-xs);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
  white-space: nowrap;
}

/* Session detail stat strip — same primitive as player-evidence-band, card-hosted variant */
.session-stat-strip {
  display: flex;
}

.session-stat {
  flex: 1;
  text-align: center;
  align-content: center;
  padding: var(--space-md) 0;
  text-decoration: none;
  color: inherit;
}

.session-stat+.session-stat {
  border-left: 1px solid var(--border);
}

.session-stat-value {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

/* Center and space shared bubble classes when used inside the stat strip */
.session-stat .session-work-rate,
.session-stat .session-trend {
  margin-inline: auto;
  margin-bottom: var(--space-xs);
}

/* Work rate pill: don't stretch to full column width */
.session-stat .session-work-rate {
  width: fit-content;
}

/* Trend pill: allow text alongside icon, override fixed icon dimensions */
.session-stat .session-trend {
  width: fit-content;
  height: auto;
  padding: var(--space-xs) var(--space-sm);
  gap: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 600;
}

.session-stat-label {
  font-size: var(--text-xs);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

@media (max-width: 640px) {
  .session-stat {
    padding: var(--space-sm) 0;
  }

  .session-stat-value {
    font-size: var(--text-sm);
  }
}

/* Player list column headers — mirrors player-item flex layout */
.player-list-header {
  display: grid;
  grid-template-columns: 1fr 4rem 9rem 10rem 3rem;
  gap: var(--space-lg);
  padding-inline: var(--space-md);
  padding-block: var(--space-xs);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.player-col-header {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-lighter);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.player-col-header--sortable {
  cursor: pointer;
  transition: color var(--transition-fast);
}

@media (any-hover: hover) {
  .player-col-header--sortable:hover {
    color: var(--text);
  }
}

.player-col-header--active {
  color: var(--accent);
}

.sort-arrow {
  margin-left: 0.25rem;
  font-style: normal;
}

@media (max-width: 767px) {

  .player-item,
  .player-list-header {
    grid-template-columns: 1fr 3rem 7rem;
    gap: var(--space-sm);
  }

  .player-col-rank,
  .player-col-status {
    display: none;
  }
}

@media (max-width: 767px) {
  .player-item--picker {
    grid-template-columns: 1fr 6rem 2.5rem;
  }
}

/* Last trained info - positioned right after name */
.player-last-trained {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0;
  display: inline;
}

.player-last-trained.no-sessions {
  color: var(--text-lighter);
  font-style: italic;
}

.player-last-trained.lapse-warning {
  color: var(--required);
}

.player-last-trained.lapse-danger {
  color: var(--invalid);
}

/* ============================================================================
   PLAYER PROFILE - Show Page Layout
   ============================================================================ */

/* Player Profile Container - wrapper with background and border radius */
.player-profile-container {
  margin-bottom: var(--space-lg);
}

/* Player Profile with Note - side-by-side layout on desktop */
.player-profile-with-note {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-lg);
}

@media (min-width: 768px) {
  .player-profile-with-note {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--space-lg);
  }

  .player-profile-with-note .player-profile-container {
    flex: 1;
    margin-bottom: 0;
  }

  .player-profile-with-note .focus-note-wrap {
    flex: 0 0 220px;
    margin-bottom: 0;
  }

  .player-profile-with-note .focus-note {
    width: 220px;
    min-height: 220px;
  }
}

/* Player Profile Hero - mobile-only photo above the profile card */
.player-profile-hero {
  display: none;
}

@media (max-width: 767px) {
  .player-profile-hero--has-photo {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-md);
  }

  .player-profile-hero--has-photo .player-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
  }
}

/* Player Profile Card - detail fields */
.player-profile-card {
  max-width: 100%;
  margin-bottom: var(--space-md);
  border: 1px solid var(--border);
  background: var(--accent-bg);
  border-radius: var(--radius-xl);
  padding: var(--space-md) var(--space-lg);
}


@media (max-width: 767px) {
  .player-col-rank {
    display: none;
  }

  .player-profile-card {
    padding: var(--space-sm) var(--space-md);
  }
}


.player-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  transition: opacity var(--transition-standard), transform var(--transition-standard);
}

.player-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  border: 2px dashed var(--border);
  border-radius: 50%;
  box-sizing: border-box;
}

.player-photo-placeholder .placeholder-icon {
  width: 60%;
  height: 60%;
  color: var(--text-lighter);
  opacity: 0.5;
}

/* Photo Upload Forms */
.photo-upload-form {
  position: absolute;
}

.player-profile-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-self: flex-start;
  width: 100%;
}

.player-profile-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Field container for labeled details (matches form-field pattern) */
.player-detail-field {
  display: flex;
  flex-direction: column;
}

/* Rank field should be inline, not full width */
.player-detail-field .rank-badge {
  align-self: flex-start;
}

/* Label for detail items (e.g., "Phone", "Email") - matches form-label pattern */
.player-detail-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-light);
}

.player-detail-value {
  font-size: var(--text-base);
  color: var(--text);
  font-weight: 500;
  min-width: 0;
}

.player-bio-text {
  line-height: 1.6;
  color: var(--text);
}

.player-contact-link {
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: block;
}

.player-contact-link:hover {
  text-decoration: underline;
}

/* Timeline Milestone Events */
.timeline-milestone {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) 0;
}

.timeline-milestone-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-milestone--announcement .timeline-milestone-icon {
  background: var(--accent-bg);
  color: var(--warn);
}

.timeline-milestone-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
}

.timeline-milestone-label {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
}

.timeline-milestone-date {
  font-size: var(--text-xs);
  color: var(--text-lighter);
}

.timeline-milestone-description {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.5;
}

.trend-icon,
.icon.trend-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  width: var(--icon-xs);
  height: var(--icon-xs);
}

.trend-icon--up {
  color: var(--valid);
}

.trend-icon--down {
  color: var(--invalid);
}

/* ============================================================================
   TRAINING SESSION COMPONENTS
   ============================================================================ */

/* ============================================================================
   5. MODALS
   ============================================================================ */

/* Modal Styles - Native dialog based */
dialog.modal-dialog {
  border: none;
  padding: var(--space-sm);
  background: transparent;
  color: inherit;
  margin: 0;
  max-width: 100dvw;
  max-height: 100dvh;
  width: 100dvw;
  height: 100dvh;
}

dialog.modal-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

dialog.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

@media (min-width: 48rem) {
  dialog.modal-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }
}

.modal-content {
  background: var(--modal-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: min(26rem, 90vw);
  animation: slideUp 0.28s var(--ease-spring);
}

/* Promote to GPU layer only while the dialog is open and animating */
dialog.modal-dialog[open] .modal-content {
  will-change: transform, opacity;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--modal-border);
}

.modal-header h2 {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--text);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-light);
  transition: background-color var(--transition-standard), color var(--transition-standard);
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
  font-weight: normal;
}

.modal-close:hover {
  background: var(--modal-border);
  color: var(--text);
}

.modal-close:focus-visible {
  outline: none;
}

.modal-body {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.modal-details {
  margin: var(--space-sm) 0 var(--space-md);
  padding-left: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.modal-details li {
  font-size: var(--text-sm);
  color: var(--text-light);
}

.modal-form-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.modal-form-actions .btn {
  width: 100%;
  justify-content: center;
}

.confirm-code {
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
  color: var(--text);
  user-select: all;
}

/* Modal animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate3d(0, 32px, 0) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes slideDown {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    opacity: 0;
    transform: translate3d(0, 16px, 0) scale(0.97);
  }
}

/* Prevent body scroll when modal is open */
body:has(dialog.modal-dialog[open]) {
  overflow: hidden;
}

/* ============================================================================
   SLIDE-IN PANEL / BOTTOM SHEET
   ============================================================================ */

.panel-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  /* Mobile: Solid backdrop for performance (no blur) */
  background: rgba(0, 0, 0, 0.75);
  padding-bottom: 0;
  z-index: 1000;
  /* Higher than nav (100) to cover both mobile bottom nav and desktop sidebar */
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}

.panel-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Desktop: Add blur effect and change alignment for right panel */
@media (min-width: 48rem) {
  .panel-backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: stretch;
    justify-content: flex-end;
    padding-bottom: 0;
  }
}

/* Mobile: Bottom sheet */
.panel-content {
  background: var(--accent-bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3), var(--shadow-xl);
  width: 100%;
  height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  will-change: transform;
  contain: layout style;
  transform: translateY(100%);
  transition: transform 250ms var(--ease-spring);
}

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

/* Desktop: Right panel */
@media (min-width: 48rem) {
  .panel-content {
    border-radius: 0;
    width: 560px;
    max-height: none;
    height: 100vh;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3), var(--shadow-xl);
    transform: translateX(100%);
  }

  .panel-content.is-open {
    transform: translateX(0);
  }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  background: var(--accent-bg);
  flex-shrink: 0;
}

/* Form inside panel-content must participate in flex layout */
.panel-content>form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header h2 {
  margin: 0;
  font-size: var(--font-lg);
  color: var(--text);
}

.panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-light);
  transition: background-color var(--transition-standard), color var(--transition-standard);
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
  font-weight: normal;
}

.panel-close:hover {
  background: var(--modal-border);
  color: var(--text);
}

.panel-scrollable-content {
  padding: var(--space-md);
  /* Bottom padding accounts for safe area when there's no panel-footer */
  padding-bottom: calc(var(--space-md) + var(--safe-inset-bottom));
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  /* Critical: allows flex item to shrink below content size */
  display: flex;
  flex-direction: column;
  scroll-padding-top: var(--space-lg);
}

/* Make turbo-frames transparent to flex layout inside panels */
.panel-content>turbo-frame,
.panel-content>form>turbo-frame {
  display: contents;
}

/* When panel has a footer, remove bottom padding from scrollable content */
.panel-content:has(.panel-footer) .panel-scrollable-content {
  padding-bottom: 0;
}

/* Large form input modifier */
.form-input-large {
  font-size: var(--text-2xl) !important;
}

.panel-footer {
  padding: var(--space-md);
  /* Bottom padding accounts for safe area */
  padding-bottom: calc(var(--space-md) + var(--safe-inset-bottom));
  background-color: var(--accent-bg);
  border-top: 1px solid var(--modal-border);
  flex-shrink: 0;
}

/* Remove all extra margin from elements inside panel footer */
.panel-footer .form-actions,
.panel-footer .form-actions-flex {
  margin-top: 0;
  margin-bottom: 0;
}

.panel-footer .btn {
  margin: 0;
}

/* Prevent body scroll when panel is open */
body:has(turbo-frame#panel:not(:empty)) {
  overflow: hidden;
}


/* ============================================================================
   6. FLASH MESSAGES & NOTIFICATIONS
   ============================================================================ */

/* Flash Messages Container */
#flash-messages {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md);
  padding-top: calc(var(--space-md) + var(--safe-inset-top));
  pointer-events: none;
  gap: var(--space-sm);
}

/* Flash Message - Minimal style */
.flash {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  background: var(--accent);
  color: oklch(98% 0 0);
  animation: flash-appear-fade 4s ease both;
}

/* Alert flashes (errors, action prompts) — appear but don't auto-dismiss */
.flash--alert,
.flash--error {
  animation: flash-appear 0.3s ease both;
}

.flash__body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.flash__action {
  flex-shrink: 0;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  background: oklch(100% 0 0 / 0.15);
  color: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: background-color var(--transition-fast);
}

.flash__action:hover {
  background: oklch(100% 0 0 / 0.25);
  color: inherit;
}

.flash--alert .flash__icon,
.flash--error .flash__icon {
  color: inherit;
}

/* Flash animation keyframes */
@keyframes flash-appear-fade {
  0% {
    opacity: 0;
    transform: translateY(-1rem);
  }

  8%,
  75% {
    opacity: 1;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-0.5rem);
  }
}

@keyframes flash-appear {
  from {
    opacity: 0;
    transform: translateY(-1rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Flash Icon */
.flash__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flash__icon .icon {
  width: 20px;
  height: 20px;
}

/* Flash Text */
.flash__text {
  flex: 1;
  font-weight: 500;
  line-height: 1.4;
  word-wrap: break-word;
}

/* Close Button */
.flash__close {
  flex-shrink: 0;
  padding: var(--space-xs);
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  opacity: 0.7;
  color: inherit;
  transition: opacity var(--transition-fast);
}

.flash__close .icon {
  width: 16px;
  height: 16px;
}

.flash__close:hover {
  opacity: 1;
}


.empty-state-title {
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 10px;
}

.empty-state {
  color: var(--text-light);
  margin-bottom: 30px;
  margin: 0 auto;
  max-width: fit-content;
}

.empty-state--prominent {
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.empty-state--prominent .empty-state-icon-svg {
  width: 3rem;
  height: 3rem;
  color: var(--text-lighter);
}

.empty-state--prominent .empty-state-description {
  color: var(--text-light);
  max-width: 28ch;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-xs);
}


/* Responsive Design */
@media (max-width: 48rem) {
  #flash-messages {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  .flash {
    max-width: none;
  }

  .flash--alert,
  .flash--error {
    align-items: flex-start;
    border-radius: var(--radius-xl);
  }

  .flash--alert .flash__body,
  .flash--error .flash__body {
    flex-direction: column;
    gap: var(--space-xs);
    padding-top: 2px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  /* Dark mode uses same solid backgrounds */
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .flash__close {
    border: 1px solid currentColor;
  }
}


/* ============================================================================
   7. PROGRESS BARS & INDICATORS
   ============================================================================ */

/* Base Progress Bar */
.progress-bar-container {
  width: 100%;
  margin-bottom: var(--space-sm);
}

.progress-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xs);
  font-size: var(--text-sm);
}

.progress-bar-label {
  color: var(--text);
  font-weight: 500;
}

.progress-bar-value {
  color: var(--text-lighter);
  font-variant-numeric: tabular-nums;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--accent-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}

.progress-bar-fill {
  height: 100%;
  width: var(--progress-width, 0%);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    background-color var(--transition-smooth);
  position: relative;
  min-width: 2px;
  /* Ensure visibility even at very low percentages */
}

/* Color Variants */

/* Success/Safe - Green (< 70%) */
.progress-bar-fill.success,
.progress-bar-fill[data-level="safe"] {
  background: var(--accent);
}

/* Warning - Orange (70-90%) */
.progress-bar-fill.warning,
.progress-bar-fill[data-level="warning"] {
  background: var(--required);
}

/* Danger - Red (> 90%) */
.progress-bar-fill.danger,
.progress-bar-fill[data-level="danger"] {
  background: var(--invalid);
}

/* Progress Bar with Glow */
.progress-bar-fill.glow {
  position: relative;
  overflow: hidden;
}

.progress-bar-fill.glow::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg,
      transparent,
      oklch(var(--lch-bg) / 0.3) 50%,
      transparent);
  animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(200%);
  }
}

/* ============================================================================
   8. WORK RATE BADGES - Consolidated System
   ============================================================================ */

/* Shared work-rate color modifiers — applied by any work-rate display element */
.rate-9,
.rate-10 {
  color: var(--excellent);
  background: oklch(var(--lch-excellent) / 0.15);
}

.rate-7,
.rate-8 {
  color: var(--valid);
  background: oklch(var(--lch-valid) / 0.15);
}

.rate-3,
.rate-4,
.rate-5,
.rate-6 {
  color: var(--required);
  background: oklch(var(--lch-required) / 0.15);
}

.rate-0,
.rate-1,
.rate-2 {
  color: var(--invalid);
  background: color-mix(in oklch, var(--invalid) 15%, transparent);
}

/* Base work rate badge styles */
.work-rate-badge {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 2px solid;
  margin-left: var(--space-xs);
}

/* Unset work rate - neutral muted state */
.work-rate-badge.rate-unset {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

/* Badge variant: adds border and slightly higher opacity */
.work-rate-badge.rate-9,
.work-rate-badge.rate-10 {
  background: oklch(var(--lch-excellent) / 0.2);
  border-color: var(--excellent);
}

.work-rate-badge.rate-7,
.work-rate-badge.rate-8 {
  background: oklch(var(--lch-valid) / 0.2);
  border-color: var(--valid);
}

.work-rate-badge.rate-3,
.work-rate-badge.rate-4,
.work-rate-badge.rate-5,
.work-rate-badge.rate-6 {
  background: oklch(var(--lch-required) / 0.2);
  border-color: var(--required);
}

.work-rate-badge.rate-0,
.work-rate-badge.rate-1,
.work-rate-badge.rate-2 {
  background: color-mix(in oklch, var(--invalid) 20%, transparent);
  border-color: var(--invalid);
}

/* Large variant */
.work-rate-badge.large {
  padding: 8px 16px;
  font-size: 1.1em;
  font-weight: 700;
}

/* ============================================================================
   TABS - Two-panel tab interface with URL state persistence
   ============================================================================ */

.tabs-nav {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}

.tab {
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-light);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.tab:hover {
  color: var(--text);
}

.tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
}

.tab-panel--active {
  display: block;
}

/* Notes feed - flat document-like session note history in Notes tab */
.notes-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.notes-feed-entry {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border);
}

.notes-feed-entry:last-child {
  border-bottom: none;
}

.notes-feed-date {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.01em;
}

.notes-feed-text {
  margin: 0;
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.6;
  white-space: pre-line;
}

/* ============================================================================
   9. UTILITY CLASSES - Checkout, Forms, Loading States
   ============================================================================ */

/* Admin Badge Variants */
.badge-comp {
  background: oklch(75% 0.15 160);
  /* Green for complimentary */
  color: white;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
}

.badge-paid {
  background: oklch(65% 0.15 230);
  /* Blue for paid */
  color: white;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
}

/* Loading Indicator */
.loading-indicator {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-light);
}

/* Empty State (Generic) */


/* ============================================================================
   REDUCED MOTION SUPPORT
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {

  .flash {
    animation: none;
  }

  #flash-messages {
    animation: none;
  }

  .accordion-content,
  .accordion-chevron {
    transition: none;
  }

  .progress-bar-fill {
    transition: none;
  }

  .progress-bar-fill.glow::after {
    animation: none;
  }
}

/* ============================================================================
   Share Form - Radio-gated submit
   ============================================================================ */

.share-form .btn-primary {
  pointer-events: none;
  opacity: 0.5;
}

.share-form:has(input[type="radio"]:checked) .btn-primary {
  pointer-events: auto;
  opacity: 1;
}

/* ============================================================================
   EMAIL PREVIEW (inline send preview)
   ============================================================================ */


.email-preview-link-row {
  margin-top: var(--space-xs);
}

.email-preview-link {
  font-size: var(--text-sm);
  color: var(--text-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.email-preview-link:hover {
  color: var(--text);
}

/* Email preview modal — appended to body so it sits above panels and modals */
dialog.email-preview-modal {
  border: none;
  padding: var(--space-sm);
  background: transparent;
  color: inherit;
  margin: 0;
  max-width: 100dvw;
  max-height: 100dvh;
  width: 100dvw;
  height: 100dvh;
}

dialog.email-preview-modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

dialog.email-preview-modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

@media (min-width: 48rem) {
  dialog.email-preview-modal::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }
}

.email-preview-modal-inner {
  background: var(--modal-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  width: min(640px, 94vw);
  height: min(720px, 88dvh);
  overflow: hidden;
  animation: slideUp 0.28s var(--ease-spring);
}

.email-preview-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--modal-border);
  flex-shrink: 0;
}

.email-preview-modal-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.email-preview-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background-color var(--transition-standard), color var(--transition-standard);
}

.email-preview-modal-close:hover {
  background: var(--modal-border);
  color: var(--text);
}

.email-preview-modal-frame {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
}

.period-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.period-toggle-btn {
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-light);
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  text-decoration: none;
  line-height: 1.5;
  cursor: pointer;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
}

.period-toggle-btn:last-child {
  border-right: none;
}

.period-toggle-btn--active {
  background: var(--surface-raised);
  color: var(--text);
}

.period-toggle-btn:hover:not(.period-toggle-btn--active) {
  background: var(--surface-hover);
}

/* ============================================================================
   Focus Note - Sticky note UX for player current focus (Pro only)
   ============================================================================ */

.focus-note-wrap {
  rotate: -1deg;
  margin-bottom: 1.5rem;
  width: 220px;
}

.focus-note {
  background: oklch(94% 0.14 98);
  border-radius: 2px;
  box-shadow: 2px 3px 8px oklch(0% 0 0 / 0.15), 0 1px 2px oklch(0% 0 0 / 0.1);
  padding: 1rem 1rem 1.5rem;
  position: relative;
  cursor: pointer;
  min-height: 220px;
}

.focus-note-text {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: oklch(25% 0.05 98);
  white-space: pre-wrap;
  margin: 0;
}

.focus-note-placeholder {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: oklch(62% 0.08 98);
  font-style: italic;
  margin: 0;
}

.focus-note-clear {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: oklch(55% 0.08 98);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  transition: color 150ms ease;
}

.focus-note-clear:hover {
  color: oklch(30% 0.06 98);
}

.focus-note .focus-note-input,
.focus-note .focus-note-input:focus,
.focus-note .focus-note-input:focus-visible {
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  border-radius: 0;
  resize: none;
  width: 100%;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: oklch(25% 0.05 98);
  min-height: 4rem;
  padding: 0;
  font-family: inherit;
}

/* ============================================================================
   ROSTER METER PILL — Lite org player count indicator in page header
   ============================================================================ */

.roster-meter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--color-text-light);
  white-space: nowrap;
  flex-shrink: 0;
}

.roster-meter-pill--at-limit {
  color: var(--color-accent);
  border-color: color-mix(in oklch, var(--color-accent) 35%, var(--color-border));
  background: color-mix(in oklch, var(--color-accent) 8%, var(--color-bg));
  font-weight: 600;
}

.roster-meter-pill__upgrade {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.roster-meter-pill__upgrade:hover {
  text-decoration: underline;
}

/* ============================================================================
   ROSTER PROGRESS — Lite org player count progress bar on Players index
   ============================================================================ */

.roster-progress {
  margin-block-end: var(--space-md);
}

.roster-progress .progress-bar-container {
  margin-bottom: 0;
}

/* ============================================================================
   LITE LIMIT STRIP — Inline upsell when Lite player cap is reached
   ============================================================================ */

.lite-limit-strip {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: color-mix(in oklch, var(--color-accent) 8%, var(--color-bg));
  border: 1px solid color-mix(in oklch, var(--color-accent) 30%, var(--color-border));
  border-radius: var(--radius-md);
  margin-block-end: var(--space-md);
}

.lite-limit-strip__body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-xs) var(--space-sm);
  min-width: 0;
}

.lite-limit-strip__message {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent);
}

.lite-limit-strip__hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

.lite-limit-strip__cta {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
}

.lite-limit-strip__cta:hover {
  text-decoration: underline;
}

.list-item--accented {
  border-left: 3px solid var(--color-border);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.list-item--accented:hover {
  border-left-color: var(--color-accent);
}

.list-item--accented-bad {
  border-left-color: var(--color-invalid);
}

.list-item--accented-warn {
  border-left-color: var(--warn);
}

.list-item--accented-ok {
  border-left-color: transparent;
}

.list-item--accented-muted {
  border-left-color: var(--text-lighter);
  opacity: 0.6;
}

/* ── Timeline list — time + dot + name + status grid ── */
.list-timeline {
  padding: var(--space-sm) 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: var(--space-md);
  align-items: start;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  flex-shrink: 0;
  justify-self: center;
  margin-top: 5px;
}

.timeline-dot--done {
  background: var(--color-accent);
}

.timeline-dot--pending {
  background: var(--tint-today, var(--color-invalid));
}

.timeline-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.timeline-item-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-item-meta {
  font-size: var(--text-xs);
  color: var(--color-text-lighter);
}

.timeline-item-action {
  flex-shrink: 0;
}

.timeline-item-notes {
  font-size: var(--text-xs);
  color: var(--color-text-lighter);
  margin: 2px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.timeline-item-notes--private {
  font-style: italic;
}

.timeline-item-notes--plan {
  color: var(--color-accent);
}

.today-page .card--callout {
  margin-bottom: var(--space-md);
}

/* ── Journal list — date eyebrow, prose, work-rate badge ── */
.list-journal {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.journal-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: var(--space-sm);
  align-items: start;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
}

.journal-item--no-badge {
  grid-template-columns: 56px 1fr;
}

.journal-item:last-child {
  border-bottom: none;
}

.journal-item-date {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--color-text-lighter);
  text-transform: uppercase;
  padding-top: 3px;
  line-height: 1.3;
}

.journal-item-body {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.5;
}

.journal-item-title {
  font-weight: 600;
  color: var(--color-text);
}

.journal-item-excerpt {
  color: var(--color-text-light);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.journal-item-meta {
  font-size: var(--text-xs);
  color: var(--color-text-lighter);
  margin-top: var(--space-xs);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

.journal-item-badges {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  justify-self: end;
}

.journal-item-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: var(--text-sm);
  color: white;
  flex-shrink: 0;
}

.journal-item-trend--better { background: var(--color-accent); }
.journal-item-trend--same   { background: var(--color-text-lighter); }
.journal-item-trend--worse  { background: var(--color-invalid); }

.journal-item-coach {
  font-size: var(--text-xs);
  color: var(--color-text-lighter);
  font-weight: 400;
  margin-left: var(--space-xs);
}

.journal-item-badge--high  { background: var(--color-accent); }
.journal-item-badge--mid   { background: var(--warn); }
.journal-item-badge--low   { background: var(--color-invalid); }
.journal-item-badge--none  { background: var(--color-text-lighter); }

.journal-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

/* ── Stat card — single big number ── */
.card--stat {
  background: var(--card-bg-pure, var(--color-accent-bg));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
}

.card-stat-label {
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-lighter);
}

.card-stat-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: var(--space-xs) 0 var(--space-xs);
}

.card-stat-foot {
  font-size: var(--text-xs);
  color: var(--color-text-lighter);
}

.card-stat-value--accent  { color: var(--color-accent); }
.card-stat-value--warn    { color: var(--warn); }
.card-stat-value--bad     { color: var(--color-invalid); }

.player-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-md) 0;
}

/* ── Callout card — warm wash, needs action ── */
.card--callout {
  background: linear-gradient(to right, oklch(58% 0.18 29 / 0.06), oklch(78% 0.14 65 / 0.04));
  border: 1px solid oklch(58% 0.18 29 / 0.18);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.callout-tag {
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  font-weight: 800;
  color: var(--color-invalid);
  padding: 3px 6px;
  background: oklch(58% 0.18 29 / 0.1);
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  flex-shrink: 0;
}

.callout-body {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.card--callout--muted {
  background: var(--color-surface);
  border-color: var(--color-border);
}

.card--callout--muted .callout-tag {
  color: var(--color-text-lighter);
  background: var(--color-border);
}

.roster-callout {
  margin: 0 0 var(--space-sm);
}

/* Inactive player filter toggle */
.roster-filter-link {
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-lighter);
  text-decoration: none;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  background: transparent;
  transition: color 150ms, background-color 150ms, border-color 150ms;
}

.roster-filter-link:hover {
  color: var(--text);
  background: var(--accent-bg);
  border-color: color-mix(in oklch, var(--accent) 50%, var(--border));
}

.roster-filter-link--active {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: var(--accent);
}

.callout-link {
  color: var(--color-text);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Quote / private note card — purple wash, italic ── */
.card--quote {
  background: var(--color-private-bg, oklch(96% 0.012 280));
  border: 1px solid oklch(50% 0.04 280 / 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
}

.quote-tag {
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  font-weight: 800;
  color: var(--color-private, oklch(50% 0.04 280));
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
  display: block;
}

.quote-body {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--color-text);
  font-style: italic;
}

.quote-attribution {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-lighter);
  margin-top: var(--space-sm);
  display: block;
}

/* ── Data card — sparkline visualization, work-rate trend ── */
.card--data {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
}

.card--data-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.card--data-label {
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-lighter);
}

.card--data-trend {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-accent);
}

.card--data-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 80px;
}

.card--data-bar {
  flex: 1;
  height: var(--bar-h, 50%);
  border-radius: 1px;
}

.card--data-bar--high { background: var(--color-accent); }
.card--data-bar--mid  { background: var(--warn); }
.card--data-bar--low  { background: var(--color-invalid); }

/* ── Auth page supplements ── */
.auth-eyebrow {
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--color-text-lighter);
  text-transform: uppercase;
  display: block;
  margin-bottom: var(--space-xs);
}

.auth-card-tint {
  border-top: 3px solid var(--page-tint, var(--color-accent));
  padding-top: var(--space-md);
}

/* ── Expandable callout cards (Today page: Yesterday / Tomorrow) ── */
details.card--callout {
  display: block;
  cursor: default;
}

details.card--callout .callout-summary {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

details.card--callout .callout-summary::-webkit-details-marker {
  display: none;
}

.callout-chevron {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--color-text-lighter);
  border-bottom: 1.5px solid var(--color-text-lighter);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

details.card--callout[open] .callout-chevron {
  transform: rotate(45deg);
}

.callout-player-list {
  list-style: none;
  margin: var(--space-sm) 0 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.callout-player-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.callout-player-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.callout-player-name a {
  color: inherit;
  text-decoration: none;
}

.callout-player-name a:hover {
  color: var(--color-accent);
}

.callout-player-meta {
  font-size: var(--text-xs);
  color: var(--color-text-lighter);
  white-space: nowrap;
  flex-shrink: 0;
}

.callout-player-plan {
  font-size: var(--text-xs);
  color: var(--color-text-lighter);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

/* ── Trend line chart SVG ── */
.trend-line-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.trend-line-baseline {
  stroke: var(--color-border);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.trend-line-path {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.trend-line-dot--better { fill: var(--color-accent); }
.trend-line-dot--same   { fill: var(--color-text-lighter); }
.trend-line-dot--worse  { fill: var(--color-invalid); }

/* ── Chart window toggle header ── */
.chart-window-toggle {
  display: flex;
  justify-content: flex-end;
  padding: 0 var(--space-md) var(--space-xs);
}

.chart-window-empty {
  font-size: var(--text-sm);
  color: var(--color-text-lighter);
  padding: var(--space-sm) 0;
  margin: 0;
}

/* ============================================================
   Training Lanes — Weekly schedule view (training/index)
   ============================================================ */

.training-lanes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--space-md);
}

.training-lane {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--accent-bg);
  border: 1px solid var(--color-border);
  min-height: 42px;
}

.training-lane--today {
  border: 1px solid color-mix(in oklch, var(--tint-training) 35%, var(--color-border));
  border-left: 3px solid var(--tint-training);
  background: color-mix(in oklch, var(--tint-training) 8%, var(--color-bg));
  padding-left: calc(var(--space-md) - 2px);
}

.training-lane--empty {
  opacity: 0.45;
}

.training-lane-day {
  width: 34px;
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-lighter);
  flex-shrink: 0;
}

.training-lane--today .training-lane-day {
  color: var(--tint-training);
}

.training-lane-count {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--card-bg-pure);
  border: 1px solid var(--color-border);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--color-text-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.training-lane--today .training-lane-count {
  background: var(--tint-training);
  border-color: var(--tint-training);
  color: oklch(100% 0 0);
}

.training-lane-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  flex: 1;
}

.training-lane-chip {
  background: var(--card-bg-pure);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 2px var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  transition: border-color 0.1s, color 0.1s;
}

.training-lane-chip:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.training-lane-empty {
  font-size: var(--text-xs);
  color: var(--color-text-lighter);
  font-style: italic;
}

@media (prefers-color-scheme: dark) {
  .training-lane {
    background: var(--accent-bg);
    border-color: var(--border);
  }

  .training-lane--today {
    background: color-mix(in oklch, var(--tint-training) 15%, var(--color-bg));
    border-color: color-mix(in oklch, var(--tint-training) 40%, transparent);
    border-left-color: var(--tint-training);
  }

  .training-lane-count {
    border-color: var(--border);
  }

  .training-lane-chip {
    border-color: var(--border);
  }
}

