:root {
  --phi: 1.618;
  --font-root: 18px;
  --font-display: "Merriweather", Georgia, serif;
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --text-xs: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-base: 1rem;
  --text-md: 1.1875rem;
  --text-lg: 1.618rem;
  --text-xl: 2.058rem;
  --text-xxl: 3.333rem;
  --lh-tight: 1.146;
  --lh-title: 1.236;
  --lh-copy: 1.618;
  --grt-line: 1.618rem;
  --s-2: calc(var(--grt-line) / 4.236);
  --s-1: calc(var(--grt-line) / 2.618);
  --s0: var(--grt-line);
  --s1: calc(var(--grt-line) * 1.618);
  --s2: calc(var(--grt-line) * 2.618);
  --s3: calc(var(--grt-line) * 4.236);
  --s4: calc(var(--grt-line) * 6.854);
  --max: 1180px;
  --measure: 34rem;
  --bg: #f4f7f8;
  --band: #e8f0ef;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #171d1f;
  --ink-soft: #293336;
  --muted: #647277;
  --line: #d4dddf;
  --line-strong: #b8c7c9;
  --teal: #087568;
  --teal-dark: #084d48;
  --blue: #265f9d;
  --amber: #b8621d;
  --amber-soft: #fff3e8;
  --red: #b42318;
  --green: #157f55;
  --shadow-low: 0 1px 2px rgba(23, 29, 31, 0.06);
  --shadow-mid: 0 13px 34px rgba(23, 29, 31, 0.1);
  --shadow-high: 0 34px 89px rgba(23, 29, 31, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  font-size: var(--font-root);
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: clip;
  background:
    linear-gradient(180deg, #fbfcfc 0, var(--bg) 34rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: var(--lh-copy);
  letter-spacing: 0;
}

button,
input,
select {
  font-family: var(--font-ui);
  font-size: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: var(--s0) max(var(--s1), calc((100vw - var(--max)) / 2));
  background: rgba(251, 252, 252, 0.91);
  border-bottom: 1px solid rgba(212, 221, 223, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 47px;
  height: 29px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13);
  font-size: var(--text-sm);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 900;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.2;
  margin-top: 2px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px;
  border: 1px solid rgba(212, 221, 223, 0.76);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.topnav a {
  min-height: 34px;
  padding: 5px var(--s0);
  border-radius: 6px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 24px;
}

.topnav a:hover {
  background: var(--ink);
  color: #fff;
}

main {
  width: min(var(--max), calc(100% - var(--s2)));
  margin: 0 auto;
}

.hero,
.analysis-shell,
.review-band {
  scroll-margin-top: 96px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.618fr) minmax(330px, 1fr);
  gap: clamp(var(--s2), 5vw, var(--s4));
  align-items: center;
  padding: clamp(var(--s2), 7vw, var(--s4)) 0 var(--s3);
}

.hero-copy {
  max-width: 46rem;
}

.eyebrow {
  margin: 0 0 var(--s-1);
  color: var(--teal-dark);
  font-size: var(--text-xs);
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.info-tip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  cursor: help;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  vertical-align: middle;
}

.info-tip:focus {
  outline: 2px solid rgba(8, 117, 104, 0.35);
  outline-offset: 2px;
}

.info-tip::after {
  content: attr(data-tip);
  position: absolute;
  right: 50%;
  bottom: calc(100% + 10px);
  z-index: 30;
  width: min(320px, calc(100vw - 32px));
  padding: var(--s-1) var(--s0);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-high);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateX(50%) translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: normal;
}

.info-tip::before {
  content: "";
  position: absolute;
  right: 50%;
  bottom: calc(100% + 3px);
  z-index: 31;
  width: 10px;
  height: 10px;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transform: translateX(50%) rotate(45deg);
  transition: opacity 120ms ease;
}

.info-tip:hover::after,
.info-tip:focus::after,
.info-tip.is-open::after,
.info-tip:hover::before,
.info-tip:focus::before,
.info-tip.is-open::before {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}

.info-tip:hover::before,
.info-tip:focus::before,
.info-tip.is-open::before {
  transform: translateX(50%) rotate(45deg);
}

.tooltip-label {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.hero h1 {
  max-width: 10.472em;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(var(--text-xl), 6vw, var(--text-xxl));
  font-weight: 900;
  line-height: var(--lh-tight);
  letter-spacing: 0;
}

.lede {
  max-width: var(--measure);
  margin: var(--s1) 0 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: var(--text-md);
  line-height: var(--lh-copy);
}

.url-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-1);
  max-width: 44rem;
  margin-top: var(--s2);
  padding: var(--s-1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-high);
}

.url-form input,
.review-form input {
  width: 100%;
  min-height: 58px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 var(--s0);
  outline: none;
}

.url-form input::placeholder,
.review-form input::placeholder,
.add-product-form input::placeholder {
  color: #89969a;
}

.primary-action,
.secondary-action,
.tab-button,
.product-remove {
  border: 0;
  border-radius: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.primary-action {
  min-height: 58px;
  padding: 0 var(--s1);
  background: var(--teal);
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

.primary-action:hover {
  background: var(--teal-dark);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.secondary-action {
  min-height: 46px;
  padding: 0 var(--s0);
  background: var(--ink);
  color: #fff;
}

.proof-points {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  max-width: 37rem;
  margin-top: var(--s1);
}

.proof-points span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 var(--s0);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 800;
  box-shadow: var(--shadow-low);
}

.preview-panel,
.calibration-panel,
.results-panel,
.opportunity-tile,
.review-band {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-mid);
}

.preview-panel {
  position: relative;
  padding: var(--s1);
  overflow: hidden;
}

.preview-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--teal) 0 61.8%, var(--amber) 61.8% 100%);
}

.preview-header {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 900;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(21, 127, 85, 0.1);
}

.mini-ladder {
  display: grid;
  gap: var(--s-1);
  margin: var(--s1) 0;
}

.mini-ladder div {
  position: relative;
  min-height: 29px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--band);
}

.mini-ladder div::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill);
  background: var(--teal);
}

.mini-ladder div.gap::before {
  background: var(--amber);
}

.mini-ladder span {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  padding-left: var(--s-1);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 900;
}

.preview-panel p {
  max-width: 24rem;
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: var(--lh-copy);
}

.preview-panel strong {
  color: var(--ink);
}

.sequence-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s0);
  margin-bottom: var(--s2);
}

.sequence-band div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-2) var(--s0);
  align-items: start;
  padding: var(--s1);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.sequence-band span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 6px;
  background: #fff;
  color: var(--teal-dark);
  font-weight: 900;
  box-shadow: var(--shadow-low);
}

.sequence-band strong {
  color: var(--ink);
  font-size: var(--text-base);
  line-height: 1.2;
}

.sequence-band p {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.analysis-shell {
  padding: var(--s2) 0 var(--s3);
}

.analysis-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.618fr) minmax(270px, 1fr);
  gap: var(--s1);
  align-items: stretch;
  margin-bottom: var(--s1);
}

.analysis-heading h2,
.panel-heading h2,
.review-band h2 {
  max-width: 100%;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(var(--text-lg), 3vw, var(--text-xl));
  line-height: var(--lh-title);
}

.analysis-heading p:not(.eyebrow),
.review-band p {
  max-width: var(--measure);
  overflow-wrap: anywhere;
  margin: var(--s-1) 0 0;
  color: var(--muted);
  line-height: var(--lh-copy);
}

.opportunity-tile {
  display: grid;
  align-content: center;
  min-width: 270px;
  padding: var(--s1);
  border-left: 5px solid var(--teal);
}

.estimate-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: var(--s0) var(--s1);
  min-width: 0;
}

.estimate-stack > div {
  min-width: 0;
}

.estimate-stack > div > span {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--teal-dark);
  font-size: clamp(var(--text-lg), 2.65vw, var(--text-xl));
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.opportunity-tile small {
  margin-top: var(--s-2);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 900;
  line-height: 1.25;
}

.capture-control {
  display: grid;
  gap: 6px;
  margin-top: var(--s0);
  padding-top: var(--s0);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.2;
}

.capture-control .input-affix {
  width: min(160px, 100%);
  background: #fff;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.618fr) minmax(0, 1fr);
  gap: var(--s1);
  align-items: start;
}

.workspace-grid > *,
.results-panel,
.calibration-panel {
  min-width: 0;
}

.calibration-panel {
  position: sticky;
  top: calc(74px + var(--s0));
  padding: clamp(var(--s0), 2.5vw, var(--s1));
}

.panel-heading {
  margin-bottom: var(--s-1);
}

.calibration-panel .panel-heading h2 {
  font-family: var(--font-ui);
  font-size: var(--text-lg);
  line-height: 1.12;
}

.assumption-grid {
  display: grid;
  gap: 12px;
}

.assumption-grid label,
.add-product-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.2;
}

.assumption-grid input,
.assumption-grid select,
.add-product-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--s-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 800;
  outline-color: var(--teal);
}

.input-affix {
  display: flex;
  align-items: center;
  min-height: 50px;
  padding-inline: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  overflow: hidden;
}

.input-affix:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 117, 104, 0.12);
}

.input-affix input {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: var(--text-md);
  font-weight: 950;
  line-height: 1;
  outline: 0;
}

.input-affix-money input {
  flex: 1 1 auto;
  width: 100%;
}

.input-affix-percent input {
  flex: 0 0 3.1ch;
  width: 3.1ch;
}

.input-prefix,
.input-suffix {
  color: var(--muted);
  font-size: var(--text-md);
  font-weight: 900;
  line-height: 1;
}

.input-prefix {
  margin-right: 7px;
}

.input-suffix {
  margin-left: 3px;
}

.assumption-grid .money-field {
  min-height: 48px;
  color: var(--teal-dark);
  font-size: var(--text-md);
  font-weight: 900;
}

.assumption-grid .money-field::placeholder {
  color: rgba(8, 77, 72, 0.45);
}

.money-box-control {
  position: relative;
  min-width: 0;
  margin-top: 2px;
  padding: 10px;
  border: 1px solid rgba(184, 117, 26, 0.45);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 246, 218, 0.72), rgba(255, 255, 255, 0.38)),
    var(--surface);
  box-shadow:
    0 0 0 3px rgba(212, 158, 56, 0.12),
    0 13px 34px rgba(184, 117, 26, 0.1);
}

.money-box-control::after {
  content: none;
  display: none;
}

.money-box-control .tooltip-label {
  color: #7a4a11;
}

.money-box-control legend {
  margin-bottom: 8px;
  padding: 0;
}

.pareto-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pareto-card {
  position: relative;
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid rgba(184, 117, 26, 0.28);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.72);
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}

.pareto-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.pareto-card span,
.pareto-card small {
  position: relative;
  z-index: 1;
}

.pareto-card span {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 950;
}

.pareto-card small {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1.15;
}

.pareto-card:has(input:checked) {
  border-color: #b8751a;
  background: linear-gradient(180deg, #ffe8a6, #fff4cd);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.8),
    0 8px 18px rgba(184, 117, 26, 0.18);
}

.pareto-card:has(input:checked)::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(138, 84, 18, 0.22);
  border-radius: 6px;
  pointer-events: none;
}

.pareto-card:has(input:checked) span {
  color: #5c3609;
}

.pareto-card:hover,
.pareto-card:has(input:focus-visible) {
  border-color: #c98922;
  box-shadow: 0 0 0 3px rgba(212, 158, 56, 0.16);
}

.derived-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-1);
  margin-top: 16px;
  padding: var(--s-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--band);
}

.derived-box span {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.25;
}

.derived-box strong {
  color: var(--ink);
  font-size: var(--text-md);
  line-height: 1;
}

.import-note {
  margin-top: var(--s0);
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.45;
  white-space: pre-line;
}

.results-panel {
  overflow: visible;
}

.tabbar {
  display: flex;
  gap: var(--s-1);
  padding: var(--s-1);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.tab-button {
  min-height: 42px;
  padding: 0 var(--s0);
  background: transparent;
  color: var(--muted);
  font-size: var(--text-sm);
}

.tab-button.is-active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 0 0 1px var(--ink);
}

.tab-view {
  padding: var(--s1);
  min-width: 0;
}

.metric-row {
  display: grid;
  grid-template-columns: 1.618fr 1fr 1.618fr;
  gap: var(--s0);
}

.metric-row div,
.audit-card,
.formula-card {
  min-height: 105px;
  padding: var(--s0);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.metric-row div > span {
  display: block;
  color: var(--ink);
  font-size: clamp(var(--text-lg), 3vw, var(--text-xl));
  font-weight: 950;
  line-height: 1;
}

.opportunity-tile .info-tip,
.metric-row .info-tip {
  display: inline-grid;
  width: 18px;
  height: 18px;
  color: var(--teal-dark);
  font-size: 12px;
  line-height: 1;
}

.metric-row small {
  display: block;
  margin-top: var(--s-1);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 900;
  line-height: 1.25;
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--s0);
  min-width: 0;
}

.audit-card strong {
  display: block;
  margin-bottom: var(--s-1);
  color: var(--ink);
  font-size: var(--text-sm);
  text-transform: uppercase;
}

.audit-card dl {
  display: grid;
  gap: var(--s-2);
  margin: 0;
}

.audit-card div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  border-bottom: 1px solid rgba(212, 221, 223, 0.65);
}

.audit-card div:last-child {
  border-bottom: 0;
}

.audit-card dt {
  color: var(--muted);
  font-weight: 800;
  min-width: 0;
}

.audit-card dd {
  margin: 0;
  color: var(--ink);
  font-weight: 950;
  text-align: left;
  white-space: normal;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
  gap: var(--s0);
  margin-top: var(--s0);
  min-width: 0;
}

.formula-card {
  min-height: 0;
  min-width: 0;
}

.formula-card strong {
  display: block;
  margin-bottom: var(--s-1);
  color: var(--teal-dark);
}

.formula-card code {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-sm);
  line-height: 1.55;
  white-space: pre;
}

.diagnosis-box {
  margin-top: var(--s0);
  padding: var(--s1);
  border: 1px solid #f1c59c;
  border-radius: 8px;
  background: var(--amber-soft);
}

.diagnosis-box h3 {
  max-width: 24em;
  margin: 0;
  color: #432509;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(var(--text-md), 2.5vw, var(--text-lg));
  line-height: var(--lh-title);
}

.diagnosis-box p:last-child {
  max-width: var(--measure);
  margin: var(--s-1) 0 0;
  color: #70400d;
  line-height: var(--lh-copy);
}

.curve-card {
  margin-top: var(--s0);
  padding: var(--s1);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s0);
  margin-bottom: var(--s0);
}

.section-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-md);
  line-height: 1.25;
}

.section-heading span {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 900;
  line-height: 1.25;
}

.curve-chart {
  min-height: 288px;
}

.curve-chart svg {
  display: block;
  width: 100%;
  min-height: 288px;
}

.axis-label,
.point-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tier-list,
.move-list {
  display: grid;
  gap: var(--s0);
}

.ladder-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s0);
  align-items: center;
  padding: var(--s-1) var(--s0);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.35;
}

.ladder-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ladder-legend .legend-note {
  flex-basis: 100%;
  color: var(--ink-soft);
}

.legend-swatch {
  display: inline-block;
  width: 18px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal);
}

.legend-swatch.is-gap {
  background: var(--amber);
}

.legend-swatch.is-thin {
  background: var(--blue);
}

.tier-row,
.move-row {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1.618fr) minmax(7rem, 1fr);
  gap: var(--s0);
  align-items: center;
  padding: var(--s0);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.tier-label strong,
.move-row strong {
  display: block;
  color: var(--ink);
  line-height: 1.25;
}

.tier-label span,
.move-row span,
.tier-products,
.tier-impact {
  color: var(--muted);
  font-size: var(--text-sm);
}

.tier-meter {
  position: relative;
  min-height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--band);
}

.tier-meter span {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--width);
  min-width: 4px;
  background: var(--teal);
}

.tier-meter-wrap small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 900;
  line-height: 1.25;
}

.tier-row.is-gap .tier-meter span {
  background: var(--amber);
}

.tier-row.is-thin .tier-meter span {
  background: var(--blue);
}

.tier-products {
  margin-top: var(--s-1);
  line-height: 1.35;
}

.tier-impact {
  text-align: right;
  font-weight: 900;
}

.tier-impact strong {
  display: block;
  color: var(--ink);
  font-size: var(--text-base);
}

.add-product-form {
  display: grid;
  grid-template-columns: minmax(0, 1.618fr) minmax(115px, 1fr) auto;
  gap: var(--s-1);
  align-items: end;
  margin-top: var(--s1);
  padding: var(--s0);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--band);
}

.product-table {
  display: grid;
  gap: var(--s-1);
  margin-top: var(--s0);
}

.product-row {
  display: grid;
  grid-template-columns: minmax(0, 1.618fr) minmax(90px, 1fr) auto;
  gap: var(--s-1);
  align-items: center;
  min-height: 45px;
  padding: var(--s-1) var(--s0);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-row small {
  color: var(--muted);
  font-weight: 900;
}

.product-remove {
  width: 34px;
  height: 34px;
  background: #fde8e5;
  color: var(--red);
}

.move-row {
  grid-template-columns: 47px minmax(0, 1.618fr) minmax(7rem, 1fr);
  align-items: start;
}

.move-note {
  padding: var(--s-1) var(--s0);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--band);
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.45;
}

.move-number {
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 950;
}

.move-row p {
  max-width: var(--measure);
  margin: var(--s-2) 0 0;
  color: var(--muted);
  line-height: var(--lh-copy);
}

.move-impact {
  text-align: right;
  color: var(--teal-dark);
  font-size: var(--text-md);
  font-weight: 950;
  line-height: 1.2;
}

.prompt-section {
  display: grid;
  grid-template-columns: minmax(0, 0.618fr) minmax(0, 1fr);
  gap: var(--s1);
  align-items: start;
  margin: var(--s1) 0;
  padding: var(--s2);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-mid);
}

.prompt-intro h2 {
  max-width: 14em;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(var(--text-lg), 3vw, var(--text-xl));
  font-weight: 900;
  line-height: var(--lh-title);
}

.prompt-intro p:not(.eyebrow) {
  max-width: var(--measure);
  margin: var(--s-1) 0 0;
  color: var(--muted);
}

.prompt-panel {
  min-width: 0;
}

.prompt-panel .section-heading {
  align-items: center;
}

.prompt-textarea {
  width: 100%;
  min-height: 28rem;
  resize: vertical;
  padding: var(--s0);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.55;
  outline-color: var(--teal);
}

.prompt-panel small {
  display: block;
  min-height: 20px;
  margin-top: var(--s-2);
  color: var(--teal-dark);
  font-size: var(--text-sm);
  font-weight: 900;
}

.review-band {
  display: grid;
  grid-template-columns: minmax(0, 1.618fr) minmax(320px, 1fr);
  gap: var(--s2);
  align-items: center;
  margin: var(--s1) 0 var(--s3);
  padding: var(--s2);
  border-left: 5px solid var(--blue);
}

.review-form {
  display: grid;
  gap: var(--s-1);
}

.review-form input {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.review-form small {
  min-height: 20px;
  color: var(--teal-dark);
  font-size: var(--text-sm);
  font-weight: 900;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: var(--s1);
  width: min(var(--max), calc(100% - var(--s2)));
  margin: 0 auto;
  padding: var(--s1) 0 var(--s2);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-sm);
}

@media (max-width: 980px) {
  .hero,
  .workspace-grid,
  .analysis-heading,
  .prompt-section,
  .review-band {
    grid-template-columns: 1fr;
  }

  .analysis-heading h2 {
    font-size: clamp(var(--text-xl), 7vw, var(--text-xxl));
    overflow-wrap: anywhere;
  }

  .calibration-panel {
    position: static;
    max-width: 42rem;
    margin-inline: auto;
  }

  .sequence-band,
  .metric-row,
  .audit-grid,
  .formula-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  html {
    font-size: 16px;
  }

  main,
  .footer {
    width: min(100% - var(--s1), var(--max));
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--s-1);
    padding-inline: var(--s0);
  }

  .topnav {
    width: 100%;
    justify-content: space-between;
  }

  .topnav a {
    flex: 1;
    text-align: center;
  }

  .hero {
    padding-top: var(--s2);
  }

  .hero h1 {
    font-size: clamp(2rem, 11vw, 2.618rem);
  }

  .lede {
    font-size: var(--text-base);
  }

  .url-form,
  .add-product-form,
  .tier-row,
  .move-row,
  .product-row {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    padding: var(--s0);
  }

  .curve-card {
    overflow-x: auto;
  }

  .curve-chart {
    min-width: 640px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .tier-impact,
  .move-impact {
    text-align: left;
  }

  .tabbar {
    overflow-x: auto;
  }

  .tab-button {
    flex: 1;
  }

  .info-tip::after {
    position: fixed;
    inset: 112px var(--s0) auto var(--s0);
    width: auto;
    max-width: none;
    transform: translateY(4px);
  }

  .info-tip::before {
    display: none;
  }

  .info-tip:hover::after,
  .info-tip:focus::after,
  .info-tip.is-open::after {
    transform: translateY(0);
  }

  .review-band {
    padding: var(--s1);
  }

  .footer {
    flex-direction: column;
  }
}

/* ───────── HowToMoveTheNeedle global nav + footer (ported for brand consistency) ───────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.09);
  padding: 0 40px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: #0f1117;
  text-decoration: none;
  line-height: 1;
}
.nav-logo span { color: #1a4fdb; }
.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: #5a5f72;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}
.nav-links a:hover { color: #0f1117; }
.nav-cta {
  background: #1a4fdb;
  color: #ffffff;
  padding: 9px 22px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.15s;
}
.nav-cta:hover { background: #1240c2; transform: translateY(-1px); }

footer {
  background: #f7f8fc;
  border-top: 1px solid rgba(0, 0, 0, 0.09);
  padding: 60px 40px 40px;
}
.footer-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 60px;
  padding-bottom: 50px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.09);
}
.footer-brand .nav-logo { font-size: 1.6rem; display: block; margin-bottom: 16px; }
.footer-brand p {
  color: #5a5f72;
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 24px;
}
.footer-social { display: flex; gap: 10px; }
.social-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.09);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a5f72;
  font-size: 0.8rem;
  text-decoration: none;
  font-weight: 700;
  transition: border-color 0.2s, color 0.2s;
}
.social-icon:hover { border-color: #1a4fdb; color: #1a4fdb; }
.footer-col h4 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #0f1117;
  margin-bottom: 18px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; }
.footer-col a {
  color: #5a5f72;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}
.footer-col a:hover { color: #0f1117; }
.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: #5a5f72;
}
.footer-bottom-links { display: flex; gap: 24px; }
.footer-bottom-links a { color: #5a5f72; text-decoration: none; transition: color 0.2s; }
.footer-bottom-links a:hover { color: #0f1117; }

@media (max-width: 900px) {
  nav { padding: 0 20px; }
  .nav-links { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px; }
  .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
}
