/* ═══════════════════════════════════════════════════════════
   SalesNav Intelligence Pipeline
   Clean SaaS Dashboard — BoostPro-inspired aesthetic
   White space · Bold typography · Soft floating cards
   ═══════════════════════════════════════════════════════════ */

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

/* ─── Light Theme (default) ────────────────────────────────── */
:root {
  --bg:             #ffffff;
  --bg-page:        #f8f9fc;
  --bg-subtle:      #f3f5f9;
  --surface:        #ffffff;
  --surface-hover:  #fafbff;

  --border:         #e8ecf4;
  --border-light:   #f0f2f7;
  --border-hover:   #d0d7e5;
  --border-focus:   #4f46e5;

  --text-primary:   #1a1a2e;
  --text-secondary: #5c6370;
  --text-tertiary:  #9ca3b0;
  --text-inverse:   #ffffff;

  --primary:        #4f46e5;
  --primary-hover:  #4338ca;
  --primary-light:  #eef2ff;
  --primary-subtle: #c7d2fe;
  --primary-glow:   rgba(79,70,229,0.12);

  --green:          #22c55e;
  --green-light:    #f0fdf4;
  --green-border:   #bbf7d0;
  --amber:          #f59e0b;
  --amber-light:    #fffbeb;
  --amber-border:   #fde68a;
  --red:            #ef4444;
  --red-light:      #fef2f2;
  --red-border:     #fecaca;
  --purple:         #8b5cf6;
  --purple-light:   #f5f3ff;
  --orange:         #f97316;

  --radius:         16px;
  --radius-sm:      12px;
  --radius-xs:      8px;
  --radius-pill:    999px;

  --shadow-xs:      0 1px 2px rgba(0,0,0,0.03);
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow:         0 4px 12px rgba(0,0,0,0.05), 0 1px 4px rgba(0,0,0,0.03);
  --shadow-md:      0 8px 24px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-lg:      0 16px 48px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-float:   0 20px 60px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);

  --font:           'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display:   'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-mono:      'JetBrains Mono', 'Fira Code', monospace;
  --ease:           0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce:    0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  --topbar-h:       64px;
  --rail-w:         264px;
}

/* ─── Dark Theme ───────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:             #0f1118;
  --bg-page:        #0f1118;
  --bg-subtle:      #1a1d28;
  --surface:        #181b27;
  --surface-hover:  #1f2335;

  --border:         #272c3a;
  --border-light:   #1f2330;
  --border-hover:   #353b4e;
  --border-focus:   #6366f1;

  --text-primary:   #eaecf2;
  --text-secondary: #8b92a5;
  --text-tertiary:  #5a6175;
  --text-inverse:   #0f1118;

  --primary-light:  rgba(79,70,229,0.1);
  --primary-subtle: rgba(79,70,229,0.2);
  --primary-glow:   rgba(79,70,229,0.15);

  --shadow-xs:      0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.25);
  --shadow:         0 4px 12px rgba(0,0,0,0.3);
  --shadow-md:      0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg:      0 16px 48px rgba(0,0,0,0.4);
  --shadow-float:   0 20px 60px rgba(0,0,0,0.45);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--ease), color var(--ease);
}

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ═══════════════════════════════════════════════════════════
   TOP BAR — Clean, minimal, white
   ═══════════════════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 200;
  transition: background var(--ease), border-color var(--ease);
}

.topbar-left { display: flex; align-items: center; }
.topbar-right { display: flex; align-items: center; gap: 0.85rem; }

.brand { display: flex; align-items: center; gap: 0.35rem; }
.brand-icon { display: none; }
.brand-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.brand-badge {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--primary-subtle);
  margin-left: 0.5rem;
}

/* Live status pill */
.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  transition: all var(--ease);
}
.live-chip.running {
  color: var(--green);
  border-color: var(--green-border);
  background: var(--green-light);
}
[data-theme="dark"] .live-chip.running {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.25);
}
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}
.live-chip.running .live-dot {
  background: var(--green);
  animation: livePulse 1.6s infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Theme toggle */
.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: all var(--ease);
}
.icon-btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-subtle);
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT — Rail + Content
   ═══════════════════════════════════════════════════════════ */
.main-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--topbar-h));
}

/* ─── Step Rail ────────────────────────────────────────────── */
.step-rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 1.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  transition: background var(--ease), border-color var(--ease);
}

.rail-step {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  transition: all var(--ease);
  position: relative;
}
.rail-step:hover:not(.locked):not(.active) { background: var(--bg-subtle); }
.rail-step.locked { opacity: 0.35; cursor: not-allowed; }
.rail-step.active {
  background: var(--primary-light);
  border-color: var(--primary-subtle);
}
[data-theme="dark"] .rail-step.active {
  background: rgba(79,70,229,0.08);
  border-color: rgba(79,70,229,0.18);
}

.rail-num {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: all var(--ease);
  background: var(--bg);
}
.rail-step.active .rail-num {
  border-color: var(--primary);
  color: var(--text-inverse);
  background: var(--primary);
}
.rail-step.done .rail-num {
  border-color: var(--green);
  background: var(--green);
  color: white;
}
.check-mark { font-size: 0.82rem; line-height: 1; }

.rail-info { display: flex; flex-direction: column; gap: 0.05rem; min-width: 0; }
.rail-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}
.rail-desc {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-step.active .rail-label { color: var(--primary); }

/* Connector lines */
.rail-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: calc(0.75rem + 14px);
  top: calc(0.7rem + 30px + 3px);
  width: 2px;
  height: calc(100% - 30px + 0.2rem - 6px);
  background: var(--border);
  transition: background var(--ease);
}
.rail-step.done:not(:last-child)::after { background: var(--green); }

/* ─── Content Area ─────────────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 2.5rem 3rem 5rem;
  max-width: 880px;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════
   STEP HEADER — Big bold display text
   ═══════════════════════════════════════════════════════════ */
.step-header { margin-bottom: 2rem; }

.step-num {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.22rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--primary-subtle);
  margin-bottom: 0.85rem;
}
[data-theme="dark"] .step-num {
  background: rgba(79,70,229,0.1);
  border-color: rgba(79,70,229,0.22);
}

.step-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.45rem;
}

.step-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 52ch;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════
   PANEL CARD — Floating white cards with soft shadow
   ═══════════════════════════════════════════════════════════ */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  transition: all var(--ease);
  overflow: hidden;
}
.panel-card:hover { box-shadow: var(--shadow-md); }

.card-inner { padding: 2rem; }

.card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1.5rem;
  max-width: 55ch;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light);
}

.center-content { text-align: center; }
.center-content .card-desc { margin-left: auto; margin-right: auto; }
.center-content .card-actions { justify-content: center; }

/* ═══════════════════════════════════════════════════════════
   FORMS — Clean, spacious
   ═══════════════════════════════════════════════════════════ */
.form-stack { display: flex; flex-direction: column; gap: 1.1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.form-input {
  padding: 0.65rem 1rem;
  background: var(--bg-page);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.88rem;
  outline: none;
  transition: all var(--ease);
  appearance: none;
  width: 100%;
}
.form-input:focus {
  border-color: var(--primary);
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input::placeholder { color: var(--text-tertiary); }

select.form-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3b0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-textarea {
  resize: vertical;
  min-height: 110px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }

.filter-section-title {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.generated-url-panel {
  margin-top: 1.2rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}

.generated-url-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}

.generated-url-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.generated-url-input {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

@media (max-width: 640px) {
  .generated-url-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS — Pill-shaped, bold
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-lg {
  padding: 0.75rem 1.85rem;
  font-size: 0.88rem;
}
.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(79,70,229,0.25);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px rgba(79,70,229,0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--green);
  color: white;
  border-color: var(--green);
  box-shadow: 0 4px 14px rgba(34,197,94,0.2);
}
.btn-success:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }

.btn-outline {
  background: var(--bg);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: none;
  color: var(--text-secondary);
  border: none;
  padding: 0.5rem 0.9rem;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ═══════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════ */
.alert {
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.5;
  animation: fadeUp 0.3s var(--ease);
}
.alert-error {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.alert-success {
  background: var(--green-light);
  color: #15803d;
  border: 1px solid var(--green-border);
}
.alert-info {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-subtle);
}

/* ═══════════════════════════════════════════════════════════
   SECURITY NOTE
   ═══════════════════════════════════════════════════════════ */
.security-note {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 1rem 1.25rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 1.25rem;
}
.security-note strong { color: var(--text-primary); }

/* ═══════════════════════════════════════════════════════════
   PROMPT SELECTOR — Two big clickable cards
   ═══════════════════════════════════════════════════════════ */
.prompt-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.prompt-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.75rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--ease);
  text-align: center;
}
.prompt-option:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.prompt-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
[data-theme="dark"] .prompt-option.selected {
  background: rgba(79,70,229,0.06);
}
.prompt-option-icon { font-size: 2rem; }
.prompt-option-label {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
}
.prompt-option-desc { font-size: 0.72rem; color: var(--text-tertiary); line-height: 1.45; }

@media (max-width: 540px) { .prompt-selector { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════════════════════════
   STATS ROW — Clean number cards with colored top accent
   ═══════════════════════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.15rem 1.1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: all var(--ease);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-blue::before   { background: var(--primary); }
.stat-green::before  { background: var(--green); }
.stat-amber::before  { background: var(--amber); }
.stat-red::before    { background: var(--red); }
.stat-purple::before { background: var(--purple); }

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }

.stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--text-primary);
  line-height: 1.1;
}

/* ═══════════════════════════════════════════════════════════
   PROGRESS BAR — Gradient fill with shimmer
   ═══════════════════════════════════════════════════════════ */
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
}
.progress-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.progress-pct {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--primary);
}

.progress-track {
  height: 10px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 2rem;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #818cf8, var(--purple));
  border-radius: var(--radius-pill);
  transition: width 0.8s ease;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2.5s infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ═══════════════════════════════════════════════════════════
   PHASE STEPPER — Colorful circles with connectors
   ═══════════════════════════════════════════════════════════ */
.phase-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.phase-step { display: flex; align-items: center; flex: 1; }
.phase-step:last-child { flex: 0; }

.phase-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  z-index: 1;
}
.phase-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}
.phase-icon {
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.phase-short {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(4px);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.phase-circle:hover .phase-icon {
  opacity: 0;
  transform: translateY(-4px);
}
.phase-circle:hover .phase-short {
  opacity: 1;
  transform: translateY(0);
}
.phase-label {
  font-size: 0.52rem;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.phase-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 -2px;
  margin-bottom: 1.3rem;
  transition: background 0.4s ease;
}

.phase-step.completed .phase-circle { background: var(--green); border-color: var(--green); color: white; }
.phase-step.completed .phase-label { color: var(--green); }
.phase-step.completed .phase-connector { background: var(--green); }

.phase-step.active .phase-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 0 5px var(--primary-glow);
  animation: ringPulse 2s infinite;
}
.phase-step.active .phase-label { color: var(--primary); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════
   MULTI SELECT DROPDOWN
   ═══════════════════════════════════════════════════════════ */
.multi-select-container { position: relative; width: 100%; }
.multi-select-display {
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
  min-height: 42px; cursor: pointer; padding: 0.4rem 1rem;
}
.multi-select-chip {
  background: var(--primary); color: white;
  padding: 0.15rem 0.6rem; border-radius: var(--radius-pill);
  font-size: 0.75rem; display: flex; align-items: center; gap: 0.4rem;
  font-weight: 500;
}
.multi-select-chip-close {
  cursor: pointer; font-weight: bold; opacity: 0.8; transition: opacity var(--ease);
}
.multi-select-chip-close:hover { opacity: 1; }
.multi-select-menu {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-top: 0.35rem;
  max-height: 240px; overflow-y: auto; z-index: 100;
  box-shadow: var(--shadow-md); padding: 0.35rem;
}
.multi-select-option {
  padding: 0.5rem 0.75rem; cursor: pointer; display: flex; align-items: center; gap: 0.6rem;
  border-radius: var(--radius-xs); font-size: 0.82rem; transition: background var(--ease);
  color: var(--text-primary);
}
.multi-select-option:hover { background: var(--bg-subtle); }
.multi-select-option.selected { background: var(--primary-light); color: var(--primary); font-weight: 600; }
[data-theme="dark"] .multi-select-option.selected { background: rgba(79,70,229,0.1); }
.multi-select-option input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; }

@keyframes ringPulse {
  0%, 100% { box-shadow: 0 0 0 5px var(--primary-glow); }
  50%      { box-shadow: 0 0 0 10px rgba(79,70,229,0.05); }
}

/* ═══════════════════════════════════════════════════════════
   QUOTA RING — Donut chart style (like BoostPro projects ring)
   ═══════════════════════════════════════════════════════════ */
.quota-layout { display: flex; align-items: center; gap: 1.75rem; }

.quota-ring-wrapper {
  position: relative;
  width: 110px; height: 110px;
  flex-shrink: 0;
}
.quota-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.quota-ring-bg { fill: none; stroke: var(--bg-subtle); stroke-width: 10; }
.quota-ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}
.quota-ring-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.quota-ring-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-primary);
  line-height: 1;
}
.quota-ring-label {
  display: block;
  font-size: 0.58rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.2rem;
}

.quota-details { flex: 1; }
.quota-details h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}
.quota-row {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.82rem;
}
.quota-row span:first-child { color: var(--text-secondary); }
.quota-row span:last-child {
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════
   LIVE LOG — Clean event feed
   ═══════════════════════════════════════════════════════════ */
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.log-header h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-primary);
}

.event-feed {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.event-feed::-webkit-scrollbar { width: 3px; }
.event-feed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.event-empty {
  text-align: center;
  padding: 2.5rem 0;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}
.event-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-light);
  animation: eventSlide 0.25s ease;
}
.event-item:last-child { border-bottom: none; }

@keyframes eventSlide {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.event-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
}
.event-dot.info  { background: var(--primary); }
.event-dot.warn  { background: var(--amber); }
.event-dot.error { background: var(--red); }

.event-body { flex: 1; min-width: 0; }
.event-msg { font-size: 0.78rem; color: var(--text-primary); line-height: 1.5; word-break: break-word; }
.event-time { font-size: 0.62rem; color: var(--text-tertiary); font-family: var(--font-mono); margin-top: 0.1rem; }

/* ═══════════════════════════════════════════════════════════
   OUTPUT / DOWNLOAD
   ═══════════════════════════════════════════════════════════ */
.output-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.85rem;
  margin: 0 auto 1.35rem;
}
.output-blue {
  background: var(--primary-light);
  border: 2px solid var(--primary-subtle);
}
.output-green {
  background: var(--green-light);
  border: 2px solid var(--green-border);
}
[data-theme="dark"] .output-blue {
  background: rgba(79,70,229,0.08);
  border-color: rgba(79,70,229,0.2);
}
[data-theme="dark"] .output-green {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.2);
}
.output-gold {
  background: var(--amber-light);
  border: 2px solid var(--amber-border);
}
[data-theme="dark"] .output-gold {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
}
.gold-border {
  border: 2.5px solid var(--amber) !important;
}
.text-gold {
  color: var(--amber) !important;
}

.dl-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1.65rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--ease);
}
.dl-btn:hover:not(.disabled) {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.dl-btn.disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.dl-btn-icon { font-size: 1.1rem; }

/* ═══════════════════════════════════════════════════════════
   SPINNER
   ═══════════════════════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
.btn-ghost .spinner,
.progress-header .spinner {
  border-color: rgba(79,70,229,0.15);
  border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS — Slide in from right
   ═══════════════════════════════════════════════════════════ */
.toast-stack {
  position: fixed;
  top: calc(var(--topbar-h) + 1.25rem);
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-float);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 400px;
  pointer-events: auto;
  animation: toastIn 0.45s var(--ease-bounce), toastOut 0.3s ease 4.5s forwards;
}
.toast-icon { font-size: 1rem; flex-shrink: 0; }

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

.error-pre {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--text-primary);
  white-space: pre-wrap;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.toast-success { border-left: 4px solid var(--green); }
.toast-error   { border-left: 4px solid var(--red); }
.toast-warn    { border-left: 4px solid var(--amber); }
.toast-info    { border-left: 4px solid var(--primary); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(50px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(30px); }
}

/* ═══════════════════════════════════════════════════════════
   MODAL — Centered with backdrop blur
   ═══════════════════════════════════════════════════════════ */
.modal-backdrop {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  z-index: 600;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-float);
  padding: 2.25rem;
  width: 100%;
  max-width: 420px;
  animation: modalPop 0.4s var(--ease-bounce);
}
.scoring-modal-box {
  max-width: 680px;
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.9) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-box h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}
.modal-box p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.15rem;
  line-height: 1.6;
}
.modal-box .form-input { margin-bottom: 0.85rem; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.15rem;
}

/* ═══════════════════════════════════════════════════════════
   GRID HELPERS
   ═══════════════════════════════════════════════════════════ */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.step-panel { animation: fadeUp 0.45s var(--ease) both; }
.fade-in    { animation: fadeUp 0.45s var(--ease) both; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .main-layout { flex-direction: column; }

  .step-rail {
    width: 100%;
    position: relative;
    top: 0;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0.15rem;
    padding: 0.65rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .rail-step {
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 72px;
    padding: 0.45rem;
    gap: 0.3rem;
  }
  .rail-step:not(:last-child)::after { display: none; }
  .rail-desc { display: none; }
  .rail-label { font-size: 0.6rem; }

  .content-area { padding: 1.5rem 1.15rem 3rem; }
  .topbar { padding: 0 1.15rem; }
  .brand-badge { display: none; }
}

@media (max-width: 480px) {
  .step-title { font-size: 1.5rem; }
  .card-inner { padding: 1.35rem; }
  .phase-stepper { overflow-x: auto; padding-bottom: 0.5rem; }
  .prompt-selector { grid-template-columns: 1fr; }
}
