/* =============================================
   WebnWell Roadmap — Design System & Styles
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(22, 22, 32, 0.7);
  --bg-card-hover: rgba(30, 30, 45, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.03);

  --text-primary: #f0f0f5;
  --text-secondary: #9494a8;
  --text-muted: #5a5a72;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-card: rgba(255, 255, 255, 0.08);

  /* Accent Palettes */
  --accent-indigo: #6366f1;
  --accent-indigo-light: #818cf8;
  --accent-purple: #a78bfa;
  --accent-violet: #8b5cf6;
  --accent-emerald: #34d399;
  --accent-emerald-dark: #059669;
  --accent-amber: #fbbf24;
  --accent-amber-dark: #d97706;
  --accent-rose: #fb7185;
  --accent-rose-dark: #e11d48;
  --accent-cyan: #22d3ee;
  --accent-sky: #38bdf8;

  /* Roadmap Theme Colors (overridden per roadmap) */
  --theme-primary: var(--accent-indigo);
  --theme-secondary: var(--accent-purple);
  --theme-glow: rgba(99, 102, 241, 0.15);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --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 40px var(--theme-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 200ms;
  --duration-normal: 350ms;
  --duration-slow: 500ms;
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  position: relative;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* --- Ambient Background --- */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.4;
  animation: ambientFloat 20s ease-in-out infinite;
}

.ambient-orb--1 {
  width: 500px;
  height: 500px;
  background: var(--theme-primary);
  top: -10%;
  left: -10%;
  animation-delay: 0s;
}

.ambient-orb--2 {
  width: 400px;
  height: 400px;
  background: var(--theme-secondary);
  bottom: -10%;
  right: -10%;
  animation-delay: -7s;
}

.ambient-orb--3 {
  width: 300px;
  height: 300px;
  background: var(--accent-cyan);
  top: 40%;
  left: 50%;
  opacity: 0.15;
  animation-delay: -14s;
}

@keyframes ambientFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* --- Header --- */
.header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header__logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-card);
  backdrop-filter: blur(12px);
}

.header__title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header__badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
  color: white;
}

.header__meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header__date {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.header__summary-btn,
.header__access-btn {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--theme-primary);
  background: var(--theme-glow);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
}
.header__summary-btn:hover,
.header__access-btn:hover {
  transform: scale(1.05);
  border-color: rgba(255,255,255,0.2);
}

.access-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}
.access-item__email {
  color: var(--text-primary);
}
.access-item__remove {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.access-item__remove:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* --- Roadmap Switcher --- */
.switcher {
  position: relative;
  z-index: 10;
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-xs);
  margin: var(--space-xl) 0;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.switcher::-webkit-scrollbar { display: none; }

.switcher__btn {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-out);
  flex: 1;
  justify-content: center;
  min-width: 0;
}

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

.switcher__btn.active {
  color: white;
}

.switcher__icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.switcher__indicator {
  position: absolute;
  z-index: 1;
  top: var(--space-xs);
  left: var(--space-xs);
  height: calc(100% - var(--space-sm));
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
  box-shadow: var(--shadow-glow);
  transition: all var(--duration-normal) var(--ease-spring);
  pointer-events: none;
}

/* --- Roadmap Main --- */
.roadmap {
  position: relative;
  z-index: 5;
  padding-bottom: var(--space-3xl);
}

/* Roadmap Hero */
.roadmap__hero {
  margin-bottom: var(--space-2xl);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeSlideIn 0.6s var(--ease-out) forwards;
}

.roadmap__hero-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--theme-glow);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--theme-primary);
  margin-bottom: var(--space-md);
}

.roadmap__hero-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--theme-primary) 50%, var(--theme-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.roadmap__hero-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.7;
}

/* Stats Row */
.roadmap__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeSlideIn 0.6s var(--ease-out) 0.1s forwards;
}

.stat-card {
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  text-align: center;
  transition: transform var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--theme-primary);
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: var(--space-xs);
}

/* Phase Sections */
.phase {
  position: relative;
  margin-bottom: var(--space-2xl);
  opacity: 0;
  transform: translateY(30px);
  animation: fadeSlideIn 0.6s var(--ease-out) forwards;
}

.phase:nth-child(3) { animation-delay: 0.15s; }
.phase:nth-child(4) { animation-delay: 0.25s; }
.phase:nth-child(5) { animation-delay: 0.35s; }
.phase:nth-child(6) { animation-delay: 0.45s; }

.phase__header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.phase__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.phase__title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.phase__timeline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

/* Milestone Cards */
.milestones {
  display: grid;
  gap: var(--space-md);
}

.milestone {
  position: relative;
  display: flex;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  transition: all var(--duration-fast) var(--ease-out);
  cursor: default;
}

.milestone::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--theme-glow), transparent);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.milestone:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.milestone:hover::before {
  opacity: 1;
}

.milestone__status {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.milestone__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  background: transparent;
  transition: all var(--duration-fast) var(--ease-out);
}

.milestone__dot--done {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.4);
}

.milestone__dot--active {
  background: var(--theme-primary);
  border-color: var(--theme-primary);
  box-shadow: 0 0 12px var(--theme-glow);
  animation: pulse 2s ease-in-out infinite;
}

.milestone__line {
  flex: 1;
  width: 2px;
  background: var(--border-subtle);
  min-height: 20px;
}

.milestone__content {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
}

.milestone__name {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.milestone__desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-sm);
}

.milestone__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.milestone__tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.milestone__tag--priority {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
  background: rgba(251, 191, 36, 0.08);
}

.milestone__meta {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.milestone__badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.milestone__badge--done {
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.milestone__badge--active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-indigo-light);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.milestone__badge--upcoming {
  background: var(--bg-glass);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* --- Overview Section --- */
.overview {
  position: relative;
  z-index: 5;
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--border-subtle);
  margin-bottom: var(--space-3xl);
}

.overview__title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
}

.overview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-md);
}

.overview__card {
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.overview__card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--card-color-1, var(--accent-indigo)), var(--card-color-2, var(--accent-purple)));
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.overview__card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--shadow-lg);
}

.overview__card:hover::after {
  opacity: 1;
}

.overview__card-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.overview__card-name {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.overview__card-progress {
  margin: var(--space-md) 0 var(--space-sm);
}

.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--card-color-1, var(--accent-indigo)), var(--card-color-2, var(--accent-purple)));
  transition: width 0.8s var(--ease-out);
}

.overview__card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.overview__card-pct {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.overview__card-count {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* --- Animations --- */
@keyframes fadeSlideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 12px var(--theme-glow); }
  50% { box-shadow: 0 0 24px var(--theme-glow); }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  #app {
    padding: 0 var(--space-md);
  }

  .header {
    padding: var(--space-md) 0;
  }

  .header__badge {
    display: none;
  }

  .switcher {
    margin: var(--space-md) 0;
    gap: 2px;
    padding: 3px;
  }

  .switcher__btn {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.75rem;
    gap: 4px;
  }

  .switcher__icon {
    font-size: 0.95rem;
  }

  .switcher__label {
    display: none;
  }

  .roadmap__hero-title {
    font-size: 1.5rem;
  }

  .roadmap__stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .phase__header {
    flex-wrap: wrap;
  }

  .phase__timeline {
    margin-left: 0;
    margin-top: var(--space-xs);
    order: 3;
    width: fit-content;
  }

  .milestone {
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md);
  }

  .milestone__status {
    flex-direction: row;
  }

  .milestone__line {
    width: auto;
    height: 2px;
    min-height: 0;
    min-width: 20px;
    flex: 1;
  }

  .milestone__meta {
    flex-direction: row;
    align-items: center;
  }

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

@media (max-width: 375px) {
  .switcher__btn {
    padding: var(--space-sm) var(--space-xs);
    font-size: 0.7rem;
  }

  .stat-card {
    padding: var(--space-md);
  }

  .stat-card__value {
    font-size: 1.4rem;
  }
}

/* --- Theme Variations --- */
[data-theme="vibe-coding"] {
  --theme-primary: #6366f1;
  --theme-secondary: #a78bfa;
  --theme-glow: rgba(99, 102, 241, 0.15);
}

[data-theme="production"] {
  --theme-primary: #f97316;
  --theme-secondary: #fbbf24;
  --theme-glow: rgba(249, 115, 22, 0.15);
}

[data-theme="sales"] {
  --theme-primary: #10b981;
  --theme-secondary: #22d3ee;
  --theme-glow: rgba(16, 185, 129, 0.15);
}

[data-theme="productivity"] {
  --theme-primary: #ec4899;
  --theme-secondary: #f472b6;
  --theme-glow: rgba(236, 72, 153, 0.15);
}

/* Smooth transitions on theme switch */
.roadmap--transitioning {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.roadmap--visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s var(--ease-out) 0.05s, transform 0.4s var(--ease-out) 0.05s;
}

/* =============================================
   Enhanced UI — Progress, Editing, Controls
   ============================================= */

/* --- Reset Button --- */
.header__reset-btn {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--accent-rose);
  background: rgba(251, 113, 133, 0.08);
  border: 1px solid rgba(251, 113, 133, 0.2);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.header__reset-btn:hover {
  background: rgba(251, 113, 133, 0.15);
  transform: scale(1.05);
}

/* --- Progress Hero (Ring + Stats) --- */
.progress-hero {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
  padding: var(--space-xl) var(--space-2xl);
  margin: var(--space-xl) 0;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
}

.progress-ring-wrap {
  position: relative;
  flex-shrink: 0;
}
.progress-ring-wrap svg { display: block; }

.progress-ring__bg {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 8;
}
.progress-ring__fill {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 8;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 1s var(--ease-out);
}
.progress-ring__text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.progress-ring__pct {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.progress-ring__label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
}

.progress-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xl);
  flex: 1;
}
.progress-hero-stat { display: flex; flex-direction: column; gap: 2px; }
.progress-hero-stat__value {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.progress-hero-stat__value--done { color: var(--accent-emerald); }
.progress-hero-stat__value--active { color: var(--accent-indigo-light); }
.progress-hero-stat__value--upcoming { color: var(--text-muted); }
.progress-hero-stat__label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- Phase Progress Bar --- */
.phase-progress {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding: 0 calc(36px + var(--space-md));
}
.phase-progress__bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.phase-progress__fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--theme-primary), var(--theme-secondary));
  transition: width 0.6s var(--ease-out);
  position: relative;
}
.phase-progress__text {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

/* --- Editable Milestones --- */
.milestone--editable { cursor: pointer; }
.milestone--editable:hover { border-color: var(--theme-primary); }

.milestone__name[contenteditable="true"],
.milestone__desc[contenteditable="true"] {
  outline: none;
  border-bottom: 1px dashed var(--theme-primary);
  padding-bottom: 2px;
  caret-color: var(--theme-primary);
}
.milestone__name[contenteditable="true"]:focus,
.milestone__desc[contenteditable="true"]:focus {
  border-bottom-color: var(--theme-secondary);
  background: rgba(99, 102, 241, 0.05);
  border-radius: 4px;
  padding: 2px 4px;
}

.phase__title[contenteditable="true"],
.phase__timeline[contenteditable="true"] {
  outline: none;
  border-bottom: 1px dashed var(--theme-primary);
  padding-bottom: 2px;
  caret-color: var(--theme-primary);
  display: inline-block;
}
.phase__title[contenteditable="true"]:focus,
.phase__timeline[contenteditable="true"]:focus {
  border-bottom-color: var(--theme-secondary);
  background: rgba(99, 102, 241, 0.05);
  border-radius: 4px;
  padding: 2px 4px;
}


/* --- Status Dropdown --- */
.status-toggle { position: relative; cursor: pointer; user-select: none; }
.status-toggle:hover .milestone__badge { transform: scale(1.08); filter: brightness(1.2); }

.status-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 4px;
  min-width: 140px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all 0.15s var(--ease-out);
}
.status-menu.open { opacity: 1; pointer-events: auto; transform: translateY(0); }

.status-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.1s;
}
.status-menu__item:hover { background: var(--bg-glass); color: var(--text-primary); }

.status-menu__dot { width: 8px; height: 8px; border-radius: 50%; }
.status-menu__dot--done { background: var(--accent-emerald); }
.status-menu__dot--active { background: var(--accent-indigo-light); }
.status-menu__dot--upcoming { background: var(--text-muted); }

/* --- Add / Delete Milestone --- */
.add-milestone-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md);
  background: transparent;
  border: 2px dashed var(--border-card);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.add-milestone-btn:hover {
  border-color: var(--theme-primary);
  color: var(--theme-primary);
  background: var(--theme-glow);
  transform: translateY(-1px);
}

.milestone__delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(251, 113, 133, 0.1);
  color: var(--accent-rose);
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s var(--ease-out);
  z-index: 10;
}
.milestone:hover .milestone__delete { opacity: 1; }
.milestone__delete:hover { background: rgba(251, 113, 133, 0.25); transform: scale(1.15); }

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-emerald);
  border-radius: var(--radius-md);
  color: var(--accent-emerald);
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s var(--ease-out);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* --- Responsive additions --- */
@media (max-width: 768px) {
  .progress-hero {
    flex-direction: column;
    padding: var(--space-lg);
    gap: var(--space-lg);
    text-align: center;
  }
  .progress-hero-stats { justify-content: center; }
  .phase-progress { padding: 0; }
}

/* =============================================
   Auth — Login Modal & Buttons
   ============================================= */
.header__login-btn {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-glass);
  border: 1px solid var(--border-card);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.header__login-btn:hover {
  color: var(--text-primary);
  border-color: var(--theme-primary);
  background: var(--theme-glow);
}

.header__logout-btn {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-emerald);
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--duration-fast) var(--ease-out);
}
.header__logout-btn:hover {
  background: rgba(52, 211, 153, 0.15);
}

.header__user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
  animation: pulse 2s ease-in-out infinite;
}

/* Login Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}
.login-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.login-modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: var(--space-2xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s var(--ease-spring);
}
.login-overlay.open .login-modal {
  transform: translateY(0) scale(1);
}

.login-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  background: var(--bg-glass);
  color: var(--text-muted);
  border-radius: 50%;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.login-modal__close:hover {
  background: rgba(251, 113, 133, 0.15);
  color: var(--accent-rose);
}

.login-modal__icon { font-size: 2.5rem; margin-bottom: var(--space-md); }
.login-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}
.login-modal__subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
}

.login-field {
  text-align: left;
  margin-bottom: var(--space-md);
}
.login-field__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}
.login-field__input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
.login-field__input:focus {
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 3px var(--theme-glow);
}
.login-field__input::placeholder { color: var(--text-muted); }

.login-error {
  font-size: 0.75rem;
  color: var(--accent-rose);
  min-height: 20px;
  margin-bottom: var(--space-sm);
}

.login-modal__submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.login-modal__submit:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

/* --- Footer --- */
.site-footer {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xl) 0;
  margin-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}
.site-footer__text {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.site-footer__login {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.4;
  transition: opacity 0.2s;
}
.site-footer__login:hover {
  opacity: 0.8;
}

/* --- Sub-project Picker --- */
.project-picker {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm);
  margin-bottom: var(--space-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.project-picker::-webkit-scrollbar { display: none; }

.project-pill {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}
.project-pill:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
  border-color: var(--border-card);
}
.project-pill.active {
  background: var(--theme-glow);
  color: var(--text-primary);
  border-color: var(--theme-primary);
  box-shadow: 0 0 16px var(--theme-glow);
}
.project-pill__icon { font-size: 1rem; }
.project-pill__info { display: flex; flex-direction: column; gap: 1px; text-align: left; }
.project-pill__name { font-weight: 600; font-size: 0.8rem; }
.project-pill__url {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

@media (max-width: 768px) {
  .project-picker { gap: 4px; padding: 4px; }
  .project-pill { padding: 8px 12px; font-size: 0.75rem; }
  .project-pill__url { display: none; }
}

/* =============================================
   History Log
   ============================================= */
.history-log {
  position: relative;
  z-index: 5;
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--border-subtle);
  margin-bottom: var(--space-3xl);
}

.history-log__title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.history-log__container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-height: 400px;
  overflow-y: auto;
  padding-right: var(--space-sm);
}

.history-log__container::-webkit-scrollbar {
  width: 6px;
}
.history-log__container::-webkit-scrollbar-track {
  background: var(--bg-glass);
  border-radius: var(--radius-full);
}
.history-log__container::-webkit-scrollbar-thumb {
  background: var(--border-card);
  border-radius: var(--radius-full);
}

.history-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  transition: all var(--duration-fast) var(--ease-out);
}

.history-item:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateX(4px);
  box-shadow: var(--shadow-glow);
}

.history-item__time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 2px;
}

.history-item__content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item__action {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.history-item__details {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.history-item__meta {
  display: flex;
  gap: var(--space-sm);
  margin-top: 4px;
}

.history-item__tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--theme-primary);
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .history-item {
    flex-direction: column;
    gap: var(--space-sm);
  }
  .history-item__time {
    font-size: 0.7rem;
    padding-top: 0;
  }
}
