/* ===========================================
   AI Coach — Design System
   Premium dark theme with cycling-inspired accent
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- Design Tokens --- */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-solid: #1a2236;
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-hover: rgba(255, 255, 255, 0.08);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(249, 115, 22, 0.4);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #fb923c;

  --accent-orange: #f97316;
  --accent-coral: #f43f5e;
  --accent-gradient: linear-gradient(135deg, #f97316, #f43f5e);
  --accent-gradient-soft: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(244, 63, 94, 0.15));

  --color-ride: #f97316;
  --color-run: #3b82f6;
  --color-hike: #22c55e;
  --color-walk: #a78bfa;
  --color-virtual: #06b6d4;
  --color-event: #8b5cf6;
  --color-goal: #eab308;
  --color-blocked: #ef4444;
  --color-rest: #64748b;

  --success: #22c55e;
  --warning: #eab308;
  --error: #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.15);

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: #fdba74;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* --- Layout --- */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* --- Navigation --- */
.navbar {
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-primary);
}

.nav-brand-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

img.nav-brand-icon {
  background: none;
  display: block;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-links a.active {
  background: rgba(249, 115, 22, 0.12);
  color: var(--text-accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
}

.lang-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.user-avatar {
  width: 28px;
  height: 28px;
  background: var(--accent-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: white;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(249, 115, 22, 0.25);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-muted);
}

/* --- Login / Auth Pages --- */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(249, 115, 22, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(244, 63, 94, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.04) 0%, transparent 60%);
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-gradient);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
  box-shadow: var(--shadow-glow);
}

img.auth-logo-icon {
  background: none;
  display: inline-block;
  object-fit: contain;
}

.auth-logo h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.auth-logo p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Calendar --- */
.calendar-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.calendar-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

.calendar-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.calendar-nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
}

.calendar-weekday {
  padding: 10px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
  min-height: 100px;
  padding: 6px 8px;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}

.calendar-day:nth-child(7n) {
  border-right: none;
}

.calendar-day:hover {
  background: var(--bg-hover);
}

.calendar-day.other-month {
  opacity: 0.3;
}

.calendar-day.today {
  background: rgba(249, 115, 22, 0.06);
}

.calendar-day.today .day-number {
  background: var(--accent-gradient);
  color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-number {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: inline-block;
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.day-chip {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.day-chip.ride { background: rgba(249, 115, 22, 0.15); color: #fdba74; }
.day-chip.run { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.day-chip.hike { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.day-chip.walk { background: rgba(167, 139, 250, 0.15); color: #c4b5fd; }
.day-chip.virtual { background: rgba(6, 182, 212, 0.15); color: #67e8f9; }
.day-chip.event { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; border-left: 2px solid var(--color-event); }
.day-chip.other { background: rgba(100, 116, 139, 0.15); color: #cbd5e1; }

/* --- Detail Panel (slide-out) --- */
.detail-panel {
  position: fixed;
  right: -480px;
  top: 64px;
  bottom: 0;
  width: 480px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  z-index: 50;
  transition: right var(--transition-slow);
  overflow-y: auto;
  padding: 24px;
}

.detail-panel.open {
  right: 0;
}

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

.detail-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.detail-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.detail-activity {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
}

.detail-activity-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.activity-type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.detail-metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 2px;
}

.detail-metric strong {
  color: var(--text-primary);
}

/* --- Coach Page --- */
.coach-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
}

.question-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.question-card {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  line-height: 1.4;
}

.question-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-accent);
  color: var(--text-primary);
  transform: translateX(4px);
}

.question-card.active {
  border-color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.08);
  color: var(--text-accent);
}

.coach-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prompt-preview {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  max-height: 300px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.copy-feedback {
  position: fixed;
  top: 80px;
  right: 24px;
  padding: 10px 20px;
  background: var(--success);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 200;
  transform: translateX(200%);
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-md);
}

.copy-feedback.show {
  transform: translateX(0);
}

/* --- Profile Page --- */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.profile-section {
  margin-bottom: 20px;
}

.profile-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  transition: all var(--transition-fast);
}

.list-item .form-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0;
}

.list-item .form-input:focus {
  box-shadow: none;
}

.remove-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.remove-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.add-item-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px dashed var(--border-medium);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.8rem;
  transition: all var(--transition-fast);
  width: 100%;
  justify-content: center;
}

.add-item-btn:hover {
  border-color: var(--accent-orange);
  color: var(--text-accent);
  background: rgba(249, 115, 22, 0.05);
}

/* --- Strava Connection --- */
.strava-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
}

.strava-status.connected {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.strava-status.disconnected {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--error); }

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease forwards;
  max-width: 400px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--accent-orange); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* --- Loading States --- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-orange);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .coach-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 0 12px;
  }

  .nav-links {
    display: none;
  }

  .main-content {
    padding: 12px;
  }

  .calendar-day {
    min-height: 60px;
    padding: 4px;
  }

  .day-chip {
    font-size: 0.55rem;
  }

  .detail-panel {
    width: 100%;
    right: -100%;
  }

  .auth-card {
    margin: 16px;
  }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Page Header --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
}

/* --- Sync Status --- */
.sync-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(249, 115, 22, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-accent);
  margin-bottom: 16px;
}

/* --- Updates List (Coach Page) --- */
.updates-list {
  list-style: none;
}

.updates-list li {
  padding: 8px 12px;
  background: rgba(34, 197, 94, 0.08);
  border-left: 3px solid var(--success);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* --- Mobile nav toggle --- */
.nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.3rem;
  padding: 4px;
}

@media (max-width: 768px) {
  .nav-mobile-toggle {
    display: block;
  }
}

/* --- Intervals.icu Week Row Calendar Styles --- */
.calendar-weekdays {
  display: grid !important;
  grid-template-columns: 180px repeat(7, 1fr) !important;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
}

.calendar-grid {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.calendar-week-row {
  display: grid;
  grid-template-columns: 180px repeat(7, 1fr);
  gap: 8px;
  min-height: 120px;
}

.week-summary-cell {
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.week-summary-title {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 4px;
}

.week-summary-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-summary-stat-row {
  display: flex;
  justify-content: space-between;
  line-height: 1.3;
}

.week-summary-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 6px;
  margin-top: 4px;
}

.week-summary-breakdown-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
}

/* --- Premium Activity Cards --- */
.calendar-day {
  min-height: 120px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calendar-day:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.calendar-day.today {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.03);
}

.activity-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast);
  margin-bottom: 4px;
}

.activity-card:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.activity-card-header {
  padding: 3px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.activity-card-body {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.7rem;
}

.activity-card-metrics {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.activity-card-load {
  font-weight: 700;
  color: var(--text-secondary);
}

.activity-card-title {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.intensity-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 2px 0;
}

.intensity-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
}

/* Color input customization */
.form-color-picker {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 44px;
  height: 28px;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
}

.form-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: var(--radius-sm);
}

.form-color-picker::-moz-color-swatch {
  border: none;
  border-radius: var(--radius-sm);
}

/* --- Event Modal Styles --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal, 0.25s ease);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 440px;
  max-width: 90%;
  padding: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-md);
  transform: translateY(-20px);
  transition: transform var(--transition-normal, 0.25s ease);
}

.modal-backdrop.open .modal-content {
  transform: translateY(0);
}

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

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast, 0.15s ease), color var(--transition-fast, 0.15s ease);
}

.modal-close-btn:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

/* --- Drag and Drop Styles --- */
.activity-card[draggable="true"] {
  cursor: grab;
}

.activity-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.calendar-day.drag-over {
  background: rgba(139, 92, 246, 0.15);
  outline: 2px dashed var(--color-event, #8b5cf6);
  outline-offset: -2px;
}

/* --- Blocked Calendar Event Style --- */
.activity-card.blocked-event {
  border: 1px dashed var(--color-blocked, #ef4444);
  background: repeating-linear-gradient(
    45deg,
    color-mix(in srgb, var(--color-blocked, #ef4444) 20%, transparent),
    color-mix(in srgb, var(--color-blocked, #ef4444) 20%, transparent) 10px,
    rgba(17, 24, 39, 0.6) 10px,
    rgba(17, 24, 39, 0.6) 20px
  );
}

/* --- Goal Calendar Event Style --- */
.activity-card.goal-event {
  border: 1px solid var(--color-goal, #eab308);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--color-goal, #eab308) 15%, transparent),
    color-mix(in srgb, var(--color-goal, #eab308) 5%, transparent)
  );
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.2);
}

/* --- Coach Nav Link Special Highlight --- */
.nav-links a.nav-coach-highlight {
  background: var(--accent-gradient-soft);
  border: 1px solid var(--border-accent);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.15);
  font-weight: 700 !important;
  color: var(--text-accent) !important;
  transition: all var(--transition-base);
}

.nav-links a.nav-coach-highlight:hover,
.nav-links a.nav-coach-highlight.active {
  background: var(--accent-gradient) !important;
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px) scale(1.05);
}

/* --- Direct Coach API Styles --- */
.coach-direct-output {
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  border-left: 4px solid var(--accent-orange) !important;
  background: linear-gradient(145deg, var(--bg-card), rgba(249, 115, 22, 0.03)) !important;
}

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

/* Custom Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modalFadeIn var(--transition-fast);
}

.forgot-modal-content {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 30px;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp var(--transition-base);
}

.forgot-modal-content h2 {
  margin-bottom: 12px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.forgot-modal-content p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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