:root {
  --green-900: #063d22;
  --green-800: #0d5e31;
  --green-700: #177a3b;
  --green-600: #208d43;
  --green-500: #2f9e4d;
  --green-100: #dff5e7;
  --green-50: #f1fbf5;
  --ink-950: #0c1611;
  --ink-900: #14221b;
  --ink-800: #24342b;
  --ink-700: #33443a;
  --ink-600: #536359;
  --ink-500: #66766c;
  --line: #d8e3dc;
  --surface: #ffffff;
  --surface-soft: #f7faf8;
  --amber-600: #c56a18;
  --amber-100: #fff1d8;
  --blue-600: #2563eb;
  --blue-100: #e9f0ff;
  --danger-600: #c2410c;
  --danger-100: #ffedd5;
  --shadow: 0 18px 48px rgba(12, 22, 17, 0.09);
  --radius: 18px;
  --radius-sm: 12px;
  --max: 1180px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 112px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fbf9 0%, #eef5f1 100%);
  color: var(--ink-900);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.result-open {
  background: linear-gradient(180deg, #f8fbf9 0%, #f2f7f4 52%, #edf4f0 100%);
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(216, 227, 220, 0.76);
  background: rgba(248, 251, 249, 0.9);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 15px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  color: var(--ink-900);
  text-decoration: none;
}

.brand img {
  width: clamp(154px, 22vw, 238px);
  height: auto;
  display: block;
}

.brand-divider {
  width: 1px;
  height: 34px;
  background: var(--line);
}

.brand small {
  display: block;
  max-width: 210px;
  color: var(--ink-600);
  font-size: 0.82rem;
  line-height: 1.25;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.55fr);
  gap: 22px;
  align-items: center;
  margin-bottom: 20px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--green-800);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-600);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 700px;
  margin-bottom: 10px;
  color: var(--ink-950);
  font-size: clamp(1.86rem, 4vw, 3.65rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 560px;
  margin: 0;
  color: var(--ink-600);
  font-size: clamp(0.98rem, 1.5vw, 1.08rem);
  line-height: 1.5;
}

.proof-strip {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 28px rgba(12, 22, 17, 0.05);
}

.proof-strip strong {
  color: var(--ink-950);
  font-size: 0.98rem;
}

.proof-strip span {
  color: var(--ink-600);
  font-size: 0.9rem;
  line-height: 1.38;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(318px, 0.7fr);
  gap: 24px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.calculator-panel {
  overflow: hidden;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
  background: #f9fcfa;
}

.stepper li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 17px 18px;
  color: var(--ink-500);
  border-right: 1px solid var(--line);
  font-weight: 800;
}

.stepper li:last-child {
  border-right: 0;
}

.stepper span {
  display: inline-grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e8f0eb;
  color: var(--ink-700);
  font-size: 0.88rem;
}

.stepper strong {
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.stepper li.is-current {
  color: var(--green-900);
  background: var(--green-50);
}

.stepper li.is-current span,
.stepper li.is-done span {
  background: var(--green-600);
  color: #fff;
}

.form {
  padding: clamp(20px, 4vw, 34px);
}

.form-step {
  display: none;
}

.form-step.is-active {
  display: block;
  animation: fadeIn 180ms ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.step-title h2 {
  margin-bottom: 8px;
  color: var(--ink-950);
  font-size: clamp(1.34rem, 3vw, 1.84rem);
  line-height: 1.08;
}

.step-title p {
  max-width: 640px;
  margin: 0;
  color: var(--ink-600);
  line-height: 1.55;
}

.badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-900);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field {
  min-width: 0;
  scroll-margin-top: 112px;
}

.field.is-wide {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin: 0 0 8px;
  color: var(--ink-900);
  font-size: 0.95rem;
  font-weight: 800;
}

.optional {
  color: var(--ink-500);
  font-weight: 650;
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 52px;
  border: 1px solid #cbd9d1;
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input-shell:focus-within {
  border-color: var(--green-600);
  box-shadow: 0 0 0 4px rgba(32, 141, 67, 0.13);
}

.input-shell.has-error {
  border-color: var(--danger-600);
  box-shadow: 0 0 0 4px rgba(194, 65, 12, 0.12);
}

.input-prefix,
.input-suffix {
  flex: 0 0 auto;
  padding: 0 13px;
  color: var(--ink-600);
  font-weight: 800;
  white-space: nowrap;
}

.input-prefix {
  border-right: 1px solid #e4ece7;
}

.input-suffix {
  border-left: 1px solid #e4ece7;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  border: 0;
  outline: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-950);
  padding: 0 13px;
  font-size: 1rem;
}

input::placeholder {
  color: #98a69e;
  opacity: 1;
}

.hint,
.field-error {
  min-height: 18px;
  margin: 7px 0 0;
  font-size: 0.84rem;
  line-height: 1.35;
}

.hint {
  color: var(--ink-500);
}

.field-error {
  color: var(--danger-600);
  font-weight: 750;
}

.range-card {
  padding: 16px;
  border: 1px solid #cbd9d1;
  border-radius: var(--radius-sm);
  background: #fff;
}

.range-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  color: var(--ink-900);
  font-weight: 800;
}

.range-value {
  color: var(--green-800);
  white-space: nowrap;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green-600);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--ink-500);
  font-size: 0.76rem;
  font-weight: 700;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, color 140ms ease;
  user-select: none;
  white-space: nowrap;
}

.button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible {
  outline: 4px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

.button-primary {
  background: var(--green-700);
  color: #fff;
  box-shadow: 0 14px 26px rgba(23, 122, 59, 0.22);
}

.button-primary:hover {
  background: var(--green-800);
}

.button-secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-800);
}

.button-secondary:hover {
  background: #f5faf7;
}

.button-ghost {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-700);
}

.button-ghost:hover {
  border-color: var(--line);
  background: #fff;
}

.preview-panel {
  position: sticky;
  top: 92px;
  padding: 24px;
}

.preview-panel h2 {
  margin-bottom: 8px;
  color: var(--ink-950);
  font-size: 1.2rem;
}

.preview-panel > p {
  margin-bottom: 20px;
  color: var(--ink-600);
  line-height: 1.45;
}

.preview-total {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--ink-950);
  color: #fff;
}

.preview-total span {
  display: block;
  margin-bottom: 8px;
  color: #aee5bd;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.preview-total strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  line-height: 1;
}

.preview-total small {
  display: block;
  margin-top: 10px;
  color: #d7e6dd;
  line-height: 1.38;
}

.preview-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-600);
  font-size: 0.93rem;
}

.preview-item:last-child {
  border-bottom: 0;
}

.preview-item strong {
  color: var(--ink-950);
  text-align: right;
  overflow-wrap: anywhere;
}

.confidence {
  margin-top: 18px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--green-50);
  color: var(--green-900);
  font-size: 0.92rem;
  line-height: 1.45;
  font-weight: 720;
}

.result-section {
  margin-top: 28px;
  scroll-margin-top: 112px;
}

.result-section[hidden] {
  display: none;
}

.result-hero {
  overflow: hidden;
  border: 1px solid rgba(6, 61, 34, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(6, 61, 34, 0.97), rgba(20, 34, 27, 0.98)),
    var(--green-900);
  color: #fff;
  box-shadow: var(--shadow);
}

.result-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 26px;
  padding: clamp(24px, 5vw, 42px);
}

.result-label {
  margin-bottom: 14px;
  color: #aee5bd;
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-hero h2 {
  max-width: 740px;
  margin-bottom: 16px;
  color: #fff;
  font-size: clamp(1.78rem, 4vw, 3.32rem);
  line-height: 1.03;
}

.result-hero h2 strong {
  display: block;
  margin-top: 8px;
  color: #bdf0c9;
  overflow-wrap: anywhere;
}

.result-hero p {
  max-width: 700px;
  margin-bottom: 0;
  color: #dbece1;
  font-size: 1.02rem;
  line-height: 1.6;
}

.decision-box {
  align-self: stretch;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(189, 240, 201, 0.26);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.decision-box span {
  color: #bdf0c9;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.decision-box strong {
  color: #fff;
  font-size: clamp(1.55rem, 3vw, 2.22rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.decision-box small {
  color: #dbece1;
  line-height: 1.45;
}

.result-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(318px, 0.46fr);
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  min-height: 134px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 32px rgba(12, 22, 17, 0.06);
}

.metric span {
  display: block;
  margin-bottom: 10px;
  color: var(--ink-600);
  font-size: 0.84rem;
  font-weight: 850;
}

.metric strong {
  display: block;
  color: var(--ink-950);
  font-size: clamp(1.28rem, 3vw, 1.86rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--ink-500);
  line-height: 1.35;
}

.story-panel,
.share-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 32px rgba(12, 22, 17, 0.06);
}

.story-panel h3,
.share-panel h3 {
  margin-bottom: 12px;
  color: var(--ink-950);
  font-size: 1.14rem;
}

.story-panel p,
.share-panel p {
  color: var(--ink-600);
  line-height: 1.55;
}

.result-aside {
  display: grid;
  gap: 16px;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  width: fit-content;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--danger-100);
  color: var(--danger-600);
  font-size: 0.79rem;
  font-weight: 900;
  text-transform: uppercase;
}

.insight-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.insight-list li {
  padding-left: 18px;
  border-left: 4px solid var(--green-600);
  color: var(--ink-700);
  line-height: 1.48;
}

.comparison {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-700);
  font-size: 0.84rem;
  font-weight: 850;
}

.bar-track {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: #edf3ef;
}

.bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green-600);
  transition: width 300ms ease;
}

.bar-fill.is-price {
  background: var(--amber-600);
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

.share-url {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink-700);
  padding: 10px 11px;
  font-size: 0.82rem;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--ink-950);
  color: #fff;
  box-shadow: 0 18px 40px rgba(12, 22, 17, 0.22);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

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

@media (max-width: 980px) {
  .intro,
  .app-grid,
  .result-hero-inner,
  .result-body {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  .proof-strip {
    max-width: 680px;
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-divider,
  .brand small,
  .topbar-actions {
    display: none;
  }

  .main {
    width: min(100% - 22px, var(--max));
    padding-top: 24px;
  }

  .stepper {
    grid-template-columns: 1fr;
  }

  .stepper li {
    padding: 13px 15px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stepper li:last-child {
    border-bottom: 0;
  }

  .step-title {
    flex-direction: column;
  }

  .fields-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .button {
    width: 100%;
  }

  .result-hero-inner {
    padding: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  *,
  *::before,
  *::after {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    background: #fff !important;
    color: #0c1611 !important;
  }

  .topbar,
  .intro,
  .app-grid,
  .share-panel,
  .toast {
    display: none !important;
  }

  .main {
    width: 100%;
    padding: 0;
  }

  .result-section {
    display: block !important;
    margin: 0;
  }

  .result-body {
    grid-template-columns: 1fr !important;
  }

  .result-hero {
    background: #fff !important;
    border: 1px solid #b8cfc1 !important;
    color: #0c1611 !important;
  }

  .result-hero-inner {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 22px !important;
  }

  .result-label,
  .decision-box span {
    color: #177a3b !important;
  }

  .result-hero h2,
  .decision-box strong {
    color: #14221b !important;
  }

  .result-hero h2 {
    font-size: 26pt !important;
    line-height: 1.12 !important;
  }

  .result-hero h2 strong {
    color: #208d43 !important;
  }

  .result-hero p,
  .decision-box small {
    color: #33443a !important;
  }

  .decision-box {
    background: #fff !important;
    border: 1px solid #d8e3dc !important;
  }

  .metric,
  .story-panel {
    break-inside: avoid;
    color: #0c1611 !important;
  }

  .metric span,
  .metric small,
  .story-panel p,
  .insight-list li {
    color: #33443a !important;
  }

  .metric strong,
  .story-panel h3 {
    color: #0c1611 !important;
  }

  .result-hero,
  .metric,
  .story-panel {
    box-shadow: none;
  }
}
