/* ==========================================================================
   Garmin Triathlon Analytics & Predictive Dashboard - Editorial Dark Theme
   Inspired by High-End Audio & Luxury Performance Design (Matte Carbon, Flame Orange & Acid Yellow)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Brand & Signature Colors (Spesial Sounds Palette) */
  --accent-orange: #ff4d00;
  --accent-orange-hover: #ff6622;
  --accent-orange-glow: rgba(255, 77, 0, 0.35);
  
  --accent-yellow: #ffe600;
  --accent-yellow-hover: #fff04d;
  --accent-yellow-glow: rgba(255, 230, 0, 0.35);
  
  --accent-cyan: #00f0ff;
  --accent-cyan-glow: rgba(0, 240, 255, 0.3);
  
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.3);

  --accent-purple: #b55fe6;
  --accent-purple-glow: rgba(181, 95, 230, 0.35);

  /* Deep Matte Carbon & Graphite Surfaces */
  --bg-main: #0c0c10;
  --bg-surface: #121217;
  --bg-card: #17171e;
  --bg-card-hover: #1e1e27;
  --bg-subcard: #131319;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-hover: rgba(255, 77, 0, 0.4);
  --border-highlight: rgba(255, 230, 0, 0.4);
  
  /* High-Contrast Typography */
  --text-main: #ffffff;
  --text-muted: #9898a6;
  --text-dim: #5e5e6e;
  
  /* Triathlon Disciplines Harmonized */
  --swim-color: #00f0ff;
  --swim-bg: rgba(0, 240, 255, 0.12);
  --swim-border: rgba(0, 240, 255, 0.3);
  
  --bike-color: #ffe600;
  --bike-bg: rgba(255, 230, 0, 0.12);
  --bike-border: rgba(255, 230, 0, 0.3);
  
  --run-color: #ff4d00;
  --run-bg: rgba(255, 77, 0, 0.12);
  --run-border: rgba(255, 77, 0, 0.3);
  
  --brick-color: #d946ef;
  --brick-bg: rgba(217, 70, 239, 0.14);
  
  --strength-color: #a855f7;
  --strength-bg: rgba(168, 85, 247, 0.14);
  
  /* Banister PMC Colors */
  --ctl-color: #00f0ff;  /* Fitness */
  --atl-color: #ff4d00;  /* Fatigue */
  --tsb-color: #ffe600;  /* Form */
  --danger-color: #ff3344;
  --success-color: #10b981;
  
  /* Super-Ellipse Radii & Pill Shapes */
  --radius-pill: 9999px;
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  
  /* Shadows & Glows */
  --shadow-card: 0 16px 36px -10px rgba(0, 0, 0, 0.7);
  --shadow-hero: 0 24px 50px -12px rgba(0, 0, 0, 0.85);
  --shadow-orange: 0 8px 24px -4px rgba(255, 77, 0, 0.4);
  --shadow-yellow: 0 8px 24px -4px rgba(255, 230, 0, 0.35);
  
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  font-feature-settings: 'tnum' on, 'cv02' on;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(255, 77, 0, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 15%, rgba(255, 230, 0, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(0, 240, 255, 0.03) 0%, transparent 50%);
  background-attachment: fixed;
}

/* ========================================================
   HEADER & TOP NAVIGATION
   ======================================================== */
header.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 2.5rem;
  background: rgba(12, 12, 16, 0.92);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
}

/* Circular Yellow Logo Badge from Mockup */
.brand-icon {
  width: 42px;
  height: 42px;
  background: var(--accent-yellow);
  color: #000000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 900;
  box-shadow: var(--shadow-yellow);
  flex-shrink: 0;
}

.brand-title h1 {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #ffffff;
  line-height: 1.1;
  text-transform: uppercase;
}

.brand-title h1 span {
  color: var(--accent-orange);
}

.brand-subtitle {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-top: 2px;
}

/* Navigation Tabs (Minimal Pill Navigation) */
nav.app-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #14141a;
  padding: 0.35rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
}

nav.app-nav button.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.55rem 1.15rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  letter-spacing: 0.02em;
}

nav.app-nav button.nav-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

nav.app-nav button.nav-btn.active {
  color: #000000;
  background: var(--accent-yellow);
  box-shadow: var(--shadow-yellow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Vibrant Orange Capsule Sync Button */
.btn-sync {
  background: var(--accent-orange);
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.45rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-orange);
  transition: all 0.2s ease;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn-sync:hover {
  background: var(--accent-orange-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px -4px rgba(255, 77, 0, 0.6);
}

/* ========================================================
   EDITORIAL HERO SECTION ("PEAK ON TRIATHLON POWER")
   Directly matching the "HEAVEN ON AUDIO SOUND" style
   ======================================================== */
.editorial-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 2.5rem;
  padding: 2.5rem 0 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.editorial-hero-left {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.editorial-tagline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.editorial-pill {
  background: rgba(255, 230, 0, 0.12);
  color: var(--accent-yellow);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editorial-sub {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editorial-title {
  font-size: 4.2rem;
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.editorial-title .text-orange {
  color: var(--accent-orange);
}

.editorial-title .text-white {
  color: #ffffff;
}

.editorial-title .text-yellow {
  color: var(--accent-yellow);
}

.editorial-hero-right {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.editorial-hero-right::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(255, 77, 0, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

/* Audio & Telemetry Soundwave Indicator */
.editorial-wave {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 32px;
}

.editorial-wave span {
  width: 3.5px;
  background: var(--accent-orange);
  border-radius: 2px;
  animation: wave-bounce 1.6s ease-in-out infinite alternate;
}

.editorial-wave span:nth-child(2) { height: 40%; animation-delay: 0.1s; background: var(--accent-yellow); }
.editorial-wave span:nth-child(3) { height: 75%; animation-delay: 0.25s; }
.editorial-wave span:nth-child(4) { height: 95%; animation-delay: 0.4s; background: var(--accent-yellow); }
.editorial-wave span:nth-child(5) { height: 60%; animation-delay: 0.15s; }
.editorial-wave span:nth-child(6) { height: 100%; animation-delay: 0.5s; background: #ffffff; }
.editorial-wave span:nth-child(7) { height: 80%; animation-delay: 0.3s; }
.editorial-wave span:nth-child(8) { height: 50%; animation-delay: 0.2s; background: var(--accent-yellow); }
.editorial-wave span:nth-child(9) { height: 90%; animation-delay: 0.45s; }
.editorial-wave span:nth-child(10) { height: 35%; animation-delay: 0.1s; }

@keyframes wave-bounce {
  0% { transform: scaleY(0.3); opacity: 0.6; }
  100% { transform: scaleY(1); opacity: 1; }
}

.editorial-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.editorial-cta-row {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* Capsule Buttons */
.btn-capsule-orange {
  background: var(--accent-orange);
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-orange);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-capsule-orange:hover {
  background: var(--accent-orange-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255, 77, 0, 0.55);
}

.btn-capsule-yellow {
  background: var(--accent-yellow);
  color: #000000;
  border: none;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-yellow);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-capsule-yellow:hover {
  background: var(--accent-yellow-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255, 230, 0, 0.5);
}

.btn-capsule-outline {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-capsule-outline:hover {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

/* ========================================================
   MAIN CONTAINER & CARD SYSTEM
   ======================================================== */
main.container {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2.5rem 4rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.6rem 1.8rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.card:hover {
  border-color: var(--border-hover);
}

.card-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title span:first-child {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: none;
}

/* ========================================================
   EDITORIAL SHOWCASE GRID (3-COLUMN LUXURY SPEC LAYOUT)
   Faithfully matching the Spesial Sounds / HarmoniLux Mockup
   ======================================================== */
.editorial-showcase-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.25rem;
  align-items: stretch;
}

@media (max-width: 1100px) {
  .editorial-showcase-grid {
    grid-template-columns: 1fr;
  }
}

.showcase-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.showcase-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

/* Center Highlight: The Optimal A-Race Command Center */
.showcase-card-optimal {
  background: linear-gradient(150deg, #13131c 0%, #18141f 50%, #15151c 100%);
  border: 1px solid rgba(255, 77, 0, 0.4);
  border-radius: 28px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75), 0 0 35px rgba(255, 77, 0, 0.12);
  position: relative;
}

.showcase-card-optimal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-orange), var(--accent-yellow));
  border-radius: 28px 28px 0 0;
}

.showcase-card-optimal::after {
  content: '';
  position: absolute;
  bottom: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 230, 0, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

/* Feature Box Yellow Accent (From HarmoniLux Spec Card in Mockup) */
.feature-box-yellow {
  background: linear-gradient(135deg, rgba(255, 230, 0, 0.12), rgba(255, 77, 0, 0.08));
  border: 1px solid rgba(255, 230, 0, 0.35);
  border-radius: 16px;
  padding: 1.1rem 1.25rem;
  margin: 1.1rem 0;
  position: relative;
}

.feature-box-yellow .box-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-yellow);
}

.feature-box-yellow .box-val {
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin-top: 0.2rem;
}

.feature-box-yellow .box-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.25rem;
}

/* Clean Spec-Sheet Rows (HarmoniLux Elite Style) */
.spec-list {
  display: flex;
  flex-direction: column;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

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

.spec-label {
  color: var(--text-muted);
  font-weight: 600;
}

.spec-val {
  color: #ffffff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Predictor Split Grid Responsive */
.splits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.1rem;
  margin: 1.5rem 0;
}

/* ========================================================
   HERO READINESS & TRAINING STATUS GRID
   ======================================================== */
.hero-readiness {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(295px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.readiness-meter {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.score-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-emerald) calc(var(--score-val, 80) * 1%), rgba(255, 255, 255, 0.08) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  box-shadow: var(--accent-emerald-glow);
}

.score-circle::after {
  content: "";
  position: absolute;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--bg-card);
}

.score-inner {
  position: relative;
  z-index: 1;
  text-align: center;
}

.score-number {
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.score-unit {
  font-size: 0.6rem;
  color: var(--text-dim);
  font-weight: 800;
  margin-top: 2px;
  letter-spacing: 0.06em;
}

.readiness-text h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.35rem;
}

.readiness-text p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Metric Pills */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.metric-pill {
  background: var(--bg-subcard);
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.metric-pill .label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.metric-pill .val {
  font-size: 1.25rem;
  font-weight: 900;
  margin-top: 0.2rem;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.metric-pill .sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-optimal {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-warning {
  background: rgba(255, 77, 0, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(255, 77, 0, 0.35);
}

.badge-sweet-spot {
  background: rgba(255, 230, 0, 0.15);
  color: var(--accent-yellow);
  border: 1px solid rgba(255, 230, 0, 0.35);
}

.badge-info {
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.35);
}

.badge-danger {
  background: rgba(255, 51, 68, 0.18);
  color: #ff4455;
  border: 1px solid rgba(255, 51, 68, 0.4);
}

/* Tab Content Visibility */
.tab-pane {
  display: none;
}

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

/* Charts Grid */
.charts-grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-wrapper {
  position: relative;
  height: 340px;
  width: 100%;
}

/* Discipline Badges */
.sport-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sport-swim {
  background: var(--swim-bg);
  color: var(--swim-color);
  border: 1px solid var(--swim-border);
}

.sport-bike {
  background: var(--bike-bg);
  color: var(--bike-color);
  border: 1px solid var(--bike-border);
}

.sport-run {
  background: var(--run-bg);
  color: var(--run-color);
  border: 1px solid var(--run-border);
}

.sport-brick {
  background: var(--brick-bg);
  color: var(--brick-color);
  border: 1px solid rgba(217, 70, 239, 0.35);
}

/* ========================================================
   EDITORIAL ATHLETE TRAINING CALENDAR
   ======================================================== */
.calendar-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

/* Calendar Toolbar */
.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.calendar-nav-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #131319;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.65rem;
}

.calendar-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: all 0.15s ease;
}

.calendar-nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.cal-month-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
  min-width: 185px;
  text-align: center;
  letter-spacing: -0.01em;
}

/* Calendar Month Stats Dashboard */
.cal-month-stats-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.cal-stat-tile {
  background: #14141a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.cal-stat-tile:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.cal-stat-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.cal-stat-tile.stat-swim::before { background: var(--swim-color); }
.cal-stat-tile.stat-bike::before { background: var(--bike-color); }
.cal-stat-tile.stat-run::before { background: var(--run-color); }
.cal-stat-tile.stat-tss::before { background: var(--accent-yellow); }
.cal-stat-tile.stat-total::before { background: #ffffff; }

.cal-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cal-stat-val {
  font-size: 1.45rem;
  font-weight: 900;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.cal-stat-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Calendar Scroll Container & Grid */
.calendar-scroll-container {
  overflow-x: auto;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #101015;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(135px, 1fr)) 130px;
  gap: 1px;
  background: rgba(255, 255, 255, 0.05); /* 1px crisp divider lines */
  min-width: 1080px;
  width: 100%;
}

.cal-header-cell {
  background: #14141b;
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cal-day-cell {
  background: #0f0f14;
  min-height: 145px;
  max-height: 260px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto;
  transition: background 0.15s ease;
}

.cal-day-cell:hover {
  background: #16161f;
}

.cal-day-cell.other-month {
  background: #0a0a0d;
  opacity: 0.3;
}

.cal-day-cell.today {
  background: rgba(255, 230, 0, 0.04);
  box-shadow: inset 0 0 0 1px var(--accent-yellow);
}

/* Day Cell Header */
.cal-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cal-day-num {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
}

.cal-day-cell.today .cal-day-num {
  color: var(--accent-yellow);
  font-weight: 900;
}

.cal-day-today-tag {
  background: var(--accent-yellow);
  color: #000000;
  font-size: 0.58rem;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.06em;
}

.cal-day-tss-tag {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--accent-yellow);
  background: rgba(255, 230, 0, 0.12);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 230, 0, 0.3);
  font-variant-numeric: tabular-nums;
}

/* Workout Cards inside Calendar */
.cal-workout-card {
  background: #181822;
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
  border-left: 3px solid #64748b;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.cal-workout-card:hover {
  transform: translateY(-2px);
  background: #222230;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

.cal-workout-card.card-swimming { border-left-color: var(--swim-color); }
.cal-workout-card.card-cycling  { border-left-color: var(--bike-color); }
.cal-workout-card.card-running  { border-left-color: var(--run-color); }
.cal-workout-card.card-brick    { border-left-color: var(--brick-color); }
.cal-workout-card.card-other    { border-left-color: var(--strength-color); }

.cal-workout-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.cal-workout-title {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-workout-dur {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
  margin-left: 0.25rem;
}

.cal-workout-bottom {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
  font-size: 0.65rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.cal-metric-pill {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 700;
}

.cal-metric-pill.highlight {
  color: #fff;
  font-weight: 800;
}

.cal-metric-tss {
  margin-left: auto;
  color: var(--accent-yellow);
  font-weight: 800;
}

/* Week Summary Column */
.cal-week-summary {
  background: #131319;
  padding: 0.75rem 0.55rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.72rem;
}

.cal-week-header {
  font-size: 0.68rem;
  font-weight: 900;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cal-week-tss-badge {
  color: var(--accent-yellow);
  font-weight: 900;
}

.cal-week-disciplines {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.4rem 0;
}

.cal-week-disc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 700;
}

.cal-week-footer {
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* ========================================================
   TABLES & LISTS
   ======================================================== */
.table-responsive {
  overflow-x: auto;
}

table.tri-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

table.tri-table th {
  padding: 1rem 1.1rem;
  background: #121217;
  color: var(--text-dim);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-color);
}

table.tri-table td {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  transition: background 0.15s ease;
}

table.tri-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

table.data-table th {
  padding: 0.85rem 1rem;
  background: #121217;
  color: var(--text-dim);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-color);
}

table.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  transition: background 0.15s ease;
}

table.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* ========================================================
   UNIVERSAL TOGGLE PILLS & TIME SELECTORS
   ======================================================== */
.btn-toggle-pill,
.time-range-selector button,
.btn-pmc-range,
.btn-pmc-range-full {
  background: #14141a;
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-pill:hover,
.time-range-selector button:hover,
.btn-pmc-range:hover,
.btn-pmc-range-full:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.btn-toggle-pill.active,
.time-range-selector button.active,
.btn-pmc-range.active,
.btn-pmc-range-full.active {
  background: var(--accent-yellow) !important;
  color: #000000 !important;
  border-color: var(--accent-yellow) !important;
  box-shadow: var(--shadow-yellow);
  font-weight: 800;
}

/* ========================================================
   INTERACTIVE FORMS & CONTROLS
   ======================================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #121217;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 3px rgba(255, 77, 0, 0.2);
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.slider-container input[type="range"] {
  flex: 1;
  accent-color: var(--accent-orange);
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
}

/* Predictor Split Grid */
.splits-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.1rem;
  margin: 1.5rem 0;
}

.split-card {
  background: #14141b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
}

.split-card.total {
  background: linear-gradient(135deg, rgba(255, 77, 0, 0.15), rgba(255, 230, 0, 0.15));
  border-color: var(--accent-orange);
  box-shadow: var(--shadow-orange);
}

.split-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 0.45rem;
  letter-spacing: 0.05em;
}

.split-time {
  font-size: 1.65rem;
  font-weight: 900;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.split-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ========================================================
   MODAL DIALOGS
   ======================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: #16161e;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-hero);
  padding: 2rem;
  animation: modal-enter 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-enter {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

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

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* ========================================================
   RESPONSIVE LAYOUT & MOBILE OPTIMIZATIONS
   ======================================================== */

.header-top-row {
  display: contents; /* On desktop, contents lets children participate directly in flex */
}

.btn-logout {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  padding: 0.55rem 0.95rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: #f43f5e;
  color: #fda4af;
}

.cal-mobile-hint {
  display: none;
}

/* Tablet & Smaller Screens (< 1024px) */
@media (max-width: 1024px) {
  header.app-header {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem 1.5rem;
  }

  .header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  nav.app-nav {
    overflow-x: auto;
    width: 100%;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.25rem 0.35rem;
    gap: 0.35rem;
  }
  nav.app-nav::-webkit-scrollbar {
    display: none;
  }
  nav.app-nav button.nav-btn {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.82rem;
    padding: 0.5rem 0.95rem;
  }

  .editorial-hero {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .editorial-title {
    font-size: clamp(2.2rem, 5vw, 3.2rem);
  }
  .hero-readiness {
    grid-template-columns: 1fr;
  }
  .charts-grid-2 {
    grid-template-columns: 1fr;
  }
  .splits-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile Devices (< 768px) */
@media (max-width: 768px) {
  /* Prevent iOS zoom-on-input */
  input, select, textarea {
    font-size: 16px !important;
  }

  header.app-header {
    padding: 0.75rem 1rem;
    gap: 0.65rem;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .brand-title h1 {
    font-size: 1rem;
  }

  .brand-subtitle {
    font-size: 0.62rem;
  }

  .header-actions {
    gap: 0.5rem;
  }

  .btn-sync {
    padding: 0.5rem 0.95rem;
    font-size: 0.78rem;
  }

  .btn-logout {
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
  }

  .hide-mobile {
    display: none !important;
  }

  main.container {
    padding: 0.75rem 0.65rem;
  }

  .editorial-title {
    font-size: clamp(1.65rem, 6.8vw, 2.35rem);
    line-height: 1.15;
  }

  .editorial-tagline {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .editorial-showcase-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .showcase-card {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
  }

  .metrics-grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .biometrics-spec-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
  }

  .chart-canvas-container {
    height: 250px !important;
  }

  .cal-mobile-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-bottom: 0.65rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-pill);
    border: 1px dashed rgba(255, 255, 255, 0.08);
  }

  .cal-month-stats-banner {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .cal-month-title {
    font-size: 1.05rem;
    min-width: 135px;
  }

  .calendar-scroll-container {
    -webkit-overflow-scrolling: touch;
  }

  .splits-grid {
    grid-template-columns: 1fr;
  }

  #modal-activity-detail .modal-box {
    width: 96%;
    max-height: 94vh;
    padding: 1.15rem 0.85rem;
    border-radius: 18px;
    margin: 0.5rem auto;
  }

  .act-subtabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0.85rem 0 0.85rem 0;
  }

  .act-subtabs::-webkit-scrollbar {
    display: none;
  }

  .act-subtab-btn {
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
    flex-shrink: 0;
  }
}

/* Extra Small Phones (< 440px) */
@media (max-width: 440px) {
  .metrics-grid-4 {
    grid-template-columns: 1fr;
  }

  .biometrics-spec-grid {
    grid-template-columns: 1fr !important;
  }

  .cal-month-stats-banner {
    grid-template-columns: 1fr;
  }

  .cal-month-title {
    font-size: 0.95rem;
    min-width: 110px;
  }
}

/* ========================================================
   ACTIVITY DETAIL MODAL ENHANCEMENTS
   ======================================================== */
#modal-activity-detail .modal-box {
  max-width: 980px;
  width: 96%;
  max-height: 92vh;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}

#act-modal-body {
  overflow-y: auto;
  padding-right: 0.35rem;
  margin-top: 0.75rem;
}

.act-subtabs {
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border-color);
  margin: 1.25rem 0 1rem 0;
  overflow-x: auto;
}

.act-subtab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.act-subtab-btn:hover {
  color: #fff;
}

.act-subtab-btn.active {
  color: var(--ctl-color);
  border-bottom-color: var(--ctl-color);
}

.act-tab-content {
  display: none;
}

.act-tab-content.active {
  display: block;
}

.zone-bar-container {
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 1rem;
}

.zone-bar-seg {
  height: 100%;
  transition: width 0.3s ease;
}

