:root {
  color-scheme: light;
  --blue: #1658e6;
  --blue-dark: #0e3fa9;
  --ink: #102133;
  --muted: #526577;
  --line: #d5e0e9;
  --soft: #f3f7fb;
  --surface: #ffffff;
  --bad: #9c2525;
  --bad-soft: #fff1f1;
  --good: #14633f;
  --good-soft: #eaf7f0;
  --neutral: #735d00;
  --neutral-soft: #fff8da;
  --focus: #ffbf47;
  --shadow: 0 18px 50px rgb(23 48 74 / 8%);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --space-section: clamp(48px, 7vw, 72px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  background: #f7f9fc;
  color: var(--ink);
  font: 16px/1.55 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; }
button, input, select, summary { touch-action: manipulation; }
img, svg, canvas { max-width: 100%; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  transform: translateY(-150%);
  transition: transform .15s ease;
}
.skip-link:focus { transform: translateY(0); }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 40px auto;
  padding: clamp(28px, 5vw, 64px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

h1, h2, h3, h4 { color: var(--ink); text-wrap: balance; }
h1 { max-width: 900px; margin: .8em 0 .65em; font-size: clamp(2.25rem, 5vw, 4rem); line-height: 1.05; letter-spacing: -.035em; }
h2 { margin: .45em 0 .35em; font-size: clamp(1.85rem, 4vw, 3rem); line-height: 1.15; letter-spacing: -.025em; }
h3 { margin: 0; font-size: clamp(1.35rem, 2vw, 1.65rem); line-height: 1.2; }
h4 { margin: 0 0 12px; font-size: 1.05rem; line-height: 1.3; }
p, li, dd { overflow-wrap: anywhere; }
.lead { max-width: 820px; color: var(--muted); font-size: 1.2rem; }
.eyebrow, .category-label {
  margin: 0;
  color: var(--blue-dark);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.helper, .fine { color: var(--muted); font-size: .9rem; }
.fine { max-width: 78ch; }

button {
  min-height: 48px;
  padding: 13px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
button:hover { background: var(--blue-dark); }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.link { padding-inline: 0; background: transparent; color: var(--blue-dark); }
.link:hover { background: transparent; text-decoration: underline; }

.wizard-head {
  display: grid;
  gap: 10px;
  margin-bottom: 32px;
  color: var(--ink);
  font-weight: 750;
}
.wizard-head progress { height: 10px; }
progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #dfe8f0;
  accent-color: var(--blue);
}
progress::-webkit-progress-bar { background: #dfe8f0; border-radius: 999px; }
progress::-webkit-progress-value { background: var(--blue); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--blue); border-radius: 999px; }

fieldset { margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 20px; color: var(--ink); font-size: clamp(1.7rem, 3vw, 2rem); font-weight: 800; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
label { display: grid; min-width: 0; gap: 7px; color: var(--ink); font-weight: 700; }
input, select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 13px;
  border: 1px solid #aebfcd;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
input:hover, select:hover { border-color: #7f96a8; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; }
fieldset > button[data-next] { margin-top: 30px; }

.error, .notice {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--bad);
  border-radius: var(--radius-sm);
  background: var(--bad-soft);
  color: #721b1b;
}
.error { font-weight: 650; }
.notice.neutral { border-left-color: #c69b00; background: var(--neutral-soft); color: var(--neutral); }

.result-hero {
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid #dce6ef;
  border-radius: 18px;
  background: linear-gradient(135deg, #f6f9fd 0%, #edf4ff 100%);
}
.result-hero p:not(.eyebrow) { max-width: 78ch; color: var(--muted); }
.result-hero small { color: var(--muted); }

.report-section { margin-top: var(--space-section); scroll-margin-top: 20px; }
.section-heading { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 14px; align-items: start; margin-bottom: 22px; }
.section-heading p:not(.section-number) { margin: 6px 0 0; color: var(--muted); }
.section-number {
  display: grid;
  width: 38px;
  height: 38px;
  margin: 0;
  place-items: center;
  border-radius: 10px;
  background: #e9f1ff;
  color: var(--blue-dark);
  font-size: .78rem;
  font-weight: 850;
}

.cards { display: grid; gap: 16px; }
.cards.three, .financial-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards article {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 5px 18px rgb(26 55 85 / 5%);
}
.cards article p:last-child { margin-bottom: 0; }
.financial-grid article { border-top: 4px solid #8eafe9; }
.financial-grid article:nth-child(2) { border-top-color: #37a58a; }
.financial-grid article:nth-child(3) { border-top-color: #8267cb; }
.financial-grid article:nth-child(4) { border-top-color: #278557; }
.financial-grid article:nth-child(5) { border-top-color: #708090; }
.financial-grid article:nth-child(6) { border-top-color: var(--blue); }
.metric-value { display: block; color: var(--ink); font-size: clamp(1.22rem, 2vw, 1.5rem); font-weight: 850; line-height: 1.2; font-variant-numeric: tabular-nums; }

.funnel-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.funnel-summary article {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}
.funnel-summary span { color: var(--muted); font-size: .85rem; font-weight: 700; }
.funnel-summary strong { color: var(--ink); font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.reconciliation { display: flex; gap: 8px; align-items: baseline; margin: 14px 0 0; font-weight: 750; }

.metrics { display: grid; gap: 12px; }
.metrics.v2-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics > div { min-width: 0; padding: 17px; border: 1px solid #e0e8ef; border-radius: 11px; background: var(--soft); }
.metrics dt, .compact-metrics dt { color: var(--muted); font-size: .8rem; font-weight: 700; }
.metrics dd, .compact-metrics dd { margin: 7px 0 0; font-variant-numeric: tabular-nums; }
.compact-metrics { display: grid; gap: 12px; margin: 0; }
.compact-metrics > div + div { padding-top: 10px; border-top: 1px solid var(--line); }
.scenario-card h4 { margin-bottom: 18px; }

.negative { color: var(--bad) !important; }
.positive { color: var(--good) !important; }
.unavailable { color: var(--muted) !important; font-style: normal; }
.empty-state { padding: 18px; border: 1px dashed #aec0ce; border-radius: 12px; background: var(--soft); color: var(--muted); }

.dimensions { display: grid; gap: 16px; }
.dimensions > div { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(180px, 3fr) 45px; align-items: center; gap: 14px; }
.dimensions span { font-weight: 650; }
.dimensions strong { text-align: right; font-variant-numeric: tabular-nums; }

.recommendation-list { counter-reset: recommendation; }
.recommendation-card { position: relative; padding-left: 24px !important; border-left: 4px solid #8ca2b4 !important; }
.recommendation-card:before {
  counter-increment: recommendation;
  content: counter(recommendation);
  position: absolute;
  top: 18px;
  right: 18px;
  color: #b2c0cb;
  font-size: 1.5rem;
  font-weight: 850;
}
.priority-badge { display: inline-flex; margin: 0 0 8px; padding: 4px 9px; border-radius: 999px; font-size: .72rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.priority-high { background: #fde3e3; color: #7f1e1e; }
.priority-medium { background: #fff0c7; color: #674e00; }
.priority-low { background: #e4f0ff; color: #164b91; }
.category-label { margin-bottom: 12px; }
.impact-line { padding: 11px 13px; border-radius: 9px; background: var(--soft); }

.next-actions { padding: 24px; border: 1px solid #c8d8e6; border-radius: var(--radius-md); background: #f8fbfe; }
.next-actions ol { padding-left: 22px; }
.post-results, [data-premium], [data-software-section], [data-software-unavailable] { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.post-results form { display: grid; max-width: 620px; gap: 14px; }
.check { display: flex; align-items: flex-start; font-weight: 400; }
.check input { width: auto; min-height: auto; margin-top: 5px; }

details { padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
summary { font-weight: 800; cursor: pointer; }
details[open] summary { margin-bottom: 14px; }
.print-only { display: none; }

@media (max-width: 900px) {
  .cards.three, .financial-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel-summary, .metrics.v2-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .shell { width: 100%; margin: 0; padding: 28px 18px 48px; border: 0; border-radius: 0; box-shadow: none; }
  h1 { font-size: clamp(2.15rem, 12vw, 3rem); }
  .grid, .cards.three, .financial-grid, .funnel-summary, .metrics.v2-metrics { grid-template-columns: 1fr; }
  .actions { align-items: stretch; }
  .actions button { flex: 1; }
  button { max-width: 100%; white-space: normal; }
  .section-heading { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
  .section-number { width: 32px; height: 32px; }
  .dimensions > div { grid-template-columns: minmax(0, 1fr) 42px; gap: 8px 12px; }
  .dimensions progress { grid-column: 1 / -1; grid-row: 2; }
  .dimensions strong { grid-column: 2; grid-row: 1; }
  .recommendation-card { padding: 18px !important; }
  .recommendation-card:before { display: none; }
  .metric-value { font-size: 1.25rem; }
}

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

@media (prefers-contrast: more) {
  :root { --line: #718292; --muted: #344a5d; }
  .cards article, .funnel-summary article, .metrics > div { box-shadow: none; }
}

@page { size: auto; margin: 16mm 13mm 18mm; }

@media print {
  :root { --ink: #111; --muted: #444; --line: #aaa; --soft: #f4f4f4; }
  html, body { background: #fff; color: #111; font-size: 10pt; }
  body { overflow: visible; }
  .shell { width: 100%; margin: 0; padding: 0; overflow: visible; border: 0; border-radius: 0; box-shadow: none; }
  #landing, #assessment-form, button, .post-results, [data-premium], [data-software-section], [data-software-unavailable] { display: none !important; }
  .print-only { display: flex; }
  .print-header, .print-footer { justify-content: space-between; gap: 20px; color: #444; font-size: 8.5pt; }
  .print-header { margin-bottom: 8mm; padding-bottom: 3mm; border-bottom: 1px solid #999; }
  .print-footer { margin-top: 8mm; padding-top: 3mm; border-top: 1px solid #999; }
  .result-hero { padding: 7mm; border: 1px solid #aaa; background: #f5f5f5 !important; }
  .report-section { margin-top: 9mm; break-inside: auto; }
  .section-heading { margin-bottom: 4mm; }
  .section-number { border: 1px solid #999; background: transparent; color: #111; }
  .cards.three, .financial-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .funnel-summary, .metrics.v2-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cards article, .funnel-summary article, .metrics > div, .recommendation-card { break-inside: avoid; box-shadow: none; }
  .recommendation-list { display: block; }
  .recommendation-card { margin-bottom: 4mm; }
  .dimensions > div { break-inside: avoid; }
  progress { border: 1px solid #777; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  details { break-inside: avoid; }
  details > * { display: block; }
  .next-actions { break-before: auto; }
  .priority-badge, .financial-grid article, .result-hero { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}
