/* ============================================================
   Funnel Creator — list-view admin for multi-page quiz funnels
   Loaded only from admin/index.html. Hidden until mode-funnel is active.
   Uses existing color variables (--color-navy-950, --color-gold-400, etc.)
   from admin.css. No Tailwind rebuild needed.
   ============================================================ */

/* Mode visibility: hide the single-page form & tab bar when in funnel mode,
   and vice-versa. The mode switcher itself stays visible in both. */
body.mode-funnel #tab-bar,
body.mode-funnel #config-form,
body.mode-funnel #compliance-banner,
body.mode-funnel #success-banner { display: none !important; }
body:not(.mode-funnel) #funnel-tab { display: none !important; }
body.mode-funnel #funnel-tab { display: block !important; }
body:not(.mode-funnel) #funnel-tab-bar-v2 { display: none !important; }
body.mode-funnel #funnel-tab-bar-v2 { display: flex !important; }

/* Hide the header's single-page-only action buttons while in funnel mode.
   Funnel mode has its own Save & Build button inside the tab. */
body.mode-funnel #deploy-btn,
body.mode-funnel #demo-god-btn { display: none !important; }
/* Save button + status stay visible — funnel-creator.js intercepts the click
   in funnel mode and routes it to the WIP save endpoint */

/* Mode switcher tab buttons */
.mode-tab {
  padding: 5px 12px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.mode-tab:hover { color: #fff; }
.mode-tab.active {
  background: var(--color-gold-400, #D4A843);
  color: var(--color-navy-950, #0F0D2E);
}

/* ---------- Funnel Tab container ---------- */
/* Take full desktop width — this surface benefits from every pixel since
   paths + steps + (eventually) canvas all live side-by-side. */
.funnel-tab {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 24px 24px 80px;
  color: var(--color-navy-800, #1A1A2E);
}
/* Admin <main> constrains its children; push funnel-tab out of that box */
body.mode-funnel .admin-main {
  max-width: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.funnel-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
}
.funnel-toolbar-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 280px;
  flex: 1 1 280px;
}
.funnel-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.funnel-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-navy-600, #1E2235);
}
.funnel-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border-strong, #D1D5DB);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  color: var(--color-navy-900, #12112A);
}
.funnel-select:focus {
  outline: none;
  border-color: var(--color-gold-400, #D4A843);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.2);
}

.funnel-dirty {
  font-size: 12px;
  font-weight: 600;
  color: #B45309;
}
.funnel-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.funnel-status.draft {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}
.funnel-status.live {
  background: #DCFCE7;
  color: #166534;
  border: 1px solid #BBF7D0;
}
/* Phase 031F P2.5 — draft drifted from the live published snapshot. */
.funnel-unpublished {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  background: #FFEDD5;
  color: #9A3412;
  border: 1px solid #FED7AA;
}
#funnel-save-draft-btn,
#funnel-publish-btn {
  margin-left: 6px;
}
#funnel-save-draft-btn:disabled,
#funnel-publish-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.funnel-ai-toggle {
  background: #F5F3FF;
  border: 1px solid #DDD6FE;
  border-radius: 8px;
  padding: 12px 14px;
}
.funnel-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #4C1D95;
  cursor: pointer;
  margin-bottom: 8px;
}
.funnel-ai-toggle input[type="text"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 12px;
  border: 1px solid #DDD6FE;
  border-radius: 6px;
  background: #fff;
  color: var(--color-navy-800, #1A1A2E);
}
.funnel-select-compact {
  min-width: 130px;
}
.funnel-control-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}
/* Action strip — always visible above the tab bar */
.funnel-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 12px;
}
.funnel-actions-status { display: flex; gap: 10px; align-items: center; }
.funnel-actions-buttons { display: flex; gap: 8px; align-items: center; }
/* Funnel tab bar reuses #tab-bar's styling — no custom rules needed */
.funnel-tab-panels {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 18px;
  margin-bottom: 16px;
}
/* ==========================================================================
   Funnel Design Preview (.fdp-*) — JS simulation of a single quiz step
   Mirrors worker/quiz-build.js QUIZ_CSS at a high level. Vibe palette + brand
   overrides flow in via inline CSS variables on .fdp-page.
   ========================================================================== */
.fdp-wrap { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.fdp-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.fdp-step-nav { display: inline-flex; align-items: center; gap: 8px; }
.fdp-step-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.fdp-step-btn:hover:not(:disabled) { background: #e5e7eb; }
.fdp-step-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.fdp-step-label { font-size: 12px; color: #6b7280; font-weight: 600; min-width: 80px; text-align: center; }
/* Active-path pill (between step nav and device toggle) */
.fdp-path-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.fdp-path-pill[data-kind="main"] { background: #DBEAFE; color: #1E40AF; border-color: #BFDBFE; }
.fdp-path-pill[data-kind="alt"]  { background: #DDD6FE; color: #5B21B6; border-color: #C4B5FD; }
.fdp-path-pill .fdp-path-pill-name { text-transform: none; font-weight: 600; opacity: 0.85; }
/* Unified pill: Desktop/Mobile + share/copy/email — mirrors .tp-toggle in admin.css */
.fdp-toggle {
  display: inline-flex;
  align-items: stretch;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.fdp-toggle-btn {
  padding: 4px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.fdp-toggle-btn.active {
  background: var(--color-navy-700, #1e293b);
  color: #fff;
}
.fdp-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  background: transparent;
  border: none;
  border-left: 1px solid #e2e8f0;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}
.fdp-share-btn:hover { color: var(--color-navy-700, #1e293b); }
.fdp-share-btn.loading {
  opacity: 0.5;
  pointer-events: none;
  animation: fdp-pulse 1s ease-in-out infinite;
}
@keyframes fdp-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* Device frame: a chrome that resizes to mobile or desktop */
.fdp-frame {
  background: #1e293b;
  border-radius: 18px;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 560px;
  position: relative;
}
.fdp-page {
  width: 100%;
  max-width: 720px;
  background: var(--fdp-bg, #F9FAFB);
  border-radius: 12px;
  padding: clamp(20px, 2vw + 12px, 36px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-family: var(--fdp-body-font, system-ui, -apple-system, sans-serif);
  color: var(--fdp-text, #111827);
}
.fdp-frame--mobile .fdp-page { max-width: 380px; padding: 18px; }
.fdp-header { display: flex; align-items: center; gap: 12px; }
.fdp-header--center { flex-direction: column; text-align: center; }
.fdp-header--right { justify-content: flex-end; text-align: right; }
.fdp-header-logo { height: 36px; width: auto; display: block; }
.fdp-header-intro { font-size: 13px; color: #6b7280; margin: 0; max-width: 60ch; }
.fdp-progress {
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.fdp-progress-fill {
  height: 100%;
  background: var(--fdp-accent, #10B981);
  border-radius: 999px;
  transition: width 300ms ease;
}
.fdp-card {
  background: var(--fdp-card, #FFFFFF);
  border-radius: var(--fdp-radius, 16px);
  padding: clamp(16px, 1.5vw + 8px, 28px);
  box-shadow: 0 4px 24px -8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.fdp-card.fdp-card--pill { border-radius: clamp(24px, 4vw, 44px); padding: clamp(20px, 2vw + 12px, 36px); }
.fdp-card.fdp-card--maximal { min-height: 400px; }
.fdp-hero {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #f1f5f9;
}
.fdp-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fdp-question {
  font-family: var(--fdp-question-font, var(--fdp-heading-font, var(--fdp-body-font, system-ui)));
  font-size: var(--fdp-question-size, clamp(18px, 1.2vw + 14px, 28px));
  font-weight: var(--fdp-question-weight, 700);
  margin: 0;
  color: var(--fdp-on-card, var(--fdp-primary, #1A2744));
  letter-spacing: -0.02em;
}
.fdp-subtext {
  font-family: var(--fdp-subheader-font, var(--fdp-body-font, system-ui));
  font-size: var(--fdp-subheader-size, clamp(13px, 0.3vw + 12px, 16px));
  font-weight: var(--fdp-subheader-weight, 400);
  color: var(--fdp-on-card-muted, #6b7280);
  margin: 0;
}
.fdp-options { display: grid; grid-template-columns: 1fr; gap: 12px; }
.fdp-options.fdp-options--2col { grid-template-columns: 1fr 1fr; }
.fdp-frame--mobile .fdp-options.fdp-options--2col { grid-template-columns: 1fr; }
.fdp-option {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px;
  padding: 14px 18px;
  background: var(--fdp-option-bg, var(--fdp-card, #FFFFFF));
  border: 2px solid var(--fdp-option-border, #e5e7eb);
  border-radius: 999px;
  font-family: var(--fdp-answer-font, var(--fdp-body-font, system-ui));
  font-weight: var(--fdp-answer-weight, 700);
  font-size: var(--fdp-answer-size, clamp(14px, 0.3vw + 13px, 17px));
  color: var(--fdp-option-text, #111827);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.fdp-option-bullet {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  flex-shrink: 0;
}
.fdp-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  font-size: 15px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #111827;
}
.fdp-submit {
  width: 100%;
  min-height: 52px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--fdp-primary, #1A2744);
  border: 0;
  border-radius: var(--fdp-radius, 16px);
  cursor: default;
  margin-top: 4px;
}
.fdp-trust {
  display: flex; gap: 14px; justify-content: center;
  font-size: 11px; color: #94a3b8;
}
.fdp-disclaimer { font-size: 11px; color: #94a3b8; text-align: center; margin: 0; }

/* Font-control row inside the Theme tab */
.funnel-font-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.funnel-font-row .funnel-select-compact { min-width: 150px; }
.funnel-input-compact {
  width: 64px;
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #fff;
}

/* Horizontal row layout for tab panels (brand / header / hero) */
.funnel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  width: 100%;
}
.funnel-row-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}
/* Hero thumbnail */
.funnel-hero-thumb {
  width: 160px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  display: block;
}
.funnel-hero-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Logo thumb — different visual rules than hero thumbs because logos are
   rarely 16:9 and crop badly with object-fit: cover. Auto-height + contain
   shows the full logo at a size that reads clearly to the author. */
.funnel-logo-thumb {
  display: inline-block;
  max-width: 200px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.funnel-logo-thumb img {
  display: block;
  max-height: 48px;
  max-width: 100%;
  height: auto;
  width: auto;
  object-fit: contain;
}
/* Layout: visual radio cards */
.funnel-card-style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  max-width: 720px;
}
.funnel-card-style-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease;
}
.funnel-card-style-card:hover { border-color: var(--color-gold-400, #D4A843); }
.funnel-card-style-card.selected {
  border-color: var(--color-gold-400, #D4A843);
  background: #fffbeb;
}
.funnel-card-style-card input[type="radio"] { display: none; }
.fcs-preview {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  height: 180px; /* fixed height so the differences are visible */
  overflow: hidden;
}
.fcs-card-mock {
  background: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  width: 90%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: auto;
  align-self: center;
}
/* Snug = current default — compact card hugging content, modest radius */
.fcs-preview--snug .fcs-card-mock { border-radius: 8px; }
/* Pill = same hugging size, but very rounded corners */
.fcs-preview--pill .fcs-card-mock {
  border-radius: 28px;
  padding: 14px 18px;
}
/* Maximal = card fills nearly the full viewport mock */
.fcs-preview--maximal .fcs-card-mock {
  align-self: stretch;
  height: 100%;
  border-radius: 8px;
  justify-content: flex-start;
}
.fcs-line {
  height: 8px;
  background: #1A2744;
  border-radius: 4px;
  width: 75%;
}
.fcs-line.short { width: 50%; height: 5px; background: #94a3b8; }
.fcs-pill {
  height: 16px;
  background: #e5e7eb;
  border-radius: 999px;
  width: 100%;
}
.fcs-preview--maximal .fcs-pill { margin-top: auto; }
.fcs-meta { display: flex; flex-direction: column; gap: 2px; }
.fcs-meta strong { font-size: 13px; color: var(--color-navy-800, #1A1A2E); }
.fcs-meta span { font-size: 11px; color: #6b7280; }

/* Scroll mode (default): all panels visible, stacked with section labels */
.funnel-tab-panel {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  scroll-margin-top: 120px;
  padding-block: 12px;
}
.funnel-tab-panel + .funnel-tab-panel { border-top: 1px solid #f1f5f9; margin-top: 12px; padding-top: 24px; }
.funnel-tab-panel::before {
  content: attr(data-funnel-panel);
  display: block;
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 4px;
}
/* Tab mode: only the active panel is shown, no labels */
body.tab-mode .funnel-tab-panel { display: none; padding: 0; margin: 0; border-top: none; }
body.tab-mode .funnel-tab-panel.active { display: flex; }
body.tab-mode .funnel-tab-panel::before { display: none; }
/* Content-heavy panels need full-width stacking, not flex-wrap */
#funnel-panel-compliance,
#funnel-panel-everflow,
#funnel-panel-widget,
#funnel-panel-notify,
#funnel-panel-assets,
#funnel-panel-output {
  flex-direction: column;
  gap: 0;
}
/* Compliance — card wrapper matching .form-section */
#funnel-panel-compliance .funnel-section-card,
#funnel-panel-everflow .funnel-section-card,
#funnel-panel-widget .funnel-section-card,
#funnel-panel-notify .funnel-section-card,
#funnel-panel-output .funnel-section-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.funnel-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}
.funnel-section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-gold-50, #fef9ee);
  border-radius: 8px;
  color: var(--color-gold-500, #d4a843);
  flex-shrink: 0;
}
.funnel-section-header h3 {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  color: var(--color-navy-800, #1a1a2e);
  margin: 0;
}
/* Compliance field stacking */
.funnel-form-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.funnel-form-fields .field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.funnel-form-fields label {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-navy-800, #1a1a2e);
}
.funnel-form-fields textarea,
.funnel-form-fields input[type="text"],
.funnel-form-fields input[type="url"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--color-surface, #fff);
  color: var(--color-navy-800, #1a1a2e);
  box-sizing: border-box;
}
.funnel-form-fields textarea:focus,
.funnel-form-fields input:focus {
  border-color: var(--color-gold-400, #d4a843);
  outline: none;
  box-shadow: 0 0 0 2px rgba(212, 168, 67, 0.15);
}
/* Assets panel — use the existing icon-ref-grid / asset-chip styles */
#funnel-panel-assets .funnel-section-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.funnel-control-group > .funnel-palette-indicator,
.funnel-control-group > .funnel-hero-flag {
  align-self: center;
  max-width: 100%;
  text-align: center;
}
.funnel-checkbox-tight {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-navy-600, #6b7280);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  cursor: pointer;
}
.funnel-palette-indicator {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
.funnel-palette-indicator.vibe {
  background: #EEF2FF;
  color: #4338CA;
  border: 1px solid #C7D2FE;
}
.funnel-palette-indicator.custom {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}
.funnel-modal-panel-narrow { max-width: 480px; }
.funnel-modal-help {
  font-size: 12px;
  color: var(--color-navy-600, #6b7280);
  margin: 0 0 16px;
  line-height: 1.5;
}
/* No-op warning for the Vibrant card toggle (Phase 003 follow-up) — fires
   when Primary and Surface resolve to the same hex, since flipping the
   toggle then has no visible effect. */
.brand-noop-warning {
  margin-top: 8px;
  padding: 8px 10px;
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-radius: 6px;
  color: #78350F;
  font-size: 12px;
  line-height: 1.45;
}
.brand-noop-warning[hidden] { display: none; }
.funnel-brand-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.funnel-brand-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  gap: 12px;
}
.funnel-brand-row label {
  font-size: 13px;
  font-weight: 600;
}
.funnel-brand-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.funnel-brand-input-row input[type="color"] {
  width: 36px;
  height: 36px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  background: transparent;
}
.funnel-brand-input-row input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.funnel-brand-cardstyle {
  margin-top: 16px;
  padding: 12px 14px;
  background: #F5F3FF;
  border: 1px solid #DDD6FE;
  border-radius: 8px;
}
.funnel-hero-flag {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
}
.funnel-header-logo-thumb {
  height: 22px;
  width: auto;
  max-width: 80px;
  border-radius: 4px;
  background: #fff;
  padding: 2px;
  border: 1px solid #d1fae5;
}
.funnel-hero-flag.funnel-hero-flag--empty {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #e5e7eb;
  font-style: italic;
}
.funnel-hero-remove {
  background: none;
  border: none;
  color: #065F46;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 999px;
  opacity: 0.7;
}
.funnel-hero-remove:hover { opacity: 1; background: rgba(6, 95, 70, 0.1); }
.funnel-step-image-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
}
.funnel-step-image-thumbs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.fsi-thumb {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.fsi-thumb img {
  display: block;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  overflow: hidden;
}
.fsi-thumb--desktop     { max-width: 220px; }
.fsi-thumb--desktop img { width: 220px; }
.fsi-thumb--mobile      { max-width: 110px; }
.fsi-thumb--mobile  img { width: 110px; aspect-ratio: 4 / 3; }
.fsi-thumb figcaption {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}
.funnel-step-image-actions { display: flex; gap: 8px; }

/* ---------- Shared hero picker modal ----------
   Must sit ABOVE the step editor modal (.funnel-modal at 2000) because the
   Edit Step modal contains a "pick image" button that opens this picker. */
.lgf-hero-picker {
  position: fixed; inset: 0;
  z-index: 2500;
  display: flex; align-items: center; justify-content: center;
}
.lgf-hero-picker.hidden { display: none; }
.lgf-hp-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.6);
}
.lgf-hp-panel {
  position: relative;
  background: #fff;
  border-radius: 12px;
  width: min(960px, 92vw);
  max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.lgf-hp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.lgf-hp-header h3 { margin: 0; font-size: 16px; }
.lgf-hp-vertical { font-weight: 400; color: #6b7280; font-size: 13px; margin-left: 8px; }
.lgf-hp-close {
  background: none; border: none; font-size: 28px;
  cursor: pointer; color: #6b7280; line-height: 1;
}
.lgf-hp-body { padding: 16px 20px; overflow-y: auto; flex: 1; min-height: 0; }
/* Category tab bar */
.lgf-hp-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.lgf-hp-tab {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid transparent;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms;
}
.lgf-hp-tab:hover { background: #e2e8f0; }
.lgf-hp-tab.active {
  background: var(--color-navy-950, #0F0D2E);
  color: #fff;
  border-color: var(--color-navy-950, #0F0D2E);
}
.lgf-hp-tabs:empty { display: none; }
.lgf-hp-tab-loader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
}
.lgf-hp-tab-loader::before {
  content: '';
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  border-top-color: transparent;
  animation: lgf-hp-spin 0.7s linear infinite;
}
.lgf-hp-status {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lgf-hp-status::before {
  content: '';
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: lgf-hp-spin 0.7s linear infinite;
}
.lgf-hp-status.info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.lgf-hp-status.err  { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.lgf-hp-status.err::before { animation: none; border-top-color: currentColor; }
@keyframes lgf-hp-spin { to { transform: rotate(360deg); } }
.lgf-hp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.lgf-hp-card {
  position: relative;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: border-color 150ms ease, transform 150ms ease;
  font: inherit;
}
.lgf-hp-card:hover { border-color: var(--color-gold-400, #D4A843); transform: translateY(-2px); }
.lgf-hp-card.selecting { cursor: wait; }
.lgf-hp-card.selecting > .lgf-hp-thumbs,
.lgf-hp-card.selecting > img,
.lgf-hp-card.selecting > .lgf-hp-card-info { opacity: 0.35; }
.lgf-hp-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(15, 13, 46, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: inherit;
  pointer-events: none;
  backdrop-filter: blur(2px);
}
.lgf-hp-card-overlay .lgf-hp-spin {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  animation: lgf-hp-spin 0.7s linear infinite;
}
/* Desktop + mobile thumbnail pair layout */
.lgf-hp-thumbs {
  display: flex;
  gap: 6px;
  padding: 8px 8px 0;
  align-items: flex-end;
}
.lgf-hp-thumb {
  margin: 0;
}
.lgf-hp-thumb--desktop {
  flex: 1;
  min-width: 0;
}
.lgf-hp-thumb--mobile {
  flex: 0 0 auto;
  width: 60px;
}
.lgf-hp-thumb img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}
.lgf-hp-thumb--mobile img {
  aspect-ratio: 9 / 16;
  height: 80px;
  width: auto;
}
.lgf-hp-thumb figcaption {
  font-size: 10px;
  color: #6b7280;
  text-align: center;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
/* Fallback for cards without .lgf-hp-thumbs (legacy) */
.lgf-hp-card > img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
}
.lgf-hp-card-info {
  padding: 8px 12px;
  font-size: 12px;
  color: #1f2937;
  line-height: 1.4;
}
.lgf-hp-loading, .lgf-hp-empty { text-align: center; padding: 24px; color: #6b7280; }
.lgf-hp-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5e7eb;
}
.lgf-hp-action {
  background: var(--color-gold-400, #D4A843);
  color: var(--color-navy-950, #0F0D2E);
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.lgf-hp-action:hover { filter: brightness(0.95); }

.funnel-banner {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.funnel-banner.ok { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.funnel-banner.err { background: #FEF2F2; color: #991B1B; border: 1px solid #FCA5A5; white-space: pre-wrap; }

.funnel-build-progress {
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "label elapsed" "track track";
  gap: 8px 12px;
  align-items: center;
}
.funnel-build-progress.error {
  background: #FEF2F2;
  border-color: #FCA5A5;
}
.fbp-label {
  grid-area: label;
  font-size: 13px;
  font-weight: 600;
  color: #4338CA;
}
.funnel-build-progress.error .fbp-label { color: #991B1B; }
.fbp-elapsed {
  grid-area: elapsed;
  font-size: 11px;
  color: #6366F1;
  font-variant-numeric: tabular-nums;
}
.funnel-build-progress.error .fbp-elapsed { color: #991B1B; }
.fbp-track {
  grid-area: track;
  height: 6px;
  background: rgba(99, 102, 241, 0.2);
  border-radius: 999px;
  overflow: hidden;
}
.fbp-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366F1, #8B5CF6);
  border-radius: 999px;
  transition: width 400ms ease-out;
  background-size: 200% 100%;
  animation: fbp-shimmer 1.6s linear infinite;
}
.funnel-build-progress.error .fbp-fill {
  background: #DC2626;
  animation: none;
}
@keyframes fbp-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .fbp-fill { animation: none !important; }
}

/* ---------- Two-column grid ----------
   Paths panel stays a compact fixed width; steps panel expands to fill
   the rest of the viewport. On wide desktops this gives the step list
   enough room to show the full question and monospace sub-line without
   any horizontal scroll at all. */
.funnel-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 820px) {
  .funnel-grid { grid-template-columns: 1fr; }
}

.funnel-paths,
.funnel-steps {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 10px;
  overflow: hidden;
}
.funnel-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-page, #F9FAFB);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
}
.funnel-panel-header::-webkit-scrollbar { display: none; }
.funnel-panel-header > * { flex-shrink: 0; }
.funnel-panel-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-navy-800, #1A1A2E);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.funnel-panel-header .btn-compact { margin-left: auto; flex-shrink: 0; }
/* When content overflows, the auto margin collapses and items scroll horizontally */
.funnel-selected-path {
  font-size: 12px;
  color: var(--color-navy-600, #1E2235);
  font-weight: 500;
  white-space: nowrap;
}
.funnel-selected-path:empty { display: none; }

/* ---------- Path list ---------- */
.funnel-path-list,
.funnel-step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 560px;
  overflow-y: auto;
  overflow-x: auto;
}
.funnel-path-list li,
.funnel-step-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
  cursor: pointer;
  transition: background 120ms ease;
  white-space: nowrap;
  min-width: max-content;
}
.funnel-path-list li .funnel-row-title,
.funnel-step-list li .funnel-row-title,
.funnel-path-list li .funnel-row-sub,
.funnel-step-list li .funnel-row-sub {
  white-space: nowrap;
}
.funnel-path-list li:hover,
.funnel-step-list li:hover {
  background: #FAFAFA;
}
.funnel-path-list li.active,
.funnel-step-list li.active {
  background: #FEF8E7;
  border-left: 3px solid var(--color-gold-400, #D4A843);
}
/* Path currently being shown in the Theme tab Design preview */
.funnel-path-list li.previewing {
  box-shadow: inset 0 0 0 2px #3B82F6;
}
.funnel-path-list li.previewing::after {
  content: '● previewing';
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #3B82F6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.funnel-path-list li.indent {
  padding-left: 32px;
  background: linear-gradient(90deg, #FAFAFA 0%, #fff 24px);
}
.funnel-path-list li.empty,
.funnel-step-list li.funnel-empty,
.funnel-path-list li.funnel-empty {
  cursor: default;
  color: #6B7280;
  font-size: 13px;
  font-style: italic;
  justify-content: center;
}

.funnel-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
/* Horizontal scroll for title + sub instead of truncation or wrap */
.funnel-row-title,
.funnel-row-sub {
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  max-width: 100%;
}
.funnel-row-title::-webkit-scrollbar,
.funnel-row-sub::-webkit-scrollbar { display: none; }
.funnel-row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-navy-900, #12112A);
  display: flex;
  align-items: center;
  gap: 8px;
}
.funnel-row-sub {
  font-size: 11px;
  color: #6B7280;
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.funnel-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.4;
  transition: opacity 120ms ease;
}
.funnel-path-list li:hover .funnel-row-actions,
.funnel-step-list li:hover .funnel-row-actions,
.funnel-path-list li.active .funnel-row-actions,
.funnel-step-list li.active .funnel-row-actions {
  opacity: 1;
}
.funnel-icon-btn {
  background: transparent;
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  font-size: 13px;
  cursor: pointer;
  color: var(--color-navy-600, #1E2235);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.funnel-icon-btn:hover {
  background: var(--color-gold-400, #D4A843);
  color: var(--color-navy-950, #0F0D2E);
  border-color: var(--color-gold-400, #D4A843);
}
.funnel-icon-btn.danger:hover {
  background: #DC2626;
  color: #fff;
  border-color: #DC2626;
}

/* ---------- Badges ---------- */
.funnel-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.funnel-badge.main    { background: #DBEAFE; color: #1E40AF; }
.funnel-badge.alt     { background: #FEF3C7; color: #92400E; }
.funnel-badge.next    { background: #E5E7EB; color: #374151; }
.funnel-badge.redirect{ background: #FCE7F3; color: #9D174D; }
.funnel-badge.alternate { background: #DDD6FE; color: #5B21B6; }

/* ---------- Buttons reused (defensive fallbacks) ---------- */
.btn-primary {
  background: var(--color-gold-400, #D4A843);
  color: var(--color-navy-950, #0F0D2E);
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary:hover:not(:disabled) { background: var(--color-gold-500, #C9993E); }
.btn-secondary {
  background: #fff;
  color: var(--color-navy-800, #1A1A2E);
  border: 1px solid var(--color-border-strong, #D1D5DB);
  padding: 7px 13px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--color-navy-600, #1E2235);
}
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-compact { padding: 5px 10px; font-size: 12px; }

/* ---------- Modal ---------- */
.funnel-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.funnel-modal[hidden] { display: none !important; }
.funnel-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 13, 46, 0.55);
  backdrop-filter: blur(2px);
}
.funnel-modal-panel {
  position: relative;
  background: #fff;
  border-radius: 12px;
  width: min(720px, 94vw);
  max-height: 88vh;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.funnel-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border, #E5E7EB);
}
.funnel-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-navy-900, #12112A);
}
.funnel-modal-close {
  background: transparent;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: #6B7280;
  cursor: pointer;
  padding: 0 4px;
}
.funnel-modal-close:hover { color: var(--color-navy-900, #12112A); }
.funnel-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.funnel-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--color-border, #E5E7EB);
  background: var(--color-page, #F9FAFB);
}

/* ---------- Form rows in the modal ---------- */
.funnel-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.funnel-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-navy-600, #1E2235);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.funnel-field input[type="text"],
.funnel-field input[type="url"],
.funnel-field textarea,
.funnel-field select {
  padding: 8px 10px;
  border: 1px solid var(--color-border-strong, #D1D5DB);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--color-navy-900, #12112A);
}
.funnel-field textarea { min-height: 60px; resize: vertical; }
.funnel-field input:focus,
.funnel-field textarea:focus,
.funnel-field select:focus {
  outline: none;
  border-color: var(--color-gold-400, #D4A843);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.18);
}

.funnel-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px) { .funnel-field-grid { grid-template-columns: 1fr; } }

/* Repeater rows (options, qualifying_rules) */
.funnel-repeater {
  border: 1px dashed var(--color-border-strong, #D1D5DB);
  border-radius: 8px;
  padding: 10px;
  background: #FAFAFA;
}
.funnel-repeater-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.funnel-repeater-row input,
.funnel-repeater-row select {
  padding: 6px 8px;
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 4px;
  font-size: 13px;
  min-width: 0;
  flex: 1 1 auto;
}
.funnel-repeater-row .funnel-icon-btn { flex: 0 0 auto; }
.funnel-repeater-add {
  background: #fff;
  border: 1px solid var(--color-border-strong, #D1D5DB);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  color: var(--color-navy-700, #1E2235);
  font-weight: 600;
}
.funnel-repeater-add:hover { border-color: var(--color-gold-400, #D4A843); }
.funnel-repeater-empty { font-size: 12px; color: #9CA3AF; font-style: italic; padding: 4px 0; }

.funnel-dq-sub {
  margin-top: 8px;
  padding: 10px;
  background: #F3F4F6;
  border-radius: 6px;
  border-left: 3px solid var(--color-gold-400, #D4A843);
}

/* Answer-surface toggle (Options | Text | Email | PII Form) */
.funnel-answer-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--color-border-strong, #D1D5DB);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.funnel-answer-toggle-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-navy-700, #1E2235);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.funnel-answer-toggle-btn + .funnel-answer-toggle-btn {
  border-left: 1px solid var(--color-border-strong, #D1D5DB);
}
.funnel-answer-toggle-btn:hover {
  background: #F9FAFB;
}
.funnel-answer-toggle-btn.is-active {
  background: var(--color-gold-400, #D4A843);
  color: #1E2235;
}
/* Sub-toggle (Single value | Range) — same shape, slightly muted active color */
.funnel-answer-toggle--sub .funnel-answer-toggle-btn.is-active {
  background: var(--color-navy-700, #1E2235);
  color: #fff;
}

/* Range pair editor (admin modal) */
.funnel-range-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px) { .funnel-range-pair { grid-template-columns: 1fr; } }
.funnel-range-col {
  background: #FAFAFA;
  border: 1px solid var(--color-border, #E5E7EB);
  border-radius: 8px;
  padding: 10px;
}
.funnel-range-col-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-navy-700, #1E2235);
  margin-bottom: 8px;
}

/* Validation panel */
.funnel-validation-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--color-border-strong, #D1D5DB);
  border-radius: 8px;
  background: #FAFAFA;
}
.funnel-validation-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-navy-700, #1E2235);
  margin-bottom: 4px;
}

/* Live design-preview range pair (mirrors funnel-range-pair on the canvas) */
.fdp-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}
.fdp-range-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fdp-range-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #6B7280);
}

/* Ensure help-trigger (?) buttons render correctly inline in the funnel tab
   (help.js uses absolute positioning assumptions in label context — we reset them). */
.funnel-tab .help-trigger,
#mode-switcher .help-trigger,
.funnel-modal .help-trigger {
  position: static !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #E5E7EB;
  color: #4B5563;
  border: none;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  margin: 0;
}
.funnel-tab .help-trigger:hover,
#mode-switcher .help-trigger:hover,
.funnel-modal .help-trigger:hover {
  background: var(--color-gold-400, #D4A843);
  color: var(--color-navy-950, #0F0D2E);
}

/* --- Global search (in #mode-switcher header) ---
   Without explicit sizing the bare <input> stretches wide and renders taller
   than the surrounding nav chrome. Constrain to a compact pill that sits
   flush on the right edge of the nav. */
#global-search-wrap {
  position: relative;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.global-search {
  width: 240px;
  height: 28px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.global-search::placeholder {
  color: rgba(255, 255, 255, 0.45);
  font-style: italic;
}
.global-search:focus {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
}
#global-search-wrap .search-results {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

/* --- A/B Testing --- */
.funnel-ab-split-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.funnel-ab-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--color-navy-950, #0F0D2E) 50%, #e2e8f0 50%);
  outline: none;
  cursor: pointer;
}
.funnel-ab-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-gold-400, #D4A843);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}
.funnel-ab-split-label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  min-width: 42px;
}

/* Variant B section in step editor */
.funnel-variant-b-section {
  margin-top: 20px;
  padding: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
}
.funnel-variant-b-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 10px;
}
.funnel-badge-b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: #3b82f6;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.funnel-variant-b-section .funnel-field { margin-bottom: 10px; }
.funnel-variant-b-section input,
.funnel-variant-b-section textarea {
  background: #fff;
}
.vb-opt-value {
  display: inline-block;
  min-width: 100px;
  font-size: 12px;
  color: #6b7280;
  font-family: ui-monospace, monospace;
  padding: 6px 0;
}

/* B badge in step list */
.funnel-badge--b {
  background: #3b82f6;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}

/* ── Mobile Responsive ────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Path & step lists: allow wrapping, prevent overflow */
  .funnel-path-list li,
  .funnel-step-list li {
    white-space: normal;
    min-width: 0;
  }
  .funnel-path-list li .funnel-row-title,
  .funnel-step-list li .funnel-row-title {
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .funnel-path-list li .funnel-row-sub,
  .funnel-step-list li .funnel-row-sub {
    white-space: normal;
    font-size: 11px;
  }
  /* Modal: full width on mobile */
  .funnel-modal-panel {
    width: 96vw;
    max-height: 92vh;
    border-radius: 8px;
  }
  .funnel-modal-panel-narrow {
    max-width: 96vw;
  }
  /* Font control rows: stack vertically */
  .funnel-font-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .funnel-font-row .funnel-select-compact {
    min-width: 0;
    flex: 1 1 120px;
  }
  /* Section containers */
  .funnel-section {
    padding: 12px;
  }
  .funnel-section-header {
    flex-wrap: wrap;
  }
  /* Actions bar (Draft / Reload / Save): horizontal scroll on mobile */
  .funnel-actions {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding: 10px 12px;
    gap: 8px;
  }
  .funnel-actions-status,
  .funnel-actions-buttons {
    flex-shrink: 0;
  }
}

/* Jump page section editor styles moved to css/jump-page.css */

/* ============================================================
   Recipe (Layout) Picker — Phase 004c
   Sits at the top of the Edit Step modal. Visual thumbnail picker
   for the page layout that wraps the question card.
   ============================================================ */

.recipe-picker {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 18px;
  background: #f8fafc;
}
.recipe-picker-header { margin-bottom: 10px; }
.recipe-picker-header .funnel-label { display: block; margin-bottom: 4px; }
.recipe-picker-header .field-hint { margin: 0; }

.recipe-picker-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.recipe-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 60ms ease;
}
.recipe-tile:hover {
  border-color: #cbd5e1;
  box-shadow: 0 1px 4px rgba(15,23,42,0.06);
}
.recipe-tile:active { transform: scale(0.98); }
.recipe-tile--active {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.recipe-tile-svg {
  width: 100%;
  aspect-ratio: 3 / 2;
  background: #f1f5f9;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.recipe-tile-svg svg { width: 92%; height: 92%; display: block; }
.recipe-tile-label {
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
  text-align: center;
}
.recipe-tile--custom .recipe-tile-svg { background: #f8fafc; border: 1px dashed #cbd5e1; }
.recipe-picker-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  font-size: 12px;
  color: #78350f;
  border-radius: 0 4px 4px 0;
}
.recipe-picker-note code {
  background: #fef3c7;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

/* ============================================================
   Recipe editor (custom repeater) + Section palette modal — Phase 004d
   ============================================================ */

.recipe-editor {
  margin-top: 14px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.recipe-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recipe-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}
.recipe-row-icon { font-size: 16px; line-height: 1; }
.recipe-row-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}
.recipe-row-required {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  background: #e5e7eb;
  padding: 2px 6px;
  border-radius: 3px;
}
.recipe-row-controls {
  display: flex;
  gap: 4px;
}
.recipe-row-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #4b5563;
  transition: background 100ms ease, border-color 100ms ease;
}
.recipe-row-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}
.recipe-row-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.recipe-row-btn--danger:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}
.recipe-add-btn {
  margin-top: 12px;
  padding: 8px 14px;
  background: #fff;
  border: 1.5px dashed #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  width: 100%;
  transition: border-color 120ms ease, background 120ms ease;
}
.recipe-add-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
}

/* Section palette modal — grid of section cards inside the standard
   funnel-modal-panel. Reuses .funnel-modal* styles for backdrop / panel. */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.palette-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 10px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 60ms ease;
}
.palette-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 6px rgba(15,23,42,0.08);
}
.palette-card:active { transform: scale(0.98); }
.palette-card-icon { font-size: 22px; line-height: 1; }
.palette-card-label {
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
}
.palette-card-description {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.35;
}

/* ============================================================
   Section content accordions — Phase 004 follow-up
   Per-step content editor for sections in the active recipe.
   ============================================================ */

.section-accordions {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
}
.section-accordions-header {
  margin-bottom: 10px;
}
.section-accordions-header .funnel-label { display: block; margin-bottom: 4px; }
.section-accordions-header .field-hint { margin: 0; }

.section-acc {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
}
.section-acc[open] { box-shadow: 0 1px 4px rgba(15,23,42,0.06); }

.section-acc-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}
.section-acc-summary::-webkit-details-marker { display: none; }
.section-acc-summary::after {
  content: '▾';
  margin-left: auto;
  color: #94a3b8;
  font-size: 11px;
  transition: transform 120ms ease;
}
.section-acc[open] > .section-acc-summary::after {
  transform: rotate(180deg);
}
.section-acc-summary:hover { background: #f8fafc; }

.section-acc-icon { font-size: 16px; line-height: 1; }
.section-acc-label { font-weight: 600; }
.section-acc-hint {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  margin-left: 6px;
}
.section-acc[open] .section-acc-hint { display: none; }

.section-acc-body {
  padding: 14px;
  border-top: 1px solid #f1f5f9;
}

/* Value-props / trust-badges repeater rows */
.vp-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.vp-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.vp-row > input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
}

/* Section accordion image preview */
.section-img-preview {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}
.section-img-preview img {
  width: 120px;
  height: 80px;
  object-fit: contain;
  background: #fff;
  border-radius: 3px;
  flex-shrink: 0;
}
.section-img-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Phase 031 B0 — complex_funnel (advanced canvas) read-only summary panel.
   Temporary surface proving the site loads + round-trips; B1 replaces it with
   the real component editor. */
.funnel-complex-summary {
  margin: 12px 0;
  padding: 18px 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.funnel-complex-summary .cfs-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.funnel-complex-summary .cfs-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}
.funnel-complex-summary .cfs-badge {
  font-size: 11px;
  font-weight: 600;
  color: #3730a3;
  background: #e0e7ff;
  border-radius: 999px;
  padding: 2px 10px;
}
.funnel-complex-summary .cfs-counts {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}
.funnel-complex-summary .cfs-note {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.45;
}
.funnel-complex-summary .cfs-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.funnel-complex-summary .cfs-steps li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 6px;
  font-size: 12.5px;
}
.funnel-complex-summary .cfs-step-id { color: #1e293b; font-weight: 600; }
.funnel-complex-summary .cfs-step-meta { color: #94a3b8; font-size: 11.5px; }

/* ===== Phase 031 B1 — complex_funnel component canvas (editable) ===== */
.cfc-canvas { margin: 12px 0; }
.cfc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cfc-title { font-size: 15px; font-weight: 700; color: #1e293b; }
.cfc-preview { font-size: 12.5px; font-weight: 600; color: #4338ca; background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 7px; padding: 5px 12px; cursor: pointer; }
.cfc-preview:hover { background: #e0e7ff; }
.cfc-cols { display: grid; grid-template-columns: 260px 1fr 1fr; gap: 14px; align-items: start; }
.cfc-col { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; min-height: 220px; }
.cfc-col-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #64748b; margin-bottom: 8px; }
.cfc-steps, .cfc-comps, .cfc-opts { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 5px; }
.cfc-step-row, .cfc-comp-row { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid #eef2f7; border-radius: 7px; padding: 4px 6px; }
.cfc-step-row.sel, .cfc-comp-row.sel { border-color: #6366f1; box-shadow: 0 0 0 1px #6366f1 inset; }
.cfc-row-body { flex: 1; text-align: left; background: none; border: 0; cursor: pointer; padding: 4px; display: flex; flex-direction: column; gap: 1px; }
.cfc-step-title, .cfc-comp-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.cfc-step-meta { font-size: 11px; color: #94a3b8; }
.cfc-pill { font-size: 10px; font-weight: 600; color: #3730a3; background: #e0e7ff; border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.cfc-row-acts { display: flex; gap: 2px; }
.cfc-row-acts button { font-size: 12px; line-height: 1; color: #64748b; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 5px; padding: 3px 6px; cursor: pointer; }
.cfc-row-acts button:hover:not([disabled]) { background: #e2e8f0; color: #1e293b; }
.cfc-row-acts button[disabled] { opacity: .35; cursor: default; }
.cfc-add { font-size: 12.5px; font-weight: 600; color: #4338ca; background: #fff; border: 1px dashed #c7d2fe; border-radius: 7px; padding: 6px 10px; cursor: pointer; width: 100%; }
.cfc-add:hover { background: #eef2ff; }
.cfc-add-sm { width: auto; padding: 4px 10px; font-size: 12px; }
.cfc-empty { font-size: 12.5px; color: #94a3b8; padding: 10px 4px; }
.cfc-lbl { display: block; font-size: 12px; font-weight: 600; color: #475569; margin: 10px 0 4px; }
.cfc-text, .cfc-step-title-input, .cfc-opt-label, .cfc-opt-value { width: 100%; font-size: 13px; padding: 7px 9px; border: 1px solid #cbd5e1; border-radius: 7px; box-sizing: border-box; }
.cfc-text:focus, .cfc-step-title-input:focus, .cfc-opt-label:focus, .cfc-opt-value:focus { outline: 2px solid #6366f1; outline-offset: -1px; border-color: #6366f1; }
.cfc-opt { display: grid; grid-template-columns: 1fr 120px auto; gap: 6px; align-items: center; }
.cfc-opt button { font-size: 12px; color: #64748b; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 5px; padding: 6px 8px; cursor: pointer; }
.cfc-note { font-size: 12px; color: #64748b; margin: 10px 0 0; line-height: 1.45; }
.cfc-note.cfc-subtle { color: #94a3b8; font-size: 11px; }
/* B-mapping — "where this answer goes" signal */
.cfc-wire { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.cfc-maps-sent { color: #047857; }
.cfc-maps-unmapped { color: #b45309; }
/* B3 — brand & theme color row */
.cfc-color-row { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; }
.cfc-color { width: 44px; height: 36px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; background: #fff; }
.cfc-color-hex { margin: 0; }
/* fix — roomy textarea for paragraph-length content (TCPA consent, text blocks) */
.cfc-textarea { width: 100%; min-height: 140px; resize: vertical; line-height: 1.45; font-family: inherit; padding: 8px 10px; }
/* B4 — hero image thumbnail */
.cfc-hero-thumb { margin-top: 8px; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #f8fafc; max-width: 220px; }
.cfc-hero-thumb img { display: block; width: 100%; height: auto; max-height: 180px; object-fit: contain; }
@media (max-width: 1100px) { .cfc-cols { grid-template-columns: 1fr; } }
