/* ===========================================
   Theme Lab — Guided Wizard Flow
   Cluster → Creator → Goal → Themes → Predict
   =========================================== */

/* ── Page ── */
.lab-page {
  padding: 32px 28px 80px;
  position: relative;
}

/* ── Single-Column Flow ── */
.lab-flow {
  max-width: 720px;
  margin: 0 auto;
}

/* ── Pre-populated Banner ── */
.lab-prepop-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(155, 138, 245, 0.06);
  border: 1px solid rgba(155, 138, 245, 0.15);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.lab-prepop-banner strong {
  color: var(--text-primary);
}

.lab-prepop-clear {
  margin-left: auto;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  padding: 0 4px;
  transition: color var(--transition-fast);
}

.lab-prepop-clear:hover {
  color: var(--text-primary);
}

/* ── Header (simplified) ── */
.lab-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.lab-header svg {
  flex-shrink: 0;
}

.lab-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.3px;
}

.lab-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Steps ── */
.lab-step {
  margin-bottom: 24px;
}

.lab-step-marker {
  display: none;
}

/* ── Form Controls ── */
.lab-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.lab-count {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

.lab-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.lab-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155, 138, 245, .08);
}

.lab-search {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 10px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.lab-search::placeholder {
  color: var(--text-muted);
  font-size: 12px;
}

.lab-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155, 138, 245, .08);
}

/* ── Theme Grid (search results) ── */
.lab-theme-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding: 2px;
  scroll-behavior: smooth;
}

.lab-theme-grid::-webkit-scrollbar { width: 4px; }
.lab-theme-grid::-webkit-scrollbar-track { background: transparent; }
.lab-theme-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ── Theme Chips (simplified) ── */
.lab-theme-chip {
  padding: 7px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lab-theme-chip .chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  line-height: 1.4;
}

.lab-theme-chip .chip-arate {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--sweet);
  opacity: .7;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 1px 5px;
  background: rgba(34, 197, 94, .06);
  border-radius: 3px;
}

.lab-theme-chip:hover {
  border-color: rgba(155, 138, 245, .3);
  color: var(--text-primary);
  background: rgba(155, 138, 245, .04);
}

.lab-theme-chip.active {
  background: rgba(155, 138, 245, .1);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.lab-theme-chip.active .chip-arate {
  color: var(--accent);
  opacity: 1;
  background: rgba(155, 138, 245, .08);
}

.lab-theme-chip.dimmed {
  opacity: .45;
}

.lab-theme-chip.disabled {
  opacity: .3;
  pointer-events: auto;
  cursor: not-allowed;
}

/* ── Recommendation Sections ── */
.lab-rec-section {
  margin-bottom: 14px;
}

.lab-rec-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lab-rec-label::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .5;
}

.lab-rec-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 2px;
}

.lab-rec-grid::-webkit-scrollbar { width: 4px; }
.lab-rec-grid::-webkit-scrollbar-track { background: transparent; }
.lab-rec-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ── Collapsible "Popular Across Niche" ── */
.lab-rec-collapsible {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.lab-rec-collapsible-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
  transition: color var(--transition-fast);
}

.lab-rec-collapsible-header:hover {
  color: var(--text-secondary);
}

.lab-rec-collapsible-icon {
  font-size: 8px;
  transition: transform var(--transition-fast);
  display: inline-block;
}

.lab-rec-collapsible.open .lab-rec-collapsible-icon {
  transform: rotate(90deg);
}

.lab-rec-collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, opacity .2s ease;
  opacity: 0;
}

.lab-rec-collapsible.open .lab-rec-collapsible-body {
  max-height: 300px;
  opacity: 1;
  margin-top: 8px;
}

/* ── Initial Theme Hint ── */
.lab-theme-hint {
  font-size: 13px;
  color: var(--text-muted);
  padding: 16px 0 8px;
}

/* ── Search Section ── */
.lab-search-section {
  margin-top: 12px;
}

/* ── Selected Recipe Bar ── */
.lab-selected {
  margin-bottom: 16px;
  min-height: 6px;
}

.lab-recipe-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(155, 138, 245, .03);
  border: 1px dashed rgba(155, 138, 245, .12);
  border-radius: 10px;
  animation: lab-reveal .25s ease;
}

.lab-recipe-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-right: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.lab-sel-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(155, 138, 245, .08);
  border: 1px solid rgba(155, 138, 245, .18);
  border-radius: 5px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  animation: lab-pill-in .2s ease;
}

@keyframes lab-pill-in {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}

.lab-sel-x {
  cursor: pointer;
  font-size: 13px;
  opacity: .4;
  transition: opacity var(--transition-fast), color var(--transition-fast);
  font-weight: 700;
  line-height: 1;
}

.lab-sel-x:hover {
  opacity: 1;
  color: var(--miss);
}

.lab-clear-all {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 4px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.lab-clear-all:hover {
  color: var(--miss);
  background: rgba(245, 82, 82, .06);
}

/* ── Run Button (simplified, no shimmer/pulse) ── */
.lab-run-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent), var(--purple-600));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  margin-bottom: 28px;
}

.lab-run-btn:hover {
  box-shadow: 0 4px 20px rgba(155, 138, 245, .25);
  transform: translateY(-1px);
}

.lab-run-btn:active {
  transform: translateY(0);
}

.lab-run-btn.loading {
  pointer-events: none;
  opacity: .85;
}

.lab-run-icon {
  font-size: 10px;
}

.lab-run-btn.loading .lab-run-icon {
  animation: lab-spin .8s linear infinite;
}

@keyframes lab-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.lab-run-count {
  font-size: 11px;
  opacity: .7;
  font-weight: 500;
}

/* ── Results Area ── */
.lab-results-area {
  min-height: 200px;
}

/* ── Empty State (static beaker + connector dots) ── */
.lab-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  gap: 16px;
  padding: 24px 0;
}

.lab-empty-beaker {
  opacity: .35;
}

.lab-empty-text {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
}

/* Connector dots: (●)───(●)───(○) */
.lab-empty-connector {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 4px;
}

.lab-empty-connector-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.lab-empty-connector-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-elevated);
  transition: all var(--transition-normal);
}

.lab-empty-connector-step.done .lab-empty-connector-dot {
  background: rgba(34, 197, 94, .1);
  border-color: rgba(34, 197, 94, .4);
  color: var(--sweet);
}

.lab-empty-connector-label {
  font-size: 11px;
  color: var(--text-muted);
}

.lab-empty-connector-line {
  width: 48px;
  height: 2px;
  background: var(--border);
  margin-bottom: 20px; /* offset for label alignment */
}

/* ── Error ── */
.lab-error {
  text-align: center;
  color: var(--miss);
  font-size: 13px;
  padding: 14px 16px;
  background: var(--miss-bg);
  border: 1px solid rgba(245, 82, 82, .12);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lab-error-hint {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ── Result Card ── */
.lab-result-card {
  animation: lab-reveal .4s cubic-bezier(.22, .68, 0, 1.1);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

@keyframes lab-reveal {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Grade Display ── */
.lab-grade-display {
  text-align: center;
  margin-bottom: 8px;
}

.lab-grade-ring {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 10px;
}

.lab-grade-ring svg {
  width: 100px;
  height: 100px;
  transform: rotate(-90deg);
}

.lab-grade-ring-bg {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 4;
}

.lab-grade-ring-fill {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  transition: stroke-dashoffset 1.2s cubic-bezier(.22, .68, 0, 1.1);
}

.lab-grade-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 800;
}

.lab-grade-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ── Hero Metric ── */
.lab-hero-metric {
  text-align: center;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

.lab-hero-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
}

/* ── Outcome Section ── */
.lab-outcome-section {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.lab-outcome-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.lab-outcome-visual {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
  margin-bottom: 8px;
  padding: 0 2px;
}

.lab-oc-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.lab-oc-bar-fill {
  width: 100%;
  border-radius: 4px 4px 2px 2px;
  background: var(--bg-elevated);
  transition: height .6s cubic-bezier(.22, .68, 0, 1.1);
  min-height: 4px;
}

.lab-oc-bar.highlight .lab-oc-bar-fill {
  background: linear-gradient(180deg, rgba(155, 138, 245, .25) 0%, rgba(155, 138, 245, .12) 100%);
  border: 1px solid rgba(155, 138, 245, .3);
}

.lab-oc-bar-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.lab-oc-bar.highlight .lab-oc-bar-val {
  color: var(--accent);
}

.lab-oc-bar-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  text-align: center;
  white-space: nowrap;
}

.lab-oc-baseline {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 4px;
}

/* ── Expandable Sections (progressive disclosure) ── */
.lab-expandable {
  border-top: 1px solid var(--border);
}

.lab-expandable + .lab-expandable {
  border-top: none;
}

.lab-expandable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.lab-expandable-header:hover {
  color: var(--text-primary);
}

.lab-expand-icon {
  font-size: 10px;
  transition: transform var(--transition-fast);
  color: var(--text-muted);
}

.lab-expandable.open .lab-expand-icon {
  transform: rotate(90deg);
}

.lab-expandable-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, opacity .2s ease;
  opacity: 0;
}

.lab-expandable.open .lab-expandable-body {
  max-height: 600px;
  opacity: 1;
  padding-bottom: 14px;
}

/* ── Detail Rows (key-value inside expandable) ── */
.lab-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 12px;
}

.lab-detail-row + .lab-detail-row {
  border-top: 1px solid rgba(255, 255, 255, .03);
}

.lab-detail-key {
  color: var(--text-secondary);
  font-weight: 500;
}

.lab-detail-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 12px;
}

/* ── Best-for / Peer Comparison (inside expandable) ── */
.lab-bf-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
}

.lab-bf-row + .lab-bf-row {
  border-top: 1px solid rgba(255, 255, 255, .03);
}

.lab-bf-name {
  flex: 1;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 12px;
}

.lab-bf-typical {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--accent);
  font-size: 12px;
}

.lab-bf-baseline {
  color: var(--text-secondary);
  font-size: 11px;
}

/* ── Predicted Power Metrics ── */
.lab-power-metrics {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 8px;
}

.lab-power-metrics-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: .02em;
}

.lab-power-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.lab-power-row + .lab-power-row {
  border-top: 1px solid rgba(255, 255, 255, .03);
}

.lab-power-label {
  flex: 0 0 130px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.lab-power-stars {
  display: flex;
  gap: 2px;
  flex: 1;
}

.lab-star {
  font-size: 16px;
  line-height: 1;
}

.lab-star.empty {
  color: var(--text-muted);
  opacity: .3;
}

.lab-star.half {
  position: relative;
  overflow: hidden;
}

.lab-star.half::after {
  content: '\2605';
  position: absolute;
  left: 0;
  top: 0;
  width: 50%;
  overflow: hidden;
  color: inherit;
}

.lab-power-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  min-width: 32px;
  text-align: right;
}

/* ── Overlay (preserved) ── */
.lab-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

.lab-overlay.active {
  display: flex;
}

.lab-panel {
  background: var(--bg-surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  max-width: 860px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

.lab-panel-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.lab-panel-close:hover { color: var(--text-primary); }

/* ── Loading State ── */
.lab-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  gap: 16px;
  padding: 40px;
}

.lab-loading-spinner {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(155, 138, 245, .12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: lab-spin .8s linear infinite;
}

.lab-loading-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

.lab-loading-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.lab-loading-error .lab-loading-text {
  color: var(--miss);
}

.lab-retry-btn {
  margin-top: 8px;
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lab-retry-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(155, 138, 245, .25);
}

/* ── Metric Toggle ── */
.lab-metric-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  padding: 3px;
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.lab-metric-btn {
  flex: 1;
  padding: 7px 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.lab-metric-btn:hover {
  color: var(--text-secondary);
}

.lab-metric-btn.active {
  background: rgba(155, 138, 245, .12);
  color: var(--accent);
}

.lab-metric-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 12px;
}

/* ── Auto-Generate Button ── */
.lab-autogen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px;
  background: rgba(34, 197, 94, .05);
  border: 1px dashed rgba(34, 197, 94, .2);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sweet);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 14px;
}

.lab-autogen-btn:hover {
  background: rgba(34, 197, 94, .1);
  border-color: rgba(34, 197, 94, .35);
}

.lab-autogen-btn .lab-autogen-icon {
  font-size: 13px;
}

/* ── Theme Cards (richer recommendation display) ── */
.lab-rec-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.lab-rec-card-grid--scroll {
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.lab-rec-card-grid--scroll::-webkit-scrollbar { width: 4px; }
.lab-rec-card-grid--scroll::-webkit-scrollbar-track { background: transparent; }
.lab-rec-card-grid--scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.lab-theme-chip.lab-theme-card {
  padding: 10px 14px;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.lab-tc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.lab-tc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.lab-tc-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--sweet);
  padding: 1px 5px;
  background: rgba(34, 197, 94, .06);
  border-radius: 3px;
  flex-shrink: 0;
  white-space: nowrap;
}

.lab-theme-chip.lab-theme-card.active .lab-tc-name {
  color: var(--accent);
}

.lab-theme-chip.lab-theme-card.active .lab-tc-badge {
  color: var(--accent);
  background: rgba(155, 138, 245, .08);
}

.lab-tc-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* ── Shake Animation ── */
@keyframes lab-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.lab-theme-chip.shake {
  animation: lab-shake .35s ease;
}

/* ===========================================
   Wizard — Breadcrumb Navigation
   =========================================== */

.lab-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.lab-bc-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.lab-bc-step.clickable {
  cursor: pointer;
}

.lab-bc-step.clickable:hover .lab-bc-label {
  color: var(--accent);
}

.lab-bc-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-elevated);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.lab-bc-step.done .lab-bc-dot {
  background: rgba(34, 197, 94, .1);
  border-color: rgba(34, 197, 94, .4);
  color: var(--sweet);
  font-size: 11px;
}

.lab-bc-step.current .lab-bc-dot {
  background: rgba(155, 138, 245, .1);
  border-color: var(--accent);
  color: var(--accent);
}

.lab-bc-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.lab-bc-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  transition: color var(--transition-fast);
}

.lab-bc-step.current .lab-bc-label {
  color: var(--accent);
}

.lab-bc-step.done .lab-bc-label {
  color: var(--text-secondary);
}

.lab-bc-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.lab-bc-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 10px;
  min-width: 16px;
}

/* ===========================================
   Wizard — Step Intro / Question
   =========================================== */

.lab-step-intro {
  margin-bottom: 20px;
  animation: lab-step-in .35s cubic-bezier(.22, .68, 0, 1.1);
}

@keyframes lab-step-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lab-step-question {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 6px;
}

.lab-step-accent {
  color: var(--accent);
}

.lab-step-hint {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===========================================
   Wizard — Step 1: Cluster Cards
   =========================================== */

.lab-cluster-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  animation: lab-step-in .35s cubic-bezier(.22, .68, 0, 1.1);
}

.lab-cluster-card {
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lab-cluster-card:hover {
  border-color: rgba(155, 138, 245, .35);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}

.lab-cc-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.lab-cc-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.lab-cc-channels {
  font-size: 12px;
  color: var(--text-secondary);
}

.lab-cc-diag {
  font-size: 11px;
  font-weight: 600;
}

.lab-cc-stars {
  margin-top: 4px;
}

/* ===========================================
   Wizard — Step 2: Creator Cards
   =========================================== */

.lab-creator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
  animation: lab-step-in .35s cubic-bezier(.22, .68, 0, 1.1);
}

.lab-creator-grid::-webkit-scrollbar { width: 4px; }
.lab-creator-grid::-webkit-scrollbar-track { background: transparent; }
.lab-creator-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.lab-creator-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lab-creator-card:hover {
  border-color: rgba(155, 138, 245, .35);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

.lab-crc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-elevated);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.lab-crc-body {
  flex: 1;
  min-width: 0;
}

.lab-crc-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.lab-crc-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.lab-crc-diag {
  font-weight: 600;
}

.lab-crc-stars {
  margin-top: 2px;
}

/* ===========================================
   Wizard — Step 3: Goal Cards
   =========================================== */

.lab-goal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  animation: lab-step-in .35s cubic-bezier(.22, .68, 0, 1.1);
}

.lab-goal-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.lab-goal-card {
  padding: 24px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}

.lab-goal-card:hover {
  border-color: rgba(155, 138, 245, .4);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}

.lab-gc-icon {
  font-size: 28px;
  margin-bottom: 10px;
  line-height: 1;
}

.lab-gc-star {
  font-size: 26px;
  margin-bottom: 8px;
  line-height: 1;
  opacity: .8;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.lab-goal-card:hover .lab-gc-star {
  opacity: 1;
  transform: scale(1.15);
}

.lab-gc-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.lab-gc-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.lab-gc-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 4px;
}

.lab-goal-card:hover {
  border-color: var(--goal-color, rgba(155, 138, 245, .4));
}

/* ===========================================
   Wizard — Wizard body animation
   =========================================== */

.lab-wizard-body {
  animation: lab-step-in .3s ease;
}

/* ===========================================
   Brand Mode — Mode Toggle
   =========================================== */

.lab-mode-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  width: fit-content;
}

.lab-mode-btn {
  padding: 7px 20px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lab-mode-btn:hover {
  color: var(--text-secondary);
}

.lab-mode-btn.active {
  background: rgba(155, 138, 245, .12);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
}

/* ===========================================
   Brand Mode — Results Cards
   =========================================== */

.lab-brand-theme-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.lab-brand-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: lab-step-in .35s cubic-bezier(.22, .68, 0, 1.1);
}

.lab-brand-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lab-brand-card:hover {
  border-color: rgba(155, 138, 245, .35);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}

/* Rank badge */
.lab-brand-rank {
  position: absolute;
  top: 14px;
  right: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  opacity: .35;
}

/* Header row: avatar + name */
.lab-brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.lab-brand-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--bg-elevated);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.lab-brand-info {
  flex: 1;
  min-width: 0;
}

.lab-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lab-brand-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.lab-brand-diag {
  font-weight: 600;
}

/* Body: grade ring + stats side by side */
.lab-brand-body {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 14px;
}

/* Grade ring (compact) */
.lab-brand-grade-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.lab-brand-grade-ring {
  position: relative;
  width: 62px;
  height: 62px;
}

.lab-brand-grade-ring svg {
  width: 62px;
  height: 62px;
  transform: rotate(-90deg);
}

.lab-brand-grade-ring .lab-grade-ring-bg {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 3;
}

.lab-brand-grade-ring .lab-grade-ring-fill {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 175.9;
  stroke-dashoffset: 175.9;
  transition: stroke-dashoffset 1.2s cubic-bezier(.22, .68, 0, 1.1);
}

.lab-brand-grade-letter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 800;
}

.lab-brand-grade-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Stats column */
.lab-brand-stats {
  flex: 1;
  min-width: 0;
}

.lab-brand-stars-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.lab-brand-stars-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.lab-brand-stars {
  display: flex;
  gap: 2px;
}

.lab-brand-star {
  font-size: 14px;
}

.lab-brand-star.empty {
  color: var(--text-muted);
  opacity: .3;
}

.lab-brand-star.half {
  opacity: .6;
}

.lab-brand-star-val {
  font-size: 11px;
  font-weight: 600;
  min-width: 26px;
  text-align: right;
}

.lab-brand-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 12px;
}

.lab-brand-stat + .lab-brand-stat {
  border-top: 1px solid rgba(255, 255, 255, .03);
}

.lab-brand-stat-label {
  color: var(--text-secondary);
}

.lab-brand-stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--text-primary);
}

/* Compact P25/P50/P75 bar chart */
.lab-brand-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 50px;
  margin-bottom: 8px;
  padding: 0 2px;
}

.lab-brand-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  height: 100%;
  justify-content: flex-end;
}

.lab-brand-bar-fill {
  width: 100%;
  border-radius: 3px 3px 1px 1px;
  background: var(--bg-elevated);
  min-height: 3px;
}

.lab-brand-bar.highlight .lab-brand-bar-fill {
  background: linear-gradient(180deg, rgba(155, 138, 245, .25) 0%, rgba(155, 138, 245, .12) 100%);
  border: 1px solid rgba(155, 138, 245, .3);
}

.lab-brand-bar-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
}

.lab-brand-bar.highlight .lab-brand-bar-val {
  color: var(--accent);
}

.lab-brand-bar-label {
  font-size: 8px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}

.lab-brand-baseline {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 10px;
}

.lab-brand-cta {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
  opacity: .5;
  transition: opacity var(--transition-fast);
}

.lab-brand-card:hover .lab-brand-cta {
  opacity: 1;
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .lab-flow {
    max-width: 100%;
  }
  .lab-empty-connector-line {
    width: 28px;
  }
  .lab-rec-card-grid {
    grid-template-columns: 1fr;
  }
  .lab-metric-toggle {
    flex-wrap: wrap;
  }
  .lab-creator-grid {
    grid-template-columns: 1fr;
  }
  .lab-goal-grid,
  .lab-goal-grid--3 {
    grid-template-columns: 1fr;
  }
  .lab-bc-value {
    max-width: 80px;
  }
  .lab-breadcrumb {
    padding: 10px 12px;
  }
  .lab-brand-body {
    flex-direction: column;
    gap: 12px;
  }
}
