:root {
  /* Aligned with the Market Dominator app: neutral-gray surfaces + orange
     accent, Manrope. Light theme. */
  --navy: #171717;          /* primary "ink" — headings + key values */
  --navy-600: #404040;      /* softer ink */
  --navy-50: #f5f5f5;       /* ghost-hover fill / soft neutral wash */
  --teal: #ea580c;          /* secondary accent / links (orange-600) */
  --teal-600: #c2410c;
  --gold: #f97316;          /* primary brand / CTA accent (orange-500) */
  --gold-soft: #fff7ed;     /* orange-50 wash */
  --brand-strong: #ea580c;  /* solid CTA surface (white text on it) */
  --brand-strong-600: #c2410c;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  /* Readable text colors for use ON the *-soft tinted callout backgrounds.
     Dark hues in light mode (unchanged look); light pastels in dark mode so
     callouts stay legible on the dark translucent tints. */
  --ok-text: #1f6030;
  --warn-text: #78350f;
  --bad-text: #7f1d1d;

  --bg: #fafafa;            /* neutral-50 (matches app body) */
  --panel: #ffffff;
  --panel-alt: #f5f5f5;
  --border: #e5e5e5;        /* neutral-200 */
  --border-strong: #d4d4d4; /* neutral-300 */
  --text: #171717;          /* neutral-900 */
  --text-soft: #404040;     /* neutral-700 */
  --muted: #737373;         /* neutral-500 */
  --chip: #f5f5f5;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow:    0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.14);

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;

  color-scheme: light;
}

/* Dark theme — toggled by the .dark class on <html>, exactly like the
   Market Dominator app (shared localStorage 'theme' key + no-flash script).
   The whole sheet is token-driven, so these overrides cascade everywhere;
   hardcoded `white` panel fills were converted to var(--panel). */
html.dark {
  --navy: #fafafa;          /* ink flips light so headings read on dark */
  --navy-600: #d4d4d4;
  --navy-50: #2a2a2a;       /* ghost-hover fill on dark */
  --teal: #fb923c;          /* orange-400 — better contrast on dark */
  --teal-600: #fdba74;
  --gold: #f97316;
  --gold-soft: rgba(249, 115, 22, 0.14);
  --brand-strong: #ea580c;
  --brand-strong-600: #f97316;
  --ok: #4ade80;
  --ok-soft: rgba(34, 197, 94, 0.16);
  --warn: #fbbf24;
  --warn-soft: rgba(217, 119, 6, 0.20);
  --bad: #f87171;
  --bad-soft: rgba(220, 38, 38, 0.22);
  --ok-text: #bbf7d0;       /* green-200  */
  --warn-text: #fde68a;     /* amber-200  */
  --bad-text: #fecaca;      /* red-200    */

  --bg: #171717;            /* neutral-900 */
  --panel: #262626;         /* neutral-800 */
  --panel-alt: #1f1f1f;
  --border: #404040;        /* neutral-700 */
  --border-strong: #525252;
  --text: #fafafa;
  --text-soft: #d4d4d4;
  --muted: #a3a3a3;         /* neutral-400 */
  --chip: #333333;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow:    0 4px 12px rgba(0, 0, 0, 0.50), 0 1px 3px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.60);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============ TOPBAR ============ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
/* MD-tool logo lockup: orange-600 rounded square + bar-chart glyph, wordmark
   over an uppercase tracked sub-line. 1:1 with the Market Dominator header. */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #ea580c;
  flex-shrink: 0;
  transition: background 0.15s;
}
.brand:hover .brand-mark { background: #c2410c; }
.brand-mark svg { display: block; }
.brand-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
}
.brand-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.topbar-actions { display: flex; gap: 4px; align-items: center; }
.nav-link {
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--navy-50); color: var(--text); }
.label-inline { font-size: 12px; color: var(--muted); font-weight: 500; }
.topbar select {
  padding: 7px 10px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
/* Sun/moon theme toggle — mirrors the Market Dominator app header button.
   Icon swap is pure CSS, driven by the .dark class on <html>. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-toggle:hover { background: var(--navy-50); color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .icon-sun { display: none; }
html.dark .theme-toggle .icon-sun { display: block; }
html.dark .theme-toggle .icon-moon { display: none; }

/* ============ LAYOUT ============ */
.app-grid {
  display: grid;
  grid-template-columns: minmax(380px, 440px) 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
  padding: 24px 32px;
  max-width: 1600px;
  margin: 0 auto;
}
.inputs-panel { grid-column: 1; grid-row: 1 / span 2; }
.results-panel { grid-column: 2; grid-row: 1; }
.scenarios-panel { grid-column: 2; grid-row: 2; }

/* Form-first layout: before the first run there are no results, so don't
   strand the form in a narrow island next to a huge empty panel. Center
   it in a comfortable single column; the 2-pane dashboard appears once
   results exist (.has-results is added by app.js when results render).
   Desktop only — narrow screens already stack via the 1100px breakpoint. */
@media (min-width: 1101px) {
  .app-grid:not(.has-results) {
    grid-template-columns: minmax(0, 900px);
    justify-content: center;
  }
  .app-grid:not(.has-results) .results-panel,
  .app-grid:not(.has-results) .scenarios-panel { display: none; }
  .app-grid:not(.has-results) .inputs-panel { grid-row: auto; }
}

/* "No credits / runs in browser" reassurance — header chip + run note. */
.free-chip {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok-text);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.free-note {
  margin: 10px 0 0;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.45;
  background: var(--ok-soft);
  color: var(--ok-text);
  border-left: 3px solid var(--ok);
  border-radius: var(--radius-sm);
}

/* "Start with a template" starter — moved out of the header into the top of
   the Product Plan panel so the header stays clean (matches the Market
   Dominator tool's layout). */
.template-starter {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.template-starter-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.template-starter-hint {
  margin: 2px 0 10px;
  font-size: 12px;
  color: var(--muted);
}
.template-starter-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.template-starter-row select {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

section.inputs-panel,
section.results-panel,
section.scenarios-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel-head { margin-bottom: 16px; }
.panel-head h2, h2 {
  font-size: 18px;
  margin: 0;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}
.panel-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}
h3 {
  font-size: 16px;
  margin: 0 0 4px;
  color: var(--navy);
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* ============ INPUT PANEL ============ */
details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--panel-alt);
  transition: border-color 0.15s;
}
details[open] { border-color: var(--teal); }
details > summary {
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
  padding: 2px 0;
  font-size: 14px;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "+";
  display: inline-block;
  margin-right: 10px;
  color: var(--teal);
  font-weight: 800;
  width: 14px;
  transition: transform 0.15s ease;
}
details[open] > summary::before { content: "−"; }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin-top: 12px;
}
.field-grid label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 500;
  gap: 4px;
}
.field-grid input,
.range-table input,
.field-grid select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field-grid input:focus,
.range-table input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

.section-note {
  font-size: 12.5px;
  color: var(--text-soft);
  margin: 8px 0 12px;
  padding: 10px 12px;
  background: var(--chip);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--teal);
}
.section-note-tight {
  padding: 7px 10px;
  font-size: 12px;
  margin: 6px 0 10px;
  line-height: 1.4;
}

/* ============ PRE-LAUNCH TIMELINE DIAGRAM ============ */
.prelaunch-timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 12px 10px;
  background: linear-gradient(135deg, var(--navy-50) 0%, var(--gold-soft) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 10px 0 6px;
  flex-wrap: nowrap;
}
.pl-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: var(--panel);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  min-width: 56px;
  text-align: center;
}
.pl-step.pl-launch {
  background: var(--brand-strong);
  color: white;
  box-shadow: 0 2px 8px rgba(244,167,51,0.4);
  border: 1px solid var(--gold);
}
.pl-step.pl-launch .pl-day,
.pl-step.pl-launch .pl-label { color: white; }
.pl-icon { font-size: 18px; line-height: 1; }
.pl-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.02em;
}
.pl-day {
  font-size: 9.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pl-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.pl-arrow .pl-gap {
  font-size: 9px;
  font-weight: 600;
  color: var(--teal-600);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
@media (max-width: 500px) {
  .prelaunch-timeline { flex-wrap: wrap; }
  .pl-arrow { transform: rotate(90deg); }
}

/* Chart help link/expander */
.chart-help-link {
  color: var(--teal-600);
  text-decoration: none;
  font-weight: 700;
  margin-left: 4px;
  font-size: 11.5px;
}
.chart-help-link:hover { color: var(--teal); text-decoration: underline; }
details.chart-help {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.55;
}
details.chart-help[open] { background: var(--gold-soft); border-color: var(--gold); }
details.chart-help summary { display: none; }
details.chart-help p { margin: 0; }

.range-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}
.range-table th {
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.03em;
}
.range-table td { padding: 4px 6px; font-size: 12px; }
.range-table td:first-child {
  width: 44%;
  color: var(--text-soft);
  font-weight: 500;
}
.range-table td input { width: 74px; text-align: right; }
.hint-cell {
  font-size: 11.5px;
  color: var(--muted);
  margin: 10px 0 0;
  padding: 8px 10px;
  background: var(--gold-soft);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold);
}

.hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--chip);
  color: var(--teal-600);
  font-size: 10px;
  cursor: pointer;
  margin-left: 4px;
  font-weight: 800;
  border: 1px solid transparent;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s;
}
.hint:hover, .hint.tip-active { background: var(--teal); color: white; }

/* Floating tooltip popover — works on hover and tap */
.tip-popover {
  position: fixed;
  max-width: 280px;
  padding: 10px 12px;
  background: var(--brand-strong);
  color: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  line-height: 1.5;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.tip-popover.visible { opacity: 1; pointer-events: auto; }
.tip-popover::after {
  content: "";
  position: absolute;
  left: var(--tip-arrow-x, 12px);
  top: -6px;
  width: 10px; height: 10px;
  background: var(--brand-strong);
  transform: rotate(45deg);
}
.tip-popover.tip-above::after { top: auto; bottom: -6px; }

/* Stale-results overlay — shown when an input is edited after a run */
.results-body {
  position: relative;
}
.results-body.stale::before {
  content: "";
  position: absolute;
  inset: -8px;
  background: rgba(245, 247, 250, 0.62);
  backdrop-filter: blur(1.5px);
  z-index: 5;
  border-radius: var(--radius-lg);
  pointer-events: none;
}
.stale-banner {
  position: sticky;
  top: 12px;
  z-index: 6;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--brand-strong);
  color: white;
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.stale-banner button {
  background: var(--gold);
  color: var(--navy);
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.stale-banner button:hover { background: var(--panel); }
.results-body.stale .stale-banner { display: flex; }

/* ============ BUTTONS ============ */
.btn {
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary {
  background: var(--brand-strong);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-strong-600); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: var(--panel);
  color: var(--navy);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--navy-50); border-color: var(--navy); }
.btn-small { padding: 7px 12px; font-size: 12px; }
.btn svg { height: 15px; width: 15px; vertical-align: -2px; margin-right: 6px; }
.btn-small svg { height: 14px; width: 14px; margin-right: 5px; }

/* ============ MARKET DOMINATOR ============ */
details.dominator-details {
  border: 1px solid var(--border);
  background: var(--gold-soft);
  margin-bottom: 16px;
  padding: 14px 16px;
}
details.dominator-details > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--teal-600);
  font-size: 14.5px;
  font-weight: 800;
  gap: 10px;
}
.dom-summary-title { flex: 1; }
.dom-summary-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dom-summary-status.grade-green  { background: var(--ok-soft); color: var(--ok); }
.dom-summary-status.grade-orange { background: var(--warn-soft); color: var(--warn); }
.dom-summary-status.grade-red    { background: var(--bad-soft); color: var(--bad); }

.dom-upload-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-top: 10px;
  border: 2px dashed var(--teal);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dom-upload-box:hover { background: var(--navy-50); border-color: var(--teal-600); }
.dom-upload-box.drag-over { background: var(--gold-soft); border-color: var(--gold); }
.dom-upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
}
.dom-upload-icon svg { height: 22px; width: 22px; }
.dom-upload-text {
  flex: 1;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.dom-target-label { margin-top: 10px; }

.dom-upload-feedback {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.5;
  border-left: 3px solid;
}
.dom-upload-feedback.success {
  background: var(--ok-soft);
  color: var(--ok-text);
  border-color: var(--ok);
}
.dom-upload-feedback.error {
  background: var(--bad-soft);
  color: var(--bad-text);
  border-color: var(--bad);
}
.dom-upload-feedback strong { font-weight: 700; }

details.dom-advanced-paste {
  margin-top: 14px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  padding: 8px 12px;
}
details.dom-advanced-paste > summary {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}
details.dom-advanced-paste[open] > summary { margin-bottom: 8px; }

/* Run button gate message */
.run-gate-msg {
  margin: 10px 0 0;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  background: var(--warn-soft);
  color: var(--warn-text);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
}

.dom-inputs { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.dom-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
}
.dom-label textarea, .dom-label input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: 12px;
  color: var(--text);
  background: var(--panel);
  resize: vertical;
}
.dom-label textarea {
  min-height: 70px;
  font-variant-numeric: tabular-nums;
  white-space: pre;
  overflow-x: auto;
}
.dom-label input[type="text"] { font-family: inherit; font-size: 13px; }
.dom-label textarea:focus, .dom-label input[type="text"]:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
}

.dom-actions { display: flex; gap: 8px; margin-top: 4px; }

.dom-results {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.dom-headline {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 14px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.grade-badge {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
}
.grade-badge.grade-green  { background: var(--ok); }
.grade-badge.grade-orange { background: var(--warn); }
.grade-badge.grade-red    { background: var(--bad); }

.dom-score-wrap { text-align: center; }
.dom-score-label { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.dom-score-value { font-size: 26px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1; margin-top: 2px; }
.dom-score-meta { font-size: 10px; color: var(--muted); }
.dom-reason { font-size: 12.5px; color: var(--text-soft); line-height: 1.45; }

.dom-competitor-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.competitor-pill {
  display: grid;
  grid-template-columns: 120px 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  padding: 4px 6px;
}
.competitor-pill .cp-label {
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cp-bar-track {
  height: 10px;
  background: var(--chip);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.cp-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.3s ease;
}
/* Solid, desaturated fills (calmer than the old gradients); red still reads as
   the threat to focus on. */
.cp-bar-fill.color-green  { background: #8FB996; }
.cp-bar-fill.color-lime   { background: #A9C47F; }
.cp-bar-fill.color-yellow { background: #D9C27A; }
.cp-bar-fill.color-orange { background: #E0A36B; }
.cp-bar-fill.color-red    { background: #D98A86; }
.cp-pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--navy); min-width: 42px; text-align: right; }
.cp-bucket {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.cp-bucket.color-green  { background: var(--ok-soft);   color: var(--ok); }
.cp-bucket.color-lime   { background: #ECF7D4;          color: #5C7E10; }
.cp-bucket.color-yellow { background: #FEF3C7;          color: #92400E; }
.cp-bucket.color-orange { background: var(--warn-soft); color: var(--warn); }
.cp-bucket.color-red    { background: var(--bad-soft);  color: var(--bad); }

.dom-apply-row { display: flex; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* "Applied to the simulator" confirmation — green so users can see at a glance
   that their Market Dominator data is in effect. */
.dom-apply-note {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--ok-text);
  background: var(--ok-soft);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--ok);
}

/* Niche tag on the verdict card */
.verdict-top-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.verdict-niche-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--chip);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
  cursor: help;
}
.verdict-niche-tag.grade-green  { background: var(--ok-soft);   color: var(--ok-text);   border-color: transparent; }
.verdict-niche-tag.grade-orange { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }
.verdict-niche-tag.grade-red    { background: var(--bad-soft);  color: var(--bad-text);  border-color: transparent; }

@media (max-width: 800px) {
  .competitor-pill { grid-template-columns: 90px 1fr auto; gap: 6px; }
  .cp-bucket { display: none; }
  .dom-headline { grid-template-columns: auto 1fr; }
  .dom-reason { grid-column: 1 / -1; }
}

/* Sticky run button — always accessible while user scrolls the form */
.run-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  position: sticky;
  bottom: 12px;
  z-index: 20;
  padding: 10px;
  background: linear-gradient(180deg, transparent 0%, var(--panel) 70%);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
}
.run-row .btn { flex: 1; }
.run-row .btn-primary { flex: 2; }

.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding: 14px 16px 12px;
  background: linear-gradient(135deg, var(--navy-50) 0%, var(--panel) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.progress-milestones {
  position: relative;
  height: 22px;
  /* Inset so the leftmost (0%) and rightmost (100%) emojis don't get clipped
     by the parent's edge — they sit centered above their own anchor point. */
  margin: 0 24px;
}
.progress-milestone {
  position: absolute;
  top: 0;
  font-size: 16px;
  transform: translateX(-50%) scale(0.85);
  opacity: 0.45;
  filter: grayscale(0.5);
  transition: all 0.4s ease;
}
.progress-milestone.lit {
  opacity: 1;
  filter: grayscale(0) drop-shadow(0 0 6px rgba(244,167,51,0.5));
  transform: translateX(-50%) scale(1.15);
}
.progress-milestone[data-at="0"]   { left: 0%; }
.progress-milestone[data-at="33"]  { left: 33%; }
.progress-milestone[data-at="66"]  { left: 66%; }
.progress-milestone[data-at="100"] { left: 100%; }

.progress-bar {
  position: relative;
  height: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: visible; /* let the rocket peek beyond the bar edge */
  margin: 0 24px;    /* keep matched with .progress-milestones margin */
  box-shadow: inset 0 1px 2px rgba(11,37,69,0.08);
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--gold) 60%, #F4524D 100%);
  transition: width 0.25s ease-out;
  background-size: 200% 100%;
  animation: progress-shimmer 1.6s linear infinite;
}
@keyframes progress-shimmer {
  0%   { background-position: 0% 0%; }
  100% { background-position: -200% 0%; }
}
.progress-rocket {
  position: absolute;
  top: 50%;
  left: 0;
  font-size: 22px;
  transform: translate(-50%, -50%);
  transition: left 0.25s ease-out;
  filter: drop-shadow(0 2px 4px rgba(11,37,69,0.25));
  animation: progress-rocket-bob 0.7s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes progress-rocket-bob {
  from { transform: translate(-50%, -55%) rotate(-4deg); }
  to   { transform: translate(-50%, -45%) rotate(4deg); }
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 4px 4px 0;
  font-size: 12.5px;
}
.progress-status {
  color: var(--navy-600);
  font-weight: 600;
  flex: 1;
  transition: opacity 0.25s ease;
}
.progress-status.fading { opacity: 0; }
.progress-counter {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
}

/* ============ EMPTY STATE ============ */
.empty-state {
  padding: 60px 30px;
  text-align: center;
  color: var(--muted);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--panel-alt);
}
.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border-strong);
  margin-bottom: 12px;
}
.empty-icon svg { height: 44px; width: 44px; }
.empty-state h3 { color: var(--navy); margin-bottom: 8px; }
.empty-state .muted { color: var(--muted); font-size: 12.5px; margin-top: 10px; }

/* ============ VERDICT CARD ============ */
/* Calm, on-brand panel: a status-coloured left border + soft tint over the
   same surface tokens as the wizard, with dark ink text. */
.verdict-card {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-left: 5px solid var(--muted);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  background: var(--panel);
}
.verdict-card.verdict-good  { border-left-color: var(--ok);   background: linear-gradient(110deg, var(--ok-soft) 0%, var(--panel) 55%); }
.verdict-card.verdict-mixed { border-left-color: var(--warn); background: linear-gradient(110deg, var(--warn-soft) 0%, var(--panel) 55%); }
.verdict-card.verdict-risky { border-left-color: var(--bad);  background: linear-gradient(110deg, var(--bad-soft) 0%, var(--panel) 55%); }

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--chip);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.verdict-card.verdict-good  .verdict-badge { background: var(--ok-soft);   color: var(--ok-text);   border-color: transparent; }
.verdict-card.verdict-mixed .verdict-badge { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }
.verdict-card.verdict-risky .verdict-badge { background: var(--bad-soft);  color: var(--bad-text);  border-color: transparent; }
.verdict-product {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin: 10px 0 0;
}
.verdict-headline {
  font-size: 24px;
  font-weight: 800;
  margin: 6px 0 6px;
  letter-spacing: -0.4px;
  color: var(--navy);
  text-transform: none;
}
.verdict-sub {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-soft);
  max-width: 760px;
}
.verdict-sub strong { color: var(--navy); }

/* ============ KPI ROW ============ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
.kpi-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.kpi-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
/* Uniform subtle accent on every card — the meaningful good/bad signal lives
   on the value colour below, so the cards themselves stay calm. */
.kpi-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--border-strong);
}
.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  margin-bottom: 8px;
}
.kpi-icon svg { height: 18px; width: 18px; }
.kpi-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.3;
}
.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.kpi-card.kpi-positive .kpi-value { color: var(--ok); }
.kpi-card.kpi-warn .kpi-value { color: var(--warn); }
.kpi-card.kpi-bad .kpi-value { color: var(--bad); }
.kpi-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

/* ============ EXPLAINER ============ */
details.explainer {
  margin: 4px 0 20px;
  background: var(--gold-soft);
  border-color: var(--gold);
}
details.explainer > summary {
  color: var(--navy);
}
details.explainer > summary::before {
  color: var(--gold);
}
details.explainer p, details.explainer ul { font-size: 12.5px; color: var(--text-soft); margin: 8px 0; }
details.explainer ul { padding-left: 20px; }
details.explainer li { margin-bottom: 4px; }

/* ============ WARNING BANNER ============ */
.warning-banner {
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  border-left: 4px solid var(--warn);
  background: var(--warn-soft);
  color: var(--warn-text);
  font-size: 12.5px;
  line-height: 1.55;
}
.warning-banner strong { color: var(--warn-text); }

/* Inline validation panel — replaces blocking alert() dialogs.
   Shown above the Run button when inputs fail validation. */
.validation-panel {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--bad-soft);
  border-left: 4px solid var(--bad);
  color: var(--bad-text);
  font-size: 13px;
  line-height: 1.5;
}
.validation-panel strong { color: var(--bad-text); display: block; margin-bottom: 4px; }
.validation-panel ul { margin: 0; padding-left: 20px; }
.validation-panel li { margin-bottom: 2px; }

/* Toast — small, auto-dismissing confirmation in bottom-right.
   Used for save scenario, copy-link, etc. */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 360px;
  padding: 12px 18px;
  background: var(--brand-strong);
  color: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 10000;
}
.toast.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast.toast-warn { background: #92400e; }
.toast strong { color: white; }

/* Q4 dependency one-liner */
.q4-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--gold-soft) 0%, var(--panel) 100%);
  border-left: 3px solid var(--gold);
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.45;
}
.q4-line .q4-icon { font-size: 16px; }
.q4-line strong { color: var(--navy); }

/* ============ CHART BLOCKS ============ */
.chart-block {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-alt);
}
.chart-head { margin-bottom: 14px; }
.chart-head h3 { color: var(--navy); margin: 0 0 4px; font-size: 16px; }
.chart-sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.chart-block canvas { max-height: 340px; }

/* Chart annotation toggles — placed BELOW the canvas */
.chart-toggles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.chart-toggle-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-right: 4px;
}
.chart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.chart-toggle:hover { background: var(--chip); border-color: var(--teal); }
.chart-toggle input { margin: 0; accent-color: var(--teal); cursor: pointer; }
.chart-toggle:has(input:checked) {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: var(--text);
}

/* ============ SCENARIOS ============ */
.scenarios-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.scenario-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.scenario-item:hover { border-color: var(--teal); box-shadow: var(--shadow-sm); }
.scenario-item input[type="checkbox"] {
  margin: 0;
  accent-color: var(--teal);
  width: 16px; height: 16px;
  cursor: pointer;
}
.scenario-name { font-weight: 700; color: var(--navy); font-size: 13px; }
.scenario-meta { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; }
.scenario-actions { display: flex; gap: 4px; }
.scenario-actions button {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  background: var(--panel);
  color: var(--navy);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s;
}
.scenario-actions button:hover { background: var(--brand-strong); color: white; border-color: var(--navy); }
.empty-note { color: var(--muted); font-size: 13px; padding: 12px; text-align: center; }

.compare-table {
  margin-top: 16px;
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.compare-table th, .compare-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.compare-table thead th {
  background: var(--brand-strong);
  color: white;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.compare-table tbody tr:last-child th, .compare-table tbody tr:last-child td { border-bottom: none; }
.compare-table td.best { color: var(--ok); font-weight: 700; background: var(--ok-soft); }
.compare-table td.worst { color: var(--bad); background: var(--bad-soft); }

/* ============ FOOTER ============ */
.site-footer {
  padding: 20px 32px 24px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--panel);
  margin-top: 30px;
}
.footer-disclaimer {
  max-width: 880px;
  margin: 0 auto 14px;
  padding: 12px 16px;
  background: var(--warn-soft);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  text-align: left;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--warn-text);
}
.footer-disclaimer strong { color: var(--warn-text); }
.footer-meta { margin: 0; }
.footer-bar {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
}
.footer-copyright { color: var(--muted); }
.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.footer-links a:hover { color: var(--text); }

/* ============ RESPONSIVE ============ */
.results-actions { display: flex; justify-content: flex-end; align-items: center; margin-bottom: 10px; gap: 8px; }
.results-actions-spacer { flex: 1 1 auto; }

@media (max-width: 1100px) {
  .app-grid { grid-template-columns: 1fr; padding: 16px; }
  .inputs-panel, .results-panel, .scenarios-panel { grid-column: 1; grid-row: auto; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px 20px; }
  .brand-titles h1 { font-size: 18px; }
}

/* ============ PRINT / PDF EXPORT ============ */
@media print {
  /* Force all colors to render — critical for the navy/gold verdict card */
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* Always print in the light palette — ink-friendly and predictable even
     when the user has dark mode on. */
  :root, html.dark {
    --bg: #ffffff; --panel: #ffffff; --panel-alt: #f5f5f5;
    --border: #e5e5e5; --border-strong: #d4d4d4;
    --text: #171717; --text-soft: #404040; --muted: #737373;
    --navy: #171717; --navy-600: #404040; --navy-50: #f5f5f5;
    --chip: #f5f5f5;
  }
  body { background: #ffffff; color: #171717; font-size: 11pt; }

  /* Hide everything except results */
  .inputs-panel,
  .scenarios-panel,
  .site-footer,
  .stale-banner,
  .topbar-actions,
  .no-print,
  #run-tornado-btn,
  .chart-block:last-of-type /* tornado block */ {
    display: none !important;
  }

  /* Single-column layout for the remaining content */
  .app-grid {
    display: block !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .results-panel {
    grid-column: 1 !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }

  /* Topbar keeps the brand but compact */
  .topbar {
    padding: 12px 20px !important;
    page-break-after: avoid;
  }
  .topbar, .verdict-card, .kpi-card, .grade-badge, .warning-banner {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Keep verdict card + KPI row together at top of page */
  .verdict-card { page-break-inside: avoid; margin-top: 16px !important; }
  .kpi-row { page-break-inside: avoid; }
  .chart-block { page-break-inside: avoid; margin-top: 12px !important; padding: 10px !important; }

  /* Smaller chart size for one-page fit */
  .chart-block canvas { max-height: 280px !important; }

  /* Empty state + explainer details + print button: hide */
  .empty-state,
  details.explainer,
  .results-actions { display: none !important; }

  /* Print footer with date + app name — added via ::after on results-panel */
  .results-panel::after {
    content: "Generated by TheFBABros Product Launch Simulator · Part of The AMZ Escape 3.0 coaching program · " attr(data-print-date);
    display: block;
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid #e3e8ef;
    font-size: 9pt;
    color: #667085;
    text-align: center;
  }

  /* Tighten KPI cards for print */
  .kpi-card { padding: 10px !important; }
  .kpi-value { font-size: 18pt !important; }

  /* Tighten verdict card */
  .verdict-card { padding: 16px 20px !important; }
  .verdict-headline { font-size: 18pt !important; }
  .verdict-sub { font-size: 10pt !important; }

  /* Page break controls */
  @page {
    margin: 0.5in;
    size: letter;
  }
}
@media (max-width: 600px) {
  .kpi-row { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .verdict-headline { font-size: 22px; }
}

/* ============ GUIDED WIZARD ============ */
.wizard-head { margin-bottom: 14px; scroll-margin-top: 84px; }
.wizard-subtitle { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

/* Step indicator */
.wizard-stepper { margin: 0 0 18px; }
.wizard-stepper ol {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.wstep { flex: 1 1 auto; min-width: 0; display: flex; }
.wstep-btn {
  width: 100%;
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.wstep-btn:hover { border-color: var(--border-strong); color: var(--text-soft); }
.wstep-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.wstep-num {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 999px;
  background: var(--border); color: var(--text-soft);
  font-size: 11px; font-weight: 800;
}
.wstep-name { overflow: hidden; text-overflow: ellipsis; }
.wstep.is-current .wstep-btn { background: var(--gold-soft); border-color: var(--gold); color: var(--teal-600); }
.wstep.is-current .wstep-num { background: var(--brand-strong); color: #fff; }
.wstep.is-done .wstep-num { background: var(--ok); color: #fff; font-size: 0; }
.wstep.is-done .wstep-num::after { content: "✓"; font-size: 12px; }

/* Step panels */
.wizard-step { scroll-margin-top: 84px; }
.wizard-step[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .wizard-step.is-active { animation: wizardFade .22s ease both; }
}
@keyframes wizardFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.wstep-header { margin-bottom: 4px; }
.wstep-eyebrow {
  margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--teal-600);
}
.wstep-header h3 {
  margin: 3px 0 0; font-size: 18px; font-weight: 800; color: var(--navy);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; line-height: 1.25;
}
.wstep-header h3:focus { outline: none; }
.wstep-help { margin: 6px 0 14px; font-size: 12.5px; line-height: 1.5; color: var(--text-soft); }

/* Niche block (was a <details> summary before the wizard) */
.dominator-block {
  border: 1px solid var(--border);
  background: var(--panel-alt);
  border-radius: var(--radius);
  padding: 14px 16px;
}
/* Empty-state hint shows only while there's no scan result yet. */
.dom-empty-hint { margin-top: 10px; }
.dom-results:not([hidden]) + .dom-empty-hint { display: none; }
.block-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-bottom: 4px;
}
.block-title { font-size: 14px; font-weight: 800; color: var(--teal-600); }

/* Sub-section inside a step (e.g. Ads budget under Costs) */
.substep { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.substep-title { margin: 0 0 2px; font-size: 13px; font-weight: 800; color: var(--navy); }

/* Advanced fold on the review step */
.advanced-fold { margin: 12px 0 4px; }
.advanced-fold-body { margin-top: 6px; }
.advanced-fold-body .substep-title { margin-top: 14px; }
.advanced-fold-body .substep-title:first-child { margin-top: 2px; }

/* Hand-off banner */
.handoff-banner {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 14px; padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 12.5px; line-height: 1.45;
}
.handoff-banner .hb-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.handoff-banner .hb-text strong { font-size: 13px; }
.handoff-banner.is-loading { background: var(--gold-soft); border-color: var(--gold); color: var(--teal-600); }
.handoff-banner.is-success { background: var(--ok-soft); border-color: var(--ok); color: var(--ok-text); }
.handoff-banner.is-error   { background: var(--bad-soft); border-color: var(--bad); color: var(--bad-text); }
.handoff-banner .btn { flex: none; }
.hb-spinner {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--teal-600) 30%, transparent);
  border-top-color: var(--teal-600);
  animation: hbSpin .7s linear infinite;
}
@keyframes hbSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hb-spinner { animation-duration: 2s; } }

/* Review recap */
.review-summary {
  margin: 0 0 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel-alt); overflow: hidden;
}
.review-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 14px; font-size: 13px;
}
.review-row + .review-row { border-top: 1px solid var(--border); }
.review-label { color: var(--text-soft); }
.review-value { font-weight: 700; color: var(--navy); text-align: right; }
.review-note {
  margin: 0; padding: 9px 14px;
  font-size: 11.5px; line-height: 1.45;
  color: var(--warn-text); background: var(--warn-soft);
  border-top: 1px solid var(--border);
}
.review-note a { color: inherit; font-weight: 700; }

/* Wizard navigation footer */
.wizard-nav {
  display: flex; align-items: center; gap: 12px;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.wizard-nav .wizard-back { margin-right: auto; }
.wizard-nav .wizard-next { margin-left: auto; }
.wizard-progress-text { font-size: 12px; font-weight: 600; color: var(--muted); }
.wizard-nav .wizard-back[hidden] { display: none; }
.wizard-nav .wizard-next[hidden] { display: none; }

/* "Try a sample" — kept off the main path, styled as a quiet link not a panel. */
.sample-fold {
  border: none;
  background: transparent;
  padding: 0;
  margin: 14px 0 0;
}
.sample-fold > summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 0;
}
.sample-fold[open] { border: none; }
.sample-fold[open] > summary { margin-bottom: 10px; }
.sample-fold > summary::before { color: var(--muted); }
.sample-row { display: flex; gap: 8px; align-items: center; }
.sample-row select {
  flex: 1; min-width: 0;
  padding: 7px 10px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px;
}

/* Detailed-charts fold — a clear secondary section so the summary stays calm. */
.charts-fold { margin-top: 6px; }
.charts-fold > summary {
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
  padding: 4px 0;
}
.charts-fold-hint {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 6px;
}
.charts-fold-body { margin-top: 12px; }
.charts-fold-body .chart-block:first-child { margin-top: 0; }

/* Inline chart-legend swatches in chart captions (theme-aware, on-brand). */
.lg-organic { color: var(--ok); }
.lg-ppc { color: var(--gold); }

/* ============ CHART ENLARGE (lightbox) ============ */
.chart-block { position: relative; }
.chart-expand-btn {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  font-family: inherit; font-size: 11px; font-weight: 600;
  color: var(--text-soft); background: var(--panel-alt);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.chart-expand-btn:hover { background: var(--chip); border-color: var(--border-strong); color: var(--navy); }
.chart-expand-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.chart-expand-btn svg { width: 13px; height: 13px; }

body.modal-open { overflow: hidden; }
.chart-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.chart-modal[hidden] { display: none; }
.chart-modal-inner {
  display: flex; flex-direction: column;
  width: min(1100px, 96vw);
  height: min(80vh, 720px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.chart-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.chart-modal-head h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--navy); }
.chart-modal-close {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--border);
  color: var(--text-soft); cursor: pointer;
}
.chart-modal-close:hover { background: var(--navy-50); color: var(--navy); }
.chart-modal-close svg { width: 18px; height: 18px; }
.chart-modal-body {
  position: relative;
  flex: 1 1 auto; min-height: 0;
  padding: 18px;
}
@media print { .chart-expand-btn, .chart-modal { display: none !important; } }

/* ============ RECOMMENDATIONS ============ */
.reco-card {
  margin-bottom: 18px;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.reco-title { margin: 0; font-size: 16px; font-weight: 800; color: var(--navy); }
.reco-sub { margin: 3px 0 14px; font-size: 12.5px; color: var(--muted); }
.reco-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.reco-item { display: flex; gap: 12px; align-items: flex-start; }
.reco-num {
  flex: none;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--gold-soft); color: var(--teal-600);
  font-size: 12px; font-weight: 800;
  margin-top: 1px;
}
.reco-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reco-text strong { font-size: 13.5px; font-weight: 700; color: var(--navy); }
.reco-text span { font-size: 12.5px; line-height: 1.5; color: var(--text-soft); }
