:root {
  color-scheme: light;
  --page: #f7f9fc;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #68738a;
  --line: #dfe5ee;
  --line-strong: #cbd5e2;
  --blue: #2463eb;
  --blue-dark: #174bbd;
  --blue-soft: #eef4ff;
  --summary: #f1f6fc;
  --warning: #a9511e;
  --warning-soft: #fff4eb;
  --error: #a22d42;
  --error-soft: #fff0f2;
  --shadow: 0 10px 28px rgb(22 36 63 / 5%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% -10%, rgb(213 229 255 / 72%), transparent 32rem),
    var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: calc(100% - 48px);
  max-width: 1440px;
  margin: 0 auto;
  padding: 56px 0 88px;
}

.hero {
  position: relative;
  margin-bottom: 36px;
}

.hero::after {
  display: block;
  width: min(100%, 680px);
  height: 1px;
  margin-top: 29px;
  background: linear-gradient(90deg, rgb(36 99 235 / 35%), transparent);
  content: "";
}

.site-footer {
  width: calc(100% - 48px);
  max-width: 1440px;
  margin: -48px auto 0;
  color: #8793a8;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-align: center;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 700px;
  margin-bottom: 14px;
  font-size: clamp(2rem, 4.5vw, 3.3rem);
  letter-spacing: -0.045em;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 2.5vw, 1.8rem);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.hero-copy {
  max-width: none;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.02rem;
  white-space: nowrap;
}

.panel {
  border: 1px solid #d9e2ee;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 14px 35px rgb(22 36 63 / 7%);
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.input-panel,
.summary-panel,
.gap-panel {
  padding: clamp(22px, 4vw, 36px);
}

.input-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 100%), rgb(250 252 255 / 100%));
}

.input-panel::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #2463eb, #8db6ff, transparent);
  content: "";
}

.summary-panel {
  position: relative;
  overflow: hidden;
  border-color: #cbd9ea;
  box-shadow: 0 16px 38px rgb(28 74 146 / 10%);
}

.summary-panel::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #122c63, #4384f7, transparent);
  content: "";
}

.section-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.section-note {
  max-width: 390px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.input-intro {
  display: block;
}

.input-intro .section-note {
  max-width: 620px;
  margin-top: 12px;
  text-align: left;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 24px 0 0;
  border: 0;
}

fieldset + fieldset {
  margin-top: 26px;
}

legend {
  margin-bottom: 17px;
  padding: 0;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 720;
}

.legend-note {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 450;
}

.form-grid {
  display: grid;
  gap: 20px;
}

.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.one-column {
  grid-template-columns: minmax(0, 340px);
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  min-height: 44px;
  margin-bottom: 8px;
  color: #303b50;
  font-size: 0.87rem;
  font-weight: 650;
}

.tooltip-wrap {
  position: relative;
  display: inline-flex;
  margin-left: 4px;
  vertical-align: middle;
}

.tooltip-trigger {
  display: inline-grid;
  width: 17px;
  height: 17px;
  padding: 0;
  place-items: center;
  border: 1px solid #aebbd0;
  border-radius: 50%;
  background: #f6f8fc;
  color: #596b87;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

.tooltip-trigger:hover,
.tooltip-trigger:focus-visible {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.tooltip-trigger:focus-visible {
  outline: 2px solid rgb(36 99 235 / 25%);
  outline-offset: 2px;
}

.tooltip-bubble {
  position: absolute;
  z-index: 10;
  bottom: calc(100% + 9px);
  left: 50%;
  width: min(260px, 70vw);
  padding: 10px 11px;
  border: 1px solid #31425f;
  border-radius: 7px;
  background: #25344f;
  color: #fff;
  box-shadow: 0 8px 18px rgb(23 32 51 / 18%);
  font-size: 0.74rem;
  font-weight: 450;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 5px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.tooltip-bubble::after {
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 9px;
  height: 9px;
  border-right: 1px solid #31425f;
  border-bottom: 1px solid #31425f;
  background: #25344f;
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.tooltip-wrap:hover .tooltip-bubble,
.tooltip-trigger:focus-visible + .tooltip-bubble {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.required {
  color: var(--blue);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 260px;
  padding: 20px;
  resize: vertical;
  border-color: #cbd9ea;
  background: var(--summary);
  font-size: 0.92rem;
  line-height: 1.65;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(36 99 235 / 14%);
}

input:hover,
select:hover {
  border-color: #9eacc1;
}

input:invalid:not(:placeholder-shown) {
  border-color: #cf697b;
}

.field-help {
  min-height: 38px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.form-actions,
.summary-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.form-actions {
  margin-top: 30px;
}

.button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 700;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible {
  outline: 3px solid rgb(36 99 235 / 25%);
  outline-offset: 2px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.button-primary {
  background: linear-gradient(135deg, #2c70f0, #1e58d2);
  color: #fff;
  box-shadow: 0 5px 13px rgb(36 99 235 / 20%);
}

.button-primary:hover {
  background: linear-gradient(135deg, #2566e5, #174bbd);
  box-shadow: 0 7px 16px rgb(36 99 235 / 27%);
}

.form-footnote {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.alert {
  margin-top: 18px;
  padding: 13px 15px;
  border-radius: 7px;
  font-size: 0.86rem;
}

.alert-error {
  border: 1px solid #f0c2ca;
  background: var(--error-soft);
  color: var(--error);
}

.alert-error ul {
  margin: 0;
  padding-left: 20px;
}

.results-stack {
  display: grid;
  gap: 24px;
  min-width: 0;
  margin-top: 0;
  position: sticky;
  top: 24px;
}

.summary-panel {
  background: var(--surface);
}

.summary-intro {
  margin-bottom: 10px;
}

.summary-note {
  max-width: none;
  margin-bottom: 18px;
  text-align: left;
}

.summary-actions {
  margin-top: 15px;
}

.action-status {
  color: #357052;
  font-size: 0.82rem;
}

.warning-text {
  color: var(--warning);
}

.revenue-spotlight {
  margin: 4px 0 8px;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.revenue-spotlight-story {
  margin: 0 0 16px;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.55;
}

.revenue-spotlight-story strong {
  font-weight: 750;
}

.revenue-callout {
  padding: 18px 20px 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, #fde8d4 0%, #f9d9bc 100%);
  text-align: left;
}

.revenue-callout-amount {
  margin: 0 0 4px;
  color: #c45a12;
  font-size: clamp(2.1rem, 4.5vw, 2.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.revenue-callout-caption {
  margin: 0;
  color: #b45309;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.4;
}

.metrics-list {
  padding-top: 2px;
}

.metric-group {
  padding-top: 24px;
}

.metric-group + .metric-group {
  margin-top: 22px;
  padding-top: 22px;
}

.metric-group h3 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  min-height: 49px;
  padding: 13px 0;
  border-bottom: 1px solid #edf0f5;
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-label {
  color: #4c5870;
  font-size: 0.9rem;
}

.metric-value {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.metric-row.highlight {
  margin: 3px -12px;
  padding: 13px 12px;
  border-radius: 7px;
  background: var(--warning-soft);
  border-bottom-color: transparent;
}

.metric-row.highlight .metric-label,
.metric-row.highlight .metric-value {
  color: var(--warning);
}

.metric-row.projected .metric-value {
  color: var(--blue-dark);
}

.limitations {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.limitations::before {
  content: "Note: ";
  color: var(--ink);
  font-weight: 700;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .calculator-layout {
    grid-template-columns: 1fr;
  }

  .results-stack {
    position: static;
    margin-top: 24px;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 28px, 620px);
    padding-top: 38px;
  }

  .site-footer {
    width: calc(100% - 28px);
    margin-top: -42px;
  }

  .section-intro {
    display: block;
  }

  .hero-copy {
    white-space: normal;
  }

  .section-note {
    margin-top: 10px;
    text-align: left;
  }

  .three-columns {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .field label,
  .field-help {
    min-height: auto;
  }

  .field-help {
    margin-bottom: 2px;
  }

  .form-actions {
    display: block;
  }

  .form-actions .button {
    width: 100%;
  }

  .form-footnote {
    margin-top: 12px;
  }
}

@media (max-width: 460px) {
  .page-shell {
    width: min(100% - 20px, 620px);
  }

  .input-panel,
  .summary-panel,
  .gap-panel {
    padding: 20px 17px;
  }

  .revenue-spotlight {
    padding: 16px;
  }

  .revenue-callout {
    padding: 14px 16px;
  }

  .metric-row {
    align-items: flex-start;
    gap: 12px;
  }

  .metric-value {
    max-width: 45%;
    white-space: normal;
  }

  .summary-actions {
    display: block;
  }

  .summary-actions .button {
    width: 100%;
  }

  .action-status {
    display: inline-block;
    margin-top: 10px;
  }
}
