/* RoxKit CSS Style Sheet */

/* --- Reset & Base Variables --- */
:root {
  /* Color system */
  --bg-dark: #07080d;
  --bg-card: rgba(18, 20, 32, 0.55);
  --bg-card-hover: rgba(26, 29, 46, 0.7);
  --border-light: rgba(255, 255, 255, 0.07);
  --text-primary: #f1f3f9;
  --text-muted: #8b92a5;
  
  /* Neon Accents */
  --color-suffer: #f97316;       /* Neon Orange */
  --color-suffer-glow: rgba(249, 115, 22, 0.25);
  --color-distance: #0ea5e9;     /* Cyan */
  --color-distance-glow: rgba(14, 165, 233, 0.25);
  --color-minutes: #a855f7;     /* Purple */
  --color-minutes-glow: rgba(168, 85, 247, 0.25);
  --color-calories: #f43f5e;    /* Coral/Rose */
  --color-calories-glow: rgba(244, 63, 94, 0.25);
  
  /* Primary CTA Accent */
  --color-accent: #6366f1;      /* Indigo */
  --color-accent-hover: #4f46e5;
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Borders */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(168, 85, 247, 0.08) 0px, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* --- Layout Structure --- */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

@media (max-width: 950px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    display: flex;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    width: 100% !important;
    height: 70px !important;
    padding: 0 20px !important;
    position: sticky !important;
    top: 0;
    z-index: 100;
    border-right: none !important;
    border-bottom: 1px solid var(--border-light);
  }
  
  .sidebar .nav-menu {
    flex-direction: row !important;
    gap: 10px;
    margin: 0 !important;
  }
  
  .sidebar-footer, .sidebar .brand p {
    display: none !important;
  }
  
  .main-content {
    padding: 20px !important;
  }
}

/* Glassmorphism base class */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  transition: transform var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

/* --- Sidebar --- */
.sidebar {
  background: rgba(9, 10, 18, 0.8);
  border-right: 1px solid var(--border-light);
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: url('logo.jpg') no-repeat center center;
  background-size: cover;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.4);
}

.brand h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand h1 span {
  color: var(--color-calories);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: inset 0 0 12px rgba(99, 102, 241, 0.1);
}

.nav-icon {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  margin-top: 30px;
}

.btn-logout-sidebar {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  color: #f43f5e;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  border: 1px solid rgba(244, 63, 94, 0.15);
  background: rgba(244, 63, 94, 0.03);
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  box-sizing: border-box;
}

.btn-logout-sidebar:hover {
  color: #ffffff;
  background: #f43f5e;
  border-color: #f43f5e;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.2);
}


/* --- Main Content Area --- */
.main-content {
  padding: 40px;
  overflow-y: auto;
  height: 100vh;
}

.main-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 35px;
}

.header-info h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-info p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--color-accent);
  color: var(--text-primary);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* --- Metrics Grid --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 35px;
}

.metric-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Card Split Row (Ring + Trend Chart) */
.card-split-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.weekly-trend-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
}

.trend-title {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.trend-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 60px;
  padding-bottom: 4px;
  min-width: 125px;
  justify-content: center;
}

.trend-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
  cursor: pointer;
}

.trend-bar {
  width: 9px;
  border-radius: 5px;
  transition: height 0.3s ease, transform 0.2s ease;
}

.trend-bar-wrapper:hover .trend-bar {
  transform: scaleY(1.08);
}

.trend-day-label {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1;
  font-weight: 500;
}

.card-subtitle {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

/* Premium Workout List Items */
.workout-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11.5px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 2px;
  transition: background var(--transition-fast);
}

.workout-list-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.workout-list-item .item-date {
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
  width: 45px;
  text-align: left;
}

.workout-list-item .item-title {
  font-weight: 500;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  flex-grow: 1;
  text-align: left;
  padding: 0 8px;
  color: var(--text-primary);
}

.workout-list-item .item-val {
  font-weight: 600;
  flex-shrink: 0;
  text-align: right;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

#card-suffer::before { background: var(--color-suffer); }
#card-distance::before { background: var(--color-distance); }
#card-zones::before { background: var(--color-minutes); }
#card-calories::before { background: var(--color-calories); }

.metric-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

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

.metric-card .card-header h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}

.card-icon {
  width: 24px;
  height: 24px;
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.7;
}

/* Progress Rings */
.progress-ring-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.progress-ring-bar {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.suffer-bar { stroke: var(--color-suffer); filter: drop-shadow(0 0 6px var(--color-suffer-glow)); }
.distance-bar { stroke: var(--color-distance); filter: drop-shadow(0 0 6px var(--color-distance-glow)); }
.minutes-bar { stroke: var(--color-minutes); filter: drop-shadow(0 0 6px var(--color-minutes-glow)); }
.calories-bar { stroke: var(--color-calories); filter: drop-shadow(0 0 6px var(--color-calories-glow)); }

.progress-ring-text {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.metric-value {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 700;
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Quick Incrementor Actions */
.quick-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: auto;
}

.btn-quick {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 8px 0;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-quick:hover {
  background: rgba(255, 255, 255, 0.1);
}

#card-suffer .btn-quick:hover { border-color: var(--color-suffer); color: var(--color-suffer); }
#card-distance .btn-quick:hover { border-color: var(--color-distance); color: var(--color-distance); }
#card-zones .btn-quick:hover { border-color: var(--color-minutes); color: var(--color-minutes); }
#card-calories .btn-quick:hover { border-color: var(--color-calories); color: var(--color-calories); }

/* --- Analytics & Charts --- */
.analytics-row {
  margin-bottom: 35px;
}

.chart-card {
  padding: 24px;
}

.chart-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.chart-card .card-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
}

.chart-legend {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 15px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.calories-bg { background-color: var(--color-calories); }

.chart-container {
  height: 220px;
  width: 100%;
}

/* SVG Chart Elements */
.chart-bar {
  fill: var(--color-calories);
  opacity: 0.85;
  rx: 4; /* rounded corners */
  transition: opacity var(--transition-fast), fill var(--transition-fast);
}
.chart-bar:hover {
  opacity: 1;
  fill: #ff6584;
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-dasharray: 4,4;
}

.chart-text {
  fill: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

/* --- Views Toggling --- */
.content-view {
  display: none;
}

.content-view.active {
  display: block;
}

/* --- Workouts View --- */
.workouts-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 35px;
}

@media (max-width: 700px) {
  .workouts-summary-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
  }
  .workouts-summary-grid .summary-card {
    padding: 12px 6px;
    align-items: center;
    text-align: center;
    gap: 4px;
  }
  .workouts-summary-grid .summary-label {
    font-size: 10px;
  }
  .workouts-summary-grid .summary-value {
    font-size: 16px;
    font-weight: 700;
  }
}

.summary-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-label {
  color: var(--text-muted);
  font-size: 14px;
}

.summary-value {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 700;
}

.workouts-history {
  padding: 24px;
}

.workout-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
}

.workout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.workout-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.workout-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.workout-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.workout-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workout-title {
  font-weight: 600;
  font-size: 16px;
}

.workout-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.workout-stats {
  display: flex;
  align-items: center;
  gap: 20px;
}

.w-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.w-stat-val {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 16px;
}

.w-stat-lbl {
  font-size: 10px;
  color: var(--text-muted);
}

.delete-workout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.delete-workout-btn:hover {
  color: var(--color-calories);
  background: rgba(244, 63, 94, 0.1);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* --- Achievements View --- */
.achievements-intro {
  margin-bottom: 30px;
}

.achievements-intro h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  margin-bottom: 6px;
}

.achievements-intro p {
  color: var(--text-muted);
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.badge-card {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  opacity: 0.5;
  transition: all var(--transition-normal);
  filter: grayscale(1);
}

.badge-card.unlocked {
  opacity: 1;
  filter: grayscale(0);
}

#badge-suffer.unlocked {
  border-color: rgba(249, 115, 22, 0.3);
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.1);
}
#badge-distance.unlocked {
  border-color: rgba(14, 165, 233, 0.3);
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.1);
}
#badge-calories.unlocked {
  border-color: rgba(244, 63, 94, 0.3);
  box-shadow: 0 4px 20px rgba(244, 63, 94, 0.1);
}
#badge-minutes.unlocked {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
}
#badge-anaerobic.unlocked {
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.1);
}
#badge-engine.unlocked {
  border-color: rgba(52, 211, 153, 0.3);
  box-shadow: 0 4px 20px rgba(52, 211, 153, 0.1);
}
#badge-power.unlocked {
  border-color: rgba(249, 115, 22, 0.3);
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.1);
}
#badge-launch.unlocked {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
}
#badge-farmers.unlocked {
  border-color: rgba(234, 179, 8, 0.3);
  box-shadow: 0 4px 20px rgba(234, 179, 8, 0.1);
}
#badge-legs.unlocked {
  border-color: rgba(236, 72, 153, 0.3);
  box-shadow: 0 4px 20px rgba(236, 72, 153, 0.1);
}
#badge-hybrid.unlocked {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
}
#badge-consistency.unlocked {
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.1);
}
#badge-double.unlocked {
  border-color: rgba(6, 182, 212, 0.3);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.1);
}
#badge-legend.unlocked {
  border-color: rgba(234, 179, 8, 0.3); /* Gold */
  box-shadow: 0 4px 25px rgba(234, 179, 8, 0.15);
}

.badge-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  transition: all var(--transition-normal);
}

.badge-card.unlocked .badge-icon-wrap {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.05);
}

#badge-suffer.unlocked .badge-icon-wrap { background: rgba(249, 115, 22, 0.1); border-color: var(--color-suffer); }
#badge-distance.unlocked .badge-icon-wrap { background: rgba(14, 165, 233, 0.1); border-color: var(--color-distance); }
#badge-calories.unlocked .badge-icon-wrap { background: rgba(244, 63, 94, 0.1); border-color: var(--color-calories); }
#badge-minutes.unlocked .badge-icon-wrap { background: rgba(16, 185, 129, 0.1); border-color: #10b981; }
#badge-anaerobic.unlocked .badge-icon-wrap { background: rgba(239, 68, 68, 0.1); border-color: #ef4444; }
#badge-engine.unlocked .badge-icon-wrap { background: rgba(52, 211, 153, 0.1); border-color: #34d399; }
#badge-power.unlocked .badge-icon-wrap { background: rgba(249, 115, 22, 0.1); border-color: #f97316; }
#badge-launch.unlocked .badge-icon-wrap { background: rgba(139, 92, 246, 0.1); border-color: #8b5cf6; }
#badge-farmers.unlocked .badge-icon-wrap { background: rgba(234, 179, 8, 0.1); border-color: #eab308; }
#badge-legs.unlocked .badge-icon-wrap { background: rgba(236, 72, 153, 0.1); border-color: #ec4899; }
#badge-hybrid.unlocked .badge-icon-wrap { background: rgba(99, 102, 241, 0.1); border-color: #6366f1; }
#badge-consistency.unlocked .badge-icon-wrap { background: rgba(245, 158, 11, 0.1); border-color: #f59e0b; }
#badge-double.unlocked .badge-icon-wrap { background: rgba(6, 182, 212, 0.1); border-color: #06b6d4; }
#badge-legend.unlocked .badge-icon-wrap { background: rgba(234, 179, 8, 0.1); border-color: #eab308; }

.badge-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.badge-title {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.badge-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.badge-status {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.unlocked .badge-status {
  color: #eab308;
}

.badge-status::after {
  content: 'Locked';
}

.unlocked .badge-status::after {
  content: 'Unlocked 🎉';
}

/* --- HTML5 dialog Modal styling --- */
.workout-modal {
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius-lg);
  padding: 30px;
  margin: auto;
  border: 1px solid var(--border-light);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  color: var(--text-primary);
  overflow: hidden;
}

/* ::backdrop targets the screen overlay when dialog is open */
.workout-modal::backdrop {
  background: rgba(3, 4, 7, 0.7);
  backdrop-filter: blur(10px);
}

.workout-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.workout-modal .modal-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}
.close-btn:hover {
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  transition: all var(--transition-fast);
}


/* --- Premium Custom Select Box overrides --- */
.detail-stage-type-select,
.detail-stage-station-select,
.detail-stage-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.6)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 8px;
  padding-right: 18px !important;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  background-color: rgba(255, 255, 255, 0.03) !important;
  outline: none;
  font-family: inherit;
  transition: all 0.2s;
  height: 28px;
  box-sizing: border-box;
}

.detail-stage-type-select:focus,
.detail-stage-station-select:focus,
.detail-stage-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 5px rgba(99, 102, 241, 0.3);
  background-color: rgba(255, 255, 255, 0.05) !important;
}

.detail-stage-input {
  width: 32px !important;
  text-align: center !important;
  text-align-last: center !important;
  padding-right: 0 !important;
  background-image: none !important;
}

.detail-stage-hr-badge {
  background: rgba(244, 63, 94, 0.05);
  border: 1px solid rgba(244, 63, 94, 0.15);
  border-radius: var(--radius-xs);
  padding: 4px 8px;
  height: 28px;
  box-sizing: border-box;
}

.form-group select option {
  background-color: #121420;
  color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 30px;
}

/* Entry and dialog open animation */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.workout-modal[open] {
  animation: modalFadeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* --- Hyrox Specific Styling --- */
.hidden {
  display: none !important;
}

.hyrox-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.hyrox-stages-container {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  padding: 5px;
  margin-top: 5px;
}

.hyrox-stage-row {
  display: grid;
  grid-template-columns: 55px 95px 120px 1fr;
  gap: 6px;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hyrox-stage-row:last-child {
  border-bottom: none;
}

.hyrox-stage-row select,
.hyrox-stage-row input {
  padding: 6px 8px !important;
  font-size: 12px !important;
  height: 32px !important;
  border-radius: 4px !important;
}

.stage-num-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.stage-duration-input-group {
  display: flex;
  align-items: center;
  gap: 3px;
}

.stage-duration-input-group input {
  width: 44px !important;
  text-align: center;
}

.stage-duration-input-group span {
  font-size: 10px;
  color: var(--text-muted);
}

/* History Card Timeline Details */
.btn-toggle-stages {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.btn-toggle-stages:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.hyrox-stages-details {
  grid-column: 1 / -1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 12px;
}

.hyrox-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  padding-left: 20px;
}

.hyrox-timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: rgba(255, 255, 255, 0.1);
}

.hyrox-timeline-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  font-size: 13px;
}

.hyrox-timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #121420;
  background: var(--text-muted);
}

.hyrox-timeline-item.run::before {
  background: var(--color-distance);
  box-shadow: 0 0 6px var(--color-distance-glow);
}

.hyrox-timeline-item.strength::before {
  background: var(--color-minutes);
  box-shadow: 0 0 6px var(--color-minutes-glow);
}

.timeline-stage-title {
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-stage-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.timeline-stage-duration {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Strava Integration Styling --- */
.btn-strava:hover {
  border-color: #fc4c02 !important;
  color: #fc4c02 !important;
  background: rgba(252, 76, 2, 0.05) !important;
}

.status-connected {
  color: #10b981;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.status-disconnected {
  color: #f59e0b;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

/* --- Workout Detail View Styling --- */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
  align-items: start;
  margin-top: 15px;
}

@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

.detail-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.detail-metric-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s, background 0.2s;
}

.detail-metric-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
}

.detail-metric-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.detail-metric-value {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.detail-metric-unit {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 2px;
}

/* Custom Chart for Hyrox Stage comparison inside details */
.detail-hyrox-chart-row {
  margin-bottom: 15px;
}

.detail-hyrox-chart-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.detail-hyrox-chart-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.detail-hyrox-chart-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 4px;
  width: 0;
  transition: width 0.8s ease-out;
}

.detail-hyrox-chart-bar-fill.run {
  background: linear-gradient(90deg, #10b981, #059669);
}

.detail-hyrox-chart-bar-fill.rest {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

/* Edit State for textareas */
#detail-notes-input:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

/* Pulsing Beating Heart Animation */
@keyframes heart-beat {
  0% { transform: scale(1); }
  14% { transform: scale(1.12); }
  28% { transform: scale(1); }
  42% { transform: scale(1.12); }
  70% { transform: scale(1); }
}

.pulsing-heart {
  display: inline-block;
  animation: heart-beat 1.2s infinite ease-in-out;
  color: #f43f5e;
}

/* Metadata Pills for Strava Device and Social stats */
.detail-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.detail-pill.strava-orange {
  border-color: rgba(252, 76, 2, 0.2);
  background: rgba(252, 76, 2, 0.03);
  color: #fc4c02;
}

/* Hyrox time analysis grid */
.hyrox-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.hyrox-summary-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.hyrox-summary-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.hyrox-summary-value {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.hyrox-summary-value.running {
  color: #10b981;
}

.hyrox-summary-value.station {
  color: #a78bfa;
}

/* --- GPS Map Styling --- */
#detail-map {
  height: 260px;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-top: 15px;
  margin-bottom: 20px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  z-index: 1;
}

/* Ensure Leaflet controls match our glass styling */
.leaflet-bar {
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-sm) !important;
  background: rgba(18, 18, 18, 0.8) !important;
  backdrop-filter: blur(10px) !important;
  overflow: hidden;
}

.leaflet-bar a {
  background: none !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-light) !important;
  transition: background 0.2s;
}

.leaflet-bar a:hover {
  background: rgba(255, 255, 255, 0.05) !important;
}

.leaflet-bar a:last-child {
  border-bottom: none !important;
}

.leaflet-container {
  font-family: inherit !important;
}

/* --- Heart Rate Chart Styling --- */
.hr-chart-wrapper {
  position: relative;
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 24px 20px 20px 20px;
  margin-bottom: 24px;
  box-sizing: border-box;
  overflow: visible; /* allow tooltip and marker overlays to render beyond container */
}

#hr-chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(18, 18, 18, 0.95);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 10px rgba(244, 63, 94, 0.1);
  transform: translate(-50%, -100%);
  margin-top: -12px;
  z-index: 100;
  transition: opacity 0.15s, left 0.05s, top 0.05s;
  opacity: 0;
  backdrop-filter: blur(10px);
}

.hr-tooltip-title {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.hr-tooltip-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: #f43f5e;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.hr-chart-line {
  fill: none;
  stroke: #f43f5e;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(244, 63, 94, 0.5));
}

.hr-chart-area {
  fill: url(#hr-gradient);
  opacity: 0.12;
}

.hr-chart-grid {
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 1;
}

.hr-chart-track-line {
  stroke: rgba(244, 63, 94, 0.25);
  stroke-width: 1.5;
  stroke-dasharray: 3,3;
  pointer-events: none;
}

.hr-chart-track-dot {
  fill: #f43f5e;
  stroke: #fff;
  stroke-width: 2;
  r: 5;
  filter: drop-shadow(0 0 5px rgba(244, 63, 94, 0.7));
  pointer-events: none;
}

/* --- Heart Rate Zones & Suffer Score Tier Styling --- */
.hr-zone-card {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 24px;
}

.hr-zone-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.hr-zone-row:last-child {
  margin-bottom: 0;
}

.hr-zone-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
}

.hr-zone-name {
  color: var(--text-secondary);
}

.hr-zone-stats {
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
  font-weight: 600;
}

.hr-zone-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
}

.hr-zone-bar-fill {
  height: 100%;
  border-radius: 3px;
  width: 0;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Zone Colors */
.hr-zone-bar-fill.z1 { background: #38bdf8; } /* Z1: Active Recovery (Sky Blue) */
.hr-zone-bar-fill.z2 { background: #34d399; } /* Z2: Aerobic Endurance (Green) */
.hr-zone-bar-fill.z3 { background: #facc15; } /* Z3: Tempo Stability (Yellow) */
.hr-zone-bar-fill.z4 { background: #fb923c; } /* Z4: Anaerobic Threshold (Orange) */
.hr-zone-bar-fill.z5 { background: #f87171; } /* Z5: Max Effort (Red) */

/* Relative Effort Badge Tiers */
.suffer-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  letter-spacing: 0.5px;
}

.suffer-score-badge.tier-easy {
  border-color: rgba(56, 189, 248, 0.2);
  background: rgba(56, 189, 248, 0.04);
  color: #38bdf8;
}

.suffer-score-badge.tier-moderate {
  border-color: rgba(52, 211, 153, 0.2);
  background: rgba(52, 211, 153, 0.04);
  color: #34d399;
}

.suffer-score-badge.tier-hard {
  border-color: rgba(251, 146, 60, 0.2);
  background: rgba(251, 146, 60, 0.04);
  color: #fb923c;
}

.suffer-score-badge.tier-extreme {
  border-color: rgba(248, 113, 113, 0.2);
  background: rgba(248, 113, 113, 0.04);
  color: #f87171;
}

/* --- Segment Efforts List Styling --- */
.segments-card {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 24px;
}

.segment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
}

.segment-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.segment-item:first-child {
  padding-top: 0;
}

.segment-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.segment-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.segment-distance {
  font-size: 10px;
  color: var(--text-muted);
}

.segment-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.segment-time {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.segment-hr {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  color: #f43f5e;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}

.segment-medal {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- Details Splits Editor rows --- */
.detail-stage-row {
  display: grid;
  grid-template-columns: 95px 1fr auto auto;
  grid-template-rows: auto auto;
  row-gap: 8px;
  column-gap: 6px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  align-items: center;
}

.detail-stage-type-select {
  grid-row: 1;
  grid-column: 1;
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 4px;
  font-size: 11px;
  outline: none;
}

.detail-stage-station-select {
  grid-row: 1;
  grid-column: 2;
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 4px;
  font-size: 11px;
  outline: none;
  min-width: 80px;
}

.detail-stage-move-controls {
  grid-row: 1;
  grid-column: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 24px;
  height: 34px;
}

.detail-stage-delete-btn {
  grid-row: 1;
  grid-column: 4;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.detail-stage-delete-btn:hover {
  color: #f87171;
}

.detail-stage-metric-wrapper {
  grid-row: 2;
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.detail-stage-metric-input {
  width: 100% !important;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 4px 2px;
  font-size: 11px;
  outline: none;
  font-family: monospace;
  text-align: center;
}

.detail-stage-metric-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 10px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  padding: 0;
  transition: background-color 0.2s, color 0.2s;
}

.detail-stage-metric-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.detail-stage-metric-btn:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.25);
}

.detail-stage-metric-btn:disabled {
  cursor: not-allowed;
}

.detail-stage-hr-badge {
  grid-row: 2;
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 6px;
}

.detail-stage-time-box {
  grid-row: 2;
  grid-column: 3 / span 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.detail-stage-input {
  width: 26px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 4px 2px;
  text-align: center;
  font-family: inherit;
  font-size: 11px;
  outline: none;
  box-sizing: border-box;
}

.detail-stage-input.detail-min-input {
  width: 34px;
}

.detail-stage-input.detail-sec-input {
  width: 28px;
}

.detail-stage-input::-webkit-inner-spin-button,
.detail-stage-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.detail-stage-input[type=number] {
  -moz-appearance: textfield;
}

/* --- Workout Card Selection Checkboxes --- */
.workout-select-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  outline: none;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.workout-select-checkbox:hover {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.1);
}

.workout-select-checkbox:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.workout-select-checkbox:checked::after {
  content: '✓';
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

/* --- Splits Unit Selector Buttons --- */
.split-unit-selector .btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  transition: all 0.2s;
  cursor: pointer;
}

.split-unit-selector .btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.split-unit-selector .btn.active-split-unit {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.splits-table th {
  padding: 8px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.splits-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

/* Premium Recovery Check-In Rating Pills & Sliders Styles */
.rating-pill-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  outline: none;
}
.rating-pill-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}
.rating-pill-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
  transform: scale(1.1);
}

.subjective-metrics-card input[type="range"],
.workout-modal input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
}
.subjective-metrics-card input[type="range"]::-webkit-slider-runnable-track,
.workout-modal input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  border: none;
}
.subjective-metrics-card input[type="range"]::-webkit-slider-thumb,
.workout-modal input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid #ffffff;
  margin-top: -5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: all 0.1s ease;
}
.subjective-metrics-card input[type="range"]::-webkit-slider-thumb:hover,
.workout-modal input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* ── Hyrox Station Tiles ─────────────────────────────────────────── */
.station-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 36px;
}

.station-tile {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.station-tile:hover {
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}
.station-tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  border-radius: 16px 16px 0 0;
  background: var(--st-accent, #6366f1);
}
.station-tile-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.station-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
/* --- Athletic Silhouette Station Badges --- */
.station-badge {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid color-mix(in srgb, var(--st-accent, #6366f1) 32%, transparent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--st-accent, #6366f1) 20%, transparent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.station-tile:hover .station-badge {
  transform: scale(1.06);
  box-shadow: 0 0 18px color-mix(in srgb, var(--st-accent, #6366f1) 40%, transparent);
  border-color: color-mix(in srgb, var(--st-accent, #6366f1) 55%, transparent);
}
.station-glyph {
  display: inline-block;
  width: 22px;
  height: 22px;
  background-color: var(--st-accent, #6366f1);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}
.station-badge-sm {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  border-radius: 7px;
  box-shadow: 0 0 8px color-mix(in srgb, var(--st-accent, #6366f1) 16%, transparent);
}
.station-badge-sm .station-glyph {
  width: 16px;
  height: 16px;
}
.station-badge-xs {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  border-radius: 6px;
  box-shadow: 0 0 6px color-mix(in srgb, var(--st-accent, #6366f1) 15%, transparent);
  margin-right: 4px;
  vertical-align: middle;
}
.station-badge-xs .station-glyph {
  width: 14px;
  height: 14px;
}
.station-tile-name {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-primary);
  line-height: 1.2;
}
.station-tile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-auto-rows: auto;
  gap: 6px;
}
.station-tile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  padding: 6px 4px 5px;
}
.station-tile-stat-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--st-accent, #6366f1);
  line-height: 1;
}
.station-tile-stat-lbl {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  margin-top: 3px;
  text-align: center;
}
.station-tile-splits {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 8px;
  max-height: 90px;
  overflow-y: auto;
}
.station-tile-split-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-muted);
}
.station-tile-split-row span:last-child {
  font-weight: 600;
  color: var(--text-primary);
}
.station-tile-empty {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 0 4px;
  opacity: .7;
}

/* ── Settings: Goal Inputs ───────────────────────────────────────── */
.goal-input-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.goal-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.goal-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(0,0,0,.25);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .2s;
}
.goal-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,.15);
}
.goal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  padding: 10px 12px;
  min-width: 0;
  font-family: 'Outfit', sans-serif;
}
.goal-input::-webkit-inner-spin-button,
.goal-input::-webkit-outer-spin-button {
  opacity: .5;
}
.goal-unit {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255,255,255,.04);
  border-left: 1px solid var(--border-light);
  padding: 0 10px;
  white-space: nowrap;
  align-self: stretch;
  display: flex;
  align-items: center;
  letter-spacing: .3px;
}

.goals-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 12px;
}

/* ── Responsive Mobile Optimizations ──────────────────────────────── */

/* 1. Base rules for refactored grids & layouts */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.subjective-grid {
  display: grid;
  grid-template-columns: 1.35fr 1.35fr 0.8fr 0.8fr 0.8fr 0.8fr;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
}

.comparison-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* 2. Media queries for larger tablets & medium viewports */
@media (max-width: 900px) {
  .settings-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  
  .subjective-grid {
    grid-template-columns: 1.35fr 1.35fr 1fr 1fr !important;
    gap: 14px !important;
  }
}

/* 3. Media queries for general mobile & iPhone screens (< 600px) */
@media (max-width: 600px) {
  /* iOS-Style Bottom Navigation Bar */
  .sidebar {
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    height: 65px !important;
    width: 100% !important;
    border-top: 1px solid var(--border-light) !important;
    border-bottom: none !important;
    background: rgba(18, 18, 29, 0.85) !important;
    backdrop-filter: blur(20px) !webkit-backdrop-filter: blur(20px) !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 1000 !important;
    display: flex !important;
    justify-content: center !important;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.4) !important;
  }
  
  .sidebar .brand {
    display: none !important;
  }
  
  .sidebar .nav-menu {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    width: 100% !important;
    height: 100% !important;
    gap: 0 !important;
    margin: 0 !important;
    align-items: center !important;
  }
  
  .sidebar .nav-item {
    flex: 1 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 6px 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 10px !important;
    text-align: center !important;
  }
  
  .sidebar .nav-item .nav-icon {
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
  }
  
  .sidebar .nav-item span {
    display: block !important;
    font-size: 10px !important;
    font-weight: 500 !important;
  }

  /* Padding at the bottom of the main container so content doesn't get hidden behind bottom tab bar */
  .main-content {
    padding: 15px 15px 85px !important; /* Extra bottom pad for iOS bottom navbar overlay */
    height: auto !important;
    min-height: 100vh;
  }

  .detail-panel-left, .detail-panel-right {
    padding: 16px !important;
  }

  /* Stack main headers vertically */
  .main-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 15px !important;
    margin-bottom: 25px !important;
  }

  .header-spacer {
    display: none !important;
  }
  
  .header-actions {
    width: 100% !important;
    justify-content: stretch !important;
    gap: 8px !important;
  }
  
  .header-actions button,
  .header-actions .btn {
    flex: 1 !important;
    justify-content: center !important;
    padding: 10px 8px !important;
    font-size: 11px !important;
    min-height: 44px !important; /* Larger touch target */
  }
  
  #btn-quick-workout {
    flex-basis: 100% !important; /* Log Workout spans full width */
  }

  /* Stack view details header vertically */
  .detail-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .detail-header > div {
    width: 100% !important;
    justify-content: space-between !important;
  }

  /* Stacking Subjective Metrics */
  .subjective-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }
  .subjective-grid .form-group:nth-child(1),
  .subjective-grid .form-group:nth-child(2) {
    grid-column: span 2 !important;
  }

  /* Stacking Comparison Cards */
  .comparison-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }

  /* Table Responsiveness */
  #compare-metrics-table-container,
  #compare-splits-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .compare-table {
    width: 100%;
    border-collapse: collapse;
  }
  
  .compare-table th,
  .compare-table td {
    white-space: nowrap !important;
  }

  /* Fluid circular rating pills for mobile viewports */
  .rating-pills {
    display: flex !important;
    gap: 4px !important;
    justify-content: space-between !important;
    width: 100% !important;
  }
  .rating-pill-btn {
    width: auto !important;
    height: auto !important;
    max-width: 30px !important;
    flex: 1 !important;
    aspect-ratio: 1 !important;
    font-size: 11px !important;
  }
  
  /* Thick slider track/thumb target area */
  .subjective-metrics-card input[type="range"],
  #recommendation-setup-dialog input[type="range"] {
    height: 28px !important;
  }

  /* Dialog adjustments for narrow screen margins */
  .workout-modal {
    width: 92% !important;
    padding: 18px !important;
    border-radius: 12px !important;
  }
  
  .workout-modal .close-btn {
    width: 44px !important;
    height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: -10px -10px 0 0 !important;
  }
  
  /* Stacking dialog buttons on mobile */
  .form-actions {
    flex-direction: column-reverse !important;
    gap: 10px !important;
    margin-top: 20px !important;
  }
  
  .form-actions .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 12px !important;
    font-size: 14px !important;
    height: 44px !important;
  }



  /* Full-width stretch and styling for detail headers buttons/badges on mobile */
  .detail-header > button,
  .detail-header > .btn,
  .detail-header > #ai-summary-status-badge,
  .detail-header > #ai-rec-status-badge {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    box-sizing: border-box !important;
    height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Workouts list view: AI Summary selection bar stacking */
  #ai-summary-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 16px !important;
  }
  #ai-summary-bar > div:first-child {
    min-width: unset !important;
    text-align: center !important;
    flex-direction: column !important;
    gap: 6px !important;
  }
  #ai-summary-bar > div:last-child {
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
  }
  #ai-summary-bar button {
    width: 100% !important;
    justify-content: center !important;
    padding: 10px !important;
    height: 44px !important;
  }

  /* Workout comparison: Winner banner stack formatting */
  #compare-winner-banner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 14px 16px !important;
  }
  #compare-winner-banner > div:first-child {
    width: 100% !important;
  }
  #compare-winner-banner select {
    width: 100% !important;
    box-sizing: border-box !important;
    height: 38px !important;
  }

  /* Hyrox station splits list modal rows formatting */
  .station-tile-split-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 10px 12px !important;
  }
  .station-tile-split-row > span:last-child {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
}

/* 4. Media queries for very small viewports (like iPhone SE < 360px) */
@media (max-width: 360px) {
  .subjective-grid {
    grid-template-columns: 1fr !important;
  }

  .sidebar .nav-item span {
    font-size: 9px !important;
  }
}

/* ── Guided Workout Active Timer UI ────────────────────────────────── */
#btn-guided-playpause:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6) !important;
}
#btn-guided-reset:hover, #btn-guided-skip:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.guided-step-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: all 0.3s ease;
}

.guided-step-item.active {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--color-primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
  font-weight: 700;
  color: var(--text-primary);
}

.guided-step-item.completed {
  background: rgba(52, 211, 153, 0.03);
  border-color: rgba(52, 211, 153, 0.2);
  color: var(--text-muted);
}

.guided-step-status-icon {
  font-size: 12px;
  font-weight: bold;
}

/* iOS Toggle Switch */
.switch input:checked + .slider {
  background-color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}
.switch .slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-primary);
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.switch input:checked + .slider::before {
  transform: translateX(20px);
}
.switch input:disabled + .slider {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Voice Assistant Mic Animation */
.mic-active {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-mic 1.5s infinite;
  color: #ef4444 !important;
}

@keyframes pulse-mic {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Suffer Score Multiplier Pills */
.mult-pill {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}
.mult-pill:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}
.mult-pill.active {
  background: rgba(255, 159, 67, 0.2);
  border-color: rgba(255, 159, 67, 0.4);
  color: #ff9f43;
  box-shadow: 0 0 8px rgba(255, 159, 67, 0.2);
}

/* Workout Details Uniform Grid */
.detail-core-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 520px) {
  .detail-core-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

.detail-stat-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 84px;
  box-sizing: border-box;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.detail-stat-card .stat-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.detail-stat-card .stat-val {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Splits Table Styles */
.splits-table th {
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-weight: 600;
  color: var(--text-muted);
}
.splits-table td {
  padding: 12px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-primary);
  font-family: monospace;
  font-size: 13px;
}
.splits-table tr:hover {
  background: rgba(255,255,255,0.02);
}

/* Performance & Freshness Section Styles */
.perf-header-row {
  transition: all var(--transition-normal);
}

.perf-metric-box h2 {
  font-family: 'Outfit', sans-serif;
}

.perf-weekly-trends-box {
  transition: all var(--transition-normal);
}

.perf-workout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.perf-workout-item:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

/* Performance REDESIGN Styling */
.perf-kpi-card {
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.perf-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.25) !important;
  box-shadow: 0 8px 24px rgba(7, 8, 13, 0.5), inset 0 0 12px rgba(99, 102, 241, 0.05);
}

.btn-tab-group button {
  color: var(--text-muted);
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-tab-group button.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-tab-group button:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.perf-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.perf-chart-card {
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
}

.perf-main-chart-container {
  position: relative;
  width: 100%;
  height: 320px;
}

.perf-chart-container {
  position: relative;
  width: 100%;
  height: 240px;
}

@media (max-width: 1024px) {
  .perf-charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .perf-chart-card {
    padding: 16px;
    border-radius: var(--radius-sm);
  }
  .perf-charts-grid {
    gap: 16px !important;
  }
  .perf-main-chart-container {
    height: 220px;
  }
  .perf-chart-container {
    height: 190px;
  }
}

.settings-card {
  padding: 24px;
  box-sizing: border-box;
}

.settings-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.settings-button-group {
  display: flex;
  gap: 10px;
  width: 100%;
}



@media (max-width: 600px) {
  .settings-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 15px !important;
  }
  
  .settings-header button,
  .settings-header .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  .settings-card {
    padding: 16px !important;
  }
  
  .settings-card-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  
  .settings-card-header button,
  .settings-card-header a,
  .settings-card-header .btn {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }
  
  .settings-button-group {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  
  .settings-button-group button,
  .settings-button-group .btn {
    flex: 1 1 120px !important;
    min-width: 100px !important;
    font-size: 11px !important;
    padding: 10px 6px !important;
    height: auto !important;
    min-height: 38px !important;
    justify-content: center !important;
  }
  .goals-input-grid {
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)) !important;
    gap: 10px !important;
  }

  .goal-lbl {
    font-size: 10px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .goal-input-wrap {
    border-radius: 6px !important;
  }

  .goal-input {
    font-size: 13px !important;
    padding: 8px 10px !important;
  }

  .goal-unit {
    font-size: 9px !important;
    padding: 0 6px !important;
  }

  .goal-input-group {
    gap: 4px !important;
  }

  .settings-card {
    padding: 14px 16px !important;
    gap: 12px !important;
  }

  .settings-card-header {
    margin-bottom: 12px !important;
    gap: 8px !important;
  }

  .settings-card-header h3 {
    font-size: 15px !important;
  }

  .settings-header {
    margin-bottom: 16px !important;
    gap: 10px !important;
  }

  .settings-header h2 {
    font-size: 20px !important;
  }

  .settings-header p {
    font-size: 12px !important;
    margin-top: 3px !important;
  }

  .settings-grid {
    gap: 14px !important;
  }

  .settings-col {
    gap: 14px !important;
  }

  #healthkit-debug-log {
    max-height: 100px !important;
    padding: 8px !important;
    font-size: 10px !important;
  }
}

@media (max-width: 360px) {
  .goals-input-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .settings-button-group {
    flex-direction: column !important;
  }
  .settings-button-group button,
  .settings-button-group .btn {
    width: 100% !important;
  }
}

/* Global rule to hide main header on settings view */
.main-header.settings-active {
  display: none !important;
}

/* Segmented Control for Weekly Goals Settings */
.goals-tabs-container {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 4px;
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  width: fit-content;
}

.goals-tab-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.goals-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.goals-tab-btn.active {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.goals-tab-content {
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Pull to Refresh Indicator styling */
.pull-to-refresh-indicator {
  height: 0;
  opacity: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: height 0.2s ease, opacity 0.2s ease;
  width: 100%;
}

.ptr-icon-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.ptr-arrow {
  transition: transform 0.2s ease;
  font-size: 14px;
}

.ptr-spinner {
  animation: ptrSpin 1s linear infinite;
  font-size: 14px;
}

@keyframes ptrSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* --- Subjective Recovery Collapsible Smooth Transitions --- */
.subjective-collapsible-container {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease-out, margin-top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 0;
}

.subjective-collapsible-container.show {
  max-height: 800px; /* high enough for all fields */
  opacity: 1;
  margin-top: 4px;
}

.subjective-toggle-icon {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.subjective-toggle-icon.rotated {
  transform: rotate(180deg);
}

/* Prevent iOS WebKit auto-zoom on input focus */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  select,
  textarea,
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="number"] {
    font-size: 16px !important;
  }
}

/* --- Expanded Workout Notes & AI Review Modal --- */
#expanded-notes-dialog {
  box-sizing: border-box;
}

#expanded-notes-dialog .modal-body::-webkit-scrollbar {
  width: 6px;
}

#expanded-notes-dialog .modal-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

#expanded-notes-dialog .modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

#expanded-notes-dialog .modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

.expanded-notes-preview-pane h2,
.expanded-notes-preview-pane h3,
.expanded-notes-preview-pane h4 {
  font-family: 'Outfit', sans-serif;
  color: var(--color-primary);
  margin-top: 18px;
  margin-bottom: 8px;
}

.expanded-notes-preview-pane p {
  margin-bottom: 12px;
}

.expanded-notes-preview-pane strong {
  color: var(--text-primary);
  font-weight: 600;
}

.expanded-notes-preview-pane em {
  color: var(--text-secondary);
}

.expanded-notes-preview-pane blockquote {
  border-left: 3px solid var(--color-primary);
  padding-left: 12px;
  margin: 12px 0;
  color: var(--text-secondary);
  background: rgba(99, 102, 241, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 8px 12px;
}

@media (max-width: 640px) {
  #expanded-notes-dialog {
    width: 96% !important;
    padding: 16px !important;
    max-height: 90vh !important;
  }
  
  #expanded-notes-dialog .modal-body {
    max-height: calc(90vh - 135px) !important;
  }
  
  #expanded-notes-textarea {
    min-height: 260px !important;
  }
}

/* Fullscreen Expanded Heart Rate Timeline Modal */
#expanded-hr-dialog {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#expanded-hr-dialog[open] {
  display: flex !important;
}

#expanded-hr-dialog::backdrop {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@media (orientation: landscape) {
  #expanded-hr-dialog {
    width: 98vw !important;
    height: 96vh !important;
    max-height: 98vh !important;
    max-width: 98vw !important;
    border-radius: 10px !important;
  }
}

@media (max-width: 768px) {
  #expanded-hr-dialog {
    width: 96vw !important;
    height: 88vh !important;
  }
}

/* Segment HUD Inspector Chips */
.hr-hud-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.hr-hud-chip strong {
  color: var(--text-primary);
  font-weight: 700;
  font-family: monospace;
  font-size: 12px;
}

.hr-hud-chip-primary {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.hr-hud-chip-heart {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.25);
  color: #f43f5e;
}

/* Dedicated Performance Recovery Check-In Modal */
#perf-status-dialog[open] {
  display: flex !important;
}

#perf-status-dialog::backdrop {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

@media (max-width: 600px) {
  #perf-status-dialog .subjective-grid {
    grid-template-columns: 1fr !important;
  }
}
