/* ── CSS Variables ─────────────────────────────────────── */
:root {
  --purple-900: #3d1a78;
  --purple-700: #5b21b6;
  --purple-600: #6d28d9;
  --purple-500: #7c3aed;
  --purple-100: #ede9fe;
  --purple-50:  #f5f3ff;
  --gold-500:   #f59e0b;
  --gold-400:   #fbbf24;
  --gold-100:   #fef3c7;
  --gray-900:   #111827;
  --gray-700:   #374151;
  --gray-500:   #6b7280;
  --gray-300:   #d1d5db;
  --gray-100:   #f3f4f6;
  --gray-50:    #f9fafb;
  --white:      #ffffff;

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --shadow-sm:  0 1px 3px rgba(93,33,182,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(93,33,182,0.10), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg:  0 8px 32px rgba(93,33,182,0.14), 0 4px 12px rgba(0,0,0,0.08);

  --nav-height: 72px;
  --header-height: 60px;
  --progress-height: 52px;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.6;
  padding-bottom: var(--nav-height);
}
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Container ──────────────────────────────────────────── */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  height: var(--header-height);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--purple-700);
  letter-spacing: -0.01em;
}
.header-tagline {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Progress Bar ───────────────────────────────────────── */
.progress-bar-wrapper {
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  height: var(--progress-height);
  display: flex;
  align-items: center;
  position: sticky;
  top: var(--header-height);
  z-index: 99;
}
.progress-bar-wrapper .container {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.progress-track {
  flex: 1;
  height: 6px;
  background: var(--gray-100);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple-700), var(--gold-500));
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 14.3%; /* 1/7 */
}
.progress-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--purple-700);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

/* ── Steps ──────────────────────────────────────────────── */
.calculator-main {
  padding: 40px 0 32px;
}
.step {
  display: none;
  animation: fadeIn 0.25s ease-out;
}
.step.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Step Header ────────────────────────────────────────── */
.step-header {
  margin-bottom: 36px;
}
.step-badge {
  display: inline-block;
  background: var(--purple-100);
  color: var(--purple-700);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 99px;
  margin-bottom: 12px;
}
.step-header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
  margin-bottom: 8px;
}
.step-subtitle {
  font-size: 1rem;
  color: var(--gray-500);
  font-weight: 400;
}

/* ── Framing Narrative ──────────────────────────────────── */
.framing-narrative {
  background: var(--purple-50);
  border-left: 3px solid var(--purple-500);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 18px 22px;
  margin-bottom: 32px;
}
.framing-narrative p {
  font-size: 0.93rem;
  color: var(--gray-700);
  line-height: 1.7;
}

/* ── Sub-process Tables ─────────────────────────────────── */
.subprocess-table-wrapper {
  margin-bottom: 36px;
}
.table-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray-500);
  margin-bottom: 10px;
}
.subprocess-table {
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.subprocess-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.subprocess-table thead tr {
  background: var(--purple-900);
  color: var(--white);
}
.subprocess-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.subprocess-table tbody tr {
  border-top: 1px solid var(--gray-100);
  transition: background 0.15s;
}
.subprocess-table tbody tr:nth-child(even) {
  background: var(--gray-50);
}
.subprocess-table tbody tr:hover {
  background: var(--purple-50);
}
.subprocess-table tbody td {
  padding: 10px 16px;
  color: var(--gray-700);
}
.subprocess-table tbody td:first-child {
  font-weight: 500;
  color: var(--gray-900);
}
.tech-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.tech-badge.deterministic {
  background: #dbeafe;
  color: #1e40af;
}
.tech-badge.ml {
  background: #d1fae5;
  color: #065f46;
}
.tech-badge.genai {
  background: var(--gold-100);
  color: #92400e;
}

/* ── Form Grid ──────────────────────────────────────────── */
.form-grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-fields {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Form Fields ────────────────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field label,
.slider-field label {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--gray-900);
}
.helper-text {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 2px;
  line-height: 1.5;
}
.optional-label {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--gray-500);
}
.required-marker {
  color: #dc2626;
}
.error-msg {
  font-size: 0.8rem;
  color: #dc2626;
  font-weight: 500;
}

/* ── Select Inputs ──────────────────────────────────────── */
select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 10px 36px 10px 12px;
  font-size: 0.92rem;
  color: var(--gray-900);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
select:focus {
  outline: none;
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
select option[value=""] { color: var(--gray-500); }

/* ── Number Inputs ──────────────────────────────────────── */
input[type="number"],
input[type="text"],
input[type="email"] {
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.92rem;
  color: var(--gray-900);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--white);
}
input[type="number"]:focus,
input[type="text"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
input::placeholder { color: var(--gray-300); }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── Currency Field ─────────────────────────────────────── */
.currency-input {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.currency-input:focus-within {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.currency-symbol {
  padding: 10px 12px;
  background: var(--gray-50);
  border-right: 1.5px solid var(--gray-300);
  color: var(--gray-500);
  font-weight: 600;
  font-size: 0.92rem;
  user-select: none;
}
.currency-input input {
  border: none;
  border-radius: 0;
  flex: 1;
  padding: 10px 12px;
  box-shadow: none !important;
}
.currency-input input:focus { outline: none; }

/* ── Sliders ────────────────────────────────────────────── */
.slider-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.slider-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}
.slider-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--purple-700);
  min-width: 130px;
  text-align: right;
  white-space: nowrap;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--gray-200, #e5e7eb);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--purple-700);
  border: 3px solid var(--white);
  box-shadow: 0 2px 6px rgba(93,33,182,0.30);
  transition: transform 0.15s, box-shadow 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(93,33,182,0.40);
}
input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.2);
}
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--purple-700);
  border: 3px solid var(--white);
  box-shadow: 0 2px 6px rgba(93,33,182,0.30);
  cursor: pointer;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--gray-400, #9ca3af);
  font-weight: 500;
  margin-top: 2px;
}

/* ── Radio Cards ────────────────────────────────────────── */
.radio-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.radio-cards.stacked {
  flex-direction: column;
  gap: 8px;
}
.radio-card {
  flex: 1;
  min-width: 140px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  background: var(--white);
  user-select: none;
}
.radio-cards.stacked .radio-card {
  flex: none;
  min-width: unset;
}
.radio-card span {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gray-700);
  display: block;
  line-height: 1.4;
}
.radio-card:hover {
  border-color: var(--purple-500);
  background: var(--purple-50);
}
.radio-card.selected {
  border-color: var(--purple-700);
  background: var(--purple-100);
  box-shadow: 0 0 0 3px rgba(93, 33, 182, 0.12);
}
.radio-card.selected span {
  color: var(--purple-900);
  font-weight: 600;
}

/* ── Checkbox Cards ─────────────────────────────────────── */
.checkbox-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.checkbox-card {
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--white);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  user-select: none;
}
.checkbox-card span:first-child {
  font-size: 1rem;
  line-height: 1;
  margin-top: 1px;
  flex-shrink: 0;
  color: var(--gray-400, #9ca3af);
}
.checkbox-card span:last-child {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
  line-height: 1.4;
}
.checkbox-card:hover {
  border-color: var(--purple-500);
  background: var(--purple-50);
}
.checkbox-card.checked {
  border-color: var(--purple-700);
  background: var(--purple-100);
}
.checkbox-card.checked span:first-child {
  color: var(--purple-700);
}
.checkbox-card.checked span:last-child {
  color: var(--purple-900);
  font-weight: 600;
}

/* ── Email Capture ──────────────────────────────────────── */
.email-capture-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}
.email-value-props {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.value-prop-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.vp-icon {
  font-size: 1.1rem;
  color: var(--gold-500);
  flex-shrink: 0;
  margin-top: 2px;
  line-height: 1;
}
.value-prop-item strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-900);
  display: block;
  margin-bottom: 3px;
}
.value-prop-item p {
  font-size: 0.82rem;
  color: var(--gray-500);
  line-height: 1.5;
}
.email-form-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.privacy-note {
  font-size: 0.75rem;
  color: var(--gray-400, #9ca3af);
  text-align: center;
  margin-top: -8px;
}

/* ── Results Page ───────────────────────────────────────── */
.results-header {
  background: linear-gradient(135deg, var(--purple-900) 0%, var(--purple-700) 100%);
  border-radius: var(--radius-lg);
  padding: 36px 36px 32px;
  color: var(--white);
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}
.results-header::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}
.results-greeting {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.75;
  margin-bottom: 6px;
}
.results-header h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.25;
}
.results-score-row {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 99px;
  padding: 8px 20px;
  font-size: 1rem;
  font-weight: 700;
}
.score-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold-400);
}
.savings-range-chip {
  background: var(--gold-500);
  color: var(--gray-900);
  border-radius: 99px;
  padding: 8px 20px;
  font-size: 0.92rem;
  font-weight: 700;
}

.results-section {
  margin-bottom: 36px;
}
.results-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--purple-100);
}
.workflow-result-block {
  background: var(--white);
  border: 1.5px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
}
.workflow-result-header {
  background: var(--gray-50);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-100);
}
.workflow-result-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gray-900);
}
.automation-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  text-transform: capitalize;
}
.automation-tag.mostly-manual { background: #fee2e2; color: #991b1b; }
.automation-tag.some-automation { background: #fef3c7; color: #92400e; }
.automation-tag.significantly-automated { background: #d1fae5; color: #065f46; }
.automation-tag.not-specified { background: var(--gray-100); color: var(--gray-500); }

.mismatch-flags {
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.mismatch-flag-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c2410c;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mismatch-flag-item {
  font-size: 0.87rem;
  color: #7c2d12;
  padding: 8px 0;
  border-top: 1px solid #fed7aa;
  line-height: 1.55;
}
.mismatch-flag-item:first-of-type { border-top: none; }

.conversion-gap-flag {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.conversion-gap-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #1e40af;
  margin-bottom: 8px;
}
.conversion-gap-flag p {
  font-size: 0.87rem;
  color: #1e3a8a;
  line-height: 1.6;
}

/* ── Upgrade CTA ────────────────────────────────────────── */
.upgrade-cta {
  background: linear-gradient(135deg, var(--purple-900), var(--purple-700));
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  color: var(--white);
  text-align: center;
  margin-top: 40px;
}
.upgrade-cta h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.upgrade-cta p {
  font-size: 0.93rem;
  opacity: 0.85;
  max-width: 480px;
  margin: 0 auto 24px;
  line-height: 1.65;
}
.upgrade-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto 28px;
  text-align: left;
}
.upgrade-feature {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.84rem;
  opacity: 0.9;
}
.upgrade-feature::before {
  content: '✓';
  color: var(--gold-400);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.upgrade-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold-400);
  margin-bottom: 20px;
  line-height: 1;
}
.upgrade-price span {
  font-size: 1rem;
  opacity: 0.7;
  font-weight: 400;
}
.btn-upgrade {
  display: inline-block;
  background: var(--gold-500);
  color: var(--gray-900);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 40px;
  border-radius: 99px;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.15s;
  font-family: inherit;
}
.btn-upgrade:hover {
  background: var(--gold-400);
  transform: translateY(-1px);
}

/* ── Bottom Nav ─────────────────────────────────────────── */
.step-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--white);
  border-top: 1px solid var(--gray-100);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  z-index: 200;
}
.step-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}
.nav-step-label {
  font-size: 0.8rem;
  color: var(--gray-400, #9ca3af);
  font-weight: 500;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 99px;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 24px;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--purple-700);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--purple-900);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(93,33,182,0.30);
}
.btn-ghost {
  background: transparent;
  color: var(--gray-500);
  border: 1.5px solid var(--gray-200, #e5e7eb);
}
.btn-ghost:hover {
  color: var(--gray-700);
  border-color: var(--gray-300);
  background: var(--gray-50);
}
.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ── Results Back ───────────────────────────────────────── */
#step-results .results-disclaimer {
  font-size: 0.78rem;
  color: var(--gray-400, #9ca3af);
  text-align: center;
  margin-top: 16px;
  line-height: 1.6;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .form-grid.two-col {
    grid-template-columns: 1fr;
  }
  .email-capture-layout {
    grid-template-columns: 1fr;
  }
  .checkbox-cards {
    grid-template-columns: 1fr;
  }
  .upgrade-features {
    grid-template-columns: 1fr;
  }
  .radio-cards:not(.stacked) {
    flex-direction: column;
  }
  .radio-card {
    min-width: unset;
  }
  .results-score-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .upgrade-cta {
    padding: 28px 20px;
  }
  .container {
    padding: 0 16px;
  }
  .slider-value {
    min-width: 110px;
  }
}
