/* ============================================
   COMPONENTS.CSS — FitnessView v2
   All UI components: cards, nav, rings, chat,
   buttons, inputs, skeleton, modals, etc.
   ============================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-stack);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  background-image: radial-gradient(ellipse at 50% 0%, var(--morph-bg-hint) 0%, transparent 60%);
}

/* ---- Utility ---- */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ---- App Shell ---- */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

/* ---- Header ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding-top: env(safe-area-inset-top);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  height: var(--header-height);
}
.header-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.header-greeting {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.header-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* ---- Tab Content ---- */
.tab-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.tab-panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px calc(var(--nav-height) + env(safe-area-inset-bottom) + 80px);
  display: none;
  -webkit-overflow-scrolling: touch;
}
.tab-panel.active { display: block; }

/* ---- Bottom Nav ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  z-index: 100;
  display: flex;
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-stack);
  min-height: 44px;
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none;
  position: relative;
  transition: color 0.2s ease;
}
.nav-tab.active {
  color: var(--morph-accent-1);
}
.nav-tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2px;
  background: var(--morph-accent-1);
  border-radius: 0 0 2px 2px;
}
.nav-icon { font-size: 18px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.5px; }

/* ---- Floating AI Button ---- */
.fab-ai {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 12px);
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #bf5af2, #9b42d4);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  z-index: 99;
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.fab-ai:active { transform: scale(0.93); }
.fab-ai-icon { font-size: 20px; color: white; }
.fab-ai.hidden-fab { display: none; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* AI Card variant */
.card-ai {
  background: linear-gradient(135deg, rgba(191, 90, 242, 0.08), rgba(155, 66, 212, 0.04));
  border-color: var(--border-ai);
  box-shadow: var(--shadow-ai);
  position: relative;
  overflow: hidden;
}
.card-ai::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(191, 90, 242, 0.5), rgba(191, 90, 242, 0.1));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ---- AI Label ---- */
.ai-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-ai);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ---- Hero Readiness ---- */
.hero-section {
  text-align: center;
  padding: 24px 16px 16px;
}
.hero-date-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.hero-greeting {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.hero-score {
  font-size: 96px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -5px;
  color: var(--morph-accent-1);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.hero-state-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ---- Metrics Row ---- */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.metric-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
}
.metric-value {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 3px;
}
.metric-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---- Progress Bar ---- */
.progress-bar-wrap {
  background: var(--bg-elevated);
  border-radius: var(--radius-pill);
  height: 6px;
  overflow: hidden;
  margin: 6px 0;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.8s ease;
}

/* ---- Buttons ---- */
.btn-primary {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: var(--morph-accent-1);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-stack);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none;
  min-height: 44px;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.btn-primary:active { opacity: 0.85; transform: scale(0.98); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  font-family: var(--font-stack);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  min-height: 44px;
  transition: background 0.15s ease;
}
.btn-secondary:active { background: var(--bg-elevated); opacity: 0.8; }

.btn-ai {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(191, 90, 242, 0.15);
  color: var(--accent-ai);
  border: 1px solid rgba(191, 90, 242, 0.3);
  border-radius: var(--radius-md);
  font-family: var(--font-stack);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  min-height: 44px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none;
  transition: background 0.15s ease;
}
.icon-btn:active { background: var(--bg-elevated); }

/* ---- Inputs ---- */
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  margin-top: 14px;
}
.field-input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-stack);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease;
  min-height: 44px;
}
.field-input:focus { border-color: var(--accent-ai); }
.goal-input {
  width: 100%;
  padding: 10px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-stack);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  outline: none;
  min-height: 44px;
}
.goal-input:focus { border-color: var(--accent-ai); }

/* ---- Goal Row ---- */
.goal-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.goal-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.goal-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}

/* ---- Theme Toggle ---- */
.theme-toggle-row {
  display: flex;
  gap: 6px;
}
.theme-btn {
  flex: 1;
  padding: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-stack);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
  transition: all 0.15s ease;
}
.theme-btn.active {
  background: rgba(0, 255, 135, 0.12);
  border-color: var(--accent-peak);
  color: var(--accent-peak);
}

/* ---- Toggle Switch ---- */
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  transition: background 0.2s ease;
  cursor: pointer;
}
.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s ease, background 0.2s ease;
}
.toggle-switch input:checked + .toggle-track { background: rgba(0, 255, 135, 0.2); border-color: var(--accent-peak); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(22px); background: var(--accent-peak); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 0;
}
.modal-sheet {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 1px solid var(--border-subtle);
  max-height: 90dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.modal-body {
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  flex: 1;
}
.modal-close { color: var(--text-muted); }

/* ---- Settings Sections ---- */
.settings-section { margin-bottom: 24px; }
.settings-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: 12px;
}
.settings-row-label {
  font-size: 15px;
  color: var(--text-primary);
}
.settings-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}

/* ---- Bottom Sheet ---- */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
}
.bottom-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.bottom-sheet-panel {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  background: var(--bg-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 1px solid var(--border-subtle);
  max-height: 70dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border-card);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.bottom-sheet-body {
  overflow-y: auto;
  padding: 16px;
  flex: 1;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  top: calc(var(--header-height) + env(safe-area-inset-top) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-card);
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.toast-ai { border-color: var(--border-ai); background: rgba(191, 90, 242, 0.15); color: var(--accent-ai); }
.toast.toast-success { border-color: var(--accent-peak); color: var(--accent-peak); }
.toast.toast-warn { border-color: var(--accent-alert); color: var(--accent-alert); }

/* ---- Skeleton Screens ---- */
.skeleton {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.05) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}
.skeleton-hero { height: 120px; border-radius: var(--radius-lg); margin-bottom: 12px; }
.skeleton-card { height: 80px; border-radius: var(--radius-lg); margin-bottom: 12px; }
.skeleton-line { height: 16px; width: 60%; margin-bottom: 8px; }
.skeleton-line-full { height: 16px; width: 100%; margin-bottom: 8px; }

/* ---- Chat Bubbles (Coach Tab) ---- */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.chat-bubble-wrap {
  display: flex;
  gap: 8px;
  max-width: 85%;
}
.chat-bubble-wrap.coach { align-self: flex-start; }
.chat-bubble-wrap.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #bf5af2, #9b42d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  color: white;
}
.chat-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
}
.chat-bubble.coach {
  background: rgba(191, 90, 242, 0.12);
  border: 1px solid rgba(191, 90, 242, 0.2);
  color: var(--text-primary);
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
}
.chat-bubble.user {
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  border-radius: var(--radius-md) 4px var(--radius-md) var(--radius-md);
}
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chat-action-btn {
  padding: 6px 12px;
  background: rgba(191, 90, 242, 0.1);
  border: 1px solid rgba(191, 90, 242, 0.25);
  border-radius: var(--radius-pill);
  color: var(--accent-ai);
  font-family: var(--font-stack);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 36px;
  display: flex;
  align-items: center;
}

/* ---- Workout Exercise List ---- */
.exercise-list { display: flex; flex-direction: column; gap: 8px; }
.exercise-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-height: 44px;
}
.exercise-item.ai-modified {
  border-color: rgba(191, 90, 242, 0.3);
  background: rgba(191, 90, 242, 0.05);
}
.exercise-sparkle { color: var(--accent-ai); font-size: 12px; flex-shrink: 0; }
.exercise-name { font-size: 14px; font-weight: 600; flex: 1; }
.exercise-meta { font-size: 12px; color: var(--text-muted); }
.exercise-diff-old {
  text-decoration: line-through;
  color: var(--text-muted);
  font-size: 12px;
  display: block;
}
.exercise-diff-arrow { color: var(--accent-peak); font-size: 11px; margin: 0 2px; }
.exercise-diff-new { color: var(--accent-peak); font-size: 14px; font-weight: 600; }

/* ---- Filter Chips ---- */
.filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  margin-bottom: 12px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 7px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  min-height: 34px;
  display: flex;
  align-items: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.chip.active {
  background: rgba(0, 255, 135, 0.12);
  border-color: var(--accent-peak);
  color: var(--accent-peak);
}

/* ---- Streak ---- */
.streak-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.streak-dot {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--bg-elevated);
}
.streak-dot.filled { background: var(--morph-accent-1); }
.streak-dot.today { background: var(--morph-accent-1); box-shadow: 0 0 6px var(--morph-glow-1); }

/* ---- Period Selector ---- */
.period-selector {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 16px;
}
.period-btn {
  flex: 1;
  padding: 8px 4px;
  background: none;
  border: none;
  border-radius: calc(var(--radius-md) - 4px);
  color: var(--text-muted);
  font-family: var(--font-stack);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 36px;
  transition: all 0.15s ease;
}
.period-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* ---- Onboarding ---- */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.onboarding-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.onboarding-logo { margin-bottom: 16px; }
.onboarding-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -2px;
  margin-bottom: 6px;
}
.onboarding-sub {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}
.onboarding-step { text-align: left; }

/* ---- Pro Gate ---- */
.pro-gate-wrap { position: relative; }
.pro-gate-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 15, 0.75);
  backdrop-filter: blur(4px);
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 10;
  border-radius: var(--radius-lg);
}
.pro-gate-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-ai);
}
.pro-gate-btn {
  padding: 10px 20px;
  background: rgba(191, 90, 242, 0.2);
  border: 1px solid var(--accent-ai);
  border-radius: var(--radius-pill);
  color: var(--accent-ai);
  font-family: var(--font-stack);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

/* ---- UI.JS Component Classes ---- */

/* Text AI */
.text-ai { color: var(--accent-ai); font-weight: 600; }
.pro-badge { font-size: 9px; font-weight: 700; color: var(--accent-ai); border: 1px solid var(--accent-ai); border-radius: 100px; padding: 2px 6px; letter-spacing: 1px; }

/* Readiness components row */
.readiness-components { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.rc-item { font-size: 12px; color: var(--text-muted); }
.rc-item strong { color: var(--text-primary); }
.rc-sep { color: var(--border-card); font-size: 10px; }

/* Ring legend */
.ring-legend { display: flex; align-items: center; gap: 6px; }
.ring-legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.ring-legend-label { font-size: 10px; color: var(--text-muted); font-weight: 600; margin-right: 4px; }

/* Rings layout */
.rings-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.rings-main { flex-shrink: 0; }
.rings-stats { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ring-stat { font-size: 13px; }
.ring-stat-color { font-size: 20px; font-weight: 900; letter-spacing: -0.5px; }
.ring-stat-unit { color: var(--text-muted); font-size: 12px; }

/* Goal rows (Today tab) */
.goal-item-row { margin-bottom: 10px; }
.goal-item-info { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.goal-item-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.goal-item-val { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.goal-item-unit { font-size: 11px; color: var(--text-muted); font-weight: 400; }

/* Streaks */
.streaks-row { display: flex; align-items: center; gap: 0; }
.streak-item { flex: 1; text-align: center; padding: 8px 0; }
.streak-number { font-size: 32px; font-weight: 900; letter-spacing: -2px; line-height: 1; margin-bottom: 4px; }
.streak-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.streak-divider { width: 1px; height: 48px; background: var(--border-subtle); flex-shrink: 0; }

/* Workout rows */
.workout-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.workout-row:last-child { border-bottom: none; }
.workout-icon { font-size: 22px; flex-shrink: 0; }
.workout-info { flex: 1; }
.workout-name { display: block; font-size: 14px; font-weight: 600; }
.workout-meta { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.workout-dur { flex-shrink: 0; }

/* Exercise rows (Train tab) */
.exercise-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  min-height: 44px;
}
.exercise-row.exercise-diff { border-color: rgba(191, 90, 242, 0.3); background: rgba(191, 90, 242, 0.05); }
.exercise-info { flex: 1; }
.exercise-name { display: block; font-size: 14px; font-weight: 600; }
.exercise-muscles { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.exercise-sets { font-size: 12px; font-weight: 700; color: var(--morph-accent-1); flex-shrink: 0; white-space: nowrap; }
.diff-sparkle { flex-shrink: 0; font-size: 12px; margin-top: 2px; }
.diff-old { display: block; font-size: 11px; text-decoration: line-through; color: var(--text-muted); }
.diff-arrow { color: var(--accent-peak); margin: 0 4px; font-size: 11px; }
.diff-new { font-size: 14px; font-weight: 700; color: var(--accent-peak); }
.diff-reason { display: block; font-size: 11px; margin-top: 2px; }

/* Health Insights grid */
.insights-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.insight-cell { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 10px; }
.insight-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.insight-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.insight-val { font-size: 18px; font-weight: 900; letter-spacing: -0.5px; }
.insight-val small { font-size: 10px; font-weight: 400; color: var(--text-muted); margin-left: 2px; }

/* Heatmap legend */
.heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 8px; justify-content: flex-end; }
.heatmap-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Trend card body */
.trend-card-body { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.trend-stats { display: flex; gap: 12px; }
.trend-stat-item { display: flex; flex-direction: column; }
.trend-stat-val { font-size: 16px; font-weight: 900; letter-spacing: -0.5px; }
.trend-stat-label { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* Anomaly rows */
.anomaly-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border-subtle); }
.anomaly-row:last-child { border-bottom: none; margin-bottom: 0; }
.anomaly-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-ai); flex-shrink: 0; margin-top: 3px; }

/* Distribution donut layout */
.donut-row { display: flex; align-items: center; gap: 16px; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.donut-legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.donut-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* PR items */
.pr-item { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 12px; text-align: center; }
.pr-value { font-size: 22px; font-weight: 900; letter-spacing: -1px; color: var(--morph-accent-1); }
.pr-unit { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 2px; }
.pr-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* Workout history expandable cards */
.history-card { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); margin-bottom: 8px; overflow: hidden; }
.history-card-header { cursor: pointer; padding: 4px 0; touch-action: manipulation; user-select: none; }
.history-card-body { display: none; padding: 8px 0 4px; border-top: 1px solid var(--border-subtle); margin-top: 4px; }
.history-card.expanded .history-card-body { display: block; }
.history-card.expanded .history-chevron { transform: rotate(180deg); }
.history-chevron { color: var(--text-muted); font-size: 14px; flex-shrink: 0; transition: transform 0.2s ease; }

/* Chat (Coach tab) */
.chat-window { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.chat-row { display: flex; gap: 8px; max-width: 88%; }
.chat-row-coach { align-self: flex-start; }
.chat-row-user { align-self: flex-end; flex-direction: row-reverse; max-width: 80%; margin-left: auto; }
.chat-col { display: flex; flex-direction: column; gap: 4px; }
.chat-bubble-coach {
  background: rgba(191, 90, 242, 0.1);
  border: 1px solid rgba(191, 90, 242, 0.2);
  color: var(--text-primary);
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
}
.chat-bubble-user {
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  border-radius: var(--radius-md) 4px var(--radius-md) var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
}
.chat-time { font-size: 10px; color: var(--text-muted); padding: 0 2px; }
.chat-options { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
.chat-option-btn {
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-family: var(--font-stack);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 36px;
  display: flex;
  align-items: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.chat-option-btn:active { background: rgba(191, 90, 242, 0.1); border-color: var(--accent-ai); color: var(--accent-ai); }

/* Pro gate */
.pro-gate { position: relative; border-radius: var(--radius-lg); overflow: hidden; }
.pro-gate-blur { pointer-events: none; user-select: none; }
.pro-gate-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 15, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
}
.pro-gate-msg { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

/* Skeleton extras */
.skeleton-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.skeleton-cell { height: 64px; border-radius: var(--radius-md); }
.skeleton-card.short { height: 50px; }
.skeleton-hero, .skeleton-card, .skeleton-cell {
  background: var(--bg-elevated);
  position: relative;
  overflow: hidden;
}
.skeleton-hero::after, .skeleton-card::after, .skeleton-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.05) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}

/* ---- Summary Stat Row ---- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.stat-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
}
.stat-value {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}
.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* ---- PR Grid ---- */
.pr-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.pr-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px;
}
.pr-exercise { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.pr-value { font-size: 20px; font-weight: 900; letter-spacing: -0.5px; color: var(--morph-accent-1); }
.pr-unit { font-size: 11px; color: var(--text-muted); }

/* ---- Expandable Workout Card ---- */
.workout-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  overflow: hidden;
}
.workout-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
  user-select: none;
}
.workout-type-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(0, 255, 135, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.workout-card-info { flex: 1; }
.workout-card-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.workout-card-meta { font-size: 12px; color: var(--text-muted); }
.workout-card-chevron {
  color: var(--text-muted);
  font-size: 12px;
  transition: transform 0.2s ease;
}
.workout-card.expanded .workout-card-chevron { transform: rotate(180deg); }
.workout-card-body {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}
.workout-card.expanded .workout-card-body { display: block; }

/* ---- Heatmap ---- */
.heatmap-wrap { overflow-x: auto; scrollbar-width: none; }
.heatmap-wrap::-webkit-scrollbar { display: none; }

/* ---- Trend Card ---- */
.trend-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 10px;
}
.trend-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.trend-card-metric { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; }
.trend-card-value { font-size: 24px; font-weight: 900; letter-spacing: -1px; }
.trend-card-range { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ---- Health Insight ---- */
.health-insight-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.health-insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px;
}
.health-insight-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.health-insight-value { font-size: 22px; font-weight: 900; letter-spacing: -0.5px; margin-bottom: 6px; }
.health-insight-unit { font-size: 11px; color: var(--text-muted); }

/* ---- Section Header ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  margin-top: 20px;
}
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.section-action {
  font-size: 12px;
  font-weight: 600;
  color: var(--morph-accent-1);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  touch-action: manipulation;
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* ---- Mini Rings Row ---- */
.mini-rings-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.mini-rings-row::-webkit-scrollbar { display: none; }
.mini-ring-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mini-ring-label { font-size: 9px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }

/* ---- Highlights Row ---- */
.highlights-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.highlight-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
}
.highlight-value { font-size: 18px; font-weight: 900; letter-spacing: -0.5px; }
.highlight-label { font-size: 9px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
